Skip to content

Commit 30fa0d5

Browse files
authored
Add a fallback timer to ensure smoke doesn't far outlive its intended lifetime (#3825)
1 parent 3e20193 commit 30fa0d5

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/obj/effect/particle_effect/fluid/smoke
2+
/// ID of the fallback timer, used to ensure that the smoke does not far outlive its intended lifetime, in case of subsystem delay or whatnot.
3+
var/fallback_timer
4+
5+
/obj/effect/particle_effect/fluid/smoke/Initialize(mapload, datum/fluid_group/group, ...)
6+
. = ..()
7+
// Ensure that smoke does not live for much longer than 1.5x the length of its lifetime (rounded up to the nearest 2 seconds)
8+
var/fallback_time = CEILING(initial(lifetime) * 1.5, 2 SECONDS)
9+
fallback_timer = addtimer(CALLBACK(src, PROC_REF(anti_fog_measures)), fallback_time, TIMER_UNIQUE | TIMER_STOPPABLE)
10+
11+
/obj/effect/particle_effect/fluid/smoke/Destroy()
12+
if(fallback_timer)
13+
deltimer(fallback_timer)
14+
fallback_timer = null
15+
return ..()
16+
17+
/obj/effect/particle_effect/fluid/smoke/proc/anti_fog_measures()
18+
fallback_timer = null
19+
if(!QDELETED(src))
20+
kill_smoke()

tgstation.dme

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5914,6 +5914,7 @@
59145914
#include "monkestation\code\game\objects\effects\anomalies\anomalies_bioscrambler.dm"
59155915
#include "monkestation\code\game\objects\effects\anomalies\anomalies_dimensional.dm"
59165916
#include "monkestation\code\game\objects\effects\anomalies\anomalies_dimensional_themes.dm"
5917+
#include "monkestation\code\game\objects\effects\effect_system\fluid_spread\effects_smoke.dm"
59175918
#include "monkestation\code\game\objects\effects\random\ai_module.dm"
59185919
#include "monkestation\code\game\objects\effects\spawners\roomspawner.dm"
59195920
#include "monkestation\code\game\objects\effects\spawners\random\fishing.dm"

0 commit comments

Comments
 (0)