mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-26 10:02:28 +00:00
This is it. The big one. Risk: Very large. This modifies or rewrites several important systems. Some things still need balancing, but that's probably better done if/when this hits dev. changes: New smooth lighting system. Machinery split into three processes: machinery, powernet, pipenet Removed due to breakage. Refactored into multi-step process. Mob process rewritten. NanoUI process rewritten. Objects process rewritten. Tweaked color output of station lights. Slime core lights now emit colored light. Fixed light update frequency issue with fire alarms, hydroponics trays, and airlocks. Increased light emission from bolted airlocks. Miscellaneous performance improvements. New datum pool implementation. New lighting usage profiler. Lighting system now tracks UV light, which is not visible to players. Space now has a parallax effect. Disabled Spin View verbs due to incompatibility with the new lighting system. Disabled hallucination view spin due to incompatibility with the new lighting system. Lighting system now initializes in the lobby before the round starts to reduce BoR deadtime. Added UV light tracking to lighting engine; dionae now gain energy exclusively from UV light. Added colored lighting to a few consoles that used default (white) light.
79 lines
2.4 KiB
Plaintext
79 lines
2.4 KiB
Plaintext
var/datum/controller/process/night_lighting/nl_ctrl
|
|
|
|
/datum/controller/process/night_lighting/
|
|
var/isactive = 0
|
|
var/firstrun = 1
|
|
var/manual_override = 0
|
|
|
|
/datum/controller/process/night_lighting/proc/is_active()
|
|
return isactive
|
|
|
|
/datum/controller/process/night_lighting/setup()
|
|
name = "night lighting controller"
|
|
schedule_interval = 3600 // Every 5 minutes.
|
|
|
|
nl_ctrl = src
|
|
|
|
if (!config.night_lighting)
|
|
// Stop trying to delete processes. Not how it goes.
|
|
disabled = 1
|
|
|
|
|
|
/datum/controller/process/night_lighting/preStart()
|
|
|
|
switch (worldtime2ticks())
|
|
if (0 to config.nl_finish)
|
|
deactivate()
|
|
if (config.nl_start to TICKS_IN_DAY)
|
|
activate()
|
|
|
|
|
|
/datum/controller/process/night_lighting/doWork()
|
|
if (manual_override) // don't automatically change lighting if it was manually changed in-game
|
|
return
|
|
|
|
switch (worldtime2ticks())
|
|
if (0 to config.nl_finish)
|
|
if (isactive)
|
|
command_announcement.Announce("Good morning. The time is [worldtime2text()]. \n\nThe automated systems aboard the [station_name()] will now return the public hallway lighting levels to normal.", "Automated Lighting System", new_sound = 'sound/misc/bosuns_whistle.ogg')
|
|
deactivate()
|
|
|
|
if (config.nl_start to TICKS_IN_DAY)
|
|
if (!isactive)
|
|
command_announcement.Announce("Good evening. The time is [worldtime2text()]. \n\nThe automated systems aboard the [station_name()] will now dim lighting in the public hallways in order to accommodate the circadian rhythm of some species.", "Automated Lighting System", new_sound = 'sound/misc/bosuns_whistle.ogg')
|
|
activate()
|
|
|
|
else
|
|
if (isactive)
|
|
deactivate()
|
|
|
|
// 'whitelisted' areas are areas that have nightmode explicitly enabled
|
|
|
|
/datum/controller/process/night_lighting/proc/activate(var/whitelisted_only = 1)
|
|
isactive = 1
|
|
for (var/obj/machinery/power/apc/APC in get_apc_list(whitelisted_only))
|
|
APC.toggle_nightlight("on")
|
|
|
|
F_SCHECK
|
|
|
|
/datum/controller/process/night_lighting/proc/deactivate(var/whitelisted_only = 1)
|
|
isactive = 0
|
|
for (var/obj/machinery/power/apc/APC in get_apc_list(whitelisted_only))
|
|
APC.toggle_nightlight("off")
|
|
|
|
F_SCHECK
|
|
|
|
/datum/controller/process/night_lighting/proc/get_apc_list(var/whitelisted_only = 1)
|
|
var/list/obj/machinery/power/apc/lighting_apcs = list()
|
|
|
|
for (var/A in all_areas)
|
|
var/area/B = A
|
|
if (B.no_light_control || (!(B.allow_nightmode) && whitelisted_only))
|
|
continue
|
|
if (B.apc && !B.apc.aidisabled)
|
|
lighting_apcs += B.apc
|
|
|
|
F_SCHECK
|
|
|
|
return lighting_apcs
|