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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.Weapons.Melee;
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.StatusEffect;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
@ -218,9 +219,13 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
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))
{
// 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))
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))
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.
}

View File

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

View File

@ -1,6 +1,8 @@
disarm-action-disarmable = {THE($targetName)} is not disarmable!
disarm-action-popup-message-other-clients = {CAPITALIZE(THE($performerName))} 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-description-disarm = Attempt to [color=red]disarm[/color] someone.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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