add spin message

This commit is contained in:
Mister_Nebula 2022-05-07 00:21:15 +01:00
parent c4568946ee
commit 04eeb702ae
4 changed files with 33 additions and 2 deletions

View File

@ -111,7 +111,7 @@ public class QSBGuardAction : QSBGhostAction
}
else
{
_controller.AttachedObject.Spin(TurnSpeed.MEDIUM);
_controller.Spin(TurnSpeed.MEDIUM);
}
_searchingAtNode = true;

View File

@ -63,7 +63,7 @@ public class QSBSearchAction : QSBGhostAction
public override void OnArriveAtPosition()
{
_controller.AttachedObject.Spin(TurnSpeed.MEDIUM);
_controller.Spin(TurnSpeed.MEDIUM);
_searchingAtNode = true;
_searchStartTime = Time.time;
}

View File

@ -0,0 +1,15 @@
using GhostEnums;
using QSB.EchoesOfTheEye.Ghosts.WorldObjects;
using QSB.Messaging;
namespace QSB.EchoesOfTheEye.Ghosts.Messages;
internal class SpinMessage : QSBWorldObjectMessage<QSBGhostController, TurnSpeed>
{
public SpinMessage(TurnSpeed turnSpeed) : base(turnSpeed) { }
public override void OnReceiveRemote()
{
WorldObject.Spin(Data, true);
}
}

View File

@ -277,4 +277,20 @@ public class QSBGhostController : WorldObject<GhostController>, IGhostObject
AttachedObject.StopFacing();
}
public void Spin(TurnSpeed turnSpeed, bool remote = false)
{
if (!remote)
{
if (!QSBCore.IsHost)
{
return;
}
this.SendMessage(new SpinMessage(turnSpeed));
}
// SPEEEEEEEEEN
AttachedObject.Spin(turnSpeed);
}
}