Files
Bubberstation/code/modules/wiremod/components/admin/spawn.dm
SkyratBot 1d2d7d2b6c [MIRROR] Fixes an issue with tags for mobs not properly being handled correctly and adds logging to admin circuits [MDB IGNORE] (#11441)
* Fixes an issue with tags for mobs not properly being handled correctly and adds logging to admin circuits (#64821)

Tags would bug out due to how the 'Save Shell' component would copy all the variables on an object except a few restricted ones, though this proved to be very buggy.
The duplicator part has been removed and more proper logging has been added.
To compensate for the duplicator part being removed, admin circuit display names will now replace the entire name of the shell.

* Fixes an issue with tags for mobs not properly being handled correctly and adds logging to admin circuits

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
2022-02-11 10:25:58 +00:00

50 lines
1.4 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"
category = "Admin"
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/populate_ports()
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(PORT_TYPE_ANY))
spawned_atom = add_output_port("Spawned Atom", PORT_TYPE_ATOM)
/obj/item/circuit_component/spawn_atom/input_received(datum/port/input/port)
var/typepath = input_path.value
if(!ispath(typepath, /atom))
return
var/list/params = parameters.value
if(!params)
params = list()
var/list/resolved_params = recursive_list_resolve(params)
resolved_params.Insert(1, spawn_at.value)
log_admin_circuit("[parent.get_creator()] spawned in [typepath] with parameters \[[resolved_params.Join(", ")]].")
var/atom/spawned = new typepath(arglist(resolved_params))
spawned.datum_flags |= DF_VAR_EDITED
spawned_atom.set_output(spawned)