Files
Bubberstation/code/datums/actions/item_action.dm
Arturlangandnevimer 1c0ac21cb4 Fixes the issue of usr pointing to admins by making Trigger pass down clicker (#92354)
## About The Pull Request
Fixes the issue of usr pointing to admins by making Trigger pass down
clicker, as usr is fucky and can be passed down by other unrelated
procs. Fun.
Added the clicker arg to all usages of Trigger as well
Also changes isobserver check in antagonist ui_act code that prevents
observers from clicking UI's instead to check if the ui.user is
owner.current
## Why It's Good For The Game
Fixes admins giving heretic to people opening the heretic UI for the
admin instead

(cherry picked from commit 0bc42d6940)
2025-08-08 15:31:08 -04:00

38 lines
1.0 KiB
Plaintext

//Presets for item actions
/datum/action/item_action
name = "Item Action"
check_flags = AB_CHECK_INCAPACITATED|AB_CHECK_HANDS_BLOCKED|AB_CHECK_CONSCIOUS
button_icon_state = null
/datum/action/item_action/New(Target)
. = ..()
// If our button state is null, use the target's icon instead
if(target && isnull(button_icon_state))
AddComponent(/datum/component/action_item_overlay, target)
/datum/action/item_action/vv_edit_var(var_name, var_value)
. = ..()
if(!. || !target)
return
if(var_name == NAMEOF(src, button_icon_state))
// If someone vv's our icon either add or remove the component
if(isnull(var_name))
AddComponent(/datum/component/action_item_overlay, target)
else
qdel(GetComponent(/datum/component/action_item_overlay))
/datum/action/item_action/Trigger(mob/clicker, trigger_flags)
. = ..()
if(!.)
return FALSE
return do_effect(trigger_flags)
/datum/action/item_action/proc/do_effect(trigger_flags)
if(!target)
return FALSE
var/obj/item/item_target = target
item_target.ui_action_click(owner, src)
return TRUE