refactor action buttons (#29416)

* refactor action buttons

* fix cult spell charge overlay

* lewc review

* update for a/mhelp buttons and xenobio organs

* update for minebot

* properly create button each time

* directly add/remove unavail overlay for reasons

* lewc review
This commit is contained in:
warriorstar-orion
2025-07-28 15:13:28 -04:00
committed by GitHub
parent f9016e65ff
commit 56f4960ed4
115 changed files with 815 additions and 584 deletions
+3 -7
View File
@@ -70,10 +70,6 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
var/list/actions = list()
/// List of paths of action datums to give to the item on New().
var/list/actions_types = list()
/// List of icons-sheets for a given action to override the icon.
var/list/action_icon = list()
/// List of icon states for a given action to override the icon_state.
var/list/action_icon_state = list()
/// What materials the item yields when broken down. Some methods will not recover everything (autolathes only recover metal and glass, for example).
var/list/materials = list()
@@ -215,7 +211,7 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
/obj/item/Initialize(mapload)
. = ..()
for(var/path in actions_types)
new path(src, action_icon[path], action_icon_state[path])
new path(src)
if(isstorage(loc)) //marks all items in storage as being such
in_storage = TRUE
@@ -1028,9 +1024,9 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
/obj/item/proc/should_stack_with(obj/item/other)
return type == other.type && name == other.name
/obj/item/proc/update_action_buttons(status_only = FALSE, force = FALSE)
/obj/item/proc/update_action_buttons(update_flags = ALL, force = FALSE)
for(var/datum/action/current_action as anything in actions)
current_action.UpdateButtons(status_only, force)
current_action.build_all_button_icons(update_flags, force)
/**
* Handles the bulk of cigarette lighting interactions. You must call `light()` to actually light the cigarette.
@@ -18,9 +18,8 @@
name = "Deploy Box"
desc = "Find inner peace, here, in the box."
check_flags = AB_CHECK_HANDS_BLOCKED | AB_CHECK_IMMOBILE | AB_CHECK_CONSCIOUS | AB_CHECK_STUNNED
button_background_icon_state = "bg_agent"
button_overlay_icon_state = "deploy_box"
use_itemicon = FALSE
background_icon_state = "bg_agent"
button_icon_state = "deploy_box"
/// If TRUE, the box can't be deployed
var/on_cooldown = FALSE
@@ -63,11 +62,11 @@
on_cooldown = TRUE
addtimer(CALLBACK(src, PROC_REF(end_cooldown)), 10 SECONDS)
owner.clear_fullscreen("agent_box")
UpdateButtons()
build_all_button_icons()
/datum/action/item_action/agent_box/proc/end_cooldown()
on_cooldown = FALSE
UpdateButtons()
build_all_button_icons()
/datum/action/item_action/agent_box/IsAvailable()
if(..() && !on_cooldown)