diff --git a/code/datums/components/turf_click/turf_hand.dm b/code/datums/components/turf_click/turf_hand.dm index 4b178a6e453..82e112f0f3c 100644 --- a/code/datums/components/turf_click/turf_hand.dm +++ b/code/datums/components/turf_click/turf_hand.dm @@ -1,34 +1,19 @@ -/** - * This component is used on airlocks and cult runes. - * When a mob [attack_hand]s a turf, it will look for objects in itself containing this component. - * If such is found, it will call attack_hand on that atom - */ -#define TURF_HAND_COMPONENT /datum/component/turf_hand +/* + This component is used on airlocks and cult runes. + When a mob [attack_hand]s a turf, it will look for objects in itself containing this component. + If such is found, it will call attack_hand on that atom + + When multiple of these components are in the tile, the one with the highest priority wins it. +*/ /datum/component/turf_hand + var/priority = 1 + var/atom/our_owner -/datum/component/turf_hand/Initialize() - . = ..() - if (!parent) - return +/datum/component/turf_hand/Initialize(var/priority = 1) + ..() + if(isatom(parent)) + our_owner = parent + src.priority = priority - RegisterSignal(parent, COMSIG_HANDLE_HAND_INTERCEPTION, PROC_REF(OnHandInterception), override = TRUE) - -/datum/component/turf_hand/Destroy() - if (parent) - UnregisterSignal(parent, COMSIG_HANDLE_HAND_INTERCEPTION) - - return ..() - -/datum/component/turf_hand/proc/OnHandInterception(var/atom/origin, var/mob/attacker, var/turf/turf) - // SIGNAL_HANDLER - // For the record you shouldn't comment out SIGNAL_HANDLER on signals for your code. - // But StrongDMM doesn't care that I'm calling a proc on ASYNC. - if (!isatom(parent)) - qdel(src) // Invalid parent. Make the component kill itself. - return - - if (!attacker) - return - - var/atom/owner = parent - INVOKE_ASYNC(owner, TYPE_PROC_REF(/atom, attack_hand), attacker) +/datum/component/turf_hand/proc/OnHandInterception(var/mob/user) + return our_owner.attack_hand(user) diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index c1dafd52822..86fdd0dddc6 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -99,7 +99,7 @@ update_nearby_tiles(need_rebuild=1) if(turf_hand_priority) - AddComponent(TURF_HAND_COMPONENT) + AddComponent(/datum/component/turf_hand, turf_hand_priority) /obj/machinery/door/Move(new_loc, new_dir) . = ..() diff --git a/code/game/objects/structures/curtains.dm b/code/game/objects/structures/curtains.dm index b7227d3a23e..da8479faf2b 100644 --- a/code/game/objects/structures/curtains.dm +++ b/code/game/objects/structures/curtains.dm @@ -13,7 +13,7 @@ /obj/structure/curtain/Initialize() . = ..() material = SSmaterials.get_material_by_name(curtain_material) - AddComponent(TURF_HAND_COMPONENT) + AddComponent(/datum/component/turf_hand) /obj/structure/curtain/open icon_state = "open" diff --git a/code/modules/multiz/structures.dm b/code/modules/multiz/structures.dm index 652c5ff9596..1998734cbd6 100644 --- a/code/modules/multiz/structures.dm +++ b/code/modules/multiz/structures.dm @@ -43,7 +43,7 @@ L.update_icon() break - AddComponent(TURF_HAND_COMPONENT) + AddComponent(/datum/component/turf_hand) update_icon() diff --git a/code/modules/turbolift/turbolift_console.dm b/code/modules/turbolift/turbolift_console.dm index 3628b72674c..cb4dc262149 100644 --- a/code/modules/turbolift/turbolift_console.dm +++ b/code/modules/turbolift/turbolift_console.dm @@ -60,7 +60,7 @@ /obj/structure/lift/button/Initialize(mapload, datum/turbolift/_lift) . = ..() - AddComponent(TURF_HAND_COMPONENT) + AddComponent(/datum/component/turf_hand) /obj/structure/lift/button/Destroy() if(floor && floor.ext_panel == src) @@ -106,7 +106,7 @@ /obj/structure/lift/panel/Initialize(mapload, datum/turbolift/_lift) . = ..() - AddComponent(TURF_HAND_COMPONENT) + AddComponent(/datum/component/turf_hand) /obj/structure/lift/panel/attack_ghost(var/mob/user) return ui_interact(user) diff --git a/html/changelogs/hellfirejag-fix-shutters.yml b/html/changelogs/hellfirejag-fix-shutters.yml new file mode 100644 index 00000000000..c4b7530c26e --- /dev/null +++ b/html/changelogs/hellfirejag-fix-shutters.yml @@ -0,0 +1,4 @@ +author: Hellfirejag +delete-after: True +changes: + - bugfix: "Fixed bug with firelocks and doors."