mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 01:34:01 +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) ```
47 lines
2.0 KiB
Plaintext
47 lines
2.0 KiB
Plaintext
/datum/action/item_action/chameleon/drone/randomise
|
|
name = "Randomise Headgear"
|
|
button_icon = 'icons/mob/actions/actions_items.dmi'
|
|
button_icon_state = "random"
|
|
|
|
/datum/action/item_action/chameleon/drone/randomise/do_effect(trigger_flags)
|
|
for(var/datum/action/item_action/chameleon/change/to_randomize in owner.actions)
|
|
to_randomize.random_look()
|
|
return TRUE
|
|
|
|
// Allows a drone to turn their hat into a mask
|
|
// This action's existence is very silly can be replaced with just, a hat with a chameleon action that can be both hats and masks.
|
|
/datum/action/item_action/chameleon/drone/togglehatmask
|
|
name = "Toggle Headgear Mode"
|
|
button_icon = 'icons/mob/actions/actions_silicon.dmi'
|
|
button_icon_state = "drone_camogear_helm"
|
|
|
|
/datum/action/item_action/chameleon/drone/togglehatmask/New(Target)
|
|
if (istype(Target, /obj/item/clothing/head/chameleon/drone))
|
|
button_icon_state = "drone_camogear_helm"
|
|
if (istype(Target, /obj/item/clothing/mask/chameleon/drone))
|
|
button_icon_state = "drone_camogear_mask"
|
|
return ..()
|
|
|
|
/datum/action/item_action/chameleon/drone/togglehatmask/IsAvailable(feedback)
|
|
return ..() && isdrone(owner)
|
|
|
|
/datum/action/item_action/chameleon/drone/togglehatmask/do_effect(trigger_flags)
|
|
var/mob/living/basic/drone/droney = owner
|
|
|
|
// The drone unEquip() proc sets head to null after dropping
|
|
// an item, so we need to keep a reference to our old headgear
|
|
// to make sure it's deleted.
|
|
var/obj/old_headgear = target
|
|
var/obj/new_headgear
|
|
|
|
if(istype(old_headgear, /obj/item/clothing/head/chameleon/drone))
|
|
new_headgear = new /obj/item/clothing/mask/chameleon/drone(droney)
|
|
else if(istype(old_headgear, /obj/item/clothing/mask/chameleon/drone))
|
|
new_headgear = new /obj/item/clothing/head/chameleon/drone(droney)
|
|
else
|
|
to_chat(owner, span_warning("You shouldn't be able to toggle a camogear helmetmask if you're not wearing it."))
|
|
return FALSE
|
|
droney.dropItemToGround(target, force = TRUE)
|
|
droney.equip_to_slot_or_del(new_headgear, ITEM_SLOT_HEAD)
|
|
return TRUE
|