mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-02-06 14:29:17 +00:00
## About The Pull Request In short, we used a static list previously within the ore_generation subsystem that held the amount of each ore that we expected a single map to uniformly need. We held this number constant, since we were spawning 15 vents per map. **Pros:** This worked flawlessly for Lavaland since 15 vents on a single Z level makes it pretty densely packed map with a good amount of map-based ore spawns, and it worked consistently. **Cons:** 15 vents did not work well on Icebox however, even when split so that the majority of the ores were spawning on the lower levels, players did not feel like icebox spawned nearly enough ores and reported the map spawning empty. **Result:** As a result, we adjusted the ratio, so that we spawned vastly more ores on the lower levels, now up to 4 vents on the upper level, and 21 vents on the lower level. However, as we were still using the ore distribution list based on lavaland, icebox vents were quickly running out of ores to distribute between them, resulting in empty vents -> which produced empty boulders -> which not only don't really let you process them properly, but also just result in a metric ton of runtimes. Icebox now has it's own list of ore distributions. These distributions are now moved to a set of global lists as opposed to being saved on the subsystem as a static list, which will make going and setting up new ore distribution lists very very easy. Additionally, we've moved the setting and getting of those ore_distributions over to the seedRuins proc, so that we're actually setting the list of ores right before we actually place them to make sure that the order that it's set is roughly as it's needed, while still setting the list at the same time the map-appropriate ruin placements are dropped in. **Plus some misc cleanup fixes:** `var/list/ore_vent_sizes` in SSore_generation wasn't being treated as a similar budget list as `ore_vent_minerals`, since it `pick()`s off it's own static size list. Which is honestly fine for this five seconds, I can handle that later while we make sure the rest of the code code is stable. In the meantime, I've just tweak it so that it's easy to see at a glance how many of each random vent has spawned into the map. Tweaked the description to not include anything about chemical processing, as I'm planning on hitting on that in a part 2 PR that I'll be picking back up after the freeze. ## Why It's Good For The Game Cleans up the code a bit, but primarily fixes ores not spawning on icebox as they should. Should fix #81058. Improves description to not mention mechanics that aren't in game. Also, cleans up a piece of code that currently isn't serving much of a purpose. ## Changelog 🆑 fix: Icebox should have it's ore distribution and it's ore vents fixed, so that vents should now produce ore. spellcheck: Boulder processing machines now don't mention things they don't do. /🆑
77 lines
2.9 KiB
Plaintext
77 lines
2.9 KiB
Plaintext
|
|
SUBSYSTEM_DEF(ore_generation)
|
|
name = "Ore Generation"
|
|
wait = 60 SECONDS
|
|
init_order = INIT_ORDER_DEFAULT
|
|
runlevels = RUNLEVEL_GAME
|
|
|
|
/// All ore vents that are currently producing boulders.
|
|
var/list/processed_vents = list()
|
|
/// All the boulders that have been produced by ore vents to be pulled by BRM machines.
|
|
var/list/available_boulders = list()
|
|
/// All the ore vents that are currently in the game, not just the ones that are producing boulders.
|
|
var/list/possible_vents = list()
|
|
/**
|
|
* A list of all the minerals that are being mined by ore vents. We reset this list every time cave generation is done.
|
|
* Generally Should be empty by the time initialize ends on lavaland.
|
|
* Each key value is the number of vents that will have this ore as a unique possible choice.
|
|
* If we call cave_generation more than once, we copy a list from the lists in lists/ores_spawned.dm
|
|
*/
|
|
var/list/ore_vent_minerals = list()
|
|
/// A tracker of how many of each ore vent size we have in the game. Useful for tracking purposes.
|
|
var/list/ore_vent_sizes = list(
|
|
LARGE_VENT_TYPE = 0,
|
|
MEDIUM_VENT_TYPE = 0,
|
|
SMALL_VENT_TYPE = 0,
|
|
)
|
|
/// Ores spawned by proximity to an ore vent. Useful for logging purposes.
|
|
var/list/post_ore_random = list(
|
|
"1" = 0,
|
|
"2" = 0,
|
|
"3" = 0,
|
|
"4" = 0,
|
|
"5" = 0,
|
|
)
|
|
/// Ores spawned randomly on the map without proximity to an ore vent. Useful for logging purposes.
|
|
var/list/post_ore_manual = list(
|
|
"1" = 0,
|
|
"2" = 0,
|
|
"3" = 0,
|
|
"4" = 0,
|
|
"5" = 0,
|
|
)
|
|
|
|
/datum/controller/subsystem/ore_generation/Initialize()
|
|
//Basically, we're going to round robin through the list of ore vents and assign a mineral to them until complete.
|
|
while(length(ore_vent_minerals) > 0) //Keep looping if there's more to assign
|
|
var/stallbreaker = 0
|
|
for(var/obj/structure/ore_vent/vent as anything in possible_vents)
|
|
if(length(ore_vent_minerals) <= 0) //But break early if there's none left.
|
|
break
|
|
if(vent.unique_vent)
|
|
continue //Ya'll already got your minerals.
|
|
if(length(difflist(first = ore_vent_minerals, second = vent.mineral_breakdown, skiprep = 1)))
|
|
vent.generate_mineral_breakdown(new_minerals = 1, map_loading = TRUE)
|
|
else
|
|
stallbreaker++
|
|
if(stallbreaker >= length(possible_vents))
|
|
return SS_INIT_SUCCESS //We've done all we can here.
|
|
continue
|
|
return SS_INIT_SUCCESS
|
|
|
|
/datum/controller/subsystem/ore_generation/fire(resumed)
|
|
available_boulders = list() // reset upon new fire.
|
|
for(var/obj/structure/ore_vent/current_vent as anything in processed_vents)
|
|
|
|
var/local_vent_count = 0
|
|
for(var/obj/item/boulder/old_rock in current_vent.loc)
|
|
available_boulders += old_rock
|
|
local_vent_count++
|
|
|
|
if(local_vent_count >= MAX_BOULDERS_PER_VENT)
|
|
continue //We don't want to be accountable for literally hundreds of unprocessed boulders for no reason.
|
|
|
|
var/obj/item/boulder/new_rock = current_vent.produce_boulder()
|
|
available_boulders += new_rock
|
|
|