mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Common camera utility (#384)
## Improvements - Nomai remote cameras (projection pools) display the right camera layers, and better show the protagonist. Uses [CommonCameraUtility](https://github.com/xen-42/ow-common-camera-util)
This commit is contained in:
commit
2baa7dfae7
@ -0,0 +1,27 @@
|
|||||||
|
using NewHorizons.OtherMods.MenuFramework;
|
||||||
|
using Logger = NewHorizons.Utility.Logger;
|
||||||
|
|
||||||
|
namespace NewHorizons.OtherMods.CommonCameraUtility
|
||||||
|
{
|
||||||
|
public static class CommonCameraHandler
|
||||||
|
{
|
||||||
|
private static ICommonCameraAPI _cameraAPI;
|
||||||
|
|
||||||
|
static CommonCameraHandler()
|
||||||
|
{
|
||||||
|
_cameraAPI = Main.Instance.ModHelper.Interaction.TryGetModApi<ICommonCameraAPI>("xen.CommonCameraUtility");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RegisterCustomCamera(OWCamera camera)
|
||||||
|
{
|
||||||
|
if (_cameraAPI != null)
|
||||||
|
{
|
||||||
|
_cameraAPI.RegisterCustomCamera(camera);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.LogError("Tried to register custom camera but Common Camera Utility was missing.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
|
||||||
|
namespace NewHorizons.OtherMods.CommonCameraUtility
|
||||||
|
{
|
||||||
|
public interface ICommonCameraAPI
|
||||||
|
{
|
||||||
|
void RegisterCustomCamera(OWCamera OWCamera);
|
||||||
|
(OWCamera, Camera) CreateCustomCamera(string name);
|
||||||
|
UnityEvent<PlayerTool> EquipTool();
|
||||||
|
UnityEvent<PlayerTool> UnequipTool();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
using NewHorizons.OtherMods.CommonCameraUtility;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.Patches.CameraPatches
|
||||||
|
{
|
||||||
|
[HarmonyPatch]
|
||||||
|
public static class NomaiRemoteCameraPatches
|
||||||
|
{
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(NomaiRemoteCamera), nameof(NomaiRemoteCamera.Awake))]
|
||||||
|
public static void NomaiRemoteCamera_Awake(NomaiRemoteCamera __instance)
|
||||||
|
{
|
||||||
|
// Ensures that if the player is visible from the remote camera they look normal
|
||||||
|
CommonCameraHandler.RegisterCustomCamera(__instance._camera);
|
||||||
|
|
||||||
|
// These layers were left on because it doesnt come up in base game (Dreamworld is inactive, player is far away)
|
||||||
|
__instance._camera.mainCamera.cullingMask &= ~(1 << LayerMask.NameToLayer("DreamSimulation"));
|
||||||
|
__instance._camera.mainCamera.cullingMask &= ~(1 <<LayerMask.NameToLayer("UI"));
|
||||||
|
__instance._camera.mainCamera.cullingMask &= ~(1 <<LayerMask.NameToLayer("HeadsUpDisplay"));
|
||||||
|
__instance._camera.mainCamera.cullingMask &= ~(1 <<LayerMask.NameToLayer("HelmetUVPass"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
namespace NewHorizons.Patches
|
|
||||||
|
namespace NewHorizons.Patches.CameraPatches
|
||||||
{
|
{
|
||||||
[HarmonyPatch]
|
[HarmonyPatch]
|
||||||
public static class OWCameraPatch
|
public static class OWCameraPatch
|
||||||
@ -6,7 +6,7 @@
|
|||||||
"uniqueName": "xen.NewHorizons",
|
"uniqueName": "xen.NewHorizons",
|
||||||
"version": "1.5.1",
|
"version": "1.5.1",
|
||||||
"owmlVersion": "2.6.0",
|
"owmlVersion": "2.6.0",
|
||||||
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework" ],
|
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility" ],
|
||||||
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_Randomizer" ],
|
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_Randomizer" ],
|
||||||
"pathsToPreserve": [ "planets", "systems", "translations" ]
|
"pathsToPreserve": [ "planets", "systems", "translations" ]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user