From 57f612f57d6802eadf9819a37273a4202cc95393 Mon Sep 17 00:00:00 2001 From: RustingWithYou Date: Thu, 6 Jun 2024 17:09:26 +1200 Subject: [PATCH] planet forcing & banning --- .../background/space_sectors/space_sector.dm | 2 + .../maps/planet_types/lore/uueoaesa.dm | 2 + code/modules/overmap/exoplanets/exoplanet.dm | 4 ++ .../RustingWithYou - planetbanning.yml | 59 +++++++++++++++++++ maps/_common/mapsystem/map.dm | 23 ++++++++ maps/away/away_sites.dm | 4 ++ 6 files changed, 94 insertions(+) create mode 100644 html/changelogs/RustingWithYou - planetbanning.yml diff --git a/code/modules/background/space_sectors/space_sector.dm b/code/modules/background/space_sectors/space_sector.dm index a8345f605b4..211bd668ddd 100644 --- a/code/modules/background/space_sectors/space_sector.dm +++ b/code/modules/background/space_sectors/space_sector.dm @@ -12,6 +12,8 @@ var/list/possible_exoplanets = list(/obj/effect/overmap/visitable/sector/exoplanet/snow, /obj/effect/overmap/visitable/sector/exoplanet/desert) ///Guaranteed planets to spawn. This ignores the map exoplanet limit, so don't put too many planets in here. var/list/guaranteed_exoplanets = list() + ///Banned exoplanets. These will be removed from the possible exoplanets list. + var/list/banned_exoplanets = list() var/list/cargo_price_coef = list("nt" = 1, "hpi" = 1, "zhu" = 1, "een" = 1, "get" = 1, "arz" = 1, "blm" = 1, "iac" = 1, "zsc" = 1, "vfc" = 1, "bis" = 1, "xmg" = 1, "npi" = 1) //how much the space sector afffects how expensive is ordering from that cargo supplier var/skybox_icon = "ceti" diff --git a/code/modules/maps/planet_types/lore/uueoaesa.dm b/code/modules/maps/planet_types/lore/uueoaesa.dm index e80d927af44..93e83052ac6 100644 --- a/code/modules/maps/planet_types/lore/uueoaesa.dm +++ b/code/modules/maps/planet_types/lore/uueoaesa.dm @@ -141,6 +141,7 @@ ruin_type_whitelist = list(/datum/map_template/ruin/exoplanet/moghes_village) //defaults to village bc for some reason nothing spawns if this is empty place_near_main = list(2,2) actors = list("reptilian humanoid", "three-faced reptilian humanoid", "a statue", "a sword", "an unidentifiable object", "an Unathi skull", "a staff", "a fishing spear", "reptilian humanoids", "unusual devices", "a pyramid") + banned_exoplanets = list(/obj/effect/overmap/visitable/sector/exoplanet/ouerea) var/landing_region /obj/effect/overmap/visitable/sector/exoplanet/moghes/pre_ruin_preparation() @@ -293,6 +294,7 @@ /datum/map_template/ruin/exoplanet/ouerea_threshbeast_herd ) place_near_main = list(2,2) + banned_exoplanets = list(/obj/effect/overmap/visitable/sector/exoplanet/moghes) /obj/effect/overmap/visitable/sector/exoplanet/ouerea/generate_habitability() return HABITABILITY_IDEAL diff --git a/code/modules/overmap/exoplanets/exoplanet.dm b/code/modules/overmap/exoplanets/exoplanet.dm index 7570d619c41..3eab2b376a8 100644 --- a/code/modules/overmap/exoplanets/exoplanet.dm +++ b/code/modules/overmap/exoplanets/exoplanet.dm @@ -83,6 +83,10 @@ ///A list of groups, as strings, that this exoplanet belongs to. When adding new map templates, try to keep this balanced on the CI execution time, or consider adding a new one ///ONLY IF IT'S THE LONGEST RUNNING CI POD AND THEY ARE ALREADY BALANCED var/list/unit_test_groups = list() + ///For mutually exclusive exoplanet types + var/list/banned_exoplanets = list() + ///For guaranteed exoplanet types + var/list/guaranteed_exoplanets = list() /obj/effect/overmap/visitable/sector/exoplanet/proc/generate_habitability() diff --git a/html/changelogs/RustingWithYou - planetbanning.yml b/html/changelogs/RustingWithYou - planetbanning.yml new file mode 100644 index 00000000000..d83a03f0e67 --- /dev/null +++ b/html/changelogs/RustingWithYou - planetbanning.yml @@ -0,0 +1,59 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: RustingWithYou + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - qol: "Exoplanets can now prevent or force other exoplanets to spawn." + - qol: "Away sites can now force or ban exoplanets from spawning." diff --git a/maps/_common/mapsystem/map.dm b/maps/_common/mapsystem/map.dm index fe9d9495297..6a174ea385e 100644 --- a/maps/_common/mapsystem/map.dm +++ b/maps/_common/mapsystem/map.dm @@ -175,6 +175,8 @@ var/datum/space_sector/sector = SSatlas.current_sector var/list/possible_exoplanets = sector.possible_exoplanets var/list/guaranteed_exoplanets = sector.guaranteed_exoplanets + possible_exoplanets.Remove(sector.banned_exoplanets) + guaranteed_exoplanets.Remove(sector.banned_exoplanets) if(length(guaranteed_exoplanets)) for(var/j in guaranteed_exoplanets) @@ -182,6 +184,11 @@ log_module_exoplanets("Building new exoplanet with type: [guaranteed_exoplanet_type] and size: [planet_size[1]] [planet_size[2]]") var/obj/effect/overmap/visitable/sector/exoplanet/P = new guaranteed_exoplanet_type(null, planet_size[1], planet_size[2]) P.build_level() + for(var/forced_exoplanet in P.guaranteed_exoplanets) + LAZYDISTINCTADD(guaranteed_exoplanets, forced_exoplanet) + for(var/banned_exoplanet in P.banned_exoplanets) + LAZYDISTINCTADD(sector.banned_exoplanets, banned_exoplanet) + LAZYREMOVE(possible_exoplanets, banned_exoplanet) if(!length(possible_exoplanets)) log_module_exoplanets("No possible exoplanets found!") @@ -198,6 +205,11 @@ log_module_exoplanets("Building new exoplanet with type: [exoplanet_type] and size: [planet_size[1]] [planet_size[2]]") var/obj/effect/overmap/visitable/sector/exoplanet/new_planet = new exoplanet_type(null, planet_size[1], planet_size[2]) new_planet.build_level() + for(var/forced_exoplanet in new_planet.guaranteed_exoplanets) + LAZYDISTINCTADD(guaranteed_exoplanets, forced_exoplanet) + for(var/banned_exoplanet in new_planet.banned_exoplanets) + LAZYDISTINCTADD(sector.banned_exoplanets, banned_exoplanet) + LAZYREMOVE(possible_exoplanets, banned_exoplanet) /* It is perfectly possible to create loops with TEMPLATE_FLAG_ALLOW_DUPLICATES and force/allow. Don't. */ /proc/resolve_site_selection(datum/map_template/ruin/away_site/site, list/selected, list/available, list/unavailable, list/by_type) @@ -238,6 +250,17 @@ continue available[allowed] = allowed.spawn_weight + var/datum/space_sector/S = SSatlas.current_sector + for(var/forced_exoplanet in site.force_exoplanets) + if(forced_exoplanet in S.banned_exoplanets) + continue + S.guaranteed_exoplanets += forced_exoplanet + + for(var/banned_exoplanet in site.ban_exoplanets) + if(banned_exoplanet in S.guaranteed_exoplanets) + continue + S.banned_exoplanets += banned_exoplanet + return list(spawn_cost, player_cost, ship_cost) /datum/map/proc/send_welcome() diff --git a/maps/away/away_sites.dm b/maps/away/away_sites.dm index 490f0b0ca33..5e22dd1874a 100644 --- a/maps/away/away_sites.dm +++ b/maps/away/away_sites.dm @@ -9,6 +9,10 @@ /// Should be assoc map of `/turf/unsimulated/marker/...` path to `/datum/exoplanet_theme/...` path, /// where exoplanet generation with the map value is applied only on marker turfs of the applicable map key. var/list/exoplanet_themes = null + ///Exoplanets that this site will force to spawn. Useful for on-planet away sites such as Point Verdant or other ports of call. + var/list/force_exoplanets = list() + ///Exoplanets that this site will prohibit from spawning. Useful for fake planet away sites intended to replace normal exoplanets. + var/list/ban_exoplanets = list() /datum/map_template/ruin/away_site/New(var/list/paths = null, rename = null)