diff --git a/code/datums/action.dm b/code/datums/action.dm index 18c5c4f885e..bca714f9c73 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -16,8 +16,6 @@ var/icon_icon = 'icons/mob/actions/actions.dmi' var/button_icon_state = "default" var/mob/owner - /// Whether to darken the button or not if [/datum/action/proc/IsAvailable] return FALSE. - var/darken_when_unavailable = TRUE /datum/action/New(var/Target) target = Target @@ -99,17 +97,18 @@ // If the action isn't available, darken the button if(!IsAvailable()) - if(!darken_when_unavailable) - return - var/image/img = image('icons/mob/screen_white.dmi', icon_state = "template") - img.alpha = 200 - img.appearance_flags = RESET_COLOR | RESET_ALPHA - img.color = "#000000" - img.plane = FLOAT_PLANE + 1 - button.overlays += img + apply_unavailable_effect() else return TRUE +/datum/action/proc/apply_unavailable_effect() + var/image/img = image('icons/mob/screen_white.dmi', icon_state = "template") + img.alpha = 200 + img.appearance_flags = RESET_COLOR | RESET_ALPHA + img.color = "#000000" + img.plane = FLOAT_PLANE + 1 + button.add_overlay(img) + /datum/action/proc/ApplyIcon(obj/screen/movable/action_button/current_button) current_button.cut_overlays() if(icon_icon && button_icon_state) @@ -117,7 +116,7 @@ img.appearance_flags = RESET_COLOR | RESET_ALPHA img.pixel_x = 0 img.pixel_y = 0 - current_button.overlays += img + current_button.add_overlay(img) //Presets for item actions /datum/action/item_action @@ -476,7 +475,6 @@ /datum/action/spell_action check_flags = 0 background_icon_state = "bg_spell" - darken_when_unavailable = FALSE var/recharge_text_color = "#FFFFFF" /datum/action/spell_action/New(Target) @@ -515,26 +513,28 @@ return spell.can_cast(owner) return FALSE -/datum/action/spell_action/UpdateButtonIcon() - if(button && !(. = ..())) - var/obj/effect/proc_holder/spell/S = target - if(!istype(S)) - return - var/progress = S.get_availability_percentage() - var/col_val_high = 72 * progress + 128 - var/col_val_low = 200 * progress - button.maptext = "