Better melee combat (#542)

* - add: NextMobAttack, EquipCooldown.

* - fix: Some combat fixes.

* - add: Telebaton.

* - add: Stun baton rework.

* - tweak: Reduce melee range.

* - add: Rework melee block system.

* - add: ExaminedEvent.
This commit is contained in:
Aviu00
2024-08-02 11:50:26 +00:00
committed by GitHub
parent 6ca036189e
commit 27268d4e28
83 changed files with 772 additions and 222 deletions

View File

@@ -76,7 +76,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
}
}
if (weapon.Attacking || weapon.NextAttack > Timing.CurTime)
if (weapon.Attacking) // WD EDIT
{
return;
}
@@ -124,10 +124,31 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
target = screen.GetDamageableClickedEntity(mousePos); // WD EDIT
}
// WD START
if (target == null)
{
if (weapon.NextAttack > Timing.CurTime || weapon.NextMobAttack > Timing.CurTime)
return;
}
else if (IsMob(target.Value))
{
if (weapon.NextMobAttack > Timing.CurTime)
return;
}
else
{
if (weapon.NextAttack > Timing.CurTime)
return;
}
// WD END
EntityManager.RaisePredictiveEvent(new DisarmAttackEvent(GetNetEntity(target), GetNetCoordinates(coordinates)));
return;
}
if (weapon.NextAttack > Timing.CurTime || weapon.NextMobAttack > Timing.CurTime)
return;
// WD START
if (HasComp<BlinkComponent>(weaponUid))
{
@@ -176,6 +197,24 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
if (Interaction.CombatModeCanHandInteract(entity, target))
return;
// WD START
if (target == null)
{
if (weapon.NextAttack > Timing.CurTime || weapon.NextMobAttack > Timing.CurTime)
return;
}
else if (IsMob(target.Value))
{
if (weapon.NextMobAttack > Timing.CurTime)
return;
}
else
{
if (weapon.NextAttack > Timing.CurTime)
return;
}
// WD END
RaisePredictiveEvent(new LightAttackEvent(GetNetEntity(target), GetNetEntity(weaponUid), GetNetCoordinates(coordinates)));
}
}