From c9d96322c4dc43ba0dd2fb1be60d5ab4e20b0c79 Mon Sep 17 00:00:00 2001 From: Toastical <20125180+Toastical@users.noreply.github.com> Date: Wed, 7 May 2025 05:09:41 +0300 Subject: [PATCH] Adds a `megafauna_safe_range` var to ruin datums and adds a megafauna exclusion zone to ghost spawn ruins on lavaland. (#29120) * add exclusion check, change area types, update script * merged the 2 for loops * removed commented out section * rename updatepaths script * var * undo area and map edits * add safe var for ruin datums, add megafauna distance check for safe ruins * removed unneeded file * rename variable --- code/datums/ruins.dm | 2 ++ code/datums/ruins/lavaland.dm | 4 ++++ .../effects/spawners/random/pool/lavaland_pools.dm | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/code/datums/ruins.dm b/code/datums/ruins.dm index 76462159b29..dd86e92085a 100644 --- a/code/datums/ruins.dm +++ b/code/datums/ruins.dm @@ -7,6 +7,8 @@ wooden container filled with 18th century coinage in the middle of a \ lavawracked hellscape? It is clearly a mystery." + /// Prevents megafauna spawning within a certain range of ruins. + var/megafauna_safe_range = FALSE var/unpickable = FALSE //If TRUE these won't be placed automatically (can still be forced or loaded with another ruin) var/always_place = FALSE //Will skip the whole weighting process and just plop this down, ideally you want the ruins of this kind to have no cost. var/placement_weight = 1 //How often should this ruin appear diff --git a/code/datums/ruins/lavaland.dm b/code/datums/ruins/lavaland.dm index 5d2f86b9f58..aa720ab4dc0 100644 --- a/code/datums/ruins/lavaland.dm +++ b/code/datums/ruins/lavaland.dm @@ -27,6 +27,7 @@ suffix = "lavaland_surface_seed_vault.dmm" allow_duplicates = FALSE always_place = TRUE + megafauna_safe_range = TRUE /datum/map_template/ruin/lavaland/seed_vault_eden name = "Garden of Eden" @@ -44,6 +45,7 @@ Probably best to stay clear." suffix = "lavaland_surface_ash_walker1.dmm" allow_duplicates = FALSE + megafauna_safe_range = TRUE /datum/map_template/ruin/lavaland/ash_walker_siege name = "Ash Walker Siege" @@ -61,6 +63,7 @@ suffix = "lavaland_surface_golem_ship.dmm" allow_duplicates = FALSE always_place = TRUE + megafauna_safe_range = TRUE /datum/map_template/ruin/lavaland/althland_facility name = "Althland Facility" @@ -197,6 +200,7 @@ suffix = "lavaland_surface_hermit.dmm" allow_duplicates = FALSE always_place = TRUE + megafauna_safe_range = TRUE /datum/map_template/ruin/lavaland/miningripley name = "Ripley" diff --git a/code/game/objects/effects/spawners/random/pool/lavaland_pools.dm b/code/game/objects/effects/spawners/random/pool/lavaland_pools.dm index 88a29001729..f02097c2636 100644 --- a/code/game/objects/effects/spawners/random/pool/lavaland_pools.dm +++ b/code/game/objects/effects/spawners/random/pool/lavaland_pools.dm @@ -27,6 +27,7 @@ var/fauna_scan_range = 12 var/megafauna_scan_range = 16 + var/ghost_ruin_scan_range = 12 var/turf/mining_base_gps loot = list( @@ -94,6 +95,15 @@ if(ismegafauna(thing) && get_dist(T, thing) <= megafauna_scan_range) return FALSE + for(var/obj/effect/landmark/ruin/ruin_landmark in GLOB.ruin_landmarks) + var/datum/map_template/ruin/template = ruin_landmark.ruin_template + // avoid spawning a megafauna if it's too close to a ghost spawn ruin + if(template.megafauna_safe_range) + // largest axis halved + the ruin scan range + var/exclusion_distance = (template.width > template.height ? template.width : template.height * 0.5) + ghost_ruin_scan_range + if(get_dist(T, ruin_landmark) < exclusion_distance) + return FALSE + return ..() /obj/effect/spawner/random/pool/lavaland_fauna/megafauna/unique