[Ready] Asteroid Dungeons (#4884)

Adds Asteroid Dungeons framework to the game. Mappers can make their own asteroid dungeons to the game. Currently there are no asteroid dungeons that can be loaded.

Anyone can make a dungeon like anyone could make a change to a map. A readme file is included inside the maps directory for information regarding how to add your own dungeon to the map.

There's an added config function in the example config that determines whether or not asteroid dungeons spawn. I also included 2 bat files in mapmerge and mapmerge2 that backup the asteroid dungeons spawns so that they can be used in mapmerge.
This commit is contained in:
BurgerLUA
2018-07-20 13:10:35 -07:00
committed by Werner
parent 15b42a92aa
commit 1bd59b6532
14 changed files with 134 additions and 51 deletions

View File

@@ -137,6 +137,9 @@ var/list/gamemode_cache = list()
var/welder_vision = 1
var/generate_asteroid = 0
var/dungeon_chance = 0
var/no_click_cooldown = 0
//Used for modifying movement speed for mobs.
@@ -396,6 +399,9 @@ var/list/gamemode_cache = list()
if ("log_runtime")
config.log_runtime = text2num(value)
if ("dungeon_chance")
config.dungeon_chance = text2num(value)
if ("generate_asteroid")
config.generate_asteroid = 1

View File

@@ -13,6 +13,9 @@
current_map.finalize_load()
log_ss("map_finalization", "Finalized map in [(world.time - time)/10] seconds.")
if(config.dungeon_chance > 0)
place_dungeon_spawns()
if(config.generate_asteroid)
time = world.time
current_map.generate_asteroid()
@@ -32,3 +35,45 @@
all_areas += A
sortTim(all_areas, /proc/cmp_name_asc)
/proc/place_dungeon_spawns()
var/map_directory = "maps/dungeon_spawns/"
var/list/files = flist(map_directory)
var/start_time = world.time
var/dungeons_placed = 0
var/static/dmm_suite/maploader = new
var/dungeon_chance = config.dungeon_chance
log_ss("map_finalization","Attempting to create asteroid dungeons for [length(asteroid_spawn)] different areas, with [length(files) - 1] possible dungeons, with a [dungeon_chance]% chance to spawn a dungeon per area.")
for(var/turf/spawn_location in asteroid_spawn)
if(length(files) <= 0) //Sanity
log_ss("map_finalization","There aren't enough dungeon map files to fill the entire dungeon map. There may be less dungeons than expected.")
break
if(prob(dungeon_chance))
var/chosen_dungeon = pick(files)
if(!dd_hassuffix(chosen_dungeon,".dmm")) //Don't read anything that isn't a map file
files -= chosen_dungeon
log_ss("map_finalization","ALERT: [chosen_dungeon] is not a .dmm file! Skipping!")
continue
var/map_file = file("[map_directory][chosen_dungeon]")
if(isfile(map_file)) //Sanity
log_ss("map_finalization","Loading dungeon '[chosen_dungeon]' at coordinates [spawn_location.x], [spawn_location.y], [spawn_location.z].")
maploader.load_map(map_file,spawn_location.x,spawn_location.y,spawn_location.z)
dungeons_placed += 1
else
log_ss("map_finalization","ERROR: Something weird happened with the file: [chosen_dungeon].")
if(dd_hassuffix(chosen_dungeon,"_unique.dmm")) //Unique dungeons should only spawn once.
files -= chosen_dungeon
log_ss("map_finalization","Loaded [dungeons_placed] asteroid dungeons in [(world.time - start_time)/10] seconds.")
qdel(maploader)