Adds SIGNAL_HANDLER to a bunch of procs (#6186)

* signal handler

* Remove a few that threw a shitton of errors

I'll get someone else to look at that

* we do a little async
This commit is contained in:
Tom
2021-06-09 13:10:47 +12:00
committed by GitHub
parent 698e2a4d59
commit 9599e8d313
14 changed files with 28 additions and 5 deletions
@@ -173,6 +173,7 @@ SUBSYSTEM_DEF(statpanels)
mc_data_encoded = url_encode(json_encode(mc_data))
/atom/proc/remove_from_cache()
SIGNAL_HANDLER
SSstatpanels.cached_images -= REF(src)
/// verbs that send information from the browser UI
@@ -107,6 +107,7 @@
autofire_on(source.client)
/datum/component/automatic_fire/proc/on_mouse_down(client/source, atom/_target, turf/location, control, params)
SIGNAL_HANDLER
var/list/modifiers = params2list(params) //If they're shift+clicking, for example, let's not have them accidentally shoot.
if(LAZYACCESS(modifiers, SHIFT_CLICK))
@@ -105,6 +105,7 @@
disconnect()
/obj/item/clothing/head/helmet/monkey_sentience/proc/make_fall_off()
SIGNAL_HANDLER
if(magnification)
visible_message("<span class='warning'>[src] falls off of [magnification]'s head as it changes shape!</span>")
magnification.dropItemToGround(src)
@@ -267,11 +267,12 @@
RegisterSignal(t, COMSIG_ATOM_ENTERED, .proc/proximity_trigger)
/obj/structure/biohazard_blob/structure/bulb/proc/proximity_trigger(datum/source, atom/movable/AM)
SIGNAL_HANDLER
if(!isliving(AM))
return
var/mob/living/L = AM
if(!(MOLD_FACTION in L.faction))
discharge()
INVOKE_ASYNC(src, .proc/discharge)
/obj/structure/biohazard_blob/structure/bulb/proc/make_full()
//Called by a timer, check if we exist
@@ -135,6 +135,7 @@ component_cell_out_of_charge/component_cell_removed proc using loc where necessa
/// Handling of cell removal.
/datum/component/cell/proc/remove_cell(datum/source, mob/user)
SIGNAL_HANDLER
if(!equipment.can_interact(user))
return
@@ -161,6 +162,7 @@ component_cell_out_of_charge/component_cell_removed proc using loc where necessa
/// Handling of cell insertion.
/datum/component/cell/proc/insert_cell(datum/source, obj/item/inserting_item, mob/living/user, params)
SIGNAL_HANDLER
if(!equipment.can_interact(user))
return
@@ -11,6 +11,7 @@ GLOBAL_VAR_INIT(combat_indicator_overlay, GenerateCombatOverlay())
var/nextcombatpopup = 0
/mob/living/proc/combat_indicator_unconscious_signal()
SIGNAL_HANDLER
set_combat_indicator(FALSE)
/mob/living/proc/set_combat_indicator(state)
@@ -15,6 +15,7 @@
UnregisterSignal(M,COMSIG_ENTER_AREA)
/datum/element/dusts_on_leaving_area/proc/check_dust(datum/source, area/A)
SIGNAL_HANDLER
var/mob/living/M = source
if(istype(M) && !(A.type in area_types))
M.dust(TRUE, force = TRUE)
@@ -76,13 +76,14 @@
addtimer(CALLBACK(src, .proc/LockOn), 7)
/datum/gunpoint/proc/MeleeAttackReact(datum/source_datum, atom/target)
SIGNAL_HANDLER
if(!CheckContinuity())
qdel(src)
return
if(!allow_use && CanReact())
source.log_message("[source] shot [target] because they attacked/disarmed/pulled", LOG_ATTACK)
to_chat(source, "<span class='warning'>You pull the trigger instinctively to [target.name] actions!</span>")
ShootTarget()
INVOKE_ASYNC(src, .proc/ShootTarget)
/datum/gunpoint/proc/LockOn()
if(src) //if we're not present then locking on failed and this datum is deleted
@@ -138,11 +139,13 @@
return ..()
/datum/gunpoint/proc/ClickDestroy()
SIGNAL_HANDLER
if(locked)
playsound(get_turf(source), 'modular_skyrat/modules/gunpoint/sound/targetoff.ogg', 50,1)
qdel(src)
/datum/gunpoint/proc/SourceCC(datum/source, amount, update, ignore)
SIGNAL_HANDLER
if(amount && !ignore)
qdel(src)
@@ -152,18 +155,20 @@
aimed_gun.afterattack(target, source)
/datum/gunpoint/proc/RadioReact(datum/datum_source, obj/item/radio/radio, message, channel, list/spans, datum/language/language, direct)
SIGNAL_HANDLER
if(!allow_radio && CanReact())
if(direct)
source.log_message("[source] shot [target] because they spoke on radio", LOG_ATTACK)
to_chat(source, "<span class='warning'>You pull the trigger instinctively as [target.name] speaks on the radio!</span>")
ShootTarget()
INVOKE_ASYNC(src, .proc/ShootTarget)
/datum/gunpoint/proc/MovedReact(datum/datum_source, atom/moved, direction, forced)
SIGNAL_HANDLER
if(!CheckContinuity())
qdel(src)
return
if(!allow_move && CanReact() && !(target.pulledby && target.pulledby == source)) //Don't shoot him if we're pulling them
MovedShootProc()
INVOKE_ASYNC(src, .proc/MovedShootProc)
/datum/gunpoint/proc/MovedShootProc() //This exists in case of someone moving several tiles in one tick, such as dashes or diagonal movement
moved_counter += 1
@@ -183,6 +188,7 @@
ShootTarget()
/datum/gunpoint/proc/SourceMoved(datum/datum_source)
SIGNAL_HANDLER
if(!CheckContinuity())
qdel(src)
@@ -411,6 +411,7 @@
AM.fire_act((T20C+50) + (50*fire_state), 125)
/obj/effect/abstract/liquid_turf/proc/mob_fall(datum/source, mob/M)
SIGNAL_HANDLER
var/turf/T = source
if(liquid_state >= LIQUID_STATE_ANKLES && T.has_gravity(T))
playsound(T, 'modular_skyrat/modules/liquids/sound/effects/splash.ogg', 50, 0)
@@ -423,7 +424,8 @@
tempr.trans_to(C, tempr.total_volume, methods = INGEST)
qdel(tempr)
C.adjustOxyLoss(5)
C.emote("cough")
//C.emote("cough")
INVOKE_ASYNC(C, /mob.proc/emote, "cough")
to_chat(C, "<span class='userdanger'>You fall in and swallow some water!</span>")
else
to_chat(M, "<span class='userdanger'>You fall in the water!</span>")
@@ -34,6 +34,7 @@
turf_loc.reasses_liquids()
/datum/element/liquids_height/proc/on_target_move(atom/movable/source, atom/OldLoc, Dir, Forced = FALSE)
SIGNAL_HANDLER
if(isturf(OldLoc))
var/turf/old_turf = OldLoc
old_turf.liquid_height += height_applied
@@ -176,6 +176,7 @@
*/
/datum/wound/blunt/proc/update_inefficiencies()
SIGNAL_HANDLER
if(limb.body_zone in list(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
if(limb.current_splint)
limp_slowdown = initial(limp_slowdown) * limb.current_splint.splint_factor
@@ -222,6 +223,7 @@
/// Getting smushed in an airlock/firelock is a last-ditch attempt to try relocating your limb
/datum/wound/blunt/moderate/proc/door_crush()
SIGNAL_HANDLER
if(prob(33))
victim.visible_message("<span class='danger'>[victim]'s dislocated [limb.name] pops back into place!</span>", "<span class='userdanger'>Your dislocated [limb.name] pops back into place! Ow!</span>")
remove_wound()
@@ -111,6 +111,7 @@
*/
/datum/wound/muscle/proc/update_inefficiencies()
SIGNAL_HANDLER
if(limb.body_zone in list(BODY_ZONE_L_LEG, BODY_ZONE_R_LEG))
if(limb.current_splint)
limp_slowdown = initial(limp_slowdown) * limb.current_splint.splint_factor
@@ -93,6 +93,7 @@ GLOBAL_LIST_EMPTY(mutant_infection_list) // A list of all mutant_infection organ
timer_id = addtimer(CALLBACK(src, .proc/transform_host), revive_time, TIMER_STOPPABLE)
/datum/component/mutant_infection/proc/cure_host()
SIGNAL_HANDLER
if(!host.stat == DEAD)
to_chat(host, "<span class='notice'>You start to feel refreshed and invigorated!</span>")
STOP_PROCESSING(SSobj, src)
@@ -124,6 +125,7 @@ GLOBAL_LIST_EMPTY(mutant_infection_list) // A list of all mutant_infection organ
RegisterSignal(parent, COMSIG_LIVING_DEATH, .proc/mutant_death)
/datum/component/mutant_infection/proc/mutant_death()
SIGNAL_HANDLER
var/revive_time = rand(REVIVE_TIME_LOWER, REVIVE_TIME_UPPER)
to_chat(host, "<span class='cultlarge'>You can feel your heart stopping, but something isn't right... \
life has not abandoned your broken form. You can only feel a deep and immutable hunger that \
@@ -1099,6 +1099,7 @@
src.user = user
/obj/item/borg_shapeshifter/proc/disrupt(mob/living/silicon/robot/user)
SIGNAL_HANDLER
if(active)
to_chat(user, "<span class='danger'>Your chameleon field deactivates.</span>")
deactivate(user)