From 3f1d0fe67d0a8358ddd8a2d8fb5dbb442f41f852 Mon Sep 17 00:00:00 2001 From: Angelo Fallaria Date: Thu, 16 Jan 2025 14:47:52 +0800 Subject: [PATCH] revert melee weapon wizmerge messery --- .../Weapons/Melee/SharedMeleeWeaponSystem.cs | 27 +++++-------------- Resources/Prototypes/Traits/physical.yml | 4 +-- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs index a019877325a..201269fcc86 100644 --- a/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs +++ b/Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs @@ -68,8 +68,6 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(OnMeleeSelected); - SubscribeLocalEvent(OnMeleeShotAttempted); - SubscribeLocalEvent(OnMeleeShot); SubscribeLocalEvent(OnGetBonusMeleeDamage); SubscribeLocalEvent(OnGetBonusHeavyDamageModifier); SubscribeLocalEvent(OnGetBonusMeleeAttackRate); @@ -93,24 +91,6 @@ private void OnMapInit(EntityUid uid, MeleeWeaponComponent component, MapInitEve #endif } - private void OnMeleeShotAttempted(EntityUid uid, MeleeWeaponComponent comp, ref ShotAttemptedEvent args) - { - if (comp.NextAttack > Timing.CurTime) - args.Cancel(); - } - - private void OnMeleeShot(EntityUid uid, MeleeWeaponComponent component, ref GunShotEvent args) - { - if (!TryComp(uid, out var gun)) - return; - - if (gun.NextFire > component.NextAttack) - { - component.NextAttack = gun.NextFire; - DirtyField(uid, component, nameof(MeleeWeaponComponent.NextAttack)); - } - } - private void OnMeleeSelected(EntityUid uid, MeleeWeaponComponent component, HandSelectedEvent args) { var attackRate = GetAttackRate(uid, args.User, component); @@ -351,6 +331,8 @@ private bool AttemptAttack(EntityUid user, EntityUid weaponUid, MeleeWeaponCompo if (!CombatMode.IsInCombatMode(user)) return false; + var fireRateSwingModifier = 1f; + EntityUid? target = null; switch (attack) { @@ -368,6 +350,9 @@ private bool AttemptAttack(EntityUid user, EntityUid weaponUid, MeleeWeaponCompo if (weaponUid == target) return false; + break; + case HeavyAttackEvent: + fireRateSwingModifier = weapon.HeavyRateModifier; break; case DisarmAttackEvent disarm: if (disarm.Target != null && !TryGetEntity(disarm.Target, out target)) @@ -386,7 +371,7 @@ private bool AttemptAttack(EntityUid user, EntityUid weaponUid, MeleeWeaponCompo } // Windup time checked elsewhere. - var fireRate = TimeSpan.FromSeconds(1f / GetAttackRate(weaponUid, user, weapon)); + var fireRate = TimeSpan.FromSeconds(GetAttackRate(weaponUid, user, weapon) * fireRateSwingModifier); var swings = 0; // TODO: If we get autoattacks then probably need a shotcounter like guns so we can do timing properly. diff --git a/Resources/Prototypes/Traits/physical.yml b/Resources/Prototypes/Traits/physical.yml index bf6a9b43476..02875f7b37f 100644 --- a/Resources/Prototypes/Traits/physical.yml +++ b/Resources/Prototypes/Traits/physical.yml @@ -297,7 +297,7 @@ functions: - !type:TraitModifyUnarmed heavyOnLightMiss: true - attackRateModifier: 1.25 + attackRateModifier: 0.8 rangeModifier: 1.1 - !type:TraitReplaceComponent components: # Keep BoxerComponent for now until we have After/Before on traits prototypes @@ -307,7 +307,7 @@ Blunt: 1.2 Slash: 1.2 Piercing: 1.2 - # An attack rate of 1.25 hits per second multiplied by 20% extra damage + # An attack rate of 1.25 hits per second (1 / 0.8 = 1.25) multiplied by 20% extra damage # effectively means 50% more overall DPS, same DPS bonus as before (1 * 1.25 * 1.2 = 1.5) # but the extra attack rate makes it visually apparent that it's Martial Artist.