diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index a25c43cbbaf..9f123cb82de 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -152,6 +152,8 @@ // 15, 45, 70 minutes respectively var/list/event_delay_upper = list(EVENT_LEVEL_MUNDANE = 9000, EVENT_LEVEL_MODERATE = 27000, EVENT_LEVEL_MAJOR = 42000) + var/starlight = 0 // Whether space turfs have ambient light or not + /datum/configuration/New() var/list/L = typesof(/datum/game_mode) - /datum/game_mode for (var/T in L) @@ -501,6 +503,10 @@ config.event_delay_upper[EVENT_LEVEL_MODERATE] = MinutesToTicks(values[2]) config.event_delay_upper[EVENT_LEVEL_MAJOR] = MinutesToTicks(values[3]) + if("starlight") + var/vvalue = text2num(value) + config.starlight = vvalue >= 0 ? vvalue : 0 + else diary << "Unknown setting in configuration: '[name]'" diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index 1cf1997259e..ee55ec14ce1 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -74,6 +74,7 @@ datum/controller/game_controller/proc/setup() color_windows_init() setup_objects() + setup_starlight() setupgenetics() setupfactions() setup_economy() @@ -83,7 +84,6 @@ datum/controller/game_controller/proc/setup() make_mining_asteroid_secret() populate_spawn_points() - /* MOVED TO SCHEDULER spawn(0) @@ -125,6 +125,11 @@ datum/controller/game_controller/proc/setup_objects() world << "\red \b Initializations complete." sleep(-1) +datum/controller/game_controller/proc/setup_starlight() + world << "\red \b Initializing Starlight" + for(var/turf/space/S in world) + S.update_starlight() + world << "\red \b Starlight Initilization Complete" datum/controller/game_controller/proc/process() processing = 1 diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index c6dfddcee38..2d79b74e638 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -11,6 +11,17 @@ /turf/space/New() if(!istype(src, /turf/space/transit)) icon_state = "[((x + y) ^ ~(x * y) + z) % 25]" + if(config) + update_starlight() //MC will initialize all the space turfs that get created before config + +/turf/space/proc/update_starlight() + if(!config) return + if(!config.starlight) + return + if(locate(/turf/simulated) in orange(src,1)) + set_light(config.starlight) + else + set_light(0) /turf/space/attack_paw(mob/user as mob) return src.attack_hand(user) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 6e175078e34..d3a11c4af28 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -240,6 +240,9 @@ W:Assimilate_Air() W.RemoveLattice() + for(var/turf/space/S in range(W,1)) + S.update_starlight() + W.levelupdate() W.CalculateAdjacentTurfs() . = W diff --git a/config/example/config.txt b/config/example/config.txt index 3a5e565e824..4f4b034718b 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -270,4 +270,7 @@ EVENT_DELAY_UPPER 15;45;70 ## Unset setting use the EVENT_DELAY_LOWER and EVENT_DELAY_UPPER values instead. # EVENT_CUSTOM_START_MINOR 10;15 # EVENT_CUSTOM_START_MODERATE 30;45 -EVENT_CUSTOM_START_MAJOR 80;100 \ No newline at end of file +EVENT_CUSTOM_START_MAJOR 80;100 + +## Strength of ambient star light. Set to 0 or less to turn off. +STARLIGHT 0 \ No newline at end of file