Fix exoplanet theming and lighting (#15083)

This commit is contained in:
Wildkins
2022-11-12 22:41:52 +01:00
committed by GitHub
parent b8677824ff
commit 158d7f68e2
10 changed files with 83 additions and 32 deletions
+6 -5
View File
@@ -34,7 +34,7 @@
var/repopulate_types = list() // animals which have died that may come back
var/list/possible_themes = list(/datum/exoplanet_theme)
var/list/themes = list()
var/datum/exoplanet_theme/theme
var/list/map_generators = list()
@@ -74,7 +74,7 @@
if(LAZYLEN(possible_themes))
var/datum/exoplanet_theme/T = pick(possible_themes)
themes += new T
theme = new T
for(var/T in subtypesof(/datum/map_template/ruin/exoplanet))
var/datum/map_template/ruin/exoplanet/ruin = T
@@ -172,8 +172,9 @@
if(length(grasscolors))
grass_color = pick(grasscolors)
for(var/datum/exoplanet_theme/T as anything in themes)
T.before_map_generation(src)
if(istype(theme))
theme.before_map_generation(src)
for (var/zlevel in map_z)
var/list/edges
edges += block(locate(1, 1, zlevel), locate(TRANSITIONEDGE, maxy, zlevel))
@@ -185,7 +186,7 @@
var/padding = TRANSITIONEDGE
for (var/map_type in map_generators)
if (ispath(map_type, /datum/random_map/noise/exoplanet))
new map_type(null,padding,padding,zlevel,maxx-padding,maxy-padding,0,1,1,planetary_area, plant_colors)
new map_type(null,padding,padding,zlevel,maxx-padding,maxy-padding,0,1,1,planetary_area, plant_colors, theme)
else
new map_type(null,1,1,zlevel,maxx,maxy,0,1,1,planetary_area)
@@ -11,7 +11,7 @@
skybox_image.overlays += get_base_image()
for (var/datum/exoplanet_theme/theme in themes)
if(istype(theme))
skybox_image.overlays += theme.get_planet_image_extra()
if (water_color) //TODO: move water levels out of randommap into exoplanet
@@ -7,6 +7,7 @@
var/water_level_max = 5
var/land_type = /turf/simulated/floor
var/water_type
var/datum/exoplanet_theme/planet_theme
//intended x*y size, used to adjust spawn probs
var/intended_x = 150
@@ -22,7 +23,7 @@
var/list/plantcolors = list("RANDOM")
var/list/grass_cache
/datum/random_map/noise/exoplanet/New(var/seed, var/tx, var/ty, var/tz, var/tlx, var/tly, var/do_not_apply, var/do_not_announce, var/never_be_priority = 0, var/used_area, var/list/_plant_colors)
/datum/random_map/noise/exoplanet/New(var/seed, var/tx, var/ty, var/tz, var/tlx, var/tly, var/do_not_apply, var/do_not_announce, var/never_be_priority = 0, var/used_area, var/list/_plant_colors, var/datum/exoplanet_theme/_planet_theme)
log_debug("Generating Random Exoplanet Map with tx: [tx], ty: [ty], tz: [tz], tlx: [tlx], tly: [tly]")
target_turf_type = world.turf
water_level = rand(water_level_min,water_level_max)
@@ -32,6 +33,8 @@
fauna_prob *= size_mod
if(_plant_colors)
plantcolors = _plant_colors
if(istype(_planet_theme))
planet_theme = _planet_theme
generate_flora()
..()
@@ -52,6 +55,8 @@
return land_type
/datum/random_map/noise/exoplanet/get_additional_spawns(var/value, var/turf/T)
if(istype(planet_theme))
planet_theme.on_turf_generation(T, use_area)
if(is_edge_turf(T))
return
if(T.is_wall())
+29 -24
View File
@@ -1,37 +1,46 @@
/datum/exoplanet_theme
var/name = "Nothing Special"
var/list/surface_turfs = list()
var/surface_color
/datum/exoplanet_theme/proc/before_map_generation(obj/effect/overmap/visitable/sector/exoplanet/E)
if(E.rock_colors)
surface_color = pick(E.rock_colors)
/datum/exoplanet_theme/proc/on_turf_generation(turf/T, var/area/use_area)
if(surface_color && is_type_in_list(T, surface_turfs))
T.color = surface_color
/datum/exoplanet_theme/proc/get_planet_image_extra()
/datum/exoplanet_theme/mountains
name = "Mountains"
var/rock_color
surface_turfs = list(
/turf/simulated/mineral,
/turf/unsimulated/floor/asteroid/ash
)
var/cave_path = /datum/random_map/automata/cave_system/mountains
/datum/exoplanet_theme/mountains/get_planet_image_extra()
var/image/res = image('icons/skybox/planet.dmi', "mountains")
res.color = rock_color
res.color = surface_color
return res
/datum/exoplanet_theme/mountains/before_map_generation(obj/effect/overmap/visitable/sector/exoplanet/E)
if(E.rock_colors)
rock_color = pick(E.rock_colors)
..()
for(var/zlevel in E.map_z)
new /datum/random_map/automata/cave_system/mountains(null,TRANSITIONEDGE,TRANSITIONEDGE,zlevel,E.maxx-TRANSITIONEDGE,E.maxy-TRANSITIONEDGE,0,1,1, E.planetary_area, rock_color)
new cave_path(null,TRANSITIONEDGE,TRANSITIONEDGE,zlevel,E.maxx-TRANSITIONEDGE,E.maxy-TRANSITIONEDGE,0,1,1, E.planetary_area, src)
/datum/exoplanet_theme/mountains/phoron/before_map_generation(obj/effect/overmap/visitable/sector/exoplanet/E)
if(E.rock_colors)
rock_color = pick(E.rock_colors)
for(var/zlevel in E.map_z)
new /datum/random_map/automata/cave_system/mountains/phoron(null,TRANSITIONEDGE,TRANSITIONEDGE,zlevel,E.maxx-TRANSITIONEDGE,E.maxy-TRANSITIONEDGE,0,1,1, E.planetary_area, rock_color)
/datum/exoplanet_theme/mountains/on_turf_generation(turf/simulated/mineral/T, var/area/use_area)
..()
if(use_area && istype(T))
T.mined_turf = use_area.base_turf
/datum/exoplanet_theme/mountains/breathable/before_map_generation(obj/effect/overmap/visitable/sector/exoplanet/E)
if(E.rock_colors)
rock_color = pick(E.rock_colors)
for(var/zlevel in E.map_z)
new /datum/random_map/automata/cave_system/mountains/breathable(null,TRANSITIONEDGE,TRANSITIONEDGE,zlevel,E.maxx-TRANSITIONEDGE,E.maxy-TRANSITIONEDGE,0,1,1, E.planetary_area, rock_color)
/datum/exoplanet_theme/mountains/phoron
cave_path = /datum/random_map/automata/cave_system/mountains/phoron
/datum/exoplanet_theme/mountains/breathable
cave_path = /datum/random_map/automata/cave_system/mountains/breathable
/datum/random_map/automata/cave_system/mountains
iterations = 2
@@ -51,16 +60,12 @@
floor_type = /turf/simulated/floor/exoplanet/mineral
use_area = FALSE
/datum/random_map/automata/cave_system/mountains/New(var/seed, var/tx, var/ty, var/tz, var/tlx, var/tly, var/do_not_apply, var/do_not_announce, var/never_be_priority = 0, var/used_area, var/_rock_color)
if(_rock_color)
rock_color = _rock_color
/datum/random_map/automata/cave_system/mountains/New(var/seed, var/tx, var/ty, var/tz, var/tlx, var/tly, var/do_not_apply, var/do_not_announce, var/never_be_priority = 0, var/used_area, var/datum/exoplanet_theme/_theme)
if(_theme)
planet_theme = _theme
target_turf_type = world.turf
floor_type = world.turf
..()
/datum/random_map/automata/cave_system/mountains/get_additional_spawns(value, var/turf/simulated/mineral/T)
if(rock_color)
T.color = rock_color
if(use_area)
if(istype(T))
T.mined_turf = use_area.base_turf
/datum/random_map/automata/cave_system/mountains/get_additional_spawns(value, turf/T)
planet_theme.on_turf_generation(T, use_area)
+1 -1
View File
@@ -17,7 +17,7 @@
else
temperature = T0C
//Must be done here, as light data is not fully carried over by ChangeTurf (but overlays are).
set_light(E.lightlevel, 0.1, 2)
set_light(MINIMUM_USEFUL_LIGHT_RANGE, E.lightlevel, COLOR_WHITE)
if(E.planetary_area && istype(loc, world.area))
ChangeArea(src, E.planetary_area)
..()