Add pulling taking up a hand (#2405)

* Add pulling taking up a hand

* Revert unnecessary refactor
This commit is contained in:
DrSmugleaf
2020-10-28 10:16:40 +01:00
committed by GitHub
parent 10dc201704
commit f785ec4efb
8 changed files with 209 additions and 51 deletions

View File

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

View File

@@ -100,6 +100,22 @@ namespace Content.Shared.Physics.Pull
return false;
}
var pullAttempt = new PullAttemptMessage(puller, ControlledComponent);
puller.Owner.SendMessage(null, pullAttempt);
if (pullAttempt.Cancelled)
{
return false;
}
ControlledComponent.Owner.SendMessage(null, pullAttempt);
if (pullAttempt.Cancelled)
{
return false;
}
_puller = puller;
var message = new PullStartedMessage(this, _puller, ControlledComponent);