diff --git a/_maps/skyrat/planets/rockplanet.dmm b/_maps/map_files/Mining/Rockplanet.dmm similarity index 99% rename from _maps/skyrat/planets/rockplanet.dmm rename to _maps/map_files/Mining/Rockplanet.dmm index 078531096df..b19cd190483 100644 --- a/_maps/skyrat/planets/rockplanet.dmm +++ b/_maps/map_files/Mining/Rockplanet.dmm @@ -294,7 +294,7 @@ dir = 8; dwidth = 3; height = 10; - id = "mining_away_rockplanet"; + id = "mining_away"; name = "Abandoned Planet LZ2"; width = 7 }, @@ -490,30 +490,18 @@ /turf/open/floor/carpet, /area/rockplanet/surface/outdoors) "Cx" = ( -/obj/structure/table, -/obj/item/storage/toolbox/mechanical{ - pixel_x = -2; - pixel_y = -1 - }, +/obj/machinery/suit_storage_unit/mining/eva, /turf/open/floor/iron, /area/mine/rockplanet_nanotrasen) "Cz" = ( -/obj/structure/table, -/obj/item/storage/toolbox/mechanical{ - pixel_x = -2; - pixel_y = -1 - }, +/obj/machinery/suit_storage_unit/mining/eva, /turf/open/floor/plating/rust, /area/mine/rockplanet_nanotrasen) "CF" = ( -/obj/structure/table, /obj/machinery/light/small{ dir = 4 }, -/obj/item/storage/toolbox/mechanical{ - pixel_x = -2; - pixel_y = -1 - }, +/obj/machinery/suit_storage_unit/mining/eva, /turf/open/floor/iron, /area/mine/rockplanet_nanotrasen) "Dc" = ( diff --git a/code/__DEFINES/~skyrat_defines/mining_traits.dm b/code/__DEFINES/~skyrat_defines/mining_traits.dm new file mode 100644 index 00000000000..82338a28afc --- /dev/null +++ b/code/__DEFINES/~skyrat_defines/mining_traits.dm @@ -0,0 +1,7 @@ +// IF YOU ARE ADDING A NEW MAP, ENSURE YOU DEFINE THE LEVEL TRAITS AND A KEYWORD TO LOAD THEM WITH. +// THE CONFIG USES THE KEYWORD TO LOAD THE ASSIGNED TRAITS. + +GLOBAL_LIST_INIT(mining_traits, list( + "lavaland" = ZTRAITS_LAVALAND, + "rockplanet" = ZTRAITS_ROCKPLANET +)) diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index d7d7b75cfe6..1c12ba0d190 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -276,10 +276,23 @@ Used by the AI doomsday and the self-destruct nuke. ++space_levels_so_far add_new_zlevel("Empty Area [space_levels_so_far]", ZTRAITS_SPACE) - if(config.minetype == "lavaland") - LoadGroup(FailedZs, "Lavaland", "map_files/Mining", "Lavaland.dmm", default_traits = ZTRAITS_LAVALAND) - else if (!isnull(config.minetype) && config.minetype != "none") - INIT_ANNOUNCE("WARNING: An unknown minetype '[config.minetype]' was set! This is being ignored! Update the maploader code!") + //SKYRAT EDIT CHANGE BEGIN + var/mining_map_to_load = SSrandommining.choosen_map + var/mining_traits_to_load = GLOB.mining_traits[SSrandommining.traits] + + if(mining_map_to_load) + add_startupmessage("MINING MAP: Loading random mining level...") + if(!mining_traits_to_load) + add_startupmessage("MINING MAP ERROR: No z-level traits detected, loading without traits.") + LoadGroup(FailedZs, "Mining Level", "map_files/Mining", mining_map_to_load, default_traits = mining_traits_to_load) + add_startupmessage("MINING MAP: Loaded successfully.") + else + add_startupmessage("MINING MAP ERROR: No loadable map z-levels detected, reverting to backup mining system!") + if(config.minetype == "lavaland") + LoadGroup(FailedZs, "Lavaland", "map_files/Mining", "Lavaland.dmm", default_traits = ZTRAITS_LAVALAND) + else if (!isnull(config.minetype) && config.minetype != "none") + INIT_ANNOUNCE("WARNING: An unknown minetype '[config.minetype]' was set! This is being ignored! Update the maploader code!") + //SKYRAT EDIT END #endif if(LAZYLEN(FailedZs)) //but seriously, unless the server's filesystem is messed up this will never happen diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm index e3de0992edb..84678bcab1a 100644 --- a/code/modules/mining/mine_items.dm +++ b/code/modules/mining/mine_items.dm @@ -73,7 +73,7 @@ desc = "Used to call and send the mining shuttle." circuit = /obj/item/circuitboard/computer/mining_shuttle shuttleId = "mining" - possible_destinations = "mining_home;mining_away;landing_zone_dock;mining_away_rockplanet" //SKYRAT EDIT CHANGE + possible_destinations = "mining_home;mining_away;landing_zone_dock" no_destination_swap = TRUE var/static/list/dumb_rev_heads = list() diff --git a/config/skyrat/mining_levels.txt b/config/skyrat/mining_levels.txt new file mode 100644 index 00000000000..750aee2d78a --- /dev/null +++ b/config/skyrat/mining_levels.txt @@ -0,0 +1,2 @@ +Lavaland.dmm+lavaland +Rockplanet.dmm+rockplanet \ No newline at end of file diff --git a/modular_skyrat/modules/random_mining/code/mining_maps.dm b/modular_skyrat/modules/random_mining/code/mining_maps.dm new file mode 100644 index 00000000000..78b4c3bb602 --- /dev/null +++ b/modular_skyrat/modules/random_mining/code/mining_maps.dm @@ -0,0 +1,52 @@ +SUBSYSTEM_DEF(randommining) + name = "Random Mining" + flags = SS_NO_FIRE + init_order = INIT_ORDER_TICKER + + var/previous_map + var/choosen_map + var/traits + +/datum/controller/subsystem/randommining/Initialize() + + var/list/possible_choices = list() + + if(fexists("data/previous_mining.dat")) + var/_previous_map = file2text("data/previous_mining.dat") + if(istext(_previous_map)) + previous_map = _previous_map + + if(!fexists("config/skyrat/mining_levels.txt")) + add_startupmessage("RANDOM MINING ERROR: mining_levels.txt does not exist, unable to load mining level!") + return ..() + + var/list/lines = world.file2list("config/skyrat/mining_levels.txt") + for(var/line in lines) + if(!length(line)) + continue + if(findtextEx(line, "#", 1, 2)) + continue + var/list/L = splittext(line,"+") + if(L.len < 2) + continue + var/name = L[1] + var/traits = L[2] + if(name == previous_map && lines.len > 1) + continue + possible_choices[name] = traits + add_startupmessage("RANDOM MINING: [uppertext(name)] Level loaded!") + + choosen_map = pick(possible_choices) + traits = possible_choices[choosen_map] + + if(!choosen_map) + add_startupmessage("RANDOM MINING: Error, no map was chosen!") + else + add_startupmessage("RANDOM MINING: Map randomly picked!") + + return ..() + +/datum/controller/subsystem/randommining/Shutdown() + if(choosen_map) + var/F = file("data/previous_mining.dat") + WRITE_FILE(F, choosen_map) diff --git a/tgstation.dme b/tgstation.dme index 7039a9a8d54..209a31085c3 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -170,6 +170,7 @@ #include "code\__DEFINES\~skyrat_defines\mapping.dm" #include "code\__DEFINES\~skyrat_defines\maps.dm" #include "code\__DEFINES\~skyrat_defines\medical_defines.dm" +#include "code\__DEFINES\~skyrat_defines\mining_traits.dm" #include "code\__DEFINES\~skyrat_defines\obj_flags.dm" #include "code\__DEFINES\~skyrat_defines\preferences.dm" #include "code\__DEFINES\~skyrat_defines\projectiles.dm" @@ -4182,6 +4183,7 @@ #include "modular_skyrat\modules\posi_alert\code\game\machinery\posialert.dm" #include "modular_skyrat\modules\QOL\code\_under.dm" #include "modular_skyrat\modules\radiosound\code\game\objects\items\devices\radio\headset.dm" +#include "modular_skyrat\modules\random_mining\code\mining_maps.dm" #include "modular_skyrat\modules\roboclothes\code\clothing\robotics_clothing.dm" #include "modular_skyrat\modules\roboclothes\code\vending\wardrobes.dm" #include "modular_skyrat\modules\ruins\space.dm"