Spawn QOL

This commit is contained in:
unid15
2017-10-29 08:36:32 +01:00
parent 8984ad596a
commit fa7b533b48
3 changed files with 19 additions and 4 deletions

View File

@@ -1273,12 +1273,22 @@ var/global/floorIsLava = 0
*/
/datum/admins/proc/spawn_atom(var/object as text)
set category = "Debug"
set desc = "(atom path) Spawn an atom. Finish path with a period to hide subtypes"
set desc = "(atom path) Spawn an atom. Finish path with a period to hide subtypes, include any variable changes at the end like so: {name=\"Test\";amount=50}"
set name = "Spawn"
if(!check_rights(R_SPAWN))
return
//Parse and strip any changed variables (added in curly brackets at the end of the input string)
var/variables_start = findtext(object,"{")
var/list/varchanges = list()
if(variables_start)
var/parameters = copytext(object,variables_start+1,length(object))//removing the last '}'
varchanges = readlist(parameters, ";")
object = copytext(object, 1, variables_start)
var/list/matches = get_matching_types(object, /atom)
if(matches.len==0)
@@ -1292,6 +1302,8 @@ var/global/floorIsLava = 0
if(!chosen)
return
_preloader = new(varchanges, chosen)
if(ispath(chosen,/turf))
var/turf/T = get_turf(usr.loc)
T.ChangeTurf(chosen)