From cd3b25bd24cc282c913ff5c8ed185d7794803a21 Mon Sep 17 00:00:00 2001 From: Citinited Date: Sat, 11 May 2019 18:15:13 +0100 Subject: [PATCH 1/4] Boo affects APCs again Also reworks the boo code --- code/game/atoms.dm | 5 ++- code/game/machinery/status_display.dm | 6 ++++ code/game/turfs/turf.dm | 4 +++ code/modules/mob/dead/observer/spells.dm | 32 +++---------------- code/modules/mob/living/carbon/human/human.dm | 3 ++ code/modules/power/apc.dm | 26 +++++++-------- code/modules/power/lighting.dm | 3 ++ 7 files changed, 37 insertions(+), 42 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 0a1aa19bcf7..9c292e42fa6 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -333,6 +333,9 @@ if(AM && isturf(AM.loc)) step(AM, turn(AM.dir, 180)) +/atom/proc/get_spooked() + return + /atom/proc/add_hiddenprint(mob/living/M as mob) if(isnull(M)) return if(isnull(M.key)) return @@ -651,7 +654,7 @@ var/list/blood_splatter_icons = list() if(V.type == type) V.reagents.add_reagent(vomit_reagent, 5) return - + var/obj/effect/decal/cleanable/vomit/this = new type(src) // Make toxins vomit look different diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 05545e6a3d1..642676c6eff 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -78,6 +78,9 @@ set_picture("ai_bsod") ..(severity) +/obj/machinery/status_display/get_spooked() + spookymode = TRUE + // set what is displayed /obj/machinery/status_display/proc/update() if(friendc && !ignore_friendc) @@ -227,6 +230,9 @@ set_picture("ai_bsod") ..(severity) +/obj/machinery/ai_status_display/get_spooked() + spookymode = TRUE + /obj/machinery/ai_status_display/proc/update() if(mode==0) //Blank overlays.Cut() diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 677357cf170..828c266c145 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -282,6 +282,10 @@ /turf/proc/Bless() flags |= NOJAUNT +/turf/get_spooked() + for(var/atom/movable/AM in contents) + AM.get_spooked() + /turf/proc/burn_down() return diff --git a/code/modules/mob/dead/observer/spells.dm b/code/modules/mob/dead/observer/spells.dm index 620c1854e73..523e27c0621 100644 --- a/code/modules/mob/dead/observer/spells.dm +++ b/code/modules/mob/dead/observer/spells.dm @@ -1,6 +1,4 @@ - - -var/global/list/boo_phrases=list( +GLOBAL_LIST_INIT(boo_phrases, list( "You feel a chill run down your spine.", "You think you see a figure in your peripheral vision.", "What was that?", @@ -9,13 +7,13 @@ var/global/list/boo_phrases=list( "Something doesn't feel right...", "You feel a presence in the room.", "It feels like someone's standing behind you.", -) +)) /obj/effect/proc_holder/spell/aoe_turf/boo name = "Boo!" desc = "Fuck with the living." - ghost = 1 + ghost = TRUE school = "transmutation" charge_max = 600 @@ -27,26 +25,4 @@ var/global/list/boo_phrases=list( /obj/effect/proc_holder/spell/aoe_turf/boo/cast(list/targets, mob/user = usr) for(var/turf/T in targets) - for(var/atom/A in T.contents) - - // Bug humans - if(ishuman(A)) - var/mob/living/carbon/human/H = A - if(H && H.client) - to_chat(H, "[pick(boo_phrases)]") - - // Flicker unblessed lights in range - if(istype(A,/obj/machinery/light)) - var/obj/machinery/light/L = A - if(L) - L.flicker() - - // OH GOD BLUE APC (single animation cycle) - if(istype(A, /obj/machinery/power/apc)) - A:spookify() - - if(istype(A, /obj/machinery/status_display)) - A:spookymode=1 - - if(istype(A, /obj/machinery/ai_status_display)) - A:spookymode=1 \ No newline at end of file + T.get_spooked() diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index bd5817e8867..54ef65766e9 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1987,6 +1987,9 @@ Eyes need to have significantly high darksight to shine unless the mob has the X genemutcheck(src, block, null, MUTCHK_FORCED) dna.UpdateSE() +/mob/living/carbon/human/get_spooked() + to_chat(src, "[pick(GLOB.boo_phrases)]") + /mob/living/carbon/human/extinguish_light() // Parent function handles stuff the human may be holding ..() diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index c7adce7f533..f240a67df52 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -50,7 +50,6 @@ use_power = NO_POWER_USE req_access = list(access_engine_equip) siemens_strength = 1 - var/spooky=0 var/area/area var/areastring = null var/obj/item/stock_parts/cell/cell @@ -251,9 +250,9 @@ // update the APC icon to show the three base states // also add overlays for indicator lights -/obj/machinery/power/apc/update_icon() +/obj/machinery/power/apc/update_icon(force_update = FALSE) - if(!status_overlays) + if(!status_overlays || force_update) status_overlays = 1 status_overlays_lock = new status_overlays_charging = new @@ -294,10 +293,10 @@ var/update = check_updates() //returns 0 if no need to update icons. // 1 if we need to update the icon_state // 2 if we need to update the overlays - if(!update) + if(!update && !force_update) return - if(update & 1) // Updating the icon state + if(force_update || update & 1) // Updating the icon state if(update_state & UPSTATE_ALLGOOD) icon_state = "apc0" else if(update_state & (UPSTATE_OPENED1|UPSTATE_OPENED2)) @@ -325,7 +324,7 @@ - if(update & 2) + if(force_update || update & 2) if(overlays.len) overlays.len = 0 @@ -415,13 +414,14 @@ update_icon() updating_icon = 0 -/obj/machinery/power/apc/proc/spookify() - if(spooky) return // Fuck you we're already spooky - spooky=1 - update_icon() - spawn(10) - spooky=0 - update_icon() +/obj/machinery/power/apc/get_spooked() + if(opened || wiresexposed) + return + if(stat & (NOPOWER | BROKEN)) + return + addtimer(CALLBACK(src, .proc/update_icon, TRUE), 10) + overlays.Cut() + flick("apcemag", src) //attack with an item - open/close cover, insert cell, or (un)lock interface diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm index a0bee89e0be..b186e862f01 100644 --- a/code/modules/power/lighting.dm +++ b/code/modules/power/lighting.dm @@ -232,6 +232,9 @@ on = FALSE return +/obj/machinery/light/get_spooked() + flicker() + // update the icon_state and luminosity of the light depending on its state /obj/machinery/light/proc/update(var/trigger = TRUE) switch(status) From 86d5b4b070b23f1bcfcfed44ce5a7bf7bdfc56d5 Mon Sep 17 00:00:00 2001 From: Citinited Date: Sat, 11 May 2019 23:32:32 +0100 Subject: [PATCH 2/4] Handles APC spoopiness differently --- code/modules/power/apc.dm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index f240a67df52..1733d54abb0 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -414,15 +414,17 @@ update_icon() updating_icon = 0 -/obj/machinery/power/apc/get_spooked() +/obj/machinery/power/apc/get_spooked(second_pass = FALSE) if(opened || wiresexposed) return if(stat & (NOPOWER | BROKEN)) return - addtimer(CALLBACK(src, .proc/update_icon, TRUE), 10) - overlays.Cut() - flick("apcemag", src) - + if(!second_pass) //The first time, we just cut overlays + addtimer(CALLBACK(src, .get_spooked, TRUE), 1) + cut_overlays() + else + flick("apcemag", src) //Second time we cause the APC to update its icon, then add a timer to update icon later + addtimer(CALLBACK(src, .proc/update_icon, TRUE), 10) //attack with an item - open/close cover, insert cell, or (un)lock interface /obj/machinery/power/apc/attackby(obj/item/W, mob/living/user, params) From da51a3315ce7f5c242f0ae56ecf9a1caeec9d400 Mon Sep 17 00:00:00 2001 From: Citinited Date: Sat, 18 May 2019 13:02:06 +0100 Subject: [PATCH 3/4] Fix for infinite boo --- code/datums/spell.dm | 19 +++++++++++++------ code/modules/mob/dead/observer/spells.dm | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/code/datums/spell.dm b/code/datums/spell.dm index 813604a1431..33c84d2eba3 100644 --- a/code/datums/spell.dm +++ b/code/datums/spell.dm @@ -62,6 +62,7 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin var/charge_type = "recharge" //can be recharge or charges, see charge_max and charge_counter descriptions; can also be based on the holder's vars now, use "holder_var" for that var/charge_max = 100 //recharge time in deciseconds if charge_type = "recharge" or starting charges if charge_type = "charges" + var/starts_charged = TRUE //Does this spell start ready to go? var/charge_counter = 0 //can only cast spells if it equals recharge, ++ each decisecond if charge_type = "recharge" or -- each cast if charge_type = "charges" var/still_recharging_msg = "The spell is still recharging." @@ -193,9 +194,11 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin /obj/effect/proc_holder/spell/New() ..() action = new(src) - still_recharging_msg = "[name] is still recharging." - charge_counter = charge_max + if(starts_charged) + charge_counter = charge_max + else + start_recharge() /obj/effect/proc_holder/spell/Destroy() QDEL_NULL(action) @@ -212,10 +215,14 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin /obj/effect/proc_holder/spell/proc/start_recharge() if(action) action.UpdateButtonIcon() - while(charge_counter < charge_max) - sleep(1) - charge_counter++ - if(action) + addtimer(CALLBACK(src, .add_charge), 10) + +/obj/effect/proc_holder/spell/proc/add_charge() + charge_counter += 10 + if(charge_counter < charge_max) //Needs to charge some more + addtimer(CALLBACK(src, .add_charge), 10) + return + if(action) //We got this far, it's charged action.UpdateButtonIcon() /obj/effect/proc_holder/spell/proc/perform(list/targets, recharge = 1, mob/user = usr) //if recharge is started is important for the trigger spells diff --git a/code/modules/mob/dead/observer/spells.dm b/code/modules/mob/dead/observer/spells.dm index 523e27c0621..916ff9aa9b8 100644 --- a/code/modules/mob/dead/observer/spells.dm +++ b/code/modules/mob/dead/observer/spells.dm @@ -17,6 +17,7 @@ GLOBAL_LIST_INIT(boo_phrases, list( school = "transmutation" charge_max = 600 + starts_charged = FALSE clothes_req = 0 stat_allowed = 1 invocation = "" From d36cb324a00abce3e4414531ed9274321a65a074 Mon Sep 17 00:00:00 2001 From: Citinited Date: Sun, 19 May 2019 18:52:01 +0100 Subject: [PATCH 4/4] Spells now charge using the fast processing subsystem --- code/datums/spell.dm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/code/datums/spell.dm b/code/datums/spell.dm index 33c84d2eba3..c4ad1d54c4d 100644 --- a/code/datums/spell.dm +++ b/code/datums/spell.dm @@ -215,14 +215,15 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin /obj/effect/proc_holder/spell/proc/start_recharge() if(action) action.UpdateButtonIcon() - addtimer(CALLBACK(src, .add_charge), 10) + START_PROCESSING(SSfastprocess, src) -/obj/effect/proc_holder/spell/proc/add_charge() - charge_counter += 10 - if(charge_counter < charge_max) //Needs to charge some more - addtimer(CALLBACK(src, .add_charge), 10) +/obj/effect/proc_holder/spell/process() + charge_counter += 2 + if(charge_counter < charge_max) return - if(action) //We got this far, it's charged + STOP_PROCESSING(SSfastprocess, src) + charge_counter = charge_max + if(action) action.UpdateButtonIcon() /obj/effect/proc_holder/spell/proc/perform(list/targets, recharge = 1, mob/user = usr) //if recharge is started is important for the trigger spells