mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 04:22:39 +01:00
Overmap exoplanet generation, ported from Bay. (#12362)
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
/datum/map_template
|
||||
var/name = "Default Template Name"
|
||||
var/id = null // All maps that should be loadable during runtime need an id
|
||||
var/width = 0
|
||||
var/height = 0
|
||||
var/mappath = null
|
||||
var/loaded = 0 // Times loaded this round
|
||||
var/static/dmm_suite/maploader = new
|
||||
var/list/shuttles_to_initialise = list()
|
||||
var/list/subtemplates_to_spawn
|
||||
var/base_turf_for_zs = null
|
||||
var/accessibility_weight = 0
|
||||
var/template_flags = TEMPLATE_FLAG_ALLOW_DUPLICATES
|
||||
|
||||
/datum/map_template/New(path = null, rename = null)
|
||||
if(path)
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/barren
|
||||
name = "barren exoplanet"
|
||||
desc = "An exoplanet that couldn't hold its atmosphere."
|
||||
color = "#6c6c6c"
|
||||
planetary_area = /area/exoplanet/barren
|
||||
rock_colors = list(COLOR_BEIGE, COLOR_GRAY80, COLOR_BROWN)
|
||||
possible_themes = list(/datum/exoplanet_theme/mountains)
|
||||
map_generators = list(/datum/random_map/noise/exoplanet/barren, /datum/random_map/noise/ore/rich)
|
||||
ruin_tags_blacklist = RUIN_HABITAT|RUIN_WATER
|
||||
features_budget = 6
|
||||
surface_color = "#807d7a"
|
||||
water_color = null
|
||||
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/barren/generate_habitability()
|
||||
return HABITABILITY_BAD
|
||||
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/barren/generate_atmosphere()
|
||||
..()
|
||||
atmosphere.remove_ratio(0.9)
|
||||
|
||||
/datum/random_map/noise/exoplanet/barren
|
||||
descriptor = "barren exoplanet"
|
||||
smoothing_iterations = 4
|
||||
land_type = /turf/simulated/floor/exoplanet/barren
|
||||
flora_prob = 0.1
|
||||
flora_diversity = 0
|
||||
fauna_prob = 0
|
||||
|
||||
/datum/random_map/noise/exoplanet/barren/New()
|
||||
if(prob(10))
|
||||
flora_diversity = 1
|
||||
..()
|
||||
|
||||
/turf/simulated/floor/exoplanet/barren
|
||||
name = "ground"
|
||||
icon = 'icons/turf/flooring/asteroid.dmi'
|
||||
icon_state = "asteroid"
|
||||
|
||||
/turf/simulated/floor/exoplanet/barren/update_icon()
|
||||
overlays.Cut()
|
||||
if(prob(20))
|
||||
overlays += image('icons/turf/flooring/decals.dmi', "asteroid[rand(0,9)]")
|
||||
|
||||
/turf/simulated/floor/exoplanet/barren/Initialize()
|
||||
. = ..()
|
||||
update_icon()
|
||||
|
||||
/area/exoplanet/barren
|
||||
name = "\improper Planetary surface"
|
||||
ambience = list('sound/effects/wind/wind_2_1.ogg','sound/effects/wind/wind_2_2.ogg','sound/effects/wind/wind_3_1.ogg','sound/effects/wind/wind_4_1.ogg','sound/effects/wind/wind_4_2.ogg','sound/effects/wind/wind_5_1.ogg')
|
||||
base_turf = /turf/simulated/floor/exoplanet/barren
|
||||
@@ -0,0 +1,155 @@
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/desert
|
||||
name = "desert exoplanet"
|
||||
desc = "An arid exoplanet with sparse biological resources but rich mineral deposits underground."
|
||||
color = "#a08444"
|
||||
planetary_area = /area/exoplanet/desert
|
||||
rock_colors = list(COLOR_BEIGE, COLOR_PALE_YELLOW, COLOR_GRAY80, COLOR_BROWN)
|
||||
plant_colors = list("#efdd6f","#7b4a12","#e49135","#ba6222","#5c755e","#420d22")
|
||||
map_generators = list(/datum/random_map/noise/exoplanet/desert)
|
||||
surface_color = "#d6cca4"
|
||||
water_color = null
|
||||
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/desert/generate_map()
|
||||
if(prob(70))
|
||||
lightlevel = rand(5,10)/10 //deserts are usually :lit:
|
||||
..()
|
||||
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/desert/generate_atmosphere()
|
||||
..()
|
||||
if(atmosphere)
|
||||
var/limit = 1000
|
||||
if(habitability_class <= HABITABILITY_OKAY)
|
||||
var/datum/species/human/H = /datum/species/human
|
||||
limit = initial(H.heat_level_1) - rand(1,10)
|
||||
atmosphere.temperature = min(T20C + rand(20, 100), limit)
|
||||
atmosphere.update_values()
|
||||
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/desert/adapt_seed(var/datum/seed/S)
|
||||
..()
|
||||
if(prob(90))
|
||||
S.set_trait(TRAIT_REQUIRES_WATER,0)
|
||||
else
|
||||
S.set_trait(TRAIT_REQUIRES_WATER,1)
|
||||
S.set_trait(TRAIT_WATER_CONSUMPTION,1)
|
||||
if(prob(75))
|
||||
S.set_trait(TRAIT_STINGS,1)
|
||||
if(prob(75))
|
||||
S.set_trait(TRAIT_CARNIVOROUS,2)
|
||||
S.set_trait(TRAIT_SPREAD,0)
|
||||
|
||||
/datum/random_map/noise/exoplanet/desert
|
||||
descriptor = "desert exoplanet"
|
||||
smoothing_iterations = 4
|
||||
land_type = /turf/simulated/floor/exoplanet/desert
|
||||
|
||||
flora_prob = 5
|
||||
flora_diversity = 4
|
||||
fauna_types = list(/mob/living/simple_animal/thinbug, /mob/living/simple_animal/tindalos)
|
||||
|
||||
/datum/random_map/noise/exoplanet/desert/get_additional_spawns(var/value, var/turf/T)
|
||||
..()
|
||||
if(is_edge_turf(T))
|
||||
return
|
||||
var/v = noise2value(value)
|
||||
if(v > 6)
|
||||
T.icon_state = "desert[v-1]"
|
||||
if(prob(10))
|
||||
new/obj/structure/quicksand(T)
|
||||
|
||||
/area/exoplanet/desert
|
||||
ambience = list('sound/effects/wind/desert0.ogg','sound/effects/wind/desert1.ogg','sound/effects/wind/desert2.ogg','sound/effects/wind/desert3.ogg','sound/effects/wind/desert4.ogg','sound/effects/wind/desert5.ogg')
|
||||
base_turf = /turf/simulated/floor/exoplanet/desert
|
||||
|
||||
/obj/structure/quicksand
|
||||
name = "sand"
|
||||
icon = 'icons/obj/quicksand.dmi'
|
||||
icon_state = "intact0"
|
||||
density = 0
|
||||
anchored = 1
|
||||
can_buckle = 1
|
||||
buckle_dir = SOUTH
|
||||
var/exposed = 0
|
||||
var/busy
|
||||
|
||||
/obj/structure/quicksand/New()
|
||||
icon_state = "intact[rand(0,2)]"
|
||||
..()
|
||||
|
||||
/obj/structure/quicksand/user_unbuckle(mob/user)
|
||||
if(buckled && !user.stat && !user.restrained())
|
||||
if(busy)
|
||||
to_chat(user, "<span class='wanoticerning'>[buckled] is already getting out, be patient.</span>")
|
||||
return
|
||||
var/delay = 60
|
||||
if(user == buckled)
|
||||
delay *=2
|
||||
user.visible_message(
|
||||
"<span class='notice'>\The [user] tries to climb out of \the [src].</span>",
|
||||
"<span class='notice'>You begin to pull yourself out of \the [src].</span>",
|
||||
"<span class='notice'>You hear water sloushing.</span>"
|
||||
)
|
||||
else
|
||||
user.visible_message(
|
||||
"<span class='notice'>\The [user] begins pulling \the [buckled] out of \the [src].</span>",
|
||||
"<span class='notice'>You begin to pull \the [buckled] out of \the [src].</span>",
|
||||
"<span class='notice'>You hear water sloushing.</span>"
|
||||
)
|
||||
busy = 1
|
||||
if(do_after(user, delay, src))
|
||||
busy = 0
|
||||
if(user == buckled)
|
||||
if(prob(80))
|
||||
to_chat(user, "<span class='warning'>You slip and fail to get out!</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>\The [buckled] pulls himself out of \the [src].</span>")
|
||||
else
|
||||
user.visible_message("<span class='notice'>\The [buckled] has been freed from \the [src] by \the [user].</span>")
|
||||
unbuckle()
|
||||
else
|
||||
busy = 0
|
||||
to_chat(user, "<span class='warning'>You slip and fail to get out!</span>")
|
||||
return
|
||||
|
||||
/obj/structure/quicksand/unbuckle()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
/obj/structure/quicksand/buckle(var/mob/L)
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
/obj/structure/quicksand/update_icon()
|
||||
if(!exposed)
|
||||
return
|
||||
icon_state = "open"
|
||||
overlays.Cut()
|
||||
if(buckled)
|
||||
overlays += buckled
|
||||
var/image/I = image(icon,icon_state="overlay")
|
||||
I.layer = ABOVE_MOB_LAYER
|
||||
overlays += I
|
||||
|
||||
/obj/structure/quicksand/proc/expose()
|
||||
if(exposed)
|
||||
return
|
||||
visible_message("<span class='warning'>The upper crust breaks, exposing treacherous quicksands underneath!</span>")
|
||||
name = "quicksand"
|
||||
desc = "There is no candy at the bottom."
|
||||
exposed = 1
|
||||
update_icon()
|
||||
|
||||
/obj/structure/quicksand/attackby(obj/item/W, mob/user)
|
||||
if(!exposed && W.force)
|
||||
expose()
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/structure/quicksand/Crossed(var/atom/movable/AM)
|
||||
if(isliving(AM))
|
||||
var/mob/living/L = AM
|
||||
if(L.throwing)
|
||||
return
|
||||
buckle(L)
|
||||
if(!exposed)
|
||||
expose()
|
||||
to_chat(L, SPAN_DANGER("You fall into \the [src]!"))
|
||||
@@ -0,0 +1,60 @@
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/grass
|
||||
name = "lush exoplanet"
|
||||
desc = "Planet with abundant flora and fauna."
|
||||
color = "#407c40"
|
||||
planetary_area = /area/exoplanet/grass
|
||||
rock_colors = list(COLOR_ASTEROID_ROCK, COLOR_GRAY80, COLOR_BROWN)
|
||||
plant_colors = list("#0e1e14","#1a3e38","#5a7467","#9eab88","#6e7248", "RANDOM")
|
||||
map_generators = list(/datum/random_map/noise/exoplanet/grass)
|
||||
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/grass/generate_map()
|
||||
if(prob(40))
|
||||
lightlevel = rand(1,7)/10 //give a chance of twilight jungle
|
||||
..()
|
||||
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/grass/generate_atmosphere()
|
||||
..()
|
||||
if(atmosphere)
|
||||
atmosphere.temperature = T20C + rand(10, 30)
|
||||
atmosphere.update_values()
|
||||
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/grass/get_surface_color()
|
||||
return grass_color
|
||||
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/grass/adapt_seed(var/datum/seed/S)
|
||||
..()
|
||||
var/carnivore_prob = rand(100)
|
||||
if(carnivore_prob < 30)
|
||||
S.set_trait(TRAIT_CARNIVOROUS,2)
|
||||
if(prob(75))
|
||||
S.get_trait(TRAIT_STINGS, 1)
|
||||
else if(carnivore_prob < 60)
|
||||
S.set_trait(TRAIT_CARNIVOROUS,1)
|
||||
if(prob(50))
|
||||
S.get_trait(TRAIT_STINGS)
|
||||
if(prob(15) || (S.get_trait(TRAIT_CARNIVOROUS) && prob(40)))
|
||||
S.set_trait(TRAIT_BIOLUM,1)
|
||||
S.set_trait(TRAIT_BIOLUM_COLOUR,get_random_colour(0,75,190))
|
||||
|
||||
if(prob(30))
|
||||
S.set_trait(TRAIT_PARASITE,1)
|
||||
|
||||
/area/exoplanet/grass
|
||||
base_turf = /turf/simulated/floor/exoplanet/grass
|
||||
ambience = list('sound/effects/wind/wind_2_1.ogg','sound/effects/wind/wind_2_2.ogg','sound/effects/wind/wind_3_1.ogg','sound/effects/wind/wind_4_1.ogg','sound/ambience/eeriejungle2.ogg','sound/ambience/eeriejungle1.ogg')
|
||||
|
||||
/area/exoplanet/grass/play_ambience(var/mob/living/L)
|
||||
..()
|
||||
if(!L.ear_deaf && L.client && !L.client.ambience_playing)
|
||||
L.client.ambience_playing = 1
|
||||
L.playsound_to(get_turf(L),sound('sound/ambience/jungle.ogg', repeat = 1, wait = 0, volume = 25))
|
||||
|
||||
/datum/random_map/noise/exoplanet/grass
|
||||
descriptor = "grass exoplanet"
|
||||
smoothing_iterations = 2
|
||||
land_type = /turf/simulated/floor/exoplanet/grass
|
||||
water_type = /turf/simulated/floor/exoplanet/water/shallow
|
||||
|
||||
flora_prob = 10
|
||||
flora_diversity = 6
|
||||
fauna_types = list(/mob/living/simple_animal/yithian, /mob/living/simple_animal/tindalos, /mob/living/simple_animal/cosmozoan)
|
||||
@@ -0,0 +1,33 @@
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/snow
|
||||
name = "snow exoplanet"
|
||||
desc = "Cold planet with limited plant life."
|
||||
color = "#dcdcdc"
|
||||
planetary_area = /area/exoplanet/snow
|
||||
rock_colors = list(COLOR_DARK_BLUE_GRAY, COLOR_GUNMETAL, COLOR_GRAY80, COLOR_DARK_GRAY)
|
||||
plant_colors = list("#d0fef5","#93e1d8","#93e1d8", "#b2abbf", "#3590f3", "#4b4e6d")
|
||||
map_generators = list(/datum/random_map/noise/exoplanet/snow)
|
||||
surface_color = "#e8faff"
|
||||
water_color = "#b5dfeb"
|
||||
|
||||
/obj/effect/overmap/visitable/sector/exoplanet/snow/generate_atmosphere()
|
||||
..()
|
||||
if(atmosphere)
|
||||
var/limit = 0
|
||||
if(habitability_class <= HABITABILITY_OKAY)
|
||||
var/datum/species/human/H = /datum/species/human
|
||||
limit = initial(H.cold_level_1) + rand(1,10)
|
||||
atmosphere.temperature = max(T0C - rand(10, 100), limit)
|
||||
atmosphere.update_values()
|
||||
|
||||
/datum/random_map/noise/exoplanet/snow
|
||||
descriptor = "snow exoplanet"
|
||||
smoothing_iterations = 1
|
||||
flora_prob = 5
|
||||
water_level_max = 3
|
||||
land_type = /turf/simulated/floor/exoplanet/snow
|
||||
water_type = /turf/simulated/floor/exoplanet/ice
|
||||
fauna_types = list(/mob/living/simple_animal/hostile/retaliate/samak, /mob/living/simple_animal/hostile/retaliate/diyaab, /mob/living/simple_animal/hostile/retaliate/shantak)
|
||||
|
||||
/area/exoplanet/snow
|
||||
ambience = list('sound/effects/wind/tundra0.ogg','sound/effects/wind/tundra1.ogg','sound/effects/wind/tundra2.ogg','sound/effects/wind/spooky0.ogg','sound/effects/wind/spooky1.ogg')
|
||||
base_turf = /turf/simulated/floor/exoplanet/snow
|
||||
@@ -0,0 +1,85 @@
|
||||
var/list/banned_ruin_ids = list()
|
||||
|
||||
/proc/seedRuins(list/zlevels, budget, list/potentialRuins, allowed_area = /area/space, var/maxx = world.maxx, var/maxy = world.maxy)
|
||||
if (!length(zlevels))
|
||||
UNLINT(WARNING("No Z levels provided - Not generating ruins"))
|
||||
return
|
||||
|
||||
for (var/z in zlevels)
|
||||
var/turf/check = locate(1, 1, z)
|
||||
if (!check)
|
||||
UNLINT(WARNING("Z level [z] does not exist - Not generating ruins"))
|
||||
return
|
||||
|
||||
var/list/available = list()
|
||||
var/list/selected = list()
|
||||
var/remaining = budget
|
||||
|
||||
for(var/datum/map_template/ruin/ruin in potentialRuins)
|
||||
if (ruin.id in banned_ruin_ids)
|
||||
continue
|
||||
if(!(SSatlas.current_sector.name in ruin.sectors) && !length(ruin.sectors))
|
||||
continue
|
||||
available[ruin] = ruin.spawn_weight
|
||||
|
||||
if (!length(available))
|
||||
UNLINT(WARNING("No ruins available - Not generating ruins"))
|
||||
|
||||
while (remaining > 0 && length(available))
|
||||
var/datum/map_template/ruin/ruin = pickweight(available)
|
||||
if (ruin.cost > budget)
|
||||
available -= ruin
|
||||
continue
|
||||
|
||||
var/width = TRANSITIONEDGE + RUIN_MAP_EDGE_PAD + round(ruin.width / 2)
|
||||
var/height = TRANSITIONEDGE + RUIN_MAP_EDGE_PAD + round(ruin.height / 2)
|
||||
if (width > maxx - width || height > maxy - height)
|
||||
available -= ruin
|
||||
continue
|
||||
|
||||
for (var/attempts = 20, attempts > 0, --attempts)
|
||||
var/z = pick(zlevels)
|
||||
var/turf/choice = locate(rand(width, maxx - width), rand(height, maxy - height), z)
|
||||
|
||||
var/valid = TRUE
|
||||
for (var/turf/check in ruin.get_affected_turfs(choice, 1))
|
||||
var/area/check_area = get_area(check)
|
||||
if (!istype(check_area, allowed_area) || check.flags & TURF_NORUINS)
|
||||
if (attempts == 1)
|
||||
available -= ruin
|
||||
valid = FALSE
|
||||
break
|
||||
if (!valid)
|
||||
continue
|
||||
|
||||
log_admin("Ruin \"[ruin.name]\" placed at ([choice.x], [choice.y], [choice.z])")
|
||||
|
||||
load_ruin(choice, ruin)
|
||||
selected += ruin
|
||||
if (ruin.cost > 0)
|
||||
remaining -= ruin.cost
|
||||
if (!(ruin.template_flags & TEMPLATE_FLAG_ALLOW_DUPLICATES))
|
||||
banned_ruin_ids += ruin.id
|
||||
available -= ruin
|
||||
break
|
||||
|
||||
if (remaining)
|
||||
log_admin("Ruin loader had no ruins to pick from with [budget] left to spend.")
|
||||
|
||||
if (length(selected))
|
||||
log_debug("Finished selecting planet ruins ([english_list(selected)]) for [budget - remaining] cost of [budget] budget.")
|
||||
|
||||
return selected
|
||||
|
||||
/proc/load_ruin(turf/central_turf, datum/map_template/template)
|
||||
if(!template)
|
||||
return FALSE
|
||||
for(var/i in template.get_affected_turfs(central_turf, 1))
|
||||
var/turf/T = i
|
||||
for(var/mob/living/simple_animal/monster in T)
|
||||
qdel(monster)
|
||||
template.load(central_turf,centered = TRUE)
|
||||
var/datum/map_template/ruin = template
|
||||
if(istype(ruin))
|
||||
new /obj/effect/landmark/ruin(central_turf, ruin)
|
||||
return TRUE
|
||||
Reference in New Issue
Block a user