Fix being able to start pulling something while incapacitated. (#4240)

This commit is contained in:
Vera Aguilera Puerto
2021-06-28 14:17:37 +02:00
committed by GitHub
parent a1088faa35
commit 9bedfe79be
7 changed files with 58 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ using Content.Shared.ActionBlocker;
using Content.Shared.Alert;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
using Content.Shared.MobState.State;
using Content.Shared.NetIDs;
using Robust.Shared.GameObjects;
using Robust.Shared.Players;
@@ -14,7 +15,7 @@ using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Shared.MobState.State
namespace Content.Shared.MobState.Components
{
/// <summary>
/// When attached to an <see cref="IDamageableComponent"/>,

View File

@@ -0,0 +1,22 @@
using Content.Shared.MobState.Components;
using Content.Shared.Pulling.Events;
using Robust.Shared.GameObjects;
namespace Content.Shared.MobState.EntitySystems
{
public class SharedMobStateSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SharedMobStateComponent, StartPullAttemptEvent>(OnStartPullAttempt);
}
private void OnStartPullAttempt(EntityUid uid, SharedMobStateComponent component, StartPullAttemptEvent args)
{
if(component.IsIncapacitated())
args.Cancel();
}
}
}