mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Refactored random map generator system and added several terrain generators.
Created a global list to track base turfs for explosions/shuttle moves. Remaps the asteroid to be a moonlet. Tidies up some references to 'asteroid', removes moonbase from the accessible z level list.
This commit is contained in:
52
code/modules/random_map/automata/caves.dm
Normal file
52
code/modules/random_map/automata/caves.dm
Normal file
@@ -0,0 +1,52 @@
|
||||
/datum/random_map/automata/cave_system
|
||||
iterations = 5
|
||||
descriptor = "moon caves"
|
||||
wall_type = /turf/simulated/mineral
|
||||
floor_type = /turf/simulated/floor/plating/airless/asteroid
|
||||
target_turf_type = /turf/unsimulated/mask
|
||||
var/mineral_sparse = /turf/simulated/mineral/random
|
||||
var/mineral_rich = /turf/simulated/mineral/random/high_chance
|
||||
var/list/ore_turfs = list()
|
||||
|
||||
/datum/random_map/automata/cave_system/get_appropriate_path(var/value)
|
||||
switch(value)
|
||||
if(DOOR_CHAR)
|
||||
return mineral_sparse
|
||||
if(EMPTY_CHAR)
|
||||
return mineral_rich
|
||||
if(FLOOR_CHAR)
|
||||
return floor_type
|
||||
if(WALL_CHAR)
|
||||
return wall_type
|
||||
|
||||
/datum/random_map/automata/cave_system/get_map_char(var/value)
|
||||
switch(value)
|
||||
if(DOOR_CHAR)
|
||||
return "x"
|
||||
if(EMPTY_CHAR)
|
||||
return "X"
|
||||
return ..(value)
|
||||
|
||||
/datum/random_map/automata/cave_system/revive_cell(var/target_cell, var/list/use_next_map, var/final_iter)
|
||||
..()
|
||||
if(final_iter)
|
||||
ore_turfs |= target_cell
|
||||
|
||||
/datum/random_map/automata/cave_system/kill_cell(var/target_cell, var/list/use_next_map, var/final_iter)
|
||||
..()
|
||||
if(final_iter)
|
||||
ore_turfs -= target_cell
|
||||
|
||||
// Create ore turfs.
|
||||
/datum/random_map/automata/cave_system/cleanup()
|
||||
var/ore_count = round(map.len/20)
|
||||
while((ore_count>0) && (ore_turfs.len>0))
|
||||
if(!priority_process) sleep(-1)
|
||||
var/check_cell = pick(ore_turfs)
|
||||
ore_turfs -= check_cell
|
||||
if(prob(75))
|
||||
map[check_cell] = DOOR_CHAR // Mineral block
|
||||
else
|
||||
map[check_cell] = EMPTY_CHAR // Rare mineral block.
|
||||
ore_count--
|
||||
return 1
|
||||
Reference in New Issue
Block a user