From 646d1faa111b3161dea65774e693ba96bdedbe4a Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Wed, 26 Nov 2025 17:42:55 +0100 Subject: [PATCH] Subsystem overruns (#18744) * fix sun subsytem overrun * . * . * night shift overrun * . * . * this * . * . --- code/controllers/subsystems/nightshift.dm | 35 ++++++++++--------- code/controllers/subsystems/sun.dm | 18 ++++++++-- code/datums/sun.dm | 7 ---- .../human/species/station/traits/positive.dm | 2 +- .../silicon/robot/dogborg/dog_modules.dm | 4 +-- .../security levels/security levels.dm | 2 +- code/modules/tgchat/to_chat.dm | 3 +- 7 files changed, 40 insertions(+), 31 deletions(-) diff --git a/code/controllers/subsystems/nightshift.dm b/code/controllers/subsystems/nightshift.dm index 201a4794b9..b66581d5fe 100644 --- a/code/controllers/subsystems/nightshift.dm +++ b/code/controllers/subsystems/nightshift.dm @@ -5,12 +5,12 @@ SUBSYSTEM_DEF(nightshift) ) priority = FIRE_PRIORITY_NIGHTSHIFT wait = 60 SECONDS - flags = SS_NO_TICK_CHECK var/nightshift_active = FALSE 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)) @@ -18,7 +18,10 @@ SUBSYSTEM_DEF(nightshift) return SS_INIT_SUCCESS /datum/controller/subsystem/nightshift/fire(resumed = FALSE) - if(round_duration_in_ds < nightshift_first_check) + if(resumed) + update_nightshift(resumed = TRUE) + return + if(world.time - SSticker.round_start_time < nightshift_first_check) return check_nightshift() @@ -26,7 +29,6 @@ SUBSYSTEM_DEF(nightshift) var/announce_z if(using_map.station_levels.len) announce_z = pick(using_map.station_levels) - //VOREStation Edit - TTS var/pickedsound if(!high_security_mode) if(nightshift_active) @@ -34,11 +36,8 @@ SUBSYSTEM_DEF(nightshift) else pickedsound = 'sound/AI/bright_lights.ogg' priority_announcement.Announce(message, new_title = "Automated Lighting System Announcement", new_sound = pickedsound, zlevel = announce_z) - //VOREStation Edit End -/datum/controller/subsystem/nightshift/proc/check_nightshift(check_canfire=FALSE) //This is called from elsewhere, like setting the alert levels - if(check_canfire && !can_fire) - return +/datum/controller/subsystem/nightshift/proc/check_nightshift(forced) //This is called from elsewhere, like setting the alert levels, sadly var/emergency = GLOB.security_level > SEC_LEVEL_GREEN var/announcing = TRUE var/night_time = using_map.get_nightshift() @@ -53,16 +52,20 @@ SUBSYSTEM_DEF(nightshift) if(emergency) night_time = FALSE if(nightshift_active != night_time) - update_nightshift(night_time, announcing) + update_nightshift(night_time, announcing, forced = forced) /datum/controller/subsystem/nightshift/proc/update_nightshift(active, announce = TRUE, resumed = FALSE, forced = FALSE) - 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/obj/machinery/power/apc/apc in GLOB.apcs) + if(!resumed) + currentrun = GLOB.apcs + 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/obj/machinery/power/apc/apc as anything in currentrun) + currentrun -= apc if(apc.z in using_map.station_levels) apc.set_nightshift(active, TRUE) - CHECK_TICK + if(MC_TICK_CHECK && !forced) // subsystem will be in state SS_IDLE if forced by an admin + return diff --git a/code/controllers/subsystems/sun.dm b/code/controllers/subsystems/sun.dm index bedb33ed13..2c1b83c0ab 100644 --- a/code/controllers/subsystems/sun.dm +++ b/code/controllers/subsystems/sun.dm @@ -3,6 +3,20 @@ SUBSYSTEM_DEF(sun) wait = 600 flags = SS_NO_INIT var/static/datum/sun/sun = new + var/list/current_run -/datum/controller/subsystem/sun/fire() - sun.calc_position() +/datum/controller/subsystem/sun/fire(resumed) + if(!resumed) + current_run = GLOB.solars_list.Copy() + sun.calc_position() + + //now tell the solar control computers to update their status and linked devices + while(current_run.len) + var/obj/machinery/power/solar_control/SC = current_run[current_run.len] + current_run.len-- + if(!SC.powernet) + GLOB.solars_list.Remove(SC) + continue + SC.update() + if(MC_TICK_CHECK) + return diff --git a/code/datums/sun.dm b/code/datums/sun.dm index d54ad28138..cc51be63e2 100644 --- a/code/datums/sun.dm +++ b/code/datums/sun.dm @@ -32,10 +32,3 @@ else dx = s/abs(s) dy = c / abs(s) - - //now tell the solar control computers to update their status and linked devices - for(var/obj/machinery/power/solar_control/SC in GLOB.solars_list) - if(!SC.powernet) - GLOB.solars_list.Remove(SC) - continue - SC.update() diff --git a/code/modules/mob/living/carbon/human/species/station/traits/positive.dm b/code/modules/mob/living/carbon/human/species/station/traits/positive.dm index 1ac285a8e5..fcca6f5204 100644 --- a/code/modules/mob/living/carbon/human/species/station/traits/positive.dm +++ b/code/modules/mob/living/carbon/human/species/station/traits/positive.dm @@ -668,7 +668,7 @@ if(last_adrenaline_rush && last_adrenaline_rush + (30 MINUTES) > world.time) return last_adrenaline_rush = world.time - log_and_message_admins("[H]'s adrenaline rush trait just activated!") + log_and_message_admins("[H]'s adrenaline rush trait just activated!", H) H.add_modifier(/datum/modifier/adrenaline, 30 SECONDS) /datum/modifier/adrenaline diff --git a/code/modules/mob/living/silicon/robot/dogborg/dog_modules.dm b/code/modules/mob/living/silicon/robot/dogborg/dog_modules.dm index 45851fa253..f9eba72283 100644 --- a/code/modules/mob/living/silicon/robot/dogborg/dog_modules.dm +++ b/code/modules/mob/living/silicon/robot/dogborg/dog_modules.dm @@ -160,7 +160,7 @@ if(istype(target,/obj/item/trash)) user.visible_message(span_filter_notice("[user] nibbles away at \the [target.name]."), span_notice("You begin to nibble away at \the [target.name]...")) busy = 1 - if(do_after (user, 50)) + if(do_after (user, 5 SECONDS, target)) user.visible_message(span_filter_notice("[user] finishes eating \the [target.name]."), span_notice("You finish eating \the [target.name].")) to_chat(user, span_notice("You finish off \the [target.name].")) qdel(target) @@ -171,7 +171,7 @@ if(istype(target,/obj/item/cell)) user.visible_message(span_filter_notice("[user] begins cramming \the [target.name] down its throat."), span_notice("You begin cramming \the [target.name] down your throat...")) busy = 1 - if(do_after (user, 50)) + if(do_after (user, 5 SECONDS, target)) user.visible_message(span_filter_notice("[user] finishes gulping down \the [target.name]."), span_notice("You finish swallowing \the [target.name].")) to_chat(user, span_notice("You finish off \the [target.name], and gain some charge!")) var/mob/living/silicon/robot/R = user diff --git a/code/modules/security levels/security levels.dm b/code/modules/security levels/security levels.dm index 42d1ab7b94..9557395573 100644 --- a/code/modules/security levels/security levels.dm +++ b/code/modules/security levels/security levels.dm @@ -86,7 +86,7 @@ GLOBAL_VAR_INIT(security_level, 0) SSatc.reroute_traffic(yes = 0) spawn() - SSnightshift.check_nightshift() + SSnightshift.check_nightshift(TRUE) admin_chat_message(message = "Security level is now: [uppertext(get_security_level())]", color = "#CC2222") //VOREStation Add diff --git a/code/modules/tgchat/to_chat.dm b/code/modules/tgchat/to_chat.dm index 6b054ba796..7038818881 100644 --- a/code/modules/tgchat/to_chat.dm +++ b/code/modules/tgchat/to_chat.dm @@ -75,8 +75,7 @@ trailing_newline = TRUE, confidential = FALSE ) - //if(isnull(Master) || !SSchat?.initialized || !MC_RUNNING(SSchat.init_stage)) - if(isnull(Master) || !SSchat?.initialized) + if(isnull(Master) || !SSchat?.initialized || !MC_RUNNING(SSchat.init_stage)) to_chat_immediate(target, html, type, text, avoid_highlighting) return