Merge branch 'orb-tracking' into conversation-system

This commit is contained in:
Mister_Nebula 2020-09-22 21:11:33 +01:00
commit 834992807e
4 changed files with 6 additions and 25 deletions

View File

@ -23,7 +23,7 @@ namespace QSB.OrbSync
return false;
}
var orbDistance = Vector3.Distance(orb.transform.position, __instance.transform.position);
var triggerRadius = !orb.IsBeingDragged() ? ____radius : ____exitRadius;
var triggerRadius = orb.IsBeingDragged() ? ____exitRadius : ____radius;
if (____occupyingOrb == null && orbDistance < ____radius)
{
____occupyingOrb = orb;
@ -35,7 +35,7 @@ namespace QSB.OrbSync
__result = true;
return false;
}
if (!(____occupyingOrb != null) || !(____occupyingOrb == orb))
if (____occupyingOrb == null || ____occupyingOrb != orb)
{
__result = false;
return false;

View File

@ -6,11 +6,6 @@ namespace QSB.OrbSync
public class OrbSlotManager : MonoBehaviour
{
private void Awake()
{
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(OWScene scene, bool isInUniverse)
{
QSB.Helper.Events.Unity.RunWhen(() => QSB.HasWokenUp, InitSlots);
}
@ -22,7 +17,6 @@ namespace QSB.OrbSync
{
var qsbOrbSlot = WorldRegistry.GetObject<QSBOrbSlot>(id) ?? new QSBOrbSlot();
qsbOrbSlot.Init(orbSlots[id], id);
WorldRegistry.AddObject(qsbOrbSlot);
}
}
}

View File

@ -14,6 +14,7 @@ namespace QSB.OrbSync
ObjectId = id;
InterfaceSlot = slot;
_initialized = true;
WorldRegistry.AddObject(this);
}
public void HandleEvent(bool state)

View File

@ -14,14 +14,6 @@ namespace QSB.Utility
.GetMethods(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
.Last(x => x.Name == "WriteLine");
var callingType = GetCallingType(new StackTrace());
if (callingType == "DebugLog")
{
callingType = GetCallingType(new StackTrace(), 2);
}
if (callingType == "DebugLog")
{
callingType = GetCallingType(new StackTrace(), 3);
}
method.Invoke(console, new object[] { type, message, callingType });
}
@ -56,16 +48,10 @@ namespace QSB.Utility
DebugWrite($"* {name} {status}", messageType);
}
private static string GetCallingType(StackTrace frame, int index = 1)
private static string GetCallingType(StackTrace frame)
{
try
{
return frame.GetFrame(index).GetMethod().DeclaringType.Name;
}
catch
{
return "";
}
var stackFrame = frame.GetFrames().First(x => x.GetMethod().DeclaringType.Name != "DebugLog");
return stackFrame.GetMethod().DeclaringType.Name;
}
}
}