mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-09 16:05:07 +00:00
## About The Pull Request This PR tackles our piss-poor item action handling. Currently in order to make an item only have actions when its equipped to a certain slot you need to override a proc, which I've changed by introducing an action_slots variable. I've also cleaned up a ton of action code, and most importantly moved a lot of Trigger effects on items to do_effect, which allows actions to not call ui_action_click or attack_self on an item without bypassing IsAvailible and comsigs that parent Trigger has. This resolves issues like jump boots being usable from your hands, HUDs being toggleable out of your pockets, etc. Also moved a few actions from relying on attack_self to individual handling on their side. This also stops welding masks/hardhats from showing their action while you hold them, this part of the change is just something I thought didn't make much sense - you can use their action by using them in-hand, and flickering on your action bar can be annoying when reshuffling your backpack. Closes #89653 ## Why It's Good For The Game Makes action handling significantly less ass, allows us to avoid code like this ```js /obj/item/clothing/mask/gas/sechailer/ui_action_click(mob/user, action) if(istype(action, /datum/action/item_action/halt)) halt() else adjust_visor(user) ```
31 lines
1011 B
Plaintext
31 lines
1011 B
Plaintext
/datum/action/item_action/berserk_mode
|
|
name = "Berserk"
|
|
desc = "Increase your movement and melee speed while also increasing your melee armor for a short amount of time."
|
|
button_icon = 'icons/mob/actions/actions_items.dmi'
|
|
button_icon_state = "berserk_mode"
|
|
background_icon_state = "bg_demon"
|
|
overlay_icon_state = "bg_demon_border"
|
|
|
|
/datum/action/item_action/berserk_mode/do_effect(trigger_flags)
|
|
var/obj/item/clothing/head/hooded/berserker/berserk = target
|
|
berserk.berserk_mode(owner)
|
|
return TRUE
|
|
|
|
/datum/action/item_action/berserk_mode/IsAvailable(feedback = FALSE)
|
|
. = ..()
|
|
if(!.)
|
|
return FALSE
|
|
if(!istype(target, /obj/item/clothing/head/hooded/berserker))
|
|
return FALSE
|
|
|
|
var/obj/item/clothing/head/hooded/berserker/berserk = target
|
|
if(berserk.berserk_active)
|
|
if(feedback)
|
|
to_chat(owner, span_warning("You are already berserk!"))
|
|
return FALSE
|
|
if(berserk.berserk_charge < 100)
|
|
if(feedback)
|
|
to_chat(owner, span_warning("You don't have a full charge."))
|
|
return FALSE
|
|
return TRUE
|