more fixes goddamn

This commit is contained in:
Mister_Nebula 2021-10-25 10:42:25 +01:00
parent bccc4e1873
commit 7dd7967834
5 changed files with 86 additions and 11 deletions

View File

@ -34,6 +34,7 @@ namespace QSB.OrbSync
{
var newOrb = Instantiate(QSBNetworkManager.Instance.OrbPrefab);
newOrb.SpawnWithServerAuthority();
_orbs.Add(newOrb);
}
}

View File

@ -1,4 +1,5 @@
using QSB.Animation.Player;
using OWML.Common;
using QSB.Animation.Player;
using QSB.Animation.Player.Thrusters;
using QSB.CampfireSync.WorldObjects;
using QSB.ClientServerStateSync;
@ -23,9 +24,49 @@ namespace QSB.Player
public PlayerTransformSync TransformSync { get; set; }
// Body Objects
public OWCamera Camera { get; set; }
public OWCamera Camera
{
get
{
if (_camera == null && PlayerStates.IsReady)
{
DebugLog.ToConsole($"Warning - {PlayerId}.Camera is null!", MessageType.Warning);
}
return _camera;
}
set
{
if (value == null)
{
DebugLog.ToConsole($"Warning - Setting {PlayerId}.Camera to null.", MessageType.Warning);
}
_camera = value;
}
}
private OWCamera _camera;
public GameObject CameraBody { get; set; }
public GameObject Body { get; set; }
public GameObject Body
{
get
{
if (_body == null && PlayerStates.IsReady)
{
DebugLog.ToConsole($"Warning - {PlayerId}.Body is null!", MessageType.Warning);
}
return _body;
}
set
{
if (value == null)
{
DebugLog.ToConsole($"Warning - Setting {PlayerId}.Body to null.", MessageType.Warning);
}
_body = value;
}
}
private GameObject _body;
public GameObject RoastingStick { get; set; }
public bool Visible { get; set; } = true;
@ -79,7 +120,7 @@ namespace QSB.Player
{
if (QSBPlayerManager.LocalPlayer != this)
{
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalProbeLauncher in PlayerInfo for non local player!", OWML.Common.MessageType.Warning);
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalProbeLauncher in PlayerInfo for non local player!", MessageType.Warning);
return null;
}
@ -93,7 +134,7 @@ namespace QSB.Player
{
if (QSBPlayerManager.LocalPlayer != this)
{
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalFlashlight in PlayerInfo for non local player!", OWML.Common.MessageType.Warning);
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalFlashlight in PlayerInfo for non local player!", MessageType.Warning);
return null;
}
@ -107,7 +148,7 @@ namespace QSB.Player
{
if (QSBPlayerManager.LocalPlayer != this)
{
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalSignalscope in PlayerInfo for non local player!", OWML.Common.MessageType.Warning);
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalSignalscope in PlayerInfo for non local player!", MessageType.Warning);
return null;
}
@ -121,7 +162,7 @@ namespace QSB.Player
{
if (QSBPlayerManager.LocalPlayer != this)
{
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalTranslator in PlayerInfo for non local player!", OWML.Common.MessageType.Warning);
DebugLog.ToConsole($"Warning - Tried to access local-only property LocalTranslator in PlayerInfo for non local player!", MessageType.Warning);
return null;
}

View File

@ -2,6 +2,7 @@
using OWML.Utils;
using QSB.Utility;
using QSB.WorldSync;
using System;
using System.Linq;
using UnityEngine;
@ -10,7 +11,19 @@ namespace QSB.SectorSync.WorldObjects
public class QSBSector : WorldObject<Sector>
{
public Sector.Name Type => AttachedObject.GetName();
public Transform Transform => AttachedObject.transform;
public Transform Transform
{
get
{
if (AttachedObject == null)
{
DebugLog.ToConsole($"Error - Tried to get Transform from QSBSector {ObjectId} with null AttachedObject!\r\n{Environment.StackTrace}", MessageType.Error);
return null;
}
return AttachedObject.transform;
}
}
public Vector3 Position => Transform.position;
public bool IsFakeSector => AttachedObject.GetType() == typeof(FakeSector);

View File

@ -34,6 +34,12 @@ namespace QSB.Syncs.Sectored
}
}
protected override void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool isInUniverse)
{
base.OnSceneLoaded(oldScene, newScene, isInUniverse);
SetReferenceSector(null);
}
protected override void Init()
{
base.Init();

View File

@ -1,4 +1,5 @@
using QSB.ClientServerStateSync;
using OWML.Utils;
using QSB.ClientServerStateSync;
using QSB.OrbSync.TransformSync;
using QSB.Player;
using QSB.ProbeSync.TransformSync;
@ -82,12 +83,24 @@ namespace QSB.Utility
if (player.PlayerStates.IsReady && QSBCore.WorldObjectsReady)
{
var networkTransform = player.TransformSync;
var sector = networkTransform.ReferenceSector;
var referenceSector = networkTransform.ReferenceSector;
var referenceTransform = networkTransform.ReferenceTransform;
var parent = networkTransform.AttachedObject?.transform.parent;
var intermediary = networkTransform.GetValue<IntermediaryTransform>("_intermediaryTransform");
var interTransform = intermediary.GetReferenceTransform();
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - L.Pos : {networkTransform.transform.localPosition}", guiStyle);
offset2 += _debugLineSpacing;
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Sector : {(sector == null ? "NULL" : sector.Name)}", guiStyle);
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Ref. Sector : {(referenceSector == null ? "NULL" : referenceSector.Name)}", guiStyle);
offset2 += _debugLineSpacing;
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Ref. Transform : {(referenceTransform == null ? "NULL" : referenceTransform.name)}", guiStyle);
offset2 += _debugLineSpacing;
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Inter. Ref. Transform : {(interTransform == null ? "NULL" : interTransform.name)}", guiStyle);
offset2 += _debugLineSpacing;
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Parent : {(parent == null ? "NULL" : parent.name)}", guiStyle);
offset2 += _debugLineSpacing;
/*
var probeSync = SyncBase.GetPlayers<PlayerProbeSync>(player);
if (probeSync != default)
{
@ -95,6 +108,7 @@ namespace QSB.Utility
GUI.Label(new Rect(420, offset2, 400f, 20f), $" - Probe Sector : {(probeSector == null ? "NULL" : probeSector.Name)}", guiStyle);
offset2 += _debugLineSpacing;
}
*/
}
}
}