Skip to content

Commit

Permalink
Made electric vehicles no longer ignore EMPs (#11234)
Browse files Browse the repository at this point in the history
* emps

* figured out a better way

* gave it smoke and made it depend on severity

* this should work
  • Loading branch information
XeonMations authored Aug 1, 2024
1 parent 881fdae commit eb1b198
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions code/datums/components/riding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
var/ride_check_ridden_restrained = FALSE

var/del_on_unbuckle_all = FALSE
var/emped = FALSE
var/empable = FALSE

/datum/component/riding/Initialize()
if(!ismovable(parent))
return COMPONENT_INCOMPATIBLE
RegisterSignal(parent, COMSIG_MOVABLE_BUCKLE, PROC_REF(vehicle_mob_buckle))
RegisterSignal(parent, COMSIG_MOVABLE_UNBUCKLE, PROC_REF(vehicle_mob_unbuckle))
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(vehicle_moved))
RegisterSignal(parent, COMSIG_ATOM_EMP_ACT, PROC_REF(on_emp_act))
//Calculate the move multiplier speed, to be proportional to mob speed
vehicle_move_multiplier = CONFIG_GET(number/movedelay/run_delay) / 1.5

Expand Down Expand Up @@ -171,6 +174,9 @@
return
last_vehicle_move = world.time

if(emped && empable)
to_chat(user, "<span class='notice'>\The [AM]'s controls aren't responding!</span>")
return
if(keycheck(user))
var/turf/next = get_step(AM, direction)
var/turf/current = get_turf(AM)
Expand Down Expand Up @@ -414,3 +420,18 @@
var/mob/living/simple_animal/S = parent
S.toggle_ai(AI_ON)
..()

/datum/component/riding/proc/on_emp_act(datum/source, severity)
SIGNAL_HANDLER

if(!empable)
return
emped = TRUE
var/atom/movable/AM = parent
AM.add_emitter(/obj/emitter/fire_smoke, "smoke")
addtimer(CALLBACK(src, PROC_REF(reboot)), 300 / severity, TIMER_UNIQUE|TIMER_OVERRIDE) //if a new EMP happens, remove the old timer so it doesn't reactivate early

/datum/component/riding/proc/reboot()
emped = FALSE
var/atom/movable/AM = parent
AM.remove_emitter("smoke")
1 change: 1 addition & 0 deletions code/modules/vehicles/atv.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
. = ..()
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
D.vehicle_move_delay = 1.5
D.empable = TRUE
D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 4), TEXT_SOUTH = list(0, 4), TEXT_EAST = list(0, 4), TEXT_WEST = list( 0, 4)))
D.set_vehicle_dir_layer(SOUTH, ABOVE_MOB_LAYER)
D.set_vehicle_dir_layer(NORTH, OBJ_LAYER)
Expand Down
1 change: 1 addition & 0 deletions code/modules/vehicles/motorized_wheelchair.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
power_efficiency = C.rating
var/datum/component/riding/D = GetComponent(/datum/component/riding)
D.vehicle_move_delay = round(1.5 * delay_multiplier) / speed
D.empable = TRUE


/obj/vehicle/ridden/wheelchair/motorized/get_cell()
Expand Down
1 change: 1 addition & 0 deletions code/modules/vehicles/pimpin_ride.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
update_icon()
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 4), TEXT_SOUTH = list(0, 7), TEXT_EAST = list(-12, 7), TEXT_WEST = list( 12, 7)))
D.empable = TRUE
GLOB.janitor_devices += src
if(floorbuffer)
AddElement(/datum/element/cleaning)
Expand Down
1 change: 1 addition & 0 deletions code/modules/vehicles/secway.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
. = ..()
var/datum/component/riding/D = LoadComponent(/datum/component/riding)
D.vehicle_move_delay = 1.5
D.empable = TRUE
D.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 4), TEXT_SOUTH = list(0, 4), TEXT_EAST = list(0, 4), TEXT_WEST = list( 0, 4)))

/obj/vehicle/ridden/secway/obj_break()
Expand Down

0 comments on commit eb1b198

Please sign in to comment.