Skip to content

Commit

Permalink
revert melee weapon wizmerge messery
Browse files Browse the repository at this point in the history
  • Loading branch information
angelofallars committed Jan 16, 2025
1 parent e5864a5 commit 3f1d0fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
27 changes: 6 additions & 21 deletions Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ public override void Initialize()
base.Initialize();

SubscribeLocalEvent<MeleeWeaponComponent, HandSelectedEvent>(OnMeleeSelected);
SubscribeLocalEvent<MeleeWeaponComponent, ShotAttemptedEvent>(OnMeleeShotAttempted);
SubscribeLocalEvent<MeleeWeaponComponent, GunShotEvent>(OnMeleeShot);
SubscribeLocalEvent<BonusMeleeDamageComponent, GetMeleeDamageEvent>(OnGetBonusMeleeDamage);
SubscribeLocalEvent<BonusMeleeDamageComponent, GetHeavyDamageModifierEvent>(OnGetBonusHeavyDamageModifier);
SubscribeLocalEvent<BonusMeleeAttackRateComponent, GetMeleeAttackRateEvent>(OnGetBonusMeleeAttackRate);
Expand All @@ -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<GunComponent>(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);
Expand Down Expand Up @@ -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)
{
Expand All @@ -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))
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions Resources/Prototypes/Traits/physical.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand Down

0 comments on commit 3f1d0fe

Please sign in to comment.