Don't allow adminfrozen entities to be pulled (#8205)

This commit is contained in:
metalgearsloth
2022-05-16 22:24:52 +10:00
committed by GitHub
parent 527eabc677
commit 644277bf6f
5 changed files with 40 additions and 19 deletions

View File

@@ -0,0 +1,11 @@
using Robust.Shared.Physics;
namespace Content.Shared.Physics.Pull
{
public sealed class PullAttemptEvent : PullMessage
{
public PullAttemptEvent(IPhysBody puller, IPhysBody pulled) : base(puller, pulled) { }
public bool Cancelled { get; set; }
}
}

View File

@@ -1,11 +0,0 @@
using Robust.Shared.Physics;
namespace Content.Shared.Physics.Pull
{
public sealed class PullAttemptMessage : PullMessage
{
public PullAttemptMessage(IPhysBody puller, IPhysBody pulled) : base(puller, pulled) { }
public bool Cancelled { get; set; }
}
}

View File

@@ -26,12 +26,12 @@ namespace Content.Shared.Pulling
return false;
}
if (!EntityManager.TryGetComponent<IPhysBody?>(pulled, out var _physics))
if (!EntityManager.TryGetComponent<IPhysBody>(pulled, out var physics))
{
return false;
}
if (_physics.BodyType == BodyType.Static)
if (physics.BodyType == BodyType.Static)
{
return false;
}
@@ -113,12 +113,12 @@ namespace Content.Shared.Pulling
return false;
}
if (!EntityManager.TryGetComponent<PhysicsComponent?>(puller.Owner, out var pullerPhysics))
if (!EntityManager.TryGetComponent<PhysicsComponent>(puller.Owner, out var pullerPhysics))
{
return false;
}
if (!EntityManager.TryGetComponent<PhysicsComponent?>(pullable.Owner, out var pullablePhysics))
if (!EntityManager.TryGetComponent<PhysicsComponent>(pullable.Owner, out var pullablePhysics))
{
return false;
}
@@ -158,7 +158,7 @@ namespace Content.Shared.Pulling
// Continue with pulling process.
var pullAttempt = new PullAttemptMessage(pullerPhysics, pullablePhysics);
var pullAttempt = new PullAttemptEvent(pullerPhysics, pullablePhysics);
RaiseLocalEvent(puller.Owner, pullAttempt, broadcast: false);