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<QSBHearthianRecorderEffects, HearthianRecorderEffects>();
QSBWorldSync.Init<QSBTravelerEyeController, TravelerEyeController>(); 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.Clear();
QSBWorldSync.OldDialogueTrees.AddRange(QSBWorldSync.GetUnityObjects<CharacterDialogueTree>()); 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 // 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.center = new Vector3(0, 1.75f, 0.25f);
boxShape.size = new Vector3(3, 3.5f, 3); boxShape.size = new Vector3(3, 3.5f, 3);
@ -79,8 +79,13 @@ namespace QSB.ElevatorSync.WorldObjects
public override void DisplayLines() public override void DisplayLines()
{ {
var boxShape = AttachedObject.gameObject.GetComponent<BoxShape>(); var boxShape = (BoxShape)_elevatorTrigger._shape;
Popcron.Gizmos.Cube(AttachedObject.transform.position + boxShape.center, AttachedObject.transform.rotation, boxShape.size); 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.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using Object = UnityEngine.Object;
namespace QSB.QuantumSync.WorldObjects namespace QSB.QuantumSync.WorldObjects
{ {
@ -25,38 +26,31 @@ namespace QSB.QuantumSync.WorldObjects
} }
} }
public override bool ShouldDisplayLabel() => ControllingPlayer != 0;
public override void Init() public override void Init()
{ {
var debugBundle = QSBCore.DebugAssetBundle; if (QSBCore.ShowQuantumVisibilityObjects)
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)
{ {
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) if (cube == null)
{
DebugLog.DebugWrite($"SPHERE IS NULL");
}
if (capsule == null)
{
DebugLog.DebugWrite($"CAPSULE IS NULL");
}
foreach (var shape in GetAttachedShapes())
{
if (shape == 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) if (shape is BoxShape boxShape)
{ {
@ -92,20 +86,19 @@ namespace QSB.QuantumSync.WorldObjects
private void LateInit() private void LateInit()
{ {
FinishDelayedReady(); FinishDelayedReady();
foreach (var shape in GetAttachedShapes())
{
shape.OnShapeActivated += OnEnable;
shape.OnShapeDeactivated += OnDisable;
}
var attachedShapes = GetAttachedShapes(); var attachedShapes = GetAttachedShapes();
if (attachedShapes.Count == 0) if (attachedShapes.Count == 0)
{ {
IsEnabled = false; IsEnabled = false;
return; return;
} }
foreach (var shape in attachedShapes)
{
shape.OnShapeActivated += OnEnable;
shape.OnShapeDeactivated += OnDisable;
}
if (attachedShapes.All(x => x.enabled && x.gameObject.activeInHierarchy && x.active)) if (attachedShapes.All(x => x.enabled && x.gameObject.activeInHierarchy && x.active))
{ {
IsEnabled = true; IsEnabled = true;
@ -151,7 +144,7 @@ namespace QSB.QuantumSync.WorldObjects
} }
var shapes = tracker._shapes; var shapes = tracker._shapes;
totalShapes.AddRange(shapes); totalShapes.AddRange(shapes.Where(x => x != null));
} }
return totalShapes; return totalShapes;

View File

@ -4,6 +4,6 @@ namespace QSB.QuantumSync.WorldObjects
{ {
internal class QSBQuantumSocket : WorldObject<QuantumSocket> 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); 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.ShipSync.WorldObjects;
using QSB.Utility; using QSB.Utility;
using QSB.WorldSync; using QSB.WorldSync;
using System;
using UnityEngine; using UnityEngine;
namespace QSB.ShipSync.Patches namespace QSB.ShipSync.Patches
@ -60,7 +59,7 @@ namespace QSB.ShipSync.Patches
[HarmonyReversePatch] [HarmonyReversePatch]
[HarmonyPatch(typeof(SingleInteractionVolume), nameof(SingleInteractionVolume.UpdateInteractVolume))] [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] [HarmonyPrefix]
[HarmonyPatch(typeof(InteractZone), nameof(InteractZone.UpdateInteractVolume))] [HarmonyPatch(typeof(InteractZone), nameof(InteractZone.UpdateInteractVolume))]
@ -96,7 +95,7 @@ namespace QSB.ShipSync.Patches
[HarmonyReversePatch] [HarmonyReversePatch]
[HarmonyPatch(typeof(ShipComponent), nameof(ShipComponent.OnEnterShip))] [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] [HarmonyPrefix]
[HarmonyPatch(typeof(ShipElectricalComponent), nameof(ShipElectricalComponent.OnEnterShip))] [HarmonyPatch(typeof(ShipElectricalComponent), nameof(ShipElectricalComponent.OnEnterShip))]
@ -109,7 +108,7 @@ namespace QSB.ShipSync.Patches
[HarmonyReversePatch] [HarmonyReversePatch]
[HarmonyPatch(typeof(ShipComponent), nameof(ShipComponent.OnExitShip))] [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] [HarmonyPrefix]
[HarmonyPatch(typeof(ShipElectricalComponent), nameof(ShipElectricalComponent.OnExitShip))] [HarmonyPatch(typeof(ShipElectricalComponent), nameof(ShipElectricalComponent.OnExitShip))]

View File

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

View File

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

View File

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

View File

@ -14,9 +14,8 @@ namespace QSB.WorldSync
public virtual void Init() { } public virtual void Init() { }
public virtual void OnRemoval() { } public virtual void OnRemoval() { }
public MonoBehaviour ReturnObject() => AttachedObject; 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 string ReturnLabel() => LogName;
public virtual bool ShouldDisplayLines() => ShouldDisplayLabel();
public virtual void DisplayLines() { } public virtual void DisplayLines() { }
/// indicates that this won't become ready immediately /// indicates that this won't become ready immediately