fixed line endings, stupid visual studio

This commit is contained in:
FreezeDriedMangoes 2022-05-25 07:27:07 -04:00
parent 41c8e17f49
commit c1b2a2fc8c
3 changed files with 226 additions and 226 deletions

View File

@ -5,7 +5,7 @@ using OWML.Common;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using static NewHorizons.External.Modules.PropModule; using static NewHorizons.External.Modules.PropModule;
using Logger = NewHorizons.Utility.Logger; using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
@ -18,8 +18,8 @@ namespace NewHorizons.Builder.Props
public static void Make(GameObject go, Sector sector, PropModule.ProjectionInfo info, IModBehaviour mod) public static void Make(GameObject go, Sector sector, PropModule.ProjectionInfo info, IModBehaviour mod)
{ {
if (info.type == "autoProjector") MakeAutoProjector(go, sector, info, mod); if (info.type == "autoProjector") MakeAutoProjector(go, sector, info, mod);
else if (info.type == "slideReel") MakeSlideReel(go, sector, info, mod); else if (info.type == "slideReel") MakeSlideReel(go, sector, info, mod);
else if (info.type == "playerVisionTorchTarget") MakeMindSlidesTarget(go, sector, info, mod); else if (info.type == "playerVisionTorchTarget") MakeMindSlidesTarget(go, sector, info, mod);
else if (info.type == "standingVisionTorch") MakeStandingVisionTorch(go, sector, info, mod); else if (info.type == "standingVisionTorch") MakeStandingVisionTorch(go, sector, info, mod);
else Logger.LogError($"Invalid projection type {info.type}"); else Logger.LogError($"Invalid projection type {info.type}");
} }
@ -156,120 +156,120 @@ namespace NewHorizons.Builder.Props
projectorObj.SetActive(true); projectorObj.SetActive(true);
} }
// Makes a target for a vision torch to scan // Makes a target for a vision torch to scan
public static GameObject MakeMindSlidesTarget(GameObject planetGO, Sector sector, PropModule.ProjectionInfo info, IModBehaviour mod) public static GameObject MakeMindSlidesTarget(GameObject planetGO, Sector sector, PropModule.ProjectionInfo info, IModBehaviour mod)
{ {
// spawn a trigger for the vision torch // spawn a trigger for the vision torch
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 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";
GameObject g = DetailBuilder.MakeDetail(planetGO, sector, path, info.position, Vector3.zero, 2, false); GameObject g = DetailBuilder.MakeDetail(planetGO, sector, path, info.position, Vector3.zero, 2, false);
if (g == null) if (g == null)
{ {
Logger.LogWarning($"Tried to make a vision torch target but couldn't. Do you have the DLC installed?"); Logger.LogWarning($"Tried to make a vision torch target but couldn't. Do you have the DLC installed?");
return null; return null;
} }
g.name = "VisionStaffDetector"; 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 // The number of slides is unlimited, 15 is only for texturing the actual slide reel item. This is not a slide reel item
SlideInfo[] slides = info.slides; SlideInfo[] slides = info.slides;
var slidesCount = slides.Length; var slidesCount = slides.Length;
var slideCollection = new SlideCollection(slidesCount); var slideCollection = new SlideCollection(slidesCount);
for (int i = 0; i < slidesCount; i++) for (int i = 0; i < slidesCount; i++)
{ {
var slide = new Slide(); var slide = new Slide();
var slideInfo = slides[i]; var slideInfo = slides[i];
// TODO: do this part asynchronously so that you can load all the slides you want without stalling the game out for 5 days // TODO: do this part asynchronously so that you can load all the slides you want without stalling the game out for 5 days
var texture = ImageUtilities.GetTexture(mod, slideInfo.imagePath); var texture = ImageUtilities.GetTexture(mod, slideInfo.imagePath);
slide.textureOverride = texture; //ImageUtilities.Invert(texture); slide.textureOverride = texture; //ImageUtilities.Invert(texture);
AddModules(slideInfo, ref slide); AddModules(slideInfo, ref slide);
slideCollection.slides[i] = slide; slideCollection.slides[i] = slide;
} }
// attatch a component to store all the data for the slides that play when a vision torch scans this target // attatch a component to store all the data for the slides that play when a vision torch scans this target
VisionTorchTarget target = g.AddComponent<VisionTorchTarget>(); VisionTorchTarget target = g.AddComponent<VisionTorchTarget>();
SlideCollectionContainer slideCollectionContainer = g.AddComponent<SlideCollectionContainer>(); SlideCollectionContainer slideCollectionContainer = g.AddComponent<SlideCollectionContainer>();
slideCollectionContainer.slideCollection = slideCollection; slideCollectionContainer.slideCollection = slideCollection;
target.slideCollection = g.AddComponent<MindSlideCollection>(); target.slideCollection = g.AddComponent<MindSlideCollection>();
target.slideCollection._slideCollectionContainer = slideCollectionContainer; target.slideCollection._slideCollectionContainer = slideCollectionContainer;
target.slideCollectionContainer = slideCollectionContainer; target.slideCollectionContainer = slideCollectionContainer;
// Idk why but it wants reveals to be comma delimited not a list // Idk why but it wants reveals to be comma delimited not a list
if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals); if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals);
return g; return g;
} }
public static GameObject MakeStandingVisionTorch(GameObject planetGO, Sector sector, PropModule.ProjectionInfo info, IModBehaviour mod) public static GameObject MakeStandingVisionTorch(GameObject planetGO, Sector sector, PropModule.ProjectionInfo info, IModBehaviour mod)
{ {
// //
// spawn the torch itself // spawn the torch itself
// //
var path = "RingWorld_Body/Sector_RingWorld/Sector_SecretEntrance/Interactibles_SecretEntrance/Experiment_1/VisionTorchApparatus/VisionTorchRoot/Prefab_IP_VisionTorchProjector"; var path = "RingWorld_Body/Sector_RingWorld/Sector_SecretEntrance/Interactibles_SecretEntrance/Experiment_1/VisionTorchApparatus/VisionTorchRoot/Prefab_IP_VisionTorchProjector";
GameObject standingTorch = DetailBuilder.MakeDetail(planetGO, sector, path, info.position, info.rotation, 1, false); GameObject standingTorch = DetailBuilder.MakeDetail(planetGO, sector, path, info.position, info.rotation, 1, false);
if (standingTorch == null) if (standingTorch == null)
{ {
Logger.LogWarning($"Tried to make a vision torch target but couldn't. Do you have the DLC installed?"); Logger.LogWarning($"Tried to make a vision torch target but couldn't. Do you have the DLC installed?");
return null; return null;
} }
// //
// set some required properties on the torch // set some required properties on the torch
// //
MindSlideProjector mindSlideProjector = standingTorch.GetComponent<MindSlideProjector>(); MindSlideProjector mindSlideProjector = standingTorch.GetComponent<MindSlideProjector>();
mindSlideProjector._mindProjectorImageEffect = GameObject.Find("Player_Body/PlayerCamera").GetComponent<MindProjectorImageEffect>(); mindSlideProjector._mindProjectorImageEffect = GameObject.Find("Player_Body/PlayerCamera").GetComponent<MindProjectorImageEffect>();
// //
// set up slides // set up slides
// //
// The number of slides is unlimited, 15 is only for texturing the actual slide reel item. This is not a slide reel item // The number of slides is unlimited, 15 is only for texturing the actual slide reel item. This is not a slide reel item
SlideInfo[] slides = info.slides; SlideInfo[] slides = info.slides;
var slidesCount = slides.Length; var slidesCount = slides.Length;
var slideCollection = new SlideCollection(slidesCount); var slideCollection = new SlideCollection(slidesCount);
for (int i = 0; i < slidesCount; i++) for (int i = 0; i < slidesCount; i++)
{ {
var slide = new Slide(); var slide = new Slide();
var slideInfo = slides[i]; var slideInfo = slides[i];
// TODO: do this part asynchronously so that you can load all the slides you want without stalling the game out for 5 days // TODO: do this part asynchronously so that you can load all the slides you want without stalling the game out for 5 days
var texture = ImageUtilities.GetTexture(mod, slideInfo.imagePath); var texture = ImageUtilities.GetTexture(mod, slideInfo.imagePath);
slide.textureOverride = texture; //ImageUtilities.Invert(texture); slide.textureOverride = texture; //ImageUtilities.Invert(texture);
AddModules(slideInfo, ref slide); AddModules(slideInfo, ref slide);
slideCollection.slides[i] = slide; slideCollection.slides[i] = slide;
} }
// set up the containers for the slides // set up the containers for the slides
SlideCollectionContainer slideCollectionContainer = standingTorch.AddComponent<SlideCollectionContainer>(); SlideCollectionContainer slideCollectionContainer = standingTorch.AddComponent<SlideCollectionContainer>();
slideCollectionContainer.slideCollection = slideCollection; slideCollectionContainer.slideCollection = slideCollection;
MindSlideCollection mindSlideCollection = standingTorch.AddComponent<MindSlideCollection>(); MindSlideCollection mindSlideCollection = standingTorch.AddComponent<MindSlideCollection>();
mindSlideCollection._slideCollectionContainer = slideCollectionContainer; mindSlideCollection._slideCollectionContainer = slideCollectionContainer;
// make sure that these slides play when the player wanders into the beam // make sure that these slides play when the player wanders into the beam
// _slideCollectionItem is actually a reference to a SlideCollectionContainer. Not a slide reel item // _slideCollectionItem is actually a reference to a SlideCollectionContainer. Not a slide reel item
standingTorch.GetComponent<MindSlideProjector>()._mindSlideCollection = mindSlideCollection; standingTorch.GetComponent<MindSlideProjector>()._mindSlideCollection = mindSlideCollection;
mindSlideProjector._slideCollectionItem = slideCollectionContainer; mindSlideProjector._slideCollectionItem = slideCollectionContainer;
mindSlideProjector._mindSlideCollection = mindSlideCollection; mindSlideProjector._mindSlideCollection = mindSlideCollection;
mindSlideProjector.SetMindSlideCollection(mindSlideCollection); mindSlideProjector.SetMindSlideCollection(mindSlideCollection);
// Idk why but it wants reveals to be comma delimited not a list // Idk why but it wants reveals to be comma delimited not a list
if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals); if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals);
return standingTorch; return standingTorch;
} }
private static void AddModules(PropModule.SlideInfo slideInfo, ref Slide slide) private static void AddModules(PropModule.SlideInfo slideInfo, ref Slide slide)
{ {
@ -318,11 +318,11 @@ namespace NewHorizons.Builder.Props
Slide.WriteModules(modules, ref slide._modulesList, ref slide._modulesData, ref slide.lengths); Slide.WriteModules(modules, ref slide._modulesList, ref slide._modulesData, ref slide.lengths);
} }
} }
public class VisionTorchTarget : MonoBehaviour public class VisionTorchTarget : MonoBehaviour
{ {
public MindSlideCollection slideCollection; public MindSlideCollection slideCollection;
public SlideCollectionContainer slideCollectionContainer; public SlideCollectionContainer slideCollectionContainer;
} }
} }

