fix shove regression (#12316)

This commit is contained in:
Rane
2022-11-08 16:10:59 -05:00
committed by GitHub
parent 20032b5ecc
commit 6c95c8d165
12 changed files with 45 additions and 15 deletions

View File

@@ -5,6 +5,7 @@ using Content.Client.Weapons.Melee.Components;
using Content.Shared.MobState.Components; using Content.Shared.MobState.Components;
using Content.Shared.Weapons.Melee; using Content.Shared.Weapons.Melee;
using Content.Shared.Weapons.Melee.Events; using Content.Shared.Weapons.Melee.Events;
using Content.Shared.StatusEffect;
using Robust.Client.Animations; using Robust.Client.Animations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Client.Graphics; using Robust.Client.Graphics;
@@ -218,9 +219,13 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
return false; return false;
} }
// If target doesn't have hands then we can't disarm so will let the player know it's pointless. // They need to either have hands...
if (!HasComp<HandsComponent>(ev.Target!.Value)) if (!HasComp<HandsComponent>(ev.Target!.Value))
{ {
// or just be able to be shoved over.
if (TryComp<StatusEffectsComponent>(ev.Target!.Value, out var status) && status.AllowedEffects.Contains("KnockedDown"))
return true;
if (Timing.IsFirstTimePredicted && HasComp<MobStateComponent>(ev.Target.Value)) if (Timing.IsFirstTimePredicted && HasComp<MobStateComponent>(ev.Target.Value))
PopupSystem.PopupEntity(Loc.GetString("disarm-action-disarmable", ("targetName", ev.Target.Value)), ev.Target.Value, Filter.Local()); PopupSystem.PopupEntity(Loc.GetString("disarm-action-disarmable", ("targetName", ev.Target.Value)), ev.Target.Value, Filter.Local());

View File

@@ -94,15 +94,6 @@ namespace Content.Server.Hands.Systems
if (!_handsSystem.TryDrop(uid, component.ActiveHand!, null, checkActionBlocker: false)) if (!_handsSystem.TryDrop(uid, component.ActiveHand!, null, checkActionBlocker: false))
return; return;
var targEnt = Identity.Entity(args.Target, EntityManager);
var msgOther = Loc.GetString("hands-component-disarm-success-others-message",
("disarmer", Identity.Entity(args.Source, EntityManager)), ("disarmed", targEnt));
var msgUser = Loc.GetString("hands-component-disarm-success-message", ("disarmed", targEnt));
var filter = Filter.Pvs(args.Source).RemoveWhereAttachedEntity(e => e == args.Source);
_popupSystem.PopupEntity(msgOther, args.Source, filter);
_popupSystem.PopupEntity(msgUser, args.Source, Filter.Entities(args.Source));
args.Handled = true; // no shove/stun. args.Handled = true; // no shove/stun.
} }

View File

@@ -25,6 +25,7 @@ using Content.Shared.Physics;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Content.Shared.Weapons.Melee; using Content.Shared.Weapons.Melee;
using Content.Shared.Weapons.Melee.Events; using Content.Shared.Weapons.Melee.Events;
using Content.Shared.StatusEffect;
using Robust.Server.Player; using Robust.Server.Player;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Map; using Robust.Shared.Map;
@@ -328,7 +329,7 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
if (!TryComp<HandsComponent>(ev.Target.Value, out var targetHandsComponent)) if (!TryComp<HandsComponent>(ev.Target.Value, out var targetHandsComponent))
{ {
// Client will have already predicted this. if (!TryComp<StatusEffectsComponent>(ev.Target!.Value, out var status) || !status.AllowedEffects.Contains("KnockedDown"))
return false; return false;
} }
@@ -339,7 +340,7 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
EntityUid? inTargetHand = null; EntityUid? inTargetHand = null;
if (targetHandsComponent.ActiveHand is { IsEmpty: false }) if (targetHandsComponent?.ActiveHand is { IsEmpty: false })
{ {
inTargetHand = targetHandsComponent.ActiveHand.HeldEntity!.Value; inTargetHand = targetHandsComponent.ActiveHand.HeldEntity!.Value;
} }
@@ -368,13 +369,17 @@ public sealed class MeleeWeaponSystem : SharedMeleeWeaponSystem
} }
var filterOther = Filter.Pvs(user, entityManager: EntityManager).RemoveWhereAttachedEntity(e => e == user); var filterOther = Filter.Pvs(user, entityManager: EntityManager).RemoveWhereAttachedEntity(e => e == user);
var msgPrefix = "disarm-action-";
if (inTargetHand == null)
msgPrefix = "disarm-action-shove-";
var msgOther = Loc.GetString( var msgOther = Loc.GetString(
"disarm-action-popup-message-other-clients", msgPrefix + "popup-message-other-clients",
("performerName", Identity.Entity(user, EntityManager)), ("performerName", Identity.Entity(user, EntityManager)),
("targetName", Identity.Entity(target, EntityManager))); ("targetName", Identity.Entity(target, EntityManager)));
var msgUser = Loc.GetString("disarm-action-popup-message-cursor", ("targetName", Identity.Entity(target, EntityManager))); var msgUser = Loc.GetString(msgPrefix + "popup-message-cursor", ("targetName", Identity.Entity(target, EntityManager)));
PopupSystem.PopupEntity(msgOther, user, filterOther); PopupSystem.PopupEntity(msgOther, user, filterOther);
PopupSystem.PopupEntity(msgUser, target, Filter.Entities(user)); PopupSystem.PopupEntity(msgUser, target, Filter.Entities(user));

View File

