Files
S.P.L.U.R.T-Station-13/code/modules/events/aurora_caelus.dm
SandPoot 54641ce201 send
2023-01-23 20:44:28 -03:00

65 lines
3.0 KiB
Plaintext

/datum/round_event_control/aurora_caelus
name = "Aurora Caelus"
typepath = /datum/round_event/aurora_caelus
max_occurrences = 1
weight = 4
earliest_start = 5 MINUTES
category = EVENT_CATEGORY_FRIENDLY
description = "A colourful display can be seen through select windows. And the kitchen."
/datum/round_event_control/aurora_caelus/canSpawnEvent(players, gamemode)
if(!CONFIG_GET(flag/starlight))
return FALSE
return ..()
/datum/round_event/aurora_caelus
announce_when = 1
start_when = 9
end_when = 50
var/list/aurora_colors = list("#A2FF80", "#A2FF8B", "#A2FF96", "#A2FFA5", "#A2FFB6", "#A2FFC7", "#A2FFDE", "#A2FFEE")
var/aurora_progress = 0 //this cycles from 1 to 8, slowly changing colors from gentle green to gentle blue
/datum/round_event/aurora_caelus/announce()
priority_announce("[station_name()]: A harmless cloud of ions is approaching your station, and will exhaust their energy battering the hull. Nanotrasen has approved a short break for all employees to relax and observe this very rare event. During this time, starlight will be bright but gentle, shifting between quiet green and blue colors. Any staff who would like to view these lights for themselves may proceed to the area nearest to them with viewing ports to open space. We hope you enjoy the lights.",
sound = 'sound/misc/notice2.ogg',
sender_override = "Nanotrasen Meteorology Division")
for(var/V in GLOB.player_list)
var/mob/M = V
if((M.client.prefs.toggles & SOUND_MIDI) && is_station_level(M.z))
M.playsound_local(M, 'sound/ambience/aurora_caelus.ogg', 20, FALSE, pressure_affected = FALSE)
/datum/round_event/aurora_caelus/start()
for(var/area in GLOB.sortedAreas)
var/area/A = area
if(initial(A.dynamic_lighting) == DYNAMIC_LIGHTING_IFSTARLIGHT)
for(var/turf/open/space/S in A)
S.set_light(S.light_range * 3, S.light_power * 0.5)
/datum/round_event/aurora_caelus/tick()
if(activeFor % 5 == 0)
aurora_progress++
var/aurora_color = aurora_colors[aurora_progress]
for(var/area in GLOB.sortedAreas)
var/area/A = area
if(initial(A.dynamic_lighting) == DYNAMIC_LIGHTING_IFSTARLIGHT)
for(var/turf/open/space/S in A)
S.set_light(l_color = aurora_color)
/datum/round_event/aurora_caelus/end()
for(var/area in GLOB.sortedAreas)
var/area/A = area
if(initial(A.dynamic_lighting) == DYNAMIC_LIGHTING_IFSTARLIGHT)
for(var/turf/open/space/S in A)
fade_to_black(S)
priority_announce("The aurora caelus event is now ending. Starlight conditions will slowly return to normal. When this has concluded, please return to your workplace and continue work as normal. Have a pleasant shift, [station_name()], and thank you for watching with us.",
sound = 'sound/misc/notice2.ogg',
sender_override = "Nanotrasen Meteorology Division")
/datum/round_event/aurora_caelus/proc/fade_to_black(turf/open/space/S)
set waitfor = FALSE
var/new_light = initial(S.light_range)
while(S.light_range > new_light)
S.set_light(S.light_range - 0.2)
sleep(30)
S.set_light(new_light, initial(S.light_power), initial(S.light_color))