This commit is contained in:
SandPoot
2024-08-11 14:10:35 -03:00
parent 587f92e900
commit 0fd4dba15b
8 changed files with 215 additions and 144 deletions
+29 -11
View File
@@ -29,25 +29,31 @@
return ..()
/atom/movable/screen/movable/action_button/proc/can_use(mob/user)
if (linked_action)
if(isobserver(user))
var/mob/dead/observer/dead_mob = user
if(dead_mob.observetarget) // Observers can only click on action buttons if they're not observing something
return FALSE
if(linked_action)
if(linked_action.viewers[user.hud_used])
return TRUE
return FALSE
else if (isobserver(user))
var/mob/dead/observer/O = user
return !O.observetarget
else
return TRUE
return TRUE
/atom/movable/screen/movable/action_button/Click(location,control,params)
if (!can_use(usr))
return
var/list/modifiers = params2list(params)
if(modifiers["shift"])
if(LAZYACCESS(modifiers, SHIFT_CLICK))
var/datum/hud/our_hud = usr.hud_used
our_hud.position_action(src, SCRN_OBJ_DEFAULT)
return TRUE
var/mob/clicker = usr
if(!clicker.CheckActionCooldown())
return
clicker.DelayNextAction(1)
linked_action.Trigger()
return TRUE
@@ -82,7 +88,7 @@
closeToolTip(usr)
return ..()
/atom/movable/screen/movable/action_button/MouseDrop(over_object)
/atom/movable/screen/movable/action_button/MouseDrop(atom/over_object, mob/user, src_location, over_location, params)
last_hovored_ref = null
if(!can_use(usr))
return
@@ -107,7 +113,6 @@
our_hud.position_action_relative(src, button)
save_position()
return
. = ..()
our_hud.position_action(src, screen_loc)
save_position()
@@ -141,6 +146,12 @@
user.client.prefs.action_buttons_screen_locs -= "[name]_[id]"
user.client.prefs.queue_save_pref(1 SECONDS, TRUE)
/**
* This is a silly proc used in hud code code to determine what icon and icon state we should be using
* for hud elements (such as action buttons) that don't have their own icon and icon state set.
*
* It returns a list, which is pretty much just a struct of info
*/
/datum/hud/proc/get_action_buttons_icons()
. = list()
.["bg_icon"] = ui_style
@@ -153,8 +164,15 @@
var/datum/action/A = X
A.UpdateButtons(status_only)
//This is the proc used to update all the action buttons.
/mob/proc/update_action_buttons(reload_screen)
/**
* This proc handles adding all of the mob's actions to their screen
*
* If you just need to update existing buttons, use [/mob/proc/update_mob_action_buttons]!
*
* Arguments:
* * update_flags - reload_screen - bool, if TRUE, this proc will add the button to the screen of the passed mob as well
*/
/mob/proc/update_action_buttons(reload_screen = FALSE)
if(!hud_used || !client)
return