@@ -1,6 +1,8 @@
disarm-action-disarmable = {THE($targetName)} is not disarmable! disarm-action-disarmable = {THE($targetName)} is not disarmable!
disarm-action-popup-message-other-clients = {CAPITALIZE(THE($performerName))} disarmed {THE($targetName)}! disarm-action-popup-message-other-clients = {CAPITALIZE(THE($performerName))} disarmed {THE($targetName)}!
disarm-action-popup-message-cursor = Disarmed {THE($targetName)}! disarm-action-popup-message-cursor = Disarmed {THE($targetName)}!
disarm-action-shove-popup-message-other-clients = {CAPITALIZE(THE($performerName))} shoves {THE($targetName)}!
disarm-action-shove-popup-message-cursor = You shove {THE($targetName)}!
action-name-disarm = [color=red]Disarm[/color] action-name-disarm = [color=red]Disarm[/color]
action-description-disarm = Attempt to [color=red]disarm[/color] someone. action-description-disarm = Attempt to [color=red]disarm[/color] someone.

View File

@@ -98,6 +98,8 @@
0: Alive 0: Alive
5: Critical 5: Critical
10: Dead 10: Dead
- type: Stamina
excess: 10
- type: Appearance - type: Appearance
- type: DamageStateVisuals - type: DamageStateVisuals
rotate: true rotate: true

View File

@@ -32,6 +32,8 @@
thresholds: thresholds:
0: Alive 0: Alive
150: Dead 150: Dead
- type: Stamina
excess: 150
- type: Appearance - type: Appearance
- type: DamageStateVisuals - type: DamageStateVisuals
states: states:

View File

@@ -40,6 +40,8 @@
0: Alive 0: Alive
50: Critical 50: Critical
100: Dead 100: Dead
- type: Stamina
excess: 100
- type: MovementAlwaysTouching - type: MovementAlwaysTouching
- type: Appearance - type: Appearance
- type: DamageStateVisuals - type: DamageStateVisuals

View File

@@ -197,6 +197,8 @@
0: Alive 0: Alive
40: Critical 40: Critical
60: Dead 60: Dead
- type: Stamina
excess: 60
- type: MeleeWeapon - type: MeleeWeapon
hidden: true hidden: true
angle: 0 angle: 0

View File

@@ -76,6 +76,8 @@
thresholds: thresholds:
0: Alive 0: Alive
120: Dead 120: Dead
- type: Stamina
excess: 120
- type: Destructible - type: Destructible
thresholds: thresholds:
- trigger: - trigger:

View File

@@ -94,6 +94,7 @@
0: Alive 0: Alive
50: Critical 50: Critical
100: Dead 100: Dead
- type: Stamina
- type: Destructible - type: Destructible
thresholds: thresholds:
- trigger: - trigger:

View File

@@ -34,6 +34,8 @@
thresholds: thresholds:
0: Alive 0: Alive
15: Dead 15: Dead
- type: Stamina
excess: 15
- type: MovementAlwaysTouching - type: MovementAlwaysTouching
- type: Appearance - type: Appearance
- type: DamageStateVisuals - type: DamageStateVisuals

View File

@@ -57,6 +57,8 @@
thresholds: thresholds:
0: Alive 0: Alive
200: Dead 200: Dead
- type: Stamina
excess: 200
- type: Bloodstream - type: Bloodstream
bloodReagent: FluorosulfuricAcid bloodReagent: FluorosulfuricAcid
bloodlossDamage: bloodlossDamage:
@@ -130,6 +132,8 @@
thresholds: thresholds:
0: Alive 0: Alive
300: Dead 300: Dead
- type: Stamina
excess: 300
- type: SlowOnDamage - type: SlowOnDamage
speedModifierThresholds: speedModifierThresholds:
250: 0.7 250: 0.7
@@ -160,6 +164,8 @@
thresholds: thresholds:
0: Alive 0: Alive
200: Dead 200: Dead
- type: Stamina
excess: 200
- type: MovementSpeedModifier - type: MovementSpeedModifier
baseWalkSpeed : 3.0 baseWalkSpeed : 3.0
baseSprintSpeed : 5.5 baseSprintSpeed : 5.5
@@ -193,6 +199,8 @@
thresholds: thresholds:
0: Alive 0: Alive
1500: Dead 1500: Dead
- type: Stamina
excess: 1500
- type: MovementSpeedModifier - type: MovementSpeedModifier
baseWalkSpeed : 2.8 baseWalkSpeed : 2.8
baseSprintSpeed : 3.8 baseSprintSpeed : 3.8
@@ -231,6 +239,8 @@
thresholds: thresholds:
0: Alive 0: Alive
550: Dead 550: Dead
- type: Stamina
excess: 550
- type: MovementSpeedModifier - type: MovementSpeedModifier
baseWalkSpeed : 2.3 baseWalkSpeed : 2.3
baseSprintSpeed : 4.2 baseSprintSpeed : 4.2
@@ -269,6 +279,8 @@
thresholds: thresholds:
0: Alive 0: Alive
250: Dead 250: Dead
- type: Stamina
excess: 250
- type: MovementSpeedModifier - type: MovementSpeedModifier
baseWalkSpeed : 2.7 baseWalkSpeed : 2.7
baseSprintSpeed : 6.0 baseSprintSpeed : 6.0
@@ -317,6 +329,8 @@
thresholds: thresholds:
0: Alive 0: Alive
300: Dead 300: Dead
- type: Stamina
excess: 300
- type: SlowOnDamage - type: SlowOnDamage
speedModifierThresholds: speedModifierThresholds:
250: 0.4 250: 0.4