Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Planet Gen Redo to make exploration more fun, two #1256

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions code/__defines/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,13 @@
//Lying animation
#define ANIM_LYING_TIME 2

//Planet habitability class
#define HABITABILITY_IDEAL 1
#define HABITABILITY_OKAY 2
#define HABITABILITY_BAD 3

//Planet habitability weight
#define HABITABILITY_LOCKED 1
#define HABITABILITY_TYPICAL 2
#define HABITABILITY_BAD 3
#define HABITABILITY_EXTREME 4


#ifndef WINDOWS_HTTP_POST_DLL_LOCATION
#define WINDOWS_HTTP_POST_DLL_LOCATION "lib/byhttp.dll"
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/simple_animal/hostile/leech.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Tiny, weak, and mostly harmless alone. dangerous in groups.
flash_vulnerability = 0 // We dont have eyes, why should we care about light?
bleed_colour = COLOR_VIOLET
color = COLOR_GRAY
min_gas = null
max_gas = null

ai_holder = /datum/ai_holder/simple_animal/melee/leech

Expand Down
16 changes: 2 additions & 14 deletions code/modules/overmap/exoplanets/_exoplanet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,7 @@ GLOBAL_VAR(planet_repopulation_disabled)
var/list/spawned_features

//Either a type or a list of types and weights. You must include all types if it's a list
var/list/habitability_distribution = list(
HABITABILITY_IDEAL = 10,
HABITABILITY_OKAY = 40,
HABITABILITY_BAD = 50
)
var/habitability_class

/obj/overmap/visitable/sector/exoplanet/proc/generate_habitability()
if (isnum(habitability_distribution))
habitability_class = habitability_distribution
else
habitability_class = pickweight_index(habitability_distribution)
var/habitability_weight = HABITABILITY_TYPICAL

/obj/overmap/visitable/sector/exoplanet/New(nloc, max_x, max_y)
if (!GLOB.using_map.use_overmap)
Expand Down Expand Up @@ -124,14 +113,13 @@ GLOBAL_VAR(planet_repopulation_disabled)
..()

/obj/overmap/visitable/sector/exoplanet/proc/build_level()
generate_habitability()
generate_atmosphere()
for (var/datum/exoplanet_theme/T in themes)
T.adjust_atmosphere(src)
if (atmosphere)
//Set up gases for living things
if (!length(breathgas))
var/list/goodgases = gas_data.gases.Copy()
var/list/goodgases = atmosphere.gas.Copy()
var/gasnum = min(rand(1,3), length(goodgases))
for (var/i = 1 to gasnum)
var/gas = pick(goodgases)
Expand Down
48 changes: 31 additions & 17 deletions code/modules/overmap/exoplanets/exoplanet_atmosphere.dm
Original file line number Diff line number Diff line change
@@ -1,47 +1,61 @@
/obj/overmap/visitable/sector/exoplanet/proc/generate_atmosphere()
atmosphere = new
if (habitability_class == HABITABILITY_IDEAL)
if (habitability_weight == HABITABILITY_LOCKED)
atmosphere.adjust_gas(GAS_OXYGEN, MOLES_O2STANDARD, 0)
atmosphere.adjust_gas(GAS_NITROGEN, MOLES_N2STANDARD)
else //let the fuckery commence
var/habitability
var/list/newgases = gas_data.gases.Copy()
if (prob(90)) //all phoron planet should be rare
newgases -= GAS_PHORON
if (prob(50)) //alium gas should be slightly less common than mundane shit
newgases -= GAS_ALIEN
newgases -= GAS_STEAM

var/total_moles = MOLES_CELLSTANDARD * rand(80,120)/100
switch(habitability_weight)
if (HABITABILITY_TYPICAL)
habitability = NORMAL_RAND
if (HABITABILITY_BAD)
habitability = LINEAR_RAND
if (HABITABILITY_EXTREME)
habitability = SQUARE_RAND
else
habitability = UNIFORM_RAND

var/total_moles = MOLES_CELLSTANDARD * (rand(7, 40) / 10)
var/generator/new_moles = generator("num", 0.15 * total_moles, 0.6 * total_moles, habitability)
var/badflag = 0

