diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index 3ebc54cc4a2..16dd8580a47 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -19,7 +19,8 @@ // Copypaste of parent for performance. /turf/space/Initialize() appearance = SSicon_cache.space_cache["[((x + y) ^ ~(x * y) + z) % 25]"] - update_starlight() + if (config.starlight) + update_starlight() if (initialized) crash_with("Warning: [src]([type]) initialized multiple times!") diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 74fc80fb430..16c808b8a62 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -350,7 +350,7 @@ var/const/enterloopsanity = 100 if (!above || isopenturf(above)) return - above.ChangeTurf(/turf/simulated/open) + above.ChangeToOpenturf() /turf/proc/AdjacentTurfsRanged() var/static/list/allowed = typecacheof(list( @@ -388,4 +388,4 @@ var/const/enterloopsanity = 100 break if(add) L.Add(t) - return L \ No newline at end of file + return L diff --git a/code/game/turfs/turf_changing.dm b/code/game/turfs/turf_changing.dm index 9d68b1503c6..afce2070743 100644 --- a/code/game/turfs/turf_changing.dm +++ b/code/game/turfs/turf_changing.dm @@ -1,10 +1,10 @@ /turf var/tmp/changing_turf + var/openspace_override_type // If defined, this type is spawned instead of openturfs. /turf/proc/ReplaceWithLattice() - src.ChangeTurf(baseturf) - spawn() - new /obj/structure/lattice( locate(src.x, src.y, src.z) ) + ChangeTurf(baseturf) + new /obj/structure/lattice(src) // Removes all signs of lattice on the pos of the turf -Donkieyo /turf/proc/RemoveLattice() @@ -15,12 +15,15 @@ // Called after turf replaces old one /turf/proc/post_change() levelupdate() - var/turf/simulated/open/T = GetAbove(src) - if(istype(T)) - T.update_icon() + if (above) + above.update_mimic() queue_smooth_neighbors(src) +// Helper to change this turf into an appropriate openturf type, generally you should use this instead of ChangeTurf(/turf/simulated/open). +/turf/proc/ChangeToOpenturf() + . = ChangeTurf(/turf/space) + //Creates a new turf. // N is the type of the turf. /turf/proc/ChangeTurf(N, tell_universe = TRUE, force_lighting_update = FALSE) @@ -31,12 +34,16 @@ // This makes sure that turfs are not changed to space when there's a multi-z turf below if(N == /turf/space && HasBelow(z)) - N = /turf/simulated/open + N = openspace_override_type || /turf/simulated/open/airless var/obj/fire/old_fire = fire var/old_baseturf = baseturf - -// log_debug("Replacing [src.type] with [N]") + var/old_above = above + var/old_opacity = opacity + var/old_dynamic_lighting = dynamic_lighting + var/list/old_affecting_lights = affecting_lights + var/old_lighting_overlay = lighting_overlay + var/list/old_corners = corners changing_turf = TRUE @@ -46,7 +53,37 @@ // So we call destroy. qdel(src) - var/turf/simulated/W = new N( locate(src.x, src.y, src.z) ) + var/turf/simulated/W = new N(src) + +#ifndef AO_USE_LIGHTING_OPACITY + // If we're using opacity-based AO, this is done in recalc_atom_opacity(). + if (permit_ao) + regenerate_ao() +#endif + + recalc_atom_opacity() + lighting_overlay = old_lighting_overlay + if (lighting_overlay && lighting_overlay.loc != src) + // This is a hack, but I can't figure out why the fuck they're not on the correct turf in the first place. + lighting_overlay.forceMove(src, harderforce = TRUE) + + affecting_lights = old_affecting_lights + corners = old_corners + + if ((old_opacity != opacity) || (dynamic_lighting != old_dynamic_lighting) || force_lighting_update) + reconsider_lights() + + if (dynamic_lighting != old_dynamic_lighting) + if (dynamic_lighting) + lighting_build_overlay() + else + lighting_clear_overlay() + + if (config.starlight) + for (var/turf/space/S in RANGE_TURFS(1, src)) + S.update_starlight() + + W.above = old_above if(ispath(N, /turf/simulated)) if(old_fire) diff --git a/code/modules/lighting/lighting_turf.dm b/code/modules/lighting/lighting_turf.dm index 1b0468b078f..c9881becaa5 100644 --- a/code/modules/lighting/lighting_turf.dm +++ b/code/modules/lighting/lighting_turf.dm @@ -195,41 +195,3 @@ continue corners[i] = new/datum/lighting_corner(src, LIGHTING_CORNER_DIAGONAL[i]) - -/turf/ChangeTurf(turf/N, tell_universe = TRUE, force_lighting_update = FALSE) - if (!SSlighting) - return ..() - - var/old_opacity = opacity - var/old_dynamic_lighting = dynamic_lighting - var/list/old_affecting_lights = affecting_lights - var/old_lighting_overlay = lighting_overlay - var/list/old_corners = corners - - . = ..() - -#ifndef AO_USE_LIGHTING_OPACITY - if (permit_ao) - regenerate_ao() -#endif - - recalc_atom_opacity() - lighting_overlay = old_lighting_overlay - if (lighting_overlay && lighting_overlay.loc != src) - // This is a hack, but I can't figure out why the fuck they're not on the correct turf in the first place. - lighting_overlay.forceMove(src, harderforce = TRUE) - - affecting_lights = old_affecting_lights - corners = old_corners - - if ((old_opacity != opacity) || (dynamic_lighting != old_dynamic_lighting) || force_lighting_update) - reconsider_lights() - - if (dynamic_lighting != old_dynamic_lighting) - if (dynamic_lighting) - lighting_build_overlay() - else - lighting_clear_overlay() - - for (var/turf/space/S in RANGE_TURFS(1, src)) - S.update_starlight() diff --git a/code/modules/mining/mine_turf_types.dm b/code/modules/mining/mine_turf_types.dm index 864c76868b7..527cb1f98e0 100644 --- a/code/modules/mining/mine_turf_types.dm +++ b/code/modules/mining/mine_turf_types.dm @@ -12,6 +12,7 @@ /turf/simulated/lava, /turf/simulated/mineral ) + openspace_override_type = /turf/simulated/open/chasm/airless // Custom behavior here - we want smoothed turfs to show basalt underneath, not lava. /turf/simulated/lava/get_smooth_underlay_icon(mutable_appearance/underlay_appearance, turf/asking_turf, adjacency_dir) @@ -34,6 +35,7 @@ light_color = LIGHT_COLOR_LAVA smooth = SMOOTH_FALSE canSmoothWith = null + openspace_override_type = /turf/simulated/open/chasm/airless footstep_sound = "concretestep" diff --git a/code/modules/multiz/structures.dm b/code/modules/multiz/structures.dm index d3d51ed32f2..68a5bca1057 100644 --- a/code/modules/multiz/structures.dm +++ b/code/modules/multiz/structures.dm @@ -175,7 +175,7 @@ warning("Stair created without level above: ([loc.x], [loc.y], [loc.z])") return qdel(src) if(!istype(above)) - above.ChangeTurf(/turf/simulated/open) + above.ChangeToOpenturf() /obj/structure/stairs/Uncross(atom/movable/A) if(A.dir == dir && A.loc == loc) diff --git a/icons/turf/smooth/rocky_ash.dmi b/icons/turf/smooth/rocky_ash.dmi index 2a57edfc53a..3e2f72bc358 100644 Binary files a/icons/turf/smooth/rocky_ash.dmi and b/icons/turf/smooth/rocky_ash.dmi differ