From edeba9232646827ec1b747220d7d78f073424063 Mon Sep 17 00:00:00 2001 From: S34N <12197162+S34NW@users.noreply.github.com> Date: Sat, 15 Oct 2022 17:05:55 +0100 Subject: [PATCH] Smoke spells readability (#19387) * read the smoke * oops * contra * contra * more tidying * last one * Update code/modules/projectiles/projectile/magic.dm Co-authored-by: Farie82 Co-authored-by: Farie82 --- code/__DEFINES/spell.dm | 5 +++ code/datums/spell.dm | 32 +++++++++---------- code/datums/spells/banana_touch.dm | 2 +- code/datums/spells/construct_spells.dm | 2 +- code/datums/spells/mime_malaise.dm | 2 +- code/datums/spells/rathens.dm | 2 +- code/datums/spells/wizard.dm | 6 ++-- code/game/gamemodes/wizard/godhand.dm | 2 +- code/game/mecha/mecha.dm | 2 +- .../effects/effect_system/effect_system.dm | 13 +++----- .../effect_system/effects_explosion.dm | 2 +- .../effects/effect_system/effects_smoke.dm | 19 ++++------- code/game/objects/effects/step_triggers.dm | 4 +-- .../objects/items/weapons/alien_specific.dm | 2 +- code/game/objects/items/weapons/dice.dm | 2 +- code/game/objects/items/weapons/explosives.dm | 2 +- .../items/weapons/grenades/smokebomb.dm | 2 +- code/game/objects/items/weapons/scrolls.dm | 2 +- .../objects/items/weapons/tanks/watertank.dm | 2 +- .../machinery/pipes/simple/pipe_simple.dm | 2 +- .../kitchen_machinery/cooker.dm | 2 +- .../combos/mimejutsu/smokebomb.dm | 2 +- .../mining/lavaland/loot/tendril_loot.dm | 4 +-- .../living/simple_animal/hostile/hellhound.dm | 2 +- .../living/simple_animal/hostile/hivebot.dm | 2 +- .../hostile/mining/elites/legionnaire.dm | 2 +- code/modules/power/apc.dm | 2 +- code/modules/power/smes.dm | 4 +-- code/modules/projectiles/guns/magic/wand.dm | 2 +- code/modules/projectiles/projectile/magic.dm | 2 +- .../reagents/chemistry/reagents/misc.dm | 2 +- code/modules/research/experimentor.dm | 6 ++-- code/modules/station_goals/bsa.dm | 2 +- 33 files changed, 68 insertions(+), 73 deletions(-) diff --git a/code/__DEFINES/spell.dm b/code/__DEFINES/spell.dm index 6babcaad31a..e23568a6103 100644 --- a/code/__DEFINES/spell.dm +++ b/code/__DEFINES/spell.dm @@ -3,3 +3,8 @@ #define SPELL_SELECTION_RANGE "range" #define SPELL_SELECTION_VIEW "view" + +#define SMOKE_NONE 0 +#define SMOKE_HARMLESS 1 +#define SMOKE_COUGHING 2 +#define SMOKE_SLEEPING 3 diff --git a/code/datums/spell.dm b/code/datums/spell.dm index 2cc2e979dbc..83ed53ca3f9 100644 --- a/code/datums/spell.dm +++ b/code/datums/spell.dm @@ -108,9 +108,11 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) var/overlay_lifespan = 0 var/sparks_spread = FALSE - var/sparks_amt = 0 //cropped at 10 - var/smoke_spread = 0 //1 - harmless, 2 - harmful - var/smoke_amt = 0 //cropped at 10 + var/sparks_amt = 0 + + ///Determines if the spell has smoke, and if so what effect the smoke has. See spell defines. + var/smoke_type = SMOKE_NONE + var/smoke_amt = 0 var/critfailchance = 0 var/centcom_cancast = TRUE //Whether or not the spell should be allowed on the admin zlevel @@ -401,19 +403,17 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) to_chat(target, text("[message]")) if(sparks_spread) do_sparks(sparks_amt, 0, location) - if(smoke_spread) - if(smoke_spread == 1) - var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(smoke_amt, 0, location) //no idea what the 0 is - smoke.start() - else if(smoke_spread == 2) - var/datum/effect_system/smoke_spread/bad/smoke = new - smoke.set_up(smoke_amt, 0, location) //no idea what the 0 is - smoke.start() - else if(smoke_spread == 3) - var/datum/effect_system/smoke_spread/sleeping/smoke = new - smoke.set_up(smoke_amt, 0, location) // same here - smoke.start() + if(smoke_type) + var/datum/effect_system/smoke_spread/smoke + switch(smoke_type) + if(SMOKE_HARMLESS) + smoke = new /datum/effect_system/smoke_spread() + if(SMOKE_COUGHING) + smoke = new /datum/effect_system/smoke_spread/bad() + if(SMOKE_SLEEPING) + smoke = new /datum/effect_system/smoke_spread/sleeping() + smoke.set_up(smoke_amt, FALSE, location) + smoke.start() custom_handler?.after_cast(targets, user, src) diff --git a/code/datums/spells/banana_touch.dm b/code/datums/spells/banana_touch.dm index fdfc432eab3..61466ef5711 100644 --- a/code/datums/spells/banana_touch.dm +++ b/code/datums/spells/banana_touch.dm @@ -24,7 +24,7 @@ return var/datum/effect_system/smoke_spread/s = new - s.set_up(5, 0, target) + s.set_up(5, FALSE, target) s.start() to_chat(user, "HONK") diff --git a/code/datums/spells/construct_spells.dm b/code/datums/spells/construct_spells.dm index 0c4707faf53..176e07bb5a7 100644 --- a/code/datums/spells/construct_spells.dm +++ b/code/datums/spells/construct_spells.dm @@ -172,5 +172,5 @@ holy_area_cancast = FALSE //Stops cult magic from working on holy ground eg: chapel cooldown_min = 20 //25 deciseconds reduction per rank - smoke_spread = 3 + smoke_type = SMOKE_SLEEPING smoke_amt = 10 diff --git a/code/datums/spells/mime_malaise.dm b/code/datums/spells/mime_malaise.dm index 762039dddf7..f7e7646d961 100644 --- a/code/datums/spells/mime_malaise.dm +++ b/code/datums/spells/mime_malaise.dm @@ -24,7 +24,7 @@ return var/datum/effect_system/smoke_spread/s = new - s.set_up(5, 0, target) + s.set_up(5, FALSE, target) s.start() var/mob/living/carbon/human/H = target diff --git a/code/datums/spells/rathens.dm b/code/datums/spells/rathens.dm index 1d5f2c617cb..c55496743d1 100644 --- a/code/datums/spells/rathens.dm +++ b/code/datums/spells/rathens.dm @@ -16,7 +16,7 @@ /obj/effect/proc_holder/spell/rathens/cast(list/targets, mob/user = usr) for(var/mob/living/carbon/human/H in targets) var/datum/effect_system/smoke_spread/s = new - s.set_up(5, 0, H) + s.set_up(5, FALSE, H) s.start() var/obj/item/organ/internal/appendix/A = H.get_int_organ(/obj/item/organ/internal/appendix) if(A) diff --git a/code/datums/spells/wizard.dm b/code/datums/spells/wizard.dm index d507300032d..f3f28d75176 100644 --- a/code/datums/spells/wizard.dm +++ b/code/datums/spells/wizard.dm @@ -120,7 +120,7 @@ invocation_type = "none" cooldown_min = 20 //25 deciseconds reduction per rank - smoke_spread = 2 + smoke_type = SMOKE_COUGHING smoke_amt = 10 action_icon_state = "smoke" @@ -154,7 +154,7 @@ cooldown_min = 5 //4 deciseconds reduction per rank - smoke_spread = 1 + smoke_type = SMOKE_HARMLESS smoke_amt = 1 inner_tele_radius = 0 @@ -181,7 +181,7 @@ invocation_type = "shout" cooldown_min = 200 //100 deciseconds reduction per rank - smoke_spread = 1 + smoke_type = SMOKE_HARMLESS smoke_amt = 5 action_icon_state = "spell_teleport" diff --git a/code/game/gamemodes/wizard/godhand.dm b/code/game/gamemodes/wizard/godhand.dm index 976955b3410..162bf060cff 100644 --- a/code/game/gamemodes/wizard/godhand.dm +++ b/code/game/gamemodes/wizard/godhand.dm @@ -101,7 +101,7 @@ return var/datum/effect_system/smoke_spread/s = new - s.set_up(5, 0, target) + s.set_up(5, FALSE, target) s.start() var/mob/living/carbon/human/H = target diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index ab850bf4a42..2b04a3c8a5b 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -108,7 +108,7 @@ add_airtank() spark_system.set_up(2, 0, src) spark_system.attach(src) - smoke_system.set_up(3, src) + smoke_system.set_up(3, FALSE, src) smoke_system.attach(src) add_cell() START_PROCESSING(SSobj, src) diff --git a/code/game/objects/effects/effect_system/effect_system.dm b/code/game/objects/effects/effect_system/effect_system.dm index 6fb2a502272..885587b529f 100644 --- a/code/game/objects/effects/effect_system/effect_system.dm +++ b/code/game/objects/effects/effect_system/effect_system.dm @@ -34,15 +34,10 @@ would spawn and follow the beaker, even if it is carried or thrown. location = null return ..() -/datum/effect_system/proc/set_up(n = 3, c = 0, loca) - if(n > 10) - n = 10 - number = n - cardinals = c - if(isturf(loca)) - location = loca - else - location = get_turf(loca) +/datum/effect_system/proc/set_up(amount = 3, only_cardinals = FALSE, source) + number = clamp(amount, amount, 10) + cardinals = only_cardinals + location = get_turf(source) /datum/effect_system/proc/attach(atom/atom) holder = atom diff --git a/code/game/objects/effects/effect_system/effects_explosion.dm b/code/game/objects/effects/effect_system/effects_explosion.dm index 02f33b79d2d..e6e1d12a0e6 100644 --- a/code/game/objects/effects/effect_system/effects_explosion.dm +++ b/code/game/objects/effects/effect_system/effects_explosion.dm @@ -51,7 +51,7 @@ /datum/effect_system/explosion/smoke/proc/create_smoke() var/datum/effect_system/smoke_spread/S = new - S.set_up(5,0,location,null) + S.set_up(5, FALSE, location, null) S.start() /datum/effect_system/explosion/smoke/start() diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm index 4b9c7fb573a..04eba273ac2 100644 --- a/code/game/objects/effects/effect_system/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/effects_smoke.dm @@ -78,17 +78,12 @@ effect_type = /obj/effect/particle_effect/smoke var/direction -/datum/effect_system/smoke_spread/set_up(n = 5, c = 0, loca, direct) - if(n > 20) - n = 20 - number = n - cardinals = c - if(isturf(loca)) - location = loca - else - location = get_turf(loca) - if(direct) - direction = direct +/datum/effect_system/smoke_spread/set_up(amount = 5, only_cardinals = FALSE, source, desired_direction) + number = clamp(amount, amount, 20) + cardinals = only_cardinals + location = get_turf(source) + if(desired_direction) + direction = desired_direction /datum/effect_system/smoke_spread/start() for(var/i=0, i\The [src] bursts!") playsound(src.loc, 'sound/effects/bang.ogg', 25, 1) var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(1,0, src.loc, 0) + smoke.set_up(1, FALSE, loc) smoke.start() qdel(src) diff --git a/code/modules/food_and_drinks/kitchen_machinery/cooker.dm b/code/modules/food_and_drinks/kitchen_machinery/cooker.dm index fca8dc7183a..6cf7130fdad 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/cooker.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/cooker.dm @@ -92,7 +92,7 @@ soundloop.stop() to_chat(user, "You smell burning coming from [src]!") var/datum/effect_system/smoke_spread/bad/smoke = new // burning things makes smoke! - smoke.set_up(5, 0, src) + smoke.set_up(5, FALSE, src) smoke.start() if(prob(firechance)) var/turf/location = get_turf(src) diff --git a/code/modules/martial_arts/combos/mimejutsu/smokebomb.dm b/code/modules/martial_arts/combos/mimejutsu/smokebomb.dm index 23277fa5f0d..cc67e801706 100644 --- a/code/modules/martial_arts/combos/mimejutsu/smokebomb.dm +++ b/code/modules/martial_arts/combos/mimejutsu/smokebomb.dm @@ -7,7 +7,7 @@ target.visible_message("[user] throws an invisible smoke bomb!!") var/datum/effect_system/smoke_spread/bad/smoke = new - smoke.set_up(5, 0, target.loc) + smoke.set_up(5, FALSE, target) smoke.start() return MARTIAL_COMBO_DONE_BASIC_HIT diff --git a/code/modules/mining/lavaland/loot/tendril_loot.dm b/code/modules/mining/lavaland/loot/tendril_loot.dm index 36075515ea0..093324b68d5 100644 --- a/code/modules/mining/lavaland/loot/tendril_loot.dm +++ b/code/modules/mining/lavaland/loot/tendril_loot.dm @@ -321,14 +321,14 @@ return var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(1, 0, user.loc) + smoke.set_up(1, FALSE, user) smoke.start() user.forceMove(get_turf(linked)) SSblackbox.record_feedback("tally", "warp_cube", 1, type) var/datum/effect_system/smoke_spread/smoke2 = new - smoke2.set_up(1, 0, user.loc) + smoke2.set_up(1, FALSE, user) smoke2.start() cooldown = TRUE linked.cooldown = TRUE diff --git a/code/modules/mob/living/simple_animal/hostile/hellhound.dm b/code/modules/mob/living/simple_animal/hostile/hellhound.dm index a0b2f234911..f0435aeaaaf 100644 --- a/code/modules/mob/living/simple_animal/hostile/hellhound.dm +++ b/code/modules/mob/living/simple_animal/hostile/hellhound.dm @@ -149,7 +149,7 @@ return smoke_lastuse = world.time var/datum/effect_system/smoke_spread/sleeping/smoke = new - smoke.set_up(10, 0, loc) + smoke.set_up(10, FALSE, loc) smoke.start() /mob/living/simple_animal/hostile/hellhound/tear diff --git a/code/modules/mob/living/simple_animal/hostile/hivebot.dm b/code/modules/mob/living/simple_animal/hostile/hivebot.dm index 4bd08ddff6f..dd9416a0615 100644 --- a/code/modules/mob/living/simple_animal/hostile/hivebot.dm +++ b/code/modules/mob/living/simple_animal/hostile/hivebot.dm @@ -75,7 +75,7 @@ /mob/living/simple_animal/hostile/hivebot/tele/Initialize(mapload) . = ..() var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(5, 0, src.loc) + smoke.set_up(5, FALSE, loc) smoke.start() visible_message("[src] warps in!") playsound(src.loc, 'sound/effects/empulse.ogg', 25, 1) diff --git a/code/modules/mob/living/simple_animal/hostile/mining/elites/legionnaire.dm b/code/modules/mob/living/simple_animal/hostile/mining/elites/legionnaire.dm index a6ee0d9c578..3b2ca1dcd62 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining/elites/legionnaire.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining/elites/legionnaire.dm @@ -235,7 +235,7 @@ else visible_message("[src] spews smoke from its maw!") var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(6, 0, smoke_location) + smoke.set_up(6, FALSE, smoke_location) smoke.attach(smoke_location) smoke.start() diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 5c4ea5fdd8e..5d6fb251067 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -1121,7 +1121,7 @@ malfhack = TRUE update_icon() var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(3, 0, loc) + smoke.set_up(3, FALSE, loc) smoke.attach(src) smoke.start() do_sparks(3, 1, src) diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 5d0197497ba..cc14a132daa 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -425,7 +425,7 @@ M.show_message("[src] is making strange noises!", 3, "You hear sizzling electronics.", 2) sleep(10*pick(4,5,6,7,10,14)) var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(3, 0, src.loc) + smoke.set_up(3, FALSE, loc) smoke.attach(src) smoke.start() explosion(src.loc, -1, 0, 1, 3, 1, 0) @@ -439,7 +439,7 @@ emp_act(2) if(prob(5)) //smoke only var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(3, 0, src.loc) + smoke.set_up(3, FALSE, loc) smoke.attach(src) smoke.start() diff --git a/code/modules/projectiles/guns/magic/wand.dm b/code/modules/projectiles/guns/magic/wand.dm index 0375fc46f1d..1754b7a1146 100644 --- a/code/modules/projectiles/guns/magic/wand.dm +++ b/code/modules/projectiles/guns/magic/wand.dm @@ -139,7 +139,7 @@ /obj/item/gun/magic/wand/teleport/zap_self(mob/living/user) do_teleport(user, user, 10) var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(10, 0, user.loc) + smoke.set_up(10, FALSE, user) smoke.start() charges-- ..() diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index df2f67a128a..a54b0ce322b 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -116,7 +116,7 @@ teleammount++ do_teleport(stuff, stuff, 10) var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(max(round(10 - teleammount),1), 0, stuff.loc) //Smoke drops off if a lot of stuff is moved for the sake of sanity + smoke.set_up(max(round(10 - teleammount), 1), FALSE, stuff) //Smoke drops off if a lot of stuff is moved for the sake of sanity smoke.start() /obj/item/projectile/magic/door diff --git a/code/modules/reagents/chemistry/reagents/misc.dm b/code/modules/reagents/chemistry/reagents/misc.dm index bdbc30de5f0..0753ad8faa8 100644 --- a/code/modules/reagents/chemistry/reagents/misc.dm +++ b/code/modules/reagents/chemistry/reagents/misc.dm @@ -219,7 +219,7 @@ fireflash(T, min(max(0, volume / 40), 8)) var/datum/effect_system/smoke_spread/bad/BS = new - BS.set_up(1, 0, T) + BS.set_up(1, FALSE, T) BS.start() if(!QDELETED(old_holder) && reagent_after_burning) old_holder.add_reagent(reagent_after_burning, round(volume * 0.5)) diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index 25f61a8816f..9056f54c8c8 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -223,7 +223,7 @@ /obj/machinery/r_n_d/experimentor/proc/throwSmoke(turf/where) var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(1,0, where, 0) + smoke.set_up(1, FALSE, where) smoke.start() /obj/machinery/r_n_d/experimentor/proc/pickWeighted(list/from) @@ -433,7 +433,7 @@ if(prob(EFFECT_PROB_MEDIUM-badThingCoeff)) visible_message("[src] malfunctions, releasing a flurry of chilly air as [exp_on] pops out!") var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(1, 0, loc, 0) + smoke.set_up(1, FALSE, loc) smoke.start() ejectItem() //////////////////////////////////////////////////////////////////////////////////////////////// @@ -647,7 +647,7 @@ /obj/item/relic/proc/throwSmoke(turf/where) var/datum/effect_system/smoke_spread/smoke = new - smoke.set_up(1,0, where, 0) + smoke.set_up(1, FALSE, where) smoke.start() /obj/item/relic/proc/floofcannon(mob/user) diff --git a/code/modules/station_goals/bsa.dm b/code/modules/station_goals/bsa.dm index 1df3cb4384c..768815bb283 100644 --- a/code/modules/station_goals/bsa.dm +++ b/code/modules/station_goals/bsa.dm @@ -397,7 +397,7 @@ return null //Totally nanite construction system not an immersion breaking spawning var/datum/effect_system/smoke_spread/s = new - s.set_up(4, 0, get_turf(centerpiece)) + s.set_up(4, FALSE, centerpiece) s.start() var/obj/machinery/bsa/full/cannon = new(get_turf(centerpiece),centerpiece.get_cannon_direction()) cannon.controller = src