mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
literally do less work and vision torch works perfectly
This commit is contained in:
parent
dd4b9ea54a
commit
9f089fe5a9
@ -231,7 +231,6 @@ namespace NewHorizons.Builder.Props
|
||||
slideCollectionContainer.slideCollection = slideCollection;
|
||||
target.slideCollection = g.AddComponent<MindSlideCollection>();
|
||||
target.slideCollection._slideCollectionContainer = slideCollectionContainer;
|
||||
target.slideCollectionContainer = slideCollectionContainer;
|
||||
|
||||
// Idk why but it wants reveals to be comma delimited not a list
|
||||
if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals);
|
||||
@ -378,7 +377,5 @@ namespace NewHorizons.Builder.Props
|
||||
public class VisionTorchTarget : MonoBehaviour
|
||||
{
|
||||
public MindSlideCollection slideCollection;
|
||||
public SlideCollectionContainer slideCollectionContainer;
|
||||
public OWEvent.OWCallback onSlidesComplete;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,80 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using NewHorizons.Builder.Props;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Patches
|
||||
{
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class MindProjectorTriggerPatches
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MindProjectorTrigger), nameof(MindProjectorTrigger.OnTriggerVolumeEntry))]
|
||||
public static bool MindProjectorTrigger_OnTriggerVolumeEntry(MindProjectorTrigger __instance, GameObject hitObj)
|
||||
{
|
||||
var t = hitObj.GetComponent<VisionTorchTarget>();
|
||||
if (t != null) //(hitObj.CompareTag("PrisonerDetector"))
|
||||
{
|
||||
__instance._mindProjector.OnProjectionComplete += t.onSlidesComplete;
|
||||
|
||||
// _slideCollectionItem is actually a reference to a SlideCollectionContainer. Not a slide reel item
|
||||
__instance._mindProjector._slideCollectionItem = t.slideCollectionContainer;
|
||||
__instance._mindProjector._mindSlideCollection = t.slideCollection;
|
||||
__instance._mindProjector.SetMindSlideCollection(t.slideCollection);
|
||||
|
||||
__instance.OnBeamStartHitPrisoner.Invoke();
|
||||
__instance._mindProjector.Play(reset: true);
|
||||
__instance._mindProjector.OnProjectionStart += new OWEvent.OWCallback(__instance.OnProjectionStart);
|
||||
__instance._mindProjector.OnProjectionComplete += new OWEvent.OWCallback(__instance.OnProjectionComplete);
|
||||
|
||||
Locator.GetPlayerTransform().GetComponent<PlayerLockOnTargeting>().LockOn(hitObj.transform, Vector3.zero);
|
||||
__instance._playerLockedOn = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
using NewHorizons.Builder.Props;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MindProjectorTrigger), nameof(MindProjectorTrigger.OnTriggerVolumeExit))]
|
||||
private static bool MindProjectorTrigger_OnTriggerVolumeExit(MindProjectorTrigger __instance, GameObject hitObj)
|
||||
namespace NewHorizons.Patches
|
||||
{
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class MindProjectorTriggerPatches
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MindProjectorTrigger), nameof(MindProjectorTrigger.OnTriggerVolumeEntry))]
|
||||
public static bool MindProjectorTrigger_OnTriggerVolumeEntry(MindProjectorTrigger __instance, GameObject hitObj)
|
||||
{
|
||||
var t = hitObj.GetComponent<VisionTorchTarget>();
|
||||
if (t != null) //(hitObj.CompareTag("PrisonerDetector"))
|
||||
var t = hitObj.GetComponent<VisionTorchTarget>();
|
||||
if (t != null) //(hitObj.CompareTag("PrisonerDetector"))
|
||||
{
|
||||
__instance._mindProjector.OnProjectionComplete -= t.onSlidesComplete;
|
||||
__instance._mindProjector.SetMindSlideCollection(t.slideCollection);
|
||||
|
||||
__instance.OnBeamStartHitPrisoner.Invoke();
|
||||
__instance._mindProjector.Play(reset: true);
|
||||
__instance._mindProjector.OnProjectionStart += __instance.OnProjectionStart;
|
||||
__instance._mindProjector.OnProjectionComplete += __instance.OnProjectionComplete;
|
||||
|
||||
Locator.GetPlayerTransform().GetComponent<PlayerLockOnTargeting>().LockOn(hitObj.transform, Vector3.zero);
|
||||
__instance._playerLockedOn = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class VisionTorchItemPatches
|
||||
{
|
||||
// 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(OWItem), nameof(OWItem.DropItem))]
|
||||
private static void base_DropItem(OWItem instance, Vector3 position, Vector3 normal, Transform parent, Sector sector, IItemDropTarget customDropTarget) { }
|
||||
|
||||
|
||||
// Make the vision torch droppable. In the base game you can only drop it if you're in the dream world.
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(VisionTorchItem), nameof(VisionTorchItem.DropItem))]
|
||||
public static bool VisionTorchItem_DropItem(VisionTorchItem __instance, Vector3 position, Vector3 normal, Transform parent, Sector sector, IItemDropTarget customDropTarget)
|
||||
{
|
||||
if (!Locator.GetDreamWorldController().IsInDream())
|
||||
{
|
||||
base_DropItem(__instance, position, normal, parent, sector, customDropTarget);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public static class VisionTorchItemPatches
|
||||
{
|
||||
// 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(OWItem), nameof(OWItem.DropItem))]
|
||||
private static void base_DropItem(OWItem instance, Vector3 position, Vector3 normal, Transform parent, Sector sector, IItemDropTarget customDropTarget) { }
|
||||
|
||||
|
||||
// Make the vision torch droppable. In the base game you can only drop it if you're in the dream world.
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(VisionTorchItem), nameof(VisionTorchItem.DropItem))]
|
||||
public static bool VisionTorchItem_DropItem(VisionTorchItem __instance, Vector3 position, Vector3 normal, Transform parent, Sector sector, IItemDropTarget customDropTarget)
|
||||
{
|
||||
if (!Locator.GetDreamWorldController().IsInDream())
|
||||
{
|
||||
base_DropItem(__instance, position, normal, parent, sector, customDropTarget);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user