mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-23 06:40:56 +00:00
stuff
This commit is contained in:
parent
54297ddb17
commit
6c9e39a6bb
@ -178,7 +178,10 @@ namespace QSB
|
|||||||
offset3 += _debugLineSpacing;
|
offset3 += _debugLineSpacing;
|
||||||
GUI.Label(new Rect(420, offset3, 200f, 20f), $"Ship sector : {(ship.ReferenceSector == null ? "NULL" : ship.ReferenceSector.Name)}");
|
GUI.Label(new Rect(420, offset3, 200f, 20f), $"Ship sector : {(ship.ReferenceSector == null ? "NULL" : ship.ReferenceSector.Name)}");
|
||||||
offset3 += _debugLineSpacing;
|
offset3 += _debugLineSpacing;
|
||||||
GUI.Label(new Rect(420, offset3, 200f, 20f), $"Ship relative velocity : {ship.AttachedObject.GetRelativeVelocity(ship.ReferenceTransform.GetAttachedOWRigidbody())}");
|
GUI.Label(new Rect(420, offset3, 400f, 20f), $"Ship relative velocity : {ship.AttachedObject.GetRelativeVelocity(ship.ReferenceTransform.GetAttachedOWRigidbody())}");
|
||||||
|
offset3 += _debugLineSpacing;
|
||||||
|
offset3 += _debugLineSpacing;
|
||||||
|
GUI.Label(new Rect(420, offset3, 400f, 20f), $"Ship velocity mag. : {ship.GetVelocityChangeMagnitude()}");
|
||||||
offset3 += _debugLineSpacing;
|
offset3 += _debugLineSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ using QSB.Syncs.RigidbodySync;
|
|||||||
using QSB.Syncs.TransformSync;
|
using QSB.Syncs.TransformSync;
|
||||||
using QSB.Utility;
|
using QSB.Utility;
|
||||||
using QSB.WorldSync;
|
using QSB.WorldSync;
|
||||||
|
using QuantumUNET;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -20,29 +21,17 @@ namespace QSB.SectorSync
|
|||||||
private void OnEnable() => RepeatingManager.Repeatings.Add(this);
|
private void OnEnable() => RepeatingManager.Repeatings.Add(this);
|
||||||
private void OnDisable() => RepeatingManager.Repeatings.Remove(this);
|
private void OnDisable() => RepeatingManager.Repeatings.Remove(this);
|
||||||
|
|
||||||
|
public List<ISectoredSync<Component>> SectoredSyncs = new List<ISectoredSync<Component>>();
|
||||||
|
|
||||||
public void Invoke()
|
public void Invoke()
|
||||||
{
|
{
|
||||||
foreach (var sync in SectoredTransformSync.SectoredNetworkTransformList)
|
foreach (var sync in SectoredSyncs)
|
||||||
{
|
{
|
||||||
if (sync.AttachedObject == null)
|
if (sync.AttachedObject == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (sync.HasAuthority
|
if ((sync as QNetworkBehaviour).HasAuthority
|
||||||
&& sync.AttachedObject.gameObject.activeInHierarchy
|
|
||||||
&& sync.IsReady)
|
|
||||||
{
|
|
||||||
CheckTransformSyncSector(sync);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var sync in SectoredRigidbodySync.SectoredNetworkTransformList)
|
|
||||||
{
|
|
||||||
if (sync.AttachedObject == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (sync.HasAuthority
|
|
||||||
&& sync.AttachedObject.gameObject.activeInHierarchy
|
&& sync.AttachedObject.gameObject.activeInHierarchy
|
||||||
&& sync.IsReady)
|
&& sync.IsReady)
|
||||||
{
|
{
|
||||||
|
@ -57,6 +57,7 @@ namespace QSB.ShipSync.Events
|
|||||||
? id
|
? id
|
||||||
: uint.MaxValue;
|
: uint.MaxValue;
|
||||||
|
|
||||||
|
/*
|
||||||
if (id == uint.MaxValue)
|
if (id == uint.MaxValue)
|
||||||
{
|
{
|
||||||
DebugLog.DebugWrite($"ShipDetector setactive {QSBCore.IsServer}");
|
DebugLog.DebugWrite($"ShipDetector setactive {QSBCore.IsServer}");
|
||||||
@ -72,6 +73,7 @@ namespace QSB.ShipSync.Events
|
|||||||
DebugLog.DebugWrite($"Disable ship detector");
|
DebugLog.DebugWrite($"Disable ship detector");
|
||||||
Locator.GetShipDetector().SetActive(false);
|
Locator.GetShipDetector().SetActive(false);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (QSBCore.IsServer)
|
if (QSBCore.IsServer)
|
||||||
{
|
{
|
||||||
|
@ -10,20 +10,19 @@ namespace QSB.Syncs.RigidbodySync
|
|||||||
{
|
{
|
||||||
public QSBSector ReferenceSector { get; set; }
|
public QSBSector ReferenceSector { get; set; }
|
||||||
public SectorSync.SectorSync SectorSync { get; private set; }
|
public SectorSync.SectorSync SectorSync { get; private set; }
|
||||||
public static List<SectoredRigidbodySync> SectoredNetworkTransformList = new List<SectoredRigidbodySync>();
|
|
||||||
public abstract TargetType Type { get; }
|
public abstract TargetType Type { get; }
|
||||||
|
|
||||||
public override void Start()
|
public override void Start()
|
||||||
{
|
{
|
||||||
SectorSync = gameObject.AddComponent<SectorSync.SectorSync>();
|
SectorSync = gameObject.AddComponent<SectorSync.SectorSync>();
|
||||||
SectoredNetworkTransformList.Add(this);
|
QSBSectorManager.Instance.SectoredSyncs.Add((ISectoredSync<UnityEngine.Component>)this);
|
||||||
base.Start();
|
base.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDestroy()
|
protected override void OnDestroy()
|
||||||
{
|
{
|
||||||
base.OnDestroy();
|
base.OnDestroy();
|
||||||
SectoredNetworkTransformList.Remove(this);
|
QSBSectorManager.Instance.SectoredSyncs.Remove((ISectoredSync<UnityEngine.Component>)this);
|
||||||
if (SectorSync != null)
|
if (SectorSync != null)
|
||||||
{
|
{
|
||||||
Destroy(SectorSync);
|
Destroy(SectorSync);
|
||||||
|
@ -177,8 +177,8 @@ namespace QSB.Syncs.RigidbodySync
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedObject.SetPosition(targetPos);
|
AttachedObject.transform.position = targetPos;
|
||||||
AttachedObject.SetRotation(targetRot);
|
AttachedObject.transform.rotation = targetRot;
|
||||||
AttachedObject.SetVelocity(ReferenceTransform.GetAttachedOWRigidbody().GetVelocity() + _velocity);
|
AttachedObject.SetVelocity(ReferenceTransform.GetAttachedOWRigidbody().GetVelocity() + _velocity);
|
||||||
AttachedObject.SetAngularVelocity(ReferenceTransform.GetAttachedOWRigidbody().GetAngularVelocity() + _angularVelocity);
|
AttachedObject.SetAngularVelocity(ReferenceTransform.GetAttachedOWRigidbody().GetAngularVelocity() + _angularVelocity);
|
||||||
}
|
}
|
||||||
@ -220,6 +220,9 @@ namespace QSB.Syncs.RigidbodySync
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float GetVelocityChangeMagnitude()
|
||||||
|
=> (_velocity - _prevVelocity).magnitude;
|
||||||
|
|
||||||
private void OnRenderObject()
|
private void OnRenderObject()
|
||||||
{
|
{
|
||||||
if (!QSBCore.WorldObjectsReady || !QSBCore.DebugMode || !QSBCore.ShowLinesInDebug || !IsReady)
|
if (!QSBCore.WorldObjectsReady || !QSBCore.DebugMode || !QSBCore.ShowLinesInDebug || !IsReady)
|
||||||
|
@ -11,20 +11,19 @@ namespace QSB.Syncs.TransformSync
|
|||||||
{
|
{
|
||||||
public QSBSector ReferenceSector { get; set; }
|
public QSBSector ReferenceSector { get; set; }
|
||||||
public SectorSync.SectorSync SectorSync { get; private set; }
|
public SectorSync.SectorSync SectorSync { get; private set; }
|
||||||
public static List<SectoredTransformSync> SectoredNetworkTransformList = new List<SectoredTransformSync>();
|
|
||||||
public abstract TargetType Type { get; }
|
public abstract TargetType Type { get; }
|
||||||
|
|
||||||
public override void Start()
|
public override void Start()
|
||||||
{
|
{
|
||||||
SectorSync = gameObject.AddComponent<SectorSync.SectorSync>();
|
SectorSync = gameObject.AddComponent<SectorSync.SectorSync>();
|
||||||
SectoredNetworkTransformList.Add(this);
|
QSBSectorManager.Instance.SectoredSyncs.Add((ISectoredSync<UnityEngine.Component>)this);
|
||||||
base.Start();
|
base.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDestroy()
|
protected override void OnDestroy()
|
||||||
{
|
{
|
||||||
base.OnDestroy();
|
base.OnDestroy();
|
||||||
SectoredNetworkTransformList.Remove(this);
|
QSBSectorManager.Instance.SectoredSyncs.Remove((ISectoredSync<UnityEngine.Component>)this);
|
||||||
if (SectorSync != null)
|
if (SectorSync != null)
|
||||||
{
|
{
|
||||||
Destroy(SectorSync);
|
Destroy(SectorSync);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user