Merge pull request #10046 from Ghommie/Ghommie-cit424

Ports flag for bespoke elements.
This commit is contained in:
kevinz000
2019-12-05 21:50:19 -07:00
committed by Dip
parent ac25b449f7
commit 014bc3e026
3 changed files with 28 additions and 4 deletions
+15 -3
View File
@@ -6,10 +6,22 @@ PROCESSING_SUBSYSTEM_DEF(dcs)
/datum/controller/subsystem/processing/dcs/Recover()
comp_lookup = SSdcs.comp_lookup
/datum/controller/subsystem/processing/dcs/proc/GetElement(eletype)
. = elements_by_type[eletype]
/datum/controller/subsystem/processing/dcs/proc/GetElement(datum/element/eletype, ...)
var/element_id = eletype
if(initial(eletype.element_flags) & ELEMENT_BESPOKE)
var/list/fullid = list("[eletype]")
for(var/i in initial(eletype.id_arg_index) to length(args))
var/argument = args[i]
if(istext(argument) || isnum(argument))
fullid += "[argument]"
else
fullid += "[REF(argument)]"
element_id = fullid.Join("&")
. = elements_by_type[element_id]
if(.)
return
if(!ispath(eletype, /datum/element))
CRASH("Attempted to instantiate [eletype] as a /datum/element")
. = elements_by_type[eletype] = new eletype
. = elements_by_type[element_id] = new eletype