[READY] Adds night shifts (#4281)
* initial commit - adds night shifts * fixes lighting not updating when nightshift is triggered and fixes compiling issues * makes red alert override nightshift * Update lighting.dm * adds announcements for nightshift changes * fixes nightshift flip-flopping during the night, adjusts night message a little, moves from minor_announce to priority_announce * Update cit_nightshift.dm * fixes compiling errors
This commit is contained in:
@@ -249,6 +249,15 @@
|
||||
/datum/config_entry/flag/allow_miscreants
|
||||
|
||||
/datum/config_entry/flag/allow_extended_miscreants
|
||||
|
||||
|
||||
/datum/config_entry/flag/nightshift_enabled
|
||||
|
||||
/datum/config_entry/number/nightshift_start
|
||||
config_entry_value = 20
|
||||
|
||||
/datum/config_entry/number/nightshift_finish
|
||||
config_entry_value = 6
|
||||
//End of Cit changes
|
||||
|
||||
/datum/config_entry/number/bombcap/ValidateAndSet(str_val)
|
||||
|
||||
@@ -311,8 +311,9 @@
|
||||
on = FALSE
|
||||
emergency_mode = FALSE
|
||||
if(on)
|
||||
if(!light || light.light_range != brightness)
|
||||
if(!light || light.light_range != brightness || SSnightshift.nightshift != nightshift) //Cit change - makes lights update when nightshift triggers
|
||||
switchcount++
|
||||
nightshift = SSnightshift.nightshift // Cit change - makes lights update when nightshift triggers
|
||||
if(rigged)
|
||||
if(status == LIGHT_OK && trigger)
|
||||
explode()
|
||||
@@ -321,7 +322,7 @@
|
||||
burn_out()
|
||||
else
|
||||
use_power = ACTIVE_POWER_USE
|
||||
set_light(brightness, bulb_power, bulb_colour)
|
||||
set_light(brightness, ((SSnightshift.nightshift && obeysnightshift) ? SSnightshift.nightshift_light_power : bulb_power), ((SSnightshift.nightshift && obeysnightshift) ? SSnightshift.nightshift_light_color : bulb_colour)) // Citadel change. Allows nightshift and admins to modify station light power and color
|
||||
else if(has_emergency_power(LIGHT_EMERGENCY_POWER_USE) && !turned_off())
|
||||
use_power = IDLE_POWER_USE
|
||||
emergency_mode = TRUE
|
||||
|
||||
@@ -41,6 +41,8 @@ GLOBAL_VAR_INIT(security_level, 0)
|
||||
if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL)
|
||||
SSshuttle.emergency.modTimer(2)
|
||||
GLOB.security_level = SEC_LEVEL_BLUE
|
||||
sound_to_playing_players('sound/misc/voybluealert.ogg') // Citadel change - Makes alerts play a sound
|
||||
|
||||
for(var/obj/machinery/firealarm/FA in GLOB.machines)
|
||||
if(is_station_level(FA.z))
|
||||
FA.update_icon()
|
||||
@@ -55,6 +57,7 @@ GLOBAL_VAR_INIT(security_level, 0)
|
||||
else
|
||||
minor_announce(CONFIG_GET(string/alert_red_downto), "Attention! Code red!")
|
||||
GLOB.security_level = SEC_LEVEL_RED
|
||||
sound_to_playing_players('sound/misc/voyalert.ogg') // Citadel change - Makes alerts play a sound
|
||||
|
||||
for(var/obj/machinery/firealarm/FA in GLOB.machines)
|
||||
if(is_station_level(FA.z))
|
||||
@@ -69,6 +72,8 @@ GLOBAL_VAR_INIT(security_level, 0)
|
||||
else if(GLOB.security_level == SEC_LEVEL_BLUE)
|
||||
SSshuttle.emergency.modTimer(0.5)
|
||||
GLOB.security_level = SEC_LEVEL_DELTA
|
||||
sound_to_playing_players('sound/misc/deltakalaxon.ogg') // Citadel change - Makes alerts play a sound
|
||||
|
||||
for(var/obj/machinery/firealarm/FA in GLOB.machines)
|
||||
if(is_station_level(FA.z))
|
||||
FA.update_icon()
|
||||
@@ -79,6 +84,12 @@ GLOBAL_VAR_INIT(security_level, 0)
|
||||
if(D.red_alert_access)
|
||||
D.visible_message("<span class='notice'>[D] whirrs as it automatically lifts access requirements!</span>")
|
||||
playsound(D, 'sound/machines/boltsup.ogg', 50, TRUE)
|
||||
//Citadel change, makes red and delta alerts override nightshift lights
|
||||
SSnightshift.nightshift_override = TRUE
|
||||
if(SSnightshift.nightshift)
|
||||
SSnightshift.nightshift = FALSE
|
||||
SSnightshift.updatenightlights()
|
||||
//End of citadel changes
|
||||
SSblackbox.record_feedback("tally", "security_level_changes", 1, get_security_level())
|
||||
else
|
||||
return
|
||||
|
||||
+12
-4
@@ -136,10 +136,10 @@ MIDROUND_ANTAG CHANGELING
|
||||
MIDROUND_ANTAG WIZARD
|
||||
#MIDROUND_ANTAG MONKEY
|
||||
|
||||
## Uncomment these for overrides of the minimum / maximum number of players in a round type.
|
||||
## Uncomment these for overrides of the minimum / maximum number of players in a round type.
|
||||
## If you set any of these occasionally check to see if you still need them as the modes
|
||||
## will still be actively rebalanced around the SUGGESTED populations, not your overrides.
|
||||
## Notes: For maximum number of players a value of -1 means no maximum. Setting minimums to
|
||||
## Notes: For maximum number of players a value of -1 means no maximum. Setting minimums to
|
||||
## VERY low numbers (< 5) can lead to errors if the roundtypes were not designed for that.
|
||||
|
||||
#MIN_POP TRAITOR 0
|
||||
@@ -508,5 +508,13 @@ ALLOW_MISCREANTS
|
||||
## Uncomment to let miscreants spawn during Extended. I hold no responsibility for fun that may occur while this is enabled.
|
||||
#ALLOW_EXTENDED_MISCREANTS
|
||||
|
||||
## Uncomment to give players the choice of their species before they join the game
|
||||
JOIN_WITH_MUTANT_RACE
|
||||
## Determines if players are allowed to print integrated circuits, uncomment to allow.
|
||||
#IC_PRINTING
|
||||
|
||||
## NIGHT SHIFT ##
|
||||
## Comment to disable nightshift
|
||||
NIGHTSHIFT_ENABLED
|
||||
|
||||
## These values determine the start and end of night shift. By default, night shift starts at 8 PM, and ends at 6 AM.
|
||||
NIGHTSHIFT_START 20
|
||||
NIGHTSHIFT_FINISH 6
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/obj/machinery/light
|
||||
var/obeysnightshift = FALSE
|
||||
var/nightshift = FALSE
|
||||
|
||||
/obj/machinery/light/Initialize()
|
||||
. = ..()
|
||||
var/area/a = get_area(src)
|
||||
if(a.type in GLOB.the_station_areas)
|
||||
obeysnightshift = TRUE
|
||||
SSnightshift.nightlights += src
|
||||
|
||||
/obj/machinery/light/Destroy()
|
||||
if(obeysnightshift && src in SSnightshift.nightlights)
|
||||
SSnightshift.nightlights -= src
|
||||
. = ..()
|
||||
|
||||
SUBSYSTEM_DEF(nightshift)
|
||||
name = "Night shift"
|
||||
wait = 3000
|
||||
flags = SS_BACKGROUND
|
||||
|
||||
var/nightshift = FALSE
|
||||
var/nightshift_light_power = 0.45
|
||||
var/nightshift_light_color = "#FFDDCC"
|
||||
var/nightshift_override = FALSE
|
||||
|
||||
var/list/nightlights = list()
|
||||
|
||||
/datum/controller/subsystem/nightshift/Initialize()
|
||||
if(CONFIG_GET(flag/nightshift_enabled) && !nightshift_override)
|
||||
var/nighttime = text2num(time2text(world.timeofday,"hh"))
|
||||
if(!nightshift && ((nighttime >= CONFIG_GET(number/nightshift_start)) || (nighttime <= CONFIG_GET(number/nightshift_finish))))
|
||||
nightshift = TRUE
|
||||
. = ..()
|
||||
|
||||
/datum/controller/subsystem/nightshift/fire(resumed = 0)
|
||||
if(CONFIG_GET(flag/nightshift_enabled) && !nightshift_override)
|
||||
var/nighttime = text2num(time2text(world.timeofday,"hh"))
|
||||
if(GLOB.security_level < SEC_LEVEL_RED && ((nighttime >= CONFIG_GET(number/nightshift_start)) || (nighttime <= CONFIG_GET(number/nightshift_finish))))
|
||||
if(!nightshift)
|
||||
nightshift = TRUE
|
||||
updatenightlights()
|
||||
priority_announce("Good afternoon, 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.", sound='sound/misc/notice2.ogg', sender_override="Automated Lighting System Announcement")
|
||||
else if(nightshift)
|
||||
nightshift = FALSE
|
||||
updatenightlights()
|
||||
priority_announce("Good morning, crew. As it is now day time, all of the lights aboard the station have been restored to their former brightness.", sound='sound/misc/notice2.ogg', sender_override="Automated Lighting System Announcement")
|
||||
|
||||
/datum/controller/subsystem/nightshift/proc/updatenightlights()
|
||||
for(var/obj/machinery/light/nightlight in nightlights)
|
||||
if(nightlight)
|
||||
nightlight.update(FALSE)
|
||||
@@ -2503,6 +2503,7 @@
|
||||
#include "modular_citadel\code\init.dm"
|
||||
#include "modular_citadel\code\__HELPERS\lists.dm"
|
||||
#include "modular_citadel\code\__HELPERS\mobs.dm"
|
||||
#include "modular_citadel\code\controllers\subsystem\cit_nightshift.dm"
|
||||
#include "modular_citadel\code\controllers\subsystem\job.dm"
|
||||
#include "modular_citadel\code\controllers\subsystem\shuttle.dm"
|
||||
#include "modular_citadel\code\datums\uplink_items_cit.dm"
|
||||
|
||||
Reference in New Issue
Block a user