Skip to content

Commit

Permalink
bugfix: Fixed turrets breaking on cross Z-level move (#4487)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladisvell authored Feb 24, 2024
1 parent 267aea3 commit 11c3951
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions code/datums/components/proximity_monitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@
/datum/component/proximity_monitor/RegisterWithParent()
if(ismovable(hasprox_receiver))
RegisterSignal(hasprox_receiver, COMSIG_MOVABLE_MOVED, PROC_REF(on_receiver_move))
RegisterSignal(hasprox_receiver, COMSIG_MOVABLE_Z_CHANGED, PROC_REF(on_receiver_move))
RegisterSignal(hasprox_receiver, COMSIG_MOVABLE_DISPOSING, PROC_REF(on_disposal_enter))
RegisterSignal(hasprox_receiver, COMSIG_MOVABLE_EXIT_DISPOSALS, PROC_REF(on_disposal_exit))
map_nested_locs()

/datum/component/proximity_monitor/UnregisterFromParent()
if(ismovable(hasprox_receiver))
UnregisterSignal(hasprox_receiver, list(COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_DISPOSING, COMSIG_MOVABLE_EXIT_DISPOSALS))
UnregisterSignal(hasprox_receiver, list(COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_DISPOSING, COMSIG_MOVABLE_EXIT_DISPOSALS, COMSIG_MOVABLE_Z_CHANGED))
clear_nested_locs()

/**
Expand Down Expand Up @@ -149,6 +150,7 @@
continue
nested_receiver_locs += loc_to_check
RegisterSignal(loc_to_check, COMSIG_MOVABLE_MOVED, PROC_REF(on_nested_loc_move))
RegisterSignal(loc_to_check, COMSIG_MOVABLE_Z_CHANGED, PROC_REF(recenter_prox_checkers))
RegisterSignal(loc_to_check, COMSIG_MOVABLE_DISPOSING, PROC_REF(on_disposal_enter))
RegisterSignal(loc_to_check, COMSIG_MOVABLE_EXIT_DISPOSALS, PROC_REF(on_disposal_exit))
loc_to_check = loc_to_check.loc
Expand All @@ -158,7 +160,7 @@
*/
/datum/component/proximity_monitor/proc/clear_nested_locs()
for(var/nested_loc in nested_receiver_locs)
UnregisterSignal(nested_loc, list(COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_DISPOSING, COMSIG_MOVABLE_EXIT_DISPOSALS))
UnregisterSignal(nested_loc, list(COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_DISPOSING, COMSIG_MOVABLE_EXIT_DISPOSALS, COMSIG_MOVABLE_Z_CHANGED))
nested_receiver_locs = list()

/**
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/portable_turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
spark_system.set_up(5, 0, src)
spark_system.attach(src)

AddComponent(/datum/component/proximity_monitor, scan_range)
AddComponent(/datum/component/proximity_monitor, scan_range, TRUE)
setup()

/obj/machinery/porta_turret/HasProximity(atom/movable/AM)
Expand Down

0 comments on commit 11c3951

Please sign in to comment.