fix: fixed some missing references and a MonoBehavior that was incorrectly initialized as a regular class. also added some stuff from VisionTorchItem.Start that won't get called for custom slides since some references aren't set up at that point

This commit is contained in:
FreezeDriedMangoes 2022-05-23 12:57:37 -04:00
parent 22a386e50a
commit 72a87c5c2e
2 changed files with 15 additions and 4 deletions

View File

@ -162,6 +162,13 @@ namespace NewHorizons.Builder.Props
var path = "DreamWorld_Body/Sector_DreamWorld/Sector_Underground/Sector_PrisonCell/Ghosts_PrisonCell/GhostNodeMap_PrisonCell_Lower/Prefab_IP_GhostBird_Prisoner/Ghostbird_IP_ANIM/Ghostbird_Skin_01:Ghostbird_Rig_V01:Base/Ghostbird_Skin_01:Ghostbird_Rig_V01:Root/Ghostbird_Skin_01:Ghostbird_Rig_V01:Spine01/Ghostbird_Skin_01:Ghostbird_Rig_V01:Spine02/Ghostbird_Skin_01:Ghostbird_Rig_V01:Spine03/Ghostbird_Skin_01:Ghostbird_Rig_V01:Spine04/Ghostbird_Skin_01:Ghostbird_Rig_V01:Neck01/Ghostbird_Skin_01:Ghostbird_Rig_V01:Neck02/Ghostbird_Skin_01:Ghostbird_Rig_V01:Head/PrisonerHeadDetector";
var position = info.position;
GameObject g = DetailBuilder.MakeDetail(planetGO, sector, path, position, Vector3.zero, 1, false);
if (g == null)
{
Logger.LogWarning($"Tried to make a vision torch target but couldn't. Do you have the DLC installed?");
return null;
}
g.name = "VisionStaffDetector";
// The number of slides is unlimited, 15 is only for texturing the actual slide reel item. This is not a slide reel item
@ -187,8 +194,9 @@ namespace NewHorizons.Builder.Props
VisionTorchTarget target = g.AddComponent<VisionTorchTarget>();
SlideCollectionContainer slideCollectionContainer = g.AddComponent<SlideCollectionContainer>();
slideCollectionContainer.slideCollection = slideCollection;
target.slideCollection = new MindSlideCollection();
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);

View File

@ -17,8 +17,6 @@ namespace NewHorizons.Patches
[HarmonyPatch(typeof(MindProjectorTrigger), nameof(MindProjectorTrigger.OnTriggerVolumeEntry))]
public static bool MindProjectorTrigger_OnTriggerVolumeEntry(MindProjectorTrigger __instance, GameObject hitObj)
{
Logger.Log("MIND PROJECTOR TRIGGER");
VisionTorchTarget t = hitObj.GetComponent<VisionTorchTarget>();
if (t != null) //(hitObj.CompareTag("PrisonerDetector"))
{
@ -26,11 +24,16 @@ namespace NewHorizons.Patches
__instance._mindProjector._slideCollectionItem = t.slideCollectionContainer;
__instance._mindProjector._mindSlideCollection = t.slideCollection;
Logger.Log("MIND PROJECTOR CUSTOM TRIGGER");
Main.Instance.ModHelper.Console.WriteLine("MIND PROJECTOR CUSTOM TRIGGER");
__instance.OnBeamStartHitPrisoner.Invoke();
__instance._mindProjector.Play(reset: true);
__instance._mindProjector.OnProjectionStart += new OWEvent.OWCallback(__instance.OnProjectionStart);
__instance._mindProjector.OnProjectionComplete += new OWEvent.OWCallback(__instance.OnProjectionComplete);
__instance._mindProjector._slideCollectionItem.onSlideTextureUpdated += new OWEvent.OWCallback(__instance._mindProjector.OnSlideTextureUpdated);
__instance._mindProjector._slideCollectionItem.onPlayBeatAudio += new OWEvent<AudioType>.OWCallback(__instance._mindProjector.OnPlayBeatAudio);
__instance._mindProjector._slideCollectionItem.Initialize();
Locator.GetPlayerTransform().GetComponent<PlayerLockOnTargeting>().LockOn(hitObj.transform, Vector3.zero);
__instance._playerLockedOn = true;
return false;