Fix unavailable button tint not clearing on stat change

This commit is contained in:
Elizabeth Lavenza
2024-04-13 18:30:26 -04:00
parent 9043920b69
commit 02c37e950a
2 changed files with 14 additions and 2 deletions

View File

@@ -49,6 +49,10 @@
Remove(owner)
owner = M
RegisterSignal(owner, COMSIG_PARENT_QDELETING, PROC_REF(clear_ref), override = TRUE)
// Register some signals based on our check_flags
// so that our button icon updates when relevant
if(check_flags & AB_CHECK_CONSCIOUS)
RegisterSignal(owner, COMSIG_MOB_STATCHANGE, PROC_REF(update_status_on_signal))
GiveAction(M)
@@ -68,7 +72,10 @@
viewers = list()
if(owner)
UnregisterSignal(owner, COMSIG_PARENT_QDELETING)
UnregisterSignal(owner, list(
COMSIG_PARENT_QDELETING,
COMSIG_MOB_STATCHANGE
))
if(target == owner)
RegisterSignal(target, COMSIG_PARENT_QDELETING, PROC_REF(clear_ref))
owner = null
@@ -218,6 +225,11 @@
our_button.id = bitflag
return
/// A general use signal proc that reacts to an event and updates JUST our button's status
/datum/action/proc/update_status_on_signal(datum/source, new_stat, old_stat)
SIGNAL_HANDLER
UpdateButton(status_only = TRUE)
//Presets for item actions
/datum/action/item_action
check_flags = AB_CHECK_RESTRAINED|AB_CHECK_STUN|AB_CHECK_LYING|AB_CHECK_CONSCIOUS

View File

@@ -131,7 +131,7 @@
/datum/action/cooldown/bloodsucker/proc/CheckCanDeactivate(display_error)
return TRUE
/datum/action/cooldown/bloodsucker/UpdateButton(atom/movable/screen/movable/action_button/button, force = FALSE)
/datum/action/cooldown/bloodsucker/UpdateButton(atom/movable/screen/movable/action_button/button, status_only = FALSE, force = FALSE)
background_icon_state = active? background_icon_state_on : background_icon_state_off
..()//UpdateButton()