View File

@ -1,36 +1,36 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using HarmonyLib; using HarmonyLib;
namespace NewHorizons.Patches namespace NewHorizons.Patches
{ {
[HarmonyPatch] [HarmonyPatch]
public static class ToolModeSwapperPatches public static class ToolModeSwapperPatches
{ {
// Patches ToolModeSwapper.EquipToolMode(ToolMode mode) to deny swaps if you're holding a vision torch. // Patches ToolModeSwapper.EquipToolMode(ToolMode mode) to deny swaps if you're holding a vision torch.
// This is critical for preventing swapping to the scout launcher (causes memory slides to fail) but it // This is critical for preventing swapping to the scout launcher (causes memory slides to fail) but it
// just doesn't look right when you switch to other stuff (eg the signalscope), so I'm disabling swapping tools entirely // just doesn't look right when you switch to other stuff (eg the signalscope), so I'm disabling swapping tools entirely
// the correct way to do this is to patch ToolModeSwapper.Update to be exactly the same as it is now, but change the below line // the correct way to do this is to patch ToolModeSwapper.Update to be exactly the same as it is now, but change the below line
// to include a check for "is holding vision torch", but I'm not copy/pasting an entire function, no sir // to include a check for "is holding vision torch", but I'm not copy/pasting an entire function, no sir
// if (((_currentToolMode == ToolMode.None || _currentToolMode == ToolMode.Item) && Locator.GetPlayerSuit().IsWearingSuit(includeTrainingSuit: false)) || ((_currentToolMode == ToolMode.None || _currentToolMode == ToolMode.SignalScope) && OWInput.IsInputMode(InputMode.ShipCockpit))) // if (((_currentToolMode == ToolMode.None || _currentToolMode == ToolMode.Item) && Locator.GetPlayerSuit().IsWearingSuit(includeTrainingSuit: false)) || ((_currentToolMode == ToolMode.None || _currentToolMode == ToolMode.SignalScope) && OWInput.IsInputMode(InputMode.ShipCockpit)))
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(ToolModeSwapper), nameof(ToolModeSwapper.EquipToolMode))] [HarmonyPatch(typeof(ToolModeSwapper), nameof(ToolModeSwapper.EquipToolMode))]
public static bool ToolModeSwapper_EquipToolMode(ToolModeSwapper __instance, ToolMode mode) public static bool ToolModeSwapper_EquipToolMode(ToolModeSwapper __instance, ToolMode mode)
{ {
bool isHoldingVisionTorch = __instance.GetItemCarryTool()?.GetHeldItemType() == ItemType.VisionTorch; bool isHoldingVisionTorch = __instance.GetItemCarryTool()?.GetHeldItemType() == ItemType.VisionTorch;
bool swappingToRestrictedTool = bool swappingToRestrictedTool =
mode == ToolMode.Probe || mode == ToolMode.Probe ||
mode == ToolMode.SignalScope || mode == ToolMode.SignalScope ||
mode == ToolMode.Translator; mode == ToolMode.Translator;
if (isHoldingVisionTorch && swappingToRestrictedTool) return false; if (isHoldingVisionTorch && swappingToRestrictedTool) return false;
return true; return true;
} }
} }
} }

