mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Rearrange components, add comet tail controller
This commit is contained in:
parent
5dd8e8db4e
commit
64e2e3ce19
@ -1,4 +1,5 @@
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.Components.Sectored;
|
||||
using NewHorizons.External.Modules;
|
||||
using NewHorizons.Utility;
|
||||
using NewHorizons.Utility.Files;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.Components.Sectored;
|
||||
using NewHorizons.External.Modules;
|
||||
using NewHorizons.Utility;
|
||||
using NewHorizons.Utility.Files;
|
||||
|
||||
@ -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<CometTailController>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.Components.Props;
|
||||
using NewHorizons.External.Modules.Props.Dialogue;
|
||||
using NewHorizons.Handlers;
|
||||
using NewHorizons.Utility;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.Components.Props;
|
||||
using NewHorizons.External.Modules.Props;
|
||||
using NewHorizons.Handlers;
|
||||
using NewHorizons.Utility;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
namespace NewHorizons.Components
|
||||
namespace NewHorizons.Components.EyeOfTheUniverse
|
||||
{
|
||||
public class EyeAstroObject : AstroObject
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
namespace NewHorizons.Components
|
||||
namespace NewHorizons.Components.EyeOfTheUniverse
|
||||
{
|
||||
/*
|
||||
public class EyeSunLightParamUpdater : MonoBehaviour
|
||||
@ -1,3 +1,4 @@
|
||||
using NewHorizons.Components.Props;
|
||||
using NewHorizons.Components.SizeControllers;
|
||||
using NewHorizons.Handlers;
|
||||
using NewHorizons.Utility.OuterWilds;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
namespace NewHorizons.Components
|
||||
namespace NewHorizons.Components.Props
|
||||
{
|
||||
public class NHCharacterDialogueTree : CharacterDialogueTree
|
||||
{
|
||||
@ -3,7 +3,7 @@ using NewHorizons.Handlers;
|
||||
using UnityEngine;
|
||||
using static SupernovaPlanetEffectController;
|
||||
|
||||
namespace NewHorizons.Components
|
||||
namespace NewHorizons.Components.Props
|
||||
{
|
||||
public class NHSupernovaPlanetEffectController : MonoBehaviour
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
namespace NewHorizons.Components
|
||||
namespace NewHorizons.Components.Props
|
||||
{
|
||||
public class NHTornadoWanderController : MonoBehaviour
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Components
|
||||
namespace NewHorizons.Components.Sectored
|
||||
{
|
||||
public class BrambleSectorController : MonoBehaviour, ISectorGroup
|
||||
{
|
||||
@ -1,5 +1,5 @@
|
||||
using UnityEngine;
|
||||
namespace NewHorizons.Components
|
||||
namespace NewHorizons.Components.Sectored
|
||||
{
|
||||
public class CloakSectorController : MonoBehaviour
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Components
|
||||
namespace NewHorizons.Components.Sectored
|
||||
{
|
||||
[RequireComponent(typeof(TessellatedSphereRenderer))]
|
||||
public class CloakedTessSphereSectorToggle : SectoredMonoBehaviour
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@ namespace NewHorizons.Components.SizeControllers
|
||||
public Material material;
|
||||
public Material proxyMaterial;
|
||||
|
||||
protected new void FixedUpdate()
|
||||
public override void FixedUpdate()
|
||||
{
|
||||
base.FixedUpdate();
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Components
|
||||
namespace NewHorizons.Components.Vessel
|
||||
{
|
||||
[UsedInUnityProject]
|
||||
public class VesselOrbLocker : MonoBehaviour
|
||||
@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Components
|
||||
namespace NewHorizons.Components.Vessel
|
||||
{
|
||||
[UsedInUnityProject]
|
||||
public class VesselSingularityRoot : MonoBehaviour
|
||||
@ -21,5 +21,10 @@ namespace NewHorizons.External.Modules
|
||||
/// Inner radius of the comet tail, defaults to match surfaceSize
|
||||
/// </summary>
|
||||
public float? innerRadius;
|
||||
|
||||
/// <summary>
|
||||
/// The body that the comet tail should always point away from
|
||||
/// </summary>
|
||||
public string primaryBody;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.Components.Props;
|
||||
using NewHorizons.Components.SizeControllers;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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<Shape> _shapesInInner = new List<Shape>();
|
||||
Loading…
x
Reference in New Issue
Block a user