diff --git a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs index 7ddbe7d5..3fa30b09 100644 --- a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs @@ -1,4 +1,5 @@ using NewHorizons.Components; +using NewHorizons.Components.Sectored; using NewHorizons.External.Modules; using NewHorizons.Utility; using NewHorizons.Utility.Files; diff --git a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs index 3ad3473b..9eba9930 100644 --- a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs +++ b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs @@ -1,6 +1,6 @@ using NewHorizons.Builder.Props; -using NewHorizons.Components; using NewHorizons.Components.Orbital; +using NewHorizons.Components.Sectored; using NewHorizons.External; using NewHorizons.External.Modules; using NewHorizons.External.Modules.Props; diff --git a/NewHorizons/Builder/Body/CloakBuilder.cs b/NewHorizons/Builder/Body/CloakBuilder.cs index dd1ece55..369683eb 100644 --- a/NewHorizons/Builder/Body/CloakBuilder.cs +++ b/NewHorizons/Builder/Body/CloakBuilder.cs @@ -1,4 +1,4 @@ -using NewHorizons.Components; +using NewHorizons.Components.Sectored; using NewHorizons.External.Modules; using NewHorizons.Utility; using NewHorizons.Utility.Files; diff --git a/NewHorizons/Builder/Body/CometTailBuilder.cs b/NewHorizons/Builder/Body/CometTailBuilder.cs index 95359416..1f3d80ab 100644 --- a/NewHorizons/Builder/Body/CometTailBuilder.cs +++ b/NewHorizons/Builder/Body/CometTailBuilder.cs @@ -1,6 +1,9 @@ +using NewHorizons.Components.SizeControllers; using NewHorizons.External.Configs; using NewHorizons.External.Modules; using NewHorizons.Utility; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using UnityEngine; namespace NewHorizons.Builder.Body @@ -14,17 +17,24 @@ namespace NewHorizons.Builder.Body if (_tailPrefab == null) _tailPrefab = SearchUtilities.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes").InstantiateInactive().Rename("Prefab_CO_Tail").DontDestroyOnLoad(); } - public static void Make(GameObject planetGO, Sector sector, CometTailModule cometTailModule, float surfaceSize) + public static void Make(GameObject planetGO, Sector sector, CometTailModule cometTailModule, PlanetConfig config) { var cometTail = GameObject.Instantiate(_tailPrefab, sector?.transform ?? planetGO.transform); cometTail.transform.position = planetGO.transform.position; cometTail.name = "CometTail"; - cometTail.transform.localScale = Vector3.one * (cometTailModule.innerRadius ?? surfaceSize) / 110; - var alignment = new Vector3(0, 270, 90); - if (cometTailModule.rotationOverride != null) alignment = cometTailModule.rotationOverride; + var controller = cometTail.AddComponent(); - cometTail.transform.rotation = Quaternion.Euler(alignment); + controller.size = (cometTailModule.innerRadius ?? config.Base.surfaceSize) / 110; + + if (cometTailModule.rotationOverride != null) controller.SetRotationOverride(cometTailModule.rotationOverride); + + if (string.IsNullOrEmpty(cometTailModule.primaryBody)) cometTailModule.primaryBody = config.Orbit.primaryBody; + + Delay.FireOnNextUpdate(() => + { + controller.SetPrimaryBody(AstroObjectLocator.GetAstroObject(cometTailModule.primaryBody).transform); + }); cometTail.SetActive(true); } diff --git a/NewHorizons/Builder/Body/ProxyBuilder.cs b/NewHorizons/Builder/Body/ProxyBuilder.cs index 9a48f7c4..1730470c 100644 --- a/NewHorizons/Builder/Body/ProxyBuilder.cs +++ b/NewHorizons/Builder/Body/ProxyBuilder.cs @@ -1,6 +1,7 @@ using NewHorizons.Builder.Atmosphere; using NewHorizons.Builder.Props; using NewHorizons.Components; +using NewHorizons.Components.Props; using NewHorizons.Components.SizeControllers; using NewHorizons.External; using NewHorizons.External.Modules.VariableSize; @@ -196,7 +197,7 @@ namespace NewHorizons.Builder.Body if (body.Config.CometTail != null) { - CometTailBuilder.Make(proxy, null, body.Config.CometTail, body.Config.Base.surfaceSize); + CometTailBuilder.Make(proxy, null, body.Config.CometTail, body.Config); } if (body.Config.Props?.proxyDetails != null) diff --git a/NewHorizons/Builder/Body/RingBuilder.cs b/NewHorizons/Builder/Body/RingBuilder.cs index d727e173..d7e18da0 100644 --- a/NewHorizons/Builder/Body/RingBuilder.cs +++ b/NewHorizons/Builder/Body/RingBuilder.cs @@ -4,6 +4,7 @@ using NewHorizons.Components.Volumes; using NewHorizons.External.Modules; using NewHorizons.Utility; using NewHorizons.Utility.Files; +using NewHorizons.Utility.Geometry; using NewHorizons.Utility.OuterWilds; using NewHorizons.Utility.OWML; using OWML.Common; diff --git a/NewHorizons/Builder/Body/SupernovaEffectBuilder.cs b/NewHorizons/Builder/Body/SupernovaEffectBuilder.cs index edc92b25..32086640 100644 --- a/NewHorizons/Builder/Body/SupernovaEffectBuilder.cs +++ b/NewHorizons/Builder/Body/SupernovaEffectBuilder.cs @@ -1,10 +1,10 @@ using UnityEngine; using NewHorizons.Utility; using NewHorizons.External.Configs; -using NewHorizons.Components; using System.Linq; using OWML.Common; using NewHorizons.Utility.Files; +using NewHorizons.Components.Props; namespace NewHorizons.Builder.Body { diff --git a/NewHorizons/Builder/General/AstroObjectBuilder.cs b/NewHorizons/Builder/General/AstroObjectBuilder.cs index a2777a4c..f51ab71f 100644 --- a/NewHorizons/Builder/General/AstroObjectBuilder.cs +++ b/NewHorizons/Builder/General/AstroObjectBuilder.cs @@ -18,7 +18,7 @@ namespace NewHorizons.Builder.General var type = AstroObject.Type.Planet; if (config.Orbit.isMoon) type = AstroObject.Type.Moon; // else if (config.Base.IsSatellite) type = AstroObject.Type.Satellite; - else if (config.Base.hasCometTail) type = AstroObject.Type.Comet; + else if (config.CometTail != null) type = AstroObject.Type.Comet; else if (config.Star != null) type = AstroObject.Type.Star; else if (config.FocalPoint != null) type = AstroObject.Type.None; astroObject._type = type; diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs index 03fbc290..d4e849a6 100644 --- a/NewHorizons/Builder/Props/DialogueBuilder.cs +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -1,4 +1,4 @@ -using NewHorizons.Components; +using NewHorizons.Components.Props; using NewHorizons.External.Modules.Props.Dialogue; using NewHorizons.Handlers; using NewHorizons.Utility; diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index 4d1907e4..90987169 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -1,4 +1,4 @@ -using NewHorizons.Components; +using NewHorizons.Components.Props; using NewHorizons.External.Modules.Props; using NewHorizons.Handlers; using NewHorizons.Utility; diff --git a/NewHorizons/Components/EyeAstroObject.cs b/NewHorizons/Components/EyeOfTheUniverse/EyeAstroObject.cs similarity index 84% rename from NewHorizons/Components/EyeAstroObject.cs rename to NewHorizons/Components/EyeOfTheUniverse/EyeAstroObject.cs index 799617bc..c863d1e5 100644 --- a/NewHorizons/Components/EyeAstroObject.cs +++ b/NewHorizons/Components/EyeOfTheUniverse/EyeAstroObject.cs @@ -1,4 +1,4 @@ -namespace NewHorizons.Components +namespace NewHorizons.Components.EyeOfTheUniverse { public class EyeAstroObject : AstroObject { diff --git a/NewHorizons/Components/EyeSunLightParamUpdater.cs b/NewHorizons/Components/EyeOfTheUniverse/EyeSunLightParamUpdater.cs similarity index 96% rename from NewHorizons/Components/EyeSunLightParamUpdater.cs rename to NewHorizons/Components/EyeOfTheUniverse/EyeSunLightParamUpdater.cs index 0649d90c..92a0ea1a 100644 --- a/NewHorizons/Components/EyeSunLightParamUpdater.cs +++ b/NewHorizons/Components/EyeOfTheUniverse/EyeSunLightParamUpdater.cs @@ -1,4 +1,4 @@ -namespace NewHorizons.Components +namespace NewHorizons.Components.EyeOfTheUniverse { /* public class EyeSunLightParamUpdater : MonoBehaviour diff --git a/NewHorizons/Components/NHProxy.cs b/NewHorizons/Components/NHProxy.cs index 9562678c..9aabe150 100644 --- a/NewHorizons/Components/NHProxy.cs +++ b/NewHorizons/Components/NHProxy.cs @@ -1,3 +1,4 @@ +using NewHorizons.Components.Props; using NewHorizons.Components.SizeControllers; using NewHorizons.Handlers; using NewHorizons.Utility.OuterWilds; diff --git a/NewHorizons/Components/NHCharacterDialogueTree.cs b/NewHorizons/Components/Props/NHCharacterDialogueTree.cs similarity index 67% rename from NewHorizons/Components/NHCharacterDialogueTree.cs rename to NewHorizons/Components/Props/NHCharacterDialogueTree.cs index c68c85f4..f509906b 100644 --- a/NewHorizons/Components/NHCharacterDialogueTree.cs +++ b/NewHorizons/Components/Props/NHCharacterDialogueTree.cs @@ -1,4 +1,4 @@ -namespace NewHorizons.Components +namespace NewHorizons.Components.Props { public class NHCharacterDialogueTree : CharacterDialogueTree { diff --git a/NewHorizons/Components/NHSupernovaPlanetEffectController.cs b/NewHorizons/Components/Props/NHSupernovaPlanetEffectController.cs similarity index 99% rename from NewHorizons/Components/NHSupernovaPlanetEffectController.cs rename to NewHorizons/Components/Props/NHSupernovaPlanetEffectController.cs index 4d9e9b22..df1ebc7b 100644 --- a/NewHorizons/Components/NHSupernovaPlanetEffectController.cs +++ b/NewHorizons/Components/Props/NHSupernovaPlanetEffectController.cs @@ -3,7 +3,7 @@ using NewHorizons.Handlers; using UnityEngine; using static SupernovaPlanetEffectController; -namespace NewHorizons.Components +namespace NewHorizons.Components.Props { public class NHSupernovaPlanetEffectController : MonoBehaviour { diff --git a/NewHorizons/Components/NHTornadoWanderController.cs b/NewHorizons/Components/Props/NHTornadoWanderController.cs similarity index 98% rename from NewHorizons/Components/NHTornadoWanderController.cs rename to NewHorizons/Components/Props/NHTornadoWanderController.cs index 6d8dcd0e..c8af273c 100644 --- a/NewHorizons/Components/NHTornadoWanderController.cs +++ b/NewHorizons/Components/Props/NHTornadoWanderController.cs @@ -1,6 +1,6 @@ using UnityEngine; using Random = UnityEngine.Random; -namespace NewHorizons.Components +namespace NewHorizons.Components.Props { public class NHTornadoWanderController : MonoBehaviour { diff --git a/NewHorizons/Components/BrambleSectorController.cs b/NewHorizons/Components/Sectored/BrambleSectorController.cs similarity index 98% rename from NewHorizons/Components/BrambleSectorController.cs rename to NewHorizons/Components/Sectored/BrambleSectorController.cs index b4c4fd16..3d48e53a 100644 --- a/NewHorizons/Components/BrambleSectorController.cs +++ b/NewHorizons/Components/Sectored/BrambleSectorController.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace NewHorizons.Components +namespace NewHorizons.Components.Sectored { public class BrambleSectorController : MonoBehaviour, ISectorGroup { diff --git a/NewHorizons/Components/CloakSectorController.cs b/NewHorizons/Components/Sectored/CloakSectorController.cs similarity index 99% rename from NewHorizons/Components/CloakSectorController.cs rename to NewHorizons/Components/Sectored/CloakSectorController.cs index 55bc4a88..caf3df97 100644 --- a/NewHorizons/Components/CloakSectorController.cs +++ b/NewHorizons/Components/Sectored/CloakSectorController.cs @@ -1,5 +1,5 @@ using UnityEngine; -namespace NewHorizons.Components +namespace NewHorizons.Components.Sectored { public class CloakSectorController : MonoBehaviour { diff --git a/NewHorizons/Components/CloakedTessSphereSectorToggle.cs b/NewHorizons/Components/Sectored/CloakedTessSphereSectorToggle.cs similarity index 98% rename from NewHorizons/Components/CloakedTessSphereSectorToggle.cs rename to NewHorizons/Components/Sectored/CloakedTessSphereSectorToggle.cs index b5232720..d0d59d4c 100644 --- a/NewHorizons/Components/CloakedTessSphereSectorToggle.cs +++ b/NewHorizons/Components/Sectored/CloakedTessSphereSectorToggle.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace NewHorizons.Components +namespace NewHorizons.Components.Sectored { [RequireComponent(typeof(TessellatedSphereRenderer))] public class CloakedTessSphereSectorToggle : SectoredMonoBehaviour diff --git a/NewHorizons/Components/SizeControllers/CometTailController.cs b/NewHorizons/Components/SizeControllers/CometTailController.cs new file mode 100644 index 00000000..6532cec1 --- /dev/null +++ b/NewHorizons/Components/SizeControllers/CometTailController.cs @@ -0,0 +1,40 @@ +using UnityEngine; + +namespace NewHorizons.Components.SizeControllers +{ + public class CometTailController : SizeController + { + private Transform _primaryBody; + private OWRigidbody _body; + + private bool _hasRotationOverride; + private bool _hasPrimaryBody; + + public void Start() + { + _body = transform.GetAttachedOWRigidbody(); + } + + public override void FixedUpdate() + { + base.FixedUpdate(); + + if (!_hasRotationOverride && _hasPrimaryBody) + { + transform.LookAt(_primaryBody, _body.GetVelocity().normalized); + } + } + + public void SetRotationOverride(Vector3 eulerAngles) + { + _hasRotationOverride = true; + transform.localRotation = Quaternion.Euler(eulerAngles); + } + + public void SetPrimaryBody(Transform primaryBody) + { + _hasPrimaryBody = true; + _primaryBody = primaryBody; + } + } +} diff --git a/NewHorizons/Components/SizeControllers/LavaSizeController.cs b/NewHorizons/Components/SizeControllers/LavaSizeController.cs index 829746f1..6d4f4a9f 100644 --- a/NewHorizons/Components/SizeControllers/LavaSizeController.cs +++ b/NewHorizons/Components/SizeControllers/LavaSizeController.cs @@ -8,7 +8,7 @@ namespace NewHorizons.Components.SizeControllers public Material material; public Material proxyMaterial; - protected new void FixedUpdate() + public override void FixedUpdate() { base.FixedUpdate(); diff --git a/NewHorizons/Components/VesselOrbLocker.cs b/NewHorizons/Components/Vessel/VesselOrbLocker.cs similarity index 97% rename from NewHorizons/Components/VesselOrbLocker.cs rename to NewHorizons/Components/Vessel/VesselOrbLocker.cs index a7343659..a10958fc 100644 --- a/NewHorizons/Components/VesselOrbLocker.cs +++ b/NewHorizons/Components/Vessel/VesselOrbLocker.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace NewHorizons.Components +namespace NewHorizons.Components.Vessel { [UsedInUnityProject] public class VesselOrbLocker : MonoBehaviour diff --git a/NewHorizons/Components/VesselSingularityRoot.cs b/NewHorizons/Components/Vessel/VesselSingularityRoot.cs similarity index 74% rename from NewHorizons/Components/VesselSingularityRoot.cs rename to NewHorizons/Components/Vessel/VesselSingularityRoot.cs index fcfc3fab..dce83f1d 100644 --- a/NewHorizons/Components/VesselSingularityRoot.cs +++ b/NewHorizons/Components/Vessel/VesselSingularityRoot.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace NewHorizons.Components +namespace NewHorizons.Components.Vessel { [UsedInUnityProject] public class VesselSingularityRoot : MonoBehaviour diff --git a/NewHorizons/External/Modules/CometTailModule.cs b/NewHorizons/External/Modules/CometTailModule.cs index 2704ad1e..e2156271 100644 --- a/NewHorizons/External/Modules/CometTailModule.cs +++ b/NewHorizons/External/Modules/CometTailModule.cs @@ -21,5 +21,10 @@ namespace NewHorizons.External.Modules /// Inner radius of the comet tail, defaults to match surfaceSize /// public float? innerRadius; + + /// + /// The body that the comet tail should always point away from + /// + public string primaryBody; } } diff --git a/NewHorizons/Handlers/EyeSceneHandler.cs b/NewHorizons/Handlers/EyeSceneHandler.cs index 15ee0e76..a0c925a9 100644 --- a/NewHorizons/Handlers/EyeSceneHandler.cs +++ b/NewHorizons/Handlers/EyeSceneHandler.cs @@ -1,5 +1,5 @@ using NewHorizons.Builder.General; -using NewHorizons.Components; +using NewHorizons.Components.EyeOfTheUniverse; using NewHorizons.Components.Stars; using NewHorizons.External.SerializableData; using NewHorizons.Utility; diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 9b7c90f0..414ce9e7 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -601,7 +601,7 @@ namespace NewHorizons.Handlers if (body.Config.CometTail != null) { - CometTailBuilder.Make(go, sector, body.Config.CometTail, body.Config.Base.surfaceSize); + CometTailBuilder.Make(go, sector, body.Config.CometTail, body.Config); } if (body.Config.Lava != null) diff --git a/NewHorizons/Handlers/SupernovaEffectHandler.cs b/NewHorizons/Handlers/SupernovaEffectHandler.cs index de35d181..22483ece 100644 --- a/NewHorizons/Handlers/SupernovaEffectHandler.cs +++ b/NewHorizons/Handlers/SupernovaEffectHandler.cs @@ -1,4 +1,4 @@ -using NewHorizons.Components; +using NewHorizons.Components.Props; using NewHorizons.Components.SizeControllers; using System.Collections.Generic; using UnityEngine; diff --git a/NewHorizons/Handlers/VesselWarpHandler.cs b/NewHorizons/Handlers/VesselWarpHandler.cs index 935c4399..4066b711 100644 --- a/NewHorizons/Handlers/VesselWarpHandler.cs +++ b/NewHorizons/Handlers/VesselWarpHandler.cs @@ -1,11 +1,12 @@ using UnityEngine; -using NewHorizons.Components; using NewHorizons.Utility; using static NewHorizons.Main; using NewHorizons.Builder.Props; using NewHorizons.Utility.OWML; using NewHorizons.Utility.OuterWilds; +using NewHorizons.Components.Vessel; +using NewHorizons.Components.EyeOfTheUniverse; namespace NewHorizons.Handlers { diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 4412aae3..122abee8 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -4,7 +4,6 @@ using NewHorizons.Builder.Body; using NewHorizons.Builder.General; using NewHorizons.Builder.Props; using NewHorizons.Builder.Props.TranslatorText; -using NewHorizons.Components; using NewHorizons.Components.Fixers; using NewHorizons.Components.SizeControllers; using NewHorizons.External; @@ -32,6 +31,7 @@ using UnityEngine.SceneManagement; using NewHorizons.Utility.DebugTools; using NewHorizons.Utility.DebugTools.Menu; +using NewHorizons.Components.Ship; namespace NewHorizons { diff --git a/NewHorizons/Patches/CameraPatches/ProbeCameraPatches.cs b/NewHorizons/Patches/CameraPatches/ProbeCameraPatches.cs index 481c0f30..2b2cf116 100644 --- a/NewHorizons/Patches/CameraPatches/ProbeCameraPatches.cs +++ b/NewHorizons/Patches/CameraPatches/ProbeCameraPatches.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using NewHorizons.Components.Sectored; using NewHorizons.Handlers; namespace NewHorizons.Patches.CameraPatches @@ -10,7 +11,7 @@ namespace NewHorizons.Patches.CameraPatches [HarmonyPatch(nameof(ProbeCamera.HasInterference))] public static void ProbeCamera_HasInterference(ProbeCamera __instance, ref bool __result) { - __result = __result || (__instance._id != ProbeCamera.ID.PreLaunch && (Components.CloakSectorController.isPlayerInside != Components.CloakSectorController.isProbeInside || !InterferenceHandler.IsPlayerSameAsProbe())); + __result = __result || (__instance._id != ProbeCamera.ID.PreLaunch && (CloakSectorController.isPlayerInside != CloakSectorController.isProbeInside || !InterferenceHandler.IsPlayerSameAsProbe())); } } } diff --git a/NewHorizons/Patches/DialoguePatches/CharacterDialogueTreePatches.cs b/NewHorizons/Patches/DialoguePatches/CharacterDialogueTreePatches.cs index 32cab4ad..1ef6c7b3 100644 --- a/NewHorizons/Patches/DialoguePatches/CharacterDialogueTreePatches.cs +++ b/NewHorizons/Patches/DialoguePatches/CharacterDialogueTreePatches.cs @@ -1,7 +1,7 @@ using HarmonyLib; -using NewHorizons.Components; using NewHorizons.OtherMods.AchievementsPlus.NH; using NewHorizons.OtherMods.AchievementsPlus; +using NewHorizons.Components.Props; namespace NewHorizons.Patches.DialoguePatches; diff --git a/NewHorizons/Patches/EchoesOfTheEyePatches/CloakFieldControllerPatches.cs b/NewHorizons/Patches/EchoesOfTheEyePatches/CloakFieldControllerPatches.cs index cdb8736c..7af04378 100644 --- a/NewHorizons/Patches/EchoesOfTheEyePatches/CloakFieldControllerPatches.cs +++ b/NewHorizons/Patches/EchoesOfTheEyePatches/CloakFieldControllerPatches.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using NewHorizons.Components.Sectored; namespace NewHorizons.Patches.EchoesOfTheEyePatches { @@ -16,21 +17,21 @@ namespace NewHorizons.Patches.EchoesOfTheEyePatches [HarmonyPatch(nameof(CloakFieldController.isPlayerInsideCloak), MethodType.Getter)] public static void CloakFieldController_isPlayerInsideCloak(ref bool __result) { - __result = __result || Components.CloakSectorController.isPlayerInside; + __result = __result || CloakSectorController.isPlayerInside; } [HarmonyPostfix] [HarmonyPatch(nameof(CloakFieldController.isProbeInsideCloak), MethodType.Getter)] public static void CloakFieldController_isProbeInsideCloak(ref bool __result) { - __result = __result || Components.CloakSectorController.isProbeInside; + __result = __result || CloakSectorController.isProbeInside; } [HarmonyPostfix] [HarmonyPatch(nameof(CloakFieldController.isShipInsideCloak), MethodType.Getter)] public static void CloakFieldController_isShipInsideCloak(ref bool __result) { - __result = __result || Components.CloakSectorController.isShipInside; + __result = __result || CloakSectorController.isShipInside; } } } diff --git a/NewHorizons/Patches/HUDPatches/ProbeHUDMarkerPatches.cs b/NewHorizons/Patches/HUDPatches/ProbeHUDMarkerPatches.cs index dc464f3c..15da0b12 100644 --- a/NewHorizons/Patches/HUDPatches/ProbeHUDMarkerPatches.cs +++ b/NewHorizons/Patches/HUDPatches/ProbeHUDMarkerPatches.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using NewHorizons.Components.Sectored; using NewHorizons.Handlers; namespace NewHorizons.Patches.HUDPatches @@ -30,7 +31,7 @@ namespace NewHorizons.Patches.HUDPatches bool insideQM = __instance._quantumMoon != null && (__instance._quantumMoon.IsPlayerInside() || __instance._quantumMoon.IsProbeInside()); bool insideRW = Locator.GetRingWorldController() != null && Locator.GetRingWorldController().isPlayerInside == Locator.GetRingWorldController().isProbeInside; bool insideIP = Locator.GetCloakFieldController() != null && Locator.GetCloakFieldController().isPlayerInsideCloak == Locator.GetCloakFieldController().isProbeInsideCloak; - bool insideCloak = Components.CloakSectorController.isPlayerInside == Components.CloakSectorController.isProbeInside; + bool insideCloak = CloakSectorController.isPlayerInside == CloakSectorController.isProbeInside; bool sameInterference = InterferenceHandler.IsPlayerSameAsProbe(); bool isActive = __instance.gameObject.activeInHierarchy || __instance._isTLCDuplicate; diff --git a/NewHorizons/Patches/HUDPatches/ShipHUDMarkerPatches.cs b/NewHorizons/Patches/HUDPatches/ShipHUDMarkerPatches.cs index c44f46dc..c99ae6fe 100644 --- a/NewHorizons/Patches/HUDPatches/ShipHUDMarkerPatches.cs +++ b/NewHorizons/Patches/HUDPatches/ShipHUDMarkerPatches.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using NewHorizons.Components.Sectored; using NewHorizons.Handlers; namespace NewHorizons.Patches.HUDPatches @@ -14,7 +15,7 @@ namespace NewHorizons.Patches.HUDPatches bool insideQM = __instance._quantumMoon != null && (__instance._quantumMoon.IsPlayerInside() || __instance._quantumMoon.IsShipInside()); bool insideRW = Locator.GetRingWorldController() != null && Locator.GetRingWorldController().isPlayerInside; bool insideIP = Locator.GetCloakFieldController() != null && Locator.GetCloakFieldController().isPlayerInsideCloak == Locator.GetCloakFieldController().isShipInsideCloak; - bool insideCloak = Components.CloakSectorController.isPlayerInside == Components.CloakSectorController.isShipInside; + bool insideCloak = CloakSectorController.isPlayerInside == CloakSectorController.isShipInside; bool sameInterference = InterferenceHandler.IsPlayerSameAsShip(); __instance._isVisible = !insideEYE && !insideQM && !insideRW && !__instance._translatorEquipped && !__instance._inConversation && !__instance._shipDestroyed && !__instance._playerInShip && PlayerState.HasPlayerEnteredShip() && __instance._isWearingHelmet && insideIP && insideCloak && sameInterference; diff --git a/NewHorizons/Patches/HUDPatches/ShipLogEntryHUDMarkerPatches.cs b/NewHorizons/Patches/HUDPatches/ShipLogEntryHUDMarkerPatches.cs index 75800339..4860bee5 100644 --- a/NewHorizons/Patches/HUDPatches/ShipLogEntryHUDMarkerPatches.cs +++ b/NewHorizons/Patches/HUDPatches/ShipLogEntryHUDMarkerPatches.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using NewHorizons.Components.Sectored; namespace NewHorizons.Patches.HUDPatches { @@ -14,7 +15,7 @@ namespace NewHorizons.Patches.HUDPatches bool insideQM = __instance._quantumMoon != null && __instance._quantumMoon.IsPlayerInside(); bool insideRW = Locator.GetRingWorldController() != null && Locator.GetRingWorldController().isPlayerInside && ShipLogEntryHUDMarker.s_entryLocationID == "IP_RING_WORLD"; bool insideIP = hasEntryLocation && ShipLogEntryHUDMarker.s_entryLocation.IsWithinCloakField() || !(Locator.GetCloakFieldController() != null && Locator.GetCloakFieldController().isPlayerInsideCloak); - bool insideCloak = hasEntryLocation && ShipLogEntryHUDMarker.s_entryLocation.IsWithinCloakField() || !Components.CloakSectorController.isPlayerInside; + bool insideCloak = hasEntryLocation && ShipLogEntryHUDMarker.s_entryLocation.IsWithinCloakField() || !CloakSectorController.isPlayerInside; __instance._isVisible = !insideEYE && !insideQM && !insideRW && !__instance._translatorEquipped && !__instance._inConversation && hasEntryLocation && (__instance._isWearingHelmet || __instance._atFlightConsole) && insideIP && insideCloak; diff --git a/NewHorizons/Components/RingShape.cs b/NewHorizons/Utility/Geometry/RingShape.cs similarity index 97% rename from NewHorizons/Components/RingShape.cs rename to NewHorizons/Utility/Geometry/RingShape.cs index e8d30478..85f36519 100644 --- a/NewHorizons/Components/RingShape.cs +++ b/NewHorizons/Utility/Geometry/RingShape.cs @@ -1,6 +1,7 @@ -using System.Collections.Generic; +using System.Collections.Generic; using UnityEngine; -namespace NewHorizons.Components + +namespace NewHorizons.Utility.Geometry { public class RingShape : Shape { @@ -185,7 +186,7 @@ namespace NewHorizons.Components public override bool PointInside(Vector3 point) { - return (!_innerCylinderShape.PointInside(point) && _outerCylinderShape.PointInside(point)); + return !_innerCylinderShape.PointInside(point) && _outerCylinderShape.PointInside(point); } private List _shapesInInner = new List();