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) ```
79 lines
3.3 KiB
Plaintext
79 lines
3.3 KiB
Plaintext
/obj/item/picket_sign
|
|
icon = 'icons/obj/signs.dmi'
|
|
icon_state = "picket"
|
|
inhand_icon_state = "picket"
|
|
name = "blank picket sign"
|
|
desc = "It's blank."
|
|
force = 5
|
|
w_class = WEIGHT_CLASS_BULKY
|
|
attack_verb_continuous = list("bashes", "smacks")
|
|
attack_verb_simple = list("bash", "smack")
|
|
resistance_flags = FLAMMABLE
|
|
|
|
var/label = ""
|
|
COOLDOWN_DECLARE(picket_sign_cooldown)
|
|
|
|
/obj/item/picket_sign/cyborg
|
|
name = "metallic nano-sign"
|
|
desc = "A high tech picket sign used by silicons that can reprogram its surface at will. Probably hurts to get hit by, too."
|
|
force = 13
|
|
resistance_flags = NONE
|
|
actions_types = list(/datum/action/item_action/nano_picket_sign)
|
|
|
|
/obj/item/picket_sign/proc/retext(mob/user, obj/item/writing_instrument)
|
|
if(!user.can_write(writing_instrument))
|
|
return
|
|
var/txt = tgui_input_text(user, "What would you like to write on the sign?", "Sign Label", max_length = 30)
|
|
if(txt && user.can_perform_action(src))
|
|
playsound(src, SFX_WRITING_PEN, 50, TRUE, SHORT_RANGE_SOUND_EXTRARANGE, SOUND_FALLOFF_EXPONENT + 3, ignore_walls = FALSE)
|
|
label = txt
|
|
name = "[label] sign"
|
|
desc = "It reads: [label]"
|
|
|
|
/obj/item/picket_sign/attackby(obj/item/W, mob/user, params)
|
|
if(IS_WRITING_UTENSIL(W))
|
|
retext(user, W)
|
|
else
|
|
return ..()
|
|
|
|
/obj/item/picket_sign/attack_self(mob/living/carbon/human/user)
|
|
if(!COOLDOWN_FINISHED(src, picket_sign_cooldown))
|
|
return
|
|
COOLDOWN_START(src, picket_sign_cooldown, 5 SECONDS)
|
|
if(label)
|
|
user.manual_emote("waves around \the \"[label]\" sign.")
|
|
else
|
|
user.manual_emote("waves around a blank sign.")
|
|
var/direction = prob(50) ? -1 : 1
|
|
if(NSCOMPONENT(user.dir)) //So signs are waved horizontally relative to what way the player waving it is facing.
|
|
animate(user, pixel_w = (1 * direction), time = 0.1 SECONDS, easing = SINE_EASING, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL)
|
|
animate(pixel_w = (-2 * direction), time = 0.1 SECONDS, easing = SINE_EASING, flags = ANIMATION_RELATIVE)
|
|
animate(pixel_w = (2 * direction), time = 0.1 SECONDS, easing = SINE_EASING, flags = ANIMATION_RELATIVE)
|
|
animate(pixel_w = (-2 * direction), time = 0.1 SECONDS, easing = SINE_EASING, flags = ANIMATION_RELATIVE)
|
|
animate(pixel_w = (1 * direction), time = 0.1 SECONDS, easing = SINE_EASING, flags = ANIMATION_RELATIVE)
|
|
else
|
|
animate(user, pixel_z = (1 * direction), time = 0.1 SECONDS, easing = SINE_EASING, flags = ANIMATION_RELATIVE|ANIMATION_PARALLEL)
|
|
animate(pixel_z = (-2 * direction), time = 0.1 SECONDS, easing = SINE_EASING, flags = ANIMATION_RELATIVE)
|
|
animate(pixel_z = (2 * direction), time = 0.1 SECONDS, easing = SINE_EASING, flags = ANIMATION_RELATIVE)
|
|
animate(pixel_z = (-2 * direction), time = 0.1 SECONDS, easing = SINE_EASING, flags = ANIMATION_RELATIVE)
|
|
animate(pixel_z = (1 * direction), time = 0.1 SECONDS, easing = SINE_EASING, flags = ANIMATION_RELATIVE)
|
|
user.changeNext_move(CLICK_CD_MELEE)
|
|
|
|
/datum/action/item_action/nano_picket_sign
|
|
name = "Retext Nano Picket Sign"
|
|
|
|
/datum/action/item_action/nano_picket_sign/do_effect(trigger_flags)
|
|
if(!istype(target, /obj/item/picket_sign))
|
|
return FALSE
|
|
var/obj/item/picket_sign/sign = target
|
|
sign.retext(owner)
|
|
return TRUE
|
|
|
|
/datum/crafting_recipe/picket_sign
|
|
name = "Picket Sign"
|
|
result = /obj/item/picket_sign
|
|
reqs = list(/obj/item/stack/rods = 1,
|
|
/obj/item/stack/sheet/cardboard = 2)
|
|
time = 80
|
|
category = CAT_ENTERTAINMENT
|