makes action buttons bindable to keybinds (#22390)

* makes action buttons bindable to keybinds

* i'm just based like that

* zamn

* fix

* More alterations

* bruh

* runtime fix

* fixed up the jank

* Update code/_onclick/hud/action_button.dm

Co-authored-by: Gaxeer <44334376+Gaxeer@users.noreply.github.com>

* Update code/modules/input/keybindings_procs.dm

---------

Co-authored-by: Gaxeer <44334376+Gaxeer@users.noreply.github.com>
This commit is contained in:
GDN
2023-12-11 18:56:20 +00:00
committed by GitHub
co-authored by Gaxeer
parent 337a13538c
commit c9bc4635e0
7 changed files with 62 additions and 10 deletions
+9 -4
View File
@@ -26,8 +26,10 @@
button.linked_action = src
button.name = name
button.actiontooltipstyle = buttontooltipstyle
if(desc)
button.desc = desc
var/list/our_description = list()
our_description += desc
our_description += button.desc
button.desc = our_description.Join(" ")
/datum/action/Destroy()
if(owner)
@@ -55,6 +57,7 @@
return
if(M.client)
M.client.screen -= button
button.clean_up_keybinds(M)
button.moved = FALSE //so the button appears in its normal position when given to another owner.
button.locked = FALSE
M.actions -= src
@@ -110,7 +113,6 @@
else
button.icon = button_icon
button.icon_state = background_icon_state
button.desc = desc
ApplyIcon(button)
var/obj/effect/proc_holder/spell/S = target
@@ -562,7 +564,10 @@
var/obj/effect/proc_holder/spell/S = target
S.action = src
name = S.name
desc = S.desc
var/list/our_description = list()
our_description += S.desc
our_description += button.desc
button.desc = our_description.Join(" ")
button_icon = S.action_icon
button_icon_state = S.action_icon_state
background_icon_state = S.action_background_icon_state
+10
View File
@@ -224,3 +224,13 @@
/datum/keybinding/mob/target/l_foot
name = "Target Left Foot"
body_part = BODY_ZONE_PRECISE_L_FOOT
/datum/keybinding/mob/trigger_action_button // Don't add a name to this, shouldn't show up in the prefs menu
var/datum/action/linked_action
var/binded_to // these are expected to actually get deleted at some point, to prevent hard deletes we need to know where to remove them from the clients list
/datum/keybinding/mob/trigger_action_button/down(client/C)
. = ..()
if(C.mob.next_click > world.time)
return
linked_action.Trigger()
+1 -1
View File
@@ -17,7 +17,6 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
to_chat(user, "<span class='warning'><b>[user.ranged_ability.name]</b> has been disabled.")
user.ranged_ability.remove_ranged_ability(user)
return TRUE //TRUE for failed, FALSE for passed.
user.changeNext_click(CLICK_CD_CLICK_ABILITY)
user.face_atom(A)
return FALSE
@@ -159,6 +158,7 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell))
if(!can_cast(user, charge_check, TRUE))
return FALSE
user.changeNext_click(CLICK_CD_CLICK_ABILITY)
if(ishuman(user))
var/mob/living/carbon/human/caster = user
if(caster.remoteview_target)