diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index 57152d3679d..1fa2f5c6ff1 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -56,7 +56,7 @@ return INITIALIZE_HINT_NORMAL // Handles starlight logic unique to space turfs. -/turf/space/update_starlight() +/turf/space/update_starlight(has_simulated_neighbor = FALSE) . = ..() // We also run the parent proc here, since space may also require starlight from needs_starlight! // Our parent proc already handled starlight for us, we don't have to do our own checks @@ -64,7 +64,8 @@ return // Otherwise, if a space turf borders a simulated turf, it should be producing starlight. - if(locate(/turf/simulated) in RANGE_TURFS(1, src)) + // Some callers already know this and can skip building another range list. + if(has_simulated_neighbor || locate(/turf/simulated) in RANGE_TURFS(1, src)) set_light(SSatlas.current_sector.starlight_range, SSatlas.current_sector.starlight_power, l_color = SSskybox.background_color) // We don't want this doing anything on space, otherwise update_starlight() would run set_light on space turfs twice. diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index 66c4b022782..5b02055bbe8 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -244,6 +244,7 @@ for (var/obj/structure/machinery/machine as anything in machines) machine.power_change() + var/list/space_turfs_to_update for (var/turf/T as anything in turfs) T.post_change(FALSE) if(template_flags & TEMPLATE_FLAG_NO_RUINS) @@ -252,6 +253,11 @@ if(istype(T,/turf/simulated)) var/turf/simulated/sim = T sim.update_air_properties() + if(GLOB.config.starlight) + for(var/direction in GLOB.alldirs) + var/turf/neighbor = get_step(sim, direction) + if(istype(neighbor, /turf/space)) + LAZYSET(space_turfs_to_update, neighbor, TRUE) if(SSlighting.initialized) //don't generate lighting overlays before SSlighting in case these templates are loaded before var/area/A = T.loc @@ -259,6 +265,10 @@ continue T.static_lighting_build_overlay() + // New z-level space initializes before its template is placed, so refresh each affected space turf once. + for(var/turf/space/space_turf as anything in space_turfs_to_update) + space_turf.update_starlight(TRUE) + /datum/map_template/proc/load(turf/T, centered = FALSE) last_load_error = null if(centered) diff --git a/html/changelogs/geeves-starlight_fix.yml b/html/changelogs/geeves-starlight_fix.yml new file mode 100644 index 00000000000..bcd50cb0319 --- /dev/null +++ b/html/changelogs/geeves-starlight_fix.yml @@ -0,0 +1,6 @@ +author: Geeves + +delete-after: True + +changes: + - bugfix: "Fix starlight not working on overmap and overship maps."