33 lines
962 B
C#
Raw Normal View History

2021-05-10 14:30:38 +01:00
using QSB.Player;
using QSB.ShipSync.WorldObjects;
2021-05-02 13:59:39 +01:00
using QSB.Syncs.TransformSync;
2021-04-16 11:40:13 +01:00
using QSB.WorldSync;
using System.Linq;
2021-04-11 17:05:02 +01:00
namespace QSB.ShipSync.TransformSync
{
2021-05-10 14:30:38 +01:00
public class ShipTransformSync : UnparentedSectoredRigidbodySync
2020-12-02 21:29:53 +00:00
{
2021-05-10 14:30:38 +01:00
public static ShipTransformSync LocalInstance { get; private set; }
2020-12-02 21:29:53 +00:00
2021-04-28 10:02:16 +01:00
public override bool UseInterpolation => true;
2021-04-21 19:06:00 +01:00
2021-05-10 14:30:38 +01:00
public override bool IsReady
=> QSBWorldSync.GetWorldObjects<QSBShip>().Count() != 0;
public override void OnStartLocalPlayer()
=> LocalInstance = this;
2020-12-02 21:29:53 +00:00
2021-05-10 14:30:38 +01:00
protected override OWRigidbody InitLocalTransform()
2021-03-09 19:45:00 +00:00
{
SectorSync.SetSectorDetector(Locator.GetShipDetector().GetComponent<SectorDetector>());
2021-05-10 14:30:38 +01:00
return QSBWorldSync.GetWorldFromId<QSBShip>(0).AttachedObject;
2021-03-09 19:45:00 +00:00
}
2020-12-02 21:29:53 +00:00
2021-05-10 14:30:38 +01:00
protected override OWRigidbody InitRemoteTransform()
2020-12-02 21:29:53 +00:00
{
2021-05-10 14:30:38 +01:00
SectorSync.SetSectorDetector(Locator.GetShipDetector().GetComponent<SectorDetector>());
return QSBWorldSync.GetWorldFromId<QSBShip>(0).AttachedObject;
2020-12-02 21:29:53 +00:00
}
}
2020-12-03 08:28:05 +00:00
}