Refactors bardrone area based godmode into an element (#76619)

Let's this be used for more than just bardrones and for more than just
the exit shuttle in the future
This commit is contained in:
Zephyr
2023-07-12 23:35:12 -04:00
committed by GitHub
parent 42a2b0ab77
commit 763112fb61
6 changed files with 158 additions and 24 deletions
@@ -61,22 +61,34 @@
names += componentsubtypes
names += "---Elements---"
names += sort_list(subtypesof(/datum/element), GLOBAL_PROC_REF(cmp_typepaths_asc))
var/result = tgui_input_list(usr, "Choose a component/element to add", "Add Component", names)
if(isnull(result))
return
if(!usr || result == "---Components---" || result == "---Elements---")
return
if(QDELETED(src))
to_chat(usr, "That thing doesn't exist anymore!", confidential = TRUE)
return
var/add_source
if(ispath(result, /datum/component))
var/datum/component/comp_path = result
if(initial(comp_path.dupe_mode) == COMPONENT_DUPE_SOURCES)
add_source = tgui_input_text(usr, "Enter a source for the component", "Add Component", "ADMIN-ABUSE")
if(isnull(add_source))
return
var/list/lst = get_callproc_args()
if(!lst)
return
var/datumname = "error"
lst.Insert(1, result)
if(result in componentsubtypes)
datumname = "component"
target._AddComponent(lst)
target._AddComponent(lst, add_source)
else
datumname = "element"
target._AddElement(lst)