mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-14 01:24:21 +01:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user