From 8c26ed816d304c70caa736d18ef2a8dfd86ad9ab Mon Sep 17 00:00:00 2001 From: Cameron Lennox Date: Sat, 15 Feb 2025 01:55:47 -0500 Subject: [PATCH] fixes constructs (#17146) - gets rid of sleeps - makes it so their spells show --- code/game/gamemodes/cult/construct_spells.dm | 53 ++++++++++--------- .../subtypes/occult/constructs/_construct.dm | 4 +- code/modules/spells/spells.dm | 2 +- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/code/game/gamemodes/cult/construct_spells.dm b/code/game/gamemodes/cult/construct_spells.dm index 5a2168fa53..e65b3e0707 100644 --- a/code/game/gamemodes/cult/construct_spells.dm +++ b/code/game/gamemodes/cult/construct_spells.dm @@ -46,8 +46,7 @@ /spell/aoe_turf/conjure/floor/conjure_animation(var/atom/movable/overlay/animation, var/turf/target) animation.icon_state = "cultfloor" flick("cultfloor",animation) - spawn(10) - qdel(animation) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), animation), 1 SECOND) /spell/aoe_turf/conjure/wall name = "Lesser Construction" @@ -65,8 +64,7 @@ /spell/aoe_turf/conjure/wall/conjure_animation(var/atom/movable/overlay/animation, var/turf/target) animation.icon_state = "cultwall" flick("cultwall",animation) - spawn(10) - qdel(animation) + addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(qdel), animation), 1 SECOND) /spell/aoe_turf/conjure/wall/reinforced name = "Greater Construction" @@ -194,15 +192,14 @@ return */ for(var/turf/T in targets) for(var/obj/machinery/door/door in T.contents) - spawn(1) - if(istype(door,/obj/machinery/door/airlock)) - var/obj/machinery/door/airlock/AL = door - AL.locked = 0 //The spirits of the damned care not for your locks. - AL.welded = 0 //Or your welding tools. - else if(istype(door, /obj/machinery/door/firedoor)) - var/obj/machinery/door/firedoor/FD = door - FD.blocked = 0 - door.open(1) + if(istype(door,/obj/machinery/door/airlock)) + var/obj/machinery/door/airlock/AL = door + AL.locked = 0 //The spirits of the damned care not for your locks. + AL.welded = 0 //Or your welding tools. + else if(istype(door, /obj/machinery/door/firedoor)) + var/obj/machinery/door/firedoor/FD = door + FD.blocked = 0 + door.open(1) return /* @@ -523,19 +520,23 @@ return P /obj/item/spell/construct/projectile/proc/set_up(atom/hit_atom, mob/living/user) - if(spell_projectile) - if(pay_energy(energy_cost_per_shot)) - if(pre_shot_delay) - var/image/target_image = image(icon = 'icons/obj/spells.dmi', loc = get_turf(hit_atom), icon_state = "target") - user << target_image - user.Stun(pre_shot_delay / 10) - sleep(pre_shot_delay) - qdel(target_image) - if(owner) - return TRUE - return FALSE // We got dropped before the firing occured. - return TRUE // No delay, no need to check. - return FALSE + if(!spell_projectile || !pay_energy(energy_cost_per_shot) || !owner) + return FALSE + if(!pre_shot_delay) + return TRUE + var/succeeded = FALSE + + var/turf/T = get_turf(hit_atom) + var/image/target_image = image(icon = 'icons/obj/spells.dmi', icon_state = "target") + + T.add_overlay(target_image) + + if(do_after(user, pre_shot_delay)) + succeeded = TRUE + + T.cut_overlay(target_image) + qdel(target_image) + return succeeded /obj/item/spell/construct/spawner name = "spawner template" diff --git a/code/modules/mob/living/simple_mob/subtypes/occult/constructs/_construct.dm b/code/modules/mob/living/simple_mob/subtypes/occult/constructs/_construct.dm index d62100fd76..58465be41d 100644 --- a/code/modules/mob/living/simple_mob/subtypes/occult/constructs/_construct.dm +++ b/code/modules/mob/living/simple_mob/subtypes/occult/constructs/_construct.dm @@ -97,8 +97,8 @@ /mob/living/simple_mob/construct/cultify() return -/mob/living/simple_mob/construct/New() - ..() +/mob/living/simple_mob/construct/Initialize(mapload) + . = ..() name = text("[initial(name)] ([rand(1, 1000)])") real_name = name for(var/spell in construct_spells) diff --git a/code/modules/spells/spells.dm b/code/modules/spells/spells.dm index eba1e7055f..e4be409667 100644 --- a/code/modules/spells/spells.dm +++ b/code/modules/spells/spells.dm @@ -11,7 +11,7 @@ ..() if(spell_masters) for(var/obj/screen/movable/spell_master/spell_master in spell_masters) - spell_master.toggle_open(1) + spell_master.toggle_open() client.screen -= spell_master // TODO: Investigate if this matters