mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 21:48:21 +01:00
refactor: Remove cave generation from mineral ore generation odds (#24783)
* Remove cave generation from mineral ore generation odds * use clearer vars
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
/// Approximate lower bound of the walkable land area on Lavaland, north of the southern lava border.
|
||||
#define LAVALAND_MIN_CAVE_Y 10
|
||||
/// Approximate upper bound of the walkable land area on Lavaland, south of the Legion entrance.
|
||||
#define LAVALAND_MAX_CAVE_Y 222
|
||||
|
||||
/datum/lavaland_theme
|
||||
/// Name of lavaland theme
|
||||
var/name = "Not Specified"
|
||||
@@ -12,6 +17,20 @@
|
||||
else if(!ispath(primary_turf_type))
|
||||
stack_trace("Wrong turf type `[primary_turf_type.type]` in `[type]` lavaland theme")
|
||||
|
||||
/datum/lavaland_theme/proc/setup_caves()
|
||||
var/max_attempts = 100
|
||||
var/max_cave_spawns = 40
|
||||
var/z = level_name_to_num(MINING)
|
||||
while(max_attempts > 0 && max_cave_spawns > 0)
|
||||
var/x = rand(1, world.maxx)
|
||||
var/y = rand(LAVALAND_MIN_CAVE_Y, LAVALAND_MAX_CAVE_Y)
|
||||
var/turf/next_turf = locate(x, y, z)
|
||||
var/area/next_area = get_area(next_turf)
|
||||
if(istype(next_turf, /turf/simulated/mineral/random/volcanic) && istype(next_area, /area/lavaland/surface/outdoors/unexplored/danger))
|
||||
next_turf.ChangeTurf(/turf/simulated/floor/plating/asteroid/airless/cave/volcanic, FALSE, TRUE, TRUE)
|
||||
max_cave_spawns--
|
||||
max_attempts--
|
||||
|
||||
/**
|
||||
* This proc should do all theme specific thing.
|
||||
* Now it only generates rivers, but it can do all stuff you desire.
|
||||
@@ -46,3 +65,6 @@
|
||||
/datum/lavaland_theme/chasm/setup()
|
||||
var/datum/river_spawner/spawner = new(level_name_to_num(MINING), spread_prob_ = 10, spread_prob_loss_ = 5)
|
||||
spawner.generate(nodes = 6, min_x = 50, min_y = 7, max_x = 250, max_y = 225)
|
||||
|
||||
#undef LAVALAND_MIN_CAVE_Y
|
||||
#undef LAVALAND_MAX_CAVE_Y
|
||||
|
||||
Reference in New Issue
Block a user