mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-26 09:35:26 +00:00
turn leeway into abstract, give each transformsync it's own value
This commit is contained in:
parent
ed39bacc95
commit
f0b6c8add7
@ -8,6 +8,8 @@ namespace QSB.Player.TransformSync
|
|||||||
{
|
{
|
||||||
public class PlayerCameraSync : SyncObjectTransformSync
|
public class PlayerCameraSync : SyncObjectTransformSync
|
||||||
{
|
{
|
||||||
|
public override float DistanceLeeway => 5f;
|
||||||
|
|
||||||
protected override Transform InitLocalTransform()
|
protected override Transform InitLocalTransform()
|
||||||
{
|
{
|
||||||
SectorSync.SetSectorDetector(Locator.GetPlayerSectorDetector());
|
SectorSync.SetSectorDetector(Locator.GetPlayerSectorDetector());
|
||||||
|
@ -9,6 +9,8 @@ namespace QSB.Player.TransformSync
|
|||||||
{
|
{
|
||||||
public static PlayerTransformSync LocalInstance { get; private set; }
|
public static PlayerTransformSync LocalInstance { get; private set; }
|
||||||
|
|
||||||
|
public override float DistanceLeeway => 5f;
|
||||||
|
|
||||||
static PlayerTransformSync() => AnimControllerPatch.Init();
|
static PlayerTransformSync() => AnimControllerPatch.Init();
|
||||||
|
|
||||||
public override void OnStartLocalPlayer()
|
public override void OnStartLocalPlayer()
|
||||||
|
@ -9,7 +9,7 @@ namespace QSB.ProbeSync.TransformSync
|
|||||||
{
|
{
|
||||||
public class PlayerProbeSync : SyncObjectTransformSync
|
public class PlayerProbeSync : SyncObjectTransformSync
|
||||||
{
|
{
|
||||||
private Transform _disabledSocket;
|
public override float DistanceLeeway => 20f;
|
||||||
|
|
||||||
private Transform GetProbe() =>
|
private Transform GetProbe() =>
|
||||||
Locator.GetProbe().transform.Find("CameraPivot").Find("Geometry");
|
Locator.GetProbe().transform.Find("CameraPivot").Find("Geometry");
|
||||||
@ -19,7 +19,6 @@ namespace QSB.ProbeSync.TransformSync
|
|||||||
SectorSync.SetSectorDetector(Locator.GetProbe().GetSectorDetector());
|
SectorSync.SetSectorDetector(Locator.GetProbe().GetSectorDetector());
|
||||||
var body = GetProbe();
|
var body = GetProbe();
|
||||||
|
|
||||||
SetSocket(Player.CameraBody.transform);
|
|
||||||
Player.ProbeBody = body.gameObject;
|
Player.ProbeBody = body.gameObject;
|
||||||
|
|
||||||
return body;
|
return body;
|
||||||
@ -42,20 +41,11 @@ namespace QSB.ProbeSync.TransformSync
|
|||||||
|
|
||||||
PlayerToolsManager.CreateProbe(body, Player);
|
PlayerToolsManager.CreateProbe(body, Player);
|
||||||
|
|
||||||
QSBCore.UnityEvents.RunWhen(
|
|
||||||
() => Player.ProbeLauncher != null,
|
|
||||||
() => SetSocket(Player.ProbeLauncher.ToolGameObject.transform));
|
|
||||||
Player.ProbeBody = body.gameObject;
|
Player.ProbeBody = body.gameObject;
|
||||||
|
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetSocket(Transform socket)
|
|
||||||
{
|
|
||||||
DebugLog.DebugWrite($"Set DisabledSocket of id:{PlayerId}.");
|
|
||||||
_disabledSocket = socket;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool IsReady => Locator.GetProbe() != null
|
public override bool IsReady => Locator.GetProbe() != null
|
||||||
&& Player != null
|
&& Player != null
|
||||||
&& QSBPlayerManager.PlayerExists(Player.PlayerId)
|
&& QSBPlayerManager.PlayerExists(Player.PlayerId)
|
||||||
|
@ -9,6 +9,8 @@ namespace QSB.RoastingSync.TransformSync
|
|||||||
{
|
{
|
||||||
internal class RoastingStickTransformSync : SyncObjectTransformSync
|
internal class RoastingStickTransformSync : SyncObjectTransformSync
|
||||||
{
|
{
|
||||||
|
public override float DistanceLeeway => 5f;
|
||||||
|
|
||||||
private Transform _stickTip;
|
private Transform _stickTip;
|
||||||
private Transform _networkStickTip => gameObject.transform.GetChild(0);
|
private Transform _networkStickTip => gameObject.transform.GetChild(0);
|
||||||
private const float SmoothTime = 0.1f;
|
private const float SmoothTime = 0.1f;
|
||||||
|
@ -6,6 +6,8 @@ namespace QSB.ShipSync.TransformSync
|
|||||||
{
|
{
|
||||||
public class ShipTransformSync : SyncObjectTransformSync
|
public class ShipTransformSync : SyncObjectTransformSync
|
||||||
{
|
{
|
||||||
|
public override float DistanceLeeway => 20f;
|
||||||
|
|
||||||
private Transform GetShipModel() => Locator.GetShipTransform();
|
private Transform GetShipModel() => Locator.GetShipTransform();
|
||||||
|
|
||||||
protected override Transform InitLocalTransform()
|
protected override Transform InitLocalTransform()
|
||||||
|
@ -20,7 +20,7 @@ namespace QSB.TransformSync
|
|||||||
public SectorSync.SectorSync SectorSync { get; private set; }
|
public SectorSync.SectorSync SectorSync { get; private set; }
|
||||||
|
|
||||||
private const float SmoothTime = 0.1f;
|
private const float SmoothTime = 0.1f;
|
||||||
private const float DistanceLeeway = 5f;
|
public abstract float DistanceLeeway { get; }
|
||||||
private bool _isInitialized;
|
private bool _isInitialized;
|
||||||
private Vector3 _positionSmoothVelocity;
|
private Vector3 _positionSmoothVelocity;
|
||||||
private Quaternion _rotationSmoothVelocity;
|
private Quaternion _rotationSmoothVelocity;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user