mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 22:50:26 +01:00
[MIRROR] Adds the bare minimum admin components and allows admins to define list literals. (#7320)
* Adds the bare minimum admin components and allows admins to define list literals. * Update decaySS.dm Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
co-authored by
Watermelon914
Gandalf
parent
9098086959
commit
e2c9240251
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* # Spawn Atom Component
|
||||
*
|
||||
* Spawns an atom.
|
||||
*/
|
||||
/obj/item/circuit_component/spawn_atom
|
||||
display_name = "Spawn Atom"
|
||||
desc = "A component that returns the value of a list at a given index."
|
||||
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL|CIRCUIT_FLAG_ADMIN
|
||||
|
||||
/// The input path to convert into a typepath
|
||||
var/datum/port/input/input_path
|
||||
|
||||
/// The turf to spawn them at
|
||||
var/datum/port/input/spawn_at
|
||||
|
||||
/// Parameters to pass to the atom being spawned
|
||||
var/datum/port/input/parameters
|
||||
|
||||
/// The result from the output
|
||||
var/datum/port/output/spawned_atom
|
||||
|
||||
/obj/item/circuit_component/spawn_atom/Initialize()
|
||||
. = ..()
|
||||
input_path = add_input_port("Type", PORT_TYPE_ANY)
|
||||
spawn_at = add_input_port("Spawn At", PORT_TYPE_ATOM)
|
||||
parameters = add_input_port("Parameters", PORT_TYPE_LIST)
|
||||
|
||||
spawned_atom = add_output_port("Spawned Atom", PORT_TYPE_ATOM)
|
||||
|
||||
/obj/item/circuit_component/spawn_atom/input_received(datum/port/input/port)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
var/typepath = input_path.input_value
|
||||
|
||||
if(!ispath(typepath, /atom))
|
||||
return
|
||||
|
||||
var/list/params = parameters.input_value
|
||||
if(!params)
|
||||
params = list()
|
||||
|
||||
params.Insert(1, spawn_at.input_value)
|
||||
|
||||
spawned_atom.set_output(new typepath(arglist(params)))
|
||||
Reference in New Issue
Block a user