mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 10:11:09 +00:00
Remove SS_NO_TICK_CHECK (#57800)
## About The Pull Request This is a whopper, will need @MrStonedOne to review. In theory this flag shouldn't be needed and my own testing didn't find any issues, but I'd feel better with a lengthy test merge. ## Why It's Good For The Game Might make nightshift subsystem lag less, MC loop has less stuff to check.
This commit is contained in:
@@ -36,23 +36,20 @@
|
||||
/// SS_BACKGROUND has its own priority bracket, this overrides SS_TICKER's priority bump
|
||||
#define SS_BACKGROUND 4
|
||||
|
||||
/// subsystem does not tick check, and should not run unless there is enough time (or its running behind (unless background))
|
||||
#define SS_NO_TICK_CHECK 8
|
||||
|
||||
/** Treat wait as a tick count, not DS, run every wait ticks. */
|
||||
/// (also forces it to run first in the tick (unless SS_BACKGROUND))
|
||||
/// (implies all runlevels because of how it works)
|
||||
/// This is designed for basically anything that works as a mini-mc (like SStimer)
|
||||
#define SS_TICKER 16
|
||||
#define SS_TICKER 8
|
||||
|
||||
/** keep the subsystem's timing on point by firing early if it fired late last fire because of lag */
|
||||
/// ie: if a 20ds subsystem fires say 5 ds late due to lag or what not, its next fire would be in 15ds, not 20ds.
|
||||
#define SS_KEEP_TIMING 32
|
||||
#define SS_KEEP_TIMING 16
|
||||
|
||||
/** Calculate its next fire after its fired. */
|
||||
/// (IE: if a 5ds wait SS takes 2ds to run, its next fire should be 5ds away, not 3ds like it normally would be)
|
||||
/// This flag overrides SS_KEEP_TIMING
|
||||
#define SS_POST_FIRE_TIMING 64
|
||||
#define SS_POST_FIRE_TIMING 32
|
||||
|
||||
//! SUBSYSTEM STATES
|
||||
#define SS_IDLE 0 /// ain't doing shit.
|
||||
|
||||
@@ -447,7 +447,6 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
|
||||
var/tick_precentage
|
||||
var/tick_remaining
|
||||
var/ran = TRUE //this is right
|
||||
var/ran_non_ticker = FALSE
|
||||
var/bg_calc //have we swtiched current_tick_budget to background mode yet?
|
||||
var/tick_usage
|
||||
|
||||
@@ -467,20 +466,6 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
|
||||
if (!(queue_node_flags & SS_TICKER) && skip_ticks)
|
||||
queue_node = queue_node.queue_next
|
||||
continue
|
||||
//super special case, subsystems where we can't make them pause mid way through
|
||||
//if we can't run them this tick (without going over a tick)
|
||||
//we bump up their priority and attempt to run them next tick
|
||||
//(unless we haven't even ran anything this tick, since its unlikely they will ever be able run
|
||||
// in those cases, so we just let them run)
|
||||
if (queue_node_flags & SS_NO_TICK_CHECK)
|
||||
if (queue_node.tick_usage > TICK_LIMIT_RUNNING - TICK_USAGE && ran_non_ticker)
|
||||
if (!(queue_node_flags & SS_BACKGROUND))
|
||||
queue_node.queued_priority += queue_priority_count * 0.1
|
||||
queue_priority_count -= queue_node_priority
|
||||
queue_priority_count += queue_node.queued_priority
|
||||
current_tick_budget -= queue_node_priority
|
||||
queue_node = queue_node.queue_next
|
||||
continue
|
||||
|
||||
if (!bg_calc && (queue_node_flags & SS_BACKGROUND))
|
||||
current_tick_budget = queue_priority_count_bg
|
||||
@@ -497,8 +482,6 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
|
||||
|
||||
current_ticklimit = round(TICK_USAGE + tick_precentage)
|
||||
|
||||
if (!(queue_node_flags & SS_TICKER))
|
||||
ran_non_ticker = TRUE
|
||||
ran = TRUE
|
||||
|
||||
queue_node_paused = (queue_node.state == SS_PAUSED || queue_node.state == SS_PAUSING)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
SUBSYSTEM_DEF(blackbox)
|
||||
name = "Blackbox"
|
||||
wait = 6000
|
||||
flags = SS_NO_TICK_CHECK
|
||||
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
|
||||
init_order = INIT_ORDER_BLACKBOX
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
SUBSYSTEM_DEF(nightshift)
|
||||
name = "Night Shift"
|
||||
wait = 600
|
||||
flags = SS_NO_TICK_CHECK
|
||||
wait = 10 MINUTES
|
||||
|
||||
var/nightshift_active = FALSE
|
||||
var/nightshift_start_time = 702000 //7:30 PM, station time
|
||||
@@ -9,6 +8,7 @@ SUBSYSTEM_DEF(nightshift)
|
||||
var/nightshift_first_check = 30 SECONDS
|
||||
|
||||
var/high_security_mode = FALSE
|
||||
var/list/currentrun
|
||||
|
||||
/datum/controller/subsystem/nightshift/Initialize()
|
||||
if(!CONFIG_GET(flag/enable_night_shifts))
|
||||
@@ -16,6 +16,9 @@ SUBSYSTEM_DEF(nightshift)
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/nightshift/fire(resumed = FALSE)
|
||||
if(resumed)
|
||||
update_nightshift(resumed = TRUE)
|
||||
return
|
||||
if(world.time - SSticker.round_start_time < nightshift_first_check)
|
||||
return
|
||||
check_nightshift()
|
||||
@@ -41,15 +44,18 @@ SUBSYSTEM_DEF(nightshift)
|
||||
if(nightshift_active != night_time)
|
||||
update_nightshift(night_time, announcing)
|
||||
|
||||
/datum/controller/subsystem/nightshift/proc/update_nightshift(active, announce = TRUE)
|
||||
/datum/controller/subsystem/nightshift/proc/update_nightshift(active, announce = TRUE, resumed = FALSE)
|
||||
if(!resumed)
|
||||
currentrun = GLOB.apcs_list.Copy()
|
||||
nightshift_active = active
|
||||
if(announce)
|
||||
if (active)
|
||||
announce("Good evening, crew. To reduce power consumption and stimulate the circadian rhythms of some species, all of the lights aboard the station have been dimmed for the night.")
|
||||
else
|
||||
announce("Good morning, crew. As it is now day time, all of the lights aboard the station have been restored to their former brightness.")
|
||||
for(var/A in GLOB.apcs_list)
|
||||
var/obj/machinery/power/apc/APC = A
|
||||
for(var/obj/machinery/power/apc/APC as anything in currentrun)
|
||||
currentrun -= APC
|
||||
if (APC.area && (APC.area.type in GLOB.the_station_areas))
|
||||
APC.set_nightshift(active)
|
||||
CHECK_TICK
|
||||
if(MC_TICK_CHECK)
|
||||
return
|
||||
|
||||
@@ -5,7 +5,6 @@ SUBSYSTEM_DEF(profiler)
|
||||
init_order = INIT_ORDER_PROFILER
|
||||
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY
|
||||
wait = 3000
|
||||
flags = SS_NO_TICK_CHECK
|
||||
var/fetch_cost = 0
|
||||
var/write_cost = 0
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
SUBSYSTEM_DEF(sun)
|
||||
name = "Sun"
|
||||
wait = 1 MINUTES
|
||||
flags = SS_NO_TICK_CHECK
|
||||
|
||||
var/azimuth = 0 ///clockwise, top-down rotation from 0 (north) to 359
|
||||
var/azimuth_mod = 1 ///multiplier against base_rotation
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
SUBSYSTEM_DEF(time_track)
|
||||
name = "Time Tracking"
|
||||
wait = 100
|
||||
flags = SS_NO_TICK_CHECK
|
||||
init_order = INIT_ORDER_TIMETRACK
|
||||
runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user