-
-
Notifications
You must be signed in to change notification settings - Fork 683
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Day night cycle map config setting (#10283)
* Day night cycle * Update natural_light_cycle.dm
- Loading branch information
1 parent
167d1ce
commit ff56526
Showing
8 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
SUBSYSTEM_DEF(natural_light_cycle) | ||
name = "Natural Light Cycle" | ||
wait = 600 | ||
flags = SS_KEEP_TIMING | ||
init_order = INIT_ORDER_NATURAL_LIGHT | ||
var/list/cycle_colours = null | ||
|
||
/datum/controller/subsystem/natural_light_cycle/Initialize(start_timeofday) | ||
. = ..() | ||
if (SSmapping.config.starlight_mode != STARLIGHT_MODE_CYCLE) | ||
flags |= SS_NO_FIRE | ||
return | ||
cycle_colours = SSmapping.config.cycle_colours | ||
if (!islist(cycle_colours) || !length(cycle_colours)) | ||
to_chat(world, "<span class='boldannounce'>WARNING: Starlight is set to cycle, yet the colours that are set to be cycled is undefined.</span>"); | ||
log_world("WARNING: Starlight is set to cycle, yet the colours that are set to be cycled is undefined.") | ||
flags |= SS_NO_FIRE | ||
return | ||
|
||
/datum/controller/subsystem/natural_light_cycle/fire(resumed) | ||
var/time = station_time() | ||
var/next_proportion = min((((time + wait) % DECISECONDS_IN_DAY) / DECISECONDS_IN_DAY) * length(cycle_colours) + 1, length(cycle_colours)) | ||
var/next_index = FLOOR(next_proportion, 1) | ||
var/next_offset = next_proportion - next_index | ||
var/lower_colour = cycle_colours[next_index] | ||
var/upper_colour = cycle_colours[((next_index - 1) % length(cycle_colours)) + 1] | ||
var/blended_colour = BlendRGB(lower_colour, upper_colour, next_offset) | ||
set_starlight_colour(blended_colour, wait) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters