Adds buttons in the UI for specific components (#61622)

Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
This commit is contained in:
Watermelon914
2021-09-25 03:50:15 -07:00
committed by GitHub
co-authored by Watermelon914
parent b463e0417e
commit 390f60f571
5 changed files with 65 additions and 16 deletions
+18
View File
@@ -51,6 +51,9 @@
// Defines which shells support this component. Only used as an informational guide, does not restrict placing these components in circuits.
var/required_shells = null
/// The UI buttons of this circuit component. An assoc list that has this format: "button_icon" = "action_name"
var/ui_buttons = null
/// Called when the option ports should be set up
/obj/item/circuit_component/proc/populate_options()
return
@@ -295,6 +298,16 @@
if(length(input_ports))
. += create_ui_notice("Power Usage Per Input: [power_usage_per_input]", "orange", "bolt")
/**
* Called when a special button is pressed on this component in the UI.
*
* Arguments:
* * user - Interacting mob
* * action - A string for which action is being performed. No parameters passed because it's only a button press.
*/
/obj/item/circuit_component/proc/ui_perform_action(mob/user, action)
return
/**
* Creates a UI notice entry to be used in get_ui_notices()
*
@@ -309,6 +322,11 @@
"color" = color,
))
/obj/item/circuit_component/ui_host(mob/user)
if(parent)
return parent.ui_host()
return ..()
/**
* Creates a table UI notice entry to be used in get_ui_notices()
*