Skip to content

Moves the stamina subsystem and stun effect processing into the ticker priority bracket #3798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/status_effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#define STATUS_EFFECT_FAST_PROCESS 0
///This is slower and better for more intensive status effects - 1s between ticks
#define STATUS_EFFECT_NORMAL_PROCESS 1
/// (monkestation addition) Similar speed to STATUS_EFFECT_FAST_PROCESS, but uses a high priority subsystem (SSpriority_effects).
#define STATUS_EFFECT_PRIORITY 2

//several flags for the Necropolis curse status effect
///makes the edges of the target's screen obscured
Expand Down
8 changes: 8 additions & 0 deletions code/datums/status_effects/_status_effect.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
START_PROCESSING(SSfastprocess, src)
if(STATUS_EFFECT_NORMAL_PROCESS)
START_PROCESSING(SSprocessing, src)
// monkestation start: SSpriority_effects
if(STATUS_EFFECT_PRIORITY)
START_PROCESSING(SSpriority_effects, src)
// monkestation end

update_particles()

Expand All @@ -76,6 +80,10 @@
STOP_PROCESSING(SSfastprocess, src)
if(STATUS_EFFECT_NORMAL_PROCESS)
STOP_PROCESSING(SSprocessing, src)
// monkestation start: SSpriority_effects
if(STATUS_EFFECT_PRIORITY)
STOP_PROCESSING(SSpriority_effects, src)
// monkestation end
if(owner)
linked_alert = null
owner.clear_alert(id)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/status_effects/buffs/stop_drop_roll.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/datum/status_effect/stop_drop_roll
id = "stop_drop_roll"
alert_type = null

tick_interval = 0.8 SECONDS
processing_speed = STATUS_EFFECT_PRIORITY // monkestation edit: high-priority status effect processing

/datum/status_effect/stop_drop_roll/on_apply()
if(!iscarbon(owner))
Expand Down
1 change: 1 addition & 0 deletions code/datums/status_effects/debuffs/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
alert_type = null
remove_on_fullheal = TRUE
heal_flag_necessary = HEAL_CC_STATUS
processing_speed = STATUS_EFFECT_PRIORITY // monkestation edit: high-priority status effect processing
var/needs_update_stat = FALSE

/datum/status_effect/incapacitating/on_creation(mob/living/new_owner, set_duration)
Expand Down
5 changes: 5 additions & 0 deletions monkestation/code/controllers/subsystem/z_priority_effects.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PROCESSING_SUBSYSTEM_DEF(priority_effects)
name = "Priority Status Effects"
flags = SS_TICKER | SS_KEEP_TIMING | SS_NO_INIT
wait = 2 // Not seconds - we're running on SS_TICKER, so this is ticks.
stat_tag = "PEFF"
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ SUBSYSTEM_DEF(stamina)
name = "Stamina"

priority = FIRE_PRIORITY_STAMINA
flags = SS_BACKGROUND|SS_POST_FIRE_TIMING|SS_NO_INIT
wait = 1 SECONDS
flags = SS_TICKER | SS_KEEP_TIMING | SS_NO_INIT
wait = 10 // Not seconds - we're running on SS_TICKER, so this is ticks.

var/list/processing = list()
var/list/currentrun = list()
Expand All @@ -21,6 +21,6 @@ SUBSYSTEM_DEF(stamina)
while(current_run.len)
var/datum/stamina_container/thing = current_run[current_run.len]
current_run.len--
thing.update(wait * 0.1)
thing.update(world.tick_lag * wait * 0.1)
if (MC_TICK_CHECK)
return
3 changes: 2 additions & 1 deletion tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,6 @@
#include "code\controllers\subsystem\processing\quirks.dm"
#include "code\controllers\subsystem\processing\reagents.dm"
#include "code\controllers\subsystem\processing\singulo.dm"
#include "code\controllers\subsystem\processing\stamina.dm"
#include "code\controllers\subsystem\processing\station.dm"
#include "code\controllers\subsystem\processing\supermatter_cascade.dm"
#include "code\controllers\subsystem\processing\tramprocess.dm"
Expand Down Expand Up @@ -5819,6 +5818,8 @@
#include "monkestation\code\controllers\subsystem\init_profiler.dm"
#include "monkestation\code\controllers\subsystem\job.dm"
#include "monkestation\code\controllers\subsystem\profiler.dm"
#include "monkestation\code\controllers\subsystem\z_priority_effects.dm"
#include "monkestation\code\controllers\subsystem\z_stamina.dm"
#include "monkestation\code\datums\action.dm"
#include "monkestation\code\datums\dna.dm"
#include "monkestation\code\datums\emotes.dm"
Expand Down
Loading