From 00fd3aa5a678b906e99de4f326509024b54de1a5 Mon Sep 17 00:00:00 2001 From: Mikhail Dzianishchyts Date: Wed, 25 Dec 2024 23:02:57 +0300 Subject: [PATCH] Apply upstream refactors --- modular_ss220/_components/_components.dm | 4 - modular_ss220/_components/_components.dme | 3 - .../_components/code/connect_range.dm | 107 ------------------ modular_ss220/_misc/code/global_procs.dm | 11 -- .../code/signals_mob/signals_mob_living.dm | 4 +- .../code/items/awaymission_gun.dm | 6 +- .../code/clumsy_climb_component.dm | 16 ++- .../clumsy_table/code/clumsy_table.dm | 10 +- modular_ss220/modular_ss220.dme | 1 - modular_ss220/objects/code/officetoys.dm | 18 ++- modular_ss220/objects/code/platform.dm | 41 ++++--- .../objects/code/plushies/hampters.dm | 45 ++++---- .../objects/code/plushies/macvulpix.dm | 7 +- modular_ss220/objects/code/tribune.dm | 21 ++-- .../pixel_shift/code/pixel_shift_component.dm | 2 +- .../wire_splicing/code/wiresplicing.dm | 13 ++- 16 files changed, 113 insertions(+), 196 deletions(-) delete mode 100644 modular_ss220/_components/_components.dm delete mode 100644 modular_ss220/_components/_components.dme delete mode 100644 modular_ss220/_components/code/connect_range.dm diff --git a/modular_ss220/_components/_components.dm b/modular_ss220/_components/_components.dm deleted file mode 100644 index 7de630500b91f..0000000000000 --- a/modular_ss220/_components/_components.dm +++ /dev/null @@ -1,4 +0,0 @@ -/datum/modpack/comps - name = "Компоненты" - desc = "Различные полезные компоненты, которые обязательно(нет) кому то понадобятся" - author = "aylong" diff --git a/modular_ss220/_components/_components.dme b/modular_ss220/_components/_components.dme deleted file mode 100644 index 1b701de2654f9..0000000000000 --- a/modular_ss220/_components/_components.dme +++ /dev/null @@ -1,3 +0,0 @@ -#include "_components.dm" - -#include "code/connect_range.dm" diff --git a/modular_ss220/_components/code/connect_range.dm b/modular_ss220/_components/code/connect_range.dm deleted file mode 100644 index c87d203a2d66c..0000000000000 --- a/modular_ss220/_components/code/connect_range.dm +++ /dev/null @@ -1,107 +0,0 @@ -/** - * This component behaves similar to connect_loc_behalf but for all turfs in range, hooking into a signal on each of them. - * Just like connect_loc_behalf, It can react to that signal on behalf of a seperate listener. - * Good for components, though it carries some overhead. Can't be an element as that may lead to bugs. - */ -/datum/component/connect_range - dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS - - /// An assoc list of signal -> procpath to register to the loc this object is on. - var/list/connections - /** - * The atom the component is tracking. The component will delete itself if the tracked is deleted. - * Signals will also be updated whenever it moves (if it's a movable). - */ - var/atom/tracked - - /// The component will hook into signals only on turfs not farther from tracked than this. - var/range - /// Whether the component works when the movable isn't directly located on a turf. - var/works_in_containers - -/datum/component/connect_range/Initialize(atom/tracked, list/connections, range, works_in_containers = TRUE) - if(!isatom(tracked) || isarea(tracked) || range < 0) - return COMPONENT_INCOMPATIBLE - src.connections = connections - src.range = range - set_tracked(tracked) - src.works_in_containers = works_in_containers - -/datum/component/connect_range/Destroy() - set_tracked(null) - return ..() - -/datum/component/connect_range/InheritComponent(datum/component/component, original, atom/tracked, list/connections, range, works_in_containers) - // Not equivalent. Checks if they are not the same list via shallow comparison. - if(!compare_list(src.connections, connections)) - stack_trace("connect_range component attached to [parent] tried to inherit another connect_range component with different connections") - return - if(src.tracked != tracked) - set_tracked(tracked) - if(src.range == range && src.works_in_containers == works_in_containers) - return - //Unregister the signals with the old settings. - unregister_signals(isturf(tracked) ? tracked : tracked.loc) - src.range = range - src.works_in_containers = works_in_containers - //Re-register the signals with the new settings. - update_signals(src.tracked) - -/datum/component/connect_range/proc/set_tracked(atom/new_tracked) - if(tracked) //Unregister the signals from the old tracked and its surroundings - unregister_signals(isturf(tracked) ? tracked : tracked.loc) - UnregisterSignal(tracked, list( - COMSIG_MOVABLE_MOVED, - COMSIG_PARENT_QDELETING, - )) - tracked = new_tracked - if(!tracked) - return - //Register signals on the new tracked atom and its surroundings. - RegisterSignal(tracked, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved)) - RegisterSignal(tracked, COMSIG_PARENT_QDELETING, PROC_REF(handle_tracked_qdel)) - update_signals(tracked) - -/datum/component/connect_range/proc/handle_tracked_qdel() - SIGNAL_HANDLER - qdel(src) - -/datum/component/connect_range/proc/update_signals(atom/target, atom/old_loc, forced = FALSE) - var/turf/current_turf = get_turf(target) - var/on_same_turf = current_turf == get_turf(old_loc) //Only register/unregister turf signals if it's moved to a new turf. - unregister_signals(old_loc, on_same_turf) - - if(isnull(current_turf)) - return - - if(ismovable(target.loc)) - if(!works_in_containers) - return - //Keep track of possible movement of all movables the target is in. - for(var/atom/movable/container as anything in get_nested_locs(target)) - RegisterSignal(container, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved)) - - if(on_same_turf && !forced) - return - for(var/turf/target_turf in RANGE_TURFS(range, current_turf)) - for(var/signal in connections) - parent.RegisterSignal(target_turf, signal, connections[signal]) - -/datum/component/connect_range/proc/unregister_signals(atom/location, on_same_turf = FALSE) - //The location is null or is a container and the component shouldn't have register signals on it - if(isnull(location) || (!works_in_containers && !isturf(location))) - return - - if(ismovable(location)) - for(var/atom/movable/target as anything in (get_nested_locs(location) + location)) - UnregisterSignal(target, COMSIG_MOVABLE_MOVED) - - if(on_same_turf) - return - var/turf/previous_turf = get_turf(location) - for(var/turf/target_turf in RANGE_TURFS(range, previous_turf)) - parent.UnregisterSignal(target_turf, connections) - -/datum/component/connect_range/proc/on_moved(atom/movable/movable, atom/old_loc) - SIGNAL_HANDLER - update_signals(movable, old_loc) diff --git a/modular_ss220/_misc/code/global_procs.dm b/modular_ss220/_misc/code/global_procs.dm index d6c790f5c99b4..e7163cc06d448 100644 --- a/modular_ss220/_misc/code/global_procs.dm +++ b/modular_ss220/_misc/code/global_procs.dm @@ -1,13 +1,2 @@ /proc/cmp_typepaths_asc(A, B) return sorttext("[B]","[A]") - -///Returns a list of all locations (except the area) the movable is within. -/proc/get_nested_locs(atom/movable/atom_on_location, include_turf = FALSE) - . = list() - var/atom/location = atom_on_location.loc - var/turf/our_turf = get_turf(atom_on_location) - while(location && location != our_turf) - . += location - location = location.loc - if(our_turf && include_turf) //At this point, only the turf is left, provided it exists. - . += our_turf diff --git a/modular_ss220/_signals220/code/signals_mob/signals_mob_living.dm b/modular_ss220/_signals220/code/signals_mob/signals_mob_living.dm index d3dc947da91b8..ae0ad19c5b581 100644 --- a/modular_ss220/_signals220/code/signals_mob/signals_mob_living.dm +++ b/modular_ss220/_signals220/code/signals_mob/signals_mob_living.dm @@ -1,7 +1,7 @@ // Signals for /mob/living -/mob/living/CanPass(atom/movable/mover, turf/target, height) - if(SEND_SIGNAL(src, COMSIG_LIVING_CAN_PASS, mover, target, height) & COMPONENT_LIVING_PASSABLE) +/mob/living/CanPass(atom/movable/mover, border_dir) + if(SEND_SIGNAL(src, COMSIG_LIVING_CAN_PASS, mover, border_dir) & COMPONENT_LIVING_PASSABLE) return TRUE return ..() diff --git a/modular_ss220/awaymission_gun/code/items/awaymission_gun.dm b/modular_ss220/awaymission_gun/code/items/awaymission_gun.dm index 61659b4992d7f..49e0b42a23c71 100644 --- a/modular_ss220/awaymission_gun/code/items/awaymission_gun.dm +++ b/modular_ss220/awaymission_gun/code/items/awaymission_gun.dm @@ -14,11 +14,11 @@ /obj/item/gun/energy/laser/awaymission_aeg/Initialize(mapload) . = ..() // Force update it incase it spawns outside an away mission and shouldnt be charged - onTransitZ(new_z = loc.z) + on_changed_z_level(new_turf = loc.z) -/obj/item/gun/energy/laser/awaymission_aeg/onTransitZ(old_z, new_z) +/obj/item/gun/energy/laser/awaymission_aeg/on_changed_z_level(turf/old_turf, turf/new_turf) . = ..() - if(is_away_level(new_z)) + if(is_away_level(new_turf)) if(ismob(loc)) to_chat(loc, span_notice("Ваш [src] активируется, начиная аккумулировать энергию из материи сущего.")) selfcharge = TRUE diff --git a/modular_ss220/clumsy_table/code/clumsy_climb_component.dm b/modular_ss220/clumsy_table/code/clumsy_climb_component.dm index 69ce54a644118..4a87258d95092 100644 --- a/modular_ss220/clumsy_table/code/clumsy_climb_component.dm +++ b/modular_ss220/clumsy_table/code/clumsy_climb_component.dm @@ -8,18 +8,24 @@ var/max_thrown_objects = 15 // max possible thrown objects when not forced var/max_thrown_objects_low = 5 + /// what we set connect_loc to if parent is an atom + var/static/list/default_connections = list( + COMSIG_ATOM_ENTERED = PROC_REF(cross), + ) /datum/component/clumsy_climb/Initialize() if(!isatom(parent)) return COMPONENT_INCOMPATIBLE + if(ismovable(parent)) + AddComponent(/datum/component/connect_loc_behalf, parent, default_connections) + /datum/component/clumsy_climb/RegisterWithParent() - RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, PROC_REF(cross)) RegisterSignal(parent, COMSIG_CLIMBED_ON, PROC_REF(cross)) RegisterSignal(parent, COMSIG_DANCED_ON, PROC_REF(cross)) /datum/component/clumsy_climb/UnregisterFromParent() - UnregisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_CLIMBED_ON, COMSIG_DANCED_ON)) + UnregisterSignal(parent, list(COMSIG_CLIMBED_ON, COMSIG_DANCED_ON)) /datum/component/clumsy_climb/proc/cross(atom/table, mob/living/user) SIGNAL_HANDLER @@ -63,8 +69,8 @@ var/list/items_to_throw = list() - var/turf/user_turf = get_turf(user) - for(var/obj/item/candidate_to_throw in user_turf) + var/turf/parent_turf = get_turf(parent) + for(var/obj/item/candidate_to_throw in parent_turf) if(length(items_to_throw) >= max_thrown_objects) break @@ -74,7 +80,7 @@ items_to_throw += candidate_to_throw for(var/obj/item/item_to_throw as anything in items_to_throw) - var/atom/thrown_target = get_edge_target_turf(user, get_dir(user_turf, get_step_away(item_to_throw, user_turf))) + var/atom/thrown_target = get_edge_target_turf(user, get_dir(parent_turf, get_step_away(item_to_throw, parent_turf))) item_to_throw.throw_at(target = thrown_target, range = 1, speed = 1) item_to_throw.force *= force_mod item_to_throw.throwforce *= force_mod //no killing using shards :lul: diff --git a/modular_ss220/clumsy_table/code/clumsy_table.dm b/modular_ss220/clumsy_table/code/clumsy_table.dm index 3edfd64c3c189..ffd53b96e0968 100644 --- a/modular_ss220/clumsy_table/code/clumsy_table.dm +++ b/modular_ss220/clumsy_table/code/clumsy_table.dm @@ -1,6 +1,12 @@ -/obj/structure/table/Crossed(atom/movable/AM, oldloc) - AddComponent(/datum/component/clumsy_climb, 5) +/obj/structure/table/Initialize(mapload) . = ..() + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = PROC_REF(on_crossed) + ) + AddElement(/datum/element/connect_loc, loc_connections) + +/obj/structure/table/proc/on_crossed(atom/crosser) + AddComponent(/datum/component/clumsy_climb, 5) /obj/structure/table/do_climb(mob/living/user) . = ..() diff --git a/modular_ss220/modular_ss220.dme b/modular_ss220/modular_ss220.dme index e80023eb857f0..9345b3d03cf32 100644 --- a/modular_ss220/modular_ss220.dme +++ b/modular_ss220/modular_ss220.dme @@ -5,7 +5,6 @@ // --- MAINTENANCE --- // #include "_rust_utils/_rust_utils.dme" -#include "_components/_components.dme" #include "_defines220/_defines220.dme" #include "_signals220/_signals220.dme" #include "_misc/_misc.dme" diff --git a/modular_ss220/objects/code/officetoys.dm b/modular_ss220/objects/code/officetoys.dm index 78443e9b4b17d..ae676f49a68d6 100644 --- a/modular_ss220/objects/code/officetoys.dm +++ b/modular_ss220/objects/code/officetoys.dm @@ -16,8 +16,10 @@ . = ..() countdown = new(src) -/obj/item/hourglass/attack_self__legacy__attackchain(mob/user) +/obj/item/hourglass/activate_self(mob/user) . = ..() + if(.) + return if(hand_activated) toggle(user) @@ -109,12 +111,12 @@ else icon_state = "[initial(icon_state)]" -/obj/item/toy/desk/attack_self__legacy__attackchain(mob/user) +/obj/item/hourglass/attack_self__legacy__attackchain(mob/user) + . = ..() on = !on if(activation_sound) playsound(src.loc, activation_sound, 75, 1) update_icon() - return TRUE /obj/item/toy/desk/examine(mob/user) . = ..() @@ -155,7 +157,10 @@ . = ..() soundloop = new(list(src), FALSE) -/obj/item/toy/desk/newtoncradle/attack_self__legacy__attackchain(mob/user) +/obj/item/toy/desk/newtoncradle/activate_self(mob/user) + . = ..() + if(.) + return on = !on update_icon() if(on) @@ -173,7 +178,10 @@ . = ..() soundloop = new(list(src), FALSE) -/obj/item/toy/desk/fan/attack_self__legacy__attackchain(mob/user) +/obj/item/toy/desk/fan/activate_self(mob/user) + . = ..() + if(.) + return on = !on update_icon() if(on) diff --git a/modular_ss220/objects/code/platform.dm b/modular_ss220/objects/code/platform.dm index c7086e605748b..4593785042ec5 100644 --- a/modular_ss220/objects/code/platform.dm +++ b/modular_ss220/objects/code/platform.dm @@ -27,6 +27,10 @@ /obj/structure/platform/Initialize(mapload) . = ..() CheckLayer() + var/static/list/loc_connections = list( + COMSIG_ATOM_EXIT = PROC_REF(on_atom_exit), + ) + AddElement(/datum/element/connect_loc, loc_connections) /obj/structure/platform/New() ..() @@ -87,23 +91,27 @@ qdel(src) -/obj/structure/platform/CheckExit(atom/movable/O, turf/target) +/obj/structure/platform/proc/on_atom_exit(datum/source, atom/movable/leaving, direction) + SIGNAL_HANDLER + if(!anchored) CheckLayer() - if(istype(O, /obj/structure/platform)) - return FALSE - if(istype(O, /obj/item/projectile) || istype(O, /obj/effect)) - return TRUE - if(corner) - return !density - if(O && O.throwing) - return TRUE - if(((flags & ON_BORDER) && get_dir(loc, target) == dir)) - return FALSE - else - return TRUE + if(istype(leaving, /obj/structure/platform)) + return COMPONENT_ATOM_BLOCK_EXIT + if(istype(leaving, /obj/item/projectile) || istype(leaving, /obj/effect)) + return + var/mob/living/M = leaving + if(istype(M)) + if(HAS_TRAIT(M, TRAIT_FLYING) || M.floating || (IS_HORIZONTAL(M) && HAS_TRAIT(M, TRAIT_CONTORTED_BODY))) + return + if(leaving.throwing) + return + if(leaving.move_force >= MOVE_FORCE_EXTREMELY_STRONG) + return + if(!(flags & ON_BORDER) || direction == dir) + return COMPONENT_ATOM_BLOCK_EXIT -/obj/structure/platform/CanPass(atom/movable/mover, turf/target) +/obj/structure/platform/CanPass(atom/movable/mover, border_dir) if(!anchored) CheckLayer() if(istype(mover, /obj/structure/platform)) @@ -117,10 +125,9 @@ var/obj/structure/S = locate(/obj/structure) in get_turf(mover) if(S && S.climbable && !(S.flags & ON_BORDER) && climbable && isliving(mover))// Climbable objects allow you to universally climb over others return TRUE - if(!(flags & ON_BORDER) || get_dir(loc, target) == dir) + if(!(flags & ON_BORDER) || border_dir == dir) return FALSE - else - return TRUE + return TRUE /obj/structure/platform/do_climb(mob/living/user) if(!can_touch(user) || !climbable) diff --git a/modular_ss220/objects/code/plushies/hampters.dm b/modular_ss220/objects/code/plushies/hampters.dm index 430269fdeb3c2..38fbeb436d29f 100644 --- a/modular_ss220/objects/code/plushies/hampters.dm +++ b/modular_ss220/objects/code/plushies/hampters.dm @@ -6,7 +6,10 @@ RegisterSignal(parent, list(COMSIG_ATOM_HULK_ATTACK, COMSIG_ATTACK_BY, COMSIG_MOVABLE_BUMP, COMSIG_ATTACK, COMSIG_ATTACK_OBJ), PROC_REF(play_squeak)) // Пищит при наступании - RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, PROC_REF(play_squeak_crossed)) + var/static/list/crossed_connections = list( + COMSIG_ATOM_ENTERED = PROC_REF(play_squeak_crossed), + ) + AddComponent(/datum/component/connect_loc_behalf, parent, crossed_connections) // Пищание /datum/component/plushtoy/proc/play_squeak() @@ -65,34 +68,34 @@ AddComponent(/datum/component/plushtoy) // Действия при взаимодействии в руке при разных интентах -/obj/item/toy/hampter/attack_self__legacy__attackchain(mob/living/carbon/human/user) +/obj/item/toy/hampter/activate_self(mob/user) . = ..() - // Небольшой кулдаун дабы нельзя было спамить - if(cooldown < world.time - 10) - switch(user.a_intent) - // Если выбрано что угодно кроме харма - жмякаем с писком хамптера - if(INTENT_HELP, INTENT_DISARM, INTENT_GRAB) - playsound(get_turf(src), squeak, 50, 1, -10) - - // Если выбран харм, сжимаем хамптера до "краски" (?) в его туловище - if(INTENT_HARM) + if(. || cooldown >= world.time - 1 SECONDS) + return + switch(user.a_intent) + // Если выбрано что угодно кроме харма - жмякаем с писком хамптера + if(INTENT_HELP, INTENT_DISARM, INTENT_GRAB) + playsound(get_turf(src), squeak, 50, 1, -10) + + // Если выбран харм, сжимаем хамптера до "краски" (?) в его туловище + if(INTENT_HARM) + if(istype(user, /mob/living/carbon/human)) + var/mob/living/carbon/human/human = user + // Прописываю это здесь ибо иначе хомяки будут отмечаться кровавыми в игре blood_DNA = "Plush hampter's paint" - - user.visible_message( - span_warning("[user] раздавил хамптера в своей руке!"), + human.visible_message( + span_warning("[human] раздавил хамптера в своей руке!"), span_warning("Вы раздавили хамптера в своей руке!")) playsound(get_turf(src), "bonebreak", 50, TRUE, -10) + human.hand_blood_color = blood_color + human.transfer_blood_dna(blood_DNA) - user.hand_blood_color = blood_color - user.transfer_blood_dna(blood_DNA) // Сколько бы я не хотел ставить 0 - не выйдет. Нельзя будет отмыть руки в раковине - user.bloody_hands = 1 - user.update_inv_gloves() - + human.bloody_hands = 1 + human.update_inv_gloves() qdel(src) - - cooldown = world.time + cooldown = world.time // Подвиды /obj/item/toy/hampter/assistant diff --git a/modular_ss220/objects/code/plushies/macvulpix.dm b/modular_ss220/objects/code/plushies/macvulpix.dm index db999bd8a894d..a690a0b5ef77a 100644 --- a/modular_ss220/objects/code/plushies/macvulpix.dm +++ b/modular_ss220/objects/code/plushies/macvulpix.dm @@ -30,9 +30,12 @@ M.update_inv_r_hand() M.update_inv_l_hand() -/obj/item/toy/plushie/macvulpix/attackby__legacy__attackchain(obj/item/clothing/glasses/sunglasses, mob/living/user, params) +/obj/item/toy/plushie/macvulpix/attack_by(obj/item/attacking, mob/user, params) . = ..() - if(is_type_in_list(sunglasses, allowed_glasses)) + if(.) + return + if(is_type_in_list(attacking, allowed_glasses)) + var/obj/item/clothing/glasses/sunglasses = attacking user.drop_item() sunglasses.forceMove(src) glasses = sunglasses diff --git a/modular_ss220/objects/code/tribune.dm b/modular_ss220/objects/code/tribune.dm index f683a108fa27b..62f175fccb7bf 100644 --- a/modular_ss220/objects/code/tribune.dm +++ b/modular_ss220/objects/code/tribune.dm @@ -38,6 +38,11 @@ ..() handle_layer() + var/static/list/loc_connections = list( + COMSIG_ATOM_EXIT = PROC_REF(on_atom_exit), + ) + AddElement(/datum/element/connect_loc, loc_connections) + /obj/structure/tribune/setDir(newdir) ..() handle_layer() @@ -61,19 +66,19 @@ setDir(turn(dir, 90)) after_rotation(user) -/obj/structure/tribune/CanPass(atom/movable/mover, turf/target, height=0) +/obj/structure/tribune/CanPass(atom/movable/mover, border_dir) if(istype(mover) && mover.checkpass(PASSGLASS)) return TRUE - if(get_dir(loc, target) == dir) + if(border_dir == dir) return !density return TRUE -/obj/structure/tribune/CheckExit(atom/movable/object, target) - if(istype(object) && object.checkpass(PASSGLASS)) - return TRUE - if(get_dir(object.loc, target) == dir) - return FALSE - return TRUE +/obj/structure/tribune/proc/on_atom_exit(datum/source, atom/movable/leaving, direction) + SIGNAL_HANDLER + if(istype(leaving) && leaving.checkpass(PASSGLASS)) + return + if(direction == dir) + return COMPONENT_ATOM_BLOCK_EXIT /obj/structure/tribune/centcom name = "CentCom tribune" diff --git a/modular_ss220/pixel_shift/code/pixel_shift_component.dm b/modular_ss220/pixel_shift/code/pixel_shift_component.dm index ad20552196238..e463072b7b284 100644 --- a/modular_ss220/pixel_shift/code/pixel_shift_component.dm +++ b/modular_ss220/pixel_shift/code/pixel_shift_component.dm @@ -37,7 +37,7 @@ pixel_shift(source, movement_dir) return COMPONENT_BLOCK_SPACEMOVE -/datum/component/pixel_shift/proc/check_passable(mob/source, atom/movable/mover, target, height) +/datum/component/pixel_shift/proc/check_passable(mob/source, atom/movable/mover, border_dir) SIGNAL_HANDLER var/mob/living/carbon/human/owner = parent if(!istype(mover, /obj/item/projectile) && !mover.throwing && passthroughable & get_dir(owner, mover)) diff --git a/modular_ss220/wire_splicing/code/wiresplicing.dm b/modular_ss220/wire_splicing/code/wiresplicing.dm index 952f4b6eb4a32..58e5d9a0e183e 100644 --- a/modular_ss220/wire_splicing/code/wiresplicing.dm +++ b/modular_ss220/wire_splicing/code/wiresplicing.dm @@ -41,6 +41,11 @@ if(messiness > 2) layer = LOW_OBJ_LAYER // I wont do such stuff on splicing "reinforcement". Take it as nasty feature + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = PROC_REF(on_atom_entered), + ) + AddElement(/datum/element/connect_loc, loc_connections) + // Wire splice can only exist on a cable. Lets try to place it in a good location if(locate(/obj/structure/cable) in get_turf(src)) // If we're already in a good location, no problem! return @@ -99,16 +104,16 @@ . = ..() . += span_warning("It has [messiness] wire[messiness > 1 ? "s" : ""] dangling around.") -/obj/structure/wire_splicing/Crossed(atom/movable/AM, oldloc) - . = ..() - if(isliving(AM)) +/obj/structure/wire_splicing/proc/on_atom_entered(datum/source, atom/movable/entered) + SIGNAL_HANDLER + if(isliving(entered)) var/chance_to_shock = messiness * shock_chance_per_messiness /* var/turf/T = get_turf(src) if(locate(/obj/structure/catwalk) in T) chance_to_shock -= 20 */ - shock(AM, chance_to_shock) + shock(entered, chance_to_shock) /obj/structure/wire_splicing/proc/shock(mob/living/user, prb, siemens_coeff = 1) . = FALSE