From 4f0e877948fad29322b238ece7058b1dba4209a0 Mon Sep 17 00:00:00 2001 From: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com> Date: Sat, 7 Jun 2025 10:08:58 -0400 Subject: [PATCH] Allows ruins to block other ruins from spawning on the same level (#29435) --- code/datums/mapping/ruin_placer.dm | 13 +++++++++++++ .../mapping/templates/lavaland_map_templates.dm | 3 +++ .../datums/mapping/templates/space_map_templates.dm | 1 + code/datums/ruins.dm | 3 +++ code/modules/space_management/space_level.dm | 3 +++ 5 files changed, 23 insertions(+) diff --git a/code/datums/mapping/ruin_placer.dm b/code/datums/mapping/ruin_placer.dm index 8251723a5de..79f7ec5f316 100644 --- a/code/datums/mapping/ruin_placer.dm +++ b/code/datums/mapping/ruin_placer.dm @@ -27,6 +27,18 @@ var/height_border = base_padding + round(ruin.height / 2) + padding for(var/z_level in z_levels) + var/blocked_on_level = FALSE + var/datum/space_level/current_level = GLOB.space_manager.get_zlev(z_level) + for(var/blocked_ruin_id in ruin.never_spawn_on_the_same_level) + if(blocked_on_level) + break + for(var/ruin_id in current_level.our_ruin_list) + if(blocked_ruin_id == ruin_id) + blocked_on_level = TRUE + break + if(blocked_on_level) + continue + var/placement_tries = PLACEMENT_TRIES while(placement_tries > 0) CHECK_TICK @@ -82,6 +94,7 @@ T.flags |= NO_RUINS new /obj/effect/landmark/ruin(central_turf, ruin) ruin.loaded++ + current_level.our_ruin_list += ruin.id log_world("Ruin \"[ruin.name]\" placed at ([central_turf.x], [central_turf.y], [central_turf.z])") diff --git a/code/datums/mapping/templates/lavaland_map_templates.dm b/code/datums/mapping/templates/lavaland_map_templates.dm index 98f940f3c70..53284f95532 100644 --- a/code/datums/mapping/templates/lavaland_map_templates.dm +++ b/code/datums/mapping/templates/lavaland_map_templates.dm @@ -250,6 +250,7 @@ suffix = "lavaland_surface_nt.dmm" allow_duplicates = FALSE always_place = TRUE + never_spawn_on_the_same_level = list("lavaland_relay") /datum/map_template/ruin/lavaland/legiongate name = "Necropolis Gate" @@ -265,6 +266,8 @@ name = "Nanotrasen Lavaland Relay" description = "Using the same technology as shelter capsules, these pods have been shot from orbit onto lavaland to demonstrate a quick and efficient way for an army to setup forward bases. \ Sadly, in their mass production rush, they lack a RTG power source and rely on pacmans, with many of the pods being shipped with the wrong fuel inside." + allow_duplicates = FALSE + never_spawn_on_the_same_level = list("gulag") allow_duplicates = FALSE // Less space on lavaland. Ideally we would figure out a way to ban this from spawning the same level as the mining base always_place = TRUE // Since only one can spawn for now, might as well ensure it. diff --git a/code/datums/mapping/templates/space_map_templates.dm b/code/datums/mapping/templates/space_map_templates.dm index cb063104bd5..10777b1210d 100644 --- a/code/datums/mapping/templates/space_map_templates.dm +++ b/code/datums/mapping/templates/space_map_templates.dm @@ -400,3 +400,4 @@ name = "Nanotrasen Bluespace Relay" description = "Nanotrasen uses relays like these to further extend telecommunications around an area of space, as well as long range beacons for easier deployment in the future. \ Unfortunately, the anomalous activity around Epsilon Eridani, along with orbital debris and space-faring hostiles, has rendered many of these relay stations inoperable, leaving their communications and teleportation systems offline." + never_spawn_on_the_same_level = list("bluespace_relay_beacon") diff --git a/code/datums/ruins.dm b/code/datums/ruins.dm index dd86e92085a..33cd928b603 100644 --- a/code/datums/ruins.dm +++ b/code/datums/ruins.dm @@ -15,6 +15,9 @@ var/allow_duplicates = TRUE var/list/never_spawn_with = null //If this ruin is spawned these will not eg list(/datum/map_template/ruin/base_alternate) + /// If a ruin ID is in this list, this ruin will not spawn on the same level as that ruin. + var/list/never_spawn_on_the_same_level = list() + var/prefix = null var/suffix = null diff --git a/code/modules/space_management/space_level.dm b/code/modules/space_management/space_level.dm index 766cb7832f0..9af6b530088 100644 --- a/code/modules/space_management/space_level.dm +++ b/code/modules/space_management/space_level.dm @@ -27,6 +27,9 @@ var/dirt_count = 0 var/list/init_list = list() + /// This is a list of ruins on the space_level. Used to prevent certain ruins from spawning on the same level as other ruins. + var/list/our_ruin_list = list() + /datum/space_level/New(z, level_name, transition_type = SELFLOOPING, traits = list(BLOCK_TELEPORT), transition_tag_) name = level_name zpos = z