(code bounty) refactors all uses of Crossed() and Uncrossed() into signals sent to loc, tracked by connect_loc (#58340)

Co-authored-by: Jared-Fogle <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Emmett Gaines <ninjanomnom@gmail.com>
This commit is contained in:
Kylerace
2021-05-07 03:54:03 -07:00
committed by GitHub
co-authored by Jared-Fogle Emmett Gaines
parent 3cabee50b6
commit 08df8798ce
104 changed files with 702 additions and 358 deletions
@@ -161,19 +161,17 @@ GLOBAL_LIST_EMPTY(lifts)
/obj/structure/industrial_lift/Initialize(mapload)
. = ..()
RegisterSignal(src, COMSIG_MOVABLE_CROSSED, .proc/AddItemOnLift)
RegisterSignal(loc, COMSIG_ATOM_CREATED, .proc/AddItemOnLift)//For atoms created on platform
RegisterSignal(src, COMSIG_MOVABLE_UNCROSSED, .proc/UncrossedRemoveItemFromLift)
var/static/list/loc_connections = list(
COMSIG_ATOM_EXITED =.proc/UncrossedRemoveItemFromLift,
COMSIG_ATOM_ENTERED = .proc/AddItemOnLift,
COMSIG_ATOM_CREATED = .proc/AddItemOnLift,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
RegisterSignal(src, COMSIG_MOVABLE_BUMP, .proc/GracefullyBreak)
if(!lift_master_datum)
lift_master_datum = new(src)
/obj/structure/industrial_lift/Move(atom/newloc, direct)
UnregisterSignal(loc, COMSIG_ATOM_CREATED)
. = ..()
RegisterSignal(loc, COMSIG_ATOM_CREATED, .proc/AddItemOnLift)//For atoms created on platform
/obj/structure/industrial_lift/proc/UncrossedRemoveItemFromLift(datum/source, atom/movable/potential_rider)
SIGNAL_HANDLER
RemoveItemFromLift(potential_rider)
+6 -2
View File
@@ -40,6 +40,10 @@
reagents.add_reagent(reagent_id, reagent_capacity)
soundloop = new(list(src), FALSE)
AddComponent(/datum/component/plumbing/simple_demand)
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
/obj/machinery/shower/examine(mob/user)
. = ..()
@@ -133,8 +137,8 @@
qdel(mist)
/obj/machinery/shower/Crossed(atom/movable/AM)
..()
/obj/machinery/shower/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
if(on && reagents.total_volume)
wash_atom(AM)
+6 -2
View File
@@ -322,13 +322,17 @@
. = ..()
debris += new frame
debris += new /obj/item/shard
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
/obj/structure/table/glass/Destroy()
QDEL_LIST(debris)
. = ..()
/obj/structure/table/glass/Crossed(atom/movable/AM)
. = ..()
/obj/structure/table/glass/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
if(flags_1 & NODECONSTRUCT_1)
return
if(!isliving(AM))
+7 -3
View File
@@ -60,8 +60,8 @@
else
animate(src, alpha = initial(alpha), time = time_between_triggers)
/obj/structure/trap/Crossed(atom/movable/AM)
. = ..()
/obj/structure/trap/proc/on_entered(datum/source, atom/movable/AM)
SIGNAL_HANDLER
if(last_trigger + time_between_triggers > world.time)
return
// Don't want the traps triggered by sparks, ghosts or projectiles.
@@ -108,8 +108,12 @@
. = ..()
time_between_triggers = 10
flare_message = "<span class='warning'>[src] snaps shut!</span>"
var/static/list/loc_connections = list(
COMSIG_ATOM_ENTERED = .proc/on_entered,
)
AddElement(/datum/element/connect_loc, src, loc_connections)
/obj/structure/trap/stun/hunter/Crossed(atom/movable/AM)
/obj/structure/trap/stun/hunter/on_entered(datum/source, atom/movable/AM)
if(isliving(AM))
var/mob/living/L = AM
if(!L.mind?.has_antag_datum(/datum/antagonist/fugitive))
@@ -300,7 +300,7 @@
else
windoor.req_access = electronics.accesses
windoor.electronics = electronics
electronics.loc = windoor
electronics.forceMove(windoor)
if(created_name)
windoor.name = created_name
qdel(src)