mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
fixed quantum socketed objects
This commit is contained in:
parent
73c0a5d4f5
commit
551dc650fb
@ -16,6 +16,8 @@ using Logger = NewHorizons.Utility.Logger;
|
|||||||
// 1) MultiStateQuantumObjects don't check to see if the new state would be visible before choosing it
|
// 1) MultiStateQuantumObjects don't check to see if the new state would be visible before choosing it
|
||||||
// 2) QuantumShuffleObjects don't respect rotation, they set rotation to 0 on collapse
|
// 2) QuantumShuffleObjects don't respect rotation, they set rotation to 0 on collapse
|
||||||
|
|
||||||
|
// New features to support
|
||||||
|
// 1) multiState._prerequisiteObjects
|
||||||
|
|
||||||
namespace NewHorizons.Builder.Props
|
namespace NewHorizons.Builder.Props
|
||||||
{
|
{
|
||||||
@ -72,11 +74,8 @@ namespace NewHorizons.Builder.Props
|
|||||||
quantumObject._prebuilt = true;
|
quantumObject._prebuilt = true;
|
||||||
quantumObject._childSockets = new List<QuantumSocket>();
|
quantumObject._childSockets = new List<QuantumSocket>();
|
||||||
// TODO: support _alignWithGravity?
|
// TODO: support _alignWithGravity?
|
||||||
|
if (prop.GetComponentInChildren<VisibilityTracker>() == null) AddBoundsVisibility(prop);
|
||||||
prop.SetActive(true);
|
prop.SetActive(true);
|
||||||
|
|
||||||
if (prop.GetComponentInChildren<ShapeVisibilityTracker>() != null) continue;
|
|
||||||
|
|
||||||
AddBoundsVisibility(prop);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,11 +13,45 @@ namespace NewHorizons.Patches
|
|||||||
[HarmonyPatch]
|
[HarmonyPatch]
|
||||||
public static class TemporaryDebugOnlyPatchesDeleteBeforePR
|
public static class TemporaryDebugOnlyPatchesDeleteBeforePR
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(QuantumObject), nameof(QuantumObject.Collapse))]
|
||||||
|
public static bool QuantumObject_Collapse(QuantumObject __instance, ref bool __result, bool skipInstantVisibilityCheck = false)
|
||||||
|
{
|
||||||
|
Logger.Log("trying to collapse");
|
||||||
|
Logger.Log(__instance.gameObject.activeInHierarchy+"");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// This is some dark magic
|
||||||
|
// this creates a method called base_DropItem that basically just calls OWItem.PickUpItem whenever it (VisionTorchItemPatches.base_PickUpItem) is called
|
||||||
|
[HarmonyReversePatch]
|
||||||
|
[HarmonyPatch(typeof(VisibilityObject), nameof(VisibilityObject.Update))]
|
||||||
|
private static void base_Update(VisibilityObject __instance) { }
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(QuantumObject), nameof(QuantumObject.Update))]
|
||||||
|
public static bool QuantumObject_Update(QuantumObject __instance)
|
||||||
|
{
|
||||||
|
base_Update(__instance);
|
||||||
|
bool flag = __instance.IsLocked();
|
||||||
|
if (__instance._wasLocked && !flag) Logger.Log("locked falling edge");
|
||||||
|
if (__instance._wasLocked && !flag && !__instance.Collapse() && !__instance._ignoreRetryQueue)
|
||||||
|
{
|
||||||
|
ShapeManager.AddToRetryQueue(__instance);
|
||||||
|
}
|
||||||
|
__instance._wasLocked = flag;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(SocketedQuantumObject), nameof(SocketedQuantumObject.ChangeQuantumState))]
|
[HarmonyPatch(typeof(SocketedQuantumObject), nameof(SocketedQuantumObject.ChangeQuantumState))]
|
||||||
public static bool SocketedQuantumObject_ChangeQuantumState(SocketedQuantumObject __instance, ref bool __result, bool skipInstantVisibilityCheck)
|
public static bool SocketedQuantumObject_ChangeQuantumState(SocketedQuantumObject __instance, ref bool __result, bool skipInstantVisibilityCheck)
|
||||||
{
|
{
|
||||||
|
Logger.Log("attempting change state");
|
||||||
for (int i = 0; i < __instance._childSockets.Count; i++)
|
for (int i = 0; i < __instance._childSockets.Count; i++)
|
||||||
{
|
{
|
||||||
if (__instance._childSockets[i].IsOccupied())
|
if (__instance._childSockets[i].IsOccupied())
|
||||||
@ -28,6 +62,7 @@ namespace NewHorizons.Patches
|
|||||||
}
|
}
|
||||||
if (__instance._socketList.Count <= 1)
|
if (__instance._socketList.Count <= 1)
|
||||||
{
|
{
|
||||||
|
Logger.Log("not enough sockets");
|
||||||
Debug.LogError("Not enough quantum sockets in list!", __instance);
|
Debug.LogError("Not enough quantum sockets in list!", __instance);
|
||||||
Debug.Break();
|
Debug.Break();
|
||||||
__result = false;
|
__result = false;
|
||||||
|
|||||||
@ -19,7 +19,7 @@ namespace NewHorizons.Utility
|
|||||||
|
|
||||||
void OnRenderObject()
|
void OnRenderObject()
|
||||||
{
|
{
|
||||||
Popcron.Gizmos.Cube(transform.TransformPoint(box.center), transform.rotation, box.size);
|
Popcron.Gizmos.Cube(transform.TransformPoint(box.center), transform.rotation, Vector3.Scale(box.size, transform.lossyScale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user