Fix CanDisarm (#11843)
This commit is contained in:
@@ -202,8 +202,11 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
|||||||
if (!base.DoDisarm(user, ev, component))
|
if (!base.DoDisarm(user, ev, component))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!HasComp<CombatModeComponent>(user))
|
if (!TryComp<CombatModeComponent>(user, out var combatMode) ||
|
||||||
|
combatMode.CanDisarm != true)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// If target doesn't have hands then we can't disarm so will let the player know it's pointless.
|
// If target doesn't have hands then we can't disarm so will let the player know it's pointless.
|
||||||
if (!HasComp<HandsComponent>(ev.Target!.Value))
|
if (!HasComp<HandsComponent>(ev.Target!.Value))
|
||||||
|
|||||||
@@ -308,8 +308,11 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
|||||||
if (!base.DoDisarm(user, ev, component))
|
if (!base.DoDisarm(user, ev, component))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!TryComp<CombatModeComponent>(user, out var combatMode))
|
if (!TryComp<CombatModeComponent>(user, out var combatMode) ||
|
||||||
|
combatMode.CanDisarm != true)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var target = ev.Target!.Value;
|
var target = ev.Target!.Value;
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,6 @@ namespace Content.Shared.CombatMode
|
|||||||
[ViewVariables(VVAccess.ReadWrite), DataField("disarm")]
|
[ViewVariables(VVAccess.ReadWrite), DataField("disarm")]
|
||||||
public bool? CanDisarm;
|
public bool? CanDisarm;
|
||||||
|
|
||||||
[DataField("disarmFailSound")]
|
|
||||||
public readonly SoundSpecifier DisarmFailSound = new SoundPathSpecifier("/Audio/Weapons/punchmiss.ogg");
|
|
||||||
|
|
||||||
[DataField("disarmSuccessSound")]
|
[DataField("disarmSuccessSound")]
|
||||||
public readonly SoundSpecifier DisarmSuccessSound = new SoundPathSpecifier("/Audio/Effects/thudswoosh.ogg");
|
public readonly SoundSpecifier DisarmSuccessSound = new SoundPathSpecifier("/Audio/Effects/thudswoosh.ogg");
|
||||||
|
|
||||||
|
|||||||
@@ -243,8 +243,6 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
|||||||
weapon.NextAttack += TimeSpan.FromSeconds(1f / weapon.AttackRate);
|
weapon.NextAttack += TimeSpan.FromSeconds(1f / weapon.AttackRate);
|
||||||
|
|
||||||
// Attack confirmed
|
// Attack confirmed
|
||||||
// Play a sound to give instant feedback; same with playing the animations
|
|
||||||
Audio.PlayPredicted(weapon.SwingSound, weapon.Owner, user);
|
|
||||||
|
|
||||||
switch (attack)
|
switch (attack)
|
||||||
{
|
{
|
||||||
@@ -252,7 +250,9 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
|||||||
DoLightAttack(user, light, weapon);
|
DoLightAttack(user, light, weapon);
|
||||||
break;
|
break;
|
||||||
case DisarmAttackEvent disarm:
|
case DisarmAttackEvent disarm:
|
||||||
DoDisarm(user, disarm, weapon);
|
if (!DoDisarm(user, disarm, weapon))
|
||||||
|
return;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case HeavyAttackEvent heavy:
|
case HeavyAttackEvent heavy:
|
||||||
DoHeavyAttack(user, heavy, weapon);
|
DoHeavyAttack(user, heavy, weapon);
|
||||||
@@ -261,6 +261,9 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Play a sound to give instant feedback; same with playing the animations
|
||||||
|
Audio.PlayPredicted(weapon.SwingSound, weapon.Owner, user);
|
||||||
|
|
||||||
DoLungeAnimation(user, weapon.Angle, attack.Coordinates.ToMap(EntityManager), weapon.Animation);
|
DoLungeAnimation(user, weapon.Angle, attack.Coordinates.ToMap(EntityManager), weapon.Animation);
|
||||||
weapon.Attacking = true;
|
weapon.Attacking = true;
|
||||||
Dirty(weapon);
|
Dirty(weapon);
|
||||||
|
|||||||
@@ -234,7 +234,7 @@
|
|||||||
fireStackAlternateState: 3
|
fireStackAlternateState: 3
|
||||||
- type: EnsnareableVisualizer
|
- type: EnsnareableVisualizer
|
||||||
- type: CombatMode
|
- type: CombatMode
|
||||||
disarm: true
|
canDisarm: true
|
||||||
- type: Climbing
|
- type: Climbing
|
||||||
- type: Cuffable
|
- type: Cuffable
|
||||||
- type: Ensnareable
|
- type: Ensnareable
|
||||||
|
|||||||
Reference in New Issue
Block a user