Actually fixes mining maps lol (#4968)

* Update mining_maps.dm

* Update mining_maps.dm

* a

* aaa

* aaaa

* Update mining_maps.dm

* aaaaa
This commit is contained in:
Gandalf
2021-04-17 15:52:34 +01:00
committed by GitHub
parent 76f0086dac
commit f136e49b88
5 changed files with 52 additions and 13 deletions
+1 -1
View File
@@ -281,7 +281,7 @@ Used by the AI doomsday and the self-destruct nuke.
var/mining_traits_to_load = GLOB.mining_traits[SSrandommining.traits]
if(mining_map_to_load)
add_startupmessage("MINING MAP: Loading random mining level...")
add_startupmessage("MINING MAP: Loading 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)
+3 -1
View File
@@ -132,7 +132,9 @@ SUBSYSTEM_DEF(vote)
SSmapping.map_voted = TRUE
//SKYRAT EDIT ADDITION BEGIN
if("mining_map")
SSrandommining.voted_next_map = .
SSrandommining.voted_next_map = TRUE
if(fexists("data/next_mining.dat"))
fdel("data/next_mining.dat")
var/F = file("data/next_mining.dat")
WRITE_FILE(F, .)
if("transfer")
+1
View File
@@ -135,6 +135,7 @@ GLOBAL_PROTECT(admin_verbs_server)
/client/proc/cmd_admin_delete, /*delete an instance/object/mob/etc*/
/client/proc/cmd_debug_del_all,
/client/proc/toggle_random_events,
/client/proc/set_mining_map, //SKYRAT EDIT ADDITION
/client/proc/forcerandomrotate,
/client/proc/adminchangemap,
/client/proc/panicbunker,
+2
View File
@@ -453,6 +453,7 @@
setTimer(SSshuttle.emergencyDockTime)
send2adminchat("Server", "The Emergency Shuttle has docked with the station.")
priority_announce("[SSshuttle.emergency] has docked with the station. You have [timeLeft(600)] minutes to board the Emergency Shuttle.", null, ANNOUNCER_SHUTTLEDOCK, "Priority")
SSrandommining.mapvote()
ShuttleDBStuff()
@@ -467,6 +468,7 @@
if(M.launch_status == UNLAUNCHED) //Pods will not launch from the mine/planet, and other ships won't launch unless we tell them to.
M.check_transit_zone()
if(SHUTTLE_IGNITING)
var/success = TRUE
SSshuttle.checkHostileEnvironment()
@@ -15,14 +15,16 @@ SUBSYSTEM_DEF(randommining)
var/list/possible_choices = list()
if(fexists("data/next_mining.dat"))
var/_voted_map = file2text("data/next_mining.dat")
if(istext(_voted_map))
voted_map = _voted_map
var/list/_voted_map = world.file2list("data/next_mining.dat")
if(istext(_voted_map[1]))
voted_map = _voted_map[1]
fdel("data/previous_mining.dat")
if(fexists("data/previous_mining.dat"))
var/_previous_map = file2text("data/previous_mining.dat")
if(istext(_previous_map))
previous_map = _previous_map
var/list/_previous_map = world.file2list("data/previous_mining.dat")
if(istext(_previous_map[1]))
previous_map = _previous_map[1]
fdel("data/previous_mining.dat")
if(!fexists("config/skyrat/mining_levels.txt"))
add_startupmessage("RANDOM MINING ERROR: mining_levels.txt does not exist, unable to load mining level!")
@@ -46,7 +48,7 @@ SUBSYSTEM_DEF(randommining)
add_startupmessage("RANDOM MINING: [uppertext(name)] Level loaded!")
if(voted_map)
chosen_map = possible_choices[voted_map]
chosen_map = voted_map
traits = possible_choices[chosen_map]
else
chosen_map = pick(possible_choices)
@@ -54,12 +56,44 @@ SUBSYSTEM_DEF(randommining)
if(!chosen_map)
add_startupmessage("RANDOM MINING: Error, no map was chosen!")
return ..()
else if(voted_map)
add_startupmessage("RANDOM MINING: Voted map loaded!")
else
add_startupmessage("RANDOM MINING: Map randomly picked!")
var/F = file("data/previous_mining.dat")
WRITE_FILE(F, chosen_map)
return ..()
/datum/controller/subsystem/randommining/Shutdown()
if(chosen_map)
var/F = file("data/previous_mining.dat")
WRITE_FILE(F, chosen_map)
/datum/controller/subsystem/randommining/proc/mapvote()
if(voted_next_map) //If voted or set by other means.
return
if(SSvote.mode) //Theres already a vote running, default to rotation.
to_chat(world, "<span class='boldannounce'>MAPPING VOTE ERROR; VOTE IN PROGRESS, REVERTING TO RANDOM MAP.")
if(fexists("data/next_mining.dat"))
fdel("data/next_mining.dat")
return
SSvote.initiate_vote("mining_map", "automatic mining map rotation")
/client/proc/set_mining_map()
set name = "Set Mining Map"
set category = "Server"
set desc = "Force change the next mining map."
if(!check_rights(R_SERVER))
return
var/new_map = tgui_input_list(usr, "Choose a mining map:", "Mining Map Change", SSrandommining.possible_names)
if(fexists("data/next_mining.dat"))
fdel("data/next_mining.dat")
var/F = file("data/next_mining.dat")
WRITE_FILE(F, new_map)
SSrandommining.voted_next_map = TRUE
message_admins("[key_name_admin(usr)] has set the next mining map to [new_map]!")