Co-authored-by: DreamySkrell <>
This commit is contained in:
DreamySkrell
2024-01-30 10:54:13 +00:00
committed by GitHub
co-authored by DreamySkrell <>
parent ade6ebcc08
commit 65893dc74c
4 changed files with 74 additions and 6 deletions
+27 -1
View File
@@ -5,10 +5,22 @@
How is there a wooden container filled with 18th century coinage in the middle of a lavawracked hellscape? \
It is clearly a mystery."
/// Spawn weight.
var/spawn_weight = 1
/// Sector-dependent `spawn_weight` override, changing the weight based on sector.
/// Should be assoc list in the form of `= list(X=N)`, where `X` is either a single sector string like `SECTOR_TAU_CETI`
/// or a list (of lists) like `ALL_POSSIBLE_SECTORS` which will be flattened later, and where `N` is the weight override like `1` or `2`.
/// Setting weight overrides for blacklisted sectors is valid, and `sectors` and `sectors_blacklist` are respected still.
/// If current sector is not contained in this assoc list, then `spawn_weight` is not overriden and is used as default value.
/// The first matching sector override is applied and further ones are not checked.
var/list/spawn_weight_sector_dependent = list()
/// Spawn cost, to be used by ruins or sites *WITHOUT* any ghost roles.
var/spawn_cost = 0
var/player_cost = 0
/// Spawn cost, to be used by ruins or sites *WITH* ghost roles.
var/ship_cost = 0
/// Unused?
var/player_cost = 0
/// This ruin can only spawn in the sectors in this list.
/// Should contain names of sectors as defined in `space_sectors.dm`.
@@ -34,13 +46,27 @@
var/list/ban_ruins // Listed ruins are removed from the set of available spawns. Beats allowed.
/datum/map_template/ruin/New()
// get the map paths
if (suffixes)
mappaths = list()
for (var/suffix in suffixes)
mappaths += (prefix + suffix)
// set up sectors
sectors = flatten_list(sectors)
sectors_blacklist = flatten_list(sectors_blacklist)
sectors -= sectors_blacklist
// adjust weight from sector dependent override
var/datum/space_sector/current_sector = SSatlas.current_sector
if(current_sector && spawn_weight_sector_dependent)
for(var/sectors in spawn_weight_sector_dependent)
var/weight_in_sector = spawn_weight_sector_dependent[sectors]
var/list/sectors_flattened = flatten_list(list(sectors))
if(current_sector.name in sectors_flattened)
spawn_weight = weight_in_sector
// fin
..()
/// Returns `TRUE` if this ruin can spawn in current sector, otherwise `FALSE`.