Allows setting tick_interval on status effects to 0, effectively passing process() straight to tick() (#90248)

## About The Pull Request

Adds STATUS_EFFECT_AUTO_TICK, a define with a value of 0 that just makes
process() call tick() every time.

## Why It's Good For The Game

An unambiguous way to make tick() consistent with process() is quite
nice.
Sometimes you just have a status effect that only needs to run every
0.2s or every 2s. (past cases downstream)
Other times you have a status effect that is reliant on being in sync
with process() (my case downstream that started this PR)
This commit is contained in:
RikuTheKiller
2025-04-01 12:29:57 -05:00
committed by GitHub
parent faeb997bc0
commit 4ee5cb9dcc
3 changed files with 12 additions and 10 deletions
@@ -11,19 +11,16 @@
if(tick_speed == INFINITY)
TEST_FAIL("Status effect [checking] has tick_interval set to INFINITY, this is not how you prevent ticks - use tick_interval = STATUS_EFFECT_NO_TICK instead.")
continue
if(tick_speed == 0)
TEST_FAIL("Status effect [checking] has tick_interval set to 0, this is not how you prevent ticks - use tick_interval = STATUS_EFFECT_NO_TICK instead.")
continue
switch(initial(checking.processing_speed))
if(STATUS_EFFECT_FAST_PROCESS)
if(tick_speed < SSfastprocess.wait)
if(tick_speed < SSfastprocess.wait && tick_speed != STATUS_EFFECT_AUTO_TICK)
TEST_FAIL("Status effect [checking] has tick_interval set to [tick_speed], which is faster than SSfastprocess can tick ([SSfastprocess.wait]).")
if(STATUS_EFFECT_NORMAL_PROCESS)
if(tick_speed < SSprocessing.wait)
if(tick_speed < SSprocessing.wait && tick_speed != STATUS_EFFECT_AUTO_TICK)
TEST_FAIL("Status effect [checking] has tick_interval set to [tick_speed], which is faster than SSprocessing can tick ([SSprocessing.wait]).")
if(STATUS_EFFECT_PRIORITY)
var/priority_wait = world.tick_lag * SSpriority_effects.wait // SSpriority_effects has the SS_TICKER flag, so its wait is in ticks, so we have to convert it to deciseconds.
if(tick_speed < priority_wait)
if(tick_speed < priority_wait && tick_speed != STATUS_EFFECT_AUTO_TICK)
TEST_FAIL("Status effect [checking] has tick_interval set to [tick_speed], which is faster than SSpriority_effects can tick ([priority_wait]).")
else
TEST_FAIL("Invalid processing speed for status effect [checking] : [initial(checking.processing_speed)]")