From 08df8798ceec1519e74c4d36c011c4e5c23bcc2b Mon Sep 17 00:00:00 2001 From: Kylerace Date: Fri, 7 May 2021 03:54:03 -0700 Subject: [PATCH] (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 --- code/__DEFINES/dcs/signals.dm | 14 ++-- code/__HELPERS/unsorted.dm | 10 +-- code/datums/ai/monkey/monkey_controller.dm | 11 +++- code/datums/brain_damage/imaginary_friend.dm | 9 ++- code/datums/components/acid.dm | 6 +- code/datums/components/butchering.dm | 8 ++- code/datums/components/chasm.dm | 2 +- code/datums/components/food/edible.dm | 8 ++- code/datums/components/infective.dm | 7 +- code/datums/components/pellet_cloud.dm | 7 +- code/datums/components/rot.dm | 12 +++- code/datums/components/singularity.dm | 7 +- code/datums/components/slippery.dm | 25 +++++-- code/datums/components/squeak.dm | 26 +++++--- code/datums/components/swarming.dm | 8 ++- code/datums/elements/caltrop.dm | 17 ++++- code/datums/elements/connect_loc.dm | 12 ++-- code/datums/elements/squashable.dm | 50 +++++++------- code/datums/materials/basemats.dm | 2 +- code/game/atoms_movable.dm | 66 ++++++++++--------- code/game/machinery/recycler.dm | 10 ++- code/game/machinery/scan_gate.dm | 10 ++- code/game/machinery/teambuilder.dm | 8 ++- code/game/objects/effects/anomalies.dm | 19 ++++-- code/game/objects/effects/decals/cleanable.dm | 8 ++- .../objects/effects/decals/cleanable/food.dm | 4 +- .../effects/decals/cleanable/humans.dm | 2 +- code/game/objects/effects/decals/misc.dm | 2 +- .../effects/effect_system/effects_smoke.dm | 13 +++- code/game/objects/effects/mines.dm | 8 ++- code/game/objects/effects/portals.dm | 22 ++++--- code/game/objects/effects/powerup.dm | 8 ++- code/game/objects/effects/proximity.dm | 14 +++- code/game/objects/effects/step_triggers.dm | 13 +++- code/game/objects/items.dm | 4 +- code/game/objects/items/clown_items.dm | 10 +-- .../objects/items/devices/pressureplates.dm | 8 ++- .../objects/items/devices/transfer_valve.dm | 6 +- code/game/objects/items/handcuffs.dm | 15 +++-- code/game/objects/items/puzzle_pieces.dm | 7 +- .../game/objects/items/stacks/sheets/glass.dm | 8 ++- code/game/objects/items/stacks/stack.dm | 10 ++- code/game/objects/items/toys.dm | 9 ++- .../objects/structures/industrial_lift.dm | 14 ++-- code/game/objects/structures/shower.dm | 8 ++- code/game/objects/structures/tables_racks.dm | 8 ++- code/game/objects/structures/traps.dm | 10 ++- .../objects/structures/windoor_assembly.dm | 2 +- code/game/turfs/open/space/space.dm | 2 +- code/game/turfs/open/space/transit.dm | 2 +- code/modules/admin/verbs/possess.dm | 4 +- .../abductor/equipment/abduction_gear.dm | 9 ++- .../eldritch_cult/eldritch_structures.dm | 9 ++- code/modules/assembly/bomb.dm | 7 -- code/modules/assembly/holder.dm | 8 +-- code/modules/assembly/infrared.dm | 11 +++- code/modules/assembly/mousetrap.dm | 30 +++++++-- .../atmospherics/environmental/LINDA_fire.dm | 8 ++- .../awaymissions/mission_code/wildwest.dm | 9 ++- .../modules/awaymissions/super_secret_room.dm | 20 ++++-- code/modules/buildmode/effects/line.dm | 2 +- code/modules/clothing/shoes/miscellaneous.dm | 2 +- code/modules/events/immovable_rod.dm | 10 ++- code/modules/events/spacevine.dm | 8 ++- code/modules/fields/turf_objects.dm | 11 ++-- code/modules/flufftext/Hallucination.dm | 30 +++++++-- code/modules/hydroponics/grown/towercap.dm | 11 +++- code/modules/hydroponics/hydroitemdefines.dm | 9 ++- code/modules/mining/equipment/resonator.dm | 6 +- code/modules/mob/camera/camera.dm | 5 -- code/modules/mob/dead/dead.dm | 6 +- .../living/carbon/alien/special/facehugger.dm | 8 ++- code/modules/mob/living/carbon/human/human.dm | 8 ++- .../mob/living/silicon/ai/freelook/eye.dm | 2 +- .../living/simple_animal/bot/SuperBeepsky.dm | 6 +- .../mob/living/simple_animal/bot/cleanbot.dm | 10 ++- .../mob/living/simple_animal/bot/honkbot.dm | 10 ++- .../living/simple_animal/bot/hygienebot.dm | 13 ++-- .../mob/living/simple_animal/bot/mulebot.dm | 17 ++--- .../mob/living/simple_animal/bot/secbot.dm | 8 ++- .../living/simple_animal/friendly/mouse.dm | 12 ++-- .../simple_animal/guardian/types/fire.dm | 11 +++- .../simple_animal/guardian/types/ranged.dm | 10 ++- .../living/simple_animal/hostile/cockroach.dm | 4 +- .../simple_animal/hostile/jungle/leaper.dm | 8 ++- .../hostile/jungle/mega_arachnid.dm | 4 +- .../hostile/megafauna/hierophant.dm | 8 ++- .../hostile/mining_mobs/elites/legionnaire.dm | 10 ++- .../simple_animal/hostile/retaliate/frog.dm | 9 ++- .../simple_animal/hostile/venus_human_trap.dm | 9 ++- code/modules/mob/mob_movement.dm | 2 +- code/modules/plumbing/plumbers/fermenter.dm | 8 ++- .../plumbing/plumbers/grinder_chemical.dm | 8 ++- code/modules/power/lighting.dm | 8 ++- .../power/singularity/containment_field.dm | 8 ++- .../power/singularity/field_generator.dm | 2 +- code/modules/projectiles/projectile.dm | 10 ++- .../projectile/energy/net_snare.dm | 8 +-- .../ruins/objects_and_mobs/necropolis_gate.dm | 10 ++- code/modules/shuttle/on_move.dm | 5 +- code/modules/shuttle/special.dm | 12 +++- .../spell_types/spacetime_distortion.dm | 8 ++- code/modules/swarmers/swarmer_objs.dm | 11 +++- .../modules/unit_tests/hydroponics_harvest.dm | 7 +- 104 files changed, 702 insertions(+), 358 deletions(-) diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index de15296025f..4de01402991 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -384,18 +384,12 @@ #define COMPONENT_MOVABLE_BLOCK_PRE_MOVE (1<<0) ///from base of atom/movable/Moved(): (/atom, dir) #define COMSIG_MOVABLE_MOVED "movable_moved" +///from base of atom/movable/update_loc(): (/atom/oldloc) +#define COMSIG_MOVABLE_LOCATION_CHANGE "location_changed" ///from base of atom/movable/Cross(): (/atom/movable) #define COMSIG_MOVABLE_CROSS "movable_cross" -///from base of atom/movable/Crossed(): (/atom/movable) -#define COMSIG_MOVABLE_CROSSED "movable_crossed" -///from base of atom/movable/Uncrossed(): (/atom/movable) -#define COMSIG_MOVABLE_UNCROSSED "movable_uncrossed" -///from base of atom/movable/Cross(): (/atom/movable) +///from base of atom/movable/Move(): (/atom/movable) #define COMSIG_MOVABLE_CROSS_OVER "movable_cross_am" -///from base of atom/movable/Crossed(): (/atom/movable) -#define COMSIG_MOVABLE_CROSSED_OVER "movable_crossed_am" -///from base of atom/movable/Uncrossed(): (/atom/movable) -#define COMSIG_MOVABLE_UNCROSSED_OVER "movable_uncross_am" ///from base of atom/movable/Bump(): (/atom) #define COMSIG_MOVABLE_BUMP "movable_bump" ///from base of atom/movable/throw_impact(): (/atom/hit_atom, /datum/thrownthing/throwingdatum) @@ -968,7 +962,7 @@ ///from Edible component: (mob/living/eater, mob/feeder, bitecount, bitesize) #define COMSIG_FOOD_EATEN "food_eaten" -///from base of datum/component/edible/oncrossed: (mob/crosser, bitecount) +///from base of datum/component/edible/on_entered: (mob/crosser, bitecount) #define COMSIG_FOOD_CROSSED "food_crossed" ///from base of Component/edible/On_Consume: (mob/living/eater, mob/living/feeder) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 2c8d7bb38f3..9bac53c0709 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -332,12 +332,12 @@ Turf and target are separate in case you want to teleport some distance from a t //For example, using this on a disk, which is in a bag, on a mob, will return the mob because it's on the turf. //Optional arg 'type' to stop once it reaches a specific type instead of a turf. /proc/get_atom_on_turf(atom/movable/M, stop_type) - var/atom/loc = M - while(loc?.loc && !isturf(loc.loc)) - loc = loc.loc - if(stop_type && istype(loc, stop_type)) + var/atom/turf_to_check = M + while(turf_to_check?.loc && !isturf(turf_to_check.loc)) + turf_to_check = turf_to_check.loc + if(stop_type && istype(turf_to_check, stop_type)) break - return loc + return turf_to_check //Returns a list of all locations (except the area) the movable is within. /proc/get_nested_locs(atom/movable/AM, include_turf = FALSE) diff --git a/code/datums/ai/monkey/monkey_controller.dm b/code/datums/ai/monkey/monkey_controller.dm index 7a42cc3d348..945ddf7ead0 100644 --- a/code/datums/ai/monkey/monkey_controller.dm +++ b/code/datums/ai/monkey/monkey_controller.dm @@ -41,19 +41,24 @@ have ways of interacting with a specific mob and control it. RegisterSignal(new_pawn, COMSIG_ATOM_ATTACK_PAW, .proc/on_attack_paw) RegisterSignal(new_pawn, COMSIG_ATOM_BULLET_ACT, .proc/on_bullet_act) RegisterSignal(new_pawn, COMSIG_ATOM_HITBY, .proc/on_hitby) - RegisterSignal(new_pawn, COMSIG_MOVABLE_CROSSED, .proc/on_Crossed) RegisterSignal(new_pawn, COMSIG_LIVING_START_PULL, .proc/on_startpulling) RegisterSignal(new_pawn, COMSIG_LIVING_TRY_SYRINGE, .proc/on_try_syringe) RegisterSignal(new_pawn, COMSIG_ATOM_HULK_ATTACK, .proc/on_attack_hulk) RegisterSignal(new_pawn, COMSIG_CARBON_CUFF_ATTEMPTED, .proc/on_attempt_cuff) RegisterSignal(new_pawn, COMSIG_MOB_MOVESPEED_UPDATED, .proc/update_movespeed) RegisterSignal(new_pawn, COMSIG_FOOD_EATEN, .proc/on_eat) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, new_pawn, loc_connections) movement_delay = living_pawn.cached_multiplicative_slowdown return ..() //Run parent at end /datum/ai_controller/monkey/UnpossessPawn(destroy) - UnregisterSignal(pawn, list(COMSIG_PARENT_ATTACKBY, COMSIG_ATOM_ATTACK_HAND, COMSIG_ATOM_ATTACK_PAW, COMSIG_ATOM_BULLET_ACT, COMSIG_ATOM_HITBY, COMSIG_MOVABLE_CROSSED, COMSIG_LIVING_START_PULL,\ + UnregisterSignal(pawn, list(COMSIG_PARENT_ATTACKBY, COMSIG_ATOM_ATTACK_HAND, COMSIG_ATOM_ATTACK_PAW, COMSIG_ATOM_BULLET_ACT, COMSIG_ATOM_HITBY, COMSIG_LIVING_START_PULL,\ COMSIG_LIVING_TRY_SYRINGE, COMSIG_ATOM_HULK_ATTACK, COMSIG_CARBON_CUFF_ATTEMPTED, COMSIG_MOB_MOVESPEED_UPDATED)) + pawn.RemoveElement(/datum/element/connect_loc) + return ..() //Run parent at end /datum/ai_controller/monkey/able_to_run() @@ -304,7 +309,7 @@ have ways of interacting with a specific mob and control it. var/mob/living/carbon/human/H = I.thrownby retaliate(H) -/datum/ai_controller/monkey/proc/on_Crossed(datum/source, atom/movable/AM) +/datum/ai_controller/monkey/proc/on_entered(datum/source, atom/movable/AM) SIGNAL_HANDLER var/mob/living/living_pawn = pawn if(!IS_DEAD_OR_INCAP(living_pawn) && ismob(AM)) diff --git a/code/datums/brain_damage/imaginary_friend.dm b/code/datums/brain_damage/imaginary_friend.dm index 1b2ec390de3..839396fda3c 100644 --- a/code/datums/brain_damage/imaginary_friend.dm +++ b/code/datums/brain_damage/imaginary_friend.dm @@ -186,18 +186,17 @@ recall() move_delay = world.time + 10 return FALSE - forceMove(NewLoc) + abstract_move(NewLoc) move_delay = world.time + 1 -/mob/camera/imaginary_friend/forceMove(atom/destination) - dir = get_dir(get_turf(src), destination) - loc = destination +/mob/camera/imaginary_friend/abstract_move(atom/destination) + . = ..() Show() /mob/camera/imaginary_friend/proc/recall() if(!owner || loc == owner) return FALSE - forceMove(owner) + abstract_move(owner) /datum/action/innate/imaginary_join name = "Join" diff --git a/code/datums/components/acid.dm b/code/datums/components/acid.dm index 0cbafbc94df..762e62e8353 100644 --- a/code/datums/components/acid.dm +++ b/code/datums/components/acid.dm @@ -70,7 +70,7 @@ RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND, .proc/on_attack_hand) RegisterSignal(parent, COMSIG_ATOM_EXPOSE_REAGENT, .proc/on_expose_reagent) if(isturf(parent)) - RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/on_crossed) + RegisterSignal(parent, COMSIG_ATOM_ENTERED, .proc/on_entered) /datum/component/acid/UnregisterFromParent() UnregisterSignal(parent, list( @@ -80,7 +80,7 @@ COMSIG_ATOM_EXPOSE_REAGENT)) if(isturf(parent)) - UnregisterSignal(parent, COMSIG_MOVABLE_CROSSED) + UnregisterSignal(parent, COMSIG_ATOM_ENTERED) /// Averages corrosive power and sums volume. /datum/component/acid/InheritComponent(datum/component/C, i_am_original, _acid_power, _acid_volume) @@ -201,7 +201,7 @@ /// Handles searing the feet of whoever walks over this without protection. Only active if the parent is a turf. -/datum/component/acid/proc/on_crossed(atom/parent_atom, mob/living/crosser) +/datum/component/acid/proc/on_entered(atom/parent_atom, mob/living/crosser) SIGNAL_HANDLER if(!isliving(crosser)) diff --git a/code/datums/components/butchering.dm b/code/datums/components/butchering.dm index 511c4b0669d..97dd7203151 100644 --- a/code/datums/components/butchering.dm +++ b/code/datums/components/butchering.dm @@ -142,9 +142,13 @@ . = ..() if(. == COMPONENT_INCOMPATIBLE) return - RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/onCrossed) -/datum/component/butchering/recycler/proc/onCrossed(datum/source, mob/living/L) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, parent, loc_connections) + +/datum/component/butchering/recycler/proc/on_entered(datum/source, mob/living/L) SIGNAL_HANDLER if(!istype(L)) diff --git a/code/datums/components/chasm.dm b/code/datums/components/chasm.dm index bdd341651b3..d48900f6ae3 100644 --- a/code/datums/components/chasm.dm +++ b/code/datums/components/chasm.dm @@ -27,7 +27,7 @@ )) /datum/component/chasm/Initialize(turf/target) - RegisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_ATOM_ENTERED), .proc/Entered) + RegisterSignal(parent, COMSIG_ATOM_ENTERED, .proc/Entered) target_turf = target START_PROCESSING(SSobj, src) // process on create, in case stuff is still there diff --git a/code/datums/components/food/edible.dm b/code/datums/components/food/edible.dm index cbaec4f1770..d8e05ba1fb2 100644 --- a/code/datums/components/food/edible.dm +++ b/code/datums/components/food/edible.dm @@ -67,9 +67,13 @@ Behavior that's still missing from this component that original food items had t RegisterSignal(parent, COMSIG_ATOM_CHECKPARTS, .proc/OnCraft) RegisterSignal(parent, COMSIG_ATOM_CREATEDBY_PROCESSING, .proc/OnProcessed) RegisterSignal(parent, COMSIG_ITEM_MICROWAVE_COOKED, .proc/OnMicrowaveCooked) - RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/onCrossed) RegisterSignal(parent, COMSIG_EDIBLE_INGREDIENT_ADDED, .proc/edible_ingredient_added) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, parent, loc_connections) + if(isitem(parent)) RegisterSignal(parent, COMSIG_ITEM_ATTACK, .proc/UseFromHand) RegisterSignal(parent, COMSIG_ITEM_FRIED, .proc/OnFried) @@ -431,7 +435,7 @@ Behavior that's still missing from this component that original food items had t ///Ability to feed food to puppers -/datum/component/edible/proc/onCrossed(datum/source, mob/user) +/datum/component/edible/proc/on_entered(datum/source, mob/user) SIGNAL_HANDLER SEND_SIGNAL(parent, COMSIG_FOOD_CROSSED, user, bitecount) diff --git a/code/datums/components/infective.dm b/code/datums/components/infective.dm index 19ead5d2e66..3aeb006dc1d 100644 --- a/code/datums/components/infective.dm +++ b/code/datums/components/infective.dm @@ -14,10 +14,15 @@ if(!ismovable(parent)) return COMPONENT_INCOMPATIBLE + + var/static/list/disease_connections = list( + COMSIG_ATOM_ENTERED = .proc/try_infect_crossed, + ) + AddElement(/datum/element/connect_loc, parent, disease_connections) + RegisterSignal(parent, COMSIG_COMPONENT_CLEAN_ACT, .proc/clean) RegisterSignal(parent, COMSIG_MOVABLE_BUCKLE, .proc/try_infect_buckle) RegisterSignal(parent, COMSIG_MOVABLE_BUMP, .proc/try_infect_collide) - RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/try_infect_crossed) RegisterSignal(parent, COMSIG_MOVABLE_IMPACT_ZONE, .proc/try_infect_impact_zone) if(isitem(parent)) RegisterSignal(parent, COMSIG_ITEM_ATTACK_ZONE, .proc/try_infect_attack_zone) diff --git a/code/datums/components/pellet_cloud.dm b/code/datums/components/pellet_cloud.dm index 6ac80d87141..f2cf10507fb 100644 --- a/code/datums/components/pellet_cloud.dm +++ b/code/datums/components/pellet_cloud.dm @@ -89,7 +89,7 @@ RegisterSignal(parent, COMSIG_SUPPLYPOD_LANDED, .proc/create_blast_pellets) /datum/component/pellet_cloud/UnregisterFromParent() - UnregisterSignal(parent, list(COMSIG_PARENT_PREQDELETED, COMSIG_PELLET_CLOUD_INIT, COMSIG_GRENADE_DETONATE, COMSIG_GRENADE_ARMED, COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_UNCROSSED, COMSIG_MINE_TRIGGERED, COMSIG_ITEM_DROPPED)) + UnregisterSignal(parent, list(COMSIG_PARENT_PREQDELETED, COMSIG_PELLET_CLOUD_INIT, COMSIG_GRENADE_DETONATE, COMSIG_GRENADE_ARMED, COMSIG_MOVABLE_MOVED, COMSIG_MINE_TRIGGERED, COMSIG_ITEM_DROPPED)) /** * create_casing_pellets() is for directed pellet clouds for ammo casings that have multiple pellets (buckshot and scatter lasers for instance) @@ -324,7 +324,10 @@ LAZYINITLIST(bodies) RegisterSignal(parent, COMSIG_ITEM_DROPPED, .proc/grenade_dropped) RegisterSignal(parent, COMSIG_MOVABLE_MOVED, .proc/grenade_moved) - RegisterSignal(parent, COMSIG_MOVABLE_UNCROSSED, .proc/grenade_uncrossed) + var/static/list/loc_connections = list( + COMSIG_ATOM_EXITED =.proc/grenade_uncrossed, + ) + AddElement(/datum/element/connect_loc, parent, loc_connections) /// Someone dropped the grenade, so set them to the shooter in case they're on top of it when it goes off /datum/component/pellet_cloud/proc/grenade_dropped(obj/item/nade, mob/living/slick_willy) diff --git a/code/datums/components/rot.dm b/code/datums/components/rot.dm index fc837ef2e25..7afae5362d3 100644 --- a/code/datums/components/rot.dm +++ b/code/datums/components/rot.dm @@ -17,6 +17,10 @@ ///Bitfield of sources preventing the component from rotting var/blockers = NONE + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/rot_react, + ) + /datum/component/rot/Initialize(delay, scaling, severity) if(!isatom(parent)) return COMPONENT_INCOMPATIBLE @@ -33,7 +37,8 @@ RegisterSignal(parent, list(COMSIG_ATOM_HULK_ATTACK, COMSIG_ATOM_ATTACK_ANIMAL, COMSIG_ATOM_ATTACK_HAND), .proc/rot_react_touch) RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, .proc/rot_hit_react) if(ismovable(parent)) - RegisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_MOVABLE_BUMP), .proc/rot_react) + AddElement(/datum/element/connect_loc, parent, loc_connections) + RegisterSignal(parent, COMSIG_MOVABLE_BUMP, .proc/rot_react) if(isliving(parent)) RegisterSignal(parent, COMSIG_LIVING_REVIVE, .proc/react_to_revive) //mobs stop this when they come to life RegisterSignal(parent, COMSIG_LIVING_GET_PULLED, .proc/rot_react_touch) @@ -52,6 +57,11 @@ start_up(NONE) //If nothing's blocking it, start +/datum/component/rot/UnregisterFromParent() + . = ..() + if(ismovable(parent)) + RemoveElement(/datum/element/connect_loc, parent, loc_connections) + ///One of two procs that modifies blockers, this one handles removing a blocker and potentially restarting the rot /datum/component/rot/proc/start_up(blocker_type) blockers &= ~blocker_type //Yeet the type diff --git a/code/datums/components/singularity.dm b/code/datums/components/singularity.dm index c7dc5cb3e79..c2cb875c00a 100644 --- a/code/datums/components/singularity.dm +++ b/code/datums/components/singularity.dm @@ -81,7 +81,11 @@ RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, .proc/consume_attackby) RegisterSignal(parent, COMSIG_MOVABLE_PRE_MOVE, .proc/moved) - RegisterSignal(parent, list(COMSIG_ATOM_BUMPED, COMSIG_MOVABLE_CROSSED), .proc/consume) + RegisterSignal(parent, COMSIG_ATOM_BUMPED, .proc/consume) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/consume, + ) + AddElement(/datum/element/connect_loc, parent, loc_connections) RegisterSignal(parent, COMSIG_ATOM_BULLET_ACT, .proc/consume_bullets) @@ -111,7 +115,6 @@ COMSIG_ATOM_BSA_BEAM, COMSIG_ATOM_BULLET_ACT, COMSIG_ATOM_BUMPED, - COMSIG_MOVABLE_CROSSED, COMSIG_MOVABLE_PRE_MOVE, COMSIG_PARENT_ATTACKBY, )) diff --git a/code/datums/components/slippery.dm b/code/datums/components/slippery.dm index b47d4d9bcdb..89a58456fbe 100644 --- a/code/datums/components/slippery.dm +++ b/code/datums/components/slippery.dm @@ -14,6 +14,15 @@ var/mob/living/holder /// Whitelist of item slots the parent can be equipped in that make the holder slippery. If null or empty, it will always make the holder slippery. var/list/slot_whitelist = list(ITEM_SLOT_OCLOTHING, ITEM_SLOT_ICLOTHING, ITEM_SLOT_GLOVES, ITEM_SLOT_FEET, ITEM_SLOT_HEAD, ITEM_SLOT_MASK, ITEM_SLOT_BELT, ITEM_SLOT_NECK) + ///what we give to connect_loc by default, makes slippable mobs moving over us slip + var/static/list/default_connections = list( + COMSIG_ATOM_ENTERED = .proc/Slip, + ) + + ///what we give to connect_loc if we're an item and get equipped by a mob. makes slippable mobs moving over our holder slip + var/static/list/holder_connections = list( + COMSIG_ATOM_ENTERED = .proc/Slip_on_wearer, + ) /datum/component/slippery/Initialize(knockdown, lube_flags = NONE, datum/callback/callback, paralyze, force_drop = FALSE, slot_whitelist) src.knockdown_time = max(knockdown, 0) @@ -23,9 +32,10 @@ src.callback = callback if(slot_whitelist) src.slot_whitelist = slot_whitelist - RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/Slip) + if(ismovable(parent)) + AddElement(/datum/element/connect_loc, parent, default_connections) + if(isitem(parent)) - holder = parent RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, .proc/on_equip) RegisterSignal(parent, COMSIG_ITEM_DROPPED, .proc/on_drop) else @@ -58,7 +68,7 @@ if((!LAZYLEN(slot_whitelist) || (slot in slot_whitelist)) && isliving(equipper)) holder = equipper - RegisterSignal(holder, COMSIG_MOVABLE_CROSSED, .proc/Slip_on_wearer) + AddElement(/datum/element/connect_loc, holder, holder_connections) RegisterSignal(holder, COMSIG_PARENT_PREQDELETED, .proc/holder_deleted) /* @@ -84,8 +94,9 @@ /datum/component/slippery/proc/on_drop(datum/source, mob/user) SIGNAL_HANDLER + UnregisterSignal(user, COMSIG_PARENT_PREQDELETED) + RemoveElement(/datum/element/connect_loc, holder, holder_connections) holder = null - UnregisterSignal(user, COMSIG_MOVABLE_CROSSED) /* * The slip proc, but for equipped items. @@ -100,6 +111,12 @@ if(holder.body_position == LYING_DOWN && !holder.buckled) Slip(source, AM) +/datum/component/slippery/UnregisterFromParent() + . = ..() + if(holder) + RemoveElement(/datum/element/connect_loc, holder, holder_connections) + RemoveElement(/datum/element/connect_loc, parent, default_connections) + /// Used for making the clown PDA only slip if the clown is wearing his shoes and the elusive banana-skin belt /datum/component/slippery/clowning diff --git a/code/datums/components/squeak.dm b/code/datums/components/squeak.dm index d18f3294633..22c56e7d99b 100644 --- a/code/datums/components/squeak.dm +++ b/code/datums/components/squeak.dm @@ -21,13 +21,19 @@ ///sound exponent for squeak. Defaults to 10 as squeaking is loud and annoying enough. var/sound_falloff_exponent = 10 + ///what we set connect_loc to if parent is an item + var/static/list/item_connections = list( + COMSIG_ATOM_ENTERED = .proc/play_squeak_crossed, + ) + /datum/component/squeak/Initialize(custom_sounds, volume_override, chance_override, step_delay_override, use_delay_override, extrarange, falloff_exponent, fallof_distance) if(!isatom(parent)) return COMPONENT_INCOMPATIBLE RegisterSignal(parent, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_BLOB_ACT, COMSIG_ATOM_HULK_ATTACK, COMSIG_PARENT_ATTACKBY), .proc/play_squeak) if(ismovable(parent)) RegisterSignal(parent, list(COMSIG_MOVABLE_BUMP, COMSIG_MOVABLE_IMPACT, COMSIG_PROJECTILE_BEFORE_FIRE), .proc/play_squeak) - RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/play_squeak_crossed) + + AddElement(/datum/element/connect_loc, parent, item_connections) RegisterSignal(parent, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react) if(isitem(parent)) RegisterSignal(parent, list(COMSIG_ITEM_ATTACK, COMSIG_ITEM_ATTACK_OBJ, COMSIG_ITEM_HIT_REACT), .proc/play_squeak) @@ -59,6 +65,10 @@ if(isnum(fallof_distance)) sound_falloff_distance = fallof_distance +/datum/component/squeak/UnregisterFromParent() + . = ..() + RemoveElement(/datum/element/connect_loc, parent, item_connections) + /datum/component/squeak/proc/play_squeak() SIGNAL_HANDLER @@ -99,17 +109,17 @@ /datum/component/squeak/proc/on_equip(datum/source, mob/equipper, slot) SIGNAL_HANDLER - holder = equipper - RegisterSignal(holder, COMSIG_MOVABLE_CROSSED, .proc/play_squeak_crossed) - RegisterSignal(holder, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react, TRUE) - RegisterSignal(holder, COMSIG_PARENT_PREQDELETED, .proc/holder_deleted) + RegisterSignal(holder, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react, override=TRUE) + RegisterSignal(holder, COMSIG_PARENT_PREQDELETED, .proc/holder_deleted, override=TRUE) + //override for the preqdeleted is necessary because putting parent in hands sends the signal that this proc is registered towards, + //so putting an object in hands and then equipping the item on a clothing slot (without dropping it first) + //will always runtime without override = TRUE /datum/component/squeak/proc/on_drop(datum/source, mob/user) SIGNAL_HANDLER - - UnregisterSignal(user, COMSIG_MOVABLE_CROSSED) UnregisterSignal(user, COMSIG_MOVABLE_DISPOSING) + UnregisterSignal(user, COMSIG_PARENT_PREQDELETED) holder = null ///just gets rid of the reference to holder in the case that theyre qdeleted @@ -118,7 +128,7 @@ if(possible_holder == holder) holder = null -// Disposal pipes related shit +// Disposal pipes related shits /datum/component/squeak/proc/disposing_react(datum/source, obj/structure/disposalholder/holder, obj/machinery/disposal/source) SIGNAL_HANDLER diff --git a/code/datums/components/swarming.dm b/code/datums/components/swarming.dm index 5234aab3949..ea18ff5c9a2 100644 --- a/code/datums/components/swarming.dm +++ b/code/datums/components/swarming.dm @@ -3,6 +3,10 @@ var/offset_y = 0 var/is_swarming = FALSE var/list/swarm_members = list() + var/static/list/swarming_loc_connections = list( + COMSIG_ATOM_EXITED =.proc/leave_swarm, + COMSIG_ATOM_ENTERED = .proc/join_swarm + ) /datum/component/swarming/Initialize(max_x = 24, max_y = 24) if(!ismovable(parent)) @@ -10,8 +14,8 @@ offset_x = rand(-max_x, max_x) offset_y = rand(-max_y, max_y) - RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/join_swarm) - RegisterSignal(parent, COMSIG_MOVABLE_UNCROSSED, .proc/leave_swarm) + + AddElement(/datum/element/connect_loc, parent, swarming_loc_connections) /datum/component/swarming/Destroy() for(var/other in swarm_members) diff --git a/code/datums/elements/caltrop.dm b/code/datums/elements/caltrop.dm index cf505748c5b..636f2b04ac5 100644 --- a/code/datums/elements/caltrop.dm +++ b/code/datums/elements/caltrop.dm @@ -19,6 +19,11 @@ ///Miscelanous caltrop flags; shoe bypassing, walking interaction, silence var/flags + ///given to connect_loc to listen for something moving over target + var/static/list/crossed_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + /datum/element/caltrop/Attach(datum/target, min_damage = 0, max_damage = 0, probability = 100, flags = NONE) . = ..() if(!isatom(target)) @@ -29,9 +34,12 @@ src.probability = probability src.flags = flags - RegisterSignal(target, COMSIG_MOVABLE_CROSSED, .proc/Crossed) + if(ismovable(target)) + AddElement(/datum/element/connect_loc, target, crossed_connections) + else + RegisterSignal(get_turf(target), COMSIG_ATOM_ENTERED, .proc/on_entered) -/datum/element/caltrop/proc/Crossed(atom/caltrop, atom/movable/AM) +/datum/element/caltrop/proc/on_entered(atom/caltrop, atom/movable/AM) SIGNAL_HANDLER if(!prob(probability)) @@ -81,3 +89,8 @@ H.apply_damage(damage, BRUTE, picked_def_zone, wound_bonus = CANT_WOUND) H.Paralyze(60) + +/datum/element/caltrop/Detach(datum/target) + . = ..() + if(ismovable(target)) + RemoveElement(/datum/element/connect_loc, target, crossed_connections) diff --git a/code/datums/elements/connect_loc.dm b/code/datums/elements/connect_loc.dm index 537aebdee0f..73a93872bd3 100644 --- a/code/datums/elements/connect_loc.dm +++ b/code/datums/elements/connect_loc.dm @@ -24,7 +24,7 @@ src.connections = connections - RegisterSignal(tracked, COMSIG_MOVABLE_MOVED, .proc/on_moved) + RegisterSignal(tracked, COMSIG_MOVABLE_LOCATION_CHANGE, .proc/on_moved) update_signals(listener, tracked) /datum/element/connect_loc/Detach(datum/listener, atom/movable/tracked, list/connections) @@ -36,20 +36,20 @@ if(!istype(tracked)) return - if (!isnull(tracked.loc)) - unregister_signals(listener, tracked, tracked.loc) + unregister_signals(listener, tracked, tracked.loc) - UnregisterSignal(tracked, COMSIG_MOVABLE_MOVED) + UnregisterSignal(tracked, COMSIG_MOVABLE_LOCATION_CHANGE) /datum/element/connect_loc/proc/update_signals(datum/listener, atom/movable/tracked) var/existing = length(targets[tracked.loc]) LAZYSET(targets[tracked.loc], tracked, listener) - if (isnull(tracked.loc)) + if(isnull(tracked.loc)) return for (var/signal in connections) - listener.RegisterSignal(tracked.loc, signal, connections[signal]) + listener.RegisterSignal(tracked.loc, signal, connections[signal], override=TRUE) + //override=TRUE because more than one connect_loc element instance tracked object can be on the same loc if (!existing && isturf(tracked.loc)) RegisterSignal(tracked.loc, COMSIG_TURF_CHANGE, .proc/on_turf_change) diff --git a/code/datums/elements/squashable.dm b/code/datums/elements/squashable.dm index e419730a6c6..ae3ef4c1e84 100644 --- a/code/datums/elements/squashable.dm +++ b/code/datums/elements/squashable.dm @@ -1,7 +1,5 @@ -///This element allows something to be when crossed, for example for cockroaches. -/datum/element/squashable - element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH - id_arg_index = 2 +///This component allows something to be when crossed, for example for cockroaches. +/datum/component/squashable ///Chance on crossed to be squashed var/squash_chance = 50 ///How much brute is applied when mob is squashed @@ -10,12 +8,16 @@ var/squash_flags = NONE ///Special callback to call on squash instead, for things like hauberoach var/datum/callback/on_squash_callback + ///signal list given to connect_loc + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) -/datum/element/squashable/Attach(mob/living/target, squash_chance, squash_damage, squash_flags, squash_callback) +/datum/component/squashable/Initialize(squash_chance, squash_damage, squash_flags, squash_callback) . = ..() - if(!istype(target)) - return ELEMENT_INCOMPATIBLE + if(!isliving(parent)) + return COMPONENT_INCOMPATIBLE if(squash_chance) src.squash_chance = squash_chance if(squash_damage) @@ -23,46 +25,48 @@ if(squash_flags) src.squash_flags = squash_flags if(!src.on_squash_callback && squash_callback) - on_squash_callback = CALLBACK(target, squash_callback) + on_squash_callback = CALLBACK(parent, squash_callback) - RegisterSignal(target, COMSIG_MOVABLE_CROSSED, .proc/OnCrossed) - -/datum/element/squashable/Detach(mob/living/target) - UnregisterSignal(target, COMSIG_MOVABLE_CROSSED) + AddElement(/datum/element/connect_loc, parent, loc_connections) ///Handles the squashing of the mob -/datum/element/squashable/proc/OnCrossed(mob/living/target, atom/movable/crossing_movable) +/datum/component/squashable/proc/on_entered(turf/source_turf, atom/movable/crossing_movable) SIGNAL_HANDLER + var/mob/living/parent_as_living = parent - if(squash_flags & SQUASHED_SHOULD_BE_DOWN && target.body_position != LYING_DOWN) + if(squash_flags & SQUASHED_SHOULD_BE_DOWN && parent_as_living.body_position != LYING_DOWN) return var/should_squash = prob(squash_chance) if(should_squash && on_squash_callback) - if(on_squash_callback.Invoke(target, crossing_movable)) + if(on_squash_callback.Invoke(parent_as_living, crossing_movable)) return //Everything worked, we're done! if(isliving(crossing_movable)) var/mob/living/crossing_mob = crossing_movable if(crossing_mob.mob_size > MOB_SIZE_SMALL && !(crossing_mob.movement_type & FLYING)) if(HAS_TRAIT(crossing_mob, TRAIT_PACIFISM)) - crossing_mob.visible_message("[crossing_mob] carefully steps over [target].", "You carefully step over [target] to avoid hurting it.") + crossing_mob.visible_message("[crossing_mob] carefully steps over [parent_as_living].", "You carefully step over [parent_as_living] to avoid hurting it.") return if(should_squash) - crossing_mob.visible_message("[crossing_mob] squashed [target].", "You squashed [target].") - Squish(target) + crossing_mob.visible_message("[crossing_mob] squashed [parent_as_living].", "You squashed [parent_as_living].") + Squish(parent_as_living) else - target.visible_message("[target] avoids getting crushed.") + parent_as_living.visible_message("[parent_as_living] avoids getting crushed.") else if(isstructure(crossing_movable)) if(should_squash) - crossing_movable.visible_message("[target] is crushed under [crossing_movable].") - Squish(target) + crossing_movable.visible_message("[parent_as_living] is crushed under [crossing_movable].") + Squish(parent_as_living) else - target.visible_message("[target] avoids getting crushed.") + parent_as_living.visible_message("[parent_as_living] avoids getting crushed.") -/datum/element/squashable/proc/Squish(mob/living/target) +/datum/component/squashable/proc/Squish(mob/living/target) if(squash_flags & SQUASHED_SHOULD_BE_GIBBED) target.gib() else target.adjustBruteLoss(squash_damage) + +/datum/component/squashable/UnregisterFromParent() + . = ..() + RemoveElement(/datum/element/connect_loc, parent, loc_connections) diff --git a/code/datums/materials/basemats.dm b/code/datums/materials/basemats.dm index 0a466cd5610..bf6c3f5f548 100644 --- a/code/datums/materials/basemats.dm +++ b/code/datums/materials/basemats.dm @@ -161,7 +161,7 @@ Unless you know what you're doing, only use the first three numbers. They're in /datum/material/bananium/on_applied(atom/source, amount, material_flags) . = ..() - source.AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg'=1), 50, falloff_exponent = 20) + source.LoadComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg'=1), 50, 0, 0, 0, 0, 20, 0) source.AddComponent(/datum/component/slippery, min(amount / 10, 80)) /datum/material/bananium/on_removed(atom/source, amount, material_flags) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index e133afb81d6..1b1a3e2cff8 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -353,6 +353,25 @@ var/mob/buckled_mob = m buckled_mob.set_glide_size(target) +/** + * meant for movement with zero side effects. only use for objects that are supposed to move "invisibly" (like camera mobs or ghosts) + * if you want something to move onto a tile with a beartrap or recycler or tripmine or mouse without that object knowing about it at all, use this + * most of the time you want forceMove() + */ +/atom/movable/proc/abstract_move(atom/new_loc) + var/atom/old_loc = update_loc(new_loc) + Moved(old_loc) + +/** + * meant to be used for all location changes. any instances of setting loc directly (for movables) should instead use this + * do NOT use this directly, use either Move() or abstract_move() or forceMove() + */ +/atom/movable/proc/update_loc(atom/new_loc) + SHOULD_NOT_OVERRIDE(TRUE) + var/old_loc = loc + loc = new_loc + SEND_SIGNAL(src, COMSIG_MOVABLE_LOCATION_CHANGE, old_loc) + //////////////////////////////////////// // Here's where we rewrite how byond handles movement except slightly different // To be removed on step_ conversion @@ -381,28 +400,18 @@ var/atom/oldloc = loc var/area/oldarea = get_area(oldloc) var/area/newarea = get_area(newloc) - loc = newloc + + update_loc(newloc) + . = TRUE oldloc.Exited(src, newloc) if(oldarea != newarea) oldarea.Exited(src, newloc) - for(var/i in oldloc) - if(i == src) // Multi tile objects - continue - var/atom/movable/thing = i - thing.Uncrossed(src) - newloc.Entered(src, oldloc) if(oldarea != newarea) newarea.Entered(src, oldloc) - for(var/i in loc) - if(i == src) // Multi tile objects - continue - var/atom/movable/thing = i - thing.Crossed(src) - //////////////////////////////////////// /atom/movable/Move(atom/newloc, direct, glide_size_override = 0) @@ -526,12 +535,10 @@ SEND_SIGNAL(AM, COMSIG_MOVABLE_CROSS_OVER, src) return CanPass(AM, AM.loc, TRUE) -//oldloc = old location on atom, inserted when forceMove is called and ONLY when forceMove is called! +///default byond proc that is deprecated for us in lieu of signals. do not call /atom/movable/Crossed(atom/movable/AM, oldloc) - SHOULD_CALL_PARENT(TRUE) - . = ..() - SEND_SIGNAL(src, COMSIG_MOVABLE_CROSSED, AM) - SEND_SIGNAL(AM, COMSIG_MOVABLE_CROSSED_OVER, src) + SHOULD_NOT_OVERRIDE(TRUE) + CRASH("atom/movable/Crossed() was called!") /** * `Uncross()` is a default BYOND proc that is called when something is *going* @@ -557,9 +564,15 @@ SHOULD_NOT_OVERRIDE(TRUE) CRASH("Uncross() should not be being called, please read the doc-comment for it for why.") +/** + * default byond proc that is normally called on everything inside the previous turf + * a movable was in after moving to its current turf + * this is wasteful since the vast majority of objects do not use Uncrossed + * use connect_loc to register to COMSIG_ATOM_EXITED instead + */ /atom/movable/Uncrossed(atom/movable/AM) - SEND_SIGNAL(src, COMSIG_MOVABLE_UNCROSSED, AM) - SEND_SIGNAL(AM, COMSIG_MOVABLE_UNCROSSED_OVER, src) + SHOULD_NOT_OVERRIDE(TRUE) + CRASH("/atom/movable/Uncrossed() was called") /atom/movable/Bump(atom/A) if(!A) @@ -629,7 +642,7 @@ var/area/old_area = get_area(oldloc) var/area/destarea = get_area(destination) - loc = destination + update_loc(destination) moving_diagonally = 0 if(!same_loc) @@ -637,8 +650,6 @@ oldloc.Exited(src, destination) if(old_area && old_area != destarea) old_area.Exited(src, destination) - for(var/atom/movable/AM in oldloc) - AM.Uncrossed(src) var/turf/oldturf = get_turf(oldloc) var/turf/destturf = get_turf(destination) var/old_z = (oldturf ? oldturf.z : null) @@ -649,24 +660,19 @@ if(destarea && old_area != destarea) destarea.Entered(src, oldloc) - for(var/atom/movable/AM in destination) - if(AM == src) - continue - AM.Crossed(src, oldloc) - Moved(oldloc, NONE, TRUE) . = TRUE //If no destination, move the atom into nullspace (don't do this unless you know what you're doing) else . = TRUE + var/atom/oldloc = loc if (loc) - var/atom/oldloc = loc var/area/old_area = get_area(oldloc) oldloc.Exited(src, null) if(old_area) old_area.Exited(src, null) - loc = null + update_loc(null) /atom/movable/proc/onTransitZ(old_z,new_z) SEND_SIGNAL(src, COMSIG_MOVABLE_Z_CHANGED, old_z, new_z) diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index e6a14193d5c..5a7eeaaba1f 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -35,6 +35,10 @@ . = ..() update_appearance(UPDATE_ICON) req_one_access = SSid_access.get_region_access_list(list(REGION_ALL_STATION, REGION_CENTCOM)) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/machinery/recycler/RefreshParts() var/amt_made = 0 @@ -98,9 +102,9 @@ if(move_dir == eat_dir) return TRUE -/obj/machinery/recycler/Crossed(atom/movable/AM) - eat(AM) - . = ..() +/obj/machinery/recycler/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER + INVOKE_ASYNC(src, .proc/eat, AM) /obj/machinery/recycler/proc/eat(atom/movable/AM0, sound=TRUE) if(machine_stat & (BROKEN|NOPOWER)) diff --git a/code/game/machinery/scan_gate.dm b/code/game/machinery/scan_gate.dm index f0e5b975c3b..705e710ea93 100644 --- a/code/game/machinery/scan_gate.dm +++ b/code/game/machinery/scan_gate.dm @@ -56,6 +56,10 @@ . = ..() wires = new /datum/wires/scanner_gate(src) set_scanline("passive") + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/machinery/scanner_gate/Destroy() qdel(wires) @@ -69,9 +73,9 @@ else . += "The control panel is unlocked. Swipe an ID to lock it." -/obj/machinery/scanner_gate/Crossed(atom/movable/AM) - . = ..() - auto_scan(AM) +/obj/machinery/scanner_gate/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER + INVOKE_ASYNC(src, .proc/auto_scan, AM) /obj/machinery/scanner_gate/proc/auto_scan(atom/movable/AM) if(!(machine_stat & (BROKEN|NOPOWER)) && isliving(AM) & (!panel_open)) diff --git a/code/game/machinery/teambuilder.dm b/code/game/machinery/teambuilder.dm index daa2a6a9379..2ce9faed8a1 100644 --- a/code/game/machinery/teambuilder.dm +++ b/code/game/machinery/teambuilder.dm @@ -17,13 +17,17 @@ /obj/machinery/teambuilder/Initialize() . = ..() add_filter("teambuilder", 2, list("type" = "outline", "color" = team_color, "size" = 2)) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/machinery/teambuilder/examine_more(mob/user) . = ..() . += "You see a hastily written note on the side, it says '1215-1217, PICK A SIDE'." -/obj/machinery/teambuilder/Crossed(atom/movable/AM, oldloc) - . = ..() +/obj/machinery/teambuilder/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(AM.get_filter("teambuilder")) return if(isliving(AM) && team_color) diff --git a/code/game/objects/effects/anomalies.dm b/code/game/objects/effects/anomalies.dm index b5d6ff01ec6..a57638a1eea 100644 --- a/code/game/objects/effects/anomalies.dm +++ b/code/game/objects/effects/anomalies.dm @@ -102,6 +102,13 @@ var/boing = 0 aSignal = /obj/item/assembly/signaler/anomaly/grav +/obj/effect/anomaly/grav/Initialize(mapload, new_lifespan, drops_core) + . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + /obj/effect/anomaly/grav/anomalyEffect() ..() boing = 1 @@ -123,8 +130,8 @@ if(target && !target.stat) O.throw_at(target, 5, 10) -/obj/effect/anomaly/grav/Crossed(atom/movable/AM) - . = ..() +/obj/effect/anomaly/grav/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER gravShock(AM) /obj/effect/anomaly/grav/Bump(atom/A) @@ -168,6 +175,10 @@ /obj/effect/anomaly/flux/Initialize(mapload, new_lifespan, drops_core = TRUE, _explosive = TRUE) . = ..() explosive = _explosive + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/effect/anomaly/flux/anomalyEffect() ..() @@ -175,8 +186,8 @@ for(var/mob/living/M in range(0, src)) mobShock(M) -/obj/effect/anomaly/flux/Crossed(atom/movable/AM) - . = ..() +/obj/effect/anomaly/flux/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER mobShock(AM) /obj/effect/anomaly/flux/Bump(atom/A) diff --git a/code/game/objects/effects/decals/cleanable.dm b/code/game/objects/effects/decals/cleanable.dm index 0da93d9043e..978101a721e 100644 --- a/code/game/objects/effects/decals/cleanable.dm +++ b/code/game/objects/effects/decals/cleanable.dm @@ -33,6 +33,10 @@ var/turf/T = get_turf(src) if(T && is_station_level(T.z)) SSblackbox.record_feedback("tally", "station_mess_created", 1, name) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/effect/decal/cleanable/Destroy() var/turf/T = get_turf(src) @@ -83,8 +87,8 @@ //Add "bloodiness" of this blood's type, to the human's shoes //This is on /cleanable because fuck this ancient mess -/obj/effect/decal/cleanable/Crossed(atom/movable/AM) - ..() +/obj/effect/decal/cleanable/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(iscarbon(AM) && blood_state && bloodiness >= 40) SEND_SIGNAL(AM, COMSIG_STEP_ON_BLOOD, src) update_appearance() diff --git a/code/game/objects/effects/decals/cleanable/food.dm b/code/game/objects/effects/decals/cleanable/food.dm index 5444e3ba32d..9167a02359a 100644 --- a/code/game/objects/effects/decals/cleanable/food.dm +++ b/code/game/objects/effects/decals/cleanable/food.dm @@ -42,8 +42,8 @@ if(is_species(AM, /datum/species/snail)) to_chat(AM, "Your path is obstructed by salt.") -/obj/effect/decal/cleanable/food/salt/Crossed(atom/movable/AM) - ..() +/obj/effect/decal/cleanable/food/salt/on_entered(datum/source, atom/movable/AM) + . = ..() if(!isliving(AM)) return if(iscarbon(AM)) diff --git a/code/game/objects/effects/decals/cleanable/humans.dm b/code/game/objects/effects/decals/cleanable/humans.dm index 0ff8c711d23..6b815b8f8aa 100644 --- a/code/game/objects/effects/decals/cleanable/humans.dm +++ b/code/game/objects/effects/decals/cleanable/humans.dm @@ -117,7 +117,7 @@ /obj/effect/decal/cleanable/blood/gibs/ex_act(severity, target) return FALSE -/obj/effect/decal/cleanable/blood/gibs/Crossed(atom/movable/L) +/obj/effect/decal/cleanable/blood/gibs/on_entered(datum/source, atom/movable/L) if(isliving(L) && has_gravity(loc)) playsound(loc, 'sound/effects/gib_step.ogg', HAS_TRAIT(L, TRAIT_LIGHT_STEP) ? 20 : 50, TRUE) . = ..() diff --git a/code/game/objects/effects/decals/misc.dm b/code/game/objects/effects/decals/misc.dm index f9b5af6a91f..409ad09c581 100644 --- a/code/game/objects/effects/decals/misc.dm +++ b/code/game/objects/effects/decals/misc.dm @@ -8,7 +8,7 @@ /obj/effect/temp_visual/point/Initialize(mapload, set_invis = 0) . = ..() var/atom/old_loc = loc - loc = get_turf(src) // We don't want to actualy trigger anything when it moves + update_loc(get_turf(src)) pixel_x = old_loc.pixel_x pixel_y = old_loc.pixel_y invisibility = set_invis diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm index 59063c214df..b356ca612d9 100644 --- a/code/game/objects/effects/effect_system/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/effects_smoke.dm @@ -125,6 +125,13 @@ /obj/effect/particle_effect/smoke/bad lifetime = 8 +/obj/effect/particle_effect/smoke/bad/Initialize() + . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + /obj/effect/particle_effect/smoke/bad/smoke_mob(mob/living/carbon/M) . = ..() if(.) @@ -133,8 +140,8 @@ M.emote("cough") return TRUE -/obj/effect/particle_effect/smoke/bad/Crossed(atom/movable/AM, oldloc) - . = ..() +/obj/effect/particle_effect/smoke/bad/proc/on_entered(datum/source, atom/movable/AM, oldloc) + SIGNAL_HANDLER if(istype(AM, /obj/projectile/beam)) var/obj/projectile/beam/B = AM B.damage = (B.damage/2) @@ -265,7 +272,7 @@ chemholder = new /obj() var/datum/reagents/R = new (500, REAGENT_HOLDER_INSTANT_REACT) //This is a safety for now to prevent smoke generating more smoke as the smoke reagents react in the smoke. This is prevented naturally from happening even if this is off, but I want to be sure that any edge cases are prevented before I get a chance to rework smoke reactions (specifically adding water or reacting away stabilizing agent in the middle of it). chemholder.reagents = R - + R.my_atom = chemholder /datum/effect_system/smoke_spread/chem/Destroy() diff --git a/code/game/objects/effects/mines.dm b/code/game/objects/effects/mines.dm index e435b2937ca..d82600e7f14 100644 --- a/code/game/objects/effects/mines.dm +++ b/code/game/objects/effects/mines.dm @@ -18,6 +18,10 @@ armed = FALSE icon_state = "uglymine-inactive" addtimer(CALLBACK(src, .proc/now_armed), arm_delay) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/effect/mine/examine(mob/user) . = ..() @@ -35,8 +39,8 @@ playsound(src, 'sound/machines/nuke/angry_beep.ogg', 40, FALSE, -2) visible_message("\The [src] beeps softly, indicating it is now active.", vision_distance = COMBAT_MESSAGE_RANGE) -/obj/effect/mine/Crossed(atom/movable/AM) - . = ..() +/obj/effect/mine/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(triggered || !isturf(loc) || !armed) return diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm index 88f7654eeb1..1f63df93f10 100644 --- a/code/game/objects/effects/portals.dm +++ b/code/game/objects/effects/portals.dm @@ -49,19 +49,17 @@ user.forceMove(get_turf(src)) return TRUE -/obj/effect/portal/Crossed(atom/movable/AM, oldloc, force_stop = 0) - if(force_stop) - return ..() - if(isobserver(AM)) - return ..() - if(linked && (get_turf(oldloc) == get_turf(linked))) - return ..() - if(!teleport(AM)) - return ..() - /obj/effect/portal/attack_tk(mob/user) return +/obj/effect/portal/proc/on_entered(atom/newloc, atom/movable/entering_movable, atom/oldloc) + SIGNAL_HANDLER + if(isobserver(entering_movable)) + return + if(linked && (get_turf(oldloc) == get_turf(linked))) + return + teleport(entering_movable) + /obj/effect/portal/attack_hand(mob/user, list/modifiers) . = ..() if(.) @@ -85,6 +83,10 @@ hardlinked = automatic_link if(isturf(hard_target_override)) hard_target = hard_target_override + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/effect/portal/singularity_pull() return diff --git a/code/game/objects/effects/powerup.dm b/code/game/objects/effects/powerup.dm index 234f64d21f8..993946fd38d 100644 --- a/code/game/objects/effects/powerup.dm +++ b/code/game/objects/effects/powerup.dm @@ -19,9 +19,13 @@ ..() if(lifetime) QDEL_IN(src, lifetime) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) -/obj/effect/powerup/Crossed(atom/movable/movable_atom) - . = ..() +/obj/effect/powerup/proc/on_entered(datum/source, atom/movable/movable_atom) + SIGNAL_HANDLER trigger(movable_atom) /obj/effect/powerup/Bump(atom/bumped_atom) diff --git a/code/game/objects/effects/proximity.dm b/code/game/objects/effects/proximity.dm index d75521c38d3..49241255a12 100644 --- a/code/game/objects/effects/proximity.dm +++ b/code/game/objects/effects/proximity.dm @@ -107,12 +107,20 @@ else stack_trace("proximity_checker created without host") return INITIALIZE_HINT_QDEL + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + COMSIG_ATOM_EXITED =.proc/on_uncrossed, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/obj/effect/abstract/proximity_checker/proc/on_uncrossed(datum/source, atom/movable/AM) + SIGNAL_HANDLER + return /obj/effect/abstract/proximity_checker/Destroy() monitor = null return ..() -/obj/effect/abstract/proximity_checker/Crossed(atom/movable/AM) - set waitfor = FALSE - . = ..() +/obj/effect/abstract/proximity_checker/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER monitor?.hasprox_receiver?.HasProximity(AM) diff --git a/code/game/objects/effects/step_triggers.dm b/code/game/objects/effects/step_triggers.dm index d1296af5236..6fae4cd7c75 100644 --- a/code/game/objects/effects/step_triggers.dm +++ b/code/game/objects/effects/step_triggers.dm @@ -7,18 +7,25 @@ invisibility = INVISIBILITY_ABSTRACT // nope cant see this shit anchored = TRUE +/obj/effect/step_trigger/Initialize(mapload) + . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + /obj/effect/step_trigger/proc/Trigger(atom/movable/A) return 0 -/obj/effect/step_trigger/Crossed(H as mob|obj) - ..() +/obj/effect/step_trigger/proc/on_entered(datum/source, H as mob|obj) + SIGNAL_HANDLER if(!H) return if(isobserver(H) && !affect_ghosts) return if(!ismob(H) && mobs_only) return - Trigger(H) + INVOKE_ASYNC(src, .proc/Trigger, H) /obj/effect/step_trigger/singularity_act() diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index a8a400cf63c..ff028fb274d 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -299,7 +299,7 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb var/turf/T = loc loc = null - loc = T + forceMove(T) /obj/item/examine(mob/user) //This might be spammy. Remove? . = ..() @@ -492,7 +492,7 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb if(item_flags & DROPDEL) qdel(src) item_flags &= ~IN_INVENTORY - SEND_SIGNAL(src, COMSIG_ITEM_DROPPED,user) + SEND_SIGNAL(src, COMSIG_ITEM_DROPPED, user) if(!silent) playsound(src, drop_sound, DROP_SOUND_VOLUME, ignore_walls = FALSE) user?.update_equipment_speed_mods() diff --git a/code/game/objects/items/clown_items.dm b/code/game/objects/items/clown_items.dm index 8a95cd9a364..afa1bf6df99 100644 --- a/code/game/objects/items/clown_items.dm +++ b/code/game/objects/items/clown_items.dm @@ -185,10 +185,13 @@ throw_range = 7 attack_verb_continuous = list("HONKS") attack_verb_simple = list("HONK") + ///sound file given to the squeaky component we make in Initialize() + var/soundfile = 'sound/items/bikehorn.ogg' /obj/item/bikehorn/Initialize() . = ..() - AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg'=1), 50, falloff_exponent = 20) //die off quick please) + //LoadComponent so child types dont stack squeak components + LoadComponent(/datum/component/squeak, list(soundfile=1), 50, 0, 0, 0, 0, 20, 0) /obj/item/bikehorn/attack(mob/living/carbon/M, mob/living/carbon/user) if(user != M && ishuman(user)) @@ -208,10 +211,7 @@ desc = "Damn son, where'd you find this?" icon_state = "air_horn" worn_icon_state = "horn_air" - -/obj/item/bikehorn/airhorn/Initialize() - . = ..() - AddComponent(/datum/component/squeak, list('sound/items/airhorn2.ogg'=1), 50, falloff_exponent = 20) //die off quick please) + soundfile = 'sound/items/airhorn2.ogg' //golden bikehorn /obj/item/bikehorn/golden diff --git a/code/game/objects/items/devices/pressureplates.dm b/code/game/objects/items/devices/pressureplates.dm index 6350591ead0..0da49a5be85 100644 --- a/code/game/objects/items/devices/pressureplates.dm +++ b/code/game/objects/items/devices/pressureplates.dm @@ -32,9 +32,13 @@ AddElement(/datum/element/undertile, tile_overlay = tile_overlay, use_anchor = TRUE) RegisterSignal(src, COMSIG_OBJ_HIDE, .proc/ToggleActive) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) -/obj/item/pressure_plate/Crossed(atom/movable/AM) - . = ..() +/obj/item/pressure_plate/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(!can_trigger || !active) return if(trigger_item && !istype(AM, specific_item)) diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm index 72ae2acaa7b..a3db0c45c54 100644 --- a/code/game/objects/items/devices/transfer_valve.dm +++ b/code/game/objects/items/devices/transfer_valve.dm @@ -61,6 +61,7 @@ return attached_device = A to_chat(user, "You attach the [item] to the valve controls and secure it.") + A.on_attach() A.holder = src A.toggle_secure() //this calls update_icon(), which calls update_icon() on the holder (i.e. the bomb). log_bomber(user, "attached a [item.name] to a ttv -", src, null, FALSE) @@ -82,11 +83,6 @@ if(attached_device) attached_device.on_found(finder) -/obj/item/transfer_valve/Crossed(atom/movable/AM as mob|obj) - . = ..() - if(attached_device) - attached_device.Crossed(AM) - //Triggers mousetraps /obj/item/transfer_valve/attack_hand(mob/user, list/modifiers) . = ..() diff --git a/code/game/objects/items/handcuffs.dm b/code/game/objects/items/handcuffs.dm index 1b865fef73a..17d8ba939a1 100644 --- a/code/game/objects/items/handcuffs.dm +++ b/code/game/objects/items/handcuffs.dm @@ -320,6 +320,10 @@ /obj/item/restraints/legcuffs/beartrap/Initialize() . = ..() update_appearance() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/spring_trap, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/item/restraints/legcuffs/beartrap/update_icon_state() icon_state = "[initial(icon_state)][armed]" @@ -349,7 +353,8 @@ update_appearance() playsound(src, 'sound/effects/snap.ogg', 50, TRUE) -/obj/item/restraints/legcuffs/beartrap/Crossed(AM as mob|obj) +/obj/item/restraints/legcuffs/beartrap/proc/spring_trap(datum/source, AM as mob|obj) + SIGNAL_HANDLER if(armed && isturf(loc)) if(isliving(AM)) var/mob/living/L = AM @@ -359,7 +364,6 @@ if(!ridden_vehicle.are_legs_exposed) //close the trap without injuring/trapping the rider if their legs are inside the vehicle at all times. close_trap() ridden_vehicle.visible_message("[ridden_vehicle] triggers \the [src].") - return ..() if(L.movement_type & (FLYING|FLOATING)) //don't close the trap if they're flying/floating over it. snap = FALSE @@ -384,7 +388,6 @@ L.visible_message("[L] triggers \the [src].", \ "You trigger \the [src]!") L.apply_damage(trap_damage, BRUTE, def_zone) - ..() /** * # Energy snare @@ -418,7 +421,7 @@ qdel(src) /obj/item/restraints/legcuffs/beartrap/energy/attack_hand(mob/user, list/modifiers) - Crossed(user) //honk + spring_trap(null, user) return ..() /obj/item/restraints/legcuffs/beartrap/energy/cyborg @@ -495,9 +498,9 @@ /obj/item/restraints/legcuffs/bola/energy/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) if(iscarbon(hit_atom)) var/obj/item/restraints/legcuffs/beartrap/B = new /obj/item/restraints/legcuffs/beartrap/energy/cyborg(get_turf(hit_atom)) - B.Crossed(hit_atom) + B.spring_trap(null, hit_atom) qdel(src) - ..() + . = ..() /** * A pacifying variant of the bola. diff --git a/code/game/objects/items/puzzle_pieces.dm b/code/game/objects/items/puzzle_pieces.dm index a4aa37ae4fa..465da06e711 100644 --- a/code/game/objects/items/puzzle_pieces.dm +++ b/code/game/objects/items/puzzle_pieces.dm @@ -122,7 +122,10 @@ /obj/item/pressure_plate/hologrid/Initialize() . = ..() - + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) AddElement(/datum/element/undertile, tile_overlay = tile_overlay) //we remove use_anchor here, so it ALWAYS stays anchored /obj/item/pressure_plate/hologrid/examine(mob/user) @@ -137,7 +140,7 @@ icon_state = "lasergrid_full" claimed = TRUE -/obj/item/pressure_plate/hologrid/Crossed(atom/movable/AM) +/obj/item/pressure_plate/hologrid/on_entered(datum/source, atom/movable/AM) . = ..() if(trigger_item && istype(AM, specific_item) && !claimed) AM.set_anchored(TRUE) diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index ba43e578a73..efbae7a04ba 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -292,6 +292,10 @@ GLOBAL_LIST_INIT(plastitaniumglass_recipes, list( var/turf/T = get_turf(src) if(T && is_station_level(T.z)) SSblackbox.record_feedback("tally", "station_mess_created", 1, name) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/item/shard/Destroy() . = ..() @@ -347,12 +351,12 @@ GLOBAL_LIST_INIT(plastitaniumglass_recipes, list( qdel(src) return TRUE -/obj/item/shard/Crossed(atom/movable/AM) +/obj/item/shard/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(isliving(AM)) var/mob/living/L = AM if(!(L.movement_type & (FLYING|FLOATING)) || L.buckled) playsound(src, 'sound/effects/glass_step.ogg', HAS_TRAIT(L, TRAIT_LIGHT_STEP) ? 30 : 50, TRUE) - return ..() /obj/item/shard/plasma name = "purple shard" diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index eb01018ad3d..c5995aecd69 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -77,6 +77,10 @@ recipes += temp update_weight() update_appearance() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /** Sets the amount of materials per unit for this stack. * @@ -437,10 +441,10 @@ S.add(transfer) return transfer -/obj/item/stack/Crossed(atom/movable/crossing) +/obj/item/stack/proc/on_entered(datum/source, atom/movable/crossing) + SIGNAL_HANDLER if(!crossing.throwing && can_merge(crossing)) - merge(crossing) - . = ..() + INVOKE_ASYNC(src, .proc/merge, crossing) /obj/item/stack/hitby(atom/movable/hitting, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum) if(can_merge(hitting)) diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index 98fac81c799..d110e88dc9b 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -534,8 +534,15 @@ if(!..()) pop_burst() -/obj/item/toy/snappop/Crossed(H as mob|obj) +/obj/item/toy/snappop/Initialize() . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/obj/item/toy/snappop/proc/on_entered(datum/source, H as mob|obj) + SIGNAL_HANDLER if(ishuman(H) || issilicon(H)) //i guess carp and shit shouldn't set them off var/mob/living/carbon/M = H if(issilicon(H) || M.m_intent == MOVE_INTENT_RUN) diff --git a/code/game/objects/structures/industrial_lift.dm b/code/game/objects/structures/industrial_lift.dm index 4fafd631253..d15ea9f9dbf 100644 --- a/code/game/objects/structures/industrial_lift.dm +++ b/code/game/objects/structures/industrial_lift.dm @@ -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) diff --git a/code/game/objects/structures/shower.dm b/code/game/objects/structures/shower.dm index 4a82035cbaa..a12fd850970 100644 --- a/code/game/objects/structures/shower.dm +++ b/code/game/objects/structures/shower.dm @@ -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) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 46a706dfada..7cc1a87c7ca 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -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)) diff --git a/code/game/objects/structures/traps.dm b/code/game/objects/structures/traps.dm index f68a17063df..aaeaccf2783 100644 --- a/code/game/objects/structures/traps.dm +++ b/code/game/objects/structures/traps.dm @@ -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 = "[src] snaps shut!" + 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)) diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index 69a19e7d010..eddea789005 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -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) diff --git a/code/game/turfs/open/space/space.dm b/code/game/turfs/open/space/space.dm index 2c65d0884e9..d329058b96f 100644 --- a/code/game/turfs/open/space/space.dm +++ b/code/game/turfs/open/space/space.dm @@ -159,7 +159,7 @@ to_chat(user, "The plating is going to need some support! Place metal rods first.") /turf/open/space/Entered(atom/movable/A) - ..() + . = ..() if ((!(A) || src != A.loc)) return diff --git a/code/game/turfs/open/space/transit.dm b/code/game/turfs/open/space/transit.dm index 94d710b5c96..727929033af 100644 --- a/code/game/turfs/open/space/transit.dm +++ b/code/game/turfs/open/space/transit.dm @@ -33,7 +33,7 @@ /turf/open/space/transit/proc/throw_atom(atom/movable/AM) set waitfor = FALSE - if(!AM || istype(AM, /obj/docking_port)) + if(!AM || istype(AM, /obj/docking_port) || istype(AM, /obj/effect/abstract)) return if(AM.loc != src) // Multi-tile objects are "in" multiple locs but its loc is it's true placement. return // Don't move multi tile objects if their origin isn't in transit diff --git a/code/modules/admin/verbs/possess.dm b/code/modules/admin/verbs/possess.dm index bfdc8e00809..3edc1a3e0de 100644 --- a/code/modules/admin/verbs/possess.dm +++ b/code/modules/admin/verbs/possess.dm @@ -18,7 +18,7 @@ if(!usr.control_object) //If you're not already possessing something... usr.name_archive = usr.real_name - usr.loc = O + usr.forceMove(O) usr.real_name = O.name usr.name = O.name usr.reset_perspective(O) @@ -39,7 +39,7 @@ H.name = H.get_visible_name() - usr.loc = get_turf(usr.control_object) + usr.forceMove(get_turf(usr.control_object)) usr.reset_perspective() usr.control_object = null SSblackbox.record_feedback("tally", "admin_verb", 1, "Release Object") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/antagonists/abductor/equipment/abduction_gear.dm b/code/modules/antagonists/abductor/equipment/abduction_gear.dm index b602beaf73c..afa578e66ec 100644 --- a/code/modules/antagonists/abductor/equipment/abduction_gear.dm +++ b/code/modules/antagonists/abductor/equipment/abduction_gear.dm @@ -840,8 +840,15 @@ Congratulations! You are now trained for invasive xenobiology research!"} var/static/list/injected_reagents = list(/datum/reagent/medicine/cordiolis_hepatico) -/obj/structure/table/optable/abductor/Crossed(atom/movable/AM) +/obj/structure/table/optable/abductor/Initialize() . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/obj/structure/table/optable/abductor/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(iscarbon(AM)) START_PROCESSING(SSobj, src) to_chat(AM, "You feel a series of tiny pricks!") diff --git a/code/modules/antagonists/eldritch_cult/eldritch_structures.dm b/code/modules/antagonists/eldritch_cult/eldritch_structures.dm index 4c4e7b96b53..5a5331cfc3e 100644 --- a/code/modules/antagonists/eldritch_cult/eldritch_structures.dm +++ b/code/modules/antagonists/eldritch_cult/eldritch_structures.dm @@ -112,7 +112,14 @@ /// Reference to trap owner mob var/mob/owner -/obj/structure/trap/eldritch/Crossed(atom/movable/AM) +/obj/structure/trap/eldritch/Initialize(mapload) + . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/obj/structure/trap/eldritch/on_entered(datum/source, atom/movable/AM) if(!isliving(AM)) return ..() var/mob/living/living_mob = AM diff --git a/code/modules/assembly/bomb.dm b/code/modules/assembly/bomb.dm index 8eb5581ef03..51b3531b1c2 100644 --- a/code/modules/assembly/bomb.dm +++ b/code/modules/assembly/bomb.dm @@ -80,13 +80,6 @@ else bombtank.release() -//Assembly / attached device memes - -/obj/item/onetankbomb/Crossed(atom/movable/AM as mob|obj) //for mousetraps - . = ..() - if(bombassembly) - bombassembly.Crossed(AM) - /obj/item/onetankbomb/on_found(mob/finder) //for mousetraps if(bombassembly) bombassembly.on_found(finder) diff --git a/code/modules/assembly/holder.dm b/code/modules/assembly/holder.dm index 15712065be7..04a038174d2 100644 --- a/code/modules/assembly/holder.dm +++ b/code/modules/assembly/holder.dm @@ -43,6 +43,7 @@ else a_right = A A.holder_movement() + A.on_attach() /obj/item/assembly_holder/update_appearance(updates=ALL) . = ..() @@ -70,13 +71,6 @@ right.add_overlay("[right_overlay]_l") . += right -/obj/item/assembly_holder/Crossed(atom/movable/AM as mob|obj) - . = ..() - if(a_left) - a_left.Crossed(AM) - if(a_right) - a_right.Crossed(AM) - /obj/item/assembly_holder/on_found(mob/finder) if(a_left) a_left.on_found(finder) diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm index a31ccd97a4d..6159f80bd8f 100644 --- a/code/modules/assembly/infrared.dm +++ b/code/modules/assembly/infrared.dm @@ -229,12 +229,19 @@ pass_flags_self = LETPASSTHROW var/obj/item/assembly/infra/master -/obj/effect/beam/i_beam/Crossed(atom/movable/AM as mob|obj) +/obj/effect/beam/i_beam/Initialize(mapload) . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/obj/effect/beam/i_beam/proc/on_entered(datum/source, atom/movable/AM as mob|obj) + SIGNAL_HANDLER if(istype(AM, /obj/effect/beam)) return if (isitem(AM)) var/obj/item/I = AM if (I.item_flags & ABSTRACT) return - master.trigger_beam(AM, get_turf(src)) + INVOKE_ASYNC(master, /obj/item/assembly/infra.proc/trigger_beam, AM, get_turf(src)) diff --git a/code/modules/assembly/mousetrap.dm b/code/modules/assembly/mousetrap.dm index 46c2bb530c1..1b116e1bae1 100644 --- a/code/modules/assembly/mousetrap.dm +++ b/code/modules/assembly/mousetrap.dm @@ -9,6 +9,17 @@ drop_sound = 'sound/items/handling/component_drop.ogg' pickup_sound = 'sound/items/handling/component_pickup.ogg' + ///if we are attached to an assembly holder, we attach a connect_loc element to ourselves that listens to this from the holder + var/static/list/holder_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + +/obj/item/assembly/mousetrap/Initialize() + . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/item/assembly/mousetrap/examine(mob/user) . = ..() @@ -34,6 +45,14 @@ . = ..() holder?.update_icon(updates) +/obj/item/assembly/mousetrap/on_attach() + . = ..() + AddElement(/datum/element/connect_loc, holder, holder_connections) + +/obj/item/assembly/mousetrap/on_detach() + . = ..() + RemoveElement(/datum/element/connect_loc, holder, holder_connections) + /obj/item/assembly/mousetrap/proc/triggered(mob/target, type = "feet") if(!armed) return @@ -107,7 +126,8 @@ return ..() -/obj/item/assembly/mousetrap/Crossed(atom/movable/AM as mob|obj) +/obj/item/assembly/mousetrap/proc/on_entered(datum/source, atom/movable/AM as mob|obj) + SIGNAL_HANDLER if(armed) if(ismob(AM)) var/mob/MM = AM @@ -115,15 +135,13 @@ if(ishuman(AM)) var/mob/living/carbon/H = AM if(H.m_intent == MOVE_INTENT_RUN) - triggered(H) + INVOKE_ASYNC(src, .proc/triggered, H) H.visible_message("[H] accidentally steps on [src].", \ "You accidentally step on [src]") else if(ismouse(MM) || israt(MM) || isregalrat(MM)) - triggered(MM) + INVOKE_ASYNC(src, .proc/triggered, MM) else if(AM.density) // For mousetrap grenades, set off by anything heavy - triggered(AM) - ..() - + INVOKE_ASYNC(src, .proc/triggered, AM) /obj/item/assembly/mousetrap/on_found(mob/finder) if(armed) diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm index 1ec6048e79f..beb6ef96a57 100644 --- a/code/modules/atmospherics/environmental/LINDA_fire.dm +++ b/code/modules/atmospherics/environmental/LINDA_fire.dm @@ -72,6 +72,10 @@ perform_exposure() setDir(pick(GLOB.cardinals)) air_update_turf(FALSE, FALSE) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/effect/hotspot/proc/perform_exposure() var/turf/open/location = loc @@ -213,8 +217,8 @@ T.active_hotspot = null return ..() -/obj/effect/hotspot/Crossed(atom/movable/AM, oldLoc) - ..() +/obj/effect/hotspot/proc/on_entered(datum/source, atom/movable/AM, oldLoc) + SIGNAL_HANDLER if(isliving(AM)) var/mob/living/L = AM L.fire_act(temperature, volume) diff --git a/code/modules/awaymissions/mission_code/wildwest.dm b/code/modules/awaymissions/mission_code/wildwest.dm index 5b8467ec535..3473ea4530c 100644 --- a/code/modules/awaymissions/mission_code/wildwest.dm +++ b/code/modules/awaymissions/mission_code/wildwest.dm @@ -126,8 +126,15 @@ icon_state = "blobpod" var/triggered = 0 -/obj/effect/meatgrinder/Crossed(atom/movable/AM) +/obj/effect/meatgrinder/Initialize(mapload) . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/obj/effect/meatgrinder/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER Bumped(AM) /obj/effect/meatgrinder/Bumped(atom/movable/AM) diff --git a/code/modules/awaymissions/super_secret_room.dm b/code/modules/awaymissions/super_secret_room.dm index 92fd0f670d7..aed0345dad2 100644 --- a/code/modules/awaymissions/super_secret_room.dm +++ b/code/modules/awaymissions/super_secret_room.dm @@ -128,16 +128,22 @@ . = ..() var/newcolor = color2hex(pick(10;"green", 5;"blue", 3;"red", 1;"purple")) add_atom_colour(newcolor, FIXED_COLOUR_PRIORITY) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) -/obj/item/rupee/Crossed(atom/movable/AM) +/obj/item/rupee/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(!ismob(AM)) return - var/mob/M = AM - if(M.put_in_hands(src)) - if(src != M.get_active_held_item()) - M.swap_hand() - equip_to_best_slot(M) - ..() + INVOKE_ASYNC(src, .proc/put_in_crossers_hands, AM) + +/obj/item/rupee/proc/put_in_crossers_hands(mob/crosser) + if(crosser.put_in_hands(src)) + if(src != crosser.get_active_held_item()) + crosser.swap_hand() + equip_to_best_slot(crosser) /obj/item/rupee/equipped(mob/user, slot) playsound(get_turf(loc), 'sound/misc/server-ready.ogg', 50, TRUE, -1) diff --git a/code/modules/buildmode/effects/line.dm b/code/modules/buildmode/effects/line.dm index 5cc88309e56..27678a7cd04 100644 --- a/code/modules/buildmode/effects/line.dm +++ b/code/modules/buildmode/effects/line.dm @@ -4,7 +4,7 @@ /obj/effect/buildmode_line/New(client/C, atom/atom_a, atom/atom_b, linename) name = linename - loc = get_turf(atom_a) + update_loc(get_turf(atom_a)) I = image('icons/misc/mark.dmi', src, "line", 19.0) var/x_offset = ((atom_b.x * 32) + atom_b.pixel_x) - ((atom_a.x * 32) + atom_a.pixel_x) var/y_offset = ((atom_b.y * 32) + atom_b.pixel_y) - ((atom_a.y * 32) + atom_a.pixel_y) diff --git a/code/modules/clothing/shoes/miscellaneous.dm b/code/modules/clothing/shoes/miscellaneous.dm index 6a0a0bebe3d..3e3eb65e12b 100644 --- a/code/modules/clothing/shoes/miscellaneous.dm +++ b/code/modules/clothing/shoes/miscellaneous.dm @@ -98,7 +98,7 @@ /obj/item/clothing/shoes/clown_shoes/Initialize() . = ..() - AddComponent(/datum/component/squeak, list('sound/effects/clownstep1.ogg'=1,'sound/effects/clownstep2.ogg'=1), 50, falloff_exponent = 20) //die off quick please) + LoadComponent(/datum/component/squeak, list('sound/effects/clownstep1.ogg'=1,'sound/effects/clownstep2.ogg'=1), 50, 0, 0, 0, 0, 20, 0) //die off quick please AddElement(/datum/element/swabable, CELL_LINE_TABLE_CLOWN, CELL_VIRUS_TABLE_GENERIC, rand(2,3), 0) /obj/item/clothing/shoes/clown_shoes/equipped(mob/user, slot) diff --git a/code/modules/events/immovable_rod.dm b/code/modules/events/immovable_rod.dm index d18b5b68861..5ea74019772 100644 --- a/code/modules/events/immovable_rod.dm +++ b/code/modules/events/immovable_rod.dm @@ -83,7 +83,6 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 AddElement(/datum/element/point_of_interest) - RegisterSignal(src, COMSIG_MOVABLE_CROSSED_OVER, .proc/on_crossed_over_movable) RegisterSignal(src, COMSIG_ATOM_ENTERING, .proc/on_entering_atom) if(special_target) @@ -92,7 +91,7 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 walk_towards(src, destination, 1) /obj/effect/immovablerod/Destroy(force) - UnregisterSignal(src, COMSIG_MOVABLE_CROSSED_OVER, COMSIG_ATOM_ENTERING) + UnregisterSignal(src, COMSIG_ATOM_ENTERING) RemoveElement(/datum/element/point_of_interest) SSaugury.unregister_doom(src) @@ -118,7 +117,7 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 if(istype(ghost)) ghost.ManualFollow(src) -/obj/effect/immovablerod/proc/on_crossed_over_movable(datum/source, atom/movable/atom_crossed_over) +/obj/effect/immovablerod/proc/on_entered_over_movable(datum/source, atom/movable/atom_crossed_over) SIGNAL_HANDLER if((atom_crossed_over.density || isliving(atom_crossed_over)) && !QDELETED(atom_crossed_over)) Bump(atom_crossed_over) @@ -129,6 +128,11 @@ In my current plan for it, 'solid' will be defined as anything with density == 1 Bump(atom_entered) /obj/effect/immovablerod/Moved() + + for(var/atom/movable/to_bump in loc) + if((to_bump != src) && !QDELETED(to_bump) && (to_bump.density || isliving(to_bump))) + Bump(to_bump) + // If we have a special target, we should definitely make an effort to go find them. if(special_target) var/turf/target_turf = get_turf(special_target) diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index b271e4b3eb2..3cc3a413352 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -334,6 +334,10 @@ /obj/structure/spacevine/Initialize(mapload) . = ..() add_atom_colour("#ffffff", FIXED_COLOUR_PRIORITY) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) AddElement(/datum/element/atmos_sensitive, mapload) /obj/structure/spacevine/examine(mob/user) @@ -395,8 +399,8 @@ if(BURN) playsound(src.loc, 'sound/items/welder.ogg', 100, TRUE) -/obj/structure/spacevine/Crossed(atom/movable/AM) - . = ..() +/obj/structure/spacevine/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(!isliving(AM)) return for(var/datum/spacevine_mutation/SM in mutations) diff --git a/code/modules/fields/turf_objects.dm b/code/modules/fields/turf_objects.dm index 1617803884c..cc10c19fe14 100644 --- a/code/modules/fields/turf_objects.dm +++ b/code/modules/fields/turf_objects.dm @@ -13,7 +13,7 @@ /obj/effect/abstract/proximity_checker/advanced/Initialize(mapload, _monitor) if(_monitor) parent = _monitor - return ..() + . = ..() /obj/effect/abstract/proximity_checker/advanced/center name = "field anchor" @@ -28,13 +28,14 @@ if(parent) return parent.field_turf_canpass(AM, src, target) -/obj/effect/abstract/proximity_checker/advanced/field_turf/Crossed(atom/movable/AM) +/obj/effect/abstract/proximity_checker/advanced/field_turf/on_entered(datum/source, atom/movable/AM) . = ..() if(parent) return parent.field_turf_crossed(AM, src) return TRUE -/obj/effect/abstract/proximity_checker/advanced/field_turf/Uncrossed(atom/movable/AM) +/obj/effect/abstract/proximity_checker/advanced/field_turf/on_uncrossed(datum/source, atom/movable/AM) + . = ..() if(parent) return parent.field_turf_uncrossed(AM, src) return TRUE @@ -48,13 +49,13 @@ if(parent) return parent.field_edge_canpass(AM, src, target) -/obj/effect/abstract/proximity_checker/advanced/field_edge/Crossed(atom/movable/AM) +/obj/effect/abstract/proximity_checker/advanced/field_edge/on_entered(datum/source, atom/movable/AM) . = ..() if(parent) return parent.field_edge_crossed(AM, src) return TRUE -/obj/effect/abstract/proximity_checker/advanced/field_edge/Uncrossed(atom/movable/AM) +/obj/effect/abstract/proximity_checker/advanced/field_edge/on_uncrossed(datum/source, atom/movable/AM) if(parent) return parent.field_edge_uncrossed(AM, src) return TRUE diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 9f21c91d500..b8964bb4602 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -1322,13 +1322,20 @@ GLOBAL_LIST_INIT(hallucination_list, list( /obj/effect/hallucination/danger/lava name = "lava" +/obj/effect/hallucination/danger/lava/Initialize(mapload, _target) + . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + /obj/effect/hallucination/danger/lava/show_icon() image = image('icons/turf/floors/lava.dmi', src, "lava-0", TURF_LAYER) if(target.client) target.client.images += image -/obj/effect/hallucination/danger/lava/Crossed(atom/movable/AM) - . = ..() +/obj/effect/hallucination/danger/lava/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(AM == target) target.adjustStaminaLoss(20) new /datum/hallucination/fire(target) @@ -1336,14 +1343,21 @@ GLOBAL_LIST_INIT(hallucination_list, list( /obj/effect/hallucination/danger/chasm name = "chasm" +/obj/effect/hallucination/danger/chasm/Initialize(mapload, _target) + . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + /obj/effect/hallucination/danger/chasm/show_icon() var/turf/target_loc = get_turf(target) image = image('icons/turf/floors/chasms.dmi', src, "chasms-[target_loc.smoothing_junction]", TURF_LAYER) if(target.client) target.client.images += image -/obj/effect/hallucination/danger/chasm/Crossed(atom/movable/AM) - . = ..() +/obj/effect/hallucination/danger/chasm/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(AM == target) if(istype(target, /obj/effect/dummy/phased_mob)) return @@ -1358,6 +1372,10 @@ GLOBAL_LIST_INIT(hallucination_list, list( /obj/effect/hallucination/danger/anomaly/Initialize() . = ..() START_PROCESSING(SSobj, src) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/effect/hallucination/danger/anomaly/process(delta_time) if(DT_PROB(45, delta_time)) @@ -1372,8 +1390,8 @@ GLOBAL_LIST_INIT(hallucination_list, list( if(target.client) target.client.images += image -/obj/effect/hallucination/danger/anomaly/Crossed(atom/movable/AM) - . = ..() +/obj/effect/hallucination/danger/anomaly/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(AM == target) new /datum/hallucination/shock(target) diff --git a/code/modules/hydroponics/grown/towercap.dm b/code/modules/hydroponics/grown/towercap.dm index bb024321356..7c5cefff995 100644 --- a/code/modules/hydroponics/grown/towercap.dm +++ b/code/modules/hydroponics/grown/towercap.dm @@ -174,6 +174,13 @@ . = ..() StartBurning() +/obj/structure/bonfire/Initialize() + . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + /obj/structure/bonfire/attackby(obj/item/W, mob/living/user, params) if(istype(W, /obj/item/stack/rods) && !can_buckle && !grill) var/obj/item/stack/rods/R = W @@ -248,8 +255,8 @@ /obj/structure/bonfire/fire_act(exposed_temperature, exposed_volume) StartBurning() -/obj/structure/bonfire/Crossed(atom/movable/AM) - . = ..() +/obj/structure/bonfire/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(burning & !grill) Burn() diff --git a/code/modules/hydroponics/hydroitemdefines.dm b/code/modules/hydroponics/hydroitemdefines.dm index 0e6f2f09b4f..17baca98173 100644 --- a/code/modules/hydroponics/hydroitemdefines.dm +++ b/code/modules/hydroponics/hydroitemdefines.dm @@ -410,8 +410,15 @@ flags_1 = NONE resistance_flags = FLAMMABLE -/obj/item/cultivator/rake/Crossed(atom/movable/AM) +/obj/item/cultivator/rake/Initialize() . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/obj/item/cultivator/rake/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(!ishuman(AM)) return var/mob/living/carbon/human/H = AM diff --git a/code/modules/mining/equipment/resonator.dm b/code/modules/mining/equipment/resonator.dm index 1e89d112eb8..bcf0440b40e 100644 --- a/code/modules/mining/equipment/resonator.dm +++ b/code/modules/mining/equipment/resonator.dm @@ -65,7 +65,11 @@ if(mode == RESONATOR_MODE_MATRIX) icon_state = "shield2" name = "resonance matrix" - RegisterSignal(src, list(COMSIG_MOVABLE_CROSSED, COMSIG_ATOM_ENTERED), .proc/burst) + RegisterSignal(src, COMSIG_ATOM_ENTERED, .proc/burst) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/burst, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) . = ..() creator = set_creator res = set_resonator diff --git a/code/modules/mob/camera/camera.dm b/code/modules/mob/camera/camera.dm index a36e062a87d..d870748e1e0 100644 --- a/code/modules/mob/camera/camera.dm +++ b/code/modules/mob/camera/camera.dm @@ -15,11 +15,6 @@ /mob/camera/experience_pressure_difference() return -/mob/camera/forceMove(atom/destination) - var/oldloc = loc - loc = destination - Moved(oldloc, NONE, TRUE) - /mob/camera/canUseStorage() return FALSE diff --git a/code/modules/mob/dead/dead.dm b/code/modules/mob/dead/dead.dm index 3f6fe0c7f7d..14592d9ebf4 100644 --- a/code/modules/mob/dead/dead.dm +++ b/code/modules/mob/dead/dead.dm @@ -25,14 +25,12 @@ INITIALIZE_IMMEDIATE(/mob/dead) /mob/dead/canUseStorage() return FALSE -/mob/dead/forceMove(atom/destination) +/mob/dead/abstract_move(atom/destination) var/turf/old_turf = get_turf(src) var/turf/new_turf = get_turf(destination) if (old_turf?.z != new_turf?.z) onTransitZ(old_turf?.z, new_turf?.z) - var/oldloc = loc - loc = destination - Moved(oldloc, NONE, TRUE) + return ..() /mob/dead/get_status_tab_items() . = ..() diff --git a/code/modules/mob/living/carbon/alien/special/facehugger.dm b/code/modules/mob/living/carbon/alien/special/facehugger.dm index 489518a1672..55b6c107455 100644 --- a/code/modules/mob/living/carbon/alien/special/facehugger.dm +++ b/code/modules/mob/living/carbon/alien/special/facehugger.dm @@ -34,6 +34,10 @@ /obj/item/clothing/mask/facehugger/Initialize(mapload) . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) AddElement(/datum/element/atmos_sensitive, mapload) /obj/item/clothing/mask/facehugger/lamarr @@ -95,8 +99,8 @@ . = ..() Attach(M) -/obj/item/clothing/mask/facehugger/Crossed(atom/target) - . = ..() +/obj/item/clothing/mask/facehugger/proc/on_entered(datum/source, atom/target) + SIGNAL_HANDLER HasProximity(target) /obj/item/clothing/mask/facehugger/on_found(mob/finder) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index aa0526088ae..d39f061f742 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -25,6 +25,10 @@ AddElement(/datum/element/ridable, /datum/component/riding/creature/human) AddElement(/datum/element/strippable, GLOB.strippable_human_items, /mob/living/carbon/human/.proc/should_strip) GLOB.human_list += src + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /mob/living/carbon/human/proc/setup_human_dna() //initialize dna. for spawned humans; overwritten by other code @@ -86,8 +90,8 @@ . += "Absorbed DNA: [changeling.absorbedcount]" // called when something steps onto a human -/mob/living/carbon/human/Crossed(atom/movable/AM) - . = ..() +/mob/living/carbon/human/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER spreadFire(AM) /mob/living/carbon/human/Topic(href, href_list) diff --git a/code/modules/mob/living/silicon/ai/freelook/eye.dm b/code/modules/mob/living/silicon/ai/freelook/eye.dm index 09020ae9b52..d5f72e0015d 100644 --- a/code/modules/mob/living/silicon/ai/freelook/eye.dm +++ b/code/modules/mob/living/silicon/ai/freelook/eye.dm @@ -83,7 +83,7 @@ if(!force_update && (T == get_turf(src)) ) return //we are already here! if (T) - forceMove(T) + abstract_move(T) else moveToNullspace() if(use_static != USE_STATIC_NONE) diff --git a/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm b/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm index 4b72304bcda..142f8c028c4 100644 --- a/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm +++ b/code/modules/mob/living/simple_animal/bot/SuperBeepsky.dm @@ -24,12 +24,12 @@ playsound(src, 'sound/weapons/blade1.ogg', 50, TRUE) return BULLET_ACT_BLOCK -/mob/living/simple_animal/bot/secbot/grievous/Crossed(atom/movable/AM) - ..() +/mob/living/simple_animal/bot/secbot/grievous/on_entered(datum/source, atom/movable/AM) + . = ..() if(ismob(AM) && AM == target) visible_message("[src] flails his swords and cuts [AM]!") playsound(src,'sound/effects/beepskyspinsabre.ogg',100,TRUE,-1) - stun_attack(AM) + INVOKE_ASYNC(src, .proc/stun_attack, AM) /mob/living/simple_animal/bot/secbot/grievous/Initialize() . = ..() diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 40e60f6a4a4..6cc3a8272b3 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -113,6 +113,10 @@ prefixes = list(command, security, engineering) suffixes = list(research, medical, legal) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /mob/living/simple_animal/bot/cleanbot/Destroy() if(weapon) @@ -144,8 +148,8 @@ text_dehack = "[name]'s software has been reset!" text_dehack_fail = "[name] does not seem to respond to your repair code!" -/mob/living/simple_animal/bot/cleanbot/Crossed(atom/movable/AM) - . = ..() +/mob/living/simple_animal/bot/cleanbot/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER zone_selected = pick(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG) if(weapon && has_gravity() && ismob(AM)) @@ -157,7 +161,7 @@ stolen_valor += C.job update_titles() - weapon.attack(C, src) + INVOKE_ASYNC(weapon, /obj/item.proc/attack, C, src) C.Knockdown(20) /mob/living/simple_animal/bot/cleanbot/attackby(obj/item/W, mob/living/user, params) diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm index 3c1f50b255b..0eee07ec26b 100644 --- a/code/modules/mob/living/simple_animal/bot/honkbot.dm +++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm @@ -46,6 +46,10 @@ var/datum/id_trim/job/clown_trim = SSid_access.trim_singletons_by_path[/datum/id_trim/job/clown] access_card.add_access(clown_trim.access + clown_trim.wildcard_access) prev_access = access_card.access.Copy() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /mob/living/simple_animal/bot/honkbot/proc/limiting_spam_false() //used for addtimer limiting_spam = FALSE @@ -350,7 +354,8 @@ Maintenance panel panel is [open ? "opened" : "closed"]"}, target = user mode = BOT_HUNT -/mob/living/simple_animal/bot/honkbot/Crossed(atom/movable/AM) +/mob/living/simple_animal/bot/honkbot/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(ismob(AM) && (on)) //only if its online if(prob(30)) //you're far more likely to trip on a honkbot var/mob/living/carbon/C = AM @@ -366,10 +371,9 @@ Maintenance panel panel is [open ? "opened" : "closed"]"}, C.Paralyze(10) playsound(loc, 'sound/misc/sadtrombone.ogg', 50, TRUE, -1) if(!client) - speak("Honk!") + INVOKE_ASYNC(src, /mob/living/simple_animal/bot/proc/speak, "Honk!") sensor_blink() return - ..() /obj/machinery/bot_core/honkbot req_one_access = list(ACCESS_THEATRE, ACCESS_ROBOTICS) diff --git a/code/modules/mob/living/simple_animal/bot/hygienebot.dm b/code/modules/mob/living/simple_animal/bot/hygienebot.dm index 2b35777cb5f..20ea4497c8d 100644 --- a/code/modules/mob/living/simple_animal/bot/hygienebot.dm +++ b/code/modules/mob/living/simple_animal/bot/hygienebot.dm @@ -46,6 +46,10 @@ var/datum/id_trim/job/jani_trim = SSid_access.trim_singletons_by_path[/datum/id_trim/job/janitor] access_card.add_access(jani_trim.access + jani_trim.wildcard_access) prev_access = access_card.access.Copy() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /mob/living/simple_animal/bot/hygienebot/explode() walk_to(src,0) @@ -56,13 +60,8 @@ ..() -/mob/living/simple_animal/bot/hygienebot/Cross(atom/movable/AM) - . = ..() - if(washing) - do_wash(AM) - -/mob/living/simple_animal/bot/hygienebot/Crossed(atom/movable/AM) - . = ..() +/mob/living/simple_animal/bot/hygienebot/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(washing) do_wash(AM) diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index cfe44d151fd..716b0972fc1 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -65,7 +65,6 @@ RegisterSignal(src, COMSIG_MOB_CLIENT_PRE_MOVE, .proc/check_pre_step) RegisterSignal(src, COMSIG_MOB_BOT_STEP, .proc/on_bot_step) RegisterSignal(src, COMSIG_MOB_CLIENT_MOVED, .proc/on_bot_step) - RegisterSignal(src, COMSIG_MOVABLE_CROSSED_OVER, .proc/on_crossed_over) ADD_TRAIT(src, TRAIT_NOMOBSWAP, INNATE_TRAIT) @@ -114,7 +113,7 @@ /mob/living/simple_animal/bot/mulebot/Destroy() - UnregisterSignal(src, COMSIG_MOB_BOT_PRE_STEP, COMSIG_MOB_CLIENT_PRE_MOVE, COMSIG_MOB_BOT_STEP, COMSIG_MOB_CLIENT_MOVED, COMSIG_MOVABLE_CROSSED_OVER) + UnregisterSignal(src, COMSIG_MOB_BOT_PRE_STEP, COMSIG_MOB_CLIENT_PRE_MOVE, COMSIG_MOB_BOT_STEP, COMSIG_MOB_CLIENT_MOVED) unload(0) QDEL_NULL(wires) QDEL_NULL(cell) @@ -543,20 +542,12 @@ B.setDir(direct) bloodiness-- -/** - * Signal handler for COMSIG_MOVABLE_CROSSED_OVER signals sent by this mulebot. - * - * Intended to be used to crush various things. - */ -/mob/living/simple_animal/bot/mulebot/proc/on_crossed_over(atom/movable/source, atom/movable/crossed_atom) - SIGNAL_HANDLER - - if(ishuman(crossed_atom)) - run_over(crossed_atom) - /mob/living/simple_animal/bot/mulebot/Moved() . = ..() + for(var/mob/living/carbon/human/future_pancake in loc) + run_over(future_pancake) + diag_hud_set_mulebotcell() /mob/living/simple_animal/bot/mulebot/handle_automated_action() diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index 2a8739e21f8..25b934c6b2f 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -87,6 +87,10 @@ //SECHUD var/datum/atom_hud/secsensor = GLOB.huds[DATA_HUD_SECURITY_ADVANCED] secsensor.add_hud_to(src) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /mob/living/simple_animal/bot/secbot/Destroy() QDEL_NULL(weapon) @@ -499,14 +503,14 @@ Auto Patrol: []"}, target = user mode = BOT_HUNT -/mob/living/simple_animal/bot/secbot/Crossed(atom/movable/AM) +/mob/living/simple_animal/bot/secbot/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(has_gravity() && ismob(AM) && target) var/mob/living/carbon/C = AM if(!istype(C) || !C || in_range(src, target)) return knockOver(C) return - ..() /obj/machinery/bot_core/secbot req_access = list(ACCESS_SECURITY) diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm index bdb2ab66942..6d4589f2302 100644 --- a/code/modules/mob/living/simple_animal/friendly/mouse.dm +++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm @@ -42,6 +42,10 @@ add_cell_sample() ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /mob/living/simple_animal/mouse/add_cell_sample() AddElement(/datum/element/swabable, CELL_LINE_TABLE_MOUSE, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 10) @@ -75,15 +79,15 @@ if(.) SSmobs.cheeserats += src -/mob/living/simple_animal/mouse/Crossed(AM as mob|obj) - if( ishuman(AM) ) +/mob/living/simple_animal/mouse/proc/on_entered(datum/source, AM as mob|obj) + SIGNAL_HANDLER + if(ishuman(AM)) if(!stat) var/mob/M = AM to_chat(M, "[icon2html(src, M)] Squeak!") if(istype(AM, /obj/item/food/cheese/royal)) evolve() qdel(AM) - ..() /mob/living/simple_animal/mouse/handle_automated_action() if(prob(chew_probability)) @@ -144,7 +148,7 @@ /mob/living/simple_animal/mouse/proc/evolve() var/mob/living/simple_animal/hostile/regalrat/regalrat = new /mob/living/simple_animal/hostile/regalrat/controlled(loc) visible_message("[src] devours the cheese! He morphs into something... greater!") - regalrat.say("RISE, MY SUBJECTS! SCREEEEEEE!") + INVOKE_ASYNC(regalrat, /atom/movable/proc/say, "RISE, MY SUBJECTS! SCREEEEEEE!") if(mind) mind.transfer_to(regalrat) qdel(src) diff --git a/code/modules/mob/living/simple_animal/guardian/types/fire.dm b/code/modules/mob/living/simple_animal/guardian/types/fire.dm index 78ebd90470b..011058b84c1 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/fire.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/fire.dm @@ -14,6 +14,13 @@ carp_fluff_string = "CARP CARP CARP! You caught one! OH GOD, EVERYTHING'S ON FIRE. Except you and the fish." miner_fluff_string = "You encounter... Plasma, the bringer of fire." +/mob/living/simple_animal/hostile/guardian/fire/Initialize(mapload, theme) + . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + /mob/living/simple_animal/hostile/guardian/fire/Life(delta_time = SSMOBS_DT, times_fired) . = ..() if(summoner) @@ -25,8 +32,8 @@ if(. && ishuman(target) && target != summoner) new /datum/hallucination/delusion(target,TRUE,"custom",200,0, icon_state,icon) -/mob/living/simple_animal/hostile/guardian/fire/Crossed(AM as mob|obj) - ..() +/mob/living/simple_animal/hostile/guardian/fire/proc/on_entered(datum/source, AM as mob|obj) + SIGNAL_HANDLER collision_ignite(AM) /mob/living/simple_animal/hostile/guardian/fire/Bumped(atom/movable/AM) diff --git a/code/modules/mob/living/simple_animal/guardian/types/ranged.dm b/code/modules/mob/living/simple_animal/guardian/types/ranged.dm index 01724cf0233..98b2c2c7733 100644 --- a/code/modules/mob/living/simple_animal/guardian/types/ranged.dm +++ b/code/modules/mob/living/simple_animal/guardian/types/ranged.dm @@ -110,9 +110,15 @@ var/mob/living/simple_animal/hostile/guardian/spawner invisibility = INVISIBILITY_ABSTRACT - -/obj/effect/snare/Crossed(AM as mob|obj) +/obj/effect/snare/Initialize(mapload) . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/obj/effect/snare/proc/on_entered(datum/source, AM as mob|obj) + SIGNAL_HANDLER if(isliving(AM) && spawner && spawner.summoner && AM != spawner && !spawner.hasmatchingsummoner(AM)) to_chat(spawner.summoner, "[AM] has crossed surveillance snare, [name].") var/list/guardians = spawner.summoner.hasparasites() diff --git a/code/modules/mob/living/simple_animal/hostile/cockroach.dm b/code/modules/mob/living/simple_animal/hostile/cockroach.dm index 9c362d4c0ba..85a281e7258 100644 --- a/code/modules/mob/living/simple_animal/hostile/cockroach.dm +++ b/code/modules/mob/living/simple_animal/hostile/cockroach.dm @@ -40,7 +40,7 @@ ADD_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS, INNATE_TRAIT) /mob/living/simple_animal/hostile/cockroach/proc/make_squashable() - AddElement(/datum/element/squashable, squash_chance = 50, squash_damage = 1) + AddComponent(/datum/component/squashable, squash_chance = 50, squash_damage = 1) /mob/living/simple_animal/hostile/cockroach/add_cell_sample() AddElement(/datum/element/swabable, CELL_LINE_TABLE_COCKROACH, CELL_VIRUS_TABLE_GENERIC_MOB, 1, 7) @@ -97,7 +97,7 @@ AddElement(/datum/element/caltrop, min_damage = 10, max_damage = 15, flags = (CALTROP_BYPASS_SHOES | CALTROP_SILENT)) /mob/living/simple_animal/hostile/cockroach/hauberoach/make_squashable() - AddElement(/datum/element/squashable, squash_chance = 100, squash_damage = 1, squash_callback = /mob/living/simple_animal/hostile/cockroach/hauberoach/.proc/on_squish) + AddComponent(/datum/component/squashable, squash_chance = 100, squash_damage = 1, squash_callback = /mob/living/simple_animal/hostile/cockroach/hauberoach/.proc/on_squish) ///Proc used to override the squashing behavior of the normal cockroach. /mob/living/simple_animal/hostile/cockroach/hauberoach/proc/on_squish(mob/living/cockroach, mob/living/living_target) diff --git a/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm b/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm index 2a17d2b78f3..eb1d8009ebc 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/leaper.dm @@ -82,6 +82,10 @@ /obj/structure/leaper_bubble/Initialize() . = ..() QDEL_IN(src, 100) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/structure/leaper_bubble/ComponentInitialize() . = ..() @@ -93,7 +97,8 @@ playsound(src,'sound/effects/snap.ogg',50, TRUE, -1) return ..() -/obj/structure/leaper_bubble/Crossed(atom/movable/AM) +/obj/structure/leaper_bubble/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(isliving(AM)) var/mob/living/L = AM if(!istype(L, /mob/living/simple_animal/hostile/jungle/leaper)) @@ -106,7 +111,6 @@ var/mob/living/simple_animal/A = L A.adjustHealth(25) qdel(src) - return ..() /datum/reagent/toxin/leaper_venom name = "Leaper venom" diff --git a/code/modules/mob/living/simple_animal/hostile/jungle/mega_arachnid.dm b/code/modules/mob/living/simple_animal/hostile/jungle/mega_arachnid.dm index 406a2762139..08a3f3f2c5e 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/mega_arachnid.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/mega_arachnid.dm @@ -59,8 +59,8 @@ /obj/projectile/mega_arachnid/on_hit(atom/target, blocked = FALSE) if(iscarbon(target) && blocked < 100) var/obj/item/restraints/legcuffs/beartrap/mega_arachnid/B = new /obj/item/restraints/legcuffs/beartrap/mega_arachnid(get_turf(target)) - B.Crossed(target) - ..() + B.spring_trap(null, target) + return ..() /obj/item/restraints/legcuffs/beartrap/mega_arachnid name = "fleshy restraints" diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm index fe611b582d3..e4e22907a02 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm @@ -656,6 +656,10 @@ Difficulty: Hard var/turf/closed/mineral/M = loc M.gets_drilled(caster) INVOKE_ASYNC(src, .proc/blast) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/effect/temp_visual/hierophant/blast/damaging/proc/blast() var/turf/T = get_turf(src) @@ -668,8 +672,8 @@ Difficulty: Hard sleep(1.3) //slightly forgiving; the burst animation is 1.5 deciseconds bursting = FALSE //we no longer damage crossers -/obj/effect/temp_visual/hierophant/blast/damaging/Crossed(atom/movable/AM) - ..() +/obj/effect/temp_visual/hierophant/blast/damaging/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(bursting) do_damage(get_turf(src)) diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/legionnaire.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/legionnaire.dm index 9b0d649eabb..44f97e22a59 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/legionnaire.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/legionnaire.dm @@ -279,9 +279,15 @@ light_color = COLOR_SOFT_RED var/mob/living/simple_animal/hostile/asteroid/elite/legionnaire/myowner = null - -/obj/structure/legionnaire_bonfire/Crossed(atom/movable/mover) +/obj/structure/legionnaire_bonfire/Initialize() . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/obj/structure/legionnaire_bonfire/proc/on_entered(datum/source, atom/movable/mover) + SIGNAL_HANDLER if(isobj(mover)) var/obj/object = mover object.fire_act(1000, 500) diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/frog.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/frog.dm index 38f820f86d3..873091fff03 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/frog.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/frog.dm @@ -43,8 +43,13 @@ icon_dead = "rare_frog_dead" butcher_results = list(/obj/item/food/nugget = 5) -/mob/living/simple_animal/hostile/retaliate/frog/Crossed(AM as mob|obj) - . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/mob/living/simple_animal/hostile/retaliate/frog/proc/on_entered(datum/source, AM as mob|obj) + SIGNAL_HANDLER if(!stat && isliving(AM)) var/mob/living/L = AM if(L.mob_size > MOB_SIZE_TINY) diff --git a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm index 93560e2e331..b1a7b781c11 100644 --- a/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm +++ b/code/modules/mob/living/simple_animal/hostile/venus_human_trap.dm @@ -72,8 +72,15 @@ mouse_opacity = MOUSE_OPACITY_ICON desc = "A thick vine, painful to the touch." -/obj/effect/ebeam/vine/Crossed(atom/movable/AM) +/obj/effect/ebeam/vine/Initialize(mapload) . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/obj/effect/ebeam/vine/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(isliving(AM)) var/mob/living/L = AM if(!isvineimmune(L)) diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 8275356331d..2d6e71a1f47 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -232,7 +232,7 @@ return var/target = locate(locx,locy,mobloc.z) if(target) - L.loc = target + L.forceMove(target) var/limit = 2//For only two trailing shadows. for(var/turf/T in getline(mobloc, L.loc)) new /obj/effect/temp_visual/dir_setting/ninja/shadow(T, L.dir) diff --git a/code/modules/plumbing/plumbers/fermenter.dm b/code/modules/plumbing/plumbers/fermenter.dm index e67f6401769..19a3637be3a 100644 --- a/code/modules/plumbing/plumbers/fermenter.dm +++ b/code/modules/plumbing/plumbers/fermenter.dm @@ -13,6 +13,10 @@ /obj/machinery/plumbing/fermenter/Initialize(mapload, bolt, layer) . = ..() AddComponent(/datum/component/plumbing/simple_supply, bolt, layer) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user, rotation_type) if(anchored) @@ -32,8 +36,8 @@ if(move_dir == eat_dir) return TRUE -/obj/machinery/plumbing/fermenter/Crossed(atom/movable/AM) - . = ..() +/obj/machinery/plumbing/fermenter/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER ferment(AM) /// uses fermentation proc similar to fermentation barrels diff --git a/code/modules/plumbing/plumbers/grinder_chemical.dm b/code/modules/plumbing/plumbers/grinder_chemical.dm index 6c1eff4acbe..4db5d618f56 100644 --- a/code/modules/plumbing/plumbers/grinder_chemical.dm +++ b/code/modules/plumbing/plumbers/grinder_chemical.dm @@ -12,6 +12,10 @@ /obj/machinery/plumbing/grinder_chemical/Initialize(mapload, bolt, layer) . = ..() AddComponent(/datum/component/plumbing/simple_supply, bolt, layer) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/machinery/plumbing/grinder_chemical/can_be_rotated(mob/user, rotation_type) if(anchored) @@ -31,8 +35,8 @@ if(move_dir == eat_dir) return TRUE -/obj/machinery/plumbing/grinder_chemical/Crossed(atom/movable/AM) - . = ..() +/obj/machinery/plumbing/grinder_chemical/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER grind(AM) /obj/machinery/plumbing/grinder_chemical/proc/grind(atom/AM) diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index d0ce7f70232..9a1538a236b 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -927,9 +927,13 @@ create_reagents(LIGHT_REAGENT_CAPACITY, INJECTABLE | DRAINABLE) AddElement(/datum/element/caltrop, min_damage = force) update() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) -/obj/item/light/Crossed(atom/movable/AM) - . = ..() +/obj/item/light/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(!isliving(AM)) return var/mob/living/L = AM diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm index f9b4b391e7f..46ed815aa6a 100644 --- a/code/modules/power/singularity/containment_field.dm +++ b/code/modules/power/singularity/containment_field.dm @@ -21,6 +21,10 @@ . = ..() air_update_turf(TRUE, TRUE) RegisterSignal(src, COMSIG_ATOM_SINGULARITY_TRY_MOVE, .proc/block_singularity) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/machinery/field/containment/Destroy() FG1.fields -= src @@ -65,8 +69,8 @@ else return ..() -/obj/machinery/field/containment/Crossed(atom/movable/AM) - . = ..() +/obj/machinery/field/containment/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(isliving(AM)) shock(AM) diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm index 81eb6c282ec..e43510f7b9b 100644 --- a/code/modules/power/singularity/field_generator.dm +++ b/code/modules/power/singularity/field_generator.dm @@ -317,7 +317,7 @@ no power level overlay is currently in the overlays list. fields += CF G.fields += CF for(var/mob/living/L in T) - CF.Crossed(L) + CF.on_entered(src, L) connected_gens |= G G.connected_gens |= src diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 7a94526760c..2e4e2acb9a6 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -37,7 +37,7 @@ var/datum/point/vector/trajectory var/trajectory_ignore_forcemove = FALSE //instructs forceMove to NOT reset our trajectory to the new location! /// We already impacted these things, do not impact them again. Used to make sure we can pierce things we want to pierce. Lazylist, typecache style (object = TRUE) for performance. - var/list/impacted + var/list/impacted = list() /// If TRUE, we can hit our firer. var/ignore_source_check = FALSE /// We are flagged PHASING temporarily to not stop moving when we Bump something but want to keep going anyways. @@ -173,6 +173,10 @@ decayedRange = range if(embedding) updateEmbedding() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/projectile/proc/Range() range-- @@ -547,8 +551,8 @@ /** * Projectile crossed: When something enters a projectile's tile, make sure the projectile hits it if it should be hitting it. */ -/obj/projectile/Crossed(atom/movable/AM) - . = ..() +/obj/projectile/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER scan_crossed_hit(AM) /** diff --git a/code/modules/projectiles/projectile/energy/net_snare.dm b/code/modules/projectiles/projectile/energy/net_snare.dm index a5d135c1b30..d7d3e979096 100644 --- a/code/modules/projectiles/projectile/energy/net_snare.dm +++ b/code/modules/projectiles/projectile/energy/net_snare.dm @@ -67,8 +67,8 @@ new/obj/item/restraints/legcuffs/beartrap/energy(get_turf(loc)) else if(iscarbon(target)) var/obj/item/restraints/legcuffs/beartrap/B = new /obj/item/restraints/legcuffs/beartrap/energy(get_turf(target)) - B.Crossed(target) - ..() + B.spring_trap(null, target) + . = ..() /obj/projectile/energy/trap/on_range() new /obj/item/restraints/legcuffs/beartrap/energy(loc) @@ -88,9 +88,9 @@ qdel(src) if(iscarbon(target)) var/obj/item/restraints/legcuffs/beartrap/B = new /obj/item/restraints/legcuffs/beartrap/energy/cyborg(get_turf(target)) - B.Crossed(target) + B.spring_trap(null, target) QDEL_IN(src, 10) - ..() + . = ..() /obj/projectile/energy/trap/cyborg/on_range() do_sparks(1, TRUE, src) diff --git a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm index c0b4061b3e9..6a9ebdc690e 100644 --- a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm +++ b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm @@ -261,6 +261,10 @@ GLOBAL_DATUM(necropolis_gate, /obj/structure/necropolis_gate/legion_gate) /obj/structure/stone_tile/Initialize(mapload) . = ..() icon_state = "[tile_key][rand(1, tile_random_sprite_max)]" + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/structure/stone_tile/Destroy(force) if(force || fallen) @@ -271,8 +275,8 @@ GLOBAL_DATUM(necropolis_gate, /obj/structure/necropolis_gate/legion_gate) /obj/structure/stone_tile/singularity_pull() return -/obj/structure/stone_tile/Crossed(atom/movable/AM) - . = ..() +/obj/structure/stone_tile/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(falling || fallen) return var/turf/T = get_turf(src) @@ -287,7 +291,7 @@ GLOBAL_DATUM(necropolis_gate, /obj/structure/necropolis_gate/legion_gate) switch(fall_on_cross) if(COLLAPSE_ON_CROSS, DESTROY_ON_CROSS) if((I && I.w_class >= WEIGHT_CLASS_BULKY) || (L && !(L.movement_type & FLYING) && L.mob_size >= MOB_SIZE_HUMAN)) //too heavy! too big! aaah! - collapse() + INVOKE_ASYNC(src, .proc/collapse) if(UNIQUE_EFFECT) crossed_effect(AM) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index bba1a24321a..918b42ba203 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -105,8 +105,7 @@ All ShuttleMove procs go here if(loc != oldT) // This is for multi tile objects return - loc = newT - + update_loc(newT) return TRUE @@ -386,7 +385,7 @@ All ShuttleMove procs go here if(loc != oldT) // This is for multi tile objects return - loc = newT + update_loc(newT) return TRUE diff --git a/code/modules/shuttle/special.dm b/code/modules/shuttle/special.dm index b30679be6c0..ada32d4843e 100644 --- a/code/modules/shuttle/special.dm +++ b/code/modules/shuttle/special.dm @@ -195,7 +195,15 @@ max_integrity = 1000 var/boot_dir = 1 -/obj/structure/table/wood/bar/Crossed(atom/movable/AM) +/obj/structure/table/wood/bar/Initialize(mapload, _buildstack) + . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/obj/structure/table/wood/bar/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER var/mob/living/M = AM if(istype(M) && !M.incorporeal_move && !is_barstaff(M)) // No climbing on the bar please @@ -203,8 +211,6 @@ M.Paralyze(40) M.throw_at(throwtarget, 5, 1) to_chat(M, "No climbing on the bar please.") - else - return ..() /obj/structure/table/wood/bar/proc/is_barstaff(mob/living/user) . = FALSE diff --git a/code/modules/spells/spell_types/spacetime_distortion.dm b/code/modules/spells/spell_types/spacetime_distortion.dm index 933ba77736c..2623dfec194 100644 --- a/code/modules/spells/spell_types/spacetime_distortion.dm +++ b/code/modules/spells/spell_types/spacetime_distortion.dm @@ -84,6 +84,10 @@ /obj/effect/cross_action/spacetime_dist/Initialize(mapload) . = ..() setDir(pick(GLOB.cardinals)) + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) /obj/effect/cross_action/spacetime_dist/proc/walk_link(atom/movable/AM) if(ismob(AM)) @@ -102,8 +106,8 @@ playsound(get_turf(src),sound,70,FALSE) busy = FALSE -/obj/effect/cross_action/spacetime_dist/Crossed(atom/movable/AM) - . = ..() +/obj/effect/cross_action/spacetime_dist/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(!busy) walk_link(AM) diff --git a/code/modules/swarmers/swarmer_objs.dm b/code/modules/swarmers/swarmer_objs.dm index 27b0f578e76..171d1030653 100644 --- a/code/modules/swarmers/swarmer_objs.dm +++ b/code/modules/swarmers/swarmer_objs.dm @@ -130,7 +130,15 @@ max_integrity = 10 density = FALSE -/obj/structure/swarmer/trap/Crossed(atom/movable/AM) +/obj/structure/swarmer/trap/Initialize(mapload) + . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = .proc/on_entered, + ) + AddElement(/datum/element/connect_loc, src, loc_connections) + +/obj/structure/swarmer/trap/proc/on_entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER if(isliving(AM)) var/mob/living/living_crosser = AM if(!istype(living_crosser, /mob/living/simple_animal/hostile/swarmer)) @@ -139,7 +147,6 @@ if(iscyborg(living_crosser)) living_crosser.Paralyze(100) qdel(src) - return ..() /obj/structure/swarmer/blockade name = "swarmer blockade" diff --git a/code/modules/unit_tests/hydroponics_harvest.dm b/code/modules/unit_tests/hydroponics_harvest.dm index e4377499e58..eb3b6024028 100644 --- a/code/modules/unit_tests/hydroponics_harvest.dm +++ b/code/modules/unit_tests/hydroponics_harvest.dm @@ -27,9 +27,8 @@ var/mob/living/carbon/human/human = allocate(/mob/living/carbon/human) - hydroponics_tray.loc = run_loc_floor_bottom_left - human.loc = hydroponics_tray.loc - human.x += 1 + hydroponics_tray.forceMove(run_loc_floor_bottom_left) + human.forceMove(locate((run_loc_floor_bottom_left.x + 1), run_loc_floor_bottom_left.y, run_loc_floor_bottom_left.z)) // Apples should harvest 10 apples with 10u nutrients and 4u vitamins. test_seed(hydroponics_tray, planted_food_seed, human) @@ -44,7 +43,7 @@ seed.set_instability(0) // Sets the seed instability to 0, to prevent mutations. tray.myseed = seed - seed.loc = tray + seed.forceMove(tray) tray.name = tray.myseed ? "[initial(tray.name)] ([tray.myseed.plantname])" : initial(tray.name) tray.plant_health = seed.endurance