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

Exoplanet Forcing & Banning #19373

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions code/modules/background/space_sectors/space_sector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Comment on lines +15 to +16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

document what this list is supposed to contain
(types like /obj/effect/overmap/visitable/sector/exoplanet/...)

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"
Expand Down
2 changes: 2 additions & 0 deletions code/modules/maps/planet_types/lore/uueoaesa.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions code/modules/overmap/exoplanets/exoplanet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Comment on lines +86 to +89
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here, and also put it near the ruin_type_whitelist for better organization



/obj/effect/overmap/visitable/sector/exoplanet/proc/generate_habitability()
Expand Down Expand Up @@ -181,7 +185,7 @@
#if defined(UNIT_TEST)
if((SSunit_tests_config.config["exoplanets_ruins"] == FALSE) || ((SSunit_tests_config.config["exoplanets_ruins"] != TRUE) && !(T in SSunit_tests_config.config["exoplanets_ruins"])))
if(!shown_warning_for_exoplanets_ruins_config && (SSunit_tests_config.config["exoplanets_ruins"] == FALSE))
LOG_GITHUB_WARNING("Not spawning ruins for [src.name] because 'exoplanets_ruins' is FALSE in the UT config")

Check warning on line 188 in code/modules/overmap/exoplanets/exoplanet.dm

View workflow job for this annotation

GitHub Actions / Run Ruins Tests (runtime, ruins-3)

Not spawning ruins for Russo-Romeo, a romanovich cloud asteroid because 'exoplanets_ruins' is FALSE in the UT config

Check warning on line 188 in code/modules/overmap/exoplanets/exoplanet.dm

View workflow job for this annotation

GitHub Actions / Run Ruins Tests (runtime, ruins-3)

Not spawning ruins for Moon-Pi, a mineral asteroid because 'exoplanets_ruins' is FALSE in the UT config

Check warning on line 188 in code/modules/overmap/exoplanets/exoplanet.dm

View workflow job for this annotation

GitHub Actions / Run Ruins Tests (runtime, ruins-1)

Not spawning ruins for Russo-Romeo, a romanovich cloud asteroid because 'exoplanets_ruins' is FALSE in the UT config

Check warning on line 188 in code/modules/overmap/exoplanets/exoplanet.dm

View workflow job for this annotation

GitHub Actions / Run Ruins Tests (runtime, ruins-1)

Not spawning ruins for Moon-Pi, a mineral asteroid because 'exoplanets_ruins' is FALSE in the UT config

Check warning on line 188 in code/modules/overmap/exoplanets/exoplanet.dm

View workflow job for this annotation

GitHub Actions / Run Ruins Tests (runtime, ruins-2)

Not spawning ruins for Russo-Romeo, a romanovich cloud asteroid because 'exoplanets_ruins' is FALSE in the UT config

Check warning on line 188 in code/modules/overmap/exoplanets/exoplanet.dm

View workflow job for this annotation

GitHub Actions / Run Ruins Tests (runtime, ruins-2)

Not spawning ruins for Moon-Pi, a mineral asteroid because 'exoplanets_ruins' is FALSE in the UT config
shown_warning_for_exoplanets_ruins_config = TRUE

LOG_GITHUB_DEBUG("Ruin [T] for [src.name] not spawned because either 'exoplanets_ruins' is FALSE or it does not contain it in the UT config")
Expand Down
59 changes: 59 additions & 0 deletions html/changelogs/RustingWithYou - planetbanning.yml
Original file line number Diff line number Diff line change
@@ -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."
23 changes: 23 additions & 0 deletions maps/_common/mapsystem/map.dm
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,20 @@
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)
var/guaranteed_exoplanet_type = j
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!")
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions maps/away/away_sites.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Comment on lines +12 to +15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here about docs


/datum/map_template/ruin/away_site/New(var/list/paths = null, rename = null)

Expand Down
Loading