[MIRROR] Fixes some potential sleeps as detected by SpacemanDMM improvements (#1216)

* Fix some potential sleeps as detected by SpacemanDMM improvements (#54230)

overrides weren't detected by should not sleep, i think i've mostly
fixed that with SpaceManiac/SpacemanDMM#214

Some of these are wacky but overall this pr is harmless

signals shouldnt sleep even in weird 1 in a million situations or due
to other people adding bad code

overrides of changeling can_sting() use alert() and input() and that's
just too fucked for me to fix in this pr

* Fixes some potential sleeps as detected by SpacemanDMM improvements

Co-authored-by: spookydonut <github@spooksoftware.com>
This commit is contained in:
SkyratBot
2020-10-09 18:28:59 +02:00
committed by GitHub
co-authored by spookydonut
parent a76adbfbb6
commit 7eeaefe645
28 changed files with 111 additions and 95 deletions
+1 -1
View File
@@ -91,7 +91,7 @@
owner.vomit()
fail = TRUE
if(2)
owner.emote("cough")
INVOKE_ASYNC(owner, /mob.proc/emote, "cough")
owner.dizziness += 10
fail = TRUE
if(3)
@@ -5,19 +5,23 @@
var/list/obj/item/storage/backpack/holding/matching = typecache_filter_list(W.GetAllContents(), typecacheof(/obj/item/storage/backpack/holding))
matching -= A
if(istype(W, /obj/item/storage/backpack/holding) || matching.len)
var/safety = alert(user, "Doing this will have extremely dire consequences for the station and its crew. Be sure you know what you're doing.", "Put in [A.name]?", "Proceed", "Abort")
if(safety != "Proceed" || QDELETED(A) || QDELETED(W) || QDELETED(user) || !user.canUseTopic(A, BE_CLOSE, iscarbon(user)))
return
var/turf/loccheck = get_turf(A)
to_chat(user, "<span class='danger'>The Bluespace interfaces of the two devices catastrophically malfunction!</span>")
qdel(W)
playsound(loccheck,'sound/effects/supermatter.ogg', 200, TRUE)
message_admins("[ADMIN_LOOKUPFLW(user)] detonated a bag of holding at [ADMIN_VERBOSEJMP(loccheck)].")
log_game("[key_name(user)] detonated a bag of holding at [loc_name(loccheck)].")
user.gib(TRUE, TRUE, TRUE)
new/obj/singularity/boh_tear(loccheck)
qdel(A)
INVOKE_ASYNC(src, .proc/recursive_insertion, W, user)
return
. = ..()
/datum/component/storage/concrete/bluespace/bag_of_holding/proc/recursive_insertion(obj/item/W, mob/living/user)
var/atom/A = parent
var/safety = alert(user, "Doing this will have extremely dire consequences for the station and its crew. Be sure you know what you're doing.", "Put in [A.name]?", "Proceed", "Abort")
if(safety != "Proceed" || QDELETED(A) || QDELETED(W) || QDELETED(user) || !user.canUseTopic(A, BE_CLOSE, iscarbon(user)))
return
var/turf/loccheck = get_turf(A)
to_chat(user, "<span class='danger'>The Bluespace interfaces of the two devices catastrophically malfunction!</span>")
qdel(W)
playsound(loccheck,'sound/effects/supermatter.ogg', 200, TRUE)
message_admins("[ADMIN_LOOKUPFLW(user)] detonated a bag of holding at [ADMIN_VERBOSEJMP(loccheck)].")
log_game("[key_name(user)] detonated a bag of holding at [loc_name(loccheck)].")
user.gib(TRUE, TRUE, TRUE)
new/obj/singularity/boh_tear(loccheck)
qdel(A)
+1 -1
View File
@@ -32,4 +32,4 @@
/datum/mutation/human/telekinesis/proc/on_ranged_attack(datum/source, atom/target)
SIGNAL_HANDLER
target.attack_tk(owner)
INVOKE_ASYNC(target, /atom.proc/attack_tk, owner)
+24 -18
View File
@@ -1,3 +1,8 @@
#define AI_WIRE_NORMAL 0
#define AI_WIRE_DISABLED 1
#define AI_WIRE_HACKED 2
#define AI_WIRE_DISABLED_HACKED -1
/datum/wires/airlock
holder_type = /obj/machinery/door/airlock
proper_name = "Generic Airlock"
@@ -108,16 +113,11 @@
A.emergency = FALSE
A.update_icon()
if(WIRE_AI) // Pulse to disable WIRE_AI control for 10 ticks (follows same rules as cutting).
if(A.aiControlDisabled == 0)
A.aiControlDisabled = 1
else if(A.aiControlDisabled == -1)
A.aiControlDisabled = 2
sleep(10)
if(A)
if(A.aiControlDisabled == 1)
A.aiControlDisabled = 0
else if(A.aiControlDisabled == 2)
A.aiControlDisabled = -1
if(A.aiControlDisabled == AI_WIRE_NORMAL)
A.aiControlDisabled = AI_WIRE_DISABLED
else if(A.aiControlDisabled == AI_WIRE_DISABLED_HACKED)
A.aiControlDisabled = AI_WIRE_HACKED
addtimer(CALLBACK(A, /obj/machinery/door/airlock.proc/reset_ai_wire), 1 SECONDS)
if(WIRE_SHOCK) // Pulse to shock the door for 10 ticks.
if(!A.secondsElectrified)
A.set_electrified(MACHINE_DEFAULT_ELECTRIFY_TIME, usr)
@@ -132,6 +132,12 @@
A.lights = !A.lights
A.update_icon()
/obj/machinery/door/airlock/proc/reset_ai_wire()
if(aiControlDisabled == AI_WIRE_DISABLED)
aiControlDisabled = AI_WIRE_NORMAL
else if(aiControlDisabled == AI_WIRE_HACKED)
aiControlDisabled = AI_WIRE_DISABLED_HACKED
/datum/wires/airlock/on_cut(wire, mend)
var/obj/machinery/door/airlock/A = holder
switch(wire)
@@ -154,15 +160,15 @@
A.bolt()
if(WIRE_AI) // Cut to disable WIRE_AI control, mend to re-enable.
if(mend)
if(A.aiControlDisabled == 1) // 0 = normal, 1 = locked out, 2 = overridden by WIRE_AI, -1 = previously overridden by WIRE_AI
A.aiControlDisabled = 0
else if(A.aiControlDisabled == 2)
A.aiControlDisabled = -1
if(A.aiControlDisabled == AI_WIRE_DISABLED) // 0 = normal, 1 = locked out, 2 = overridden by WIRE_AI, -1 = previously overridden by WIRE_AI
A.aiControlDisabled = AI_WIRE_NORMAL
else if(A.aiControlDisabled == AI_WIRE_HACKED)
A.aiControlDisabled = AI_WIRE_DISABLED_HACKED
else
if(A.aiControlDisabled == 0)
A.aiControlDisabled = 1
else if(A.aiControlDisabled == -1)
A.aiControlDisabled = 2
if(A.aiControlDisabled == AI_WIRE_NORMAL)
A.aiControlDisabled = AI_WIRE_DISABLED
else if(A.aiControlDisabled == AI_WIRE_DISABLED_HACKED)
A.aiControlDisabled = AI_WIRE_HACKED
if(WIRE_SHOCK) // Cut to shock the door, mend to unshock.
if(mend)
if(A.secondsElectrified)
+1 -1
View File
@@ -97,7 +97,7 @@
else
victim.visible_message("<span class='danger'>[victim] weakly strikes [target] with [victim.p_their()] broken [limb.name], recoiling from pain!</span>", \
"<span class='userdanger'>You fail to strike [target] as the fracture in your [limb.name] lights up in unbearable pain!</span>", vision_distance=COMBAT_MESSAGE_RANGE)
victim.emote("scream")
INVOKE_ASYNC(victim, /mob.proc/emote, "scream")
victim.Stun(0.5 SECONDS)
limb.receive_damage(brute=rand(3,7))
return COMPONENT_NO_ATTACK_HAND