//Breathable planet
if (habitability_class == HABITABILITY_OKAY)
atmosphere.gas[GAS_OXYGEN] += MOLES_O2STANDARD
total_moles -= MOLES_O2STANDARD
badflag = XGM_GAS_FUEL|XGM_GAS_CONTAMINANT
var/gasnum = rand(max(habitability_weight - 1, 1), 4)
var/i = 0

var/gasnum = rand(1,4)
var/i = 1
var/sanity = prob(99.9)
while (i <= gasnum && total_moles && length(newgases))
if (badflag && sanity)
if (badflag)
for(var/g in newgases)
if (gas_data.flags[g] & badflag)
newgases -= g

var/ng = pick_n_take(newgases) //pick a gas
if (sanity) //make sure atmosphere is not flammable... always
if (gas_data.flags[ng] & XGM_GAS_OXIDIZER)
badflag |= XGM_GAS_FUEL
if (gas_data.flags[ng] & XGM_GAS_FUEL)

if (gas_data.flags[ng] & XGM_GAS_OXIDIZER)
badflag |= XGM_GAS_OXIDIZER
if (prob(33))
badflag |= (XGM_GAS_FUSION_FUEL | XGM_GAS_FUEL)

if ((gas_data.flags[ng] & XGM_GAS_FUEL) || (gas_data.flags[ng] & XGM_GAS_FUSION_FUEL))
badflag |= (XGM_GAS_FUSION_FUEL | XGM_GAS_FUEL)
if (prob(33))
badflag |= XGM_GAS_OXIDIZER
sanity = 0

var/part = total_moles * rand(3,80)/100 //allocate percentage to it
var/part = new_moles.Rand() //allocate percentage to it
if (i == gasnum || !length(newgases)) //if it's last gas, let it have all remaining moles
part = total_moles

atmosphere.gas[ng] += part
total_moles = max(total_moles - part, 0)
i++
atmosphere.update_values()


/obj/overmap/visitable/sector/exoplanet/proc/get_atmosphere_color()
var/list/colors = list()
Expand Down
10 changes: 3 additions & 7 deletions code/modules/overmap/exoplanets/planet_types/barren.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,19 @@
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
habitability_distribution = HABITABILITY_BAD
habitability_weight = HABITABILITY_LOCKED
has_trees = FALSE

/obj/overmap/visitable/sector/exoplanet/barren/generate_atmosphere()
..()
atmosphere.remove_ratio(0.9)
atmosphere = new

/obj/overmap/visitable/sector/exoplanet/barren/generate_flora()
if(prob(10))
flora_diversity = 1
..()
return

/datum/random_map/noise/exoplanet/barren
descriptor = "barren exoplanet"
Expand Down
17 changes: 11 additions & 6 deletions code/modules/overmap/exoplanets/planet_types/chlorine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,27 @@
ruin_tags_blacklist = RUIN_HABITAT|RUIN_WATER
surface_color = "#a3b879"
water_color = COLOR_BOTTLE_GREEN
habitability_distribution = HABITABILITY_BAD
habitability_weight = HABITABILITY_BAD
has_trees = FALSE
flora_diversity = 5
fauna_types = list(/mob/living/simple_animal/thinbug, /mob/living/simple_animal/hostile/retaliate/beast/samak/alt, /mob/living/simple_animal/yithian, /mob/living/simple_animal/tindalos, /mob/living/simple_animal/hostile/retaliate/jelly)
megafauna_types = list(/mob/living/simple_animal/hostile/retaliate/jelly/mega)
sun_brightness_modifier = 0.5 //The dense atmosphere makes it all dark

/obj/overmap/visitable/sector/exoplanet/chlorine/get_atmosphere_color()
return "#e5f2bd"
var/air_color = ..()
return MixColors("#e5f2bd", air_color)

/obj/overmap/visitable/sector/exoplanet/chlorine/generate_atmosphere()
..()
if(atmosphere)
atmosphere.adjust_gas(GAS_CHLORINE, MOLES_O2STANDARD)
atmosphere.temperature = T100C - rand(0, 100)
atmosphere.update_values()
var/chlor_moles = (rand(1, 6) / 10) * (atmosphere.total_moles)
atmosphere = atmosphere.remove(chlor_moles )
atmosphere.adjust_gas(GAS_CHLORINE, chlor_moles )

var/datum/species/H = all_species[SPECIES_HUMAN]
var/generator/new_temp = generator("num", H.cold_level_1 + 40, H.heat_level_1 + 10, UNIFORM_RAND)
atmosphere.temperature = new_temp.Rand()
atmosphere.update_values()

