mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
added patches required to block item swapping while holding a vision torch. this is the last change required to get vision torches baseline functional
This commit is contained in:
parent
f1ed8be741
commit
2af257a35f
@ -184,7 +184,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
// 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);
|
||||
slide.textureOverride = ImageUtilities.Invert(texture);
|
||||
slide.textureOverride = texture; //ImageUtilities.Invert(texture);
|
||||
|
||||
AddModules(slideInfo, ref slide);
|
||||
|
||||
|
||||
36
NewHorizons/Patches/ToolModeSwapperPatches.cs
Normal file
36
NewHorizons/Patches/ToolModeSwapperPatches.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace NewHorizons.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public static class ToolModeSwapperPatches
|
||||
{
|
||||
|
||||
// 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
|
||||
// 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
|
||||
// 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)))
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ToolModeSwapper), nameof(ToolModeSwapper.EquipToolMode))]
|
||||
public static bool ToolModeSwapper_EquipToolMode(ToolModeSwapper __instance, ToolMode mode)
|
||||
{
|
||||
bool isHoldingVisionTorch = __instance.GetItemCarryTool()?.GetHeldItemType() == ItemType.VisionTorch;
|
||||
bool swappingToRestrictedTool =
|
||||
mode == ToolMode.Probe ||
|
||||
mode == ToolMode.SignalScope ||
|
||||
mode == ToolMode.Translator;
|
||||
|
||||
if (isHoldingVisionTorch && swappingToRestrictedTool) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -68,5 +68,8 @@ namespace NewHorizons.Patches
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ProbeLauncher.Disable()?
|
||||
// public override void PickUpItem(Transform holdTranform)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user