From e0b3e861c011789da1282015dcf3e33ead211c39 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Fri, 22 Sep 2017 22:37:07 -0500 Subject: [PATCH] [MIRROR] Removes spawn()s in securitrons (#2901) * Removes spawn()s in securitrons (#30945) * Removes spawns in securitrons * Update sound.dm * Update secbot.dm * Removes spawn()s in securitrons --- code/game/sound.dm | 2 + .../mob/living/simple_animal/bot/secbot.dm | 40 +++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/code/game/sound.dm b/code/game/sound.dm index cf6d4707a7..13a3343e06 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -178,4 +178,6 @@ 'sound/vore/prey/death_10.ogg') if("bullet_miss") soundin = pick('sound/weapons/bulletflyby.ogg', 'sound/weapons/bulletflyby2.ogg', 'sound/weapons/bulletflyby3.ogg') + if("law") + soundin = pick('sound/voice/bgod.ogg', 'sound/voice/biamthelaw.ogg', 'sound/voice/bsecureday.ogg', 'sound/voice/bradio.ogg', 'sound/voice/binsult.ogg', 'sound/voice/bcreep.ogg') return soundin diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index 2c50c98816..772604a527 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -65,10 +65,9 @@ /mob/living/simple_animal/bot/secbot/Initialize() . = ..() icon_state = "secbot[on]" - spawn(3) - var/datum/job/detective/J = new/datum/job/detective - access_card.access += J.get_access() - prev_access = access_card.access + var/datum/job/detective/J = new/datum/job/detective + access_card.access += J.get_access() + prev_access = access_card.access //SECHUD var/datum/atom_hud/secsensor = GLOB.huds[DATA_HUD_SECURITY_ADVANCED] @@ -225,21 +224,25 @@ Auto Patrol: []"}, playsound(loc, 'sound/weapons/cablecuff.ogg', 30, 1, -2) C.visible_message("[src] is trying to put zipties on [C]!",\ "[src] is trying to put zipties on you!") - spawn(60) - if( !Adjacent(C) || !isturf(C.loc) ) //if he's in a closet or not adjacent, we cancel cuffing. - return - if(!C.handcuffed) - C.handcuffed = new /obj/item/restraints/handcuffs/cable/zipties/used(C) - C.update_handcuffed() - playsound(loc, pick('sound/voice/bgod.ogg', 'sound/voice/biamthelaw.ogg', 'sound/voice/bsecureday.ogg', 'sound/voice/bradio.ogg', 'sound/voice/binsult.ogg', 'sound/voice/bcreep.ogg'), 50, 0) - back_to_idle() + addtimer(CALLBACK(src, .proc/attempt_handcuff, C), 60) + +/mob/living/simple_animal/bot/secbot/proc/attempt_handcuff(mob/living/carbon/C) + if( !Adjacent(C) || !isturf(C.loc) ) //if he's in a closet or not adjacent, we cancel cuffing. + return + if(!C.handcuffed) + C.handcuffed = new /obj/item/restraints/handcuffs/cable/zipties/used(C) + C.update_handcuffed() + playsound(src, "law", 50, 0) + back_to_idle() + +/mob/living/simple_animal/bot/secbot/proc/update_onsprite() + icon_state = "secbot[on]" /mob/living/simple_animal/bot/secbot/proc/stun_attack(mob/living/carbon/C) var/judgement_criteria = judgement_criteria() playsound(loc, 'sound/weapons/egloves.ogg', 50, 1, -1) icon_state = "secbot-c" - spawn(2) - icon_state = "secbot[on]" + addtimer(CALLBACK(src, .proc/update_onsprite), 2) var/threat = 5 if(ishuman(C)) C.stuttering = 5 @@ -352,15 +355,13 @@ Auto Patrol: []"}, target = null last_found = world.time frustration = 0 - spawn(0) - handle_automated_action() //ensure bot quickly responds + INVOKE_ASYNC(src, .proc/handle_automated_action) /mob/living/simple_animal/bot/secbot/proc/back_to_hunt() anchored = FALSE frustration = 0 mode = BOT_HUNT - spawn(0) - handle_automated_action() //ensure bot quickly responds + INVOKE_ASYNC(src, .proc/handle_automated_action) // look for a criminal in view of the bot /mob/living/simple_animal/bot/secbot/proc/look_for_perp() @@ -385,8 +386,7 @@ Auto Patrol: []"}, playsound(loc, pick('sound/voice/bcriminal.ogg', 'sound/voice/bjustice.ogg', 'sound/voice/bfreeze.ogg'), 50, 0) visible_message("[src] points at [C.name]!") mode = BOT_HUNT - spawn(0) - handle_automated_action() // ensure bot quickly responds to a perp + INVOKE_ASYNC(src, .proc/handle_automated_action) break else continue