Map element datums (#10137)

* Refactor away missions and vaults

* Logging

* Allow map elements to be spawned on new zlevels

* Changelog

* Last changes
This commit is contained in:
unid15
2016-05-29 03:04:41 +02:00
committed by clusterfack
parent d984fcb11d
commit 3d1ae81414
9 changed files with 202 additions and 141 deletions

View File

@@ -44,8 +44,7 @@ var/list/admin_verbs_admin = list(
/client/proc/jumptokey, /*allows us to jump to the location of a mob with a certain ckey*/
/client/proc/jumptomob, /*allows us to jump to a specific mob*/
/client/proc/jumptoturf, /*allows us to jump to a specific turf*/
/client/proc/jumptovault, /*allows us to jump to a specific vault*/
/client/proc/jumptoaway, /*allows us to jump to a specific away mission*/
/client/proc/jumptomapelement, /*allows us to jump to a specific vault*/
/client/proc/admin_call_shuttle, /*allows us to call the emergency shuttle*/
/client/proc/admin_cancel_shuttle, /*allows us to cancel the emergency shuttle, sending it back to centcomm*/
/client/proc/cmd_admin_direct_narrate, /*send text directly to a player with no padding. Useful for narratives and fluff-text*/
@@ -129,6 +128,7 @@ var/list/admin_verbs_spawn = list(
/client/proc/respawn_character, //Allows us to re-spawn someone
/client/proc/debug_reagents, //Allows us to spawn reagents in mobs/containers
/client/proc/create_awaymission, //Allows us to summon away missions
/client/proc/create_map_element
)
var/list/admin_verbs_server = list(
/client/proc/Set_Holiday,
@@ -285,7 +285,8 @@ var/list/admin_verbs_hideable = list(
/proc/possess,
/proc/release,
/client/proc/gc_dump_hdl,
/client/proc/debug_pooling
/client/proc/debug_pooling,
/client/proc/create_map_element
)
var/list/admin_verbs_mod = list(
/client/proc/cmd_admin_pm_context, /*right-click adminPM interface*/
@@ -1104,6 +1105,68 @@ var/list/admin_verbs_mod = list(
log_admin("[key_name(src)] sent a fax to all machines.: [sent]")
message_admins("[key_name_admin(src)] sent a fax to all machines.", 1)
/client/proc/create_map_element()
set category = "Admin"
set name = "Load Map Element"
set desc = "Loads a map element - a vault, an away mission or something else."
if(!check_rights(R_SPAWN))
return
var/datum/map_element/ME
var/mission_to_load = alert(usr, "How do you want to select the map element?", "Map element loading", "Choose a /datum/map_element object", "Load external .dmm file", "Cancel")
switch(mission_to_load)
if("Choose a /datum/map_element object")
var/new_map_element = input(usr, "Please select the map element object.", "Map element loading") as null|anything in typesof(/datum/map_element) - /datum/map_element
if(!new_map_element) return
ME = new new_map_element
log_admin("[key_name(src)] is trying to load [ME.file_path].")
if("Load external .dmm file")
to_chat(src, "<span class='danger'>Do not load very large maps or files that aren't BYOND maps. If you want to be sure that your map won't hang up the game, try loading it on a local server first.</span>")
ME = new /datum/map_element
log_admin("[key_name(src)] is trying to load an external map file.")
var/new_file_path = input(usr, "Select a .dmm file. WARNING: Very large map files WILL crash the server. Loading them is punishable by death.", "Map element loading") as null|file
if(!new_file_path) return
log_admin("[key_name(src)] has selected [new_file_path] for loading.")
ME.file_path = new_file_path
else
return
var/x_coord
var/y_coord
var/z_coord
switch(alert(usr, "Select a location for the new map element", "Map element loading", "Use my current location", "Input coordinates", "Cancel"))
if("Use my current location")
var/turf/new_location = get_turf(usr)
if(!new_location)
return
x_coord = new_location.x
y_coord = new_location.y
z_coord = new_location.z
if("Input coordinates")
x_coord = input(usr, "Input the X coordinate: ", "Map element loading") as null|num
if(x_coord == null) return
y_coord = input(usr, "Input the Y coordinate (X = [x_coord]): ", "Map element loading") as null|num
if(y_coord == null) return
z_coord = input(usr, "Input the Z coordinate. If it's higher than [world.maxz], a new Z-level will be created (X = [x_coord], Y = [y_coord]): ", "Map element loading") as null|num
if(z_coord == null) return
if("Cancel")
return
log_admin("[key_name(src)] is loading [ME.file_path] at [x_coord], [y_coord], [z_coord]")
message_admins("[key_name_admin(src)] is loading [ME.file_path] at [x_coord], [y_coord], [z_coord]")
ME.load(x_coord, y_coord, z_coord)
message_admins("[ME.file_path] loaded at [ME.location ? formatJumpTo(ME.location) : "[x_coord], [y_coord], [z_coord]"]")
/client/proc/create_awaymission()
set category = "Admin"
set name = "Create Away Mission"
@@ -1121,7 +1184,7 @@ var/list/admin_verbs_mod = list(
to_chat(src, "<span class='danger'>WARNING: Loading large away missions may temporarily hang up the server. Usually the lag will last for less than a minute.</span><hr>")
for(var/datum/away_mission/AM in L)
for(var/datum/map_element/away_mission/AM in L)
if(AM.name)
choices[AM.name] = AM
else
@@ -1135,7 +1198,7 @@ var/list/admin_verbs_mod = list(
log_admin("[key_name(src)] is loading an away mission: [choice]")
message_admins("[key_name_admin(src)] is loading an away mission: [choice]", 1)
var/datum/away_mission/AM = choices[choice]
var/datum/map_element/away_mission/AM = choices[choice]
var/override = 0
if(existing_away_missions.len)

View File

@@ -110,9 +110,9 @@
else
alert("Admin jumping disabled")
/client/proc/jumptovault()
/client/proc/jumptomapelement()
set category = "Admin"
set name = "Jump to Vault"
set name = "Jump to Map Element"
if(!check_rights())
return
@@ -120,16 +120,18 @@
if(config.allow_admin_jump)
var/list/vaults = list()
for(var/datum/vault/V in existing_vaults)
vaults["[V.map_name] at [V.location ? "[V.location.x], [V.location.y], [V.location.z]" : "UNKNOWN"]"] = V
for(var/datum/map_element/V in map_elements)
var/name = "[V.type_abbreviation] [V.name ? V.name : V.file_path] @ [V.location ? "[V.location.x],[V.location.y],[V.location.z]" : "UNKNOWN"]"
var/selection = input("Select a vault to teleport to.", "Admin Jumping", null, null) as null|anything in sortList(vaults)
vaults[name] = V
var/selection = input("Select a map element to teleport to. AM = Away Mission, V = Vault.", "Admin Jumping", null, null) as null|anything in sortList(vaults)
if(!selection)
return
var/datum/vault/V = vaults[selection]
var/datum/map_element/V = vaults[selection]
if(!V.location)
to_chat(src, "[V.map_name] doesn't have a location! Report this")
to_chat(src, "[V.file_path] doesn't have a location! Report this")
return
usr.forceMove(V.location)
@@ -137,33 +139,6 @@
else
alert("Admin jumping disabled")
/client/proc/jumptoaway()
set category = "Admin"
set name = "Jump to Away Mission"
if(!check_rights())
return
if(!config.allow_admin_jump)
alert("Admin jumping disabled")
return
var/list/awaymissions = list()
for(var/datum/away_mission/AM in existing_away_missions)
awaymissions["[AM.name] ([AM.file_path][AM.location ? ", Z:[AM.location.z]" : ""])"] = AM
var/selection = input("Select a vault to teleport to.", "Admin Jumping", null, null) as null|anything in sortList(awaymissions)
if(!selection)
return
var/datum/away_mission/AM = awaymissions[selection]
if(!AM.location)
to_chat(src, "[AM.name] doesn't have a location! Panic")
return
usr.forceMove(AM.location)
feedback_add_details("admin_verb","JV")
/client/proc/Getmob(var/mob/M in mob_list)
set category = "Admin"
set name = "Get Mob"