Merge branch 'solanum-mask-sync' of https://github.com/misternebula/quantum-space-buddies into solanum-mask-sync

This commit is contained in:
Mister_Nebula 2022-01-07 17:30:04 +00:00
commit 086a129bad
10 changed files with 45 additions and 54 deletions

View File

@ -17,7 +17,7 @@ namespace QSB.Animation.NPC
QSBWorldSync.Init<QSBHearthianRecorderEffects, HearthianRecorderEffects>();
QSBWorldSync.Init<QSBTravelerEyeController, TravelerEyeController>();
//MOVE : this is the wrong place to put this... move it to Conversations?
// TODO MOVE : this is the wrong place to put this... move it to Conversations?
QSBWorldSync.OldDialogueTrees.Clear();
QSBWorldSync.OldDialogueTrees.AddRange(QSBWorldSync.GetUnityObjects<CharacterDialogueTree>());
}

View File

@ -30,7 +30,7 @@ namespace QSB.ElevatorSync.WorldObjects
// BUG : This won't work for the log lift! need to make a different trigger for that
var boxShape = AttachedObject.gameObject.AddComponent<BoxShape>();
var boxShape = AttachedObject.gameObject.GetAddComponent<BoxShape>();
boxShape.center = new Vector3(0, 1.75f, 0.25f);
boxShape.size = new Vector3(3, 3.5f, 3);
@ -79,8 +79,13 @@ namespace QSB.ElevatorSync.WorldObjects
public override void DisplayLines()
{
var boxShape = AttachedObject.gameObject.GetComponent<BoxShape>();
Popcron.Gizmos.Cube(AttachedObject.transform.position + boxShape.center, AttachedObject.transform.rotation, boxShape.size);
var boxShape = (BoxShape)_elevatorTrigger._shape;
Popcron.Gizmos.Cube(
ShapeUtil.Box.CalcWorldSpaceCenter(boxShape),
boxShape.transform.rotation,
ShapeUtil.Box.CalcWorldSpaceSize(boxShape),
_elevatorTrigger.IsTrackingObject(Locator.GetPlayerDetector()) ? Color.green : Color.white
);
}
}
}

View File