/datum/random_map/noise/exoplanet/chlorine
descriptor = "chlorine exoplanet"
Expand Down
13 changes: 4 additions & 9 deletions code/modules/overmap/exoplanets/planet_types/desert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
map_generators = list(/datum/random_map/noise/exoplanet/desert, /datum/random_map/noise/ore/rich)
surface_color = "#d6cca4"
water_color = null
habitability_distribution = list(HABITABILITY_IDEAL = 30, HABITABILITY_OKAY = 50, HABITABILITY_BAD = 10)
has_trees = FALSE
flora_diversity = 4
fauna_types = list(/mob/living/simple_animal/thinbug, /mob/living/simple_animal/tindalos, /mob/living/simple_animal/hostile/voxslug, /mob/living/simple_animal/hostile/retaliate/beast/antlion)
megafauna_types = list(/mob/living/simple_animal/hostile/retaliate/beast/antlion/mega)

Expand All @@ -21,13 +19,10 @@

/obj/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()
var/datum/species/H = all_species[SPECIES_HUMAN]
var/generator/new_temp = generator("num", H.heat_level_1, 2 * H.heat_level_1, NORMAL_RAND)
atmosphere.temperature = new_temp.Rand()
atmosphere.update_values()

/obj/overmap/visitable/sector/exoplanet/desert/adapt_seed(datum/seed/S)
..()
Expand Down
46 changes: 31 additions & 15 deletions code/modules/overmap/exoplanets/planet_types/grass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@
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)
habitability_distribution = list(HABITABILITY_IDEAL = 70, HABITABILITY_OKAY = 20, HABITABILITY_BAD = 5)
has_trees = TRUE
flora_diversity = 7
fauna_types = list(/mob/living/simple_animal/yithian, /mob/living/simple_animal/tindalos, /mob/living/simple_animal/hostile/retaliate/jelly)
megafauna_types = list(/mob/living/simple_animal/hostile/retaliate/parrot/space/megafauna, /mob/living/simple_animal/hostile/retaliate/goose/dire)
fauna_types = list(
/mob/living/simple_animal/yithian,
/mob/living/simple_animal/tindalos,
/mob/living/simple_animal/hostile/retaliate/jelly
)
megafauna_types = list(
/mob/living/simple_animal/hostile/retaliate/parrot/space/megafauna,
/mob/living/simple_animal/hostile/retaliate/goose/dire
)

/obj/overmap/visitable/sector/exoplanet/grass/generate_atmosphere()
..()
if(atmosphere)
atmosphere.temperature = T20C + rand(10, 30)
atmosphere.update_values()
var/datum/species/H = all_species[SPECIES_HUMAN]
var/generator/new_temp = generator("num", T0C, H.heat_level_1 - 10, UNIFORM_RAND)
atmosphere.temperature = new_temp.Rand()
atmosphere.update_values()

/obj/overmap/visitable/sector/exoplanet/grass/get_surface_color()
return grass_color
Expand Down Expand Up @@ -74,8 +80,20 @@
sun_brightness_modifier = 0.8 //Fairly bright
has_trees = TRUE
flora_diversity = 8
fauna_types = list(/mob/living/simple_animal/passive/cat, /mob/living/simple_animal/passive/chicken, /mob/living/simple_animal/passive/mouse, /mob/living/simple_animal/passive/opossum, /mob/living/simple_animal/hostile/retaliate/goat, /mob/living/simple_animal/hostile/retaliate/goose, /mob/living/simple_animal/passive/cow)
megafauna_types = list(/mob/living/simple_animal/hostile/retaliate/parrot/space/megafauna, /mob/living/simple_animal/hostile/retaliate/goose/dire)
fauna_types = list(
/mob/living/simple_animal/passive/cat,
/mob/living/simple_animal/passive/chicken,
/mob/living/simple_animal/passive/mouse,
/mob/living/simple_animal/passive/opossum,
/mob/living/simple_animal/hostile/retaliate/goat,
/mob/living/simple_animal/hostile/retaliate/goose,
/mob/living/simple_animal/passive/cow
)
megafauna_types = list(
/mob/living/simple_animal/hostile/retaliate/parrot/space/megafauna,
/mob/living/simple_animal/hostile/retaliate/goose/dire
)
habitability_weight = HABITABILITY_LOCKED

