Files
Bubberstation/code/modules/wiremod/components/admin/spawn.dm
SkyratBot 9e74cd4a03 [MIRROR] Input ports now connect to multiple output ports. Remove combiner. (#7505)
* Input ports now connect to multiple output ports. Remove combiner. (#60494)

* tgui bsod

* debug disconnections

* prelim

* recomment

* set_value -> put ._.

* DAMN IT

* reinsert subsystem

* prepare

* unditch signals

* remove combiner

* remove combiner some more

* how did router.dm get here? deleting.

* These two COMSIGS should be one.

* critical typo

* inline cast

* have your signals

* Have your set_input & set_output.

* make compile

* upgrade save/load to n-to-n-wires

* have your documentation

* have your unsafe proc

* pay no attention to the compile errors

* unlist the ref

* paste my for block back in ._.

* fix manual input

* oops pushed too soon

* Have your !port.connected_to?.length

Co-authored-by: Watermelon914 <37270891+Watermelon914@ users.noreply.github.com>

Co-authored-by: Watermelon914 <37270891+Watermelon914@ users.noreply.github.com>

* Input ports now connect to multiple output ports. Remove combiner.

Co-authored-by: Gurkenglas <gurkenglas@hotmail.de>
Co-authored-by: Watermelon914 <37270891+Watermelon914@ users.noreply.github.com>
2021-08-11 20:27:29 +01:00

48 lines
1.2 KiB
Plaintext

/**
* # Spawn Atom Component
*
* Spawns an atom.
*/
/obj/item/circuit_component/spawn_atom
display_name = "Spawn Atom"
desc = "Spawns an atom at a desired location"
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.value
if(!ispath(typepath, /atom))
return
var/list/params = parameters.value
if(!params)
params = list()
params.Insert(1, spawn_at.value)
spawned_atom.set_output(new typepath(arglist(params)))