Merge pull request #15098 from Very-Soft/redgate

Randomness updates
This commit is contained in:
Casey
2023-07-01 18:30:18 -04:00
committed by CHOMPStation2
parent ed75318989
commit 4cefffe8f4
3 changed files with 71 additions and 24 deletions

View File

@@ -5,6 +5,9 @@
icon_state = "fakesun"
invisibility = INVISIBILITY_ABSTRACT
var/atom/movable/sun_visuals/sun
var/family = null //Allows multipe maps that are THEORETICALLY connected to use the same settings when not in a connected Z stack
var/shared_settings //Automatically set if using the family var
var/static/world_suns = list() //List of all the fake_suns in the world, used for checking for family members
var/list/possible_light_setups = list(
list(
@@ -78,13 +81,26 @@
)
/obj/effect/fake_sun/New(loc, ...)
. = ..()
world_suns += src
/obj/effect/fake_sun/Initialize()
..()
return INITIALIZE_HINT_LATELOAD
/obj/effect/fake_sun/LateInitialize()
. = ..()
var/list/choice = pick(possible_light_setups)
var/list/choice
if(family) //Allows one to make multiple fake_suns to use the same settings
for(var/obj/effect/fake_sun/l in world_suns) //check all the suns that exist
if(l.family == family && l.shared_settings) //do you have settings we need?
choice = l.shared_settings
break
if(!choice) //We didn't get anything from our family, let's pick something
choice = pick(possible_light_setups)
if(family) //Let's pass our settings on to our family
shared_settings = choice
if(choice["brightness"] <= LIGHTING_SOFT_THRESHOLD) // dark!
return