@ -7,6 +7,7 @@ using QSB.WorldSync;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Object = UnityEngine.Object;
namespace QSB.QuantumSync.WorldObjects
{
@ -25,38 +26,31 @@ namespace QSB.QuantumSync.WorldObjects
}
}
public override bool ShouldDisplayLabel() => ControllingPlayer != 0;
public override void Init()
{
var debugBundle = QSBCore.DebugAssetBundle;
var sphere = debugBundle.LoadAsset<GameObject>("Assets/Prefabs/Sphere.prefab");
var cube = debugBundle.LoadAsset<GameObject>("Assets/Prefabs/Cube.prefab");
var capsule = debugBundle.LoadAsset<GameObject>("Assets/Prefabs/Capsule.prefab");
if (cube == null)
if (QSBCore.ShowQuantumVisibilityObjects)
{
DebugLog.DebugWrite($"CUBE IS NULL");
}
var debugBundle = QSBCore.DebugAssetBundle;
var sphere = debugBundle.LoadAsset<GameObject>("Assets/Prefabs/Sphere.prefab");
var cube = debugBundle.LoadAsset<GameObject>("Assets/Prefabs/Cube.prefab");
var capsule = debugBundle.LoadAsset<GameObject>("Assets/Prefabs/Capsule.prefab");
if (sphere == null)
{
DebugLog.DebugWrite($"SPHERE IS NULL");
}
if (capsule == null)
{
DebugLog.DebugWrite($"CAPSULE IS NULL");
}
foreach (var shape in GetAttachedShapes())
{
if (shape == null)
if (cube == null)
{
break;
DebugLog.DebugWrite($"CUBE IS NULL");
}
if (QSBCore.ShowQuantumVisibilityObjects)
if (sphere == null)
{
DebugLog.DebugWrite($"SPHERE IS NULL");
}
if (capsule == null)
{
DebugLog.DebugWrite($"CAPSULE IS NULL");
}
foreach (var shape in GetAttachedShapes())
{
if (shape is BoxShape boxShape)
{
@ -92,20 +86,19 @@ namespace QSB.QuantumSync.WorldObjects
private void LateInit()
{
FinishDelayedReady();
foreach (var shape in GetAttachedShapes())
{
shape.OnShapeActivated += OnEnable;
shape.OnShapeDeactivated += OnDisable;
}
var attachedShapes = GetAttachedShapes();
if (attachedShapes.Count == 0)
{
IsEnabled = false;
return;
}
foreach (var shape in attachedShapes)
{
shape.OnShapeActivated += OnEnable;
shape.OnShapeDeactivated += OnDisable;
}
if (attachedShapes.All(x => x.enabled && x.gameObject.activeInHierarchy && x.active))
{
IsEnabled = true;
@ -151,7 +144,7 @@ namespace QSB.QuantumSync.WorldObjects
}
var shapes = tracker._shapes;
totalShapes.AddRange(shapes);
totalShapes.AddRange(shapes.Where(x => x != null));
}
return totalShapes;

View File

@ -4,6 +4,6 @@ namespace QSB.QuantumSync.WorldObjects
{
internal class QSBQuantumSocket : WorldObject<QuantumSocket>
{
public override bool ShouldDisplayLabel() => false;
public override bool ShouldDisplayDebug() => false;
}
}

View File

@ -12,6 +12,6 @@ namespace QSB.QuantumSync.WorldObjects
AttachedObject.SetVisible(visible);
}
public override bool ShouldDisplayLabel() => false;
public override bool ShouldDisplayDebug() => false;
}
}

View File

@ -8,7 +8,6 @@ using QSB.ShipSync.TransformSync;
using QSB.ShipSync.WorldObjects;
using QSB.Utility;
using QSB.WorldSync;
using System;
using UnityEngine;
namespace QSB.ShipSync.Patches
@ -60,7 +59,7 @@ namespace QSB.ShipSync.Patches
[HarmonyReversePatch]
[HarmonyPatch(typeof(SingleInteractionVolume), nameof(SingleInteractionVolume.UpdateInteractVolume))]
public static void SingleInteractionVolume_UpdateInteractVolume_Stub(object instance) => throw new NotImplementedException();
public static void SingleInteractionVolume_UpdateInteractVolume_Stub(object instance) { }
[HarmonyPrefix]
[HarmonyPatch(typeof(InteractZone), nameof(InteractZone.UpdateInteractVolume))]
@ -96,7 +95,7 @@ namespace QSB.ShipSync.Patches
[HarmonyReversePatch]
[HarmonyPatch(typeof(ShipComponent), nameof(ShipComponent.OnEnterShip))]
public static void ShipComponent_OnEnterShip_Stub(object instance) => throw new NotImplementedException();
public static void ShipComponent_OnEnterShip_Stub(object instance) { }
[HarmonyPrefix]
[HarmonyPatch(typeof(ShipElectricalComponent), nameof(ShipElectricalComponent.OnEnterShip))]
@ -109,7 +108,7 @@ namespace QSB.ShipSync.Patches
[HarmonyReversePatch]
[HarmonyPatch(typeof(ShipComponent), nameof(ShipComponent.OnExitShip))]
public static void ShipComponent_OnExitShip_Stub(object instance) => throw new NotImplementedException();
public static void ShipComponent_OnExitShip_Stub(object instance) { }
[HarmonyPrefix]
[HarmonyPatch(typeof(ShipElectricalComponent), nameof(ShipElectricalComponent.OnExitShip))]

View File

@ -263,10 +263,7 @@ namespace QSB.Utility
DrawWorldObjectLabels();
}
public void OnRenderObject()
{
DrawWorldObjectLines();
}
public void OnRenderObject() => DrawWorldObjectLines();
private static void DrawWorldObjectLabels()
{
@ -282,7 +279,7 @@ namespace QSB.Utility
return;
}
if (obj.ShouldDisplayLabel())
if (obj.ShouldDisplayDebug())
{
DrawLabel(obj.ReturnObject().transform, obj.ReturnLabel());
}
@ -303,7 +300,7 @@ namespace QSB.Utility
return;
}
if (obj.ShouldDisplayLines())
if (obj.ShouldDisplayDebug())
{
obj.DisplayLines();
}

View File

@ -1,5 +1,4 @@
using OWML.Common;
using QSB.Player;
using QSB.Player.TransformSync;
using QuantumUNET;
using System;

View File

@ -9,9 +9,8 @@ namespace QSB.WorldSync
void OnRemoval();
MonoBehaviour ReturnObject();
bool ShouldDisplayLabel();
bool ShouldDisplayDebug();
string ReturnLabel();
bool ShouldDisplayLines();
void DisplayLines();
}
}

View File

@ -14,9 +14,8 @@ namespace QSB.WorldSync
public virtual void Init() { }
public virtual void OnRemoval() { }
public MonoBehaviour ReturnObject() => AttachedObject;
public virtual bool ShouldDisplayLabel() => (bool)(AttachedObject?.gameObject.activeInHierarchy);
public virtual bool ShouldDisplayDebug() => AttachedObject != null && AttachedObject.gameObject.activeInHierarchy;
public virtual string ReturnLabel() => LogName;
public virtual bool ShouldDisplayLines() => ShouldDisplayLabel();
public virtual void DisplayLines() { }
/// indicates that this won't become ready immediately