Files
Yogstation/code/modules/admin/verbs/maprotation.dm
Byemoh d93428fe4b [MDB IGNORE] [PRE-ALPHA] MiniStation (#22568)
* Create MiniStation new.dmm

* ministation

* Update MiniStation.dmm

* Update MiniStation.dmm

* Update MiniStation.dmm

* ministayion

* Update MiniStation.dmm

* Update MiniStation.dmm

* Update MiniStation.dmm

* actual changes oops

* Update MiniStation.dmm

* Update MiniStation.dmm

* miniaturestation

* Update maps.txt

* more fixes

* fixes broken path

* more fixes

* Update MiniStation.dmm

* Update MiniStation.dmm

* filters

* robotics changes

* fixes pipes

* Update MiniStation.dmm

* Update MiniStation.dmm

* Update MiniStation.dmm

* spawns + job overrides

* Update MiniStation.dmm

* Update MiniStation.dmm

* Update MiniStation.dmm

* Update MiniStation.dmm

* more work

* Update MiniStation.dmm

* misc stuff

* maint stuff

* uopdates

* fixes bad area and chair

* tool storage + fixes

* mining APC

* cargo + hooks up some disposals

* more disposals + launcher

* lights

* more fixes

* Update MiniStation.dmm

* Update MiniStation.dmm

* more fixes

* sink

* remove sign

* expand janitor room

* Update MiniStation.dmm

* ai stuff + more firealarms

* meeting room, etc

* fixes wire

* Update MiniStation.dmm

* fixes

* Update MiniStation.dmm

* yep!

* atmos area

* fixes some map errors

* bookbinder

* robo shutters

* stair and chem fix

* fixes bad decals

* honesly no clue what's different

* disposals + pets

* Update MiniStation.dmm

* asteroid area

* more fixes

* medbay mixup

* choom button

* wire toxin room to grid

* remove this

* more fixes

* Update ai_whale.dmm

* more cameras

* Update networking_machines.dm

* update freezer

* Update MiniStation.dmm

* Update MiniStation.dmm

* Update MiniStation.dmm

* new service

* hawk + tuah + backrooms

* special charters

* remove that lol

* move him a little

* Update MiniStation.dmm

* yeah

* Update MiniStation.dmm

* psych office + more fixes + robo stuff

* thermomachines

* Update MiniStation.dmm

* maints + APCs

* all this stuff

* cameras

* air alarms

* RD office and the like

* Update MiniStation.dmm

* fixes these

* glass floors

* Update MiniStation.dmm

* more firelocks

* Update MiniStation.dmm

* Update MiniStation.dmm

* Update MiniStation.dmm

* Update MiniStation.dmm

* Update MiniStation.dmm

* extra pipe moment

* Update MiniStation.dmm

* looking up and down/fixes

* neat

* wire

* Update MiniStation.dmm

* fixes some issues

* asdad

* better SM stuff

* amon gus

* fixing falling

* Update MiniStation.dmm

* Update MiniStation.dmm

* fixes this

* fixes

* Update MiniStation.dmm

* remove stairs

* Update MiniStation.dmm

* Update MiniStation.dmm

* Update MiniStation.dmm

* fixes some ai stuff

* Update MiniStation.dmm

* adds some missing bells

* maint

* more maint stuff

* ai upload and goodbye meeting room

* fixes multiz pda stuff

* fixes locker

* ministation fixes

* requested changes

* shadows

* removes shadows

* adds medhuds

* no smoking

* move up/down

* correct medhuds

* brig stuff

* cameras

* fixes

* more lights

* more fixes

* fix one turf

* idk randomstuff

* more lights

* navigation nation (thanks plant)

* fixes + better flooring

* jamie changes

* myriad changes

* some more stuff

* server room fix
2024-10-19 00:13:31 +01:00

136 lines
4.9 KiB
Plaintext

/client/proc/forcerandomrotate()
set category = "Server"
set name = "Trigger Random Map Rotation"
var/rotate = tgui_alert(usr,"Force a random map rotation to trigger?", "Rotate map?", list("Yes", "Cancel"))
if (rotate != "Yes")
return
message_admins("[key_name_admin(usr)] is forcing a random map rotation.")
log_admin("[key_name(usr)] is forcing a random map rotation.")
SSticker.maprotatechecked = 1
SSmapping.maprotate()
/client/proc/adminchangemap()
set category = "Server"
set name = "Change Map"
var/list/maprotatechoices = list()
for (var/map in config.maplist)
var/datum/map_config/VM = config.maplist[map]
var/mapname = VM.map_name
if (VM == config.defaultmap)
mapname += " (Default)"
if (VM.config_min_users > 0 || VM.config_max_users > 0)
mapname += " \["
if (VM.config_min_users > 0)
mapname += "[VM.config_min_users]"
else
mapname += "0"
mapname += "-"
if (VM.config_max_users > 0)
mapname += "[VM.config_max_users]"
else
mapname += "inf"
mapname += "\]"
maprotatechoices[mapname] = VM
var/chosenmap = input("Choose a map to change to", "Change Map") as null|anything in (maprotatechoices|"Custom")
if (!chosenmap)
return
if(chosenmap == "Custom")
message_admins("[key_name_admin(usr)] is changing the map to a custom map")
log_admin("[key_name(usr)] is changing the map to a custom map")
var/datum/map_config/virtual_map = new
var/map_file = input(usr, "Pick file:", "Map File") as null|file
if(isnull(map_file))
return
if(copytext("[map_file]", -4) != ".dmm")//4 == length(".dmm")
to_chat(usr, span_warning("Filename must end in '.dmm': [map_file]"))
return
if(fexists("_maps/custom/[map_file]"))
fdel("_maps/custom/[map_file]")
if(!fcopy(map_file, "_maps/custom/[map_file]"))
return
// This is to make sure the map works so the server does not start without a map.
var/datum/parsed_map/M = new (map_file)
if(!M)
to_chat(usr, span_warning("Map '[map_file]' failed to parse properly."))
return
if(!M.bounds)
to_chat(usr, span_warning("Map '[map_file]' has non-existant bounds."))
qdel(M)
return
qdel(M)
var/config_file = null
var/list/json_value = list()
var/config = tgui_alert(usr,"Would you like to upload an additional config for this map?", "Map Config", list("Yes", "No"))
if(config == "Yes")
config_file = input(usr, "Pick file:", "Config JSON File") as null|file
if(isnull(config_file))
return
if(copytext("[config_file]", -5) != ".json")
to_chat(src, span_warning("Filename must end in '.json': [config_file]"))
return
if(fexists("data/custom_map_json/[config_file]"))
fdel("data/custom_map_json/[config_file]")
if(!fcopy(config_file, "data/custom_map_json/[config_file]"))
return
if (virtual_map.LoadConfig("data/custom_map_json/[config_file]", TRUE) != TRUE)
to_chat(src, span_warning("Failed to load config: [config_file]. Check that the fields are filled out correctly. \"map_path\": \"custom\" and \"map_file\": \"your_map_name.dmm\""))
return
json_value = list(
"version" = MAP_CURRENT_VERSION,
"map_name" = virtual_map.map_name,
"map_path" = virtual_map.map_path,
"map_file" = virtual_map.map_file,
"shuttles" = virtual_map.shuttles,
"traits" = virtual_map.traits,
"job_changes" = virtual_map.job_changes,
)
else
virtual_map = load_map_config()
virtual_map.map_name = input(usr, "Choose the name for the map", "Map Name") as null|text
if(isnull(virtual_map.map_name))
virtual_map.map_name = "Custom"
var/shuttles = tgui_alert(usr,"Do you want to modify the shuttles?", "Map Shuttles", list("Yes", "No"))
if(shuttles == "Yes")
for(var/s in virtual_map.shuttles)
var/shuttle = input(usr, s, "Map Shuttles") as null|text
if(!shuttle)
continue
if(!SSmapping.shuttle_templates[shuttle])
to_chat(usr, span_warning("No such shuttle as '[shuttle]' exists, using default."))
continue
virtual_map.shuttles[s] = shuttle
json_value = list(
"version" = MAP_CURRENT_VERSION,
"map_name" = virtual_map.map_name,
"map_path" = CUSTOM_MAP_PATH,
"map_file" = "[map_file]",
"shuttles" = virtual_map.shuttles,
)
// If the file isn't removed text2file will just append.
if(fexists(PATH_TO_NEXT_MAP_JSON))
fdel(PATH_TO_NEXT_MAP_JSON)
text2file(json_encode(json_value), PATH_TO_NEXT_MAP_JSON)
if(SSmapping.changemap(virtual_map))
message_admins("[key_name_admin(usr)] has changed the map to [virtual_map.map_name]")
log_admin("[key_name_admin(usr)] has changed the map to [virtual_map.map_name]")
SSticker.maprotatechecked = 1
fdel("data/custom_map_json/[config_file]")
else
var/datum/map_config/virtual_map = maprotatechoices[chosenmap]
if (SSmapping.changemap(virtual_map))
message_admins("[key_name_admin(usr)] has changed the map to [virtual_map.map_name]")
log_admin("[key_name_admin(usr)] has changed the map to [virtual_map.map_name]")
SSticker.maprotatechecked = 1