Improves the spawn command (#13063)

* Improves the spawn command

* fix description
This commit is contained in:
unid15
2016-12-25 22:53:21 +01:00
committed by ComicIronic
parent ff06eeb31c
commit e3b2c17322
3 changed files with 27 additions and 4 deletions

View File

@@ -1240,7 +1240,7 @@ var/global/floorIsLava = 0
*/
/datum/admins/proc/spawn_atom(var/object as text)
set category = "Debug"
set desc = "(atom path) Spawn an atom"
set desc = "(atom path) Spawn an atom. Finish path with a period to hide subtypes"
set name = "Spawn"
if(!check_rights(R_SPAWN))
@@ -1248,9 +1248,17 @@ var/global/floorIsLava = 0
var/list/matches = new()
for(var/path in typesof(/atom))
if(findtext("[path]", object))
matches += path
if(text_ends_with(object, ".")) //Path ends with a dot - DO NOT include subtypes
object = copytext(object, 1, length(object)) //Remove the dot
for(var/path in typesof(/atom))
if(text_ends_with("[path]", object))
matches += path
else //Include subtypes
for(var/path in typesof(/atom))
if(findtext("[path]", object))
matches += path
if(matches.len==0)
return