From cbeedfca9f357cd04bbe00b70b062cd7c8079130 Mon Sep 17 00:00:00 2001 From: Spaghetti-bit Date: Tue, 30 Jul 2024 05:33:02 -0700 Subject: [PATCH] Parrying Refactor, Adding Parrying to Select Two-handed Weapons: Parry This You Filthy Casual! (#26043) * Refactors parrying and how parrying is handled. Also gives most of the melee wizard weapons parrying as well as most two handed weapons. * Forgor the blood spear :) * Renames `special_parry_condition` to `requires_two_hands` * Apply suggestions from code review Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Signed-off-by: Spaghetti-bit * Update code/datums/components/parry.dm Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: Spaghetti-bit * Apply suggestions from code review Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: Spaghetti-bit * applies suggestion from @lewcc * Removes the two handed requirement from cult spear as per @Qwerty's request * Apply suggestions from code review (1/2) from hal Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> Signed-off-by: Spaghetti-bit * Apply suggestions from code review (2/2) * ...accidentally removed an icon in `energy_melee_weapons.dm` when I deconflicted stuff. :skull: ready for review. * Again, variable added back during deconflict. issues resolved. * Update code/game/objects/items/weapons/shields.dm Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com> --------- Signed-off-by: Spaghetti-bit Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> --- code/__HELPERS/trait_helpers.dm | 2 + code/_globalvars/traits.dm | 3 +- code/datums/components/parry.dm | 12 ++- code/game/gamemodes/cult/cult_items.dm | 2 +- code/game/objects/items/weapons/cigs.dm | 2 +- .../weapons/melee/energy_melee_weapons.dm | 95 ++++++++++--------- code/game/objects/items/weapons/shields.dm | 30 +++--- code/game/objects/items/weapons/twohanded.dm | 19 ++-- .../mining/equipment/kinetic_crusher.dm | 2 +- .../hostile/megafauna/blood_drunk_miner.dm | 6 +- .../projectiles/guns/projectile/revolver.dm | 2 +- .../projectiles/guns/projectile/shotgun.dm | 2 +- 12 files changed, 99 insertions(+), 78 deletions(-) diff --git a/code/__HELPERS/trait_helpers.dm b/code/__HELPERS/trait_helpers.dm index 7ca2893038c..48feea04b4e 100644 --- a/code/__HELPERS/trait_helpers.dm +++ b/code/__HELPERS/trait_helpers.dm @@ -268,6 +268,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_NO_THROWN_MESSAGE "no_message_when_thrown" /// Makes the item not display a message on storage insertion #define TRAIT_SILENT_INSERTION "silent_insertion" +/// Makes an item active, this is generally used by energy based weapons or toggle based items. +#define TRAIT_ITEM_ACTIVE "item_active" /// A surgical tool; when in hand in help intent (and with a surgery in progress) won't attack the user #define TRAIT_SURGICAL "surgical_tool" diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index 3a6f5515078..8db9526d525 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -124,7 +124,8 @@ GLOBAL_LIST_INIT(traits_by_type, list( "TRAIT_XENO_INTERACTABLE" = TRAIT_XENO_INTERACTABLE, "TRAIT_NO_THROWN_MESSAGE" = TRAIT_NO_THROWN_MESSAGE, "TRAIT_SILENT_INSERTION" = TRAIT_SILENT_INSERTION, - "TRAIT_HYPOSPRAY_IMMUNE" = TRAIT_HYPOSPRAY_IMMUNE + "TRAIT_HYPOSPRAY_IMMUNE" = TRAIT_HYPOSPRAY_IMMUNE, + "TRAIT_ITEM_ACTIVE" = TRAIT_ITEM_ACTIVE ), /turf = list( diff --git a/code/datums/components/parry.dm b/code/datums/components/parry.dm index f0d82912a7c..285353bd841 100644 --- a/code/datums/components/parry.dm +++ b/code/datums/components/parry.dm @@ -16,6 +16,10 @@ var/no_parry_sound /// Text to be shown to users who examine the parent. Will list which type of attacks it can parry. var/examine_text + /// Does this item have a require a condition to meet before being able to parry? This is for two handed weapons that can parry. (Default: FALSE) + var/requires_two_hands = FALSE + /// Does this item require activation? This is for activation based items or energy weapons. + var/requires_activation = FALSE /datum/component/parry/RegisterWithParent() RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(equipped)) @@ -32,7 +36,7 @@ if(ismob(I.loc)) UnregisterSignal(I.loc, COMSIG_HUMAN_PARRY) -/datum/component/parry/Initialize(_stamina_constant = 0, _stamina_coefficient = 0, _parry_time_out_time = PARRY_DEFAULT_TIMEOUT, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = 2 SECONDS, _no_parry_sound = FALSE) +/datum/component/parry/Initialize(_stamina_constant = 0, _stamina_coefficient = 0, _parry_time_out_time = PARRY_DEFAULT_TIMEOUT, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = 2 SECONDS, _no_parry_sound = FALSE, _requires_two_hands = FALSE, _requires_activation = FALSE) if(!isitem(parent)) return COMPONENT_INCOMPATIBLE @@ -41,6 +45,8 @@ stamina_coefficient = _stamina_coefficient parry_cooldown = _parry_cooldown no_parry_sound = _no_parry_sound + requires_two_hands = _requires_two_hands + requires_activation = _requires_activation if(islist(_parryable_attack_types)) parryable_attack_types = _parryable_attack_types else @@ -73,6 +79,10 @@ /datum/component/parry/proc/start_parry(mob/living/L) SIGNAL_HANDLER var/time_since_parry = world.time - time_parried + if(requires_two_hands && !HAS_TRAIT(parent, TRAIT_WIELDED)) // If our item has special conditions before being able to parry. + return + if(requires_activation && !HAS_TRAIT(parent, TRAIT_ITEM_ACTIVE)) // If our item requires an activation to be able to parry. [E-sword / Teleshield, etc.] + return if(time_since_parry < parry_cooldown) // stops spam return diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm index f3ef2d5ef90..3cc56fa4368 100644 --- a/code/game/gamemodes/cult/cult_items.dm +++ b/code/game/gamemodes/cult/cult_items.dm @@ -573,7 +573,7 @@ /obj/item/cult_spear/Initialize(mapload) . = ..() - AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.4, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = (5 / 3) SECONDS ) // 0.666667 seconds for 60% uptime. + AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.4, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = (5 / 3) SECONDS) // 0.666667 seconds for 60% uptime. AddComponent(/datum/component/two_handed, force_wielded = 24, force_unwielded = force, icon_wielded = "[base_icon_state]1") /obj/item/cult_spear/Destroy() diff --git a/code/game/objects/items/weapons/cigs.dm b/code/game/objects/items/weapons/cigs.dm index 4adb39fdb88..085c66cbab3 100644 --- a/code/game/objects/items/weapons/cigs.dm +++ b/code/game/objects/items/weapons/cigs.dm @@ -132,7 +132,7 @@ LIGHTERS ARE IN LIGHTERS.DM else if(istype(I, /obj/item/melee/energy/sword/saber)) var/obj/item/melee/energy/sword/saber/S = I - if(S.active) + if(HAS_TRAIT(S, TRAIT_ITEM_ACTIVE)) light("[user] makes a violent slashing motion, barely missing [user.p_their()] nose as light flashes. [user.p_they(TRUE)] light[user.p_s()] [user.p_their()] [name] with [S] in the process.") else if(istype(I, /obj/item/assembly/igniter)) diff --git a/code/game/objects/items/weapons/melee/energy_melee_weapons.dm b/code/game/objects/items/weapons/melee/energy_melee_weapons.dm index b06f34ec70b..3e9422d4bfe 100644 --- a/code/game/objects/items/weapons/melee/energy_melee_weapons.dm +++ b/code/game/objects/items/weapons/melee/energy_melee_weapons.dm @@ -14,7 +14,6 @@ name = "generic energy blade" desc = "If you can see this and didn't spawn it in as an admin, make an issue report on GitHub." icon = 'icons/obj/weapons/energy_melee.dmi' - var/active = FALSE /// Damage done when active. Does not stack with force_off. var/force_on = 30 /// Damage done when thrown while active. Does not stack with throwforce_off. @@ -78,8 +77,21 @@ if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50)) to_chat(user, "You accidentally cut yourself with [src], like a doofus!") user.take_organ_damage(5,5) - active = !active - if(active) + if(HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)) + REMOVE_TRAIT(src, TRAIT_ITEM_ACTIVE, TRAIT_GENERIC) + force = force_off + throwforce = throwforce_off + hitsound = initial(hitsound) + throw_speed = initial(throw_speed) + if(length(attack_verb_on)) + attack_verb = list() + icon_state = initial(icon_state) + w_class = initial(w_class) + playsound(user, 'sound/weapons/saberoff.ogg', 35, 1) //changed it from 50% volume to 35% because deafness + set_light(0) + to_chat(user, "[src] can now be concealed.") + else + ADD_TRAIT(src, TRAIT_ITEM_ACTIVE, TRAIT_GENERIC) force = force_on throwforce = throwforce_on hitsound = 'sound/weapons/blade1.ogg' @@ -95,18 +107,7 @@ w_class = w_class_on playsound(user, 'sound/weapons/saberon.ogg', 35, 1) //changed it from 50% volume to 35% because deafness to_chat(user, "[src] is now active.") - else - force = force_off - throwforce = throwforce_off - hitsound = initial(hitsound) - throw_speed = initial(throw_speed) - if(length(attack_verb_on)) - attack_verb = list() - icon_state = initial(icon_state) - w_class = initial(w_class) - playsound(user, 'sound/weapons/saberoff.ogg', 35, 1) //changed it from 50% volume to 35% because deafness - set_light(0) - to_chat(user, "[src] can now be concealed.") + if(ishuman(user)) var/mob/living/carbon/human/H = user H.update_inv_l_hand() @@ -115,7 +116,9 @@ return /obj/item/melee/energy/get_heat() - return active * 3500 + if(HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)) + return 3500 + return 0 /obj/item/melee/energy/proc/try_sharpen(obj/item/item, amount, max_amount) SIGNAL_HANDLER // COMSIG_ITEM_SHARPEN_ACT @@ -180,14 +183,14 @@ ..() if(item_color == null) item_color = pick("red", "blue", "green", "purple") - AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.5, _parryable_attack_types = ALL_ATTACK_TYPES) + AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.5, _parryable_attack_types = ALL_ATTACK_TYPES, _requires_activation = TRUE) /obj/item/melee/energy/sword/examine(mob/user) . = ..() . += "Can parry melee attacks and sometimes blocks ranged energy attacks. Use in hand to turn off and on." /obj/item/melee/energy/sword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - if(active) + if(HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)) return ..() return FALSE @@ -198,7 +201,7 @@ /obj/item/melee/energy/sword/cyborg/attack(mob/M, mob/living/silicon/robot/R) if(R.cell) var/obj/item/stock_parts/cell/C = R.cell - if(active && !(C.use(hitcost))) + if(HAS_TRAIT(src, TRAIT_ITEM_ACTIVE) && !(C.use(hitcost))) attack_self(R) to_chat(R, "It's out of charge!") return @@ -251,7 +254,7 @@ item_color = "rainbow" to_chat(user, "RNBW_ENGAGE") - if(active) + if(HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)) icon_state = "swordrainbow" // Updating overlays, copied from welder code. // I tried calling attack_self twice, which looked cool, except it somehow didn't update the overlays!! @@ -265,7 +268,7 @@ /obj/item/melee/energy/sword/saber/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - if(!active) + if(!HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)) return FALSE . = ..() if(!.) // they did not block the attack @@ -322,13 +325,16 @@ icon_state = "blade" force = 30 //Normal attacks deal esword damage hitsound = 'sound/weapons/blade1.ogg' - active = TRUE throwforce = 1//Throwing or dropping the item deletes it. throw_speed = 3 throw_range = 1 w_class = WEIGHT_CLASS_BULKY //So you can't hide it in your pocket or some such. sharp = TRUE +/obj/item/melee/energy/blade/Initialize(mapload) + . = ..() + ADD_TRAIT(src, TRAIT_ITEM_ACTIVE, ROUNDSTART_TRAIT) + /obj/item/melee/energy/blade/attack_self(mob/user) return @@ -374,7 +380,7 @@ return var/datum/status_effect/saw_bleed/B = target.has_status_effect(STATUS_EFFECT_SAWBLEED) if(!B) - if(!active) //This isn't in the above if-check so that the else doesn't care about active + if(!HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)) //This isn't in the above if-check so that the else doesn't care about active target.apply_status_effect(STATUS_EFFECT_SAWBLEED) else B.add_bleed(B.bleed_buildup) @@ -394,8 +400,21 @@ if(HAS_TRAIT(H, TRAIT_CLUMSY) && prob(50)) to_chat(H, "You accidentally cut yourself with [src], like a doofus!") H.take_organ_damage(10,10) - active = !active - if(active) + if(HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)) + REMOVE_TRAIT(src, TRAIT_ITEM_ACTIVE, TRAIT_GENERIC) + force = force_off + throwforce = throwforce_off + hitsound = initial(hitsound) + throw_speed = initial(throw_speed) + if(length(attack_verb_on)) + attack_verb = list() + icon_state = initial(icon_state) + w_class = initial(w_class) + playsound(user, 'sound/magic/fellowship_armory.ogg', 35, 1) //changed it from 50% volume to 35% because deafness + set_light(0) + to_chat(user, "You close [src]. It will now attack rapidly and cause fauna to bleed.") + else + ADD_TRAIT(src, TRAIT_ITEM_ACTIVE, TRAIT_GENERIC) force = force_on throwforce = throwforce_on hitsound = 'sound/weapons/bladeslice.ogg' @@ -409,20 +428,8 @@ icon_state = "sword[item_color]" set_light(brightness_on, l_color=colormap[item_color]) w_class = w_class_on - playsound(user, 'sound/magic/fellowship_armory.ogg', 35, TRUE, frequency = 90000 - (active * 30000)) + playsound(user, 'sound/magic/fellowship_armory.ogg', 35, TRUE, frequency = 90000 - (HAS_TRAIT(src, TRAIT_ITEM_ACTIVE) * 30000)) to_chat(user, "You open [src]. It will now cleave enemies in a wide arc and deal additional damage to fauna.") - else - force = force_off - throwforce = throwforce_off - hitsound = initial(hitsound) - throw_speed = initial(throw_speed) - if(length(attack_verb_on)) - attack_verb = list() - icon_state = initial(icon_state) - w_class = initial(w_class) - playsound(user, 'sound/magic/fellowship_armory.ogg', 35, 1) //changed it from 50% volume to 35% because deafness - set_light(0) - to_chat(user, "You close [src]. It will now attack rapidly and cause fauna to bleed.") if(ishuman(user)) var/mob/living/carbon/human/H = user @@ -433,27 +440,27 @@ /obj/item/melee/energy/cleaving_saw/examine(mob/user) . = ..() - . += "It is [active ? "open, will cleave enemies in a wide arc and deal additional damage to fauna":"closed, and can be used for rapid consecutive attacks that cause fauna to bleed"].
\ + . += "It is [HAS_TRAIT(src, TRAIT_ITEM_ACTIVE) ? "open, will cleave enemies in a wide arc and deal additional damage to fauna":"closed, and can be used for rapid consecutive attacks that cause fauna to bleed"].
\ Both modes will build up existing bleed effects, doing a burst of high damage if the bleed is built up high enough.
\ Transforming it immediately after an attack causes the next attack to come out faster.
" /obj/item/melee/energy/cleaving_saw/suicide_act(mob/user) - user.visible_message("[user] is [active ? "closing [src] on [user.p_their()] neck" : "opening [src] into [user.p_their()] chest"]! It looks like [user.p_theyre()] trying to commit suicide!") + user.visible_message("[user] is [HAS_TRAIT(src, TRAIT_ITEM_ACTIVE) ? "closing [src] on [user.p_their()] neck" : "opening [src] into [user.p_their()] chest"]! It looks like [user.p_theyre()] trying to commit suicide!") transform_cooldown = 0 transform_weapon(user, TRUE) return BRUTELOSS /obj/item/melee/energy/cleaving_saw/melee_attack_chain(mob/user, atom/target, params) ..() - if(!active) + if(!HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)) user.changeNext_move(CLICK_CD_MELEE * 0.5) //when closed, it attacks very rapidly /obj/item/melee/energy/cleaving_saw/attack(mob/living/target, mob/living/carbon/human/user) - if(!active || swiping || !target.density || get_turf(target) == get_turf(user)) - if(!active) + if(!HAS_TRAIT(src, TRAIT_ITEM_ACTIVE) || swiping || !target.density || get_turf(target) == get_turf(user)) + if(!HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)) faction_bonus_force = 0 ..() - if(!active) + if(!HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)) faction_bonus_force = initial(faction_bonus_force) else var/turf/user_turf = get_turf(user) diff --git a/code/game/objects/items/weapons/shields.dm b/code/game/objects/items/weapons/shields.dm index 3f260fb977b..604b90b7c54 100644 --- a/code/game/objects/items/weapons/shields.dm +++ b/code/game/objects/items/weapons/shields.dm @@ -139,32 +139,34 @@ throw_speed = 3 throw_range = 4 w_class = WEIGHT_CLASS_NORMAL - var/active = FALSE + +/obj/item/shield/riot/tele/add_parry_component() + AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.7, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = (5 / 3) SECONDS, _requires_activation = TRUE) /obj/item/shield/riot/tele/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK) - if(active) + if(HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)) return ..() return FALSE // by not calling the parent the hit_reaction signal is never sent /obj/item/shield/riot/tele/attack_self(mob/living/user) - active = !active - icon_state = "teleriot[active]" - playsound(src.loc, 'sound/weapons/batonextend.ogg', 50, 1) - - if(active) - force = 8 - throwforce = 5 - throw_speed = 2 - w_class = WEIGHT_CLASS_BULKY - slot_flags = SLOT_FLAG_BACK - to_chat(user, "You extend \the [src].") - else + if(HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)) + REMOVE_TRAIT(src,TRAIT_ITEM_ACTIVE, TRAIT_GENERIC) force = 3 throwforce = 3 throw_speed = 3 w_class = WEIGHT_CLASS_NORMAL slot_flags = null to_chat(user, "[src] can now be concealed.") + else + ADD_TRAIT(src, TRAIT_ITEM_ACTIVE, TRAIT_GENERIC) + force = 8 + throwforce = 5 + throw_speed = 2 + w_class = WEIGHT_CLASS_BULKY + slot_flags = SLOT_FLAG_BACK + to_chat(user, "You extend \the [src].") + icon_state = "teleriot[HAS_TRAIT(src, TRAIT_ITEM_ACTIVE)]" + playsound(loc, 'sound/weapons/batonextend.ogg', 50, TRUE) if(ishuman(user)) var/mob/living/carbon/human/H = user H.update_inv_l_hand() diff --git a/code/game/objects/items/weapons/twohanded.dm b/code/game/objects/items/weapons/twohanded.dm index 121e103b2f4..328b49f4730 100644 --- a/code/game/objects/items/weapons/twohanded.dm +++ b/code/game/objects/items/weapons/twohanded.dm @@ -29,6 +29,7 @@ /obj/item/fireaxe/Initialize(mapload) . = ..() ADD_TRAIT(src, TRAIT_FORCES_OPEN_DOORS_ITEM, ROUNDSTART_TRAIT) + AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.7, _parryable_attack_types = MELEE_ATTACK, _parry_cooldown = (10 / 3) SECONDS, _requires_two_hands = TRUE) // 2.3333 seconds of cooldown for 30% uptime AddComponent(/datum/component/two_handed, force_unwielded = force_unwielded, force_wielded = force_wielded, icon_wielded = "[base_icon_state]1") /obj/item/fireaxe/update_icon_state() //Currently only here to fuck with the on-mob icons. @@ -52,10 +53,6 @@ force_wielded = 23 needs_permit = TRUE -/obj/item/fireaxe/boneaxe/Initialize(mapload) - . = ..() - AddComponent(/datum/component/two_handed, force_wielded = force_wielded, icon_wielded = "[base_icon_state]1") - /obj/item/fireaxe/energized desc = "Someone with a love for fire axes decided to turn this one into a high-powered energy weapon. Seems excessive." force_wielded = 35 @@ -109,7 +106,6 @@ throw_range = 5 w_class = WEIGHT_CLASS_SMALL var/w_class_on = WEIGHT_CLASS_BULKY - armour_penetration_flat = 10 armour_penetration_percentage = 50 origin_tech = "magnets=4;syndicate=5" @@ -123,8 +119,6 @@ var/blade_color var/brightness_on = 2 var/colormap = list(red = LIGHT_COLOR_RED, blue = LIGHT_COLOR_LIGHTBLUE, green = LIGHT_COLOR_GREEN, purple = LIGHT_COLOR_PURPLE, rainbow = LIGHT_COLOR_WHITE) - - var/force_unwielded = 3 var/force_wielded = 34 var/wieldsound = 'sound/weapons/saberon.ogg' @@ -134,7 +128,7 @@ . = ..() 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) // 0.3333 seconds of cooldown for 75% uptime + 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) /obj/item/dualsaber/update_icon_state() @@ -261,6 +255,7 @@ /obj/item/spear/Initialize(mapload) . = ..() + AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.7, _parryable_attack_types = MELEE_ATTACK, _parry_cooldown = (10 / 3) SECONDS, _requires_two_hands = TRUE) // 2.3333 seconds of cooldown for 30% uptime AddComponent(/datum/component/two_handed, \ force_wielded = force_wielded, \ force_unwielded = force_unwielded, \ @@ -566,6 +561,7 @@ /obj/item/singularityhammer/Initialize(mapload) . = ..() + 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 = 40, \ force_unwielded = force, \ @@ -635,6 +631,7 @@ /obj/item/mjollnir/Initialize(mapload) . = ..() + 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 = 25, \ force_unwielded = force, \ @@ -685,6 +682,7 @@ /obj/item/knighthammer/Initialize(mapload) . = ..() START_PROCESSING(SSobj, src) + 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 = 30, \ force_unwielded = force, \ @@ -889,6 +887,7 @@ /obj/item/push_broom/Initialize(mapload) . = ..() + AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.25, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = (7 / 5) SECONDS, _requires_two_hands = TRUE) AddComponent(/datum/component/two_handed, \ force_wielded = 12, \ force_unwielded = force, \ @@ -959,7 +958,7 @@ /obj/item/push_broom/traitor/Initialize(mapload) . = ..() - AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.25, _parryable_attack_types = ALL_ATTACK_TYPES, _parry_cooldown = (4 / 3) SECONDS) // 0.3333 seconds of cooldown for 75% uptime + 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 // parent component handles this AddComponent(/datum/component/two_handed, force_wielded = 25, force_unwielded = force) @@ -1047,7 +1046,7 @@ . = ..() ADD_TRAIT(src, TRAIT_FORCES_OPEN_DOORS_ITEM, ROUNDSTART_TRAIT) ADD_TRAIT(src, TRAIT_SUPERMATTER_IMMUNE, ROUNDSTART_TRAIT) //so it can't be dusted by the SM - AddComponent(/datum/component/parry, _stamina_constant = 0, _stamina_coefficient = 0.25, _parryable_attack_types = ALL_ATTACK_TYPES) + 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 = 40, force_unwielded = force, icon_wielded = "[base_icon_state]1") /obj/item/supermatter_halberd/update_icon_state() diff --git a/code/modules/mining/equipment/kinetic_crusher.dm b/code/modules/mining/equipment/kinetic_crusher.dm index 7f50e031d79..0ea3a5eb913 100644 --- a/code/modules/mining/equipment/kinetic_crusher.dm +++ b/code/modules/mining/equipment/kinetic_crusher.dm @@ -36,7 +36,7 @@ /obj/item/kinetic_crusher/Initialize(mapload) . = ..() - AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.7, _parryable_attack_types = MELEE_ATTACK, _parry_cooldown = (10 / 3) SECONDS ) // 2.3333 seconds of cooldown for 30% uptime + AddComponent(/datum/component/parry, _stamina_constant = 2, _stamina_coefficient = 0.7, _parryable_attack_types = MELEE_ATTACK, _parry_cooldown = (10 / 3) SECONDS, _requires_two_hands = TRUE) // 2.3333 seconds of cooldown for 30% uptime AddComponent(/datum/component/two_handed, force_wielded = force_wielded, force_unwielded = force) /obj/item/kinetic_crusher/Destroy() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm index 56c38fb4ddd..ad8b1f7becb 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm @@ -281,13 +281,13 @@ Difficulty: Medium if(time_until_next_transform <= world.time) miner_saw.transform_cooldown = 0 miner_saw.transform_weapon(src, TRUE) - if(!miner_saw.active) + if(!HAS_TRAIT(miner_saw, TRAIT_ITEM_ACTIVE)) rapid_melee = 5 // 4 deci cooldown before changes, npcpool subsystem wait is 20, 20/4 = 5 else rapid_melee = 3 // same thing but halved (slightly rounded up) transform_stop_attack = TRUE - icon_state = "miner[miner_saw.active ? "_transformed":""]" - icon_living = "miner[miner_saw.active ? "_transformed":""]" + icon_state = "miner[HAS_TRAIT(miner_saw, TRAIT_ITEM_ACTIVE) ? "_transformed":""]" + icon_living = "miner[HAS_TRAIT(miner_saw, TRAIT_ITEM_ACTIVE) ? "_transformed":""]" time_until_next_transform = world.time + rand(50, 100) /obj/effect/temp_visual/dir_setting/miner_death diff --git a/code/modules/projectiles/guns/projectile/revolver.dm b/code/modules/projectiles/guns/projectile/revolver.dm index 25e1e1164d0..7afa753ce01 100644 --- a/code/modules/projectiles/guns/projectile/revolver.dm +++ b/code/modules/projectiles/guns/projectile/revolver.dm @@ -360,7 +360,7 @@ return ..() if(istype(A, /obj/item/melee/energy)) var/obj/item/melee/energy/W = A - if(W.active) + if(HAS_TRAIT(W, TRAIT_ITEM_ACTIVE)) sawoff(user) item_state = icon_state if(istype(A, /obj/item/circular_saw) || istype(A, /obj/item/gun/energy/plasmacutter)) diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm index 9963f90cc99..d282240d3a8 100644 --- a/code/modules/projectiles/guns/projectile/shotgun.dm +++ b/code/modules/projectiles/guns/projectile/shotgun.dm @@ -97,7 +97,7 @@ sawoff(user) if(istype(A, /obj/item/melee/energy)) var/obj/item/melee/energy/W = A - if(W.active) + if(HAS_TRAIT(W, TRAIT_ITEM_ACTIVE)) sawoff(user) if(istype(A, /obj/item/pipe)) unsaw(A, user)