From d024ece20c32a0eb7dd85ec83f009549886923da Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Tue, 4 Mar 2025 01:39:17 +0100 Subject: [PATCH] fix shuttles and turbolifts ending up outdoors (#17248) * fix shuttles and turbolifts ending up outdoors * light fixes * . * clamp brightness --- code/game/area/areas.dm | 9 +++ code/game/turfs/turf_changing.dm | 3 +- code/modules/lighting/lighting_fake_sun_vr.dm | 61 +++++++++++++------ code/modules/lighting/planet_sunlight.dm | 2 +- code/modules/planet/planet.dm | 2 +- 5 files changed, 57 insertions(+), 20 deletions(-) diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index faebc3545d..b64c67cde6 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -573,3 +573,12 @@ GLOBAL_DATUM(spoiler_obfuscation_image, /image) if(SK.ability_flags & AB_PHASE_SHIFTED) SK.phase_in(SK.loc) // RS Port #658 End + +/area/proc/isAlwaysIndoors() + return FALSE + +/area/shuttle/isAlwaysIndoors() + return TRUE + +/area/turbolift/isAlwaysIndoors() + return TRUE diff --git a/code/game/turfs/turf_changing.dm b/code/game/turfs/turf_changing.dm index 7a3e92f7c7..755cda00de 100644 --- a/code/game/turfs/turf_changing.dm +++ b/code/game/turfs/turf_changing.dm @@ -149,7 +149,8 @@ if(istype(cur_turf) && is_open != was_open) do cur_turf = GetBelow(cur_turf) - if(is_open) + var/area/A = cur_turf.loc + if(is_open && !A.isAlwaysIndoors()) cur_turf.make_outdoors() else cur_turf.make_indoors() diff --git a/code/modules/lighting/lighting_fake_sun_vr.dm b/code/modules/lighting/lighting_fake_sun_vr.dm index 81c7831085..220cfb995e 100644 --- a/code/modules/lighting/lighting_fake_sun_vr.dm +++ b/code/modules/lighting/lighting_fake_sun_vr.dm @@ -11,29 +11,31 @@ var/static/list/fake_sunlight_zs = list() 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/choice var/do_sun = TRUE var/do_weather = FALSE + var/advanced_lighting = FALSE var/list/possible_light_setups = list( list( - "brightness" = 6.0, + "brightness" = 1, "color" = "#abfff7" ), list( - "brightness" = 4.0, + "brightness" = 1, "color" = "#F4EA55" ), list( - "brightness" = 2.5, + "brightness" = 1, "color" = "#EE9AC6" ), list( - "brightness" = 1.5, + "brightness" = 1, "color" = "#F07AD8" ), list( - "brightness" = 1.5, + "brightness" = 1, "color" = "#61AEF3" ), list( @@ -45,15 +47,15 @@ var/static/list/fake_sunlight_zs = list() "color" = "#631E8A" ), list( - "brightness" = 1.0, + "brightness" = 1, "color" = "#A3A291" ), list( - "brightness" = 1.0, + "brightness" = 1, "color" = "#F07AD8" ), list( - "brightness" = 1.0, + "brightness" = 1, "color" = "#61AEF3" ), list( @@ -96,11 +98,36 @@ var/static/list/fake_sunlight_zs = list() /obj/effect/fake_sun/Initialize() ..() + if(!advanced_lighting) + return INITIALIZE_HINT_LATELOAD + do_sun = FALSE + + //Copied code + 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 + //Copied code end + + var/datum/simple_sun/Ssun = new() + Ssun.brightness = CLAMP01(choice["brightness"]) + Ssun.color = choice["color"] + var/datum/planet_sunlight_handler/pshandler = new(Ssun) + if(z > SSlighting.z_to_pshandler.len) + SSlighting.z_to_pshandler.len = z + SSlighting.z_to_pshandler[z] = pshandler + SSlighting.update_sunlight(pshandler) //Queue an update for when it starts running return INITIALIZE_HINT_LATELOAD /obj/effect/fake_sun/LateInitialize() . = ..() - 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? @@ -157,20 +184,20 @@ var/static/list/fake_sunlight_zs = list() possible_light_setups = list( list( - "brightness" = 6.0, + "brightness" = 1, "color" = "#E9FFB8" ), list( - "brightness" = 4.0, + "brightness" = 1, "color" = "#F4EA55" ), list( - "brightness" = 4.0, + "brightness" = 1, "color" = "#F07AD8" ), list( - "brightness" = 4.0, + "brightness" = 1, "color" = "#f3932d" ) @@ -182,19 +209,19 @@ var/static/list/fake_sunlight_zs = list() possible_light_setups = list( list( - "brightness" = 6.0, + "brightness" = 1, "color" = "#abfff7" ), list( - "brightness" = 4.0, + "brightness" = 1, "color" = "#2e30c9" ), list( - "brightness" = 1.0, + "brightness" = 1, "color" = "#61AEF3" ), list( - "brightness" = 1.0, + "brightness" = 1, "color" = "#61ddf3" ), list( diff --git a/code/modules/lighting/planet_sunlight.dm b/code/modules/lighting/planet_sunlight.dm index dc68325b7b..7b9b156b26 100644 --- a/code/modules/lighting/planet_sunlight.dm +++ b/code/modules/lighting/planet_sunlight.dm @@ -124,5 +124,5 @@ /datum/simple_sun/planetary/update() . = ..() - brightness = sun.our_brightness + brightness = CLAMP01(sun.our_brightness) color = sun.our_color diff --git a/code/modules/planet/planet.dm b/code/modules/planet/planet.dm index e19d215aa4..2b51684432 100644 --- a/code/modules/planet/planet.dm +++ b/code/modules/planet/planet.dm @@ -63,6 +63,6 @@ weather_holder.process() /datum/planet/proc/update_sun_deferred(var/new_brightness, var/new_color) - sun["brightness"] = new_brightness + sun["brightness"] = CLAMP01(new_brightness) sun["color"] = new_color needs_work |= PLANET_PROCESS_SUN