mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
Spawn QOL
This commit is contained in:
@@ -463,6 +463,9 @@ var/list/number_units=list(
|
||||
"billion"
|
||||
)
|
||||
|
||||
// The " character
|
||||
var/quote = ascii2text(34)
|
||||
|
||||
/proc/num2words(var/number, var/zero="zero", var/minus="minus", var/hundred="hundred", var/list/digits=number_digits, var/list/tens=number_tens, var/list/units=number_units, var/recursion=0)
|
||||
if(!isnum(number))
|
||||
warning("num2words fed a non-number: [number]")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -315,7 +315,7 @@ var/list/map_dimension_cache = list()
|
||||
|
||||
//text trimming (both directions) helper proc
|
||||
//optionally removes quotes before and after the text (for variable name)
|
||||
/dmm_suite/proc/trim_text(var/what as text,var/trim_quotes=0)
|
||||
/proc/trim_text(var/what as text,var/trim_quotes=0)
|
||||
while(length(what) && (findtext(what," ",1,2)))
|
||||
what=copytext(what,2,0)
|
||||
while(length(what) && (findtext(what," ",length(what),0)))
|
||||
@@ -329,7 +329,7 @@ var/list/map_dimension_cache = list()
|
||||
|
||||
//find the position of the next delimiter,skipping whatever is comprised between opening_escape and closing_escape
|
||||
//returns 0 if reached the last delimiter
|
||||
/dmm_suite/proc/find_next_delimiter_position(var/text as text,var/initial_position as num, var/delimiter=",",var/opening_escape=quote,var/closing_escape=quote)
|
||||
/proc/find_next_delimiter_position(var/text as text,var/initial_position as num, var/delimiter=",",var/opening_escape=quote,var/closing_escape=quote)
|
||||
var/position = initial_position
|
||||
var/next_delimiter = findtext(text,delimiter,position,0)
|
||||
var/next_opening = findtext(text,opening_escape,position,0)
|
||||
@@ -344,7 +344,7 @@ var/list/map_dimension_cache = list()
|
||||
|
||||
//build a list from variables in text form (e.g {var1="derp"; var2; var3=7} => list(var1="derp", var2, var3=7))
|
||||
//return the filled list
|
||||
/dmm_suite/proc/readlist(var/text as text,var/delimiter=",")
|
||||
/proc/readlist(var/text as text,var/delimiter=",")
|
||||
|
||||
|
||||
var/list/to_return = list()
|
||||
|
||||
Reference in New Issue
Block a user