Files
Bubberstation/code/__HELPERS/spawns.dm
SkyratBot b5a3b3308d [MIRROR] Rebalances some things about progression traitors and adds some uplink items. [MDB IGNORE] (#11178)
* Rebalances some things about progression traitors and adds some uplink items.

* Rebalances some things about progression traitors and adds some uplink items.

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
2022-02-01 15:02:13 +00:00

47 lines
2.0 KiB
Plaintext

/**
* One proc for easy spawning of pods in the code to drop off items before whizzling (please don't proc call this in game, it will destroy you)
*
* Arguments:
* * specifications: special mods to the pod, see non var edit specifications for details on what you should fill this with
* Non var edit specifications:
* * target = where you want the pod to drop
* * path = a special specific pod path if you want, this can save you a lot of var edits
* * style = style of the pod, defaults to the normal pod
* * spawn = spawned path or a list of the paths spawned, what you're sending basically
* Returns the pod spawned, in case you want to spawn items yourself and modify them before putting them in.
*/
/proc/podspawn(specifications)
//get non var edit specifications
var/turf/landing_location = specifications["target"]
var/spawn_type = specifications["path"]
var/style = specifications["style"]
var/list/paths_to_spawn = specifications["spawn"]
//setup pod, add contents
if(!isturf(landing_location))
landing_location = get_turf(landing_location)
if(!spawn_type)
spawn_type = /obj/structure/closet/supplypod/podspawn
var/obj/structure/closet/supplypod/podspawn/pod = new spawn_type(null, style)
if(paths_to_spawn && !islist(paths_to_spawn))
paths_to_spawn = list(paths_to_spawn)
for(var/atom/movable/path as anything in paths_to_spawn)
if(!ispath(path))
path.forceMove(pod)
else
path = new path(pod)
//remove non var edits from specifications
specifications -= "target"
specifications -= "style"
specifications -= "path"
specifications -= "spawn" //list, we remove the key
//rest of specificiations are edits on the pod
for(var/variable_name in specifications)
var/variable_value = specifications[variable_name]
if(!pod.vv_edit_var(variable_name, variable_value))
stack_trace("WARNING! podspawn vareditting \"[variable_name]\" to \"[variable_value]\" was rejected by the pod!")
new /obj/effect/pod_landingzone(landing_location, pod)
return pod