diff --git a/code/datums/components/two_handed.dm b/code/datums/components/two_handed.dm index 23e1856b65d..64532dfb2e8 100644 --- a/code/datums/components/two_handed.dm +++ b/code/datums/components/two_handed.dm @@ -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 * diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index a63bd7a852e..0007f12082c 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -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, "You lack the grace to wield this!") 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()