mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
1.12.2 (#631)
## Bug fixes - Fix softlock affecting The Machine due to a secret hidden slide reel that destroyed everything (thanks Damian for finding this) - More than one cloak can now work at a time, and it only took me over a year (Fixes #108) - Stranger cloak will no longer appear in other systems (Fixes #600) - Fixed cloaks breaking if the planet has no ReferenceFrame enabled
This commit is contained in:
commit
b3831fa577
@ -12,7 +12,7 @@
|
|||||||
"Ernesto#Fish",
|
"Ernesto#Fish",
|
||||||
"With help from#Raicuparta\n#dgarroDC\n#jtsalomo\n#and the modding community",
|
"With help from#Raicuparta\n#dgarroDC\n#jtsalomo\n#and the modding community",
|
||||||
" ",
|
" ",
|
||||||
"Based off Marshmallow made by#Mister_Nebula",
|
"Based off Marshmallow made by#_nebula",
|
||||||
"With help from#AmazingAlek\n#Raicuparta\n#and the Outer Wilds discord server",
|
"With help from#AmazingAlek\n#Raicuparta\n#and the Outer Wilds discord server",
|
||||||
" ",
|
" ",
|
||||||
"This work is unofficial Fan Content and is not affiliated with Mobius Digital"
|
"This work is unofficial Fan Content and is not affiliated with Mobius Digital"
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using NewHorizons.Components.Sectored;
|
using NewHorizons.Components.Sectored;
|
||||||
using NewHorizons.External.Modules;
|
using NewHorizons.External.Modules;
|
||||||
|
using NewHorizons.Handlers;
|
||||||
using NewHorizons.Utility;
|
using NewHorizons.Utility;
|
||||||
using NewHorizons.Utility.Files;
|
using NewHorizons.Utility.Files;
|
||||||
using NewHorizons.Utility.OWML;
|
using NewHorizons.Utility.OWML;
|
||||||
@ -36,7 +37,8 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
var radius = module.radius;
|
var radius = module.radius;
|
||||||
|
|
||||||
var newCloak = Object.Instantiate(_prefab, sector?.transform ?? planetGO.transform);
|
var newCloak = _prefab.InstantiateInactive();
|
||||||
|
newCloak.transform.parent = sector?.transform ?? planetGO.transform;
|
||||||
newCloak.transform.position = planetGO.transform.position;
|
newCloak.transform.position = planetGO.transform.position;
|
||||||
newCloak.transform.name = "CloakingField";
|
newCloak.transform.name = "CloakingField";
|
||||||
newCloak.transform.localScale = Vector3.one * radius;
|
newCloak.transform.localScale = Vector3.one * radius;
|
||||||
@ -44,18 +46,25 @@ namespace NewHorizons.Builder.Body
|
|||||||
Object.Destroy(newCloak.GetComponent<PlayerCloakEntryRedirector>());
|
Object.Destroy(newCloak.GetComponent<PlayerCloakEntryRedirector>());
|
||||||
|
|
||||||
var cloakFieldController = newCloak.GetComponent<CloakFieldController>();
|
var cloakFieldController = newCloak.GetComponent<CloakFieldController>();
|
||||||
cloakFieldController._cloakScaleDist = radius * 2000 / 3000f;
|
cloakFieldController._cloakScaleDist = module.cloakScaleDist ?? (radius * 2000 / 3000f);
|
||||||
cloakFieldController._farCloakRadius = radius * 500 / 3000f;
|
cloakFieldController._farCloakRadius = module.farCloakRadius ?? (radius * 500 / 3000f);
|
||||||
cloakFieldController._innerCloakRadius = radius * 900 / 3000f;
|
cloakFieldController._innerCloakRadius = module.innerCloakRadius ?? (radius * 900 / 3000f);
|
||||||
cloakFieldController._nearCloakRadius = radius * 800 / 3000f;
|
cloakFieldController._nearCloakRadius = module.nearCloakRadius ?? (radius * 800 / 3000f);
|
||||||
|
|
||||||
cloakFieldController._referenceFrameVolume = OWRB._attachedRFVolume;
|
cloakFieldController._referenceFrameVolume = OWRB._attachedRFVolume;
|
||||||
cloakFieldController._exclusionSector = null;
|
cloakFieldController._exclusionSector = null;
|
||||||
cloakFieldController._cloakSphereVolume = (sector?.transform ?? planetGO.transform).GetComponentInChildren<OWTriggerVolume>();
|
|
||||||
|
var cloakVolumeObj = new GameObject("CloakVolume");
|
||||||
|
cloakVolumeObj.transform.parent = planetGO.transform;
|
||||||
|
cloakVolumeObj.transform.localPosition = Vector3.zero;
|
||||||
|
var cloakVolume = cloakVolumeObj.AddComponent<SphereShape>();
|
||||||
|
cloakVolume.radius = module.farCloakRadius ?? (radius * 500 / 3000f);
|
||||||
|
|
||||||
|
cloakFieldController._cloakSphereVolume = cloakVolumeObj.AddComponent<OWTriggerVolume>();
|
||||||
cloakFieldController._ringworldFadeRenderers = new OWRenderer[0];
|
cloakFieldController._ringworldFadeRenderers = new OWRenderer[0];
|
||||||
|
|
||||||
var cloakSectorController = newCloak.AddComponent<CloakSectorController>();
|
var cloakSectorController = newCloak.AddComponent<CloakSectorController>();
|
||||||
cloakSectorController.Init(newCloak.GetComponent<CloakFieldController>(), planetGO);
|
cloakSectorController.Init(cloakFieldController, planetGO);
|
||||||
|
|
||||||
var cloakAudioSource = newCloak.GetComponentInChildren<OWAudioSource>();
|
var cloakAudioSource = newCloak.GetComponentInChildren<OWAudioSource>();
|
||||||
cloakAudioSource._audioSource = cloakAudioSource.GetComponent<AudioSource>();
|
cloakAudioSource._audioSource = cloakAudioSource.GetComponent<AudioSource>();
|
||||||
@ -67,6 +76,8 @@ namespace NewHorizons.Builder.Body
|
|||||||
|
|
||||||
cloakSectorController.EnableCloak();
|
cloakSectorController.EnableCloak();
|
||||||
|
|
||||||
|
CloakHandler.RegisterCloak(cloakFieldController);
|
||||||
|
|
||||||
// To cloak from the start
|
// To cloak from the start
|
||||||
Delay.FireOnNextUpdate(cloakSectorController.OnPlayerExit);
|
Delay.FireOnNextUpdate(cloakSectorController.OnPlayerExit);
|
||||||
Delay.FireOnNextUpdate(hasCustomAudio ? cloakSectorController.TurnOnMusic : cloakSectorController.TurnOffMusic);
|
Delay.FireOnNextUpdate(hasCustomAudio ? cloakSectorController.TurnOnMusic : cloakSectorController.TurnOffMusic);
|
||||||
|
|||||||
@ -8,7 +8,13 @@ namespace NewHorizons.Builder.General
|
|||||||
{
|
{
|
||||||
public static GameObject Make(GameObject planetGO, OWRigidbody owrb, float sphereOfInfluence, ReferenceFrameModule module)
|
public static GameObject Make(GameObject planetGO, OWRigidbody owrb, float sphereOfInfluence, ReferenceFrameModule module)
|
||||||
{
|
{
|
||||||
if (!module.enabled) return null;
|
if (!module.enabled)
|
||||||
|
{
|
||||||
|
// We can't not build a reference frame volume, Cloak requires one to be there
|
||||||
|
module.maxTargetDistance = 0f;
|
||||||
|
module.hideInMap = true;
|
||||||
|
owrb.SetIsTargetable(false);
|
||||||
|
}
|
||||||
|
|
||||||
var rfGO = new GameObject("RFVolume");
|
var rfGO = new GameObject("RFVolume");
|
||||||
rfGO.transform.parent = planetGO.transform;
|
rfGO.transform.parent = planetGO.transform;
|
||||||
|
|||||||
@ -102,7 +102,6 @@ namespace NewHorizons.Builder.Props
|
|||||||
StreamingHandler.SetUpStreaming(prop, detail.keepLoaded ? null : sector);
|
StreamingHandler.SetUpStreaming(prop, detail.keepLoaded ? null : sector);
|
||||||
|
|
||||||
// Could check this in the for loop but I'm not sure what order we need to know about this in
|
// Could check this in the for loop but I'm not sure what order we need to know about this in
|
||||||
var isTorch = prop.GetComponent<VisionTorchItem>() != null;
|
|
||||||
isItem = false;
|
isItem = false;
|
||||||
|
|
||||||
foreach (var component in prop.GetComponentsInChildren<Component>(true))
|
foreach (var component in prop.GetComponentsInChildren<Component>(true))
|
||||||
@ -120,7 +119,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
{
|
{
|
||||||
if (FixUnsectoredComponent(component)) continue;
|
if (FixUnsectoredComponent(component)) continue;
|
||||||
}
|
}
|
||||||
else FixSectoredComponent(component, sector, isTorch, detail.keepLoaded);
|
else FixSectoredComponent(component, sector, detail.keepLoaded);
|
||||||
|
|
||||||
FixComponent(component, go, detail.ignoreSun);
|
FixComponent(component, go, detail.ignoreSun);
|
||||||
}
|
}
|
||||||
@ -219,7 +218,7 @@ namespace NewHorizons.Builder.Props
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fix components that have sectors. Has a specific fix if there is a VisionTorchItem on the object.
|
/// Fix components that have sectors. Has a specific fix if there is a VisionTorchItem on the object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void FixSectoredComponent(Component component, Sector sector, bool isTorch, bool keepLoaded)
|
private static void FixSectoredComponent(Component component, Sector sector, bool keepLoaded)
|
||||||
{
|
{
|
||||||
// keepLoaded should remove existing groups
|
// keepLoaded should remove existing groups
|
||||||
// renderers/colliders get enabled later so we dont have to do that here
|
// renderers/colliders get enabled later so we dont have to do that here
|
||||||
@ -265,10 +264,10 @@ namespace NewHorizons.Builder.Props
|
|||||||
socket._sector = sector;
|
socket._sector = sector;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix slide reel - Softlocks if this object is a vision torch
|
// TODO: Fix low res reels (probably in VanillaFix since its a vanilla bug)
|
||||||
else if(!isTorch && component is SlideCollectionContainer container)
|
else if(component is SlideReelItem)
|
||||||
{
|
{
|
||||||
sector.OnOccupantEnterSector.AddListener(_ => container.LoadStreamingTextures());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(component is NomaiRemoteCameraPlatform remoteCameraPlatform)
|
else if(component is NomaiRemoteCameraPlatform remoteCameraPlatform)
|
||||||
|
|||||||
@ -26,7 +26,7 @@ namespace NewHorizons.Builder.Volumes
|
|||||||
|
|
||||||
volume._collider = collider;
|
volume._collider = collider;
|
||||||
volume._shrinkBodies = info.shrinkBodies;
|
volume._shrinkBodies = info.shrinkBodies;
|
||||||
volume._onlyAffectsPlayerAndShip = info.onlyAffectsPlayerAndShip;
|
volume._onlyAffectsPlayerAndShip = info.onlyAffectsPlayerRelatedBodies;
|
||||||
|
|
||||||
go.SetActive(true);
|
go.SetActive(true);
|
||||||
|
|
||||||
|
|||||||
77
NewHorizons/Components/EOTE/CloakLocatorController.cs
Normal file
77
NewHorizons/Components/EOTE/CloakLocatorController.cs
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
using NewHorizons.Components.Stars;
|
||||||
|
using NewHorizons.Handlers;
|
||||||
|
using NewHorizons.Utility.OWML;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.Components.EOTE
|
||||||
|
{
|
||||||
|
internal class CloakLocatorController : MonoBehaviour
|
||||||
|
{
|
||||||
|
private float _currentAngle = float.MaxValue;
|
||||||
|
private CloakFieldController _currentController;
|
||||||
|
|
||||||
|
public void Start()
|
||||||
|
{
|
||||||
|
// Enable and disable all cloaks, else Stranger state is weird at the start
|
||||||
|
foreach (var cloak in CloakHandler.Cloaks)
|
||||||
|
{
|
||||||
|
SetCurrentCloak(cloak);
|
||||||
|
cloak.enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Always makes sure the Locator's cloak field controller is the one that is between the player and the sun
|
||||||
|
public void Update()
|
||||||
|
{
|
||||||
|
var sun = SunLightEffectsController.Instance?.transform;
|
||||||
|
if (sun != null)
|
||||||
|
{
|
||||||
|
// Keep tracking the angle to the current cloak
|
||||||
|
if (_currentController != null)
|
||||||
|
{
|
||||||
|
_currentAngle = CalculateAngleToCloak(_currentController.transform, sun);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compare the current cloak to all the other ones
|
||||||
|
foreach (var cloak in CloakHandler.Cloaks)
|
||||||
|
{
|
||||||
|
if (cloak == _currentController) continue;
|
||||||
|
|
||||||
|
var angle = CalculateAngleToCloak(cloak.transform, sun);
|
||||||
|
|
||||||
|
if (angle < _currentAngle && cloak != _currentController)
|
||||||
|
{
|
||||||
|
_currentAngle = angle;
|
||||||
|
SetCurrentCloak(cloak);
|
||||||
|
NHLogger.LogVerbose($"Changed cloak controller to {_currentController.GetAttachedOWRigidbody().name} angle {_currentAngle}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetCurrentCloak(CloakFieldController cloak)
|
||||||
|
{
|
||||||
|
if (_currentController != null)
|
||||||
|
{
|
||||||
|
_currentController.enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_currentController = cloak;
|
||||||
|
|
||||||
|
if (_currentController != null)
|
||||||
|
{
|
||||||
|
_currentController.enabled = true;
|
||||||
|
Locator.RegisterCloakFieldController(_currentController);
|
||||||
|
_currentController.UpdateCloakVisualsState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private float CalculateAngleToCloak(Transform cloak, Transform sun)
|
||||||
|
{
|
||||||
|
var playerVector = Locator.GetPlayerTransform().position - sun.position;
|
||||||
|
var cloakVector = cloak.position - sun.position;
|
||||||
|
|
||||||
|
return Vector3.Angle(playerVector, cloakVector);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
NewHorizons/External/Configs/PlanetConfig.cs
vendored
8
NewHorizons/External/Configs/PlanetConfig.cs
vendored
@ -616,6 +616,14 @@ namespace NewHorizons.External.Configs
|
|||||||
CometTail.rotationOverride = Base.cometTailRotation;
|
CometTail.rotationOverride = Base.cometTailRotation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Volumes?.destructionVolumes != null)
|
||||||
|
{
|
||||||
|
foreach (var destructionVolume in Volumes.destructionVolumes)
|
||||||
|
{
|
||||||
|
if (destructionVolume.onlyAffectsPlayerAndShip) destructionVolume.onlyAffectsPlayerRelatedBodies = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
17
NewHorizons/External/Modules/CloakModule.cs
vendored
17
NewHorizons/External/Modules/CloakModule.cs
vendored
@ -7,11 +7,24 @@ namespace NewHorizons.External.Modules
|
|||||||
public class CloakModule
|
public class CloakModule
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Radius of the cloaking field around the planet. It's a bit finicky so experiment with different values. If you
|
/// Radius of the cloaking field around the planet. For the Stranger this is 3000
|
||||||
/// don't want a cloak, leave this as 0.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float radius;
|
public float radius;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Not sure what this is. For the Stranger it is 2000. Optional (will default to be proportional to the cloak radius).
|
||||||
|
/// </summary>
|
||||||
|
public float? cloakScaleDist;
|
||||||
|
|
||||||
|
/// Not sure what this is. For the Stranger it is 900. Optional (will default to be proportional to the cloak radius).
|
||||||
|
public float? innerCloakRadius;
|
||||||
|
|
||||||
|
/// Not sure what this is. For the Stranger it is 800. Optional (will default to be proportional to the cloak radius).
|
||||||
|
public float? nearCloakRadius;
|
||||||
|
|
||||||
|
/// Not sure what this is. For the Stranger it is 500. Optional (will default to be proportional to the cloak radius).
|
||||||
|
public float? farCloakRadius;
|
||||||
|
|
||||||
[Obsolete("audioClip is deprecated, please use audio instead")]
|
[Obsolete("audioClip is deprecated, please use audio instead")]
|
||||||
public string audioClip;
|
public string audioClip;
|
||||||
|
|
||||||
|
|||||||
@ -7,12 +7,14 @@ namespace NewHorizons.External.Modules.Volumes
|
|||||||
public class ProbeModule
|
public class ProbeModule
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add probe destruction volumes to this planet. These will delete your probe.
|
/// Add probe destruction volumes to this planet.
|
||||||
|
/// These will delete your probe just like the eye of the universe does.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VolumeInfo[] destructionVolumes;
|
public VolumeInfo[] destructionVolumes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add probe safety volumes to this planet. These will stop the probe destruction volumes from working.
|
/// Add probe safety volumes to this planet.
|
||||||
|
/// These will stop the probe destruction volumes from working.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VolumeInfo[] safetyVolumes;
|
public VolumeInfo[] safetyVolumes;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,8 @@ namespace NewHorizons.External.Modules.Volumes
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add anti travel music rulesets to this planet.
|
/// Add anti travel music rulesets to this planet.
|
||||||
|
/// This means no space/traveling music while inside the ruleset/volume.
|
||||||
|
/// Usually used on planets.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VolumeInfo[] antiTravelMusicRulesets;
|
public VolumeInfo[] antiTravelMusicRulesets;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
|
||||||
namespace NewHorizons.External.Modules.Volumes.VolumeInfos
|
namespace NewHorizons.External.Modules.Volumes.VolumeInfos
|
||||||
@ -12,9 +13,11 @@ namespace NewHorizons.External.Modules.Volumes.VolumeInfos
|
|||||||
[DefaultValue(true)] public bool shrinkBodies = true;
|
[DefaultValue(true)] public bool shrinkBodies = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this volume only affects the player and ship.
|
/// Whether this volume only affects the player, ship, probe/scout, model rocket ship, and nomai shuttle.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool onlyAffectsPlayerAndShip;
|
public bool onlyAffectsPlayerRelatedBodies;
|
||||||
|
|
||||||
|
[Obsolete] public bool onlyAffectsPlayerAndShip;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@ namespace NewHorizons.External.Modules.Volumes
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add destruction volumes to this planet.
|
/// Add destruction volumes to this planet.
|
||||||
|
/// Destroys bodies if they enter this volume. Can kill the player and recall the scout probe.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DestructionVolumeInfo[] destructionVolumes;
|
public DestructionVolumeInfo[] destructionVolumes;
|
||||||
|
|
||||||
@ -23,31 +24,38 @@ namespace NewHorizons.External.Modules.Volumes
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add hazard volumes to this planet.
|
/// Add hazard volumes to this planet.
|
||||||
|
/// Causes damage to player when inside this volume.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HazardVolumeInfo[] hazardVolumes;
|
public HazardVolumeInfo[] hazardVolumes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add interference volumes to this planet.
|
/// Add interference volumes to this planet.
|
||||||
|
/// Hides HUD markers of ship scout/probe and prevents scout photos if you are not inside the volume together with ship or scout probe.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VolumeInfo[] interferenceVolumes;
|
public VolumeInfo[] interferenceVolumes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add insulating volumes to this planet. These will stop electricty hazard volumes from affecting you (just like the jellyfish).
|
/// Add insulating volumes to this planet.
|
||||||
|
/// These will stop electricty hazard volumes from affecting you (just like the jellyfish).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VolumeInfo[] insulatingVolumes;
|
public VolumeInfo[] insulatingVolumes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add light source volumes to this planet. These will activate rafts and other light detectors.
|
/// Add light source volumes to this planet.
|
||||||
|
/// These will activate rafts and other light detectors.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VolumeInfo[] lightSourceVolumes;
|
public VolumeInfo[] lightSourceVolumes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add map restriction volumes to this planet.
|
/// Add map restriction volumes to this planet.
|
||||||
|
/// The map will be disabled when inside this volume.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VolumeInfo[] mapRestrictionVolumes;
|
public VolumeInfo[] mapRestrictionVolumes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add notification volumes to this planet.
|
/// Add notification volumes to this planet.
|
||||||
|
/// Sends a notification to the player just like ghost matter does when you get too close
|
||||||
|
/// and also to the ship just like when you damage a component on the ship.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public NotificationVolumeInfo[] notificationVolumes;
|
public NotificationVolumeInfo[] notificationVolumes;
|
||||||
|
|
||||||
@ -62,7 +70,8 @@ namespace NewHorizons.External.Modules.Volumes
|
|||||||
public ProbeModule probe;
|
public ProbeModule probe;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add reference frame blocker volumes to this planet. These will stop the player from seeing/targeting any reference frames.
|
/// Add reference frame blocker volumes to this planet.
|
||||||
|
/// These will stop the player from seeing/targeting any reference frames.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public VolumeInfo[] referenceFrameBlockerVolumes;
|
public VolumeInfo[] referenceFrameBlockerVolumes;
|
||||||
|
|
||||||
@ -82,7 +91,8 @@ namespace NewHorizons.External.Modules.Volumes
|
|||||||
public RulesetModule rulesets;
|
public RulesetModule rulesets;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add speed trap volumes to this planet. Slows down the player when they enter this volume.
|
/// Add speed trap volumes to this planet.
|
||||||
|
/// Slows down the player when they enter this volume.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SpeedTrapVolumeInfo[] speedTrapVolumes;
|
public SpeedTrapVolumeInfo[] speedTrapVolumes;
|
||||||
|
|
||||||
|
|||||||
91
NewHorizons/Handlers/CloakHandler.cs
Normal file
91
NewHorizons/Handlers/CloakHandler.cs
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
using NewHorizons.Components.EOTE;
|
||||||
|
using NewHorizons.OtherMods.VoiceActing;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace NewHorizons.Handlers
|
||||||
|
{
|
||||||
|
public static class CloakHandler
|
||||||
|
{
|
||||||
|
private static HashSet<CloakFieldController> _cloaks;
|
||||||
|
public static HashSet<CloakFieldController> Cloaks => _cloaks;
|
||||||
|
|
||||||
|
private static bool _flagStrangerDisabled;
|
||||||
|
public static bool FlagStrangerDisabled
|
||||||
|
{
|
||||||
|
get => _flagStrangerDisabled;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_flagStrangerDisabled = value;
|
||||||
|
if (value && _strangerCloak != null)
|
||||||
|
{
|
||||||
|
DeregisterCloak(_strangerCloak);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static bool VisibleStrangerInstalled => Main.Instance.ModHelper.Interaction.ModExists("xen.Decloaked");
|
||||||
|
|
||||||
|
private static CloakFieldController _strangerCloak;
|
||||||
|
private static CloakLocatorController _cloakLocator;
|
||||||
|
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
_cloaks = new();
|
||||||
|
FlagStrangerDisabled = false;
|
||||||
|
_strangerCloak = null;
|
||||||
|
_cloakLocator = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OnSystemReady()
|
||||||
|
{
|
||||||
|
// If NH is disabling the stranger it will not be gone yet, however other mods might have gotten rid of it
|
||||||
|
var stranger = Locator.GetAstroObject(AstroObject.Name.RingWorld)?.gameObject;
|
||||||
|
if (stranger != null && stranger.activeInHierarchy && !FlagStrangerDisabled && !VisibleStrangerInstalled)
|
||||||
|
{
|
||||||
|
_strangerCloak = stranger.GetComponentInChildren<CloakFieldController>();
|
||||||
|
RegisterCloak(_strangerCloak);
|
||||||
|
}
|
||||||
|
|
||||||
|
_cloakLocator = Locator.GetRootTransform().gameObject.AddComponent<CloakLocatorController>();
|
||||||
|
foreach (var cloak in _cloaks)
|
||||||
|
{
|
||||||
|
cloak.enabled = false;
|
||||||
|
cloak.UpdateCloakVisualsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RegisterCloak(CloakFieldController cloak)
|
||||||
|
{
|
||||||
|
_cloaks.Add(cloak);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DeregisterCloak(CloakFieldController cloak)
|
||||||
|
{
|
||||||
|
if (_cloaks.Contains(cloak))
|
||||||
|
{
|
||||||
|
cloak.enabled = false;
|
||||||
|
cloak.UpdateCloakVisualsState();
|
||||||
|
_cloaks.Remove(cloak);
|
||||||
|
|
||||||
|
Refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Refresh()
|
||||||
|
{
|
||||||
|
// Make sure we aren't using the disabled cloak
|
||||||
|
Locator.RegisterCloakFieldController(_cloaks.FirstOrDefault());
|
||||||
|
|
||||||
|
if (!_cloaks.Any())
|
||||||
|
{
|
||||||
|
Locator.RegisterCloakFieldController(null);
|
||||||
|
Shader.DisableKeyword("_CLOAKINGFIELDENABLED");
|
||||||
|
_cloakLocator.SetCurrentCloak(null);
|
||||||
|
_cloakLocator.enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -83,6 +83,12 @@ namespace NewHorizons.Handlers
|
|||||||
{
|
{
|
||||||
NHLogger.LogVerbose($"Removing [{ao.name}]");
|
NHLogger.LogVerbose($"Removing [{ao.name}]");
|
||||||
|
|
||||||
|
if (ao.GetAstroObjectName() == AstroObject.Name.RingWorld)
|
||||||
|
{
|
||||||
|
CloakHandler.FlagStrangerDisabled = true;
|
||||||
|
if (Locator._cloakFieldController.GetComponentInParent<AstroObject>() == ao) Locator._cloakFieldController = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (ao.gameObject == null || !ao.gameObject.activeInHierarchy)
|
if (ao.gameObject == null || !ao.gameObject.activeInHierarchy)
|
||||||
{
|
{
|
||||||
NHLogger.LogVerbose($"[{ao.name}] was already removed");
|
NHLogger.LogVerbose($"[{ao.name}] was already removed");
|
||||||
|
|||||||
@ -8,7 +8,7 @@ using static NewHorizons.External.Configs.StarSystemConfig;
|
|||||||
|
|
||||||
namespace NewHorizons.Handlers
|
namespace NewHorizons.Handlers
|
||||||
{
|
{
|
||||||
public class VesselCoordinatePromptHandler
|
public static class VesselCoordinatePromptHandler
|
||||||
{
|
{
|
||||||
private static List<Tuple<string, string, ScreenPrompt>> _factSystemIDPrompt;
|
private static List<Tuple<string, string, ScreenPrompt>> _factSystemIDPrompt;
|
||||||
// TODO: move this to ImageUtilities
|
// TODO: move this to ImageUtilities
|
||||||
|
|||||||
@ -403,6 +403,7 @@ namespace NewHorizons
|
|||||||
SingularityBuilder.Init();
|
SingularityBuilder.Init();
|
||||||
AtmosphereBuilder.Init();
|
AtmosphereBuilder.Init();
|
||||||
BrambleNodeBuilder.Init(BodyDict[CurrentStarSystem].Select(x => x.Config).Where(x => x.Bramble?.dimension != null).ToArray());
|
BrambleNodeBuilder.Init(BodyDict[CurrentStarSystem].Select(x => x.Config).Where(x => x.Bramble?.dimension != null).ToArray());
|
||||||
|
CloakHandler.Init();
|
||||||
|
|
||||||
if (isSolarSystem)
|
if (isSolarSystem)
|
||||||
{
|
{
|
||||||
@ -570,6 +571,8 @@ namespace NewHorizons
|
|||||||
PlayerSpawnHandler.OnSystemReady(shouldWarpInFromShip, shouldWarpInFromVessel);
|
PlayerSpawnHandler.OnSystemReady(shouldWarpInFromShip, shouldWarpInFromVessel);
|
||||||
|
|
||||||
VesselCoordinatePromptHandler.RegisterPrompts(SystemDict.Where(system => system.Value.Config.Vessel?.coords != null).Select(x => x.Value).ToList());
|
VesselCoordinatePromptHandler.RegisterPrompts(SystemDict.Where(system => system.Value.Config.Vessel?.coords != null).Select(x => x.Value).ToList());
|
||||||
|
|
||||||
|
CloakHandler.OnSystemReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnableWarpDrive()
|
public void EnableWarpDrive()
|
||||||
@ -811,6 +814,12 @@ namespace NewHorizons
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LoadManager.GetCurrentScene() == OWScene.SolarSystem || LoadManager.GetCurrentScene() == OWScene.EyeOfTheUniverse)
|
||||||
|
{
|
||||||
|
// Slide reel unloading is tied to being removed from the sector, so we do that here to prevent a softlock
|
||||||
|
Locator.GetPlayerSectorDetector().RemoveFromAllSectors();
|
||||||
|
}
|
||||||
|
|
||||||
if (IsChangingStarSystem) return;
|
if (IsChangingStarSystem) return;
|
||||||
|
|
||||||
IsWarpingFromShip = warp;
|
IsWarpingFromShip = warp;
|
||||||
|
|||||||
@ -15,8 +15,8 @@
|
|||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="OWML" Version="2.9.0" />
|
|
||||||
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.456" />
|
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.456" />
|
||||||
|
<PackageReference Include="OWML" Version="2.9.3" />
|
||||||
<Reference Include="../Lib/System.ComponentModel.Annotations.dll" />
|
<Reference Include="../Lib/System.ComponentModel.Annotations.dll" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -745,7 +745,36 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"radius": {
|
"radius": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"description": "Radius of the cloaking field around the planet. It's a bit finicky so experiment with different values. If you\ndon't want a cloak, leave this as 0.",
|
"description": "Radius of the cloaking field around the planet. For the Stranger this is 3000",
|
||||||
|
"format": "float"
|
||||||
|
},
|
||||||
|
"cloakScaleDist": {
|
||||||
|
"type": [
|
||||||
|
"null",
|
||||||
|
"number"
|
||||||
|
],
|
||||||
|
"description": "Not sure what this is. For the Stranger it is 2000. Optional (will default to be proportional to the cloak radius).",
|
||||||
|
"format": "float"
|
||||||
|
},
|
||||||
|
"innerCloakRadius": {
|
||||||
|
"type": [
|
||||||
|
"null",
|
||||||
|
"number"
|
||||||
|
],
|
||||||
|
"format": "float"
|
||||||
|
},
|
||||||
|
"nearCloakRadius": {
|
||||||
|
"type": [
|
||||||
|
"null",
|
||||||
|
"number"
|
||||||
|
],
|
||||||
|
"format": "float"
|
||||||
|
},
|
||||||
|
"farCloakRadius": {
|
||||||
|
"type": [
|
||||||
|
"null",
|
||||||
|
"number"
|
||||||
|
],
|
||||||
"format": "float"
|
"format": "float"
|
||||||
},
|
},
|
||||||
"audio": {
|
"audio": {
|
||||||
@ -3263,7 +3292,7 @@
|
|||||||
},
|
},
|
||||||
"destructionVolumes": {
|
"destructionVolumes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add destruction volumes to this planet.",
|
"description": "Add destruction volumes to this planet.\nDestroys bodies if they enter this volume. Can kill the player and recall the scout probe.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/DestructionVolumeInfo"
|
"$ref": "#/definitions/DestructionVolumeInfo"
|
||||||
}
|
}
|
||||||
@ -3277,42 +3306,42 @@
|
|||||||
},
|
},
|
||||||
"hazardVolumes": {
|
"hazardVolumes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add hazard volumes to this planet.",
|
"description": "Add hazard volumes to this planet.\nCauses damage to player when inside this volume.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/HazardVolumeInfo"
|
"$ref": "#/definitions/HazardVolumeInfo"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"interferenceVolumes": {
|
"interferenceVolumes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add interference volumes to this planet.",
|
"description": "Add interference volumes to this planet.\nHides HUD markers of ship scout/probe and prevents scout photos if you are not inside the volume together with ship or scout probe.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/VolumeInfo"
|
"$ref": "#/definitions/VolumeInfo"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"insulatingVolumes": {
|
"insulatingVolumes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add insulating volumes to this planet. These will stop electricty hazard volumes from affecting you (just like the jellyfish).",
|
"description": "Add insulating volumes to this planet.\nThese will stop electricty hazard volumes from affecting you (just like the jellyfish).",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/VolumeInfo"
|
"$ref": "#/definitions/VolumeInfo"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lightSourceVolumes": {
|
"lightSourceVolumes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add light source volumes to this planet. These will activate rafts and other light detectors.",
|
"description": "Add light source volumes to this planet.\nThese will activate rafts and other light detectors.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/VolumeInfo"
|
"$ref": "#/definitions/VolumeInfo"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mapRestrictionVolumes": {
|
"mapRestrictionVolumes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add map restriction volumes to this planet.",
|
"description": "Add map restriction volumes to this planet.\nThe map will be disabled when inside this volume.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/VolumeInfo"
|
"$ref": "#/definitions/VolumeInfo"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"notificationVolumes": {
|
"notificationVolumes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add notification volumes to this planet.",
|
"description": "Add notification volumes to this planet.\nSends a notification to the player just like ghost matter does when you get too close\nand also to the ship just like when you damage a component on the ship.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/NotificationVolumeInfo"
|
"$ref": "#/definitions/NotificationVolumeInfo"
|
||||||
}
|
}
|
||||||
@ -3330,7 +3359,7 @@
|
|||||||
},
|
},
|
||||||
"referenceFrameBlockerVolumes": {
|
"referenceFrameBlockerVolumes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add reference frame blocker volumes to this planet. These will stop the player from seeing/targeting any reference frames.",
|
"description": "Add reference frame blocker volumes to this planet.\nThese will stop the player from seeing/targeting any reference frames.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/VolumeInfo"
|
"$ref": "#/definitions/VolumeInfo"
|
||||||
}
|
}
|
||||||
@ -3355,7 +3384,7 @@
|
|||||||
},
|
},
|
||||||
"speedTrapVolumes": {
|
"speedTrapVolumes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add speed trap volumes to this planet. Slows down the player when they enter this volume.",
|
"description": "Add speed trap volumes to this planet.\nSlows down the player when they enter this volume.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/SpeedTrapVolumeInfo"
|
"$ref": "#/definitions/SpeedTrapVolumeInfo"
|
||||||
}
|
}
|
||||||
@ -3494,9 +3523,9 @@
|
|||||||
"description": "Whether the bodies will shrink when they enter this volume or just disappear instantly.",
|
"description": "Whether the bodies will shrink when they enter this volume or just disappear instantly.",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
"onlyAffectsPlayerAndShip": {
|
"onlyAffectsPlayerRelatedBodies": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Whether this volume only affects the player and ship."
|
"description": "Whether this volume only affects the player, ship, probe/scout, model rocket ship, and nomai shuttle."
|
||||||
},
|
},
|
||||||
"radius": {
|
"radius": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
@ -3859,14 +3888,14 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"destructionVolumes": {
|
"destructionVolumes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add probe destruction volumes to this planet. These will delete your probe.",
|
"description": "Add probe destruction volumes to this planet.\nThese will delete your probe just like the eye of the universe does.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/VolumeInfo"
|
"$ref": "#/definitions/VolumeInfo"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"safetyVolumes": {
|
"safetyVolumes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add probe safety volumes to this planet. These will stop the probe destruction volumes from working.",
|
"description": "Add probe safety volumes to this planet.\nThese will stop the probe destruction volumes from working.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/VolumeInfo"
|
"$ref": "#/definitions/VolumeInfo"
|
||||||
}
|
}
|
||||||
@ -3968,14 +3997,14 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"antiTravelMusicRulesets": {
|
"antiTravelMusicRulesets": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add anti travel music rulesets to this planet.",
|
"description": "Add anti travel music rulesets to this planet.\nThis means no space/traveling music while inside the ruleset/volume.\nUsually used on planets.",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/VolumeInfo"
|
"$ref": "#/definitions/VolumeInfo"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"playerImpactRulesets": {
|
"playerImpactRulesets": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Add player impact rulesets to this planet.",
|
"description": "Add player impact rulesets to this planet. ",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/PlayerImpactRulesetInfo"
|
"$ref": "#/definitions/PlayerImpactRulesetInfo"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,8 +4,8 @@
|
|||||||
"author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book",
|
"author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book",
|
||||||
"name": "New Horizons",
|
"name": "New Horizons",
|
||||||
"uniqueName": "xen.NewHorizons",
|
"uniqueName": "xen.NewHorizons",
|
||||||
"version": "1.12.1",
|
"version": "1.12.2",
|
||||||
"owmlVersion": "2.9.0",
|
"owmlVersion": "2.9.3",
|
||||||
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
|
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
|
||||||
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],
|
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],
|
||||||
"pathsToPreserve": [ "planets", "systems", "translations" ]
|
"pathsToPreserve": [ "planets", "systems", "translations" ]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user