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

@@ -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));