Merge pull request #10417 from kevinz000/nightshift_1
Nightshift improvements: public area settings/levels, nightshift auth requirement change, config changes, etc etc
This commit is contained in:
@@ -537,3 +537,10 @@ GLOBAL_LIST_INIT(pda_reskins, list(PDA_SKIN_CLASSIC = 'icons/obj/pda.dmi', PDA_S
|
||||
#define HOLOFORM_FILTER_STATIC "FILTER_STATIC"
|
||||
|
||||
#define CANT_REENTER_ROUND -1
|
||||
|
||||
//Nightshift levels.
|
||||
#define NIGHTSHIFT_AREA_FORCED 0 //ALWAYS nightshift if nightshift is enabled
|
||||
#define NIGHTSHIFT_AREA_PUBLIC 1 //hallways
|
||||
#define NIGHTSHIFT_AREA_RECREATION 2 //dorms common areas, etc
|
||||
#define NIGHTSHIFT_AREA_DEPARTMENT_HALLS 3 //interior hallways, etc
|
||||
#define NIGHTSHIFT_AREA_NONE 4 //default/highest.
|
||||
|
||||
@@ -362,6 +362,15 @@
|
||||
|
||||
/datum/config_entry/flag/enable_night_shifts
|
||||
|
||||
/datum/config_entry/number/night_shift_public_areas_only
|
||||
config_entry_value = NIGHTSHIFT_AREA_PUBLIC
|
||||
|
||||
/datum/config_entry/flag/nightshift_toggle_requires_auth
|
||||
config_entry_value = FALSE
|
||||
|
||||
/datum/config_entry/flag/nightshift_toggle_public_requires_auth
|
||||
config_entry_value = TRUE
|
||||
|
||||
/datum/config_entry/flag/randomize_shift_time
|
||||
|
||||
/datum/config_entry/flag/shift_time_realtime
|
||||
|
||||
@@ -35,21 +35,29 @@ SUBSYSTEM_DEF(nightshift)
|
||||
if(!emergency)
|
||||
announce("Restoring night lighting configuration to normal operation.")
|
||||
else
|
||||
announce("Disabling night lighting: Station is in a state of emergency.")
|
||||
announce("Disabling night lighting: Station is in a state of emergency.")
|
||||
if(emergency)
|
||||
night_time = FALSE
|
||||
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, max_level_override)
|
||||
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.")
|
||||
var/max_level
|
||||
var/configured_level = CONFIG_GET(number/night_shift_public_areas_only)
|
||||
if(isnull(max_level_override))
|
||||
max_level = active? configured_level : INFINITY //by default, deactivating shuts off nightshifts everywhere.
|
||||
else
|
||||
max_level = max_level_override
|
||||
for(var/A in GLOB.apcs_list)
|
||||
var/obj/machinery/power/apc/APC = A
|
||||
if (APC.area && (APC.area.type in GLOB.the_station_areas))
|
||||
APC.set_nightshift(active)
|
||||
CHECK_TICK
|
||||
if(APC.area?.type in GLOB.the_station_areas)
|
||||
var/their_level = APC.area.nightshift_public_area
|
||||
if(!max_level || (their_level <= max_level)) //if max level is 0, it means public area-only config is disabled so hit everything. if their level is 0, it means they have nightshift forced.
|
||||
APC.set_nightshift(active)
|
||||
CHECK_TICK
|
||||
|
||||
@@ -259,6 +259,9 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
|
||||
|
||||
//Hallway
|
||||
|
||||
/area/hallway
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_PUBLIC
|
||||
|
||||
/area/hallway/primary/aft
|
||||
name = "Aft Primary Hallway"
|
||||
icon_state = "hallA"
|
||||
@@ -404,14 +407,17 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
|
||||
name = "Dormitories"
|
||||
icon_state = "Sleep"
|
||||
safe = TRUE
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_RECREATION
|
||||
|
||||
/area/crew_quarters/dorms/male
|
||||
name = "Male Dorm"
|
||||
icon_state = "Sleep"
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_NONE
|
||||
|
||||
/area/crew_quarters/dorms/female
|
||||
name = "Female Dorm"
|
||||
icon_state = "Sleep"
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_NONE
|
||||
|
||||
/area/crew_quarters/rehab_dome
|
||||
name = "Rehabilitation Dome"
|
||||
@@ -448,26 +454,32 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
|
||||
/area/crew_quarters/locker
|
||||
name = "Locker Room"
|
||||
icon_state = "locker"
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_RECREATION
|
||||
|
||||
/area/crew_quarters/lounge
|
||||
name = "Lounge"
|
||||
icon_state = "yellow"
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_RECREATION
|
||||
|
||||
/area/crew_quarters/fitness
|
||||
name = "Fitness Room"
|
||||
icon_state = "fitness"
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_RECREATION
|
||||
|
||||
/area/crew_quarters/fitness/recreation
|
||||
name = "Recreation Area"
|
||||
icon_state = "fitness"
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_RECREATION
|
||||
|
||||
/area/crew_quarters/cafeteria
|
||||
name = "Cafeteria"
|
||||
icon_state = "cafeteria"
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_RECREATION
|
||||
|
||||
/area/crew_quarters/cafeteria/lunchroom
|
||||
name = "Lunchroom"
|
||||
icon_state = "cafeteria"
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_RECREATION
|
||||
|
||||
/area/crew_quarters/kitchen
|
||||
name = "Kitchen"
|
||||
@@ -480,6 +492,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
|
||||
/area/crew_quarters/bar
|
||||
name = "Bar"
|
||||
icon_state = "bar"
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_RECREATION
|
||||
|
||||
/area/crew_quarters/bar/atrium
|
||||
name = "Atrium"
|
||||
@@ -518,6 +531,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
|
||||
name = "Library"
|
||||
icon_state = "library"
|
||||
flags_1 = NONE
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_RECREATION
|
||||
|
||||
/area/library/lounge
|
||||
name = "Library Lounge"
|
||||
@@ -527,6 +541,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
|
||||
name = "Abandoned Library"
|
||||
icon_state = "library"
|
||||
flags_1 = NONE
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_NONE
|
||||
|
||||
/area/chapel
|
||||
icon_state = "chapel"
|
||||
@@ -534,12 +549,14 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
|
||||
flags_1 = NONE
|
||||
clockwork_warp_allowed = FALSE
|
||||
clockwork_warp_fail = "The consecration here prevents you from warping in."
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_RECREATION
|
||||
|
||||
/area/chapel/main
|
||||
name = "Chapel"
|
||||
|
||||
/area/chapel/main/monastery
|
||||
name = "Monastery"
|
||||
nightshift_public_area = NIGHTSHIFT_AREA_NONE
|
||||
|
||||
/area/chapel/office
|
||||
name = "Chapel Office"
|
||||
|
||||
@@ -63,6 +63,8 @@
|
||||
var/xenobiology_compatible = FALSE //Can the Xenobio management console transverse this area by default?
|
||||
var/list/canSmoothWithAreas //typecache to limit the areas that atoms in this area can smooth with
|
||||
|
||||
var/nightshift_public_area = NIGHTSHIFT_AREA_NONE //considered a public area for nightshift
|
||||
|
||||
/*Adding a wizard area teleport list because motherfucking lag -- Urist*/
|
||||
/*I am far too lazy to make it a proper list of areas so I'll just make it run the usual telepot routine at the start of the game*/
|
||||
GLOBAL_LIST_EMPTY(teleportlocs)
|
||||
|
||||
+39
-15
@@ -98,6 +98,7 @@
|
||||
var/force_update = 0
|
||||
var/emergency_lights = FALSE
|
||||
var/nightshift_lights = FALSE
|
||||
var/nightshift_requires_auth = FALSE
|
||||
var/last_nightshift_switch = 0
|
||||
var/update_state = -1
|
||||
var/update_overlay = -1
|
||||
@@ -239,6 +240,7 @@
|
||||
update_icon()
|
||||
|
||||
make_terminal()
|
||||
update_nightshift_auth_requirement()
|
||||
|
||||
addtimer(CALLBACK(src, .proc/update), 5)
|
||||
|
||||
@@ -852,6 +854,7 @@
|
||||
/obj/machinery/power/apc/ui_data(mob/user)
|
||||
var/list/data = list(
|
||||
"locked" = locked && !(integration_cog && is_servant_of_ratvar(user)),
|
||||
"lock_nightshift" = nightshift_requires_auth,
|
||||
"failTime" = failure_timer,
|
||||
"isOperating" = operating,
|
||||
"externalPower" = main_status,
|
||||
@@ -959,7 +962,18 @@
|
||||
. = UI_INTERACTIVE
|
||||
|
||||
/obj/machinery/power/apc/ui_act(action, params)
|
||||
if(..() || !can_use(usr, 1) || (locked && !usr.has_unlimited_silicon_privilege && !failure_timer && !(integration_cog && (is_servant_of_ratvar(usr)))))
|
||||
if(..() || !can_use(usr, 1))
|
||||
return
|
||||
if(failure_timer)
|
||||
if(action == "reboot")
|
||||
failure_timer = 0
|
||||
update_icon()
|
||||
update()
|
||||
var/authorized = (!locked || usr.has_unlimited_silicon_privilege || (integration_cog && (is_servant_of_ratvar(usr))))
|
||||
if((action == "toggle_nightshift") && (!nightshift_requires_auth || authorized))
|
||||
toggle_nightshift_lights()
|
||||
return TRUE
|
||||
if(!authorized)
|
||||
return
|
||||
switch(action)
|
||||
if("lock")
|
||||
@@ -969,22 +983,19 @@
|
||||
else
|
||||
locked = !locked
|
||||
update_icon()
|
||||
. = TRUE
|
||||
return TRUE
|
||||
if("cover")
|
||||
coverlocked = !coverlocked
|
||||
. = TRUE
|
||||
return TRUE
|
||||
if("breaker")
|
||||
toggle_breaker()
|
||||
. = TRUE
|
||||
if("toggle_nightshift")
|
||||
toggle_nightshift_lights()
|
||||
. = TRUE
|
||||
return TRUE
|
||||
if("charge")
|
||||
chargemode = !chargemode
|
||||
if(!chargemode)
|
||||
charging = APC_NOT_CHARGING
|
||||
update_icon()
|
||||
. = TRUE
|
||||
return TRUE
|
||||
if("channel")
|
||||
if(params["eqp"])
|
||||
equipment = setsubsystem(text2num(params["eqp"]))
|
||||
@@ -998,24 +1009,23 @@
|
||||
environ = setsubsystem(text2num(params["env"]))
|
||||
update_icon()
|
||||
update()
|
||||
. = TRUE
|
||||
return TRUE
|
||||
if("overload")
|
||||
if(usr.has_unlimited_silicon_privilege)
|
||||
overload_lighting()
|
||||
. = TRUE
|
||||
return TRUE
|
||||
if("hack")
|
||||
if(get_malf_status(usr))
|
||||
malfhack(usr)
|
||||
return TRUE
|
||||
if("occupy")
|
||||
if(get_malf_status(usr))
|
||||
malfoccupy(usr)
|
||||
return TRUE
|
||||
if("deoccupy")
|
||||
if(get_malf_status(usr))
|
||||
malfvacate()
|
||||
if("reboot")
|
||||
failure_timer = 0
|
||||
update_icon()
|
||||
update()
|
||||
return TRUE
|
||||
if("emergency_lighting")
|
||||
emergency_lights = !emergency_lights
|
||||
for(var/obj/machinery/light/L in area)
|
||||
@@ -1023,7 +1033,7 @@
|
||||
L.no_emergency = emergency_lights
|
||||
INVOKE_ASYNC(L, /obj/machinery/light/.proc/update, FALSE)
|
||||
CHECK_TICK
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/power/apc/proc/toggle_breaker()
|
||||
if(!is_operational() || failure_timer)
|
||||
@@ -1429,6 +1439,8 @@
|
||||
|
||||
/obj/machinery/power/apc/proc/set_nightshift(on)
|
||||
set waitfor = FALSE
|
||||
if(nightshift_lights == on)
|
||||
return
|
||||
nightshift_lights = on
|
||||
for(var/obj/machinery/light/L in area)
|
||||
if(L.nightshift_allowed)
|
||||
@@ -1436,6 +1448,18 @@
|
||||
L.update(FALSE)
|
||||
CHECK_TICK
|
||||
|
||||
/obj/machinery/power/apc/proc/update_nightshift_auth_requirement()
|
||||
nightshift_requires_auth = nightshift_toggle_requires_auth()
|
||||
|
||||
/obj/machinery/power/apc/proc/nightshift_toggle_requires_auth()
|
||||
if(!area)
|
||||
return FALSE
|
||||
var/configured_level = CONFIG_GET(number/night_shift_public_areas_only)
|
||||
var/our_level = area.nightshift_public_area
|
||||
var/public_requires_auth = CONFIG_GET(flag/nightshift_toggle_public_requires_auth)
|
||||
var/normal_requires_auth = CONFIG_GET(flag/nightshift_toggle_requires_auth)
|
||||
return (configured_level && our_level && ((our_level <= configured_level)? public_requires_auth : normal_requires_auth))
|
||||
|
||||
#undef UPSTATE_CELL_IN
|
||||
#undef UPSTATE_OPENED1
|
||||
#undef UPSTATE_OPENED2
|
||||
|
||||
@@ -560,6 +560,15 @@ ROUNDSTART_TRAITS
|
||||
## Enable night shifts ##
|
||||
#ENABLE_NIGHT_SHIFTS
|
||||
|
||||
## Makes night shifts only affect in-code public-flagged areas. Nightshifts hit the level as defined in __DEFINES/misc.dm that this is set to and anything below. ##
|
||||
NIGHT_SHIFT_PUBLIC_AREAS_ONLY 1
|
||||
|
||||
## Nightshift toggles REQUIRE APC authorization ##
|
||||
#NIGHTSHIFT_TOGGLE_REQUIRES_AUTH
|
||||
|
||||
## Nightshift toggles in public areas REQUIRE APC authorization ##
|
||||
NIGHTSHIFT_TOGGLE_PUBLIC_REQUIRES_AUTH
|
||||
|
||||
## Enable randomized shift start times##
|
||||
#RANDOMIZE_SHIFT_TIME
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
+13
-13
File diff suppressed because one or more lines are too long
@@ -132,7 +132,7 @@
|
||||
</ui-notice>
|
||||
<ui-notice>
|
||||
<ui-section label='Night Shift Lighting'>
|
||||
{{#if data.locked && !data.siliconUser}}
|
||||
{{#if data.locked && !data.siliconUser && data.lock_nightshift}}
|
||||
<span>{{data.nightshiftLights ? "Enabled" : "Disabled"}}</span>
|
||||
{{else}}
|
||||
<ui-button icon='lightbulb-o' action='toggle_nightshift'>{{data.nightshiftLights ? "Enabled" : "Disabled"}}</ui-button>
|
||||
|
||||
Reference in New Issue
Block a user