//Animals being named alien creature is a bit odd as these would just be earth transplants
species = list( /mob/living/simple_animal/passive/cat = "wild cat",
Expand All @@ -86,14 +104,12 @@
/mob/living/simple_animal/hostile/retaliate/goose = "goose",
/mob/living/simple_animal/passive/cow = "wild cow")

/obj/overmap/visitable/sector/exoplanet/grass/terraformed/generate_habitability()
habitability_class = HABITABILITY_IDEAL

/obj/overmap/visitable/sector/exoplanet/grass/terraformed/generate_atmosphere()
..()
if(atmosphere)
atmosphere.temperature = T0C + rand(0, 50)
atmosphere.update_values()
var/datum/species/H = all_species[SPECIES_HUMAN]
var/generator/new_temp = generator("num", T20C, H.heat_level_1 - 15)
atmosphere.temperature = new_temp.Rand()
atmosphere.update_values()

/datum/random_map/noise/exoplanet/grass/terraformed
descriptor = "terraformed grass exoplanet"
Expand Down
21 changes: 11 additions & 10 deletions code/modules/overmap/exoplanets/planet_types/shrouded.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@
sun_brightness_modifier = -0.5
surface_color = "#3e3960"
water_color = "#2b2840"
has_trees = TRUE
flora_diversity = 4
fauna_types = list(/mob/living/simple_animal/hostile/retaliate/royalcrab,
/mob/living/simple_animal/hostile/retaliate/jelly/alt,
/mob/living/simple_animal/hostile/retaliate/beast/shantak/alt,
/mob/living/simple_animal/hostile/leech)
fauna_types = list(
/mob/living/simple_animal/hostile/retaliate/royalcrab,
/mob/living/simple_animal/hostile/retaliate/jelly/alt,
/mob/living/simple_animal/hostile/retaliate/beast/shantak/alt,
/mob/living/simple_animal/hostile/leech
)


/obj/overmap/visitable/sector/exoplanet/shrouded/generate_atmosphere()
..()
if(atmosphere)
atmosphere.temperature = T20C - rand(10, 20)
if (atmosphere)
atmosphere.temperature = rand(T0C, T20C)
atmosphere.update_values()

/obj/overmap/visitable/sector/exoplanet/shrouded/get_atmosphere_color()
return COLOR_BLACK
var/air_color = ..()
return MixColors(COLOR_BLACK, air_color)

/datum/random_map/noise/exoplanet/shrouded
descriptor = "shrouded exoplanet"
Expand All @@ -41,7 +42,7 @@
/datum/random_map/noise/exoplanet/shrouded/get_additional_spawns(value, turf/T)
..()

if(prob(0.1))
if (prob(0.1))
new/obj/structure/leech_spawner(T)

/area/exoplanet/shrouded
Expand Down
21 changes: 10 additions & 11 deletions code/modules/overmap/exoplanets/planet_types/snow.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,20 @@
map_generators = list(/datum/random_map/noise/exoplanet/snow, /datum/random_map/noise/ore/poor)
surface_color = "#e8faff"
water_color = "#b5dfeb"
habitability_distribution = list(HABITABILITY_IDEAL = 30, HABITABILITY_OKAY = 50, HABITABILITY_BAD = 10)
has_trees = TRUE
flora_diversity = 4
fauna_types = list(/mob/living/simple_animal/hostile/retaliate/beast/samak, /mob/living/simple_animal/hostile/retaliate/beast/diyaab, /mob/living/simple_animal/hostile/retaliate/beast/shantak)
habitability_weight = HABITABILITY_BAD
fauna_types = list(
/mob/living/simple_animal/hostile/retaliate/beast/samak,
/mob/living/simple_animal/hostile/retaliate/beast/diyaab,
/mob/living/simple_animal/hostile/retaliate/beast/shantak
)
megafauna_types = list(/mob/living/simple_animal/hostile/retaliate/giant_crab)

/obj/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()
var/datum/species/H = all_species[SPECIES_HUMAN]
var/generator/new_temp = generator("num", H.cold_level_1 - 50, H.cold_level_3, NORMAL_RAND)
atmosphere.temperature = new_temp.Rand()
atmosphere.update_values()

/datum/random_map/noise/exoplanet/snow
descriptor = "snow exoplanet"
Expand Down
Loading