diff --git a/code/game/machinery/vending/vendor_types/crew/vehicle_crew.dm b/code/game/machinery/vending/vendor_types/crew/vehicle_crew.dm index 53853f7d4e8b..6e0a52c8248d 100644 --- a/code/game/machinery/vending/vendor_types/crew/vehicle_crew.dm +++ b/code/game/machinery/vending/vendor_types/crew/vehicle_crew.dm @@ -51,15 +51,21 @@ malfunction() return -/obj/structure/machinery/cm_vending/gear/vehicle_crew/proc/populate_products(datum/source, obj/vehicle/multitile/V) +/obj/structure/machinery/cm_vending/gear/vehicle_crew/proc/populate_products(datum/source, obj/vehicle/multitile/ordered) SIGNAL_HANDLER UnregisterSignal(SSdcs, COMSIG_GLOB_VEHICLE_ORDERED) - if(!selected_vehicle) - selected_vehicle = "TANK" // The whole thing seems to be based upon the assumption you unlock tank as an override, defaulting to APC - if(selected_vehicle == "TANK") - available_categories &= ~(VEHICLE_INTEGRAL_AVAILABLE) //APC lacks these, so we need to remove these flags to be able to access spare parts section - marine_announcement("A tank is being sent up to reinforce this operation.") + if(istype(ordered, /obj/vehicle/multitile/tank)) + selected_vehicle = "TANK" + available_categories = VEHICLE_ALL_AVAILABLE + + else if(istype(ordered, /obj/vehicle/multitile/arc)) + selected_vehicle = "ARC" + available_categories = VEHICLE_ALL_AVAILABLE + + else if(istype(ordered, /obj/vehicle/multitile/apc)) + selected_vehicle = "APC" + available_categories = VEHICLE_PRIMARY_AVAILABLE|VEHICLE_SECONDARY_AVAILABLE|VEHICLE_SUPPORT_AVAILABLE|VEHICLE_TREADS_AVAILABLE /obj/structure/machinery/cm_vending/gear/vehicle_crew/get_listed_products(mob/user) var/list/display_list = list() @@ -76,7 +82,7 @@ else if(selected_vehicle == "ARC") display_list = GLOB.cm_vending_vehicle_crew_arc - else if(selected_vehicle == "TANK") + else if(selected_vehicle == "APC") if(available_categories) display_list = GLOB.cm_vending_vehicle_crew_apc else //APC stuff costs more to prevent 4000 points spent on shitton of ammunition diff --git a/code/game/objects/items/circuitboards/computer.dm b/code/game/objects/items/circuitboards/computer.dm index ecdfba00719d..78196500c020 100644 --- a/code/game/objects/items/circuitboards/computer.dm +++ b/code/game/objects/items/circuitboards/computer.dm @@ -224,18 +224,6 @@ /obj/item/circuitboard/computer/supplycomp/vehicle name = "Circuit board (vehicle ASRS console)" build_path = /obj/structure/machinery/computer/supplycomp/vehicle - var/spent = FALSE //so that they can't just reconstruct the console to get another APC - var/tank_unlocked = FALSE - -/obj/item/circuitboard/computer/supplycomp/vehicle/construct(obj/structure/machinery/computer/supplycomp/vehicle/SCV) - if (..(SCV)) - SCV.spent = spent - SCV.tank_unlocked = tank_unlocked - -/obj/item/circuitboard/computer/supplycomp/vehicle/disassemble(obj/structure/machinery/computer/supplycomp/vehicle/SCV) - if (..(SCV)) - spent = SCV.spent - tank_unlocked = SCV.tank_unlocked /obj/item/circuitboard/computer/operating name = "Circuit board (Operating Computer)" diff --git a/code/game/supplyshuttle.dm b/code/game/supplyshuttle.dm index c1d0352766a6..80cdead85e19 100644 --- a/code/game/supplyshuttle.dm +++ b/code/game/supplyshuttle.dm @@ -1322,12 +1322,9 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) desc = "A console for an Automated Storage and Retrieval System. This one is tied to a deep storage unit for vehicles." req_access = list(ACCESS_MARINE_CREWMAN) circuit = /obj/item/circuitboard/computer/supplycomp/vehicle - // Can only retrieve one vehicle per round - var/spent = FALSE - var/tank_unlocked = TRUE - var/list/allowed_roles = list(JOB_TANK_CREW) - var/list/vehicles + var/list/allowed_roles = list(JOB_TANK_CREW) + var/list/in_stock /datum/vehicle_order var/name = "vehicle order" @@ -1337,18 +1334,15 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) var/failure_message = "Not enough resources were allocated to repair this vehicle during this operation.
" /datum/vehicle_order/proc/has_vehicle_lock() - return FALSE + return !unlocked -/datum/vehicle_order/proc/on_created(obj/vehicle/V) +/datum/vehicle_order/proc/on_created(obj/vehicle/order) return /datum/vehicle_order/tank name = "M34A2 Longstreet Light Tank" ordered_vehicle = /obj/effect/vehicle_spawner/tank/decrepit -/datum/vehicle_order/tank/has_vehicle_lock() - return - /datum/vehicle_order/tank/broken name = "Smashed M34A2 Longstreet Light Tank" ordered_vehicle = /obj/effect/vehicle_spawner/tank/hull/broken @@ -1359,34 +1353,27 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) /datum/vehicle_order/apc name = "M577 Armored Personnel Carrier" - ordered_vehicle = /obj/effect/vehicle_spawner/apc/decrepit + ordered_vehicle = /obj/effect/vehicle_spawner/apc/decrepit/fpw /datum/vehicle_order/apc/med name = "M577-MED Armored Personnel Carrier" - ordered_vehicle = /obj/effect/vehicle_spawner/apc_med/decrepit + ordered_vehicle = /obj/effect/vehicle_spawner/apc/decrepit/med /datum/vehicle_order/apc/cmd name = "M577-CMD Armored Personnel Carrier" - ordered_vehicle = /obj/effect/vehicle_spawner/apc_cmd/decrepit + ordered_vehicle = /obj/effect/vehicle_spawner/apc/decrepit/cmd /datum/vehicle_order/apc/empty name = "Barebones M577 Armored Personal Carrier" - ordered_vehicle = /obj/effect/vehicle_spawner/apc/unarmed/broken + ordered_vehicle = /obj/effect/vehicle_spawner/apc/decrepit/empty /datum/vehicle_order/arc name = "M540-B Armored Recon Carrier" ordered_vehicle = /obj/effect/vehicle_spawner/arc -/datum/vehicle_order/arc/has_vehicle_lock() - return - /obj/structure/machinery/computer/supplycomp/vehicle/Initialize() . = ..() - vehicles = list( - new /datum/vehicle_order/tank/plain - ) - if(!GLOB.VehicleElevatorConsole) GLOB.VehicleElevatorConsole = src @@ -1398,7 +1385,7 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) if(inoperable()) return - if(LAZYLEN(allowed_roles) && !allowed_roles.Find(H.job)) //replaced Z-level restriction with role restriction. + if(length(allowed_roles) && !allowed_roles.Find(H.job)) to_chat(H, SPAN_WARNING("This console isn't for you.")) return @@ -1415,29 +1402,25 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) return dat += "Platform position: " - if (SSshuttle.vehicle_elevator.mode != SHUTTLE_IDLE) + if(SSshuttle.vehicle_elevator.mode != SHUTTLE_IDLE) dat += "Moving" else if(is_mainship_level(SSshuttle.vehicle_elevator.z)) - dat += "Raised" - if(!spent) - dat += "
\[Lower\]" + dat += "Raised
" + dat += "Lower platform
" else dat += "Lowered" - dat += "

" - - if(spent) - dat += "No vehicles are available for retrieval." - else - dat += "Available vehicles:
" - - for(var/d in vehicles) - var/datum/vehicle_order/VO = d + dat += "

