Files
Bubberstation/code/controllers/subsystem/wiremod_composite.dm
SkyratBot a00cad0164 [MIRROR] Clean up subsystem Initialize(), require an explicit result returned, give a formal way to fail (for SSlua) [MDB IGNORE] (#16248)
* Clean up subsystem Initialize(), require an explicit result returned, give a formal way to fail (for SSlua)

* [PR for MIRROR PR] Changes for 16248 (#16277)

* Merge skyrat changes, update SR SS's, and remove lobby_eye

* Apply suggestions from code review

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* Update modular_skyrat/modules/autotransfer/code/autotransfer.dm

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

* restore lobby_cam for now

Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>

Co-authored-by: Tastyfish <crazychris32@gmail.com>
Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
2022-09-24 17:32:40 -04:00

43 lines
1.5 KiB
Plaintext

/**
* This subsystem is to handle creating and storing
* composite templates that are used to create composite datatypes
* for integrated circuits
*
* See: https://en.wikipedia.org/wiki/Composite_data_type
**/
SUBSYSTEM_DEF(wiremod_composite)
name = "Wiremod Composite Templates"
flags = SS_NO_FIRE
/// The templates created and stored
var/list/templates = list()
/datum/controller/subsystem/wiremod_composite/PreInit()
. = ..()
// This needs to execute before global variables have initialized.
for(var/datum/circuit_composite_template/type as anything in subtypesof(/datum/circuit_composite_template))
if(!initial(type.datatype))
continue
templates[initial(type.datatype)] = new type()
/datum/controller/subsystem/wiremod_composite/Initialize()
for(var/type in templates)
var/datum/circuit_composite_template/template = templates[type]
template.Initialize()
return SS_INIT_SUCCESS
/**
* Used to produce a composite datatype using another datatype, or
* to get an already existing composite datatype.
*/
/datum/controller/subsystem/wiremod_composite/proc/composite_datatype(datatype, ...)
var/datum/circuit_composite_template/type = templates[datatype]
if(!type)
return
return type.generate_composite_type(args.Copy(2))
/datum/controller/subsystem/wiremod_composite/proc/get_composite_type(base_type, datatype)
var/datum/circuit_composite_template/template = templates[base_type]
if(!template)
return
return template.generated_types[datatype]