Allows admins to pass parameters to New() (#26613)

* /proc/print_single_line(list/L)

* Admin datum/New parameters

* Fixes
This commit is contained in:
Cyberboss
2017-05-01 11:55:58 -06:00
committed by duncathan salt
parent 1955724e28
commit 9d0185c023
5 changed files with 61 additions and 8 deletions
+23 -2
View File
@@ -610,20 +610,41 @@
set desc = "(atom path) Spawn an atom"
set name = "Spawn"
return spawn_atom_impl(object, FALSE)
/datum/admins/proc/spawn_atom_adv(object as text)
set category = "Debug"
set desc = "(atom path) Spawn an atom with New() parameters"
set name = "Advanced Spawn"
return spawn_atom_impl(object, TRUE)
/datum/admins/proc/spawn_atom_impl(object, params)
if(!check_rights(R_SPAWN))
return
var/chosen = pick_closest_path(object)
if(!chosen)
return
var/list/arguments
if(ispath(chosen,/turf))
var/turf/T = get_turf(usr.loc)
T.ChangeTurf(chosen)
else
var/atom/A = new chosen(usr.loc)
if(params)
arguments = usr.client.get_callproc_args(TRUE)
if(!usr)
return
arguments = list(usr.loc) + arguments
var/atom/A = new chosen(arglist(arguments))
A.admin_spawned = TRUE
log_admin("[key_name(usr)] spawned [chosen] at ([usr.x],[usr.y],[usr.z])")
log_admin("[key_name(usr)] spawned [chosen] at [COORD(usr)][LAZYLEN(arguments) > 1 ? " with parameters [print_single_line(arguments)]": ""]")
SSblackbox.add_details("admin_verb","Spawn Atom") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
+1 -1
View File
@@ -103,7 +103,7 @@ GLOBAL_LIST_INIT(admin_verbs_fun, list(
/client/proc/smite
))
GLOBAL_PROTECT(admin_verbs_spawn)
GLOBAL_LIST_INIT(admin_verbs_spawn, list(/datum/admins/proc/spawn_atom,/client/proc/respawn_character))
GLOBAL_LIST_INIT(admin_verbs_spawn, list(/datum/admins/proc/spawn_atom,/datum/admins/proc/spawn_atom_adv,/client/proc/respawn_character))
GLOBAL_PROTECT(admin_verbs_server)
GLOBAL_LIST_INIT(admin_verbs_server, world.AVerbsServer())
/world/proc/AVerbsServer()
+2 -2
View File
@@ -145,8 +145,8 @@ GLOBAL_PROTECT(AdminProcCallCount)
/client/proc/get_callproc_args()
var/argnum = input("Number of arguments","Number:",0) as num|null
/client/proc/get_callproc_args(is_atom_new = FALSE)
var/argnum = input("Number of arguments[is_atom_new ? " (Excluding loc)" : ""]","Number:",0) as num|null
if(isnull(argnum))
return
+23 -3
View File
@@ -213,7 +213,14 @@ GLOBAL_PROTECT(VVpixelmovement)
.["class"] = null
return
.["type"] = type
.["value"] = new type()
var/list/arguments
if(alert(usr, "Would you like to add arguments?", "New Atom", "No", "Yes") == "Yes")
arguments = get_callproc_args(FALSE)
else
arguments = list()
.["value"] = new type(arglist(arguments))
if (VV_NEW_DATUM)
var/type = pick_closest_path(FALSE, get_fancy_list_of_datum_types())
@@ -221,7 +228,13 @@ GLOBAL_PROTECT(VVpixelmovement)
.["class"] = null
return
.["type"] = type
.["value"] = new type()
var/list/arguments
if(alert(usr, "Would you like to add arguments?", "New Atom", "No", "Yes") == "Yes")
arguments = get_callproc_args(FALSE)
else
arguments = list()
.["value"] = new type(arglist(arguments))
if (VV_NEW_TYPE)
var/type = current_value
@@ -237,7 +250,14 @@ GLOBAL_PROTECT(VVpixelmovement)
.["class"] = null
return
.["type"] = type
.["value"] = new type()
var/list/arguments
if(alert(usr, "Would you like to add arguments?", "New Atom", "No", "Yes") == "Yes")
arguments = get_callproc_args(FALSE);
else
arguments = list()
.["value"] = new type(arglist(arguments))
if (VV_NEW_LIST)