" - if(VO.has_vehicle_lock()) - dat += VO.failure_message + if(in_stock) + dat += "Available vehicles:
" + for(var/datum/vehicle_order/order as anything in in_stock) + if(order.has_vehicle_lock()) + dat += order.failure_message + else + dat += "[order.name]
" else - dat += "[VO.name]
" + dat += "No vehicles are available for retrieval." show_browser(H, dat, "Automated Storage and Retrieval System", "computer", "size=575x450") @@ -1445,49 +1428,47 @@ GLOBAL_DATUM_INIT(supply_controller, /datum/controller/supply, new()) . = ..() if(.) return - if(!is_mainship_level(z)) - return - if(spent) - return + if(!GLOB.supply_controller) world.log << "## ERROR: Eek. The GLOB.supply_controller controller datum is missing somehow." return - if (!SSshuttle.vehicle_elevator) + if(!SSshuttle.vehicle_elevator) world.log << "## ERROR: Eek. The supply/elevator datum is missing somehow." return - if(isturf(loc) && ( in_range(src, usr) || isSilicon(usr) ) ) + if(isturf(loc) && (in_range(src, usr) || isSilicon(usr))) usr.set_interaction(src) - if(href_list["get_vehicle"]) - if(is_mainship_level(SSshuttle.vehicle_elevator.z) || SSshuttle.vehicle_elevator.mode != SHUTTLE_IDLE) - to_chat(usr, SPAN_WARNING("The elevator needs to be in the cargo bay dock to call a vehicle up!")) + if(href_list["lower_platform"]) + if(!is_mainship_level(SSshuttle.vehicle_elevator.z)) return - // dunno why the +1 is needed but the vehicles spawn off-center - var/turf/middle_turf = get_turf(SSshuttle.vehicle_elevator) + SSshuttle.vehicle_elevator.request(SSshuttle.getDock("adminlevel vehicle")) - var/obj/vehicle/multitile/ordered_vehicle + if(!is_admin_level(SSshuttle.vehicle_elevator.z)) + return - var/datum/vehicle_order/VO = locate(href_list["get_vehicle"]) - if(!(VO in vehicles)) + if(href_list["get_vehicle"]) + if(!is_admin_level(SSshuttle.vehicle_elevator.z)) return - if(VO?.has_vehicle_lock()) + var/turf/middle_turf = get_turf(SSshuttle.vehicle_elevator) + var/datum/vehicle_order/order = locate(href_list["get_vehicle"]) + if(!order) return - spent = TRUE - ordered_vehicle = new VO.ordered_vehicle(middle_turf) - SSshuttle.vehicle_elevator.request(SSshuttle.getDock("almayer vehicle")) - VO.on_created(ordered_vehicle) + if(order.has_vehicle_lock()) + return - SEND_GLOBAL_SIGNAL(COMSIG_GLOB_VEHICLE_ORDERED, ordered_vehicle) + in_stock -= order - else if(href_list["lower_elevator"]) - if(!is_mainship_level(SSshuttle.vehicle_elevator.z)) - return + var/obj/effect/vehicle_spawner/vehicle_spawner = new order.ordered_vehicle(middle_turf) + var/obj/vehicle/multitile/ordered_vehicle = vehicle_spawner.spawn_vehicle() + SSshuttle.vehicle_elevator.request(SSshuttle.getDock("almayer vehicle")) - SSshuttle.vehicle_elevator.request(SSshuttle.getDock("adminlevel vehicle")) + order.on_created(ordered_vehicle) + + SEND_GLOBAL_SIGNAL(COMSIG_GLOB_VEHICLE_ORDERED, ordered_vehicle) add_fingerprint(usr) updateUsrDialog() diff --git a/code/modules/cm_tech/implements/tank.dm b/code/modules/cm_tech/implements/tank.dm index 9cd8a5c6a804..e0b51e06abef 100644 --- a/code/modules/cm_tech/implements/tank.dm +++ b/code/modules/cm_tech/implements/tank.dm @@ -12,13 +12,11 @@ icon_state = "pamphlet_written" item_state = "pamphlet_written" var/vehicle_type = /datum/vehicle_order/apc/empty - var/vehicle_category = "APC" /obj/item/vehicle_coupon/tank name = "tank coupon" desc = "We're done playing! This coupon allows the ship crew to retrieve a complete Longstreet tank from Vehicle ASRS. Make sure to send the ASRS lift down so it can be retrieved. One use only. LTB not included. Comes with free friendly fire." vehicle_type = /datum/vehicle_order/tank/broken - vehicle_category = "LONGSTREET" /obj/item/vehicle_coupon/attack_self(mob/user) if(QDELETED(src)) @@ -38,20 +36,15 @@ return . = TRUE - comp.spent = FALSE - QDEL_NULL_LIST(comp.vehicles) - comp.vehicles = list( - new vehicle_type(), - ) + comp.in_stock += new vehicle_type() + comp.allowed_roles = null + comp.req_access = list() comp.req_one_access = list() - comp.spent = FALSE gearcomp.req_access = list() gearcomp.req_one_access = list() gearcomp.vendor_role = list() - gearcomp.selected_vehicle = vehicle_category - gearcomp.available_categories = VEHICLE_ALL_AVAILABLE return TRUE diff --git a/code/modules/cm_tech/techs/marine/tier1/arc.dm b/code/modules/cm_tech/techs/marine/tier1/arc.dm index 1e3a193626c4..118065dbe488 100644 --- a/code/modules/cm_tech/techs/marine/tier1/arc.dm +++ b/code/modules/cm_tech/techs/marine/tier1/arc.dm @@ -12,19 +12,6 @@ flags = TREE_FLAG_MARINE - -/datum/tech/arc/can_unlock(mob/unlocking_mob) - . = ..() - - var/obj/structure/machinery/cm_vending/gear/vehicle_crew/gearcomp = GLOB.VehicleGearConsole - - if(gearcomp.selected_vehicle == "TANK") - to_chat(unlocking_mob, SPAN_WARNING ("A vehicle has already been selected for this operation.")) - return FALSE - - return TRUE - - /datum/tech/arc/on_unlock() . = ..() @@ -34,20 +21,13 @@ if(!comp || !gearcomp) return FALSE - comp.spent = FALSE - QDEL_NULL_LIST(comp.vehicles) - comp.vehicles = list( - new /datum/vehicle_order/arc() - ) + comp.in_stock += new /datum/vehicle_order/arc() comp.allowed_roles = list(JOB_SYNTH, JOB_SEA, JOB_SO, JOB_XO, JOB_CO, JOB_GENERAL) comp.req_access = list(ACCESS_MARINE_COMMAND) comp.req_one_access = list() - comp.spent = FALSE gearcomp.req_access = list(ACCESS_MARINE_COMMAND) gearcomp.req_one_access = list() gearcomp.vendor_role = list() - gearcomp.selected_vehicle = "ARC" - gearcomp.available_categories = VEHICLE_ALL_AVAILABLE return TRUE diff --git a/code/modules/vehicles/apc/apc.dm b/code/modules/vehicles/apc/apc.dm index b7d35f21fbe3..ea34a3bf7042 100644 --- a/code/modules/vehicles/apc/apc.dm +++ b/code/modules/vehicles/apc/apc.dm @@ -25,7 +25,7 @@ GLOBAL_LIST_EMPTY(command_apc_list) "right" = list(-2, 0), "rear left" = list(1, 2), "rear center" = list(0, 2), - "rear right" = list(-1, 2) + "rear right" = list(-1, 2), ) entrance_speed = 0.5 SECONDS @@ -61,6 +61,29 @@ GLOBAL_LIST_EMPTY(command_apc_list) mob_size_required_to_hit = MOB_SIZE_XENO + actions_list = list( + "global" = list( + /obj/vehicle/multitile/proc/get_status_info, + /obj/vehicle/multitile/proc/open_controls_guide, + /obj/vehicle/multitile/proc/name_vehicle, + ), + VEHICLE_DRIVER = list( + /obj/vehicle/multitile/proc/toggle_door_lock, + /obj/vehicle/multitile/proc/activate_horn, + ), + VEHICLE_GUNNER = list( + /obj/vehicle/multitile/proc/switch_hardpoint, + /obj/vehicle/multitile/proc/cycle_hardpoint, + /obj/vehicle/multitile/proc/toggle_shift_click, + ), + VEHICLE_SUPPORT_GUNNER_ONE = list( + /obj/vehicle/multitile/proc/reload_firing_port_weapon, + ), + VEHICLE_SUPPORT_GUNNER_TWO = list( + /obj/vehicle/multitile/proc/reload_firing_port_weapon, + ) + ) + dmg_multipliers = list( "all" = 1, "acid" = 1.6, @@ -100,54 +123,15 @@ GLOBAL_LIST_EMPTY(command_apc_list) /obj/vehicle/multitile/apc/add_seated_verbs(mob/living/M, seat) if(!M.client) return - add_verb(M.client, list( - /obj/vehicle/multitile/proc/get_status_info, - /obj/vehicle/multitile/proc/open_controls_guide - )) - if(seat == VEHICLE_DRIVER) - add_verb(M.client, list( - /obj/vehicle/multitile/proc/toggle_door_lock, - /obj/vehicle/multitile/proc/activate_horn, - /obj/vehicle/multitile/proc/name_vehicle - )) - else if(seat == VEHICLE_GUNNER) - add_verb(M.client, list( - /obj/vehicle/multitile/proc/switch_hardpoint, - /obj/vehicle/multitile/proc/cycle_hardpoint, - /obj/vehicle/multitile/proc/toggle_shift_click, - /obj/vehicle/multitile/proc/name_vehicle - )) - - else if(seat == VEHICLE_SUPPORT_GUNNER_ONE || seat == VEHICLE_SUPPORT_GUNNER_TWO) - add_verb(M.client, list( - /obj/vehicle/multitile/proc/reload_firing_port_weapon - )) + add_verb(M.client, actions_list["global"]) + add_verb(M.client, actions_list[seat]) /obj/vehicle/multitile/apc/remove_seated_verbs(mob/living/M, seat) if(!M.client) return - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/get_status_info, - /obj/vehicle/multitile/proc/open_controls_guide, - )) + remove_verb(M.client, actions_list["global"]) + remove_verb(M.client, actions_list[seat]) SStgui.close_user_uis(M, src) - if(seat == VEHICLE_DRIVER) - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/toggle_door_lock, - /obj/vehicle/multitile/proc/activate_horn, - /obj/vehicle/multitile/proc/name_vehicle, - )) - else if(seat == VEHICLE_GUNNER) - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/switch_hardpoint, - /obj/vehicle/multitile/proc/cycle_hardpoint, - /obj/vehicle/multitile/proc/toggle_shift_click, - /obj/vehicle/multitile/proc/name_vehicle, - )) - else if(seat == VEHICLE_SUPPORT_GUNNER_ONE || seat == VEHICLE_SUPPORT_GUNNER_TWO) - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/reload_firing_port_weapon - )) /obj/vehicle/multitile/apc/initialize_cameras(change_tag = FALSE) if(!camera) @@ -164,131 +148,111 @@ GLOBAL_LIST_EMPTY(command_apc_list) /* ** PRESETS SPAWNERS */ +//Transport version without FPWs +/obj/vehicle/multitile/apc/unarmed + interior_map = /datum/map_template/interior/apc_no_fpw + /obj/effect/vehicle_spawner/apc - name = "APC Transport Spawner" + name = "APC Spawner" icon = 'icons/obj/vehicles/apc.dmi' icon_state = "apc_base" pixel_x = -48 pixel_y = -48 + vehicle_type = /obj/vehicle/multitile/apc/unarmed + + var/fpw = FALSE + +//PRESET: no hardpoints +/obj/effect/vehicle_spawner/apc/spawn_vehicle(obj/vehicle/multitile/spawning) + load_misc(spawning) + if(fpw) + load_fpw(spawning) + load_hardpoints(spawning) + handle_direction(spawning) + spawning.update_icon() + //Installation of transport APC Firing Ports Weapons -/obj/effect/vehicle_spawner/apc/proc/load_fpw(obj/vehicle/multitile/apc/V) - var/obj/item/hardpoint/special/firing_port_weapon/FPW = new - FPW.allowed_seat = VEHICLE_SUPPORT_GUNNER_ONE - V.add_hardpoint(FPW) - FPW.dir = turn(V.dir, 90) - FPW.name = "Left "+ initial(FPW.name) - FPW.origins = list(1, 0) - FPW.muzzle_flash_pos = list( +/obj/effect/vehicle_spawner/apc/proc/load_fpw(obj/vehicle/multitile/spawning)//Here a lot of hardcode, and I don't want to mess with it + var/obj/item/hardpoint/special/firing_port_weapon/fpw_hardpoint = new + fpw_hardpoint.allowed_seat = VEHICLE_SUPPORT_GUNNER_ONE + spawning.add_hardpoint(fpw_hardpoint) + fpw_hardpoint.dir = turn(spawning.dir, 90) + fpw_hardpoint.name = "Left "+ initial(fpw_hardpoint.name) + fpw_hardpoint.origins = list(2, 0) + fpw_hardpoint.muzzle_flash_pos = list( "1" = list(-18, 14), "2" = list(18, -42), "4" = list(34, 3), "8" = list(-32, -34) ) - FPW = new - FPW.allowed_seat = VEHICLE_SUPPORT_GUNNER_TWO - V.add_hardpoint(FPW) - FPW.dir = turn(V.dir, -90) - FPW.name = "Right "+ initial(FPW.name) - FPW.origins = list(-1, 0) - FPW.muzzle_flash_pos = list( + fpw_hardpoint = new + fpw_hardpoint.allowed_seat = VEHICLE_SUPPORT_GUNNER_TWO + spawning.add_hardpoint(fpw_hardpoint) + fpw_hardpoint.dir = turn(spawning.dir, -90) + fpw_hardpoint.name = "Right "+ initial(fpw_hardpoint.name) + fpw_hardpoint.origins = list(-2, 0) + fpw_hardpoint.muzzle_flash_pos = list( "1" = list(16, 14), "2" = list(-18, -42), "4" = list(34, -34), "8" = list(-32, 2) ) -/obj/effect/vehicle_spawner/apc/Initialize() - . = ..() - spawn_vehicle() - qdel(src) - -//PRESET: FPWs, no hardpoints -/obj/effect/vehicle_spawner/apc/spawn_vehicle() - var/obj/vehicle/multitile/apc/APC = new (loc) - - load_misc(APC) - load_fpw(APC) - load_hardpoints(APC) - handle_direction(APC) - APC.update_icon() - -//PRESET: FPWs, wheels installed -/obj/effect/vehicle_spawner/apc/plain/load_hardpoints(obj/vehicle/multitile/apc/V) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/apc_wheels) - -//PRESET: default hardpoints, destroyed (this one spawns on VASRS elevatorfor VCs) -/obj/effect/vehicle_spawner/apc/decrepit/spawn_vehicle() - var/obj/vehicle/multitile/apc/APC = new (loc) - - load_misc(APC) - load_fpw(APC) - load_hardpoints(APC) - handle_direction(APC) - load_damage(APC) - APC.update_icon() - -/obj/effect/vehicle_spawner/apc/decrepit/load_hardpoints(obj/vehicle/multitile/apc/V) - V.add_hardpoint(new /obj/item/hardpoint/primary/dualcannon) - V.add_hardpoint(new /obj/item/hardpoint/secondary/frontalcannon) - V.add_hardpoint(new /obj/item/hardpoint/support/flare_launcher) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/apc_wheels) - -//PRESET: FPWs, default hardpoints -/obj/effect/vehicle_spawner/apc/fixed/load_hardpoints(obj/vehicle/multitile/apc/V) - V.add_hardpoint(new /obj/item/hardpoint/primary/dualcannon) - V.add_hardpoint(new /obj/item/hardpoint/secondary/frontalcannon) - V.add_hardpoint(new /obj/item/hardpoint/support/flare_launcher) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/apc_wheels) - -//Transport version without FPWs - -/obj/vehicle/multitile/apc/unarmed - interior_map = /datum/map_template/interior/apc_no_fpw - -//PRESET: no hardpoints -/obj/effect/vehicle_spawner/apc/unarmed/spawn_vehicle() - var/obj/vehicle/multitile/apc/unarmed/APC = new (loc) +//PRESET: only wheels installed +/obj/effect/vehicle_spawner/apc/plain + hardpoints = list( + /obj/item/hardpoint/locomotion/apc_wheels, + ) - load_misc(APC) - load_hardpoints(APC) - handle_direction(APC) - APC.update_icon() +//PRESET: default hardpoints, destroyed +/obj/effect/vehicle_spawner/apc/decrepit + hardpoints = list( + /obj/item/hardpoint/primary/dualcannon, + /obj/item/hardpoint/secondary/frontalcannon, + /obj/item/hardpoint/support/flare_launcher, + /obj/item/hardpoint/locomotion/apc_wheels, + ) - return APC +/obj/effect/vehicle_spawner/apc/decrepit/spawn_vehicle(obj/vehicle/multitile/spawning) + load_misc(spawning) + if(fpw) + load_fpw(spawning) + load_hardpoints(spawning) + handle_direction(spawning) + load_damage(spawning) + spawning.update_icon() -/obj/effect/vehicle_spawner/apc/unarmed/load_hardpoints(obj/vehicle/multitile/apc/V) - return +//PRESET: destroyed +/obj/effect/vehicle_spawner/apc/decrepit/empty + hardpoints = list() -/obj/effect/vehicle_spawner/apc/unarmed/broken/spawn_vehicle() - var/obj/vehicle/multitile/apc/apc = ..() - load_damage(apc) - apc.update_icon() +//PRESET: default hardpoints +/obj/effect/vehicle_spawner/apc/fixed + hardpoints = list( + /obj/item/hardpoint/primary/dualcannon, + /obj/item/hardpoint/secondary/frontalcannon, + /obj/item/hardpoint/support/flare_launcher, + /obj/item/hardpoint/locomotion/apc_wheels, + ) -//PRESET: default hardpoints, destroyed -/obj/effect/vehicle_spawner/apc/unarmed/decrepit/spawn_vehicle() - var/obj/vehicle/multitile/apc/unarmed/APC = new (loc) +//fpw +/obj/effect/vehicle_spawner/apc/fpw + vehicle_type = /obj/vehicle/multitile/apc + fpw = TRUE - load_misc(APC) - load_hardpoints(APC) - handle_direction(APC) - load_damage(APC) - APC.update_icon() +/obj/effect/vehicle_spawner/apc/plain/fpw + vehicle_type = /obj/vehicle/multitile/apc + fpw = TRUE -/obj/effect/vehicle_spawner/apc/unarmed/decrepit/load_hardpoints(obj/vehicle/multitile/apc/V) - V.add_hardpoint(new /obj/item/hardpoint/primary/dualcannon) - V.add_hardpoint(new /obj/item/hardpoint/secondary/frontalcannon) - V.add_hardpoint(new /obj/item/hardpoint/support/flare_launcher) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/apc_wheels) +/obj/effect/vehicle_spawner/apc/decrepit/fpw + vehicle_type = /obj/vehicle/multitile/apc + fpw = TRUE -//PRESET: no FPWs, wheels installed -/obj/effect/vehicle_spawner/apc/unarmed/plain/load_hardpoints(obj/vehicle/multitile/apc/unarmed/V) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/apc_wheels) +/obj/effect/vehicle_spawner/apc/decrepit/fpw/empty + hardpoints = list() -//PRESET: default hardpoints -/obj/effect/vehicle_spawner/apc/unarmed/fixed/load_hardpoints(obj/vehicle/multitile/apc/unarmed/V) - V.add_hardpoint(new /obj/item/hardpoint/primary/dualcannon) - V.add_hardpoint(new /obj/item/hardpoint/secondary/frontalcannon) - V.add_hardpoint(new /obj/item/hardpoint/support/flare_launcher) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/apc_wheels) +/obj/effect/vehicle_spawner/apc/fixed/fpw + vehicle_type = /obj/vehicle/multitile/apc + fpw = TRUE diff --git a/code/modules/vehicles/apc/apc_command.dm b/code/modules/vehicles/apc/apc_command.dm index 8d056daec2ea..c8f16481b702 100644 --- a/code/modules/vehicles/apc/apc_command.dm +++ b/code/modules/vehicles/apc/apc_command.dm @@ -19,7 +19,7 @@ entrances = list( "left" = list(2, 0), - "right" = list(-2, 0) + "right" = list(-2, 0), ) seats = list( @@ -84,47 +84,6 @@ RRS.total = 1 role_reserved_slots += RRS -/obj/vehicle/multitile/apc/command/add_seated_verbs(mob/living/M, seat) - if(!M.client) - return - add_verb(M.client, list( - /obj/vehicle/multitile/proc/get_status_info, - /obj/vehicle/multitile/proc/open_controls_guide, - /obj/vehicle/multitile/proc/name_vehicle, - )) - if(seat == VEHICLE_DRIVER) - add_verb(M.client, list( - /obj/vehicle/multitile/proc/toggle_door_lock, - /obj/vehicle/multitile/proc/activate_horn, - )) - else if(seat == VEHICLE_GUNNER) - add_verb(M.client, list( - /obj/vehicle/multitile/proc/switch_hardpoint, - /obj/vehicle/multitile/proc/cycle_hardpoint, - /obj/vehicle/multitile/proc/toggle_shift_click, - )) - -/obj/vehicle/multitile/apc/command/remove_seated_verbs(mob/living/M, seat) - if(!M.client) - return - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/get_status_info, - /obj/vehicle/multitile/proc/open_controls_guide, - /obj/vehicle/multitile/proc/name_vehicle, - )) - SStgui.close_user_uis(M, src) - if(seat == VEHICLE_DRIVER) - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/toggle_door_lock, - /obj/vehicle/multitile/proc/activate_horn, - )) - else if(seat == VEHICLE_GUNNER) - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/switch_hardpoint, - /obj/vehicle/multitile/proc/cycle_hardpoint, - /obj/vehicle/multitile/proc/toggle_shift_click, - )) - /obj/vehicle/multitile/apc/command/initialize_cameras(change_tag = FALSE) if(!camera) camera = new /obj/structure/machinery/camera/vehicle(src) @@ -202,50 +161,21 @@ /* ** PRESETS SPAWNERS */ -/obj/effect/vehicle_spawner/apc_cmd - name = "APC CMD Spawner" - icon = 'icons/obj/vehicles/apc.dmi' +/obj/effect/vehicle_spawner/apc/cmd icon_state = "apc_base_com" - pixel_x = -48 - pixel_y = -48 + vehicle_type = /obj/vehicle/multitile/apc/command -/obj/effect/vehicle_spawner/apc_cmd/Initialize() - . = ..() - spawn_vehicle() - qdel(src) - -//PRESET: no hardpoints -/obj/effect/vehicle_spawner/apc_cmd/spawn_vehicle() - var/obj/vehicle/multitile/apc/command/APC = new (loc) - - load_misc(APC) - load_hardpoints(APC) - handle_direction(APC) - APC.update_icon() - -//PRESET: only wheels installed -/obj/effect/vehicle_spawner/apc_cmd/plain/load_hardpoints(obj/vehicle/multitile/apc/command/V) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/apc_wheels) - -//PRESET: default hardpoints, destroyed -/obj/effect/vehicle_spawner/apc_cmd/decrepit/spawn_vehicle() - var/obj/vehicle/multitile/apc/command/APC = new (loc) - - load_misc(APC) - handle_direction(APC) - load_hardpoints(APC) - load_damage(APC) - APC.update_icon() - -/obj/effect/vehicle_spawner/apc_cmd/decrepit/load_hardpoints(obj/vehicle/multitile/apc/command/V) - V.add_hardpoint(new /obj/item/hardpoint/primary/dualcannon) - V.add_hardpoint(new /obj/item/hardpoint/secondary/frontalcannon) - V.add_hardpoint(new /obj/item/hardpoint/support/flare_launcher) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/apc_wheels) - -//PRESET: default hardpoints -/obj/effect/vehicle_spawner/apc_cmd/fixed/load_hardpoints(obj/vehicle/multitile/apc/command/V) - V.add_hardpoint(new /obj/item/hardpoint/primary/dualcannon) - V.add_hardpoint(new /obj/item/hardpoint/secondary/frontalcannon) - V.add_hardpoint(new /obj/item/hardpoint/support/flare_launcher) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/apc_wheels) +/obj/effect/vehicle_spawner/apc/plain/cmd + icon_state = "apc_base_com" + vehicle_type = /obj/vehicle/multitile/apc/command + +/obj/effect/vehicle_spawner/apc/decrepit/cmd + icon_state = "apc_base_com" + vehicle_type = /obj/vehicle/multitile/apc/command + +/obj/effect/vehicle_spawner/apc/decrepit/cmd/empty + hardpoints = list() + +/obj/effect/vehicle_spawner/apc/fixed/cmd + icon_state = "apc_base_com" + vehicle_type = /obj/vehicle/multitile/apc/command diff --git a/code/modules/vehicles/apc/apc_medical.dm b/code/modules/vehicles/apc/apc_medical.dm index 7d462e7da27b..cef40a48cb23 100644 --- a/code/modules/vehicles/apc/apc_medical.dm +++ b/code/modules/vehicles/apc/apc_medical.dm @@ -16,7 +16,7 @@ entrances = list( "left" = list(2, 0), - "right" = list(-2, 0) + "right" = list(-2, 0), ) seats = list( @@ -42,47 +42,6 @@ RRS.total = 1 role_reserved_slots += RRS -/obj/vehicle/multitile/apc/medical/add_seated_verbs(mob/living/M, seat) - if(!M.client) - return - add_verb(M.client, list( - /obj/vehicle/multitile/proc/get_status_info, - /obj/vehicle/multitile/proc/open_controls_guide, - /obj/vehicle/multitile/proc/name_vehicle, - )) - if(seat == VEHICLE_DRIVER) - add_verb(M.client, list( - /obj/vehicle/multitile/proc/toggle_door_lock, - /obj/vehicle/multitile/proc/activate_horn, - )) - else if(seat == VEHICLE_GUNNER) - add_verb(M.client, list( - /obj/vehicle/multitile/proc/switch_hardpoint, - /obj/vehicle/multitile/proc/cycle_hardpoint, - /obj/vehicle/multitile/proc/toggle_shift_click, - )) - -/obj/vehicle/multitile/apc/medical/remove_seated_verbs(mob/living/M, seat) - if(!M.client) - return - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/get_status_info, - /obj/vehicle/multitile/proc/open_controls_guide, - /obj/vehicle/multitile/proc/name_vehicle, - )) - SStgui.close_user_uis(M, src) - if(seat == VEHICLE_DRIVER) - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/toggle_door_lock, - /obj/vehicle/multitile/proc/activate_horn, - )) - else if(seat == VEHICLE_GUNNER) - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/switch_hardpoint, - /obj/vehicle/multitile/proc/cycle_hardpoint, - /obj/vehicle/multitile/proc/toggle_shift_click, - )) - /obj/vehicle/multitile/apc/medical/initialize_cameras(change_tag = FALSE) if(!camera) camera = new /obj/structure/machinery/camera/vehicle(src) @@ -98,50 +57,21 @@ /* ** PRESETS SPAWNERS */ -/obj/effect/vehicle_spawner/apc_med - name = "APC MED Spawner" - icon = 'icons/obj/vehicles/apc.dmi' +/obj/effect/vehicle_spawner/apc/med + icon_state = "apc_base_med" + vehicle_type = /obj/vehicle/multitile/apc/medical + +/obj/effect/vehicle_spawner/apc/plain/med + icon_state = "apc_base_med" + vehicle_type = /obj/vehicle/multitile/apc/medical + +/obj/effect/vehicle_spawner/apc/decrepit/med + icon_state = "apc_base_med" + vehicle_type = /obj/vehicle/multitile/apc/medical + +/obj/effect/vehicle_spawner/apc/decrepit/med/empty + hardpoints = list() + +/obj/effect/vehicle_spawner/apc/fixed/med icon_state = "apc_base_med" - pixel_x = -48 - pixel_y = -48 - -/obj/effect/vehicle_spawner/apc_med/Initialize() - . = ..() - spawn_vehicle() - qdel(src) - -//PRESET: no hardpoints -/obj/effect/vehicle_spawner/apc_med/spawn_vehicle() - var/obj/vehicle/multitile/apc/medical/APC = new (loc) - - load_misc(APC) - load_hardpoints(APC) - handle_direction(APC) - APC.update_icon() - -//PRESET: only wheels installed -/obj/effect/vehicle_spawner/apc_med/plain/load_hardpoints(obj/vehicle/multitile/apc/medical/V) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/apc_wheels) - -//PRESET: default hardpoints, destroyed -/obj/effect/vehicle_spawner/apc_med/decrepit/spawn_vehicle() - var/obj/vehicle/multitile/apc/medical/APC = new (loc) - - load_misc(APC) - load_hardpoints(APC) - handle_direction(APC) - load_damage(APC) - APC.update_icon() - -/obj/effect/vehicle_spawner/apc_med/decrepit/load_hardpoints(obj/vehicle/multitile/apc/medical/V) - V.add_hardpoint(new /obj/item/hardpoint/primary/dualcannon) - V.add_hardpoint(new /obj/item/hardpoint/secondary/frontalcannon) - V.add_hardpoint(new /obj/item/hardpoint/support/flare_launcher) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/apc_wheels) - -//PRESET: default hardpoints -/obj/effect/vehicle_spawner/apc_med/fixed/load_hardpoints(obj/vehicle/multitile/apc/medical/V) - V.add_hardpoint(new /obj/item/hardpoint/primary/dualcannon) - V.add_hardpoint(new /obj/item/hardpoint/secondary/frontalcannon) - V.add_hardpoint(new /obj/item/hardpoint/support/flare_launcher) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/apc_wheels) + vehicle_type = /obj/vehicle/multitile/apc/medical diff --git a/code/modules/vehicles/arc/arc.dm b/code/modules/vehicles/arc/arc.dm index 8f5a8ee5d8e9..a92fe760a958 100644 --- a/code/modules/vehicles/arc/arc.dm +++ b/code/modules/vehicles/arc/arc.dm @@ -50,6 +50,17 @@ mob_size_required_to_hit = MOB_SIZE_XENO + actions_list = list( + "global" = list( + /obj/vehicle/multitile/proc/get_status_info, + /obj/vehicle/multitile/arc/proc/open_arc_controls_guide, + /obj/vehicle/multitile/proc/toggle_door_lock, + /obj/vehicle/multitile/proc/activate_horn, + /obj/vehicle/multitile/proc/name_vehicle, + /obj/vehicle/multitile/arc/proc/toggle_antenna, + ) + ) + dmg_multipliers = list( "all" = 1, "acid" = 1.8, @@ -173,26 +184,12 @@ /obj/vehicle/multitile/arc/add_seated_verbs(mob/living/M, seat) if(!M.client) return - add_verb(M.client, list( - /obj/vehicle/multitile/proc/get_status_info, - /obj/vehicle/multitile/arc/proc/open_arc_controls_guide, - /obj/vehicle/multitile/proc/toggle_door_lock, - /obj/vehicle/multitile/proc/activate_horn, - /obj/vehicle/multitile/proc/name_vehicle, - /obj/vehicle/multitile/arc/proc/toggle_antenna, - )) + add_verb(M.client, actions_list["global"]) /obj/vehicle/multitile/arc/remove_seated_verbs(mob/living/M, seat) if(!M.client) return - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/get_status_info, - /obj/vehicle/multitile/arc/proc/open_arc_controls_guide, - /obj/vehicle/multitile/proc/toggle_door_lock, - /obj/vehicle/multitile/proc/activate_horn, - /obj/vehicle/multitile/proc/name_vehicle, - /obj/vehicle/multitile/arc/proc/toggle_antenna, - )) + remove_verb(M.client, actions_list["global"]) SStgui.close_user_uis(M, src) /obj/vehicle/multitile/arc/initialize_cameras(change_tag = FALSE) @@ -251,20 +248,16 @@ pixel_x = -48 pixel_y = -48 -/obj/effect/vehicle_spawner/arc/Initialize() - . = ..() - spawn_vehicle() - return INITIALIZE_HINT_QDEL - -/obj/effect/vehicle_spawner/arc/spawn_vehicle() - var/obj/vehicle/multitile/arc/ARC = new (loc) + vehicle_type = /obj/vehicle/multitile/arc - load_misc(ARC) - load_hardpoints(ARC) - handle_direction(ARC) - ARC.update_icon() + hardpoints = list( + /obj/item/hardpoint/primary/arc_sentry, + /obj/item/hardpoint/support/arc_antenna, + /obj/item/hardpoint/locomotion/arc_wheels, + ) -/obj/effect/vehicle_spawner/arc/load_hardpoints(obj/vehicle/multitile/arc/vehicle) - vehicle.add_hardpoint(new /obj/item/hardpoint/locomotion/arc_wheels) - vehicle.add_hardpoint(new /obj/item/hardpoint/primary/arc_sentry) - vehicle.add_hardpoint(new /obj/item/hardpoint/support/arc_antenna) +/obj/effect/vehicle_spawner/arc/spawn_vehicle(obj/vehicle/multitile/spawning) + load_misc(spawning) + load_hardpoints(spawning) + handle_direction(spawning) + spawning.update_icon() diff --git a/code/modules/vehicles/multitile/multitile.dm b/code/modules/vehicles/multitile/multitile.dm index ce118fd14c56..f06e80334137 100644 --- a/code/modules/vehicles/multitile/multitile.dm +++ b/code/modules/vehicles/multitile/multitile.dm @@ -145,7 +145,7 @@ var/list/misc_multipliers = list( "move" = 1.0, "accuracy" = 1.0, - "cooldown" = 1 + "cooldown" = 1, ) //Changes how much damage the vehicle takes @@ -156,7 +156,8 @@ "bullet" = 1.0, "explosive" = 1.0, "blunt" = 1.0, - "abstract" = 1.0) //abstract for when you just want to hurt it + "abstract" = 1.0, + ) //abstract for when you just want to hurt it // This is more important than you think. // Explosive waves can propagate through the vehicle and hit it multiple times @@ -303,8 +304,8 @@ health = max(0, health - floor(damage * get_dmg_multi(type) / 10)) if(ismob(attacker)) - var/mob/M = attacker - log_attack("[src] took [damage] [type] damage from [M] ([M.client ? M.client.ckey : "disconnected"]).") + var/mob/attacker_mob = attacker + log_attack("[src] took [damage] [type] damage from [attacker_mob] ([attacker_mob.client ? attacker_mob.client.ckey : "disconnected"]).") else log_attack("[src] took [damage] [type] damage from [attacker].") update_icon() @@ -316,29 +317,29 @@ return ..() // Add/remove verbs that should be given when a mob sits down or unbuckles here -/obj/vehicle/multitile/proc/add_seated_verbs(mob/living/M, seat) +/obj/vehicle/multitile/proc/add_seated_verbs(mob/living/sitting, seat) return -/obj/vehicle/multitile/proc/remove_seated_verbs(mob/living/M, seat) +/obj/vehicle/multitile/proc/remove_seated_verbs(mob/living/sitting, seat) return -/obj/vehicle/multitile/set_seated_mob(seat, mob/living/M) +/obj/vehicle/multitile/set_seated_mob(seat, mob/living/sitting) // Give/remove verbs - if(QDELETED(M)) - var/mob/living/L = seats[seat] - remove_seated_verbs(L, seat) + if(QDELETED(sitting)) + var/mob/living/old_sitting = seats[seat] + remove_seated_verbs(old_sitting, seat) else - add_seated_verbs(M, seat) + add_seated_verbs(sitting, seat) - seats[seat] = M + seats[seat] = sitting // Checked here because we want to be able to null the mob in a seat - if(!istype(M)) + if(!istype(sitting)) return FALSE - M.set_interaction(src) - M.reset_view(src) - give_action(M, /datum/action/human_action/vehicle_unbuckle) + sitting.set_interaction(src) + sitting.reset_view(src) + give_action(sitting, /datum/action/human_action/vehicle_unbuckle) return TRUE /// Get crewmember of seat. @@ -346,9 +347,9 @@ return seats[seat] /// Get seat of crewmember. -/obj/vehicle/multitile/proc/get_mob_seat(mob/M) +/obj/vehicle/multitile/proc/get_mob_seat(mob/sitting) for(var/seat in seats) - if(seats[seat] == M) + if(seats[seat] == sitting) return seat return null @@ -395,50 +396,62 @@ /obj/effect/vehicle_spawner name = "Vehicle Spawner" + var/vehicle_type + var/list/hardpoints = list() + +/obj/effect/vehicle_spawner/Initialize(mapload, override_type) + . = ..() + if(override_type) + vehicle_type = override_type + + spawn_vehicle(new vehicle_type(loc)) + return INITIALIZE_HINT_QDEL + //Main proc which handles spawning and adding hardpoints/damaging the vehicle -/obj/effect/vehicle_spawner/proc/spawn_vehicle() +/obj/effect/vehicle_spawner/proc/spawn_vehicle(obj/vehicle/multitile/spawning) return //Installation of modules kit -/obj/effect/vehicle_spawner/proc/load_hardpoints(obj/vehicle/multitile/V) - return +/obj/effect/vehicle_spawner/proc/load_hardpoints(obj/vehicle/multitile/spawning) + for(var/obj in hardpoints) + spawning.add_hardpoint(new obj) //Miscellaneous additions -/obj/effect/vehicle_spawner/proc/load_misc(obj/vehicle/multitile/V) +/obj/effect/vehicle_spawner/proc/load_misc(obj/vehicle/multitile/spawning) - V.load_role_reserved_slots() - V.initialize_cameras() + spawning.load_role_reserved_slots() + spawning.initialize_cameras() //transfer mapped in edits if(color) - V.color = color + spawning.color = color if(name != initial(name)) - V.name = name + spawning.name = name if(desc) - V.desc = desc + spawning.desc = desc //Dealing enough damage to destroy the vehicle -/obj/effect/vehicle_spawner/proc/load_damage(obj/vehicle/multitile/V) - V.take_damage_type(1e8, "abstract") - V.take_damage_type(1e8, "abstract") - V.healthcheck() +/obj/effect/vehicle_spawner/proc/load_damage(obj/vehicle/multitile/spawning) + spawning.take_damage_type(1e8, "abstract") + spawning.take_damage_type(1e8, "abstract") + spawning.healthcheck() -/obj/effect/vehicle_spawner/proc/handle_direction(obj/vehicle/multitile/M) +/obj/effect/vehicle_spawner/proc/handle_direction(obj/vehicle/multitile/spawning) switch(dir) if(EAST) - M.try_rotate(90) + spawning.try_rotate(90) if(WEST) - M.try_rotate(-90) + spawning.try_rotate(-90) if(NORTH) - M.try_rotate(90) - M.try_rotate(90) + spawning.try_rotate(90) + spawning.try_rotate(90) /obj/vehicle/multitile/get_applying_acid_time() return 3 SECONDS //handling dangerous acidic environment, like acidic spray or toxic waters, maybe toxic vapor in future -/obj/vehicle/multitile/proc/handle_acidic_environment(atom/A) - for(var/obj/item/hardpoint/locomotion/Loco in hardpoints) - Loco.handle_acid_damage(A) +/obj/vehicle/multitile/proc/handle_acidic_environment(atom/hazard) + for(var/obj/item/hardpoint/locomotion/loco in hardpoints) + loco.handle_acid_damage(hazard) /atom/movable/vehicle_light_holder light_system = MOVABLE_LIGHT diff --git a/code/modules/vehicles/tank/tank.dm b/code/modules/vehicles/tank/tank.dm index 1cc1174c43fe..2bd51ada4fc7 100644 --- a/code/modules/vehicles/tank/tank.dm +++ b/code/modules/vehicles/tank/tank.dm @@ -63,6 +63,24 @@ VEHICLE_GUNNER = null, ) + actions_list = list( + "global" = list( + /obj/vehicle/multitile/proc/get_status_info, + /obj/vehicle/multitile/proc/switch_hardpoint, + /obj/vehicle/multitile/proc/open_controls_guide, + /obj/vehicle/multitile/proc/name_vehicle, + ), + VEHICLE_DRIVER = list( + /obj/vehicle/multitile/proc/toggle_door_lock, + /obj/vehicle/multitile/proc/activate_horn, + ), + VEHICLE_GUNNER = list( + /obj/vehicle/multitile/proc/cycle_hardpoint, + /obj/vehicle/multitile/proc/toggle_gyrostabilizer, + /obj/vehicle/multitile/proc/toggle_shift_click, + ) + ) + dmg_multipliers = list( "all" = 1, "acid" = 1.5, // Acid melts the tank @@ -70,7 +88,7 @@ "bullet" = 0.4, "explosive" = 0.8, "blunt" = 0.8, - "abstract" = 1 + "abstract" = 1, ) explosive_resistance = 400 @@ -100,46 +118,15 @@ /obj/vehicle/multitile/tank/add_seated_verbs(mob/living/M, seat) if(!M.client) return - add_verb(M.client, list( - /obj/vehicle/multitile/proc/switch_hardpoint, - /obj/vehicle/multitile/proc/get_status_info, - /obj/vehicle/multitile/proc/open_controls_guide, - /obj/vehicle/multitile/proc/name_vehicle, - )) - if(seat == VEHICLE_DRIVER) - add_verb(M.client, list( - /obj/vehicle/multitile/proc/toggle_door_lock, - /obj/vehicle/multitile/proc/activate_horn, - )) - else if(seat == VEHICLE_GUNNER) - add_verb(M.client, list( - /obj/vehicle/multitile/proc/cycle_hardpoint, - /obj/vehicle/multitile/proc/toggle_gyrostabilizer, - /obj/vehicle/multitile/proc/toggle_shift_click, - )) - + add_verb(M.client, actions_list["global"]) + add_verb(M.client, actions_list[seat]) /obj/vehicle/multitile/tank/remove_seated_verbs(mob/living/M, seat) if(!M.client) return - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/get_status_info, - /obj/vehicle/multitile/proc/open_controls_guide, - /obj/vehicle/multitile/proc/name_vehicle, - /obj/vehicle/multitile/proc/switch_hardpoint, - )) + remove_verb(M.client, actions_list["global"]) + remove_verb(M.client, actions_list[seat]) SStgui.close_user_uis(M, src) - if(seat == VEHICLE_DRIVER) - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/toggle_door_lock, - /obj/vehicle/multitile/proc/activate_horn, - )) - else if(seat == VEHICLE_GUNNER) - remove_verb(M.client, list( - /obj/vehicle/multitile/proc/cycle_hardpoint, - /obj/vehicle/multitile/proc/toggle_gyrostabilizer, - /obj/vehicle/multitile/proc/toggle_shift_click, - )) //Called when players try to move vehicle //Another wrapper for try_move() @@ -208,100 +195,117 @@ pixel_x = -48 pixel_y = -48 -/obj/effect/vehicle_spawner/tank/Initialize() - . = ..() - spawn_vehicle() - qdel(src) + vehicle_type = /obj/vehicle/multitile/tank -//PRESET: turret, no hardpoints (not the one without turret for convenience, you still expect to have turret when you spawn "no hardpoints tank") -/obj/effect/vehicle_spawner/tank/spawn_vehicle() - var/obj/vehicle/multitile/tank/TANK = new (loc) + hardpoints = list( + /obj/item/hardpoint/holder/tank_turret, + ) - load_misc(TANK) - load_hardpoints(TANK) - handle_direction(TANK) - TANK.update_icon() + var/list/turret_hardpoints = list() - return TANK +//PRESET: turret, no hardpoints (not the one without turret for convenience, you still expect to have turret when you spawn "no hardpoints tank") +/obj/effect/vehicle_spawner/tank/spawn_vehicle(obj/vehicle/multitile/spawning) + load_misc(spawning) + load_hardpoints(spawning) + handle_direction(spawning) + spawning.update_icon() -/obj/effect/vehicle_spawner/tank/load_hardpoints(obj/vehicle/multitile/tank/V) - V.add_hardpoint(new /obj/item/hardpoint/holder/tank_turret) +/obj/effect/vehicle_spawner/tank/load_hardpoints(obj/vehicle/multitile/spawning) + . = ..() + var/obj/item/hardpoint/holder/tank_turret/turret = locate() in spawning.hardpoints + if(turret) + for(var/obj in turret_hardpoints) + turret.add_hardpoint(new obj) //PRESET: turret, treads installed -/obj/effect/vehicle_spawner/tank/plain/load_hardpoints(obj/vehicle/multitile/tank/V) - V.add_hardpoint(new /obj/item/hardpoint/holder/tank_turret) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/treads) +/obj/effect/vehicle_spawner/tank/plain + hardpoints = list( + /obj/item/hardpoint/holder/tank_turret, + /obj/item/hardpoint/locomotion/treads, + ) //PRESET: no hardpoints -/obj/effect/vehicle_spawner/tank/hull/load_hardpoints(obj/vehicle/multitile/tank/V) - return +/obj/effect/vehicle_spawner/tank/hull + hardpoints = list() //Just the hull and it's broken TOO, you get the full experience -/obj/effect/vehicle_spawner/tank/hull/broken/spawn_vehicle() - var/obj/vehicle/multitile/tank/tonk = ..() - load_damage(tonk) - tonk.update_icon() +/obj/effect/vehicle_spawner/tank/hull/broken/spawn_vehicle(obj/vehicle/multitile/spawning) + load_damage(spawning) + spawning.update_icon() //PRESET: default hardpoints, destroyed -/obj/effect/vehicle_spawner/tank/decrepit/spawn_vehicle() - var/obj/vehicle/multitile/tank/TANK = new (loc) - - load_misc(TANK) - handle_direction(TANK) - load_hardpoints(TANK) - load_damage(TANK) - TANK.update_icon() - -/obj/effect/vehicle_spawner/tank/decrepit/load_hardpoints(obj/vehicle/multitile/tank/V) - V.add_hardpoint(new /obj/item/hardpoint/support/artillery_module) - V.add_hardpoint(new /obj/item/hardpoint/armor/paladin) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/treads) - V.add_hardpoint(new /obj/item/hardpoint/holder/tank_turret) - for(var/obj/item/hardpoint/holder/tank_turret/TT in V.hardpoints) - TT.add_hardpoint(new /obj/item/hardpoint/primary/cannon) - TT.add_hardpoint(new /obj/item/hardpoint/secondary/m56cupola) - break +/obj/effect/vehicle_spawner/tank/decrepit + hardpoints = list( + /obj/item/hardpoint/support/artillery_module, + /obj/item/hardpoint/armor/paladin, + /obj/item/hardpoint/holder/tank_turret, + /obj/item/hardpoint/locomotion/treads, + ) + + turret_hardpoints = list( + /obj/item/hardpoint/primary/cannon, + /obj/item/hardpoint/secondary/m56cupola, + ) + +/obj/effect/vehicle_spawner/tank/decrepit/spawn_vehicle(obj/vehicle/multitile/spawning) + load_misc(spawning) + handle_direction(spawning) + load_hardpoints(spawning) + load_damage(spawning) + spawning.update_icon() //PRESET: default hardpoints -/obj/effect/vehicle_spawner/tank/fixed/load_hardpoints(obj/vehicle/multitile/tank/V) - V.add_hardpoint(new /obj/item/hardpoint/support/artillery_module) - V.add_hardpoint(new /obj/item/hardpoint/armor/paladin) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/treads) - V.add_hardpoint(new /obj/item/hardpoint/holder/tank_turret) - for(var/obj/item/hardpoint/holder/tank_turret/TT in V.hardpoints) - TT.add_hardpoint(new /obj/item/hardpoint/primary/cannon) - TT.add_hardpoint(new /obj/item/hardpoint/secondary/m56cupola) - break +/obj/effect/vehicle_spawner/tank/fixed + hardpoints = list( + /obj/item/hardpoint/support/artillery_module, + /obj/item/hardpoint/armor/paladin, + /obj/item/hardpoint/holder/tank_turret, + /obj/item/hardpoint/locomotion/treads, + ) + + turret_hardpoints = list( + /obj/item/hardpoint/primary/cannon, + /obj/item/hardpoint/secondary/m56cupola, + ) //PRESET: minigun kit -/obj/effect/vehicle_spawner/tank/fixed/minigun/load_hardpoints(obj/vehicle/multitile/tank/V) - V.add_hardpoint(new /obj/item/hardpoint/support/weapons_sensor) - V.add_hardpoint(new /obj/item/hardpoint/armor/ballistic) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/treads) - V.add_hardpoint(new /obj/item/hardpoint/holder/tank_turret) - for(var/obj/item/hardpoint/holder/tank_turret/TT in V.hardpoints) - TT.add_hardpoint(new /obj/item/hardpoint/primary/minigun) - TT.add_hardpoint(new /obj/item/hardpoint/secondary/small_flamer) - break +/obj/effect/vehicle_spawner/tank/fixed/minigun + hardpoints = list( + /obj/item/hardpoint/support/weapons_sensor, + /obj/item/hardpoint/armor/ballistic, + /obj/item/hardpoint/holder/tank_turret, + /obj/item/hardpoint/locomotion/treads, + ) + + turret_hardpoints = list( + /obj/item/hardpoint/primary/minigun, + /obj/item/hardpoint/secondary/small_flamer, + ) //PRESET: dragon flamer kit -/obj/effect/vehicle_spawner/tank/fixed/flamer/load_hardpoints(obj/vehicle/multitile/tank/V) - V.add_hardpoint(new /obj/item/hardpoint/support/overdrive_enhancer) - V.add_hardpoint(new /obj/item/hardpoint/armor/ballistic) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/treads) - V.add_hardpoint(new /obj/item/hardpoint/holder/tank_turret) - for(var/obj/item/hardpoint/holder/tank_turret/TT in V.hardpoints) - TT.add_hardpoint(new /obj/item/hardpoint/primary/flamer) - TT.add_hardpoint(new /obj/item/hardpoint/secondary/grenade_launcher) - break +/obj/effect/vehicle_spawner/tank/fixed/flamer + hardpoints = list( + /obj/item/hardpoint/support/overdrive_enhancer, + /obj/item/hardpoint/armor/ballistic, + /obj/item/hardpoint/holder/tank_turret, + /obj/item/hardpoint/locomotion/treads, + ) + + turret_hardpoints = list( + /obj/item/hardpoint/primary/flamer, + /obj/item/hardpoint/secondary/grenade_launcher, + ) //PRESET: autocannon kit -/obj/effect/vehicle_spawner/tank/fixed/autocannon/load_hardpoints(obj/vehicle/multitile/tank/V) - V.add_hardpoint(new /obj/item/hardpoint/support/artillery_module) - V.add_hardpoint(new /obj/item/hardpoint/armor/ballistic) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/treads) - V.add_hardpoint(new /obj/item/hardpoint/holder/tank_turret) - for(var/obj/item/hardpoint/holder/tank_turret/TT in V.hardpoints) - TT.add_hardpoint(new /obj/item/hardpoint/primary/autocannon) - TT.add_hardpoint(new /obj/item/hardpoint/secondary/towlauncher) - break +/obj/effect/vehicle_spawner/tank/fixed/autocannon + hardpoints = list( + /obj/item/hardpoint/support/artillery_module, + /obj/item/hardpoint/armor/ballistic, + /obj/item/hardpoint/holder/tank_turret, + /obj/item/hardpoint/locomotion/treads, + ) + + turret_hardpoints = list( + /obj/item/hardpoint/primary/autocannon, + /obj/item/hardpoint/secondary/towlauncher, + ) diff --git a/code/modules/vehicles/van/van.dm b/code/modules/vehicles/van/van.dm index a2e7d68bf9de..b16dbacce032 100644 --- a/code/modules/vehicles/van/van.dm +++ b/code/modules/vehicles/van/van.dm @@ -255,40 +255,35 @@ pixel_x = -16 pixel_y = -16 -/obj/effect/vehicle_spawner/van/Initialize() - . = ..() - spawn_vehicle() - qdel(src) + vehicle_type = /obj/vehicle/multitile/van //PRESET: no hardpoints -/obj/effect/vehicle_spawner/van/spawn_vehicle() - var/obj/vehicle/multitile/van/VAN = new (loc) - - load_misc(VAN) - handle_direction(VAN) - VAN.update_icon() +/obj/effect/vehicle_spawner/van/spawn_vehicle(obj/vehicle/multitile/spawning) + load_misc(spawning) + handle_direction(spawning) + spawning.update_icon() //PRESET: wheels installed, destroyed -/obj/effect/vehicle_spawner/van/decrepit/spawn_vehicle() - var/obj/vehicle/multitile/van/VAN = new (loc) - - load_misc(VAN) - load_hardpoints(VAN) - handle_direction(VAN) - load_damage(VAN) - VAN.update_icon() +/obj/effect/vehicle_spawner/van/decrepit + hardpoints = list( + /obj/item/hardpoint/locomotion/van_wheels, + ) -/obj/effect/vehicle_spawner/van/decrepit/load_hardpoints(obj/vehicle/multitile/van/V) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/van_wheels) +/obj/effect/vehicle_spawner/van/decrepit/spawn_vehicle(obj/vehicle/multitile/spawning) + load_misc(spawning) + load_hardpoints(spawning) + handle_direction(spawning) + load_damage(spawning) + spawning.update_icon() //PRESET: wheels installed -/obj/effect/vehicle_spawner/van/fixed/spawn_vehicle() - var/obj/vehicle/multitile/van/VAN = new (loc) - - load_misc(VAN) - load_hardpoints(VAN) - handle_direction(VAN) - VAN.update_icon() +/obj/effect/vehicle_spawner/van/fixed + hardpoints = list( + /obj/item/hardpoint/locomotion/van_wheels, + ) -/obj/effect/vehicle_spawner/van/fixed/load_hardpoints(obj/vehicle/multitile/van/V) - V.add_hardpoint(new /obj/item/hardpoint/locomotion/van_wheels) +/obj/effect/vehicle_spawner/van/fixed/spawn_vehicle(obj/vehicle/multitile/spawning) + load_misc(spawning) + load_hardpoints(spawning) + handle_direction(spawning) + spawning.update_icon() diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index c78be6fa57ec..f6c14a6ee7fe 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -33,6 +33,11 @@ var/charge_use = 5 can_block_movement = TRUE + var/list/actions_list = list( + "global" = null, + VEHICLE_DRIVER = null + ) + //------------------------------------------- // Standard procs //-------------------------------------------