Two handed component slight audio improvement (#28892)

* Update two_handed.dm

* remove unused
This commit is contained in:
kyunkyunkyun
2025-04-19 00:28:41 +05:00
committed by GitHub
parent 0a7ba807e1
commit f9bf03271c
2 changed files with 22 additions and 17 deletions
+6 -10
View File
@@ -105,7 +105,6 @@
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(on_equip))
RegisterSignal(parent, COMSIG_ITEM_DROPPED, PROC_REF(on_drop))
RegisterSignal(parent, COMSIG_ACTIVATE_SELF, PROC_REF(on_attack_self))
RegisterSignal(parent, COMSIG_ATTACK, PROC_REF(on_attack))
RegisterSignal(parent, COMSIG_ATOM_UPDATE_ICON, PROC_REF(on_update_icon))
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
RegisterSignal(parent, COMSIG_ITEM_SHARPEN_ACT, PROC_REF(on_sharpen))
@@ -227,6 +226,9 @@
if(wieldsound)
playsound(parent_item.loc, wieldsound, 50, TRUE)
if(attacksound)
parent_item.hitsound = attacksound
// Let's reserve the other hand
offhand_item = new(user)
offhand_item.name = "[parent_item.name] - offhand"
@@ -301,6 +303,9 @@
if(unwieldsound)
playsound(parent_item.loc, unwieldsound, 50, TRUE)
if(attacksound)
parent_item.hitsound = initial(parent_item.hitsound)
// Remove the object in the offhand
if(offhand_item)
UnregisterSignal(offhand_item, list(COMSIG_ITEM_DROPPED, COMSIG_PARENT_QDELETING))
@@ -317,15 +322,6 @@
SIGNAL_HANDLER // COMSIG_TWOHANDED_WIELDED_TRY_WIELD_INTERACT
return wielded ? FALSE : TRUE;
/**
* on_attack triggers on attack with the parent item
*/
/datum/component/two_handed/proc/on_attack(obj/item/source, mob/living/target, mob/living/user)
SIGNAL_HANDLER // COMSIG_ATTACK
if(wielded && attacksound)
var/obj/item/parent_item = parent
playsound(parent_item.loc, attacksound, 50, TRUE)
/**
* on_update_icon triggers on call to update parent items icon
*
+16 -7
View File
@@ -99,6 +99,7 @@
icon = 'icons/obj/weapons/energy_melee.dmi'
lefthand_file = 'icons/mob/inhands/weapons_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons_righthand.dmi'
hitsound = "swing_hit"
icon_state = "dualsaber0"
force = 3
throwforce = 5
@@ -128,8 +129,21 @@
. = ..()
if(!blade_color)
blade_color = pick("red", "blue", "green", "purple")
AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.25, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = (4 / 3) SECONDS, _requires_two_hands = TRUE) // 0.3333 seconds of cooldown for 75% uptime
AddComponent(/datum/component/two_handed, force_wielded = force_wielded, force_unwielded = force_unwielded, wieldsound = wieldsound, unwieldsound = unwieldsound, wield_callback = CALLBACK(src, PROC_REF(on_wield)), unwield_callback = CALLBACK(src, PROC_REF(on_unwield)), only_sharp_when_wielded = TRUE)
AddComponent(/datum/component/parry, \
_stamina_constant = 2, \
_stamina_coefficient = 0.25, \
_parryable_attack_types = ALL_ATTACK_TYPES, \
_parry_cooldown = (4 / 3) SECONDS, /* 0.33 seconds of cooldown for 75% uptime */ \
_requires_two_hands = TRUE)
AddComponent(/datum/component/two_handed, \
force_wielded = force_wielded, \
force_unwielded = force_unwielded, \
wieldsound = wieldsound, \
unwieldsound = unwieldsound, \
attacksound = 'sound/weapons/blade1.ogg', \
wield_callback = CALLBACK(src, PROC_REF(on_wield)), \
unwield_callback = CALLBACK(src, PROC_REF(on_unwield)), \
only_sharp_when_wielded = TRUE)
/obj/item/dualsaber/update_icon_state()
if(HAS_TRAIT(src, TRAIT_WIELDED))
@@ -226,18 +240,13 @@
/obj/item/dualsaber/blue
blade_color = "blue"
/obj/item/dualsaber/proc/on_wield(obj/item/source, mob/living/carbon/user)
if(user && HAS_TRAIT(user, TRAIT_HULK))
to_chat(user, "<span class='warning'>You lack the grace to wield this!</span>")
return COMPONENT_TWOHANDED_BLOCK_WIELD
hitsound = 'sound/weapons/blade1.ogg'
w_class = w_class_on
/obj/item/dualsaber/proc/on_unwield()
hitsound = "swing_hit"
w_class = initial(w_class)
/obj/item/dualsaber/IsReflect()