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:
@@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user