Away mission refactoring (#9850)

* Away mission refactor

* add to config example

* Better interface

* Attempt to make map loading less laggy. Change category of new verb

* Let admins jump to created away missions

* Fix issues noticed by PJB

* Check admin rights

* Let gateways connect to multiple away missions. Fix gateway connections

* switch order of ..() and gateways.Remove(src)

* change var name
This commit is contained in:
unid15
2016-05-14 08:45:56 +02:00
committed by clusterfack
parent e962363660
commit 5bf7f08ee1
16 changed files with 349 additions and 90 deletions

View File

@@ -45,6 +45,7 @@ var/list/admin_verbs_admin = list(
/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/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*/
@@ -126,7 +127,8 @@ var/list/admin_verbs_spawn = list(
/client/proc/spawn_datum, //Allows us to spawn datums to the marked datum buffer
/client/proc/cmd_admin_dress, //Allows us to spawn clothing and dress a mob with it in one click
/client/proc/respawn_character, //Allows us to re-spawn someone
/client/proc/debug_reagents //Allows us to spawn reagents in mobs/containers
/client/proc/debug_reagents, //Allows us to spawn reagents in mobs/containers
/client/proc/create_awaymission, //Allows us to summon away missions
)
var/list/admin_verbs_server = list(
/client/proc/Set_Holiday,
@@ -181,6 +183,7 @@ var/list/admin_verbs_debug = list(
/client/proc/test_snap_UI,
/client/proc/configFood,
/client/proc/debug_reagents,
/client/proc/create_awaymission,
/client/proc/make_invulnerable,
/client/proc/cmd_admin_dump_delprofile,
/client/proc/mob_list,
@@ -1100,3 +1103,48 @@ 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_awaymission()
set category = "Admin"
set name = "Create Away Mission"
set desc = "Creates an away mission and links it to the station's gateway."
//Check admin rights
if(!check_rights(R_SPAWN))
return
var/list/L = getRandomZlevels(1)
var/list/choices = list()
if(!L.len)
to_chat(src, "No away missions found.")
return
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)
if(AM.name)
choices[AM.name] = AM
else
choices[AM.file_path] = AM
to_chat(src, "<b>[(AM.name ? AM.name : AM.file_path)]</b> - <span class='info'>[(AM.desc ? AM.desc : "No description")]</span>")
var/choice = input(src, "Select an away mission to load. See chat for descriptions!", "AWAY MISSIONS") as null|anything in choices
if(!choice) return
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/override = 0
if(existing_away_missions.len)
var/continue_loading = alert(src, "There is already an away mission loaded. Do you want to load [AM.name] anyway? If there are more than two away mission gateways, the station gateway will be able to teleport its users to both of them.", "AWAY MISSIONS", "Yes", "No")
if(!continue_loading) return
if(continue_loading == "Yes")
override = 1
to_chat(src, "Attempting to load [AM.name] ([AM.file_path])...")
createRandomZlevel(override, AM, usr)
to_chat(src, "The away mission has been generated on z-level [world.maxz] [AM.location ? "([formatJumpTo(AM.location)])" : ""]")