[MIRROR] Refactors bardrone area based godmode into an element [MDB IGNORE] (#22419)

* 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

* Refactors bardrone area based godmode into an element

---------

Co-authored-by: Zephyr <12817816+ZephyrTFA@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-07-13 08:57:14 -04:00
committed by GitHub
co-authored by Zephyr
parent cb6aa8ce72
commit a97aab7642
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)