diff --git a/code/__DEFINES/dcs/helpers.dm b/code/__DEFINES/dcs/helpers.dm index 144e94f1fe0..ba2b9a704a3 100644 --- a/code/__DEFINES/dcs/helpers.dm +++ b/code/__DEFINES/dcs/helpers.dm @@ -6,6 +6,14 @@ #define SEND_GLOBAL_SIGNAL(sigtype, arguments...) ( SEND_SIGNAL(SSdcs, sigtype, ##arguments) ) +/// Signifies that this proc is used to handle signals. +/// Every proc you pass to RegisterSignal must have this. +#define SIGNAL_HANDLER SHOULD_NOT_SLEEP(TRUE) + +/// Signifies that this proc is used to handle signals, but also sleeps. +/// Do not use this for new work. +#define SIGNAL_HANDLER_DOES_SLEEP + /// A wrapper for _AddElement that allows us to pretend we're using normal named arguments #define AddElement(arguments...) _AddElement(list(##arguments)) /// A wrapper for _RemoveElement that allows us to pretend we're using normal named arguments diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index c2314330568..38c5001a6e6 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -304,6 +304,8 @@ or shoot a gun to move around via Newton's 3rd Law of Motion." RegisterSignal(taker, COMSIG_MOVABLE_MOVED, .proc/check_in_range, taker) /obj/screen/alert/give/proc/check_in_range(atom/taker) + SIGNAL_HANDLER + if (!giver.CanReach(taker)) to_chat(owner, "You moved out of range of [giver]!") owner.clear_alert("[giver]") diff --git a/code/controllers/subsystem/throwing.dm b/code/controllers/subsystem/throwing.dm index a06649a6451..39e4c304110 100644 --- a/code/controllers/subsystem/throwing.dm +++ b/code/controllers/subsystem/throwing.dm @@ -95,6 +95,8 @@ SUBSYSTEM_DEF(throwing) ///Defines the datum behavior on the thrownthing's qdeletion event. /datum/thrownthing/proc/on_thrownthing_qdel(atom/movable/source, force) + SIGNAL_HANDLER + qdel(src) diff --git a/code/controllers/subsystem/vis_overlays.dm b/code/controllers/subsystem/vis_overlays.dm index 8cf5d5a6289..b0d83715e5e 100644 --- a/code/controllers/subsystem/vis_overlays.dm +++ b/code/controllers/subsystem/vis_overlays.dm @@ -82,6 +82,8 @@ SUBSYSTEM_DEF(vis_overlays) UnregisterSignal(thing, COMSIG_ATOM_DIR_CHANGE) /datum/controller/subsystem/vis_overlays/proc/rotate_vis_overlay(atom/thing, old_dir, new_dir) + SIGNAL_HANDLER + if(old_dir == new_dir) return var/rotation = dir2angle(old_dir) - dir2angle(new_dir) diff --git a/code/datums/achievements/_achievement_data.dm b/code/datums/achievements/_achievement_data.dm index 384663c156e..80f544a965c 100644 --- a/code/datums/achievements/_achievement_data.dm +++ b/code/datums/achievements/_achievement_data.dm @@ -64,6 +64,8 @@ ///Unlocks an achievement of a specific type. achievement type is a typepath to the award, user is the mob getting the award, and value is an optional value to be used for defining a score to add to the leaderboard /datum/achievement_data/proc/unlock(achievement_type, mob/user, value = 1) + set waitfor = FALSE + if(!SSachievements.achievements_enabled) return var/datum/award/A = SSachievements.awards[achievement_type] diff --git a/code/datums/action.dm b/code/datums/action.dm index df93763419d..2b6463fe3a2 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -144,6 +144,8 @@ current_button.button_icon_state = button_icon_state /datum/action/proc/OnUpdatedIcon() + SIGNAL_HANDLER + UpdateButtonIcon() //Presets for item actions @@ -293,6 +295,8 @@ /// Toggle the action icon for the space suit thermal regulator /datum/action/item_action/toggle_spacesuit/proc/toggle(obj/item/clothing/suit/space/suit) + SIGNAL_HANDLER + button_icon_state = "thermal_[suit.thermal_on ? "on" : "off"]" UpdateButtonIcon() diff --git a/code/datums/brain_damage/brain_trauma.dm b/code/datums/brain_damage/brain_trauma.dm index ca63c5b3d66..8571e65d8dd 100644 --- a/code/datums/brain_damage/brain_trauma.dm +++ b/code/datums/brain_damage/brain_trauma.dm @@ -47,10 +47,14 @@ //Called when hearing a spoken message /datum/brain_trauma/proc/handle_hearing(datum/source, list/hearing_args) + SIGNAL_HANDLER + UnregisterSignal(owner, COMSIG_MOVABLE_HEAR) //Called when speaking /datum/brain_trauma/proc/handle_speech(datum/source, list/speech_args) + SIGNAL_HANDLER + UnregisterSignal(owner, COMSIG_MOB_SAY) diff --git a/code/datums/brain_damage/creepy_trauma.dm b/code/datums/brain_damage/creepy_trauma.dm index d3b38fb17f6..61e897e9256 100644 --- a/code/datums/brain_damage/creepy_trauma.dm +++ b/code/datums/brain_damage/creepy_trauma.dm @@ -105,6 +105,8 @@ // if the creep examines first, then the obsession examines them, have a 50% chance to possibly blow their cover. wearing a mask avoids this risk /datum/brain_trauma/special/obsessed/proc/stare(datum/source, mob/living/examining_mob, triggering_examiner) + SIGNAL_HANDLER + if(examining_mob != owner || !triggering_examiner || prob(50)) return diff --git a/code/datums/chatmessage.dm b/code/datums/chatmessage.dm index b11a93a9ae0..3df701ff190 100644 --- a/code/datums/chatmessage.dm +++ b/code/datums/chatmessage.dm @@ -66,6 +66,8 @@ * Calls qdel on the chatmessage when its parent is deleted, used to register qdel signal */ /datum/chatmessage/proc/on_parent_qdel() + SIGNAL_HANDLER + qdel(src) /** diff --git a/code/datums/cinematic.dm b/code/datums/cinematic.dm index 43ebe692a53..410a592bf54 100644 --- a/code/datums/cinematic.dm +++ b/code/datums/cinematic.dm @@ -93,6 +93,8 @@ toggle_ooc(TRUE) /datum/cinematic/proc/show_to(mob/M, client/C) + SIGNAL_HANDLER + if(!M.notransform) locked += M M.notransform = TRUE //Should this be done for non-global cinematics or even at all ? @@ -120,6 +122,8 @@ sleep(50) /datum/cinematic/proc/replacement_cinematic(datum/source, datum/cinematic/other) + SIGNAL_HANDLER + if(!is_global && other.is_global) //Allow it to play if we're local and it's global return NONE return COMPONENT_GLOB_BLOCK_CINEMATIC diff --git a/code/datums/components/anti_magic.dm b/code/datums/components/anti_magic.dm index 84f9f0c90d3..eede283e8b8 100644 --- a/code/datums/components/anti_magic.dm +++ b/code/datums/components/anti_magic.dm @@ -29,15 +29,21 @@ expire = _expire /datum/component/anti_magic/proc/on_equip(datum/source, mob/equipper, slot) + SIGNAL_HANDLER + if(!(allowed_slots & slot)) //Check that the slot is valid for antimagic UnregisterSignal(equipper, COMSIG_MOB_RECEIVE_MAGIC) return RegisterSignal(equipper, COMSIG_MOB_RECEIVE_MAGIC, .proc/protect, TRUE) /datum/component/anti_magic/proc/on_drop(datum/source, mob/user) + SIGNAL_HANDLER + UnregisterSignal(user, COMSIG_MOB_RECEIVE_MAGIC) /datum/component/anti_magic/proc/protect(datum/source, mob/user, _magic, _holy, _psychic, chargecost, self, list/protection_sources) + SIGNAL_HANDLER + if(((_magic && magic) || (_holy && holy) || (_psychic && psychic)) && (!self || blocks_self)) protection_sources += parent reaction?.Invoke(user, chargecost) diff --git a/code/datums/components/archaeology.dm b/code/datums/components/archaeology.dm index 449c3560f03..3be37b94db6 100644 --- a/code/datums/components/archaeology.dm +++ b/code/datums/components/archaeology.dm @@ -26,6 +26,8 @@ _archdrops[I] += other_archdrops[I] /datum/component/archaeology/proc/Dig(datum/source, obj/item/I, mob/living/user) + SIGNAL_HANDLER + if(dug) to_chat(user, "Looks like someone has dug here already!") return @@ -73,6 +75,8 @@ callback.Invoke() /datum/component/archaeology/proc/SingDig(datum/source, S, current_size) + SIGNAL_HANDLER + switch(current_size) if(STAGE_THREE) if(prob(30)) @@ -85,6 +89,8 @@ gets_dug() /datum/component/archaeology/proc/BombDig(datum/source, severity, target) + SIGNAL_HANDLER + switch(severity) if(3) return diff --git a/code/datums/components/armor_plate.dm b/code/datums/components/armor_plate.dm index f026c89c607..1baa1d92c0d 100644 --- a/code/datums/components/armor_plate.dm +++ b/code/datums/components/armor_plate.dm @@ -32,6 +32,8 @@ upgrade_name = initial(typecast.name) /datum/component/armor_plate/proc/examine(datum/source, mob/user, list/examine_list) + SIGNAL_HANDLER + //upgrade_item could also be typecast here instead if(ismecha(parent)) if(amount) @@ -48,6 +50,8 @@ examine_list += "It can be strengthened with up to [maxamount] [upgrade_name]." /datum/component/armor_plate/proc/applyplate(datum/source, obj/item/I, mob/user, params) + SIGNAL_HANDLER + if(!istype(I,upgrade_item)) return if(amount >= maxamount) @@ -75,11 +79,15 @@ /datum/component/armor_plate/proc/dropplates(datum/source, force) + SIGNAL_HANDLER + if(ismecha(parent)) //items didn't drop the plates before and it causes erroneous behavior for the time being with collapsible helmets for(var/i in 1 to amount) new upgrade_item(get_turf(parent)) /datum/component/armor_plate/proc/apply_mech_overlays(obj/mecha/mech, list/overlays) + SIGNAL_HANDLER + if(amount) var/overlay_string = "ripley-g" if(amount >= 3) diff --git a/code/datums/components/art.dm b/code/datums/components/art.dm index cd685e5ec91..eade5a44cf8 100644 --- a/code/datums/components/art.dm +++ b/code/datums/components/art.dm @@ -13,6 +13,8 @@ RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, .proc/apply_moodlet) /datum/component/art/proc/apply_moodlet(mob/M, impress) + SIGNAL_HANDLER + M.visible_message("[M] stops and looks intently at [parent].", \ "You stop to take in [parent].") switch(impress) @@ -27,13 +29,19 @@ /datum/component/art/proc/on_other_examine(datum/source, mob/M) + SIGNAL_HANDLER + apply_moodlet(M, impressiveness) /datum/component/art/proc/on_obj_examine(datum/source, mob/M) + SIGNAL_HANDLER + var/obj/O = parent apply_moodlet(M, impressiveness *(O.obj_integrity/O.max_integrity)) /datum/component/art/proc/on_attack_hand(datum/source, mob/M) + SIGNAL_HANDLER_DOES_SLEEP + to_chat(M, "You start examining [parent]...") if(!do_after(M, 20, target = parent)) return diff --git a/code/datums/components/bane.dm b/code/datums/components/bane.dm index 6fc9260df1b..4ac2c77525a 100644 --- a/code/datums/components/bane.dm +++ b/code/datums/components/bane.dm @@ -28,11 +28,15 @@ UnregisterSignal(parent, COMSIG_ITEM_AFTERATTACK) /datum/component/bane/proc/speciesCheck(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters) + SIGNAL_HANDLER + if(!proximity_flag || !is_species(target, speciestype)) return activate(source, target, user) /datum/component/bane/proc/mobCheck(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters) + SIGNAL_HANDLER + if(!proximity_flag || !istype(target, mobtype)) return activate(source, target, user) diff --git a/code/datums/components/beauty.dm b/code/datums/components/beauty.dm index c149cc2da03..9b3398b4ce9 100644 --- a/code/datums/components/beauty.dm +++ b/code/datums/components/beauty.dm @@ -16,12 +16,16 @@ enter_area(null, A) /datum/component/beauty/proc/enter_area(datum/source, area/A) + SIGNAL_HANDLER + if(A.outdoors) return A.totalbeauty += beauty A.update_beauty() /datum/component/beauty/proc/exit_area(datum/source, area/A) + SIGNAL_HANDLER + if(A.outdoors) return A.totalbeauty -= beauty diff --git a/code/datums/components/beetlejuice.dm b/code/datums/components/beetlejuice.dm index a2fdf13a8c5..c8b4b53c26b 100644 --- a/code/datums/components/beetlejuice.dm +++ b/code/datums/components/beetlejuice.dm @@ -34,6 +34,8 @@ update_regex() /datum/component/beetlejuice/proc/say_react(datum/source, mob/speaker,message) + SIGNAL_HANDLER + if(!speaker || speaker == parent || !message || !active) return var/found = R.Find(message) diff --git a/code/datums/components/butchering.dm b/code/datums/components/butchering.dm index f49a35c1124..4172ae52552 100644 --- a/code/datums/components/butchering.dm +++ b/code/datums/components/butchering.dm @@ -23,6 +23,8 @@ RegisterSignal(parent, COMSIG_ITEM_ATTACK, .proc/onItemAttack) /datum/component/butchering/proc/onItemAttack(obj/item/source, mob/living/M, mob/living/user) + SIGNAL_HANDLER + if(user.a_intent != INTENT_HARM) return if(M.stat == DEAD && (M.butcher_results || M.guaranteed_butcher_results)) //can we butcher it? @@ -122,6 +124,8 @@ RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/onCrossed) /datum/component/butchering/recycler/proc/onCrossed(datum/source, mob/living/L) + SIGNAL_HANDLER + if(!istype(L)) return var/obj/machinery/recycler/eater = parent diff --git a/code/datums/components/caltrop.dm b/code/datums/components/caltrop.dm index 1cd7269125f..dd3f6c547a7 100644 --- a/code/datums/components/caltrop.dm +++ b/code/datums/components/caltrop.dm @@ -15,6 +15,8 @@ RegisterSignal(parent, list(COMSIG_MOVABLE_CROSSED), .proc/Crossed) /datum/component/caltrop/proc/Crossed(datum/source, atom/movable/AM) + SIGNAL_HANDLER + if(!prob(probability)) return diff --git a/code/datums/components/chasm.dm b/code/datums/components/chasm.dm index e0d5f16f353..9d7b180b813 100644 --- a/code/datums/components/chasm.dm +++ b/code/datums/components/chasm.dm @@ -29,6 +29,8 @@ START_PROCESSING(SSobj, src) // process on create, in case stuff is still there /datum/component/chasm/proc/Entered(datum/source, atom/movable/AM) + SIGNAL_HANDLER + START_PROCESSING(SSobj, src) drop_stuff(AM) diff --git a/code/datums/components/construction.dm b/code/datums/components/construction.dm index 01df44752c9..362cf3c0328 100644 --- a/code/datums/components/construction.dm +++ b/code/datums/components/construction.dm @@ -20,6 +20,8 @@ update_parent(index) /datum/component/construction/proc/examine(datum/source, mob/user, list/examine_list) + SIGNAL_HANDLER + if(desc) examine_list += desc @@ -30,6 +32,8 @@ update_parent(index) /datum/component/construction/proc/action(datum/source, obj/item/I, mob/living/user) + SIGNAL_HANDLER_DOES_SLEEP + return check_step(I, user) /datum/component/construction/proc/update_index(diff) diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index 12b729774f7..b7ec72b4447 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -3,6 +3,8 @@ RegisterSignal(parent, COMSIG_MOB_CLIENT_LOGIN, .proc/create_mob_button) /datum/component/personal_crafting/proc/create_mob_button(mob/user, client/CL) + SIGNAL_HANDLER + var/datum/hud/H = user.hud_used var/obj/screen/craft/C = new() C.icon = H.ui_style @@ -312,6 +314,8 @@ qdel(DL) /datum/component/personal_crafting/proc/component_ui_interact(obj/screen/craft/image, location, control, params, user) + SIGNAL_HANDLER_DOES_SLEEP + if(user == parent) ui_interact(user) diff --git a/code/datums/components/deadchat_control.dm b/code/datums/components/deadchat_control.dm index 7c6398e51ab..db6c7a2546b 100644 --- a/code/datums/components/deadchat_control.dm +++ b/code/datums/components/deadchat_control.dm @@ -31,6 +31,8 @@ return ..() /datum/component/deadchat_control/proc/deadchat_react(mob/source, message) + SIGNAL_HANDLER + message = lowertext(message) if(!inputs[message]) return @@ -97,10 +99,14 @@ deltimer(timerid) /datum/component/deadchat_control/proc/orbit_begin(atom/source, atom/orbiter) + SIGNAL_HANDLER + RegisterSignal(orbiter, COMSIG_MOB_DEADSAY, .proc/deadchat_react) orbiters |= orbiter /datum/component/deadchat_control/proc/orbit_stop(atom/source, atom/orbiter) + SIGNAL_HANDLER + if(orbiter in orbiters) UnregisterSignal(orbiter, COMSIG_MOB_DEADSAY) orbiters -= orbiter diff --git a/code/datums/components/decal.dm b/code/datums/components/decal.dm index 3a817e139cb..9a6f40ec95e 100644 --- a/code/datums/components/decal.dm +++ b/code/datums/components/decal.dm @@ -59,11 +59,15 @@ addtimer(CALLBACK(master, /obj/item/.proc/update_slot_icon), 0, TIMER_UNIQUE) /datum/component/decal/proc/late_update_icon(atom/source) + SIGNAL_HANDLER + if(source && istype(source)) source.update_icon() UnregisterSignal(source,COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE) /datum/component/decal/proc/apply_overlay(atom/source, list/overlay_list) + SIGNAL_HANDLER + overlay_list += pic /datum/component/decal/proc/remove(atom/thing) @@ -74,6 +78,8 @@ addtimer(CALLBACK(master, /obj/item/.proc/update_slot_icon), 0, TIMER_UNIQUE) /datum/component/decal/proc/rotate_react(datum/source, old_dir, new_dir) + SIGNAL_HANDLER + if(old_dir == new_dir) return remove() @@ -81,9 +87,13 @@ apply() /datum/component/decal/proc/clean_react(datum/source, clean_types) + SIGNAL_HANDLER + if(clean_types & cleanable) qdel(src) return TRUE /datum/component/decal/proc/examine(datum/source, mob/user, list/examine_list) + SIGNAL_HANDLER + examine_list += description diff --git a/code/datums/components/decals/blood.dm b/code/datums/components/decals/blood.dm index d2c5804222e..e06c563f0d7 100644 --- a/code/datums/components/decals/blood.dm +++ b/code/datums/components/decals/blood.dm @@ -33,6 +33,8 @@ return TRUE /datum/component/decal/blood/proc/get_examine_name(datum/source, mob/user, list/override) + SIGNAL_HANDLER + var/atom/A = parent override[EXAMINE_POSITION_ARTICLE] = A.gender == PLURAL? "some" : "a" override[EXAMINE_POSITION_BEFORE] = " blood-stained " diff --git a/code/datums/components/edible.dm b/code/datums/components/edible.dm index ca6ed388bc1..b9a89ad9de9 100644 --- a/code/datums/components/edible.dm +++ b/code/datums/components/edible.dm @@ -66,6 +66,8 @@ Behavior that's still missing from this component that original food items had t owner.reagents.add_reagent(rid, amount) /datum/component/edible/proc/examine(datum/source, mob/user, list/examine_list) + SIGNAL_HANDLER + if(!(food_flags & FOOD_IN_CONTAINER)) switch (bitecount) if (0) @@ -78,9 +80,13 @@ Behavior that's still missing from this component that original food items had t examine_list += "[parent] was bitten multiple times!" /datum/component/edible/proc/UseFromHand(obj/item/source, mob/living/M, mob/living/user) + SIGNAL_HANDLER + return TryToEat(M, user) /datum/component/edible/proc/TryToEatTurf(datum/source, mob/user) + SIGNAL_HANDLER + return TryToEat(user, user) ///All the checks for the act of eating itself and @@ -230,6 +236,9 @@ Behavior that's still missing from this component that original food items had t ///Ability to feed food to puppers /datum/component/edible/proc/UseByAnimal(datum/source, mob/user) + SIGNAL_HANDLER + + var/atom/owner = parent if(!isdog(user)) diff --git a/code/datums/components/edit_complainer.dm b/code/datums/components/edit_complainer.dm index e2cca2eb50c..da801bc9e0b 100644 --- a/code/datums/components/edit_complainer.dm +++ b/code/datums/components/edit_complainer.dm @@ -19,5 +19,7 @@ RegisterSignal(SSdcs, COMSIG_GLOB_VAR_EDIT, .proc/var_edit_react) /datum/component/edit_complainer/proc/var_edit_react(datum/source, list/arguments) + SIGNAL_HANDLER + var/atom/movable/master = parent master.say(pick(say_lines)) diff --git a/code/datums/components/embedded.dm b/code/datums/components/embedded.dm index cbb7c39a83d..c12d764eb36 100644 --- a/code/datums/components/embedded.dm +++ b/code/datums/components/embedded.dm @@ -157,6 +157,8 @@ /// Called every time a carbon with a harmful embed moves, rolling a chance for the item to cause pain. The chance is halved if the carbon is crawling or walking. /datum/component/embedded/proc/jostleCheck() + SIGNAL_HANDLER + var/mob/living/carbon/victim = parent var/chance = jostle_chance if(victim.m_intent == MOVE_INTENT_WALK || !(victim.mobility_flags & MOBILITY_STAND)) @@ -182,6 +184,8 @@ /// Called when a carbon with an object embedded/stuck to them inspects themselves and clicks the appropriate link to begin ripping the item out. This handles the ripping attempt, descriptors, and dealing damage, then calls safe_remove() /datum/component/embedded/proc/ripOut(datum/source, obj/item/I, obj/item/bodypart/limb) + SIGNAL_HANDLER_DOES_SLEEP + if(I != weapon || src.limb != limb) return var/mob/living/carbon/victim = parent @@ -203,6 +207,8 @@ /// This proc handles the final step and actual removal of an embedded/stuck item from a carbon, whether or not it was actually removed safely. /// Pass TRUE for to_hands if we want it to go to the victim's hands when they pull it out /datum/component/embedded/proc/safeRemove(to_hands) + SIGNAL_HANDLER_DOES_SLEEP + var/mob/living/carbon/victim = parent limb.embedded_objects -= weapon UnregisterSignal(weapon, list(COMSIG_MOVABLE_MOVED, COMSIG_PARENT_QDELETING)) // have to do it here otherwise we trigger weaponDeleted() @@ -218,6 +224,8 @@ /// Something deleted or moved our weapon while it was embedded, how rude! /datum/component/embedded/proc/weaponDeleted() + SIGNAL_HANDLER + var/mob/living/carbon/victim = parent limb.embedded_objects -= weapon diff --git a/code/datums/components/empprotection.dm b/code/datums/components/empprotection.dm index c85cdf31c72..513370f3d5f 100644 --- a/code/datums/components/empprotection.dm +++ b/code/datums/components/empprotection.dm @@ -8,4 +8,6 @@ RegisterSignal(parent, list(COMSIG_ATOM_EMP_ACT), .proc/getEmpFlags) /datum/component/empprotection/proc/getEmpFlags(datum/source, severity) + SIGNAL_HANDLER + return flags diff --git a/code/datums/components/explodable.dm b/code/datums/components/explodable.dm index f5126ccc69d..360ab1dca84 100644 --- a/code/datums/components/explodable.dm +++ b/code/datums/components/explodable.dm @@ -36,20 +36,30 @@ always_delete = _always_delete /datum/component/explodable/proc/explodable_insert_item(datum/source, obj/item/I, mob/M, silent = FALSE, force = FALSE) + SIGNAL_HANDLER + check_if_detonate(I) /datum/component/explodable/proc/explodable_impact(datum/source, atom/hit_atom, datum/thrownthing/throwingdatum) + SIGNAL_HANDLER + check_if_detonate(hit_atom) /datum/component/explodable/proc/explodable_bump(datum/source, atom/A) + SIGNAL_HANDLER + check_if_detonate(A) ///Called when you use this object to attack sopmething /datum/component/explodable/proc/explodable_attack(datum/source, atom/movable/target, mob/living/user) + SIGNAL_HANDLER + check_if_detonate(target) ///Called when you attack a specific body part of the thing this is equipped on. Useful for exploding pants. /datum/component/explodable/proc/explodable_attack_zone(datum/source, damage, damagetype, def_zone) + SIGNAL_HANDLER + if(!def_zone) return if(damagetype != BURN) //Don't bother if it's not fire. @@ -59,9 +69,13 @@ detonate() /datum/component/explodable/proc/on_equip(datum/source, mob/equipper, slot) + SIGNAL_HANDLER + RegisterSignal(equipper, COMSIG_MOB_APPLY_DAMGE, .proc/explodable_attack_zone, TRUE) /datum/component/explodable/proc/on_drop(datum/source, mob/user) + SIGNAL_HANDLER + UnregisterSignal(user, COMSIG_MOB_APPLY_DAMGE) /// Checks if we're hitting the zone this component is covering @@ -103,6 +117,8 @@ /// Expldoe and remove the object /datum/component/explodable/proc/detonate() + SIGNAL_HANDLER + var/atom/A = parent var/log = TRUE if(light_impact_range < 1) diff --git a/code/datums/components/footstep.dm b/code/datums/components/footstep.dm index 1ab97cea544..78c798ef20b 100644 --- a/code/datums/components/footstep.dm +++ b/code/datums/components/footstep.dm @@ -66,6 +66,8 @@ return T /datum/component/footstep/proc/play_simplestep() + SIGNAL_HANDLER + var/turf/open/T = prepare_step() if(!T) return @@ -87,6 +89,8 @@ playsound(T, pick(footstep_sounds[turf_footstep][1]), footstep_sounds[turf_footstep][2] * volume, TRUE, footstep_sounds[turf_footstep][3] + e_range) /datum/component/footstep/proc/play_humanstep() + SIGNAL_HANDLER + if(HAS_TRAIT(parent, TRAIT_SILENT_FOOTSTEPS)) return var/turf/open/T = prepare_step() diff --git a/code/datums/components/forensics.dm b/code/datums/components/forensics.dm index afb529428a5..2622c0e2d6b 100644 --- a/code/datums/components/forensics.dm +++ b/code/datums/components/forensics.dm @@ -52,6 +52,8 @@ return TRUE /datum/component/forensics/proc/clean_act(datum/source, clean_types) + SIGNAL_HANDLER + if(clean_types & CLEAN_TYPE_FINGERPRINTS) wipe_fingerprints() . = TRUE diff --git a/code/datums/components/gps.dm b/code/datums/components/gps.dm index c2b3ad1f30c..9c4cac44d5e 100644 --- a/code/datums/components/gps.dm +++ b/code/datums/components/gps.dm @@ -36,15 +36,21 @@ GLOBAL_LIST_EMPTY(GPS_list) ///Called on COMSIG_ITEM_ATTACK_SELF /datum/component/gps/item/proc/interact(datum/source, mob/user) + SIGNAL_HANDLER_DOES_SLEEP + if(user) ui_interact(user) ///Called on COMSIG_PARENT_EXAMINE /datum/component/gps/item/proc/on_examine(datum/source, mob/user, list/examine_list) + SIGNAL_HANDLER + examine_list += "Alt-click to switch it [tracking ? "off":"on"]." ///Called on COMSIG_ATOM_EMP_ACT /datum/component/gps/item/proc/on_emp_act(datum/source, severity) + SIGNAL_HANDLER + emped = TRUE var/atom/A = parent A.cut_overlay("working") @@ -61,6 +67,8 @@ GLOBAL_LIST_EMPTY(GPS_list) ///Calls toggletracking /datum/component/gps/item/proc/on_AltClick(datum/source, mob/user) + SIGNAL_HANDLER + toggletracking(user) ///Toggles the tracking for the gps diff --git a/code/datums/components/gunpoint.dm b/code/datums/components/gunpoint.dm index d8f1932bcd5..512cc202870 100644 --- a/code/datums/components/gunpoint.dm +++ b/code/datums/components/gunpoint.dm @@ -65,6 +65,8 @@ UnregisterSignal(parent, list(COMSIG_LIVING_START_PULL, COMSIG_MOVABLE_BUMP)) /datum/component/gunpoint/proc/check_bump(atom/B, atom/A) + SIGNAL_HANDLER + var/mob/living/T = A if(T && T == target) var/mob/living/shooter = parent @@ -74,6 +76,8 @@ qdel(src) /datum/component/gunpoint/proc/check_shove(mob/living/carbon/shooter, mob/shooter_again, mob/living/T) + SIGNAL_HANDLER + if(T == target && (shooter.a_intent == INTENT_DISARM || shooter.a_intent == INTENT_GRAB)) shooter.visible_message("[shooter] bumps into [target] and fumbles [shooter.p_their()] aim!", \ "You bump into [target] and fumble your aim!", target) @@ -94,10 +98,14 @@ damage_mult = GUNPOINT_MULT_STAGE_3 /datum/component/gunpoint/proc/check_deescalate() + SIGNAL_HANDLER + if(!can_see(parent, target, GUNPOINT_SHOOTER_STRAY_RANGE - 1)) cancel() /datum/component/gunpoint/proc/trigger_reaction() + SIGNAL_HANDLER_DOES_SLEEP + SEND_SIGNAL(target, COMSIG_CLEAR_MOOD_EVENT, "gunpoint") if(point_of_no_return) return @@ -122,6 +130,8 @@ qdel(src) /datum/component/gunpoint/proc/cancel() + SIGNAL_HANDLER + var/mob/living/shooter = parent shooter.visible_message("[shooter] breaks [shooter.p_their()] aim on [target]!", \ "You are no longer aiming [weapon] at [target].", target) @@ -130,6 +140,8 @@ qdel(src) /datum/component/gunpoint/proc/flinch(attacker, damage, damagetype, def_zone) + SIGNAL_HANDLER_DOES_SLEEP + var/mob/living/shooter = parent var/flinch_chance = 50 diff --git a/code/datums/components/heirloom.dm b/code/datums/components/heirloom.dm index 72b28b125dd..69f8fb817b9 100644 --- a/code/datums/components/heirloom.dm +++ b/code/datums/components/heirloom.dm @@ -12,6 +12,8 @@ RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/examine) /datum/component/heirloom/proc/examine(datum/source, mob/user, list/examine_list) + SIGNAL_HANDLER + if(user.mind == owner) examine_list += "It is your precious [family_name] family heirloom. Keep it safe!" else if(isobserver(user)) diff --git a/code/datums/components/hot_ice.dm b/code/datums/components/hot_ice.dm index 9c0c4730df5..018dfe800d1 100644 --- a/code/datums/components/hot_ice.dm +++ b/code/datums/components/hot_ice.dm @@ -28,9 +28,13 @@ qdel(parent) /datum/component/hot_ice/proc/flame_react(datum/source, exposed_temperature, exposed_volume) + SIGNAL_HANDLER + if(exposed_temperature > T0C + 100) hot_ice_melt() /datum/component/hot_ice/proc/attackby_react(datum/source, obj/item/thing, mob/user, params) + SIGNAL_HANDLER + if(thing.get_temperature()) hot_ice_melt(user) diff --git a/code/datums/components/igniter.dm b/code/datums/components/igniter.dm index 175e8266018..152a325e92e 100644 --- a/code/datums/components/igniter.dm +++ b/code/datums/components/igniter.dm @@ -19,14 +19,20 @@ UnregisterSignal(parent, list(COMSIG_ITEM_AFTERATTACK, COMSIG_HOSTILE_ATTACKINGTARGET, COMSIG_PROJECTILE_ON_HIT)) /datum/component/igniter/proc/item_afterattack(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters) + SIGNAL_HANDLER + if(!proximity_flag) return do_igniter(target) /datum/component/igniter/proc/hostile_attackingtarget(mob/living/simple_animal/hostile/attacker, atom/target) + SIGNAL_HANDLER + do_igniter(target) /datum/component/igniter/proc/projectile_hit(atom/fired_from, atom/movable/firer, atom/target, Angle) + SIGNAL_HANDLER + do_igniter(target) /datum/component/igniter/proc/do_igniter(atom/target) diff --git a/code/datums/components/infective.dm b/code/datums/components/infective.dm index 2a893ad4dee..7bf6c87afca 100644 --- a/code/datums/components/infective.dm +++ b/code/datums/components/infective.dm @@ -33,11 +33,15 @@ RegisterSignal(parent, COMSIG_GIBS_STREAK, .proc/try_infect_streak) /datum/component/infective/proc/try_infect_eat(datum/source, mob/living/eater, mob/living/feeder) + SIGNAL_HANDLER + for(var/V in diseases) eater.ForceContractDisease(V) try_infect(feeder, BODY_ZONE_L_ARM) /datum/component/infective/proc/try_infect_drink(datum/source, mob/living/drinker, mob/living/feeder) + SIGNAL_HANDLER + for(var/disease in diseases) drinker.ForceContractDisease(disease) var/appendage_zone = feeder.held_items.Find(source) @@ -45,15 +49,21 @@ try_infect(feeder, appendage_zone) /datum/component/infective/proc/clean(datum/source, clean_types) + SIGNAL_HANDLER + if(clean_types & required_clean_types) qdel(src) return TRUE /datum/component/infective/proc/try_infect_buckle(datum/source, mob/M, force) + SIGNAL_HANDLER + if(isliving(M)) try_infect(M) /datum/component/infective/proc/try_infect_collide(datum/source, atom/A) + SIGNAL_HANDLER + var/atom/movable/P = parent if(P.throwing) //this will be handled by try_infect_impact_zone() @@ -62,9 +72,13 @@ try_infect(A) /datum/component/infective/proc/try_infect_impact_zone(datum/source, mob/living/target, hit_zone) + SIGNAL_HANDLER + try_infect(target, hit_zone) /datum/component/infective/proc/try_infect_attack_zone(datum/source, mob/living/carbon/target, mob/living/user, hit_zone) + SIGNAL_HANDLER + try_infect(user, BODY_ZONE_L_ARM) try_infect(target, hit_zone) @@ -74,6 +88,8 @@ try_infect(user, BODY_ZONE_L_ARM) /datum/component/infective/proc/try_infect_equipped(datum/source, mob/living/L, slot) + SIGNAL_HANDLER + var/old_permeability if(isitem(parent)) //if you are putting an infective item on, it obviously will not protect you, so set its permeability high enough that it will never block ContactContractDisease() @@ -88,10 +104,14 @@ I.permeability_coefficient = old_permeability /datum/component/infective/proc/try_infect_crossed(datum/source, atom/movable/M) + SIGNAL_HANDLER + if(isliving(M)) try_infect(M, BODY_ZONE_PRECISE_L_FOOT) /datum/component/infective/proc/try_infect_streak(datum/source, list/directions, list/output_diseases) + SIGNAL_HANDLER + output_diseases |= diseases /datum/component/infective/proc/try_infect(mob/living/L, target_zone) diff --git a/code/datums/components/jousting.dm b/code/datums/components/jousting.dm index deef1284944..fcecf89f1d0 100644 --- a/code/datums/components/jousting.dm +++ b/code/datums/components/jousting.dm @@ -23,16 +23,22 @@ RegisterSignal(parent, COMSIG_ITEM_ATTACK, .proc/on_attack) /datum/component/jousting/proc/on_equip(datum/source, mob/user, slot) + SIGNAL_HANDLER + RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/mob_move, TRUE) current_holder = user /datum/component/jousting/proc/on_drop(datum/source, mob/user) + SIGNAL_HANDLER + UnregisterSignal(user, COMSIG_MOVABLE_MOVED) current_holder = null current_direction = NONE current_tile_charge = 0 /datum/component/jousting/proc/on_attack(datum/source, mob/living/target, mob/user) + SIGNAL_HANDLER + if(user != current_holder) return var/current = current_tile_charge @@ -59,6 +65,8 @@ user.visible_message("[msg]!") /datum/component/jousting/proc/mob_move(datum/source, newloc, dir) + SIGNAL_HANDLER + if(!current_holder || (requires_mount && ((requires_mob_riding && !ismob(current_holder.buckled)) || (!current_holder.buckled)))) return if(dir != current_direction) diff --git a/code/datums/components/knockback.dm b/code/datums/components/knockback.dm index 26c160d69e8..b042973c573 100644 --- a/code/datums/components/knockback.dm +++ b/code/datums/components/knockback.dm @@ -27,16 +27,22 @@ /// triggered after an item attacks something /datum/component/knockback/proc/item_afterattack(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters) + SIGNAL_HANDLER + if(!proximity_flag) return do_knockback(target, user, get_dir(source, target)) /// triggered after a hostile simplemob attacks something /datum/component/knockback/proc/hostile_attackingtarget(mob/living/simple_animal/hostile/attacker, atom/target) + SIGNAL_HANDLER + do_knockback(target, attacker, get_dir(attacker, target)) /// triggered after a projectile hits something /datum/component/knockback/proc/projectile_hit(atom/fired_from, atom/movable/firer, atom/target, Angle) + SIGNAL_HANDLER + do_knockback(target, null, angle2dir(Angle)) diff --git a/code/datums/components/knockoff.dm b/code/datums/components/knockoff.dm index 7d399c7d26d..3f1c5422ce4 100644 --- a/code/datums/components/knockoff.dm +++ b/code/datums/components/knockoff.dm @@ -19,6 +19,8 @@ src.slots_knockoffable = slots_knockoffable /datum/component/knockoff/proc/Knockoff(mob/living/attacker,zone) + SIGNAL_HANDLER + var/obj/item/I = parent var/mob/living/carbon/human/wearer = I.loc if(!istype(wearer)) @@ -33,6 +35,8 @@ wearer.visible_message("[attacker] knocks off [wearer]'s [I.name]!","[attacker] knocks off your [I.name]!") /datum/component/knockoff/proc/OnEquipped(datum/source, mob/living/carbon/human/H,slot) + SIGNAL_HANDLER + if(!istype(H)) return if(slots_knockoffable && !(slot in slots_knockoffable)) @@ -41,4 +45,6 @@ RegisterSignal(H, COMSIG_HUMAN_DISARM_HIT, .proc/Knockoff, TRUE) /datum/component/knockoff/proc/OnDropped(datum/source, mob/living/M) + SIGNAL_HANDLER + UnregisterSignal(M, COMSIG_HUMAN_DISARM_HIT) diff --git a/code/datums/components/label.dm b/code/datums/components/label.dm index c6d0c595ebb..f93e2d93147 100644 --- a/code/datums/components/label.dm +++ b/code/datums/components/label.dm @@ -52,6 +52,8 @@ * user: The mob who is wielding the attacking object. */ /datum/component/label/proc/OnAttackby(datum/source, obj/item/attacker, mob/user) + SIGNAL_HANDLER + // If the attacking object is not a hand labeler or its mode is 1 (has a label ready to apply), return. // The hand labeler should be off (mode is 0), in order to remove a label. var/obj/item/hand_labeler/labeler = attacker @@ -73,6 +75,8 @@ * examine_list: The current list of text getting passed from the parent's normal examine() proc. */ /datum/component/label/proc/Examine(datum/source, mob/user, list/examine_list) + SIGNAL_HANDLER + examine_list += "It has a label with some words written on it. Use a hand labeler to remove it." /// Applies a label to the name of the parent in the format of: "parent_name (label)" diff --git a/code/datums/components/lifesteal.dm b/code/datums/components/lifesteal.dm index 499816f1774..6bbb1f4b7fb 100644 --- a/code/datums/components/lifesteal.dm +++ b/code/datums/components/lifesteal.dm @@ -20,14 +20,20 @@ UnregisterSignal(parent, list(COMSIG_ITEM_AFTERATTACK, COMSIG_HOSTILE_ATTACKINGTARGET, COMSIG_PROJECTILE_ON_HIT)) /datum/component/lifesteal/proc/item_afterattack(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters) + SIGNAL_HANDLER + if(!proximity_flag) return do_lifesteal(user, target) /datum/component/lifesteal/proc/hostile_attackingtarget(mob/living/simple_animal/hostile/attacker, atom/target) + SIGNAL_HANDLER + do_lifesteal(attacker, target) /datum/component/lifesteal/proc/projectile_hit(atom/fired_from, atom/movable/firer, atom/target, Angle) + SIGNAL_HANDLER + do_lifesteal(firer, target) /datum/component/lifesteal/proc/do_lifesteal(atom/heal_target, atom/damage_target) diff --git a/code/datums/components/magnetic_catch.dm b/code/datums/components/magnetic_catch.dm index 20cd8e1d78f..00d3b28d674 100644 --- a/code/datums/components/magnetic_catch.dm +++ b/code/datums/components/magnetic_catch.dm @@ -16,19 +16,31 @@ RegisterSignal(i, COMSIG_MOVABLE_PRE_THROW, .proc/throw_react) /datum/component/magnetic_catch/proc/examine(datum/source, mob/user, list/examine_list) + SIGNAL_HANDLER + examine_list += "It has been installed with inertia dampening to prevent coffee spills." /datum/component/magnetic_catch/proc/crossed_react(datum/source, atom/movable/thing) + SIGNAL_HANDLER + RegisterSignal(thing, COMSIG_MOVABLE_PRE_THROW, .proc/throw_react, TRUE) /datum/component/magnetic_catch/proc/uncrossed_react(datum/source, atom/movable/thing) + SIGNAL_HANDLER + UnregisterSignal(thing, COMSIG_MOVABLE_PRE_THROW) /datum/component/magnetic_catch/proc/entered_react(datum/source, atom/movable/thing, atom/oldloc) + SIGNAL_HANDLER + RegisterSignal(thing, COMSIG_MOVABLE_PRE_THROW, .proc/throw_react, TRUE) /datum/component/magnetic_catch/proc/exited_react(datum/source, atom/movable/thing, atom/newloc) + SIGNAL_HANDLER + UnregisterSignal(thing, COMSIG_MOVABLE_PRE_THROW) /datum/component/magnetic_catch/proc/throw_react(datum/source, list/arguments) + SIGNAL_HANDLER + return COMPONENT_CANCEL_THROW diff --git a/code/datums/components/manual_blinking.dm b/code/datums/components/manual_blinking.dm index 2459ec438f1..aa986672189 100644 --- a/code/datums/components/manual_blinking.dm +++ b/code/datums/components/manual_blinking.dm @@ -43,9 +43,13 @@ UnregisterSignal(parent, COMSIG_MOB_DEATH) /datum/component/manual_blinking/proc/restart() + SIGNAL_HANDLER + START_PROCESSING(SSdcs, src) /datum/component/manual_blinking/proc/pause() + SIGNAL_HANDLER + STOP_PROCESSING(SSdcs, src) /datum/component/manual_blinking/process() @@ -63,6 +67,8 @@ warn_grace = TRUE /datum/component/manual_blinking/proc/check_added_organ(mob/who_cares, obj/item/organ/O) + SIGNAL_HANDLER + var/obj/item/organ/eyes/new_eyes = O if(istype(new_eyes,/obj/item/organ/eyes)) @@ -70,6 +76,8 @@ START_PROCESSING(SSdcs, src) /datum/component/manual_blinking/proc/check_removed_organ(mob/who_cares, obj/item/organ/O) + SIGNAL_HANDLER + var/obj/item/organ/eyes/bye_beyes = O // oh come on, that's pretty good if(istype(bye_beyes, /obj/item/organ/eyes)) @@ -77,6 +85,8 @@ STOP_PROCESSING(SSdcs, src) /datum/component/manual_blinking/proc/check_emote(mob/living/carbon/user, datum/emote/emote) + SIGNAL_HANDLER + if(emote.type in valid_emotes) warn_grace = FALSE warn_dying = FALSE diff --git a/code/datums/components/manual_breathing.dm b/code/datums/components/manual_breathing.dm index da1c6cffc47..9fba5b46b83 100644 --- a/code/datums/components/manual_breathing.dm +++ b/code/datums/components/manual_breathing.dm @@ -43,9 +43,13 @@ UnregisterSignal(parent, COMSIG_MOB_DEATH) /datum/component/manual_breathing/proc/restart() + SIGNAL_HANDLER + START_PROCESSING(SSdcs, src) /datum/component/manual_breathing/proc/pause() + SIGNAL_HANDLER + STOP_PROCESSING(SSdcs, src) /datum/component/manual_breathing/process() @@ -65,6 +69,8 @@ warn_grace = TRUE /datum/component/manual_breathing/proc/check_added_organ(mob/who_cares, obj/item/organ/O) + SIGNAL_HANDLER + var/obj/item/organ/eyes/new_lungs = O if(istype(new_lungs,/obj/item/organ/lungs)) @@ -72,6 +78,8 @@ START_PROCESSING(SSdcs, src) /datum/component/manual_breathing/proc/check_removed_organ(mob/who_cares, obj/item/organ/O) + SIGNAL_HANDLER + var/obj/item/organ/lungs/old_lungs = O if(istype(old_lungs, /obj/item/organ/lungs)) @@ -79,6 +87,8 @@ STOP_PROCESSING(SSdcs, src) /datum/component/manual_breathing/proc/check_emote(mob/living/carbon/user, datum/emote/emote) + SIGNAL_HANDLER + if(emote.type == next_breath_type) if(next_breath_type == /datum/emote/inhale) next_breath_type = /datum/emote/exhale diff --git a/code/datums/components/material_container.dm b/code/datums/components/material_container.dm index cb812ac4ee5..b70971042e1 100644 --- a/code/datums/components/material_container.dm +++ b/code/datums/components/material_container.dm @@ -46,6 +46,8 @@ materials[M] = 0 /datum/component/material_container/proc/OnExamine(datum/source, mob/user) + SIGNAL_HANDLER + if(show_on_examine) for(var/I in materials) var/datum/material/M = I @@ -55,6 +57,8 @@ /// Proc that allows players to fill the parent with mats /datum/component/material_container/proc/OnAttackBy(datum/source, obj/item/I, mob/living/user) + SIGNAL_HANDLER + var/list/tc = allowed_typecache if(disable_attackby) return diff --git a/code/datums/components/mirv.dm b/code/datums/components/mirv.dm index bf9413a5c04..ef0790ef673 100644 --- a/code/datums/components/mirv.dm +++ b/code/datums/components/mirv.dm @@ -22,6 +22,8 @@ UnregisterSignal(parent, list(COMSIG_PROJECTILE_ON_HIT)) /datum/component/mirv/proc/projectile_hit(atom/fired_from, atom/movable/firer, atom/target, Angle) + SIGNAL_HANDLER_DOES_SLEEP + do_shrapnel(firer, target) /datum/component/mirv/proc/do_shrapnel(mob/firer, atom/target) diff --git a/code/datums/components/mood.dm b/code/datums/components/mood.dm index 022e20896ee..b39d4b417a1 100644 --- a/code/datums/components/mood.dm +++ b/code/datums/components/mood.dm @@ -38,6 +38,8 @@ return ..() /datum/component/mood/proc/register_job_signals(datum/source, job) + SIGNAL_HANDLER + if(job in list("Research Director", "Scientist", "Roboticist")) RegisterSignal(parent, COMSIG_ADD_MOOD_EVENT_RND, .proc/add_event) //Mood events that are only for RnD members @@ -237,6 +239,8 @@ insanity_effect = newval /datum/component/mood/proc/add_event(datum/source, category, type, ...) //Category will override any events in the same category, should be unique unless the event is based on the same thing like hunger. + SIGNAL_HANDLER + var/datum/mood_event/the_event if(!istext(category)) category = REF(category) @@ -260,6 +264,8 @@ addtimer(CALLBACK(src, .proc/clear_event, null, category), the_event.timeout, TIMER_UNIQUE|TIMER_OVERRIDE) /datum/component/mood/proc/clear_event(datum/source, category) + SIGNAL_HANDLER + if(!istext(category)) category = REF(category) var/datum/mood_event/event = mood_events[category] @@ -281,6 +287,8 @@ /datum/component/mood/proc/modify_hud(datum/source) + SIGNAL_HANDLER + var/mob/living/owner = parent var/datum/hud/hud = owner.hud_used screen_obj = new @@ -290,6 +298,8 @@ RegisterSignal(screen_obj, COMSIG_CLICK, .proc/hud_click) /datum/component/mood/proc/unmodify_hud(datum/source) + SIGNAL_HANDLER + if(!screen_obj) return var/mob/living/owner = parent @@ -299,6 +309,8 @@ QDEL_NULL(screen_obj) /datum/component/mood/proc/hud_click(datum/source, location, control, params, mob/user) + SIGNAL_HANDLER + if(user != parent) return print_mood(user) @@ -343,6 +355,8 @@ add_event(null, "charge", /datum/mood_event/supercharged) /datum/component/mood/proc/check_area_mood(datum/source, area/A) + SIGNAL_HANDLER + update_beauty(A) if(A.mood_bonus) add_event(null, "area", /datum/mood_event/area, A.mood_bonus, A.mood_message) @@ -373,6 +387,8 @@ ///Called when parent is ahealed. /datum/component/mood/proc/on_revive(datum/source, full_heal) + SIGNAL_HANDLER + if(!full_heal) return remove_temp_moods() diff --git a/code/datums/components/nanites.dm b/code/datums/components/nanites.dm index d1efea19a32..52341fde5ca 100644 --- a/code/datums/components/nanites.dm +++ b/code/datums/components/nanites.dm @@ -121,10 +121,14 @@ /datum/component/nanites/proc/delete_nanites() + SIGNAL_HANDLER + qdel(src) //Syncs the nanite component to another, making it so programs are the same with the same programming (except activation status) /datum/component/nanites/proc/sync(datum/signal_source, datum/component/nanites/source, full_overwrite = TRUE, copy_activation = FALSE) + SIGNAL_HANDLER + var/list/programs_to_remove = programs.Copy() var/list/programs_to_add = source.programs.Copy() for(var/X in programs) @@ -157,6 +161,8 @@ NP.software_error() /datum/component/nanites/proc/add_program(datum/source, datum/nanite_program/new_program, datum/nanite_program/source_program) + SIGNAL_HANDLER + for(var/X in programs) var/datum/nanite_program/NP = X if(NP.unique && NP.type == new_program.type) @@ -176,6 +182,8 @@ return (nanite_volume > 0) /datum/component/nanites/proc/adjust_nanites(datum/source, amount) + SIGNAL_HANDLER + nanite_volume = clamp(nanite_volume + amount, 0, max_nanites) if(nanite_volume <= 0) //oops we ran out qdel(src) @@ -192,6 +200,8 @@ holder.icon_state = "nanites[nanite_percent]" /datum/component/nanites/proc/on_emp(datum/source, severity) + SIGNAL_HANDLER + nanite_volume *= (rand(60, 90) * 0.01) //Lose 10-40% of nanites adjust_nanites(null, -(rand(5, 50))) //Lose 5-50 flat nanite volume if(prob(40/severity)) @@ -202,6 +212,8 @@ /datum/component/nanites/proc/on_shock(datum/source, shock_damage, siemens_coeff = 1, flags = NONE) + SIGNAL_HANDLER + if(flags & SHOCK_ILLUSION || shock_damage < 1) return @@ -213,35 +225,49 @@ NP.on_shock(shock_damage) /datum/component/nanites/proc/on_minor_shock(datum/source) + SIGNAL_HANDLER + adjust_nanites(null, -(rand(5, 15))) //Lose 5-15 flat nanite volume for(var/X in programs) var/datum/nanite_program/NP = X NP.on_minor_shock() /datum/component/nanites/proc/check_stealth(datum/source) + SIGNAL_HANDLER + return stealth /datum/component/nanites/proc/on_death(datum/source, gibbed) + SIGNAL_HANDLER + for(var/X in programs) var/datum/nanite_program/NP = X NP.on_death(gibbed) /datum/component/nanites/proc/receive_signal(datum/source, code, source = "an unidentified source") + SIGNAL_HANDLER + for(var/X in programs) var/datum/nanite_program/NP = X NP.receive_signal(code, source) /datum/component/nanites/proc/receive_comm_signal(datum/source, comm_code, comm_message, comm_source = "an unidentified source") + SIGNAL_HANDLER + for(var/X in programs) if(istype(X, /datum/nanite_program/comm)) var/datum/nanite_program/comm/NP = X NP.receive_comm_signal(comm_code, comm_message, comm_source) /datum/component/nanites/proc/check_viable_biotype() + SIGNAL_HANDLER + if(!(host_mob.mob_biotypes & (MOB_ORGANIC|MOB_UNDEAD))) qdel(src) //bodytype no longer sustains nanites /datum/component/nanites/proc/check_access(datum/source, obj/O) + SIGNAL_HANDLER + for(var/datum/nanite_program/access/access_program in programs) if(access_program.activated) return O.check_access_list(access_program.access) @@ -250,15 +276,23 @@ return FALSE /datum/component/nanites/proc/set_volume(datum/source, amount) + SIGNAL_HANDLER + nanite_volume = clamp(amount, 0, max_nanites) /datum/component/nanites/proc/set_max_volume(datum/source, amount) + SIGNAL_HANDLER + max_nanites = max(1, max_nanites) /datum/component/nanites/proc/set_cloud(datum/source, amount) + SIGNAL_HANDLER + cloud_id = clamp(amount, 0, 100) /datum/component/nanites/proc/set_cloud_sync(datum/source, method) + SIGNAL_HANDLER + switch(method) if(NANITE_CLOUD_TOGGLE) cloud_active = !cloud_active @@ -268,12 +302,18 @@ cloud_active = TRUE /datum/component/nanites/proc/set_safety(datum/source, amount) + SIGNAL_HANDLER + safety_threshold = clamp(amount, 0, max_nanites) /datum/component/nanites/proc/set_regen(datum/source, amount) + SIGNAL_HANDLER + regen_rate = amount /datum/component/nanites/proc/confirm_nanites() + SIGNAL_HANDLER + return TRUE //yup i exist /datum/component/nanites/proc/get_data(list/nanite_data) @@ -285,6 +325,8 @@ nanite_data["stealth"] = stealth /datum/component/nanites/proc/get_programs(datum/source, list/nanite_programs) + SIGNAL_HANDLER + nanite_programs |= programs /datum/component/nanites/proc/add_research() @@ -301,6 +343,8 @@ SSresearch.science_tech.add_point_list(list(TECHWEB_POINT_TYPE_NANITES = research_value)) /datum/component/nanites/proc/nanite_scan(datum/source, mob/user, full_scan) + SIGNAL_HANDLER + if(!full_scan) if(!stealth) to_chat(user, "Nanites Detected") @@ -324,6 +368,8 @@ return TRUE /datum/component/nanites/proc/nanite_ui_data(datum/source, list/data, scan_level) + SIGNAL_HANDLER + data["has_nanites"] = TRUE data["nanite_volume"] = nanite_volume data["regen_rate"] = regen_rate diff --git a/code/datums/components/omen.dm b/code/datums/components/omen.dm index e5183f95f1a..3d8872c6aeb 100644 --- a/code/datums/components/omen.dm +++ b/code/datums/components/omen.dm @@ -41,6 +41,8 @@ * We do the prob() at the beginning to A. add some tension for /when/ it will strike, and B. (more importantly) ameliorate the fact that we're checking up to 5 turfs's contents each time */ /datum/component/omen/proc/check_accident(atom/movable/our_guy) + SIGNAL_HANDLER_DOES_SLEEP + if(!prob(15)) return for(var/t in get_adjacent_open_turfs(our_guy)) @@ -53,6 +55,8 @@ /// If we get knocked down, see if we have a really bad slip and bash our head hard /datum/component/omen/proc/check_slip(mob/living/our_guy, amount) + SIGNAL_HANDLER + if(amount <= 0 || prob(50)) // 50% chance to bonk our head return @@ -68,6 +72,8 @@ /// Hijack the mood system to see if we get the blessing mood event to cancel the omen /datum/component/omen/proc/check_bless(mob/living/our_guy, category) + SIGNAL_HANDLER + if(category != "blessing") return to_chat(our_guy, "You feel a horrible omen lifted off your shoulders!") diff --git a/code/datums/components/orbiter.dm b/code/datums/components/orbiter.dm index 435fabdf7f8..2aaa1f65f73 100644 --- a/code/datums/components/orbiter.dm +++ b/code/datums/components/orbiter.dm @@ -118,6 +118,8 @@ /datum/component/orbiter/proc/orbiter_move_react(atom/movable/orbiter, atom/oldloc, direction) + SIGNAL_HANDLER + if(orbiter.loc == get_turf(parent)) return end_orbit(orbiter) diff --git a/code/datums/components/paintable.dm b/code/datums/components/paintable.dm index 511c51e0340..a0ed2873c90 100644 --- a/code/datums/components/paintable.dm +++ b/code/datums/components/paintable.dm @@ -13,6 +13,8 @@ A.remove_atom_colour(FIXED_COLOUR_PRIORITY, current_paint) /datum/component/spraycan_paintable/proc/Repaint(datum/source, obj/item/toy/crayon/spraycan/spraycan, mob/living/user) + SIGNAL_HANDLER + if(!istype(spraycan) || user.a_intent == INTENT_HARM) return . = COMPONENT_NO_AFTERATTACK diff --git a/code/datums/components/payment.dm b/code/datums/components/payment.dm index ec53158c2c3..689a33b0291 100644 --- a/code/datums/components/payment.dm +++ b/code/datums/components/payment.dm @@ -28,6 +28,8 @@ RegisterSignal(parent, COMSIG_OBJ_ATTEMPT_CHARGE_CHANGE, .proc/change_cost) /datum/component/payment/proc/attempt_charge(datum/source, atom/movable/target, extra_fees = 0) + SIGNAL_HANDLER + if(!cost) //In case a free variant of anything is made it'll skip charging anyone. return if(!ismob(target)) @@ -66,6 +68,8 @@ playsound(src, 'sound/effects/cashregister.ogg', 20, TRUE) /datum/component/payment/proc/change_cost(datum/source, new_cost) + SIGNAL_HANDLER + if(!isnum(new_cost)) CRASH("change_cost called with variable new_cost as not a number.") cost = new_cost diff --git a/code/datums/components/pellet_cloud.dm b/code/datums/components/pellet_cloud.dm index 326a6a6baff..254aa94f86c 100644 --- a/code/datums/components/pellet_cloud.dm +++ b/code/datums/components/pellet_cloud.dm @@ -98,6 +98,8 @@ * The arguments really don't matter, this proc is triggered by COMSIG_PELLET_CLOUD_INIT which is only for this really, it's just a big mess of the state vars we need for doing the stuff over here. */ /datum/component/pellet_cloud/proc/create_casing_pellets(obj/item/ammo_casing/shell, atom/target, mob/living/user, fired_from, randomspread, spread, zone_override, params, distro) + SIGNAL_HANDLER_DOES_SLEEP + shooter = user var/targloc = get_turf(target) if(!zone_override) @@ -125,6 +127,8 @@ * Note that grenades have extra handling for someone throwing themselves/being thrown on top of it, while landmines do not (obviously, it's a landmine!). See [/datum/component/pellet_cloud/proc/handle_martyrs] */ /datum/component/pellet_cloud/proc/create_blast_pellets(obj/O, mob/living/lanced_by) + SIGNAL_HANDLER_DOES_SLEEP + var/atom/A = parent if(isgrenade(parent)) // handle_martyrs can reduce the radius and thus the number of pellets we produce if someone dives on top of a frag grenade @@ -198,6 +202,8 @@ ///One of our pellets hit something, record what it was and check if we're done (terminated == num_pellets) /datum/component/pellet_cloud/proc/pellet_hit(obj/projectile/P, atom/movable/firer, atom/target, Angle, hit_zone) + SIGNAL_HANDLER + pellets -= P terminated++ hits++ @@ -287,6 +293,8 @@ /// Look alive, we're armed! Now we start watching to see if anyone's covering us /datum/component/pellet_cloud/proc/grenade_armed(obj/item/nade) + SIGNAL_HANDLER + if(ismob(nade.loc)) shooter = nade.loc LAZYINITLIST(bodies) @@ -296,11 +304,15 @@ /// 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) + SIGNAL_HANDLER + shooter = slick_willy grenade_moved() /// Our grenade has moved, reset var/list/bodies so we're "on top" of any mobs currently on the tile /datum/component/pellet_cloud/proc/grenade_moved() + SIGNAL_HANDLER + LAZYCLEARLIST(bodies) for(var/mob/living/L in get_turf(parent)) RegisterSignal(L, COMSIG_PARENT_QDELETING, .proc/on_target_qdel, override=TRUE) @@ -308,10 +320,14 @@ /// Someone who was originally "under" the grenade has moved off the tile and is now eligible for being a martyr and "covering" it /datum/component/pellet_cloud/proc/grenade_uncrossed(datum/source, atom/movable/AM) + SIGNAL_HANDLER + bodies -= AM /// Our grenade or landmine or caseless shell or whatever tried deleting itself, so we intervene and nullspace it until we're done here /datum/component/pellet_cloud/proc/nullspace_parent() + SIGNAL_HANDLER + var/atom/movable/AM = parent AM.moveToNullspace() queued_delete = TRUE @@ -319,6 +335,8 @@ /// Someone who was originally "under" the grenade has moved off the tile and is now eligible for being a martyr and "covering" it /datum/component/pellet_cloud/proc/on_target_qdel(atom/target) + SIGNAL_HANDLER + UnregisterSignal(target, COMSIG_PARENT_QDELETING) targets_hit -= target LAZYREMOVE(bodies, target) diff --git a/code/datums/components/plumbing/_plumbing.dm b/code/datums/components/plumbing/_plumbing.dm index 93921edb570..7ac4659af53 100644 --- a/code/datums/components/plumbing/_plumbing.dm +++ b/code/datums/components/plumbing/_plumbing.dm @@ -99,6 +99,8 @@ ///We create our luxurious piping overlays/underlays, to indicate where we do what. only called once if use_overlays = TRUE in Initialize() /datum/component/plumbing/proc/create_overlays(atom/movable/AM, list/overlays) + SIGNAL_HANDLER + if(tile_covered || !use_overlays) return @@ -135,6 +137,8 @@ ///we stop acting like a plumbing thing and disconnect if we are, so we can safely be moved and stuff /datum/component/plumbing/proc/disable() + SIGNAL_HANDLER + if(!active) return @@ -183,6 +187,8 @@ /// Toggle our machinery on or off. This is called by a hook from default_unfasten_wrench with anchored as only param, so we dont have to copypaste this on every object that can move /datum/component/plumbing/proc/toggle_active(obj/O, new_state) + SIGNAL_HANDLER + if(new_state) enable() else @@ -229,6 +235,8 @@ net.add_plumber(P, opposite_dir) /datum/component/plumbing/proc/hide(atom/movable/AM, intact) + SIGNAL_HANDLER + tile_covered = intact AM.update_icon() diff --git a/code/datums/components/pricetag.dm b/code/datums/components/pricetag.dm index e745c907da6..9cf6a6e4f16 100644 --- a/code/datums/components/pricetag.dm +++ b/code/datums/components/pricetag.dm @@ -13,9 +13,13 @@ RegisterSignal(parent, list(COMSIG_ITEM_SPLIT_PROFIT, COMSIG_ITEM_SPLIT_PROFIT_DRY), .proc/return_ratio) /datum/component/pricetag/proc/Unwrapped() + SIGNAL_HANDLER + qdel(src) //Once it leaves it's wrapped container, the object in question should lose it's pricetag component. /datum/component/pricetag/proc/split_profit(item_value) + SIGNAL_HANDLER + var/price = item_value if(price) var/adjusted_value = price*(profit_ratio/100) diff --git a/code/datums/components/punchcooldown.dm b/code/datums/components/punchcooldown.dm index 6ab114d389a..55a6bbcea67 100644 --- a/code/datums/components/punchcooldown.dm +++ b/code/datums/components/punchcooldown.dm @@ -22,6 +22,8 @@ ///Called on COMSIG_ITEM_ATTACK_SELF. Allows you to change the warcry. /datum/component/wearertargeting/punchcooldown/proc/changewarcry(datum/source, mob/user) + SIGNAL_HANDLER_DOES_SLEEP + var/input = stripped_input(user,"What do you want your battlecry to be? Max length of 6 characters.", ,"", 7) if(!QDELETED(src) && !QDELETED(user) && !user.Adjacent(parent)) return diff --git a/code/datums/components/rad_insulation.dm b/code/datums/components/rad_insulation.dm index b576e4b9d14..e46173a2815 100644 --- a/code/datums/components/rad_insulation.dm +++ b/code/datums/components/rad_insulation.dm @@ -15,11 +15,17 @@ amount = _amount /datum/component/rad_insulation/proc/rad_probe_react(datum/source) + SIGNAL_HANDLER + return COMPONENT_BLOCK_RADIATION /datum/component/rad_insulation/proc/rad_contaminating(datum/source, strength) + SIGNAL_HANDLER + return COMPONENT_BLOCK_CONTAMINATION /datum/component/rad_insulation/proc/rad_pass(datum/source, datum/radiation_wave/wave, width) + SIGNAL_HANDLER + wave.intensity = wave.intensity*(1-((1-amount)/width)) // The further out the rad wave goes the less it's affected by insulation (larger width) return COMPONENT_RAD_WAVE_HANDLED diff --git a/code/datums/components/radioactive.dm b/code/datums/components/radioactive.dm index 1b62b8712c5..5f2c28b5c6c 100644 --- a/code/datums/components/radioactive.dm +++ b/code/datums/components/radioactive.dm @@ -68,6 +68,8 @@ strength = max(strength, _strength) /datum/component/radioactive/proc/rad_examine(datum/source, mob/user, atom/thing) + SIGNAL_HANDLER + var/atom/master = parent var/list/out = list() if(get_dist(master, user) <= 1) @@ -85,6 +87,8 @@ to_chat(user, "[out.Join()]") /datum/component/radioactive/proc/rad_attack(datum/source, atom/movable/target, mob/living/user) + SIGNAL_HANDLER + radiation_pulse(parent, strength/20) target.rad_act(strength/2) if(!hl3_release_date) @@ -92,6 +96,8 @@ strength -= strength / hl3_release_date /datum/component/radioactive/proc/rad_clean(datum/source, clean_types) + SIGNAL_HANDLER + if(QDELETED(src)) return diff --git a/code/datums/components/religious_tool.dm b/code/datums/components/religious_tool.dm index d55e83896b9..4e0f6818262 100644 --- a/code/datums/components/religious_tool.dm +++ b/code/datums/components/religious_tool.dm @@ -51,6 +51,8 @@ * Since all of these involve attackby, we require mega proc. Handles Invocation, Sacrificing, And Selection of Sects. */ /datum/component/religious_tool/proc/AttemptActions(datum/source, obj/item/the_item, mob/living/user) + SIGNAL_HANDLER_DOES_SLEEP + /**********Sect Selection**********/ if(!SetGlobalToLocal()) if(!(operation_flags & RELIGION_TOOL_SECTSELECT)) @@ -126,6 +128,8 @@ * Appends to examine so the user knows it can be used for religious purposes. */ /datum/component/religious_tool/proc/on_examine(datum/source, mob/user, list/examine_list) + SIGNAL_HANDLER + var/can_i_see = FALSE if(isobserver(user)) can_i_see = TRUE diff --git a/code/datums/components/remote_materials.dm b/code/datums/components/remote_materials.dm index e4faab361a6..34d031951f4 100644 --- a/code/datums/components/remote_materials.dm +++ b/code/datums/components/remote_materials.dm @@ -86,11 +86,15 @@ handles linking back and forth. _MakeLocal() /datum/component/remote_materials/proc/OnAttackBy(datum/source, obj/item/I, mob/user) + SIGNAL_HANDLER + if (silo && istype(I, /obj/item/stack)) if (silo.remote_attackby(parent, user, I)) return COMPONENT_NO_AFTERATTACK /datum/component/remote_materials/proc/OnMultitool(datum/source, mob/user, obj/item/I) + SIGNAL_HANDLER + if(!I.multitool_check_buffer(user, I)) return COMPONENT_BLOCK_TOOL_ATTACK var/obj/item/multitool/M = I diff --git a/code/datums/components/riding.dm b/code/datums/components/riding.dm index ea523c55975..f9ab924f36c 100644 --- a/code/datums/components/riding.dm +++ b/code/datums/components/riding.dm @@ -34,6 +34,8 @@ RegisterSignal(parent, COMSIG_MOVABLE_MOVED, .proc/vehicle_moved) /datum/component/riding/proc/vehicle_mob_unbuckle(datum/source, mob/living/M, force = FALSE) + SIGNAL_HANDLER + var/atom/movable/AM = parent restore_position(M) unequip_buckle_inhands(M) @@ -41,6 +43,8 @@ qdel(src) /datum/component/riding/proc/vehicle_mob_buckle(datum/source, mob/living/M, force = FALSE) + SIGNAL_HANDLER + var/atom/movable/movable_parent = parent handle_vehicle_offsets(movable_parent.dir) @@ -58,6 +62,8 @@ directional_vehicle_layers["[dir]"] = layer /datum/component/riding/proc/vehicle_moved(datum/source, dir) + SIGNAL_HANDLER + var/atom/movable/movable_parent = parent if (isnull(dir)) dir = movable_parent.dir @@ -67,6 +73,8 @@ handle_vehicle_layer(dir) /datum/component/riding/proc/vehicle_turned(datum/source, _old_dir, new_dir) + SIGNAL_HANDLER + vehicle_moved(source, new_dir) /datum/component/riding/proc/ride_check(mob/living/M) @@ -238,6 +246,8 @@ H.add_movespeed_modifier(/datum/movespeed_modifier/human_carry) /datum/component/riding/human/proc/on_host_unarmed_melee(atom/target) + SIGNAL_HANDLER + var/mob/living/carbon/human/H = parent if(H.a_intent == INTENT_DISARM && (target in H.buckled_mobs)) force_dismount(target) diff --git a/code/datums/components/rotation.dm b/code/datums/components/rotation.dm index 1a95ec16ef3..8d8e4add4d4 100644 --- a/code/datums/components/rotation.dm +++ b/code/datums/components/rotation.dm @@ -99,15 +99,21 @@ . = ..() /datum/component/simple_rotation/proc/ExamineMessage(datum/source, mob/user, list/examine_list) + SIGNAL_HANDLER + if(rotation_flags & ROTATION_ALTCLICK) examine_list += "Alt-click to rotate it clockwise." /datum/component/simple_rotation/proc/HandRot(datum/source, mob/user, rotation = default_rotation_direction) + SIGNAL_HANDLER + if(!can_be_rotated.Invoke(user, rotation) || !can_user_rotate.Invoke(user, rotation)) return BaseRot(user, rotation) /datum/component/simple_rotation/proc/WrenchRot(datum/source, obj/item/I, mob/living/user) + SIGNAL_HANDLER + if(!can_be_rotated.Invoke(user,default_rotation_direction) || !can_user_rotate.Invoke(user,default_rotation_direction)) return BaseRot(user,default_rotation_direction) diff --git a/code/datums/components/slippery.dm b/code/datums/components/slippery.dm index 541fe474292..4e026547d05 100644 --- a/code/datums/components/slippery.dm +++ b/code/datums/components/slippery.dm @@ -15,12 +15,16 @@ RegisterSignal(parent, COMSIG_ITEM_WEARERCROSSED, .proc/Slip_on_wearer) /datum/component/slippery/proc/Slip(datum/source, atom/movable/AM) + SIGNAL_HANDLER + var/mob/victim = AM if(istype(victim) && !victim.is_flying() && victim.slip(knockdown_time, parent, lube_flags, paralyze_time, force_drop_items) && callback) callback.Invoke(victim) /datum/component/slippery/proc/Slip_on_wearer(datum/source, atom/movable/AM, mob/living/crossed) + SIGNAL_HANDLER + if(!(crossed.mobility_flags & MOBILITY_STAND) && !crossed.buckle_lying) Slip(source, AM) diff --git a/code/datums/components/soulstoned.dm b/code/datums/components/soulstoned.dm index 6e87e7f9fe8..15d512cb094 100644 --- a/code/datums/components/soulstoned.dm +++ b/code/datums/components/soulstoned.dm @@ -19,6 +19,8 @@ RegisterSignal(S, COMSIG_MOVABLE_MOVED, .proc/free_prisoner) /datum/component/soulstoned/proc/free_prisoner() + SIGNAL_HANDLER + var/mob/living/simple_animal/S = parent if(S.loc != container) qdel(src) diff --git a/code/datums/components/spawner.dm b/code/datums/components/spawner.dm index 8f5ca86cec5..8600a59de0c 100644 --- a/code/datums/components/spawner.dm +++ b/code/datums/components/spawner.dm @@ -29,6 +29,8 @@ /datum/component/spawner/proc/stop_spawning(force) + SIGNAL_HANDLER + STOP_PROCESSING(SSprocessing, src) for(var/mob/living/simple_animal/L in spawned_mobs) if(L.nest == src) diff --git a/code/datums/components/spill.dm b/code/datums/components/spill.dm index 60bfa12402e..343cdab3f08 100644 --- a/code/datums/components/spill.dm +++ b/code/datums/components/spill.dm @@ -40,15 +40,21 @@ master.item_flags &= ~ITEM_SLOT_POCKETS /datum/component/spill/proc/equip_react(obj/item/source, mob/equipper, slot) + SIGNAL_HANDLER + if(slot == ITEM_SLOT_LPOCKET || slot == ITEM_SLOT_RPOCKET) RegisterSignal(equipper, COMSIG_LIVING_STATUS_KNOCKDOWN, .proc/knockdown_react, TRUE) else UnregisterSignal(equipper, COMSIG_LIVING_STATUS_KNOCKDOWN) /datum/component/spill/proc/drop_react(obj/item/source, mob/dropper) + SIGNAL_HANDLER + UnregisterSignal(dropper, COMSIG_LIVING_STATUS_KNOCKDOWN) /datum/component/spill/proc/knockdown_react(mob/living/fool) + SIGNAL_HANDLER + var/obj/item/master = parent fool.dropItemToGround(master) if(droptext) diff --git a/code/datums/components/spooky.dm b/code/datums/components/spooky.dm index e5d8fae10a6..27d62668892 100644 --- a/code/datums/components/spooky.dm +++ b/code/datums/components/spooky.dm @@ -5,6 +5,8 @@ RegisterSignal(parent, COMSIG_ITEM_ATTACK, .proc/spectral_attack) /datum/component/spooky/proc/spectral_attack(datum/source, mob/living/carbon/C, mob/user) + SIGNAL_HANDLER_DOES_SLEEP + if(ishuman(user)) //this weapon wasn't meant for mortals. var/mob/living/carbon/human/U = user if(!istype(U.dna.species, /datum/species/skeleton)) diff --git a/code/datums/components/squeak.dm b/code/datums/components/squeak.dm index 285566edf98..0b37af2855c 100644 --- a/code/datums/components/squeak.dm +++ b/code/datums/components/squeak.dm @@ -41,6 +41,8 @@ use_delay = use_delay_override /datum/component/squeak/proc/play_squeak() + SIGNAL_HANDLER + if(prob(squeak_chance)) if(!override_squeak_sounds) playsound(parent, pickweight(default_squeak_sounds), volume, TRUE, -1) @@ -48,6 +50,8 @@ playsound(parent, pickweight(override_squeak_sounds), volume, TRUE, -1) /datum/component/squeak/proc/step_squeak() + SIGNAL_HANDLER + if(steps > step_delay) play_squeak() steps = 0 @@ -55,6 +59,8 @@ steps++ /datum/component/squeak/proc/play_squeak_crossed(datum/source, atom/movable/AM) + SIGNAL_HANDLER + if(isitem(AM)) var/obj/item/I = AM if(I.item_flags & ABSTRACT) @@ -74,22 +80,32 @@ play_squeak() /datum/component/squeak/proc/use_squeak() + SIGNAL_HANDLER + if(last_use + use_delay < world.time) last_use = world.time play_squeak() /datum/component/squeak/proc/on_equip(datum/source, mob/equipper, slot) + SIGNAL_HANDLER + RegisterSignal(equipper, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react, TRUE) /datum/component/squeak/proc/on_drop(datum/source, mob/user) + SIGNAL_HANDLER + UnregisterSignal(user, COMSIG_MOVABLE_DISPOSING) // Disposal pipes related shit /datum/component/squeak/proc/disposing_react(datum/source, obj/structure/disposalholder/holder, obj/machinery/disposal/source) + SIGNAL_HANDLER + //We don't need to worry about unregistering this signal as it will happen for us automaticaly when the holder is qdeleted RegisterSignal(holder, COMSIG_ATOM_DIR_CHANGE, .proc/holder_dir_change) /datum/component/squeak/proc/holder_dir_change(datum/source, old_dir, new_dir) + SIGNAL_HANDLER + //If the dir changes it means we're going through a bend in the pipes, let's pretend we bumped the wall if(old_dir != new_dir) play_squeak() diff --git a/code/datums/components/stationloving.dm b/code/datums/components/stationloving.dm index f8a7a4d44e4..470b9e961f0 100644 --- a/code/datums/components/stationloving.dm +++ b/code/datums/components/stationloving.dm @@ -25,6 +25,8 @@ inform_admins = inform_admins /datum/component/stationloving/proc/relocate() + SIGNAL_HANDLER + var/targetturf = find_safe_turf() if(!targetturf) if(GLOB.blobstart.len > 0) @@ -39,6 +41,8 @@ return targetturf /datum/component/stationloving/proc/check_in_bounds() + SIGNAL_HANDLER + if(in_bounds()) return else @@ -49,9 +53,13 @@ message_admins("[parent] has been moved out of bounds in [ADMIN_VERBOSEJMP(currentturf)]. Moving it to [ADMIN_VERBOSEJMP(targetturf)].") /datum/component/stationloving/proc/check_soul_imbue() + SIGNAL_HANDLER + return disallow_soul_imbue /datum/component/stationloving/proc/check_mark_retrieval() + SIGNAL_HANDLER + return COMPONENT_BLOCK_MARK_RETRIEVAL /datum/component/stationloving/proc/in_bounds() @@ -75,6 +83,9 @@ /datum/component/stationloving/proc/check_deletion(datum/source, force) // TRUE = interrupt deletion, FALSE = proceed with deletion + SIGNAL_HANDLER + + var/turf/T = get_turf(parent) if(inform_admins && force) diff --git a/code/datums/components/stationstuck.dm b/code/datums/components/stationstuck.dm index 615d6ff79a6..d6e8c57a065 100644 --- a/code/datums/components/stationstuck.dm +++ b/code/datums/components/stationstuck.dm @@ -44,6 +44,8 @@ It has a punishment variable that is what happens to the parent when they leave * * PUNISHMENT_TELEPORT: finds a safe turf if possible, or a completely random one if not. */ /datum/component/stationstuck/proc/punish() + SIGNAL_HANDLER + var/mob/living/L = parent if(message) var/span = punishment == PUNISHMENT_TELEPORT ? "danger" : "userdanger" diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 658b9e926f8..a60b08393a5 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -170,6 +170,8 @@ return master? master.real_location() : null /datum/component/storage/proc/canreach_react(datum/source, list/next) + SIGNAL_HANDLER + var/datum/component/storage/concrete/master = master() if(!master) return @@ -180,12 +182,16 @@ next += slave.parent /datum/component/storage/proc/on_move() + SIGNAL_HANDLER + var/atom/A = parent for(var/mob/living/L in can_see_contents()) if(!L.CanReach(A)) hide_from(L) /datum/component/storage/proc/attack_self(datum/source, mob/M) + SIGNAL_HANDLER_DOES_SLEEP + if(locked) to_chat(M, "[parent] seems to be locked!") return FALSE @@ -193,6 +199,8 @@ quick_empty(M) /datum/component/storage/proc/preattack_intercept(datum/source, obj/O, mob/M, params) + SIGNAL_HANDLER_DOES_SLEEP + if(!isitem(O) || !click_gather || SEND_SIGNAL(O, COMSIG_CONTAINS_STORAGE)) return FALSE . = COMPONENT_NO_ATTACK @@ -308,6 +316,8 @@ return TRUE /datum/component/storage/proc/set_locked(datum/source, new_state) + SIGNAL_HANDLER + locked = new_state if(locked) close_all() @@ -410,12 +420,16 @@ hide_from(M) /datum/component/storage/proc/close_all() + SIGNAL_HANDLER + . = FALSE for(var/mob/M in can_see_contents()) close(M) . = TRUE //returns TRUE if any mobs actually got a close(M) call /datum/component/storage/proc/emp_act(datum/source, severity) + SIGNAL_HANDLER + if(emp_shielded) return var/datum/component/storage/concrete/master = master() @@ -450,6 +464,8 @@ return master._removal_reset(thing) /datum/component/storage/proc/_remove_and_refresh(datum/source, atom/movable/thing) + SIGNAL_HANDLER + _removal_reset(thing) refresh_mob_views() @@ -463,6 +479,8 @@ return master.remove_from_storage(AM, new_location) /datum/component/storage/proc/refresh_mob_views() + SIGNAL_HANDLER + var/list/seeing = can_see_contents() for(var/i in seeing) show_to(i) @@ -492,6 +510,8 @@ //This proc is called when you want to place an item into the storage item. /datum/component/storage/proc/attackby(datum/source, obj/item/I, mob/M, params) + SIGNAL_HANDLER + if(istype(I, /obj/item/hand_labeler)) var/obj/item/hand_labeler/labeler = I if(labeler.mode) @@ -521,12 +541,16 @@ //Abuses the fact that lists are just references, or something like that. /datum/component/storage/proc/signal_return_inv(datum/source, list/interface, recursive = TRUE) + SIGNAL_HANDLER + if(!islist(interface)) return FALSE interface |= return_inv(recursive) return TRUE /datum/component/storage/proc/topic_handle(datum/source, user, href_list) + SIGNAL_HANDLER + if(href_list["show_valid_pocket_items"]) handle_show_valid_items(source, user) @@ -534,6 +558,8 @@ to_chat(user, "[source] can hold: [can_hold_description]") /datum/component/storage/proc/mousedrop_onto(datum/source, atom/over_object, mob/M) + SIGNAL_HANDLER_DOES_SLEEP + set waitfor = FALSE . = COMPONENT_NO_MOUSEDROP if(!ismob(M)) @@ -573,6 +599,8 @@ show_to(M) /datum/component/storage/proc/mousedrop_receive(datum/source, atom/movable/O, mob/M) + SIGNAL_HANDLER + if(isitem(O)) var/obj/item/I = O if(iscarbon(M) || isdrone(M)) @@ -678,26 +706,40 @@ O.update_icon() /datum/component/storage/proc/signal_insertion_attempt(datum/source, obj/item/I, mob/M, silent = FALSE, force = FALSE) + SIGNAL_HANDLER + if((!force && !can_be_inserted(I, TRUE, M)) || (I == parent)) return FALSE return handle_item_insertion(I, silent, M) /datum/component/storage/proc/signal_can_insert(datum/source, obj/item/I, mob/M, silent = FALSE) + SIGNAL_HANDLER + return can_be_inserted(I, silent, M) /datum/component/storage/proc/show_to_ghost(datum/source, mob/dead/observer/M) + SIGNAL_HANDLER + return user_show_to_mob(M, TRUE) /datum/component/storage/proc/signal_show_attempt(datum/source, mob/showto, force = FALSE) + SIGNAL_HANDLER + return user_show_to_mob(showto, force) /datum/component/storage/proc/on_check() + SIGNAL_HANDLER + return TRUE /datum/component/storage/proc/check_locked() + SIGNAL_HANDLER + return locked /datum/component/storage/proc/signal_take_type(datum/source, type, atom/destination, amount = INFINITY, check_adjacent = FALSE, force = FALSE, mob/user, list/inserted) + SIGNAL_HANDLER + if(!force) if(check_adjacent) if(!user || !user.CanReach(destination) || !user.CanReach(parent)) @@ -719,6 +761,8 @@ return max(0, max_items - real_location.contents.len) /datum/component/storage/proc/signal_fill_type(datum/source, type, amount = 20, force = FALSE) + SIGNAL_HANDLER_DOES_SLEEP + var/atom/real_location = real_location() if(!force) amount = min(remaining_space_items(), amount) @@ -731,6 +775,8 @@ return TRUE /datum/component/storage/proc/on_attack_hand(datum/source, mob/user) + SIGNAL_HANDLER_DOES_SLEEP + var/atom/A = parent if(!attack_hand_interact) return @@ -764,22 +810,32 @@ show_to(user) /datum/component/storage/proc/signal_on_pickup(datum/source, mob/user) + SIGNAL_HANDLER + update_actions() for(var/mob/M in can_see_contents() - user) close(M) /datum/component/storage/proc/signal_take_obj(datum/source, atom/movable/AM, new_loc, force = FALSE) + SIGNAL_HANDLER + if(!(AM in real_location())) return FALSE return remove_from_storage(AM, new_loc) /datum/component/storage/proc/signal_quick_empty(datum/source, atom/loctarget) + SIGNAL_HANDLER + return do_quick_empty(loctarget) /datum/component/storage/proc/signal_hide_attempt(datum/source, mob/target) + SIGNAL_HANDLER + return hide_from(target) /datum/component/storage/proc/on_alt_click(datum/source, mob/user) + SIGNAL_HANDLER_DOES_SLEEP + if(!isliving(user) || !user.CanReach(parent) || user.incapacitated()) return if(locked) @@ -804,6 +860,8 @@ user.visible_message("[user] draws [I] from [parent]!", "You draw [I] from [parent].") /datum/component/storage/proc/action_trigger(datum/signal_source, datum/action/source) + SIGNAL_HANDLER + gather_mode_switch(source.owner) return COMPONENT_ACTION_BLOCK_TRIGGER diff --git a/code/datums/components/summoning.dm b/code/datums/components/summoning.dm index 5673206b67b..9109e26b300 100644 --- a/code/datums/components/summoning.dm +++ b/code/datums/components/summoning.dm @@ -34,14 +34,20 @@ UnregisterSignal(parent, list(COMSIG_ITEM_AFTERATTACK, COMSIG_HOSTILE_ATTACKINGTARGET, COMSIG_PROJECTILE_ON_HIT)) /datum/component/summoning/proc/item_afterattack(obj/item/source, atom/target, mob/user, proximity_flag, click_parameters) + SIGNAL_HANDLER + if(!proximity_flag) return do_spawn_mob(get_turf(target), user) /datum/component/summoning/proc/hostile_attackingtarget(mob/living/simple_animal/hostile/attacker, atom/target) + SIGNAL_HANDLER + do_spawn_mob(get_turf(target), attacker) /datum/component/summoning/proc/projectile_hit(atom/fired_from, atom/movable/firer, atom/target, Angle) + SIGNAL_HANDLER + do_spawn_mob(get_turf(target), firer) /datum/component/summoning/proc/do_spawn_mob(atom/spawn_location, summoner) @@ -65,4 +71,6 @@ spawn_location.visible_message("[L] [spawn_text].") /datum/component/summoning/proc/on_spawned_death(mob/killed, gibbed) + SIGNAL_HANDLER + spawned_mobs -= killed diff --git a/code/datums/components/surgery_initiator.dm b/code/datums/components/surgery_initiator.dm index 284400931eb..77decef154a 100644 --- a/code/datums/components/surgery_initiator.dm +++ b/code/datums/components/surgery_initiator.dm @@ -31,6 +31,8 @@ * */ /datum/component/surgery_initiator/proc/initiate_surgery_moment(datum/source, atom/target, mob/user) + SIGNAL_HANDLER_DOES_SLEEP + if(!isliving(target)) return var/mob/living/livingtarget = target diff --git a/code/datums/components/swarming.dm b/code/datums/components/swarming.dm index 16ddc66280e..5234aab3949 100644 --- a/code/datums/components/swarming.dm +++ b/code/datums/components/swarming.dm @@ -23,6 +23,8 @@ return ..() /datum/component/swarming/proc/join_swarm(datum/source, atom/movable/AM) + SIGNAL_HANDLER + var/datum/component/swarming/other_swarm = AM.GetComponent(/datum/component/swarming) if(!other_swarm) return @@ -32,6 +34,8 @@ other_swarm.swarm_members |= src /datum/component/swarming/proc/leave_swarm(datum/source, atom/movable/AM) + SIGNAL_HANDLER + var/datum/component/swarming/other_swarm = AM.GetComponent(/datum/component/swarming) if(!other_swarm || !(other_swarm in swarm_members)) return diff --git a/code/datums/components/tackle.dm b/code/datums/components/tackle.dm index 01fec505fbc..0fb7d573c28 100644 --- a/code/datums/components/tackle.dm +++ b/code/datums/components/tackle.dm @@ -63,11 +63,15 @@ ///Store the thrownthing datum for later use /datum/component/tackler/proc/registerTackle(mob/living/carbon/user, datum/thrownthing/TT) + SIGNAL_HANDLER + tackle = TT tackle.thrower = user ///See if we can tackle or not. If we can, leap! /datum/component/tackler/proc/checkTackle(mob/living/carbon/user, atom/A, params) + SIGNAL_HANDLER + if(!user.in_throw_mode || user.get_active_held_item() || user.pulling || user.buckled || user.incapacitated()) return @@ -140,6 +144,8 @@ * Finally, we return a bitflag to [COMSIG_MOVABLE_IMPACT] that forces the hitpush to false so that we don't knock them away. */ /datum/component/tackler/proc/sack(mob/living/carbon/user, atom/hit) + SIGNAL_HANDLER_DOES_SLEEP + if(!tackling || !tackle) return @@ -452,6 +458,8 @@ ///Check to see if we hit a table, and if so, make a big mess! /datum/component/tackler/proc/checkObstacle(mob/living/carbon/owner) + SIGNAL_HANDLER + if(!tackling) return diff --git a/code/datums/components/tactical.dm b/code/datums/components/tactical.dm index 4cea1484a52..d1941f8a72f 100644 --- a/code/datums/components/tactical.dm +++ b/code/datums/components/tactical.dm @@ -20,6 +20,8 @@ return ..() /datum/component/tactical/proc/modify(obj/item/source, mob/user, slot) + SIGNAL_HANDLER + if(allowed_slot && slot != allowed_slot) unmodify() return @@ -32,6 +34,8 @@ I.layer = ABOVE_MOB_LAYER /datum/component/tactical/proc/unmodify(obj/item/source, mob/user) + SIGNAL_HANDLER + var/obj/item/master = source || parent if(!user) if(!ismob(master.loc)) diff --git a/code/datums/components/tether.dm b/code/datums/components/tether.dm index faa6182208a..a458db2f257 100644 --- a/code/datums/components/tether.dm +++ b/code/datums/components/tether.dm @@ -17,6 +17,8 @@ RegisterSignal(parent, list(COMSIG_MOVABLE_PRE_MOVE), .proc/checkTether) /datum/component/tether/proc/checkTether(mob/mover, newloc) + SIGNAL_HANDLER + if (get_dist(mover,newloc) > max_dist) to_chat(mover, "The [tether_name] runs out of slack and prevents you from moving!") return COMPONENT_MOVABLE_BLOCK_PRE_MOVE diff --git a/code/datums/components/thermite.dm b/code/datums/components/thermite.dm index 71403ffcb27..23f020adb7f 100644 --- a/code/datums/components/thermite.dm +++ b/code/datums/components/thermite.dm @@ -80,14 +80,20 @@ qdel(src) /datum/component/thermite/proc/clean_react(datum/source, strength) + SIGNAL_HANDLER + //Thermite is just some loose powder, you could probably clean it with your hands. << todo? qdel(src) return TRUE /datum/component/thermite/proc/flame_react(datum/source, exposed_temperature, exposed_volume) + SIGNAL_HANDLER + if(exposed_temperature > 1922) // This is roughly the real life requirement to ignite thermite thermite_melt() /datum/component/thermite/proc/attackby_react(datum/source, obj/item/thing, mob/user, params) + SIGNAL_HANDLER + if(thing.get_temperature()) thermite_melt(user) diff --git a/code/datums/components/twohanded.dm b/code/datums/components/twohanded.dm index 3f698241950..88e15d7f0a5 100644 --- a/code/datums/components/twohanded.dm +++ b/code/datums/components/twohanded.dm @@ -89,6 +89,8 @@ /// Triggered on equip of the item containing the component /datum/component/two_handed/proc/on_equip(datum/source, mob/user, slot) + SIGNAL_HANDLER + if(require_twohands && slot == ITEM_SLOT_HANDS) // force equip the item wield(user) if(!user.is_holding(parent) && wielded && !require_twohands) @@ -96,6 +98,8 @@ /// Triggered on drop of item containing the component /datum/component/two_handed/proc/on_drop(datum/source, mob/user) + SIGNAL_HANDLER + if(require_twohands) unwield(user, show_message=TRUE) if(wielded) @@ -105,6 +109,8 @@ /// Triggered on attack self of the item containing the component /datum/component/two_handed/proc/on_attack_self(datum/source, mob/user) + SIGNAL_HANDLER + if(wielded) unwield(user) else if(user.is_holding(parent)) @@ -248,6 +254,8 @@ * Updates the icon using icon_wielded if set */ /datum/component/two_handed/proc/on_update_icon(datum/source) + SIGNAL_HANDLER + if(icon_wielded && wielded) var/obj/item/parent_item = parent if(parent_item) @@ -258,12 +266,16 @@ * on_moved Triggers on item moved */ /datum/component/two_handed/proc/on_moved(datum/source, mob/user, dir) + SIGNAL_HANDLER + unwield(user) /** * on_swap_hands Triggers on swapping hands, blocks swap if the other hand is busy */ /datum/component/two_handed/proc/on_swap_hands(mob/user, obj/item/held_item) + SIGNAL_HANDLER + if(!held_item) return if(held_item == parent) @@ -273,6 +285,8 @@ * on_sharpen Triggers on usage of a sharpening stone on the item */ /datum/component/two_handed/proc/on_sharpen(obj/item/item, amount, max_amount) + SIGNAL_HANDLER + if(!item) return COMPONENT_BLOCK_SHARPEN_BLOCKED if(sharpened_increase) diff --git a/code/datums/components/uplink.dm b/code/datums/components/uplink.dm index 4136237505d..7777a47dbef 100644 --- a/code/datums/components/uplink.dm +++ b/code/datums/components/uplink.dm @@ -94,6 +94,8 @@ uplink_items = get_uplink_items(gamemode, TRUE, allow_restricted) /datum/component/uplink/proc/OnAttackBy(datum/source, obj/item/I, mob/user) + SIGNAL_HANDLER + if(!active) return //no hitting everyone/everything just to try to slot tcs in! if(istype(I, /obj/item/stack/telecrystal)) @@ -112,6 +114,8 @@ return /datum/component/uplink/proc/interact(datum/source, mob/user) + SIGNAL_HANDLER_DOES_SLEEP + if(locked) return active = TRUE @@ -225,25 +229,35 @@ // Implant signal responses /datum/component/uplink/proc/implant_activation() + SIGNAL_HANDLER_DOES_SLEEP + var/obj/item/implant/implant = parent locked = FALSE interact(null, implant.imp_in) /datum/component/uplink/proc/implanting(datum/source, list/arguments) + SIGNAL_HANDLER + var/mob/user = arguments[2] owner = "[user.key]" /datum/component/uplink/proc/old_implant(datum/source, list/arguments, obj/item/implant/new_implant) + SIGNAL_HANDLER + // It kinda has to be weird like this until implants are components return SEND_SIGNAL(new_implant, COMSIG_IMPLANT_EXISTING_UPLINK, src) /datum/component/uplink/proc/new_implant(datum/source, datum/component/uplink/uplink) + SIGNAL_HANDLER + uplink.telecrystals += telecrystals return COMPONENT_DELETE_NEW_IMPLANT // PDA signal responses /datum/component/uplink/proc/new_ringtone(datum/source, mob/living/user, new_ring_text) + SIGNAL_HANDLER_DOES_SLEEP + var/obj/item/pda/master = parent if(trim(lowertext(new_ring_text)) != trim(lowertext(unlock_code))) if(trim(lowertext(new_ring_text)) == trim(lowertext(failsafe_code))) @@ -258,11 +272,15 @@ return COMPONENT_STOP_RINGTONE_CHANGE /datum/component/uplink/proc/check_detonate() + SIGNAL_HANDLER + return COMPONENT_PDA_NO_DETONATE // Radio signal responses /datum/component/uplink/proc/new_frequency(datum/source, list/arguments) + SIGNAL_HANDLER_DOES_SLEEP + var/obj/item/radio/master = parent var/frequency = arguments[1] if(frequency != unlock_code) @@ -276,6 +294,8 @@ // Pen signal responses /datum/component/uplink/proc/pen_rotation(datum/source, degrees, mob/living/carbon/user) + SIGNAL_HANDLER_DOES_SLEEP + var/obj/item/pen/master = parent previous_attempts += degrees if(length(previous_attempts) > PEN_ROTATIONS) diff --git a/code/datums/components/wearertargeting.dm b/code/datums/components/wearertargeting.dm index 4760757701f..cbfec78d11f 100644 --- a/code/datums/components/wearertargeting.dm +++ b/code/datums/components/wearertargeting.dm @@ -13,10 +13,14 @@ RegisterSignal(parent, COMSIG_ITEM_DROPPED, .proc/on_drop) /datum/component/wearertargeting/proc/on_equip(datum/source, mob/equipper, slot) + SIGNAL_HANDLER + if((slot in valid_slots) && istype(equipper, mobtype)) RegisterSignal(equipper, signals, proctype, TRUE) else UnregisterSignal(equipper, signals) /datum/component/wearertargeting/proc/on_drop(datum/source, mob/user) + SIGNAL_HANDLER + UnregisterSignal(user, signals) diff --git a/code/datums/components/wet_floor.dm b/code/datums/components/wet_floor.dm index 2d3452d335a..0036a86ee39 100644 --- a/code/datums/components/wet_floor.dm +++ b/code/datums/components/wet_floor.dm @@ -97,6 +97,8 @@ parent.LoadComponent(/datum/component/slippery, intensity, lube_flags, CALLBACK(src, .proc/AfterSlip)) /datum/component/wet_floor/proc/dry(datum/source, strength = TURF_WET_WATER, immediate = FALSE, duration_decrease = INFINITY) + SIGNAL_HANDLER + for(var/i in time_left_list) if(text2num(i) <= strength) time_left_list[i] = max(0, time_left_list[i] - duration_decrease) @@ -137,6 +139,8 @@ highest_strength = max(highest_strength, text2num(i)) /datum/component/wet_floor/proc/is_wet() + SIGNAL_HANDLER + . = 0 for(var/i in time_left_list) . |= text2num(i) diff --git a/code/datums/diseases/pierrot_throat.dm b/code/datums/diseases/pierrot_throat.dm index 24ccf6d7f84..56261688fc2 100644 --- a/code/datums/diseases/pierrot_throat.dm +++ b/code/datums/diseases/pierrot_throat.dm @@ -32,6 +32,8 @@ /datum/disease/pierrot_throat/proc/handle_speech(datum/source, list/speech_args) + SIGNAL_HANDLER + var/message = speech_args[SPEECH_MESSAGE] var/list/split_message = splittext(message, " ") //List each word in the message var/applied = 0 diff --git a/code/datums/elements/_element.dm b/code/datums/elements/_element.dm index 46a295f90be..015267b5966 100644 --- a/code/datums/elements/_element.dm +++ b/code/datums/elements/_element.dm @@ -27,6 +27,8 @@ /// Deactivates the functionality defines by the element on the given datum /datum/element/proc/Detach(datum/source, force) + SIGNAL_HANDLER + SEND_SIGNAL(source, COMSIG_ELEMENT_DETACH, src) SHOULD_CALL_PARENT(1) UnregisterSignal(source, COMSIG_PARENT_QDELETING) diff --git a/code/datums/elements/bsa_blocker.dm b/code/datums/elements/bsa_blocker.dm index 61140ad0ed5..5bdf4fa9091 100644 --- a/code/datums/elements/bsa_blocker.dm +++ b/code/datums/elements/bsa_blocker.dm @@ -7,4 +7,6 @@ return ..() /datum/element/bsa_blocker/proc/block_bsa() + SIGNAL_HANDLER + return COMSIG_ATOM_BLOCKS_BSA_BEAM diff --git a/code/datums/elements/cleaning.dm b/code/datums/elements/cleaning.dm index 57d58c592fe..acf3749b437 100644 --- a/code/datums/elements/cleaning.dm +++ b/code/datums/elements/cleaning.dm @@ -9,6 +9,8 @@ UnregisterSignal(target, COMSIG_MOVABLE_MOVED) /datum/element/cleaning/proc/Clean(datum/source) + SIGNAL_HANDLER + var/atom/movable/AM = source var/turf/tile = AM.loc if(!isturf(tile)) diff --git a/code/datums/elements/digitalcamo.dm b/code/datums/elements/digitalcamo.dm index 5451fbfe53b..8c9b5e88a5a 100644 --- a/code/datums/elements/digitalcamo.dm +++ b/code/datums/elements/digitalcamo.dm @@ -40,9 +40,13 @@ S.unhide_single_atomhud_from(AI,target) /datum/element/digitalcamo/proc/on_examine(datum/source, mob/M) + SIGNAL_HANDLER + to_chat(M, "[source.p_their()] skin seems to be shifting and morphing like is moving around below it.") /datum/element/digitalcamo/proc/can_track(datum/source) + SIGNAL_HANDLER + return COMPONENT_CANT_TRACK /datum/element/digitalcamo/process() diff --git a/code/datums/elements/dunkable.dm b/code/datums/elements/dunkable.dm index c5b4a92d430..8ba38a515da 100644 --- a/code/datums/elements/dunkable.dm +++ b/code/datums/elements/dunkable.dm @@ -17,6 +17,8 @@ UnregisterSignal(target, COMSIG_ITEM_AFTERATTACK) /datum/element/dunkable/proc/get_dunked(datum/source, atom/target, mob/user, proximity_flag) + SIGNAL_HANDLER + if(!proximity_flag) // if the user is not adjacent to the container return var/obj/item/reagent_containers/container = target // the container we're trying to dunk into diff --git a/code/datums/elements/earhealing.dm b/code/datums/elements/earhealing.dm index deb2d696615..a1e038d998c 100644 --- a/code/datums/elements/earhealing.dm +++ b/code/datums/elements/earhealing.dm @@ -18,6 +18,8 @@ user_by_item -= target /datum/element/earhealing/proc/equippedChanged(datum/source, mob/living/carbon/user, slot) + SIGNAL_HANDLER + if(slot == ITEM_SLOT_EARS && istype(user)) user_by_item[source] = user else diff --git a/code/datums/elements/embed.dm b/code/datums/elements/embed.dm index 56d117b5c5d..5777bf8acf4 100644 --- a/code/datums/elements/embed.dm +++ b/code/datums/elements/embed.dm @@ -68,6 +68,8 @@ /// Checking to see if we're gonna embed into a human /datum/element/embed/proc/checkEmbed(obj/item/weapon, mob/living/carbon/victim, hit_zone, datum/thrownthing/throwingdatum, forced=FALSE) + SIGNAL_HANDLER + if(!istype(victim) || HAS_TRAIT(victim, TRAIT_PIERCEIMMUNE)) return @@ -108,15 +110,21 @@ ///A different embed element has been attached, so we'll detach and let them handle things /datum/element/embed/proc/severancePackage(obj/weapon, datum/element/E) + SIGNAL_HANDLER + if(istype(E, /datum/element/embed)) Detach(weapon) ///If we don't want to be embeddable anymore (deactivating an e-dagger for instance) /datum/element/embed/proc/detachFromWeapon(obj/weapon) + SIGNAL_HANDLER + Detach(weapon) ///Someone inspected our embeddable item /datum/element/embed/proc/examined(obj/item/I, mob/user, list/examine_list) + SIGNAL_HANDLER + if(I.isEmbedHarmless()) examine_list += "[I] feels sticky, and could probably get stuck to someone if thrown properly!" else @@ -129,6 +137,8 @@ * it to call tryForceEmbed() on its own embed element (it's out of our hands here, our projectile is done), where it will run through all the checks it needs to. */ /datum/element/embed/proc/checkEmbedProjectile(obj/projectile/P, atom/movable/firer, atom/hit, angle, hit_zone) + SIGNAL_HANDLER + if(!iscarbon(hit)) Detach(P) return // we don't care @@ -159,6 +169,8 @@ * * forced- if we want this to succeed 100% */ /datum/element/embed/proc/tryForceEmbed(obj/item/I, atom/target, hit_zone, forced=FALSE) + SIGNAL_HANDLER + var/obj/item/bodypart/limb var/mob/living/carbon/C diff --git a/code/datums/elements/firestacker.dm b/code/datums/elements/firestacker.dm index 928ca275205..3b131990361 100644 --- a/code/datums/elements/firestacker.dm +++ b/code/datums/elements/firestacker.dm @@ -28,13 +28,19 @@ target.adjust_fire_stacks(amount) /datum/element/firestacker/proc/impact(datum/source, atom/hit_atom, datum/thrownthing/throwingdatum) + SIGNAL_HANDLER + if(isliving(hit_atom)) stack_on(source, hit_atom) /datum/element/firestacker/proc/item_attack(datum/source, atom/movable/target, mob/living/user) + SIGNAL_HANDLER + if(isliving(target)) stack_on(source, target) /datum/element/firestacker/proc/item_attack_self(datum/source, mob/user) + SIGNAL_HANDLER + if(isliving(user)) stack_on(source, user) diff --git a/code/datums/elements/forced_gravity.dm b/code/datums/elements/forced_gravity.dm index 0b50df5b21f..b184aa989cb 100644 --- a/code/datums/elements/forced_gravity.dm +++ b/code/datums/elements/forced_gravity.dm @@ -22,9 +22,13 @@ UnregisterSignal(source, signals_b_gone) /datum/element/forced_gravity/proc/gravity_check(datum/source, turf/location, list/gravs) + SIGNAL_HANDLER + if(!ignore_space && isspaceturf(location)) return gravs += gravity /datum/element/forced_gravity/proc/turf_gravity_check(datum/source, atom/checker, list/gravs) + SIGNAL_HANDLER + return gravity_check(null, source, gravs) diff --git a/code/datums/elements/selfknockback.dm b/code/datums/elements/selfknockback.dm index 5e153579d6a..c99f8ab4cc2 100644 --- a/code/datums/elements/selfknockback.dm +++ b/code/datums/elements/selfknockback.dm @@ -37,6 +37,8 @@ clamping the Knockback_Force value below. */ return default_speed /datum/element/selfknockback/proc/Item_SelfKnockback(obj/item/I, atom/attacktarget, mob/usertarget, proximity_flag) + SIGNAL_HANDLER + if(isturf(attacktarget) && !attacktarget.density) return if(proximity_flag || (get_dist(attacktarget, usertarget) <= I.reach)) @@ -49,6 +51,8 @@ clamping the Knockback_Force value below. */ usertarget.visible_message("[usertarget] gets thrown back by the force of \the [I] impacting \the [attacktarget]!", "The force of \the [I] impacting \the [attacktarget] sends you flying!") /datum/element/selfknockback/proc/Projectile_SelfKnockback(obj/projectile/P) + SIGNAL_HANDLER + if(!P.firer) return diff --git a/code/datums/elements/snail_crawl.dm b/code/datums/elements/snail_crawl.dm index 0e322c7c9d2..2bca125f4c2 100644 --- a/code/datums/elements/snail_crawl.dm +++ b/code/datums/elements/snail_crawl.dm @@ -19,12 +19,16 @@ target.remove_movespeed_modifier(/datum/movespeed_modifier/snail_crawl) /datum/element/snailcrawl/proc/snail_crawl(mob/living/carbon/snail) + SIGNAL_HANDLER + if(snail.resting && !snail.buckled && lubricate(snail)) snail.add_movespeed_modifier(/datum/movespeed_modifier/snail_crawl) else snail.remove_movespeed_modifier(/datum/movespeed_modifier/snail_crawl) /datum/element/snailcrawl/proc/lubricate(atom/movable/snail) + SIGNAL_HANDLER + var/turf/open/OT = get_turf(snail) if(istype(OT)) OT.MakeSlippery(TURF_WET_LUBE, 20) diff --git a/code/datums/elements/tool_flash.dm b/code/datums/elements/tool_flash.dm index 622fe51c12e..47fac4b5a26 100644 --- a/code/datums/elements/tool_flash.dm +++ b/code/datums/elements/tool_flash.dm @@ -24,10 +24,14 @@ UnregisterSignal(source, list(COMSIG_TOOL_IN_USE, COMSIG_TOOL_START_USE)) /datum/element/tool_flash/proc/prob_flash(datum/source, mob/living/user) + SIGNAL_HANDLER + if(prob(90)) return flash(source, user) /datum/element/tool_flash/proc/flash(datum/source, mob/living/user) + SIGNAL_HANDLER + if(user && get_dist(get_turf(source), get_turf(user)) <= 1) user.flash_act(min(flash_strength,1)) diff --git a/code/datums/elements/undertile.dm b/code/datums/elements/undertile.dm index 3ce11d48764..a2136812b9b 100644 --- a/code/datums/elements/undertile.dm +++ b/code/datums/elements/undertile.dm @@ -29,6 +29,8 @@ ///called when a tile has been covered or uncovered /datum/element/undertile/proc/hide(atom/movable/source, covered) + SIGNAL_HANDLER + source.invisibility = covered ? invisibility_level : 0 var/turf/T = get_turf(source) diff --git a/code/datums/elements/update_icon_blocker.dm b/code/datums/elements/update_icon_blocker.dm index f52a712ebb5..5c84ed9886a 100644 --- a/code/datums/elements/update_icon_blocker.dm +++ b/code/datums/elements/update_icon_blocker.dm @@ -7,4 +7,6 @@ RegisterSignal(target, COMSIG_ATOM_UPDATE_ICON, .proc/block_update_icon) /datum/element/update_icon_blocker/proc/block_update_icon() + SIGNAL_HANDLER + return COMSIG_ATOM_NO_UPDATE_ICON_STATE | COMSIG_ATOM_NO_UPDATE_OVERLAYS diff --git a/code/datums/elements/update_icon_updates_onmob.dm b/code/datums/elements/update_icon_updates_onmob.dm index ca0e8b1641d..7d1cb8d287d 100644 --- a/code/datums/elements/update_icon_updates_onmob.dm +++ b/code/datums/elements/update_icon_updates_onmob.dm @@ -8,6 +8,8 @@ RegisterSignal(target, COMSIG_ATOM_UPDATED_ICON, .proc/update_onmob) /datum/element/update_icon_updates_onmob/proc/update_onmob(obj/item/target) + SIGNAL_HANDLER + if(ismob(target.loc)) var/mob/M = target.loc if(M.is_holding(target)) diff --git a/code/datums/elements/waddling.dm b/code/datums/elements/waddling.dm index 81a36333420..dcdbdb258dc 100644 --- a/code/datums/elements/waddling.dm +++ b/code/datums/elements/waddling.dm @@ -14,11 +14,15 @@ UnregisterSignal(source, COMSIG_MOVABLE_MOVED) /datum/element/waddling/proc/LivingWaddle(mob/living/target) + SIGNAL_HANDLER + if(target.incapacitated() || !(target.mobility_flags & MOBILITY_STAND)) return Waddle(target) /datum/element/waddling/proc/Waddle(atom/movable/target) + SIGNAL_HANDLER + animate(target, pixel_z = 4, time = 0) var/prev_trans = matrix(target.transform) animate(pixel_z = 0, transform = turn(target.transform, pick(-12, 0, 12)), time=2) diff --git a/code/datums/martial/sleeping_carp.dm b/code/datums/martial/sleeping_carp.dm index 9384abe063d..09f53dc6035 100644 --- a/code/datums/martial/sleeping_carp.dm +++ b/code/datums/martial/sleeping_carp.dm @@ -172,10 +172,14 @@ /// triggered on wield of two handed item /obj/item/staff/bostaff/proc/on_wield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = TRUE /// triggered on unwield of two handed item /obj/item/staff/bostaff/proc/on_unwield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = FALSE /obj/item/staff/bostaff/update_icon_state() diff --git a/code/datums/mind.dm b/code/datums/mind.dm index ddd0d3e2d21..f08f477f277 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -219,6 +219,8 @@ to_chat(user, msg) /datum/mind/proc/set_death_time() + SIGNAL_HANDLER + last_death = world.time /datum/mind/proc/store_memory(new_text) diff --git a/code/datums/movement_detector.dm b/code/datums/movement_detector.dm index d5df0184097..3fc64c1b11a 100644 --- a/code/datums/movement_detector.dm +++ b/code/datums/movement_detector.dm @@ -18,7 +18,7 @@ untrack() tracked = target src.listener = listener - + while(ismovable(target)) RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/move_react) target = target.loc @@ -37,8 +37,10 @@ * This works by detecting movement of either the tracked object, or anything it is inside, recursively */ /datum/movement_detector/proc/move_react(atom/movable/mover, atom/oldloc, direction) + SIGNAL_HANDLER + var/turf/newturf = get_turf(tracked) - + if(oldloc && !isturf(oldloc)) var/atom/target = oldloc while(ismovable(target)) diff --git a/code/datums/mutations/body.dm b/code/datums/mutations/body.dm index 99326abacdd..c0938a05dea 100644 --- a/code/datums/mutations/body.dm +++ b/code/datums/mutations/body.dm @@ -402,6 +402,8 @@ ///Triggers on moved(). Randomly makes the owner trip /datum/mutation/human/extrastun/proc/on_move() + SIGNAL_HANDLER + if(prob(99.5)) //The brawl mutation return if(owner.buckled || !(owner.mobility_flags & MOBILITY_STAND) || !((owner.mobility_flags & (MOBILITY_STAND | MOBILITY_MOVE)) == (MOBILITY_STAND | MOBILITY_MOVE)) || owner.throwing || owner.movement_type & (VENTCRAWLING | FLYING | FLOATING)) @@ -430,6 +432,8 @@ UnregisterSignal(owner, COMSIG_MOB_STATCHANGE) /datum/mutation/human/martyrdom/proc/bloody_shower(new_stat) + SIGNAL_HANDLER + if(new_stat != UNCONSCIOUS) return var/list/organs = owner.getorganszone(BODY_ZONE_HEAD, 1) @@ -495,5 +499,7 @@ /datum/mutation/human/headless/proc/abortattachment(datum/source, obj/item/bodypart/new_limb, special) //you aren't getting your head back + SIGNAL_HANDLER + if(istype(new_limb, /obj/item/bodypart/head)) return COMPONENT_NO_ATTACH diff --git a/code/datums/mutations/chameleon.dm b/code/datums/mutations/chameleon.dm index 47502aa85ef..ab609b54cf2 100644 --- a/code/datums/mutations/chameleon.dm +++ b/code/datums/mutations/chameleon.dm @@ -20,9 +20,13 @@ owner.alpha = max(0, owner.alpha - 25) /datum/mutation/human/chameleon/proc/on_move() + SIGNAL_HANDLER + owner.alpha = CHAMELEON_MUTATION_DEFAULT_TRANSPARENCY /datum/mutation/human/chameleon/proc/on_attack_hand(atom/target, proximity) + SIGNAL_HANDLER + if(!proximity) //stops tk from breaking chameleon return owner.alpha = CHAMELEON_MUTATION_DEFAULT_TRANSPARENCY diff --git a/code/datums/mutations/hulk.dm b/code/datums/mutations/hulk.dm index 63d87ea4728..c68d827ee69 100644 --- a/code/datums/mutations/hulk.dm +++ b/code/datums/mutations/hulk.dm @@ -27,6 +27,8 @@ RegisterSignal(owner, COMSIG_MOB_SAY, .proc/handle_speech) /datum/mutation/human/hulk/proc/on_attack_hand(mob/living/carbon/human/source, atom/target, proximity) + SIGNAL_HANDLER_DOES_SLEEP + if(!proximity) return if(source.a_intent != INTENT_HARM) @@ -79,6 +81,8 @@ UnregisterSignal(owner, COMSIG_MOB_SAY) /datum/mutation/human/hulk/proc/handle_speech(original_message, wrapped_message) + SIGNAL_HANDLER + var/message = wrapped_message[1] if(message) message = "[replacetext(message, ".", "!")]!!" diff --git a/code/datums/mutations/sight.dm b/code/datums/mutations/sight.dm index 47b112b7c9d..21563aef9b2 100644 --- a/code/datums/mutations/sight.dm +++ b/code/datums/mutations/sight.dm @@ -99,6 +99,8 @@ ///Triggers on COMSIG_MOB_ATTACK_RANGED. Does the projectile shooting. /datum/mutation/human/laser_eyes/proc/on_ranged_attack(mob/living/carbon/human/source, atom/target, mouseparams) + SIGNAL_HANDLER_DOES_SLEEP + if(source.a_intent != INTENT_HARM) return to_chat(source, "You shoot with your laser eyes!") diff --git a/code/datums/mutations/speech.dm b/code/datums/mutations/speech.dm index 637d4d7746d..d0b8ad14498 100644 --- a/code/datums/mutations/speech.dm +++ b/code/datums/mutations/speech.dm @@ -30,6 +30,8 @@ UnregisterSignal(owner, COMSIG_MOB_SAY) /datum/mutation/human/wacky/proc/handle_speech(datum/source, list/speech_args) + SIGNAL_HANDLER + speech_args[SPEECH_SPANS] |= SPAN_SANS /datum/mutation/human/mute @@ -84,6 +86,8 @@ UnregisterSignal(owner, COMSIG_MOB_SAY) /datum/mutation/human/swedish/proc/handle_speech(datum/source, list/speech_args) + SIGNAL_HANDLER + var/message = speech_args[SPEECH_MESSAGE] if(message) message = replacetext(message,"w","v") @@ -170,6 +174,8 @@ UnregisterSignal(owner, COMSIG_MOB_SAY) /datum/mutation/human/elvis/proc/handle_speech(datum/source, list/speech_args) + SIGNAL_HANDLER + var/message = speech_args[SPEECH_MESSAGE] if(message) message = " [message] " diff --git a/code/datums/mutations/telekinesis.dm b/code/datums/mutations/telekinesis.dm index 11f736b4fd4..ffa762aa4fb 100644 --- a/code/datums/mutations/telekinesis.dm +++ b/code/datums/mutations/telekinesis.dm @@ -30,4 +30,6 @@ ///Triggers on COMSIG_MOB_ATTACK_RANGED. Usually handles stuff like picking up items at range. /datum/mutation/human/telekinesis/proc/on_ranged_attack(datum/source, atom/target) + SIGNAL_HANDLER + target.attack_tk(owner) diff --git a/code/datums/progressbar.dm b/code/datums/progressbar.dm index f9452c98970..67051686b7d 100644 --- a/code/datums/progressbar.dm +++ b/code/datums/progressbar.dm @@ -78,6 +78,8 @@ ///Called right before the user's Destroy() /datum/progressbar/proc/on_user_delete(datum/source) + SIGNAL_HANDLER + user.progressbars = null //We can simply nuke the list and stop worrying about updating other prog bars if the user itself is gone. user = null qdel(src) @@ -85,6 +87,8 @@ ///Removes the progress bar image from the user_client and nulls the variable, if it exists. /datum/progressbar/proc/clean_user_client(datum/source) + SIGNAL_HANDLER + if(!user_client) //Disconnected, already gone. return user_client.images -= bar @@ -93,6 +97,8 @@ ///Called by user's Login(), it transfers the progress bar image to the new client. /datum/progressbar/proc/on_user_login(datum/source) + SIGNAL_HANDLER + if(user_client) if(user_client == user.client) //If this was not client handling I'd condemn this sanity check. But clients are fickle things. return diff --git a/code/datums/status_effects/debuffs.dm b/code/datums/status_effects/debuffs.dm index e1ff728cac9..734ad74adf2 100644 --- a/code/datums/status_effects/debuffs.dm +++ b/code/datums/status_effects/debuffs.dm @@ -365,6 +365,8 @@ return ..() /datum/status_effect/eldritch/proc/update_owner_underlay(atom/source, list/overlays) + SIGNAL_HANDLER + overlays += marked_underlay /datum/status_effect/eldritch/Destroy() @@ -650,6 +652,8 @@ to_chat(owner, "You snap out of your trance!") /datum/status_effect/trance/proc/hypnotize(datum/source, list/hearing_args) + SIGNAL_HANDLER + if(!owner.can_hear()) return if(hearing_args[HEARING_SPEAKER] == owner) diff --git a/code/datums/status_effects/gas.dm b/code/datums/status_effects/gas.dm index 1be7fffc104..e4094529d31 100644 --- a/code/datums/status_effects/gas.dm +++ b/code/datums/status_effects/gas.dm @@ -29,6 +29,8 @@ qdel(src) /datum/status_effect/freon/proc/owner_resist() + SIGNAL_HANDLER_DOES_SLEEP + to_chat(owner, "You start breaking out of the ice cube...") if(do_mob(owner, owner, 40)) if(!QDELETED(src)) diff --git a/code/datums/status_effects/wound_effects.dm b/code/datums/status_effects/wound_effects.dm index 775b72699ab..90da3e61833 100644 --- a/code/datums/status_effects/wound_effects.dm +++ b/code/datums/status_effects/wound_effects.dm @@ -53,6 +53,8 @@ desc = "One or more of your legs has been wounded, slowing down steps with that leg! Get it fixed, or at least splinted!" /datum/status_effect/limp/proc/check_step(mob/whocares, OldLoc, Dir, forced) + SIGNAL_HANDLER + if(!owner.client || !(owner.mobility_flags & MOBILITY_STAND) || !owner.has_gravity() || (owner.movement_type & FLYING) || forced) return var/determined_mod = 1 @@ -66,6 +68,8 @@ next_leg = left /datum/status_effect/limp/proc/update_limp() + SIGNAL_HANDLER + var/mob/living/carbon/C = owner left = C.get_bodypart(BODY_ZONE_L_LEG) right = C.get_bodypart(BODY_ZONE_R_LEG) @@ -132,6 +136,8 @@ /// check if the wound getting removed is the wound we're tied to /datum/status_effect/wound/proc/check_remove(mob/living/L, datum/wound/W) + SIGNAL_HANDLER + if(W == linked_wound) qdel(src) diff --git a/code/datums/traits/_quirk.dm b/code/datums/traits/_quirk.dm index 2b93be37cbf..c7878b57702 100644 --- a/code/datums/traits/_quirk.dm +++ b/code/datums/traits/_quirk.dm @@ -43,6 +43,8 @@ * Used when the quirk has been gained and no client is attached to the mob. */ /datum/quirk/proc/on_quirk_holder_first_login(mob/living/source) + SIGNAL_HANDLER + UnregisterSignal(source, COMSIG_MOB_LOGIN) post_add() diff --git a/code/datums/traits/negative.dm b/code/datums/traits/negative.dm index 6a444ebb7fe..7b0f506d1f9 100644 --- a/code/datums/traits/negative.dm +++ b/code/datums/traits/negative.dm @@ -514,6 +514,8 @@ // small chance to make eye contact with inanimate objects/mindless mobs because of nerves /datum/quirk/social_anxiety/proc/looks_at_floor(datum/source, atom/A) + SIGNAL_HANDLER + var/mob/living/mind_check = A if(prob(85) || (istype(mind_check) && mind_check.mind)) return @@ -521,6 +523,8 @@ addtimer(CALLBACK(GLOBAL_PROC, .proc/to_chat, quirk_holder, "You make eye contact with [A]."), 3) /datum/quirk/social_anxiety/proc/eye_contact(datum/source, mob/living/other_mob, triggering_examiner) + SIGNAL_HANDLER + if(prob(75)) return var/msg diff --git a/code/datums/traits/neutral.dm b/code/datums/traits/neutral.dm index 48810769fce..da7202b5027 100644 --- a/code/datums/traits/neutral.dm +++ b/code/datums/traits/neutral.dm @@ -232,6 +232,8 @@ ///Checks if the headgear equipped is a wig and sets the mood event accordingly /datum/quirk/bald/proc/equip_hat(mob/user, obj/item/hat) + SIGNAL_HANDLER + if(istype(hat, /obj/item/clothing/head/wig)) SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "bad_hair_day", /datum/mood_event/confident_mane) //Our head is covered, but also by a wig so we're happy. else @@ -239,4 +241,6 @@ ///Applies a bad moodlet for having an uncovered head /datum/quirk/bald/proc/unequip_hat(mob/user, obj/item/clothing, force, newloc, no_move, invdrop, silent) + SIGNAL_HANDLER + SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "bad_hair_day", /datum/mood_event/bald) diff --git a/code/datums/wires/_wires.dm b/code/datums/wires/_wires.dm index d55ee0c84b0..31beeed6779 100644 --- a/code/datums/wires/_wires.dm +++ b/code/datums/wires/_wires.dm @@ -77,6 +77,8 @@ ///Called when holder is qdeleted for us to clean ourselves as not to leave any unlawful references. /datum/wires/proc/on_holder_qdel(atom/source, force) + SIGNAL_HANDLER + qdel(src) diff --git a/code/datums/wounds/bones.dm b/code/datums/wounds/bones.dm index 4d1c27b42e0..dfd592698af 100644 --- a/code/datums/wounds/bones.dm +++ b/code/datums/wounds/bones.dm @@ -85,6 +85,8 @@ /// If we're a human who's punching something with a broken arm, we might hurt ourselves doing so /datum/wound/blunt/proc/attack_with_hurt_hand(mob/M, atom/target, proximity) + SIGNAL_HANDLER + if(victim.get_active_hand() != limb || victim.a_intent == INTENT_HELP || !ismob(target) || severity <= WOUND_SEVERITY_MODERATE) return diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 4d5fc5c4150..f1f88c67771 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -610,6 +610,8 @@ /// Updates the icon of the atom /atom/proc/update_icon() + SIGNAL_HANDLER + var/signalOut = SEND_SIGNAL(src, COMSIG_ATOM_UPDATE_ICON) . = FALSE diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 17f48753026..4042a30def0 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -281,6 +281,8 @@ // Bypass clickchain to allow humans to use the telescreen from a distance /obj/machinery/computer/security/telescreen/entertainment/proc/BigClick() + SIGNAL_HANDLER + interact(usr) /obj/machinery/computer/security/telescreen/entertainment/proc/notify(on) diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index e103908f973..5414f3b4252 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1215,6 +1215,8 @@ /obj/machinery/door/airlock/proc/on_break() + SIGNAL_HANDLER + if(!panel_open) panel_open = TRUE wires.cut_all() diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index ce8d2828d89..12641698ea0 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -75,7 +75,7 @@ /obj/machinery/door/firedoor/power_change() . = ..() - latetoggle() + INVOKE_ASYNC(src, .proc/latetoggle) /obj/machinery/door/firedoor/attack_hand(mob/user) . = ..() diff --git a/code/game/machinery/doppler_array.dm b/code/game/machinery/doppler_array.dm index a86a27d74b8..e499028666d 100644 --- a/code/game/machinery/doppler_array.dm +++ b/code/game/machinery/doppler_array.dm @@ -130,6 +130,8 @@ /obj/machinery/doppler_array/proc/sense_explosion(datum/source, turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, took, orig_dev_range, orig_heavy_range, orig_light_range) + SIGNAL_HANDLER + if(machine_stat & NOPOWER) return FALSE var/turf/zone = get_turf(src) diff --git a/code/game/mecha/combat/durand.dm b/code/game/mecha/combat/durand.dm index 4ad9100442f..de9793a10f9 100644 --- a/code/game/mecha/combat/durand.dm +++ b/code/game/mecha/combat/durand.dm @@ -56,6 +56,8 @@ ///Relays the signal from the action button to the shield, and creates a new shield if the old one is MIA. /obj/mecha/combat/durand/proc/relay(datum/source, list/signal_args) + SIGNAL_HANDLER + if(!shield) //if the shield somehow got deleted shield = new/obj/durand_shield shield.chassis = src @@ -66,6 +68,8 @@ //Redirects projectiles to the shield if defense_check decides they should be blocked and returns true. /obj/mecha/combat/durand/proc/prehit(obj/projectile/source, list/signal_args) + SIGNAL_HANDLER + if(defense_check(source.loc) && shield) signal_args[2] = shield @@ -156,6 +160,8 @@ and relayed by the mech itself. The "forced" variabe, signal_args[1], will skip the shield is disabled by means other than the action button (like running out of power)*/ /obj/durand_shield/proc/activate(datum/source, datum/action/innate/mecha/mech_defense_mode/button, list/signal_args) + SIGNAL_HANDLER + if(!chassis || !chassis.occupant) return if(switching && !signal_args[1]) @@ -178,17 +184,21 @@ the shield is disabled by means other than the action button (like running out o flick("shield_raise", src) playsound(src, 'sound/mecha/mech_shield_raise.ogg', 50, FALSE) set_light(l_range = MINIMUM_USEFUL_LIGHT_RANGE , l_power = 5, l_color = "#00FFFF") - sleep(3) - icon_state = "shield" + addtimer(CALLBACK(src, .proc/shield_icon_enable), 3) else flick("shield_drop", src) playsound(src, 'sound/mecha/mech_shield_drop.ogg', 50, FALSE) - sleep(5) - set_light(0) - icon_state = "shield_null" - invisibility = INVISIBILITY_MAXIMUM //no showing on right-click + addtimer(CALLBACK(src, .proc/shield_icon_reset), 5) switching = FALSE +/obj/durand_shield/proc/shield_icon_enable() + icon_state = "shield" + +/obj/durand_shield/proc/shield_icon_reset() + set_light(0) + icon_state = "shield_null" + invisibility = INVISIBILITY_MAXIMUM //no showing on right-click + /obj/durand_shield/take_damage() if(!chassis) qdel(src) diff --git a/code/game/objects/effects/blessing.dm b/code/game/objects/effects/blessing.dm index 4d3ff290e50..9db8d46b9ed 100644 --- a/code/game/objects/effects/blessing.dm +++ b/code/game/objects/effects/blessing.dm @@ -23,5 +23,7 @@ return ..() /obj/effect/blessing/proc/block_cult_teleport(datum/source, channel, turf/origin, turf/destination) + SIGNAL_HANDLER + if(channel == TELEPORT_CHANNEL_CULT) return COMPONENT_BLOCK_TELEPORT diff --git a/code/game/objects/effects/proximity.dm b/code/game/objects/effects/proximity.dm index cc3494c22d8..4b46c148e82 100644 --- a/code/game/objects/effects/proximity.dm +++ b/code/game/objects/effects/proximity.dm @@ -36,6 +36,8 @@ return ..() /datum/proximity_monitor/proc/HandleMove() + SIGNAL_HANDLER_DOES_SLEEP + var/atom/_host = host var/atom/new_host_loc = _host.loc if(last_host_loc != new_host_loc) diff --git a/code/game/objects/items/RCL.dm b/code/game/objects/items/RCL.dm index 5e4939d944c..9d00e37544b 100644 --- a/code/game/objects/items/RCL.dm +++ b/code/game/objects/items/RCL.dm @@ -35,10 +35,14 @@ /// triggered on wield of two handed item /obj/item/rcl/proc/on_wield(obj/item/source, mob/user) + SIGNAL_HANDLER + active = TRUE /// triggered on unwield of two handed item /obj/item/rcl/proc/on_unwield(obj/item/source, mob/user) + SIGNAL_HANDLER + active = FALSE /obj/item/rcl/attackby(obj/item/W, mob/user) @@ -170,6 +174,8 @@ listeningTo = to_hook /obj/item/rcl/proc/trigger(mob/user) + SIGNAL_HANDLER + if(active) layCable(user) if(wiring_gui_menu) //update the wire options as you move diff --git a/code/game/objects/items/binoculars.dm b/code/game/objects/items/binoculars.dm index 8d53cc76a8b..34b2989f660 100644 --- a/code/game/objects/items/binoculars.dm +++ b/code/game/objects/items/binoculars.dm @@ -25,6 +25,8 @@ return ..() /obj/item/binoculars/proc/on_wield(obj/item/source, mob/user) + SIGNAL_HANDLER + RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/on_walk) RegisterSignal(user, COMSIG_ATOM_DIR_CHANGE, .proc/rotate) listeningTo = user @@ -34,15 +36,21 @@ user.client.view_size.zoomOut(zoom_out_amt, zoom_amt, user.dir) /obj/item/binoculars/proc/rotate(atom/thing, old_dir, new_dir) + SIGNAL_HANDLER + if(ismob(thing)) var/mob/lad = thing lad.regenerate_icons() lad.client.view_size.zoomOut(zoom_out_amt, zoom_amt, new_dir) /obj/item/binoculars/proc/on_walk() + SIGNAL_HANDLER + attack_self(listeningTo) //Yes I have sinned, why do you ask? /obj/item/binoculars/proc/on_unwield(obj/item/source, mob/user) + SIGNAL_HANDLER + if(listeningTo) UnregisterSignal(user, COMSIG_MOVABLE_MOVED) UnregisterSignal(user, COMSIG_ATOM_DIR_CHANGE) diff --git a/code/game/objects/items/broom.dm b/code/game/objects/items/broom.dm index 26dc1be948e..2260cf8a611 100644 --- a/code/game/objects/items/broom.dm +++ b/code/game/objects/items/broom.dm @@ -37,6 +37,8 @@ * * user - The user which is wielding the broom */ /obj/item/pushbroom/proc/on_wield(obj/item/source, mob/user) + SIGNAL_HANDLER + to_chat(user, "You brace the [src] against the ground in a firm sweeping stance.") RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/sweep) @@ -48,6 +50,8 @@ * * user - The user which is unwielding the broom */ /obj/item/pushbroom/proc/on_unwield(obj/item/source, mob/user) + SIGNAL_HANDLER + UnregisterSignal(user, COMSIG_MOVABLE_MOVED) /obj/item/pushbroom/afterattack(atom/A, mob/user, proximity) @@ -65,6 +69,8 @@ * * moving - Boolean argument declaring if the sweep is from generated from movement or not */ /obj/item/pushbroom/proc/sweep(mob/user, atom/A, moving = TRUE) + SIGNAL_HANDLER + var/turf/target = moving ? user.loc : (isturf(A) ? A : A.loc) if (!isturf(target)) return diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index 8b0f0f65f4b..5a56d234227 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -298,6 +298,8 @@ . += mutable_appearance(icon, "id[job]") /obj/item/card/id/proc/update_in_wallet() + SIGNAL_HANDLER + if(istype(loc, /obj/item/storage/wallet)) var/obj/item/storage/wallet/powergaming = loc if(powergaming.front_id == src) diff --git a/code/game/objects/items/chainsaw.dm b/code/game/objects/items/chainsaw.dm index e63e7a41d0b..4cd293dbff7 100644 --- a/code/game/objects/items/chainsaw.dm +++ b/code/game/objects/items/chainsaw.dm @@ -36,10 +36,14 @@ /// triggered on wield of two handed item /obj/item/chainsaw/proc/on_wield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = TRUE /// triggered on unwield of two handed item /obj/item/chainsaw/proc/on_unwield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = FALSE /obj/item/chainsaw/suicide_act(mob/living/carbon/user) diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm index 3d66968c617..a3372dd31be 100644 --- a/code/game/objects/items/defib.dm +++ b/code/game/objects/items/defib.dm @@ -314,10 +314,14 @@ /// triggered on wield of two handed item /obj/item/shockpaddles/proc/on_wield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = TRUE /// triggered on unwield of two handed item /obj/item/shockpaddles/proc/on_unwield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = FALSE /obj/item/shockpaddles/Destroy() @@ -340,6 +344,8 @@ defib.fire_act(exposed_temperature, exposed_volume) /obj/item/shockpaddles/proc/check_range() + SIGNAL_HANDLER + if(!req_defib || !defib) return if(!in_range(src,defib)) diff --git a/code/game/objects/items/dualsaber.dm b/code/game/objects/items/dualsaber.dm index e05f2c0ccbc..a375a15d18a 100644 --- a/code/game/objects/items/dualsaber.dm +++ b/code/game/objects/items/dualsaber.dm @@ -40,6 +40,8 @@ /// Triggered on wield of two handed item /// Specific hulk checks due to reflection chance for balance issues and switches hitsounds. /obj/item/dualsaber/proc/on_wield(obj/item/source, mob/living/carbon/user) + SIGNAL_HANDLER + if(user && user.has_dna()) if(user.dna.check_mutation(HULK)) to_chat(user, "You lack the grace to wield this!") @@ -53,6 +55,8 @@ /// Triggered on unwield of two handed item /// switch hitsounds /obj/item/dualsaber/proc/on_unwield(obj/item/source, mob/living/carbon/user) + SIGNAL_HANDLER + wielded = FALSE w_class = initial(w_class) hitsound = "swing_hit" diff --git a/code/game/objects/items/fireaxe.dm b/code/game/objects/items/fireaxe.dm index 2505c6e8db6..897aa287a5d 100644 --- a/code/game/objects/items/fireaxe.dm +++ b/code/game/objects/items/fireaxe.dm @@ -34,10 +34,14 @@ /// triggered on wield of two handed item /obj/item/fireaxe/proc/on_wield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = TRUE /// triggered on unwield of two handed item /obj/item/fireaxe/proc/on_unwield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = FALSE /obj/item/fireaxe/update_icon_state() diff --git a/code/game/objects/items/his_grace.dm b/code/game/objects/items/his_grace.dm index 4989c241c4b..013bc28210f 100644 --- a/code/game/objects/items/his_grace.dm +++ b/code/game/objects/items/his_grace.dm @@ -137,6 +137,8 @@ move_gracefully() /obj/item/his_grace/proc/move_gracefully() + SIGNAL_HANDLER + if(!awakened) return var/static/list/transforms diff --git a/code/game/objects/items/pitchfork.dm b/code/game/objects/items/pitchfork.dm index 2ba33674e82..347b9f760e4 100644 --- a/code/game/objects/items/pitchfork.dm +++ b/code/game/objects/items/pitchfork.dm @@ -27,10 +27,14 @@ /// triggered on wield of two handed item /obj/item/pitchfork/proc/on_wield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = TRUE /// triggered on unwield of two handed item /obj/item/pitchfork/proc/on_unwield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = FALSE /obj/item/pitchfork/update_icon_state() diff --git a/code/game/objects/items/singularityhammer.dm b/code/game/objects/items/singularityhammer.dm index 38568071300..89b5cef072d 100644 --- a/code/game/objects/items/singularityhammer.dm +++ b/code/game/objects/items/singularityhammer.dm @@ -29,10 +29,14 @@ ///triggered on wield of two handed item /obj/item/singularityhammer/proc/on_wield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = TRUE ///triggered on unwield of two handed item /obj/item/singularityhammer/proc/on_unwield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = FALSE /obj/item/singularityhammer/update_icon_state() diff --git a/code/game/objects/items/spear.dm b/code/game/objects/items/spear.dm index 55271003197..d1f7af4f74d 100644 --- a/code/game/objects/items/spear.dm +++ b/code/game/objects/items/spear.dm @@ -66,10 +66,14 @@ /// triggered on wield of two handed item /obj/item/spear/explosive/proc/on_wield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = TRUE /// triggered on unwield of two handed item /obj/item/spear/explosive/proc/on_unwield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = FALSE /obj/item/spear/explosive/update_icon_state() diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 692101bdb00..a1106e46c3e 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -68,6 +68,8 @@ return ..() /obj/item/melee/baton/proc/convert(datum/source, obj/item/I, mob/user) + SIGNAL_HANDLER + if(istype(I,/obj/item/conversion_kit) && convertible) var/turf/T = get_turf(src) var/obj/item/melee/classic_baton/B = new /obj/item/melee/classic_baton (T) diff --git a/code/game/objects/items/teleportation.dm b/code/game/objects/items/teleportation.dm index 39c9fa100b4..86eb37ea4e8 100644 --- a/code/game/objects/items/teleportation.dm +++ b/code/game/objects/items/teleportation.dm @@ -195,6 +195,8 @@ add_fingerprint(user) /obj/item/hand_tele/proc/on_portal_destroy(obj/effect/portal/P) + SIGNAL_HANDLER + active_portal_pairs -= P //If this portal pair is made by us it'll be erased along with the other portal by the portal. /obj/item/hand_tele/proc/is_parent_of_portal(obj/effect/portal/P) diff --git a/code/game/objects/items/weaponry.dm b/code/game/objects/items/weaponry.dm index c4fd1574397..0a557f3703e 100644 --- a/code/game/objects/items/weaponry.dm +++ b/code/game/objects/items/weaponry.dm @@ -740,6 +740,8 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 /// Stage 1: The mistake is made /obj/item/circlegame/proc/ownerExamined(mob/living/owner, mob/living/sucker) + SIGNAL_HANDLER + if(!istype(sucker) || !in_range(owner, sucker)) return addtimer(CALLBACK(src, .proc/waitASecond, owner, sucker), 4) @@ -908,10 +910,14 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 /// triggered on wield of two handed item /obj/item/vibro_weapon/proc/on_wield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = TRUE /// triggered on unwield of two handed item /obj/item/vibro_weapon/proc/on_unwield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = FALSE /obj/item/vibro_weapon/update_icon_state() diff --git a/code/game/objects/structures/stairs.dm b/code/game/objects/structures/stairs.dm index fb3bf90ac75..5542e2d31c2 100644 --- a/code/game/objects/structures/stairs.dm +++ b/code/game/objects/structures/stairs.dm @@ -117,6 +117,8 @@ T.ChangeTurf(/turf/open/transparent/openspace, flags = CHANGETURF_INHERIT_AIR) /obj/structure/stairs/proc/on_multiz_new(turf/source, dir) + SIGNAL_HANDLER + if(dir == UP) var/turf/open/transparent/openspace/T = get_step_multiz(get_turf(src), UP) if(T && !istype(T)) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 3e2cb5cc3fe..857bb8325a9 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -279,6 +279,8 @@ RegisterSignal(I, COMSIG_MOVABLE_MOVED, .proc/RemoveItemFromTable) //Listen for the pickup event, unregister on pick-up so we aren't moved /obj/structure/table/rolling/proc/RemoveItemFromTable(datum/source, newloc, dir) + SIGNAL_HANDLER + if(newloc != loc) //Did we not move with the table? because that shit's ok return FALSE attached_items -= source diff --git a/code/modules/admin/callproc/callproc.dm b/code/modules/admin/callproc/callproc.dm index c3e466e2e71..1f60597e12c 100644 --- a/code/modules/admin/callproc/callproc.dm +++ b/code/modules/admin/callproc/callproc.dm @@ -83,8 +83,6 @@ GLOBAL_VAR(LastAdminCalledTarget) GLOBAL_PROTECT(LastAdminCalledTarget) GLOBAL_VAR(LastAdminCalledProc) GLOBAL_PROTECT(LastAdminCalledProc) -GLOBAL_LIST_EMPTY(AdminProcCallSpamPrevention) -GLOBAL_PROTECT(AdminProcCallSpamPrevention) /// Wrapper for proccalls where the datum is flagged as vareditted /proc/WrapAdminProcCall(datum/target, procname, list/arguments) @@ -99,15 +97,11 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention) var/ckey = usr ? usr.client.ckey : GLOB.AdminProcCaller if(!ckey) CRASH("WrapAdminProcCall with no ckey: [target] [procname] [english_list(arguments)]") + if(current_caller && current_caller != ckey) - if(!GLOB.AdminProcCallSpamPrevention[ckey]) - to_chat(usr, "Another set of admin called procs are still running, your proc will be run after theirs finish.", confidential = TRUE) - GLOB.AdminProcCallSpamPrevention[ckey] = TRUE - UNTIL(!GLOB.AdminProcCaller) - to_chat(usr, "Running your proc", confidential = TRUE) - GLOB.AdminProcCallSpamPrevention -= ckey - else - UNTIL(!GLOB.AdminProcCaller) + to_chat(usr, "Another set of admin called procs are still running. Try again later.", confidential = TRUE) + return + GLOB.LastAdminCalledProc = procname if(target != GLOBAL_PROC) GLOB.LastAdminCalledTargetRef = REF(target) diff --git a/code/modules/antagonists/ashwalker/ashwalker.dm b/code/modules/antagonists/ashwalker/ashwalker.dm index 69600918aad..871cb9c82d6 100644 --- a/code/modules/antagonists/ashwalker/ashwalker.dm +++ b/code/modules/antagonists/ashwalker/ashwalker.dm @@ -36,5 +36,7 @@ UnregisterSignal(owner.current, COMSIG_MOB_EXAMINATE) /datum/antagonist/ashwalker/proc/on_examinate(datum/source, atom/A) + SIGNAL_HANDLER + if(istype(A, /obj/structure/headpike)) SEND_SIGNAL(owner.current, COMSIG_ADD_MOOD_EVENT, "oogabooga", /datum/mood_event/sacrifice_good) diff --git a/code/modules/antagonists/changeling/changeling.dm b/code/modules/antagonists/changeling/changeling.dm index b9bb4da02a7..b9feb88dece 100644 --- a/code/modules/antagonists/changeling/changeling.dm +++ b/code/modules/antagonists/changeling/changeling.dm @@ -149,6 +149,8 @@ ///Handles stinging without verbs. /datum/antagonist/changeling/proc/stingAtom(mob/living/carbon/ling, atom/A) + SIGNAL_HANDLER + if(!chosen_sting || A == ling || !istype(ling) || ling.stat) return if(!chosen_sting.try_to_sting(ling, A)) diff --git a/code/modules/antagonists/cult/cult_items.dm b/code/modules/antagonists/cult/cult_items.dm index 64b22397d63..c95e6740da9 100644 --- a/code/modules/antagonists/cult/cult_items.dm +++ b/code/modules/antagonists/cult/cult_items.dm @@ -659,10 +659,14 @@ /// triggered on wield of two handed item /obj/item/cult_spear/proc/on_wield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = TRUE /// triggered on unwield of two handed item /obj/item/cult_spear/proc/on_unwield(obj/item/source, mob/user) + SIGNAL_HANDLER + wielded = FALSE /obj/item/cult_spear/update_icon_state() diff --git a/code/modules/antagonists/disease/disease_mob.dm b/code/modules/antagonists/disease/disease_mob.dm index 13f67b49563..6ae5b1796dc 100644 --- a/code/modules/antagonists/disease/disease_mob.dm +++ b/code/modules/antagonists/disease/disease_mob.dm @@ -282,6 +282,8 @@ the new instance inside the host to be updated to the template's stats. set_following(hosts[index]) /mob/camera/disease/proc/follow_mob(datum/source, newloc, dir) + SIGNAL_HANDLER + var/turf/T = get_turf(following_host) if(T) forceMove(T) diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm index 92a292ffaa6..078eda238a8 100644 --- a/code/modules/assembly/infrared.dm +++ b/code/modules/assembly/infrared.dm @@ -167,6 +167,8 @@ listeningTo = newloc /obj/item/assembly/infra/proc/check_exit(datum/source, atom/movable/offender) + SIGNAL_HANDLER_DOES_SLEEP + if(QDELETED(src)) return if(offender == src || istype(offender,/obj/effect/beam/i_beam)) diff --git a/code/modules/awaymissions/away_props.dm b/code/modules/awaymissions/away_props.dm index 6c58238bb00..b1d54686620 100644 --- a/code/modules/awaymissions/away_props.dm +++ b/code/modules/awaymissions/away_props.dm @@ -72,6 +72,8 @@ update_openspace() /obj/structure/pitgrate/proc/OnButtonPressed(datum/source,obj/machinery/button/button) + SIGNAL_HANDLER + if(button.id == id) //No range checks because this is admin abuse mostly. toggle() diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 1fbd1e329f6..1bc2d0c23b5 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -458,6 +458,8 @@ BLIND // can't see anything /// If we're a clothing with at least 1 shredded/disabled zone, give the wearer a periodic heads up letting them know their clothes are damaged /obj/item/clothing/proc/bristle(mob/living/L) + SIGNAL_HANDLER + if(!istype(L)) return if(prob(0.2)) diff --git a/code/modules/fields/fields.dm b/code/modules/fields/fields.dm index e8e677e4d68..c45df2c0097 100644 --- a/code/modules/fields/fields.dm +++ b/code/modules/fields/fields.dm @@ -319,6 +319,8 @@ listeningTo = null /obj/item/multitool/field_debug/proc/on_mob_move() + SIGNAL_HANDLER_DOES_SLEEP + check_turf(get_turf(src)) /obj/item/multitool/field_debug/process() diff --git a/code/modules/fields/timestop.dm b/code/modules/fields/timestop.dm index 09475ec9a56..f6d2133bfaa 100644 --- a/code/modules/fields/timestop.dm +++ b/code/modules/fields/timestop.dm @@ -112,6 +112,8 @@ unfreeze_turf(T) /datum/proximity_monitor/advanced/timestop/proc/unfreeze_atom(atom/movable/A) + SIGNAL_HANDLER + if(A.throwing) unfreeze_throwing(A) if(isliving(A)) diff --git a/code/modules/mafia/controller.dm b/code/modules/mafia/controller.dm index 50811366d50..2927a5c1994 100644 --- a/code/modules/mafia/controller.dm +++ b/code/modules/mafia/controller.dm @@ -512,6 +512,8 @@ * * overlay_list: signal var passing the overlay list of the mob */ /datum/mafia_controller/proc/display_votes(atom/source, list/overlay_list) + SIGNAL_HANDLER + if(phase != MAFIA_PHASE_VOTING) return var/v = get_vote_count(player_role_lookup[source],"Day") diff --git a/code/modules/mafia/roles.dm b/code/modules/mafia/roles.dm index 986ad77635c..93032499bbd 100644 --- a/code/modules/mafia/roles.dm +++ b/code/modules/mafia/roles.dm @@ -151,6 +151,8 @@ current_investigation = target /datum/mafia_role/detective/proc/investigate(datum/mafia_controller/game) + SIGNAL_HANDLER + var/datum/mafia_role/target = current_investigation if(target) if(target.detect_immune) @@ -202,6 +204,8 @@ current_target = target /datum/mafia_role/psychologist/proc/therapy_reveal(datum/mafia_controller/game) + SIGNAL_HANDLER + if(SEND_SIGNAL(src,COMSIG_MAFIA_CAN_PERFORM_ACTION,game,"reveal",current_target) & MAFIA_PREVENT_ACTION || game_status != MAFIA_ALIVE) //Got lynched or roleblocked by a lawyer. current_target = null if(current_target) @@ -238,6 +242,8 @@ current_target = target /datum/mafia_role/chaplain/proc/commune(datum/mafia_controller/game) + SIGNAL_HANDLER + var/datum/mafia_role/target = current_target if(target) to_chat(body,"You invoke spirit of [target.body.real_name] and learn their role was [target.name].") @@ -277,16 +283,22 @@ current_protected = target /datum/mafia_role/md/proc/protect(datum/mafia_controller/game) + SIGNAL_HANDLER + if(current_protected) RegisterSignal(current_protected,COMSIG_MAFIA_ON_KILL,.proc/prevent_kill) add_note("N[game.turn] - Protected [current_protected.body.real_name]") /datum/mafia_role/md/proc/prevent_kill(datum/source) + SIGNAL_HANDLER + to_chat(body,"The person you protected tonight was attacked!") to_chat(current_protected.body,"You were attacked last night, but someone nursed you back to life!") return MAFIA_PREVENT_KILL /datum/mafia_role/md/proc/end_protection(datum/mafia_controller/game) + SIGNAL_HANDLER + if(current_protected) UnregisterSignal(current_protected,COMSIG_MAFIA_ON_KILL) current_protected = null @@ -310,6 +322,8 @@ RegisterSignal(game,COMSIG_MAFIA_NIGHT_END,.proc/release) /datum/mafia_role/lawyer/proc/roleblock_text(datum/mafia_controller/game) + SIGNAL_HANDLER + if(SEND_SIGNAL(src,COMSIG_MAFIA_CAN_PERFORM_ACTION,game,"roleblock",current_target) & MAFIA_PREVENT_ACTION || game_status != MAFIA_ALIVE) //Got lynched or roleblocked by another lawyer. current_target = null if(current_target) @@ -335,16 +349,22 @@ to_chat(body,"You will block [target.body.real_name] tonight.") /datum/mafia_role/lawyer/proc/try_to_roleblock(datum/mafia_controller/game) + SIGNAL_HANDLER + if(current_target) RegisterSignal(current_target,COMSIG_MAFIA_CAN_PERFORM_ACTION, .proc/prevent_action) /datum/mafia_role/lawyer/proc/release(datum/mafia_controller/game) + SIGNAL_HANDLER + . = ..() if(current_target) UnregisterSignal(current_target, COMSIG_MAFIA_CAN_PERFORM_ACTION) current_target = null /datum/mafia_role/lawyer/proc/prevent_action(datum/source) + SIGNAL_HANDLER + if(game_status == MAFIA_ALIVE) //in case we got killed while imprisoning sk - bad luck edge return MAFIA_PREVENT_ACTION @@ -389,6 +409,8 @@ RegisterSignal(game,COMSIG_MAFIA_SUNDOWN,.proc/mafia_text) /datum/mafia_role/mafia/proc/mafia_text(datum/mafia_controller/source) + SIGNAL_HANDLER + to_chat(body,"Vote for who to kill tonight. The killer will be chosen randomly from voters.") //better detective for mafia @@ -418,6 +440,8 @@ current_investigation = target /datum/mafia_role/mafia/thoughtfeeder/proc/investigate(datum/mafia_controller/game) + SIGNAL_HANDLER + var/datum/mafia_role/target = current_investigation current_investigation = null if(SEND_SIGNAL(src,COMSIG_MAFIA_CAN_PERFORM_ACTION,game,"thoughtfeed",target) & MAFIA_PREVENT_ACTION) @@ -464,6 +488,8 @@ return TRUE //while alive, town AND mafia cannot win (though since mafia know who is who it's pretty easy to win from that point) /datum/mafia_role/traitor/proc/nightkill_immunity(datum/source,datum/mafia_controller/game,lynch) + SIGNAL_HANDLER + if(game.phase == MAFIA_PHASE_NIGHT && !lynch) to_chat(body,"You were attacked, but they'll have to try harder than that to put you down.") return MAFIA_PREVENT_KILL @@ -481,6 +507,8 @@ to_chat(body,"You will attempt to kill [target.body.real_name] tonight.") /datum/mafia_role/traitor/proc/try_to_kill(datum/mafia_controller/source) + SIGNAL_HANDLER + var/datum/mafia_role/target = current_victim current_victim = null if(SEND_SIGNAL(src,COMSIG_MAFIA_CAN_PERFORM_ACTION,source,"traitor kill",target) & MAFIA_PREVENT_ACTION) @@ -543,6 +571,8 @@ to_chat(body,"You will hunt everyone in a flickering room down tonight.") /datum/mafia_role/nightmare/proc/flicker_or_hunt(datum/mafia_controller/source) + SIGNAL_HANDLER + if(game_status != MAFIA_ALIVE || !flicker_target) return if(SEND_SIGNAL(src,COMSIG_MAFIA_CAN_PERFORM_ACTION,source,"nightmare actions",flicker_target) & MAFIA_PREVENT_ACTION) @@ -604,11 +634,15 @@ protection_status = !protection_status /datum/mafia_role/fugitive/proc/night_start(datum/mafia_controller/game) + SIGNAL_HANDLER + if(protection_status == FUGITIVE_WILL_PRESERVE) to_chat(body,"Your preparations are complete. Nothing could kill you tonight!") RegisterSignal(src,COMSIG_MAFIA_ON_KILL,.proc/prevent_death) /datum/mafia_role/fugitive/proc/night_end(datum/mafia_controller/game) + SIGNAL_HANDLER + if(protection_status == FUGITIVE_WILL_PRESERVE) charges-- UnregisterSignal(src,COMSIG_MAFIA_ON_KILL) @@ -616,10 +650,14 @@ protection_status = FUGITIVE_NOT_PRESERVING /datum/mafia_role/fugitive/proc/prevent_death(datum/mafia_controller/game) + SIGNAL_HANDLER + to_chat(body,"You were attacked! Luckily, you were ready for this!") return MAFIA_PREVENT_KILL /datum/mafia_role/fugitive/proc/survived(datum/mafia_controller/game) + SIGNAL_HANDLER + if(game_status == MAFIA_ALIVE) var/client/winner_client = GLOB.directory[player_key] winner_client?.give_award(winner_award, body) @@ -652,6 +690,8 @@ RegisterSignal(game,COMSIG_MAFIA_SUNDOWN,.proc/find_obsession) /datum/mafia_role/obsessed/proc/find_obsession(datum/mafia_controller/game) + SIGNAL_HANDLER + var/list/all_roles_shuffle = shuffle(game.all_roles) for(var/role in all_roles_shuffle) var/datum/mafia_role/possible = role @@ -667,6 +707,8 @@ UnregisterSignal(game,COMSIG_MAFIA_SUNDOWN) /datum/mafia_role/obsessed/proc/check_victory(datum/source,datum/mafia_controller/game,lynch) + SIGNAL_HANDLER + UnregisterSignal(source,COMSIG_MAFIA_ON_KILL) if(game_status == MAFIA_DEAD) return @@ -696,6 +738,8 @@ RegisterSignal(src,COMSIG_MAFIA_ON_KILL,.proc/prank) /datum/mafia_role/clown/proc/prank(datum/source,datum/mafia_controller/game,lynch) + SIGNAL_HANDLER + if(lynch) var/datum/mafia_role/victim = pick(game.judgement_guilty_votes + game.judgement_abstain_votes) game.send_message("[body.real_name] WAS A CLOWN! HONK! They take down [victim.body.real_name] with their last prank.") diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index e92cca5173c..f73be735ba2 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -48,6 +48,8 @@ * oldLoc - the old location that `target` was at before moving onto `source`. */ /obj/machinery/mineral/proc/pickup_item(datum/source, atom/movable/target, atom/oldLoc) + SIGNAL_HANDLER + return /// Generic unloading proc. Takes an atom as an argument and forceMove's it to the turf adjacent to this machine in the `output_dir` direction. diff --git a/code/modules/mob/living/carbon/carbon_say.dm b/code/modules/mob/living/carbon/carbon_say.dm index 27d0e9cbaf3..b57d4e4d270 100644 --- a/code/modules/mob/living/carbon/carbon_say.dm +++ b/code/modules/mob/living/carbon/carbon_say.dm @@ -1,4 +1,6 @@ /mob/living/carbon/proc/handle_tongueless_speech(mob/living/carbon/speaker, list/speech_args) + SIGNAL_HANDLER + var/message = speech_args[SPEECH_MESSAGE] var/static/regex/tongueless_lower = new("\[gdntke]+", "g") var/static/regex/tongueless_upper = new("\[GDNTKE]+", "g") diff --git a/code/modules/mob/living/simple_animal/eldritch_demons.dm b/code/modules/mob/living/simple_animal/eldritch_demons.dm index 16ad496c5ad..45329c78b71 100644 --- a/code/modules/mob/living/simple_animal/eldritch_demons.dm +++ b/code/modules/mob/living/simple_animal/eldritch_demons.dm @@ -85,10 +85,12 @@ var/datum/action/innate/mansus_speech/action = new(src) linked_mobs[mob_linked] = action action.Grant(mob_linked) - RegisterSignal(mob_linked, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING) , .proc/unlink_mob) + RegisterSignal(mob_linked, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING), .proc/unlink_mob) return TRUE /mob/living/simple_animal/hostile/eldritch/raw_prophet/proc/unlink_mob(mob/living/mob_linked) + SIGNAL_HANDLER + if(!linked_mobs[mob_linked]) return UnregisterSignal(mob_linked, list(COMSIG_MOB_DEATH, COMSIG_PARENT_QDELETING)) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 2e5f3a6d3ec..a4482fd2169 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -506,6 +506,8 @@ SEND_SIGNAL(src, COMSIG_MOB_EXAMINATE, A) /mob/proc/clear_from_recent_examines(atom/A) + SIGNAL_HANDLER + if(!client) return UnregisterSignal(A, COMSIG_PARENT_QDELETING) diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index 22decf86e26..ef1939ee2a7 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -118,7 +118,9 @@ * Returns TRUE if the NOPOWER flag was toggled */ /obj/machinery/proc/power_change() + SIGNAL_HANDLER SHOULD_CALL_PARENT(1) + if(machine_stat & BROKEN) return if(powered(power_channel)) diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index 45097200dfb..48e39202a14 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -120,6 +120,8 @@ azimuth_target = azimuth /obj/machinery/power/solar/proc/queue_update_solar_exposure() + SIGNAL_HANDLER + needs_to_update_solar_exposure = TRUE //updating right away would be wasteful if we're also turning later /obj/machinery/power/solar/proc/update_turn() @@ -454,6 +456,8 @@ ///Ran every time the sun updates. /obj/machinery/power/solar_control/proc/timed_track() + SIGNAL_HANDLER + if(track == SOLAR_TRACK_TIMED) azimuth_target += azimuth_rate set_panels(azimuth_target) diff --git a/code/modules/power/tracker.dm b/code/modules/power/tracker.dm index 9619a3a73fb..6e636cd53d8 100644 --- a/code/modules/power/tracker.dm +++ b/code/modules/power/tracker.dm @@ -41,6 +41,8 @@ ///Tell the controller to turn the solar panels /obj/machinery/power/tracker/proc/sun_update(datum/source, azimuth) + SIGNAL_HANDLER + setDir(angle2dir(azimuth)) if(control && control.track == SOLAR_TRACK_AUTO) control.set_panels(azimuth) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 1ad591a0295..75aefe6bd0f 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -646,6 +646,8 @@ ..() /obj/item/gun/proc/rotate(atom/thing, old_dir, new_dir) + SIGNAL_HANDLER + if(ismob(thing)) var/mob/lad = thing lad.client.view_size.zoomOut(zoom_out_amt, zoom_amt, new_dir) diff --git a/code/modules/shuttle/special.dm b/code/modules/shuttle/special.dm index dde691ef83c..f2798dfe909 100644 --- a/code/modules/shuttle/special.dm +++ b/code/modules/shuttle/special.dm @@ -174,6 +174,8 @@ . = ..() /mob/living/simple_animal/proc/check_barstaff_godmode() + SIGNAL_HANDLER + if(istype(get_area(loc), /area/shuttle/escape)) status_flags |= GODMODE else diff --git a/code/modules/swarmers/swarmer.dm b/code/modules/swarmers/swarmer.dm index 76f67c49a45..52988d02998 100644 --- a/code/modules/swarmers/swarmer.dm +++ b/code/modules/swarmers/swarmer.dm @@ -433,6 +433,8 @@ * * mob/drone - The drone to be removed from the list. */ /mob/living/simple_animal/hostile/swarmer/proc/remove_drone(mob/drone, force) + SIGNAL_HANDLER + UnregisterSignal(drone, COMSIG_PARENT_QDELETING) dronelist -= drone