mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-29 07:59:01 +01:00
Fixes exoplanet turfs missing their light (#21632)
## About PR Carries light handling from `New()` to `Initialize()`. Also makes exoplanet theme generation handle lighting in itself, since it still didn't properly initialize the light. Gas/temperature property handling was left out because handling them in `Initialize()` was causing ZAS active edge issues for exoplanet ruins I am not entirely sure where the problem occurs, everything runs as it supposed to in proc call chain. My guess is `New()` is too early for setting up lights. Upon testing I didn't notice any changes in gas and temperature assignments in exoplanets, Odyssey and away site maps ## To-Do - [x] Look into `exoplanet_themes` and turfs affected by it, then find out why it got hands. Regular exoplanet turfs works fine, it's just this feature becoming an exception
This commit is contained in:
@@ -13,36 +13,6 @@
|
||||
var/diggable = 1
|
||||
var/dirt_color = "#7c5e42"
|
||||
|
||||
/turf/simulated/floor/exoplanet/New()
|
||||
// try to get the the atmos and area of the planet
|
||||
if(SSatlas.current_map.use_overmap)
|
||||
// if exoplanet
|
||||
var/datum/site = GLOB.map_sectors["[z]"]
|
||||
var/datum/template = GLOB.map_templates["[z]"]
|
||||
if(istype(site, /obj/effect/overmap/visitable/sector/exoplanet))
|
||||
var/obj/effect/overmap/visitable/sector/exoplanet/exoplanet = site
|
||||
if(exoplanet.atmosphere)
|
||||
initial_gas = exoplanet.atmosphere.gas.Copy()
|
||||
temperature = exoplanet.atmosphere.temperature
|
||||
else
|
||||
initial_gas = list()
|
||||
temperature = T0C
|
||||
//Must be done here, as light data is not fully carried over by ChangeTurf (but overlays are).
|
||||
set_light(MINIMUM_USEFUL_LIGHT_RANGE, exoplanet.lightlevel, exoplanet.lightcolor)
|
||||
if(exoplanet.planetary_area && istype(loc, world.area))
|
||||
change_area(loc, exoplanet.planetary_area)
|
||||
// if away site
|
||||
else if(istype(template, /datum/map_template/ruin/away_site))
|
||||
var/datum/map_template/ruin/away_site/away_site = template
|
||||
if(away_site.exoplanet_atmosphere)
|
||||
initial_gas = away_site.exoplanet_atmosphere.gas.Copy()
|
||||
temperature = away_site.exoplanet_atmosphere.temperature
|
||||
if(away_site.exoplanet_lightlevel && is_outside())
|
||||
set_light(MINIMUM_USEFUL_LIGHT_RANGE, away_site.exoplanet_lightlevel, away_site.exoplanet_lightcolor)
|
||||
|
||||
// if not on an exoplanet, instead just keep the default or mapped in atmos
|
||||
..()
|
||||
|
||||
/turf/simulated/floor/exoplanet/attackby(obj/item/attacking_item, mob/user)
|
||||
if(diggable && istype(attacking_item, /obj/item/shovel))
|
||||
visible_message(SPAN_NOTICE("\The [user] starts digging \the [src]"))
|
||||
@@ -74,11 +44,52 @@
|
||||
if(prob(40))
|
||||
ChangeTurf(get_base_turf_by_area(src))
|
||||
|
||||
/turf/simulated/floor/exoplanet/Initialize()
|
||||
. = ..()
|
||||
/turf/simulated/floor/exoplanet/New()
|
||||
footprint_color = dirt_color
|
||||
update_icon(1)
|
||||
|
||||
if(SSatlas.current_map.use_overmap)
|
||||
// if exoplanet
|
||||
var/datum/site = GLOB.map_sectors["[z]"]
|
||||
var/datum/template = GLOB.map_templates["[z]"]
|
||||
if(istype(site, /obj/effect/overmap/visitable/sector/exoplanet))
|
||||
var/obj/effect/overmap/visitable/sector/exoplanet/exoplanet = site
|
||||
if(exoplanet.atmosphere)
|
||||
initial_gas = exoplanet.atmosphere.gas.Copy()
|
||||
temperature = exoplanet.atmosphere.temperature
|
||||
else
|
||||
initial_gas = list()
|
||||
temperature = T0C
|
||||
|
||||
if(exoplanet.planetary_area && istype(loc, world.area))
|
||||
change_area(loc, exoplanet.planetary_area)
|
||||
|
||||
// if away site
|
||||
else if(istype(template, /datum/map_template/ruin/away_site))
|
||||
var/datum/map_template/ruin/away_site/away_site = template
|
||||
if(away_site.exoplanet_atmosphere)
|
||||
initial_gas = away_site.exoplanet_atmosphere.gas.Copy()
|
||||
temperature = away_site.exoplanet_atmosphere.temperature
|
||||
|
||||
..()
|
||||
|
||||
/turf/simulated/floor/exoplanet/Initialize()
|
||||
. = ..()
|
||||
if(SSatlas.current_map.use_overmap)
|
||||
// if exoplanet
|
||||
var/datum/site = GLOB.map_sectors["[z]"]
|
||||
var/datum/template = GLOB.map_templates["[z]"]
|
||||
if(istype(site, /obj/effect/overmap/visitable/sector/exoplanet))
|
||||
var/obj/effect/overmap/visitable/sector/exoplanet/exoplanet = site
|
||||
// Must be done here, as light data is not fully carried over by ChangeTurf (but overlays are).
|
||||
set_light(MINIMUM_USEFUL_LIGHT_RANGE, exoplanet.lightlevel, exoplanet.lightcolor)
|
||||
|
||||
// if away site
|
||||
else if(istype(template, /datum/map_template/ruin/away_site))
|
||||
var/datum/map_template/ruin/away_site/away_site = template
|
||||
if(away_site.exoplanet_lightlevel && is_outside())
|
||||
set_light(MINIMUM_USEFUL_LIGHT_RANGE, away_site.exoplanet_lightlevel, away_site.exoplanet_lightcolor)
|
||||
|
||||
/turf/simulated/floor/exoplanet/update_icon(var/update_neighbors)
|
||||
if(initial_flooring)
|
||||
. = ..()
|
||||
|
||||
@@ -335,13 +335,24 @@
|
||||
|
||||
CHECK_TICK
|
||||
|
||||
/datum/exoplanet_theme/proc/on_turf_generation(turf/T, area/use_area)
|
||||
/datum/exoplanet_theme/proc/on_turf_generation(turf/T, area/use_area, property_owner)
|
||||
if(use_area && istype(T.loc, world.area))
|
||||
T.change_area(T.loc, use_area) // Switch our generated turfs from world.area (space) to our chosen exoplanet area
|
||||
|
||||
if(surface_color && is_type_in_list(T, surface_turfs))
|
||||
T.color = surface_color
|
||||
|
||||
// we re-add lights here because somehow ChangeTurf() messes with lighting
|
||||
// exoplanet
|
||||
if(istype(property_owner, /obj/effect/overmap/visitable/sector/exoplanet))
|
||||
var/obj/effect/overmap/visitable/sector/exoplanet/exoplanet = property_owner
|
||||
T.set_light(MINIMUM_USEFUL_LIGHT_RANGE, exoplanet.lightlevel, exoplanet.lightcolor)
|
||||
// away_site
|
||||
else if(istype(property_owner, /datum/map_template/ruin/away_site))
|
||||
var/datum/map_template/ruin/away_site/away_site = property_owner
|
||||
if(away_site.exoplanet_lightlevel && T.is_outside())
|
||||
T.set_light(MINIMUM_USEFUL_LIGHT_RANGE, away_site.exoplanet_lightlevel, away_site.exoplanet_lightcolor)
|
||||
|
||||
var/turf/simulated/mineral/M = T
|
||||
if(use_area && istype(M))
|
||||
M.mined_turf = use_area.base_turf
|
||||
|
||||
Reference in New Issue
Block a user