View File

@ -1,75 +1,75 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using HarmonyLib; using HarmonyLib;
using NewHorizons.Builder.Props; using NewHorizons.Builder.Props;
using UnityEngine; using UnityEngine;
namespace NewHorizons.Patches namespace NewHorizons.Patches
{ {
[HarmonyPatch] [HarmonyPatch]
public static class MindProjectorTriggerPatches public static class MindProjectorTriggerPatches
{ {
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(MindProjectorTrigger), nameof(MindProjectorTrigger.OnTriggerVolumeEntry))] [HarmonyPatch(typeof(MindProjectorTrigger), nameof(MindProjectorTrigger.OnTriggerVolumeEntry))]
public static bool MindProjectorTrigger_OnTriggerVolumeEntry(MindProjectorTrigger __instance, GameObject hitObj) public static bool MindProjectorTrigger_OnTriggerVolumeEntry(MindProjectorTrigger __instance, GameObject hitObj)
{ {
VisionTorchTarget t = hitObj.GetComponent<VisionTorchTarget>(); VisionTorchTarget t = hitObj.GetComponent<VisionTorchTarget>();
if (t != null) //(hitObj.CompareTag("PrisonerDetector")) if (t != null) //(hitObj.CompareTag("PrisonerDetector"))
{ {
// _slideCollectionItem is actually a reference to a SlideCollectionContainer. Not a slide reel item // _slideCollectionItem is actually a reference to a SlideCollectionContainer. Not a slide reel item
__instance._mindProjector._slideCollectionItem = t.slideCollectionContainer; __instance._mindProjector._slideCollectionItem = t.slideCollectionContainer;
__instance._mindProjector._mindSlideCollection = t.slideCollection; __instance._mindProjector._mindSlideCollection = t.slideCollection;
__instance._mindProjector.SetMindSlideCollection(t.slideCollection); __instance._mindProjector.SetMindSlideCollection(t.slideCollection);
Main.Instance.ModHelper.Console.WriteLine("MIND PROJECTOR CUSTOM TRIGGER"); Main.Instance.ModHelper.Console.WriteLine("MIND PROJECTOR CUSTOM TRIGGER");
__instance.OnBeamStartHitPrisoner.Invoke(); __instance.OnBeamStartHitPrisoner.Invoke();
__instance._mindProjector.Play(reset: true); __instance._mindProjector.Play(reset: true);
__instance._mindProjector.OnProjectionStart += new OWEvent.OWCallback(__instance.OnProjectionStart); __instance._mindProjector.OnProjectionStart += new OWEvent.OWCallback(__instance.OnProjectionStart);
__instance._mindProjector.OnProjectionComplete += new OWEvent.OWCallback(__instance.OnProjectionComplete); __instance._mindProjector.OnProjectionComplete += new OWEvent.OWCallback(__instance.OnProjectionComplete);
// __instance._mindProjector._slideCollectionItem.onSlideTextureUpdated += new OWEvent.OWCallback(__instance._mindProjector.OnSlideTextureUpdated); // __instance._mindProjector._slideCollectionItem.onSlideTextureUpdated += new OWEvent.OWCallback(__instance._mindProjector.OnSlideTextureUpdated);
//__instance._mindProjector._slideCollectionItem.onPlayBeatAudio += new OWEvent<AudioType>.OWCallback(__instance._mindProjector.OnPlayBeatAudio); //__instance._mindProjector._slideCollectionItem.onPlayBeatAudio += new OWEvent<AudioType>.OWCallback(__instance._mindProjector.OnPlayBeatAudio);
//__instance._mindProjector._slideCollectionItem.Initialize(); //__instance._mindProjector._slideCollectionItem.Initialize();
Locator.GetPlayerTransform().GetComponent<PlayerLockOnTargeting>().LockOn(hitObj.transform, Vector3.zero); Locator.GetPlayerTransform().GetComponent<PlayerLockOnTargeting>().LockOn(hitObj.transform, Vector3.zero);
__instance._playerLockedOn = true; __instance._playerLockedOn = true;
return false; return false;
} }
return true; return true;
} }
// TOOD: OnTriggerVolumeExit // TOOD: OnTriggerVolumeExit
} }
[HarmonyPatch] [HarmonyPatch]
public static class VisionTorchItemPatches public static class VisionTorchItemPatches
{ {
// This is some dark magic // 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 // this creates a method called base_DropItem that basically just calls OWItem.PickUpItem whenever it (VisionTorchItemPatches.base_PickUpItem) is called
[HarmonyReversePatch] [HarmonyReversePatch]
[HarmonyPatch(typeof(OWItem), nameof(OWItem.DropItem))] [HarmonyPatch(typeof(OWItem), nameof(OWItem.DropItem))]
private static void base_DropItem(OWItem instance, Vector3 position, Vector3 normal, Transform parent, Sector sector, IItemDropTarget customDropTarget) { } 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. // Make the vision torch droppable. In the base game you can only drop it if you're in the dream world.
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(VisionTorchItem), nameof(VisionTorchItem.DropItem))] [HarmonyPatch(typeof(VisionTorchItem), nameof(VisionTorchItem.DropItem))]
public static bool VisionTorchItem_DropItem(VisionTorchItem __instance, Vector3 position, Vector3 normal, Transform parent, Sector sector, IItemDropTarget customDropTarget) public static bool VisionTorchItem_DropItem(VisionTorchItem __instance, Vector3 position, Vector3 normal, Transform parent, Sector sector, IItemDropTarget customDropTarget)
{ {
if (!Locator.GetDreamWorldController().IsInDream()) if (!Locator.GetDreamWorldController().IsInDream())
{ {
base_DropItem(__instance, position, normal, parent, sector, customDropTarget); base_DropItem(__instance, position, normal, parent, sector, customDropTarget);
} }
return true; return true;
} }
// ProbeLauncher.Disable()? // ProbeLauncher.Disable()?
// public override void PickUpItem(Transform holdTranform) // public override void PickUpItem(Transform holdTranform)
} }
} }