turn leeway into abstract, give each transformsync it's own value

This commit is contained in:
Mister_Nebula 2021-04-18 22:59:42 +01:00
parent ed39bacc95
commit f0b6c8add7
6 changed files with 10 additions and 12 deletions

View File

@ -8,6 +8,8 @@ namespace QSB.Player.TransformSync
{
public class PlayerCameraSync : SyncObjectTransformSync
{
public override float DistanceLeeway => 5f;
protected override Transform InitLocalTransform()
{
SectorSync.SetSectorDetector(Locator.GetPlayerSectorDetector());

View File

@ -9,6 +9,8 @@ namespace QSB.Player.TransformSync
{
public static PlayerTransformSync LocalInstance { get; private set; }
public override float DistanceLeeway => 5f;
static PlayerTransformSync() => AnimControllerPatch.Init();
public override void OnStartLocalPlayer()

View File

@ -9,7 +9,7 @@ namespace QSB.ProbeSync.TransformSync
{
public class PlayerProbeSync : SyncObjectTransformSync
{
private Transform _disabledSocket;
public override float DistanceLeeway => 20f;
private Transform GetProbe() =>
Locator.GetProbe().transform.Find("CameraPivot").Find("Geometry");
@ -19,7 +19,6 @@ namespace QSB.ProbeSync.TransformSync
SectorSync.SetSectorDetector(Locator.GetProbe().GetSectorDetector());
var body = GetProbe();
SetSocket(Player.CameraBody.transform);
Player.ProbeBody = body.gameObject;
return body;
@ -42,20 +41,11 @@ namespace QSB.ProbeSync.TransformSync
PlayerToolsManager.CreateProbe(body, Player);
QSBCore.UnityEvents.RunWhen(
() => Player.ProbeLauncher != null,
() => SetSocket(Player.ProbeLauncher.ToolGameObject.transform));
Player.ProbeBody = body.gameObject;
return body;
}
private void SetSocket(Transform socket)
{
DebugLog.DebugWrite($"Set DisabledSocket of id:{PlayerId}.");
_disabledSocket = socket;
}
public override bool IsReady => Locator.GetProbe() != null
&& Player != null
&& QSBPlayerManager.PlayerExists(Player.PlayerId)

View File

@ -9,6 +9,8 @@ namespace QSB.RoastingSync.TransformSync
{
internal class RoastingStickTransformSync : SyncObjectTransformSync
{
public override float DistanceLeeway => 5f;
private Transform _stickTip;
private Transform _networkStickTip => gameObject.transform.GetChild(0);
private const float SmoothTime = 0.1f;

View File

@ -6,6 +6,8 @@ namespace QSB.ShipSync.TransformSync
{
public class ShipTransformSync : SyncObjectTransformSync
{
public override float DistanceLeeway => 20f;
private Transform GetShipModel() => Locator.GetShipTransform();
protected override Transform InitLocalTransform()

View File

@ -20,7 +20,7 @@ namespace QSB.TransformSync
public SectorSync.SectorSync SectorSync { get; private set; }
private const float SmoothTime = 0.1f;
private const float DistanceLeeway = 5f;
public abstract float DistanceLeeway { get; }
private bool _isInitialized;
private Vector3 _positionSmoothVelocity;
private Quaternion _rotationSmoothVelocity;