- tweak: Less attack cooldown on miss. (#140)

This commit is contained in:
Aviu00
2024-02-28 23:32:51 +09:00
committed by GitHub
parent d08393441e
commit 05ceeb4976

View File

@@ -428,8 +428,14 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
switch (attack)
{
case LightAttackEvent light:
DoLightAttack(user, light, weaponUid, weapon, session, out var anim); // WD EDIT
animation = anim ?? weapon.Animation; // WD EDIT
DoLightAttack(user, light, weaponUid, weapon, session, out var miss); // WD EDIT
// WD EDIT START
animation = miss && weapon.Animation == "WeaponArcThrust"
? weapon.MissAnimation
: weapon.Animation;
if (miss)
weapon.NextAttack -= fireRate / 2f;
// WD EDIT END
break;
case DisarmAttackEvent disarm:
if (!DoDisarm(user, disarm, weaponUid, weapon, session))
@@ -459,9 +465,9 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
protected abstract bool InRange(EntityUid user, EntityUid target, float range, ICommonSession? session);
protected virtual void DoLightAttack(EntityUid user, LightAttackEvent ev, EntityUid meleeUid, MeleeWeaponComponent component, ICommonSession? session, out string? animation) // WD EDIT
protected virtual void DoLightAttack(EntityUid user, LightAttackEvent ev, EntityUid meleeUid, MeleeWeaponComponent component, ICommonSession? session, out bool miss) // WD EDIT
{
animation = null; // WD EDIT
miss = false; // WD EDIT
// If I do not come back later to fix Light Attacks being Heavy Attacks you can throw me in the spider pit -Errant
var damage = GetDamage(meleeUid, user, component) * GetHeavyDamageModifier(meleeUid, user, component);
var target = GetEntity(ev.Target);
@@ -490,8 +496,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
var missEvent = new MeleeHitEvent(new List<EntityUid>(), user, meleeUid, damage, null);
RaiseLocalEvent(meleeUid, missEvent);
Audio.PlayPredicted(component.SwingSound, meleeUid, user);
if (component.Animation == "WeaponArcThrust") // WD EDIT
animation = component.MissAnimation;
miss = true; // WD EDIT
return;
}