Random mining! [DOWNSTREAM IMPORTANCE LEVEL 1] (#4957)

* aaaa

* AAAAAAAAAAAAAAAAAA

* 0..

* Update mapping.dm

* Update Rockplanet.dmm
This commit is contained in:
Gandalf
2021-04-17 00:19:58 +02:00
committed by GitHub
parent a00c7131e9
commit 73a45dea8e
7 changed files with 85 additions and 21 deletions
@@ -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" = (
@@ -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
))
+17 -4
View File
@@ -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
+1 -1
View File
@@ -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()
+2
View File
@@ -0,0 +1,2 @@
Lavaland.dmm+lavaland
Rockplanet.dmm+rockplanet
@@ -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)
+2
View File
@@ -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"