mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-23 16:42:13 +00:00
* Initial * Cleared duplicates * More work, get rid of log_error * more * log_debug() to macro LOG_DEBUG * More work * More * Guh * Maybe better? * More work * gah * Dear lord * *inserts swears here* * gdi * More work * More * dear lord * fsdfsdafs * rsdaf * sadfasf * sdafsad * fgsd * small fuckup fix * jfsd * sdafasf * gdi * sdfa * sfdafgds * sdafasdvf * sdfasdfg * sdfsga * asdf * dsfasfsagf * ihibhbjh * fsadf * adfas * sdafsad * sdfasd * fsda * vhb * asf * for arrow * removed source file-line logging, added header for tgui
104 lines
2.2 KiB
Plaintext
104 lines
2.2 KiB
Plaintext
#ifdef ENABLE_SUNLIGHT
|
|
|
|
/var/datum/controller/subsystem/sunlight/SSsunlight
|
|
|
|
/datum/controller/subsystem/sunlight
|
|
name = "Sunlight"
|
|
flags = SS_NO_FIRE
|
|
init_order = SS_INIT_SUNLIGHT
|
|
|
|
var/list/light_points = list()
|
|
var/config.sun_target_z = 7
|
|
|
|
var/list/presets
|
|
|
|
/datum/controller/subsystem/sunlight/New()
|
|
NEW_SS_GLOBAL(SSsunlight)
|
|
|
|
/datum/controller/subsystem/sunlight/stat_entry(msg)
|
|
msg = "A:[config.sun_accuracy] LP:[light_points.len] Z:[config.sun_target_z]"
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/sunlight/Initialize()
|
|
|
|
presets = list()
|
|
for (var/thing in subtypesof(/datum/sun_state))
|
|
presets += new thing
|
|
|
|
if (config.fastboot)
|
|
LOG_DEBUG("sunlight: fastboot detected, skipping setup.")
|
|
..()
|
|
return
|
|
|
|
var/thing
|
|
var/turf/T
|
|
for (thing in Z_ALL_TURFS(config.sun_target_z))
|
|
T = thing
|
|
if (!(T.x % config.sun_accuracy) && !(T.y % config.sun_accuracy))
|
|
light_points += new /atom/movable/sunobj(thing)
|
|
|
|
CHECK_TICK
|
|
|
|
LOG_DEBUG("sunlight: [light_points.len] sun emitters.")
|
|
..()
|
|
|
|
/datum/controller/subsystem/sunlight/proc/set_overall_light(...)
|
|
. = 0
|
|
for (var/thing in light_points)
|
|
var/atom/movable/AM = thing
|
|
AM.set_light(arglist(args))
|
|
.++
|
|
CHECK_TICK
|
|
|
|
/datum/controller/subsystem/sunlight/proc/apply_sun_state(datum/sun_state/S)
|
|
LOG_DEBUG("sunlight: Applying preset [S].")
|
|
set_overall_light(config.sun_accuracy * 1.2, 1, S.color)
|
|
|
|
/atom/movable/sunobj
|
|
name = "sunlight emitter"
|
|
desc = DESC_PARENT
|
|
light_novis = TRUE
|
|
light_range = 16
|
|
simulated = FALSE
|
|
mouse_opacity = FALSE
|
|
|
|
/atom/movable/sunobj/Destroy(force = FALSE)
|
|
if (!force)
|
|
crash_with("Something attempted to delete a sunobj!")
|
|
return QDEL_HINT_LETMELIVE
|
|
|
|
SSsunlight.light_points -= src
|
|
return ..()
|
|
|
|
/atom/movable/sunobj/Initialize()
|
|
light_range = Ceiling(config.sun_accuracy * 1.2)
|
|
return ..()
|
|
|
|
/atom/movable/sunobj/can_fall()
|
|
. = FALSE
|
|
|
|
/datum/sun_state
|
|
var/color = "#FFFFFF"
|
|
var/name = "INVALID"
|
|
|
|
/datum/sun_state/default
|
|
name = "Default"
|
|
|
|
/datum/sun_state/sensual
|
|
name = "Sensual"
|
|
color = LIGHT_COLOR_PINK
|
|
|
|
/datum/sun_state/red
|
|
name = "Nar-Sie"
|
|
color = "#FF0000"
|
|
|
|
/datum/sun_state/less_red
|
|
name = "Red"
|
|
color = LIGHT_COLOR_RED
|
|
|
|
/datum/sun_state/blue
|
|
name = "Blue"
|
|
color = LIGHT_COLOR_BLUE
|
|
|
|
#endif
|