mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-09 22:26:23 +01:00
Subsystem overruns (#18744)
* fix sun subsytem overrun * . * . * night shift overrun * . * . * this * . * .
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user