diff --git a/code/__HELPERS/_lists.dm b/code/__HELPERS/_lists.dm index e66d528a5af..9ff38a3477a 100644 --- a/code/__HELPERS/_lists.dm +++ b/code/__HELPERS/_lists.dm @@ -488,3 +488,15 @@ L1[key] += other_value else L1[key] = other_value + +/proc/print_single_line(list/L) + . = "list(" + for(var/I in 1 to L.len) + var/key = L[I] + . += "[key]" + var/val = L[key] + if(!isnull(val)) + . += " => [val]" + if(I < L.len) + . += ", " + . += ")" diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index e8803868fef..1f7dca59b35 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -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! diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index ae547140404..13314afeb2f 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -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() diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 1ee98d15557..1b099a9e0a5 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -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 diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 94d955bdd0c..c4a4d249e99 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -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)