From 1bd59b6532e2bfc4169ceffd7af1ff2c1772ee29 Mon Sep 17 00:00:00 2001 From: BurgerLUA Date: Fri, 20 Jul 2018 13:10:35 -0700 Subject: [PATCH] [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. --- code/controllers/configuration.dm | 6 +++ .../initialization/map_finalization.dm | 45 ++++++++++++++++ code/game/objects/effects/landmarks.dm | 9 ++++ code/game/objects/random/random.dm | 4 +- code/global.dm | 1 + config/example/config.txt | 3 ++ html/changelogs/burgerbb-sex_dungeons.yml | 6 +++ icons/1024x1024.dmi | Bin 0 -> 6628 bytes maps/_common/areas/ai.dm | 1 - maps/aurora/aurora-3_sublevel.dmm | 50 +++--------------- maps/aurora/aurora-5_interstitial.dmm | 14 +++-- maps/dungeon_readme.txt | 22 ++++++++ .../Prepare Maps - Random Dungeons.bat | 12 +++++ .../Prepare Maps - Random Dungeons.bat | 12 +++++ 14 files changed, 134 insertions(+), 51 deletions(-) create mode 100644 html/changelogs/burgerbb-sex_dungeons.yml create mode 100644 icons/1024x1024.dmi create mode 100644 maps/dungeon_readme.txt create mode 100644 tools/mapmerge/Prepare Maps - Random Dungeons.bat create mode 100644 tools/mapmerge2/Prepare Maps - Random Dungeons.bat diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 04812cec7e2..ff9835b119a 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -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 diff --git a/code/controllers/subsystems/initialization/map_finalization.dm b/code/controllers/subsystems/initialization/map_finalization.dm index 4684e992783..774ecad742f 100644 --- a/code/controllers/subsystems/initialization/map_finalization.dm +++ b/code/controllers/subsystems/initialization/map_finalization.dm @@ -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) diff --git a/code/game/objects/effects/landmarks.dm b/code/game/objects/effects/landmarks.dm index 60e59c20803..501e5cc19e2 100644 --- a/code/game/objects/effects/landmarks.dm +++ b/code/game/objects/effects/landmarks.dm @@ -75,6 +75,10 @@ endgame_exits += loc delete_me = 1 return + if("asteroid spawn") + asteroid_spawn += loc + delete_me = 1 + return landmarks_list += src return 1 @@ -246,3 +250,8 @@ new /obj/item/clothing/mask/gas/sexymime(src.loc) new /obj/item/clothing/under/sexymime(src.loc) delete_me = 1 + +/obj/effect/landmark/dungeon_spawn + name = "asteroid spawn" + icon = 'icons/1024x1024.dmi' + icon_state = "yellow" diff --git a/code/game/objects/random/random.dm b/code/game/objects/random/random.dm index baea1ae615a..347c59b5660 100644 --- a/code/game/objects/random/random.dm +++ b/code/game/objects/random/random.dm @@ -1034,6 +1034,4 @@ spawned_frame.update_icon() spawned_frame.update_stats() - qdel(thing) - - + qdel(thing) \ No newline at end of file diff --git a/code/global.dm b/code/global.dm index a864ead56a2..f39b1c843b5 100644 --- a/code/global.dm +++ b/code/global.dm @@ -60,6 +60,7 @@ var/list/kickoffsloc = list() var/list/prisonwarp = list() // Prisoners go to these var/list/holdingfacility = list() // Captured people go here var/list/xeno_spawn = list() // Aliens spawn at at these. +var/list/asteroid_spawn = list() // Asteroid "Dungeons" spawn at these. var/list/tdome1 = list() var/list/tdome2 = list() var/list/tdomeobserve = list() diff --git a/config/example/config.txt b/config/example/config.txt index b66679fbeb4..e42580d5fcf 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -407,6 +407,9 @@ MERCHANT_CHANCE 20 ## Enable asteroid tunnel/cave generation. Will behave strangely if turned off with a map that expects it on. # GENERATE_ASTEROID +## Enable asteroid dungeon generation. The value preceding is the chance for a dungeon slot to be occupied. +# DUNGEON_CHANCE 25 + ## Uncomment to enable organ decay outside of a body or storage item. #ORGANS_CAN_DECAY diff --git a/html/changelogs/burgerbb-sex_dungeons.yml b/html/changelogs/burgerbb-sex_dungeons.yml new file mode 100644 index 00000000000..54ce9c92a5a --- /dev/null +++ b/html/changelogs/burgerbb-sex_dungeons.yml @@ -0,0 +1,6 @@ +author: BurgerBB + +delete-after: True + +changes: + - maptweak: "Added a random dungeon framework. Mappers can make their own dungeons and submit them to Github." diff --git a/icons/1024x1024.dmi b/icons/1024x1024.dmi new file mode 100644 index 0000000000000000000000000000000000000000..9782314bf1ead0dc52df1522bd54e7051461658b GIT binary patch literal 6628 zcmeAS@N?(olHy`uVBq!ia0y~yU;#2&7&zE~RK2WrGmt8%3W+FjNi9w;$}A|!%+F(B zsF-7Vd@omnf(YA%o4-Zmx4OHn_Lg`!;k`nM_d@vq&#K>T8P>~>8TcJ@I^UMprx~Lz z@@tuD;Gs#jA}P1Os@SxjeZF6F_nCkda`(Qk4pEsVAS|NNX}YV~{<_54wt2jJcQ{FB z@2mSH%D^D0@9E+gQZeVv4M*Ms3JeDv+QMAUpAB&IxMs~-`~By=jUZ=!$o^agq!O#@J77;PGiHVsD0#L;Xp+B5)_hNDe`(WU_~8H_d! yK$&5*X)w@DgEzfRfd*V|2Q?&E7bl4H0OQ1eBA4}p-+CuN@#E?0=d#Wzp$P!R60A%B literal 0 HcmV?d00001 diff --git a/maps/_common/areas/ai.dm b/maps/_common/areas/ai.dm index 02b6d197441..fd5587e2651 100644 --- a/maps/_common/areas/ai.dm +++ b/maps/_common/areas/ai.dm @@ -73,4 +73,3 @@ /area/turret_protected/NewAIMain name = "\improper AI Main New" icon_state = "storage" - diff --git a/maps/aurora/aurora-3_sublevel.dmm b/maps/aurora/aurora-3_sublevel.dmm index 69571677a86..c238ac31b8a 100644 --- a/maps/aurora/aurora-3_sublevel.dmm +++ b/maps/aurora/aurora-3_sublevel.dmm @@ -4462,20 +4462,9 @@ }, /area/outpost/engineering/storage) "jr" = ( -/obj/structure/particle_accelerator/end_cap{ - icon_state = "end_cap"; - dir = 8 - }, -/obj/machinery/atmospherics/pipe/simple/hidden/supply{ - dir = 4 - }, -/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{ - dir = 4 - }, -/turf/simulated/floor{ - icon_state = "plating" - }, -/area/outpost/engineering/storage) +/obj/effect/landmark/dungeon_spawn, +/turf/unsimulated/chasm_mask, +/area/mine/unexplored) "js" = ( /obj/machinery/power/grounding_rod, /obj/machinery/atmospherics/pipe/manifold/hidden/supply{ @@ -9468,12 +9457,6 @@ "qO" = ( /turf/simulated/floor/reinforced, /area/security/nuke_storage) -"qP" = ( -/obj/effect/floor_decal/industrial/warning{ - dir = 8 - }, -/turf/simulated/floor/tiled/dark, -/area/security/nuke_storage) "qQ" = ( /obj/machinery/hologram/holopad, /turf/simulated/floor/tiled/dark, @@ -26419,23 +26402,6 @@ }, /turf/simulated/floor/asteroid/ash/rocky, /area/mine/unexplored) -"Ux" = ( -/obj/machinery/access_button{ - command = "cycle_exterior"; - frequency = 1379; - master_tag = "toxinsairlock_airlock"; - name = "exterior access button"; - pixel_x = 25; - pixel_y = -25; - req_one_access = list(13,65) - }, -/obj/structure/cable/green{ - d1 = 4; - d2 = 8; - icon_state = "4-8" - }, -/turf/simulated/floor/asteroid/ash/rocky, -/area/mine/unexplored) "Uy" = ( /obj/structure/cable/green{ d1 = 4; @@ -28459,7 +28425,7 @@ aa aa aa aa -aa +jr aa aa aa @@ -39156,7 +39122,7 @@ aa aa aa aa -aa +jr aa aa aa @@ -54233,7 +54199,7 @@ aa aa aa aa -aa +jr aa aa aa @@ -63043,7 +63009,7 @@ aa aa aa aa -aa +jr aa aa aa @@ -77073,7 +77039,7 @@ aa aa aa aa -aa +jr aa aa aa diff --git a/maps/aurora/aurora-5_interstitial.dmm b/maps/aurora/aurora-5_interstitial.dmm index 7a7a8797947..c1aaac79997 100644 --- a/maps/aurora/aurora-5_interstitial.dmm +++ b/maps/aurora/aurora-5_interstitial.dmm @@ -2763,6 +2763,10 @@ }, /turf/simulated/floor/carpet, /area/security/detectives_office) +"ff" = ( +/obj/effect/landmark/dungeon_spawn, +/turf/unsimulated/chasm_mask, +/area/mine/unexplored) "fh" = ( /obj/effect/floor_decal/corner/green{ icon_state = "corner_white"; @@ -17220,7 +17224,7 @@ aa aa aa aa -aa +ff aa aa aa @@ -18164,7 +18168,7 @@ aa aa aa aa -aa +ff aa aa aa @@ -40849,7 +40853,7 @@ aa aa aa aa -aa +ff aa aa aa @@ -54265,7 +54269,7 @@ aa aa aa aa -aa +ff aa aa aa @@ -54920,7 +54924,7 @@ aa aa aa aa -aa +ff aa aa aa diff --git a/maps/dungeon_readme.txt b/maps/dungeon_readme.txt new file mode 100644 index 00000000000..7dd461b3313 --- /dev/null +++ b/maps/dungeon_readme.txt @@ -0,0 +1,22 @@ +This is the readme file for asteroid dungeons. Create all new dungeons in this directory here so that they may be loaded in the game. + +Step by step: +0. Learn how to actually map, including how to use mapmerge and how to use git. +1. Open DreamMaker +2. Create a new .tgm file at the directory maps/dungeon_spawns +3. Make sure that the settings are x: 32, y: 32, z:1. Anything else may be wonky. +4. Ensure that you have the correct area set (/area/mine/unexplored), unless your dungeon uses its own special area (for power, and whatnot). +5. Ensure that you have the correct non-dungeon tile set (/turf/unsimulated/chasm_mask). +6. Apply map changes. +7. ENSURE THAT THE MAP FILE IS UNCHECKED IN THE FILE PANE WINDOW ON THE LEFT HAND SIDE AND THAT IT'S NOT INCLUDED IN AURORASTATION.DME. +8. ENSURE THAT THE MAP FILE IS UNCHECKED IN THE FILE PANE WINDOW ON THE LEFT HAND SIDE AND THAT IT'S NOT INCLUDED IN AURORASTATION.DME. +9. Go to tools, and run Prepare Maps - Random Dungeons in one of the mapmerge directories. +10. Run Map Merge - TGM +11. Merge the dungeons you made. +12. Ensure that you're not a fuckup and did everything right. +13. Do git magic here. + +Final Notes: +If the dungeon is meant to be unique, append "_unique" at the end of the filename (like "snowflake_unique") so it can only spawn once. Otherwise, your dungeon may occur multiple times. + +Ensure that your dungeon actually works if you've added anything complex like a powernet or some other complex thing. You can do this by temporarily deleting all the rest of the dungeon files so your unique dungeon will always spawn. \ No newline at end of file diff --git a/tools/mapmerge/Prepare Maps - Random Dungeons.bat b/tools/mapmerge/Prepare Maps - Random Dungeons.bat new file mode 100644 index 00000000000..9682b530153 --- /dev/null +++ b/tools/mapmerge/Prepare Maps - Random Dungeons.bat @@ -0,0 +1,12 @@ +@echo off +cd ../../maps/dungeon_spawns + +for /R %%f in (*.dmm) do copy "%%f" "%%f.backup" + +cls +echo All dmm files in the maps/dungeon_spawns directory have been backed up. +echo Now you can make your changes... +echo --- +echo Remember to run Run Map Merge - TGM.bat just before you commit your changes! +echo --- +pause diff --git a/tools/mapmerge2/Prepare Maps - Random Dungeons.bat b/tools/mapmerge2/Prepare Maps - Random Dungeons.bat new file mode 100644 index 00000000000..87898aedb35 --- /dev/null +++ b/tools/mapmerge2/Prepare Maps - Random Dungeons.bat @@ -0,0 +1,12 @@ +@echo off +cd ../../maps/dungeon_spawns + +for /R %%f in (*.dmm) do copy "%%f" "%%f.backup" + +cls +echo All dmm files in the maps/dungeon_spawns directory have been backed up. +echo Now you can make your changes... +echo --- +echo Remember to run mapmerge.bat just before you commit your changes! +echo --- +pause