Skip to content

Commit

Permalink
1.25.1 (#1019)
Browse files Browse the repository at this point in the history
Prop placer and the debug menu have been removed. These features were
either super broken or never even fully implemented, and since Clay is
now heavily retired from NH they were never going to get fixed. People
are better off using Unity or the raycasting tool instead.

## Minor Features
- Prometheus stole fire from the gods and gave it to man. For this he
was chained to a rock and tortured for eternity. Resolves #564 (quantum
lightning).
- Can now control if socketed quantum objects align with gravity or use
socket rotation, and if they randomize rotation around the local Y axis.
Fixes #751.

## Improvements
- Makes quantum organization cleaner (split into separate lists by the
type of quantum group, state or socket).
- Quantum socket groups can now have an equal number of props to sockets
and will work accordingly. Fixes #597
- ID on sector component is now set to the name of the body
- Changed focal point sphere of influence to be 1.5x of the distance
between the 2 bodies instead of being 0

## Bug fixes
- Fixed Rich Presence not working on focal points
- Minimap is now disabled automatically on focal points
- Coordinate interface orb no longer tries to return to its raised
position on Vessel when first entering a custom star system. Fixes #958
  • Loading branch information
xen-42 authored Jan 14, 2025
2 parents 7dbaa4c + d5ad5bf commit 928033f
Show file tree
Hide file tree
Showing 55 changed files with 3,744 additions and 4,072 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ManifestFileVersion: 0
CRC: 2356174904
CRC: 2772415118
Hashes:
AssetFileHash:
serializedVersion: 2
Hash: c9b4a60ca4efa0ba50065dea6e758ce7
Hash: a1c50cfbd83ea025ed5ff8a920ceb135
TypeTreeHash:
serializedVersion: 2
Hash: 65942a71d50cdc9f2387a8fa9383a3f8
Hash: 8a96558a3d9470a68866aeaaa30830cf
HashAppended: 0
ClassTypes:
- Class: 1
Expand Down Expand Up @@ -87,6 +87,8 @@ ClassTypes:
Script: {fileID: 11500000, guid: 13ab18a571ddf1b4f8dc92e3fa31b22e, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: 3d5c87c5a00ca19449219c7c54f41ee7, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: db82bd26294f5b848aaa8cb1ad0dc252, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: 840ab63696e59254eb425242136805dd, type: 3}
- Class: 114
Expand Down Expand Up @@ -198,5 +200,6 @@ Assets:
- Assets/SlideReels/Prefab_DW_Reel_8.prefab
- Assets/Vessel_Body.prefab
- Assets/AmbientLight_QM.png
- Assets/QuantumLightning/Prefab_EYE_QuantumLightningObject.prefab
- Assets/SlideReels/Prefab_IP_Reel_7.prefab
Dependencies: []
File renamed without changes.
2 changes: 1 addition & 1 deletion NewHorizons/Builder/Atmosphere/CloudsBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal static void InitPrefabs()
}
_qmBottomMeshGroup.variants = variants.ToArray();
}
if (_transparentCloud == null) _transparentCloud = Main.NHAssetBundle.LoadAsset<Material>("Assets/Resources/TransparentCloud.mat");
if (_transparentCloud == null) _transparentCloud = AssetBundleUtilities.NHAssetBundle.LoadAsset<Material>("Assets/Resources/TransparentCloud.mat");
}

public static void Make(GameObject planetGO, Sector sector, AtmosphereModule atmo, bool cloaked, IModBehaviour mod)
Expand Down
3 changes: 2 additions & 1 deletion NewHorizons/Builder/Body/BrambleDimensionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using NewHorizons.External.Modules;
using NewHorizons.External.Modules.Props;
using NewHorizons.Utility;
using NewHorizons.Utility.Files;
using NewHorizons.Utility.OWML;
using OWML.Common;
using System.Collections.Generic;
Expand Down Expand Up @@ -78,7 +79,7 @@ internal static void InitPrefabs()
if (_exitWarps == null) _exitWarps = SearchUtilities.Find("DB_HubDimension_Body/Sector_HubDimension/Interactables_HubDimension/OuterWarp_Hub").InstantiateInactive().Rename("Prefab_Bramble_OuterWarp").DontDestroyOnLoad();
if (_repelVolume == null) _repelVolume = SearchUtilities.Find("DB_HubDimension_Body/BrambleRepelVolume").InstantiateInactive().Rename("Prefab_Bramble_RepelVolume").DontDestroyOnLoad();
if (_material == null) _material = new Material(GameObject.Find("DB_PioneerDimension_Body/Sector_PioneerDimension").GetComponent<EffectRuleset>()._material).DontDestroyOnLoad();
if (_wallCollision == null) _wallCollision = Main.NHPrivateAssetBundle.LoadAsset<GameObject>("BrambleCollision");
if (_wallCollision == null) _wallCollision = AssetBundleUtilities.NHPrivateAssetBundle.LoadAsset<GameObject>("BrambleCollision");
}

public static GameObject Make(NewHorizonsBody body, GameObject go, NHAstroObject ao, Sector sector, IModBehaviour mod, OWRigidbody owRigidBody)
Expand Down
2 changes: 1 addition & 1 deletion NewHorizons/Builder/Body/HeightMapBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static GameObject Make(GameObject planetGO, Sector sector, HeightMapModul
cubeSphere.SetActive(false);
cubeSphere.transform.SetParent(sector?.transform ?? planetGO.transform, false);

if (PlanetShader == null) PlanetShader = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/SphereTextureWrapperTriplanar.shader");
if (PlanetShader == null) PlanetShader = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/SphereTextureWrapperTriplanar.shader");

var stretch = module.stretch != null ? (Vector3)module.stretch : Vector3.one;

Expand Down
8 changes: 4 additions & 4 deletions NewHorizons/Builder/Body/RingBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ public static GameObject MakeRingGraphics(GameObject rootObject, Sector sector,
var ringMesh = ringMF.mesh;
var ringMR = ringGO.AddComponent<MeshRenderer>();

if (RingShader == null) RingShader = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring.shader");
if (UnlitRingShader == null) UnlitRingShader = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitTransparent.shader");
if (RingShader1Pixel == null) RingShader1Pixel = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring1Pixel.shader");
if (UnlitRingShader1Pixel == null) UnlitRingShader1Pixel = Main.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitRing1Pixel.shader");
if (RingShader == null) RingShader = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring.shader");
if (UnlitRingShader == null) UnlitRingShader = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitTransparent.shader");
if (RingShader1Pixel == null) RingShader1Pixel = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/Ring1Pixel.shader");
if (UnlitRingShader1Pixel == null) UnlitRingShader1Pixel = AssetBundleUtilities.NHAssetBundle.LoadAsset<Shader>("Assets/Shaders/UnlitRing1Pixel.shader");

var mat = new Material(ring.unlit ? UnlitRingShader : RingShader);
if (ringTexture.width == 1)
Expand Down
1 change: 1 addition & 0 deletions NewHorizons/Builder/Body/StellarRemnantBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static GameObject Make(GameObject go, OWRigidbody rb, float soi, IModBeha
NHLogger.Log($"Creating stellar remnant for [{star.Config.name}]");

var sector = SectorBuilder.Make(go, rb, soi);
sector._idString = star.Config.name;
sector.name = "StellarRemnant";

sector.gameObject.SetActive(false);
Expand Down
2 changes: 1 addition & 1 deletion NewHorizons/Builder/General/AmbientLightBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static Light Make(GameObject planetGO, Sector sector, AmbientLightModule
}
else
{
var baseCubemap = Main.NHPrivateAssetBundle.LoadAsset<Cubemap>("AmbientLight_QM");
var baseCubemap = AssetBundleUtilities.NHPrivateAssetBundle.LoadAsset<Cubemap>("AmbientLight_QM");
var cubemap = new Cubemap(baseCubemap.width, baseCubemap.format, baseCubemap.mipmapCount != 1);
cubemap.name = key;
cubemap.wrapMode = baseCubemap.wrapMode;
Expand Down
9 changes: 5 additions & 4 deletions NewHorizons/Builder/General/GravityBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ public static GravityVolume Make(GameObject planetGO, AstroObject ao, OWRigidbod
var gravityRadius = GM / 0.1f;
if (exponent == 2f) gravityRadius = Mathf.Sqrt(gravityRadius);

if (config.FocalPoint != null) gravityRadius = 0; // keep it at the lowest possible
else if (config.Base.soiOverride != 0f) gravityRadius = config.Base.soiOverride;
else if (config.Star != null) gravityRadius = Mathf.Min(gravityRadius, 15 * config.Base.surfaceSize);
// To let you actually orbit things the way you would expect we cap this at 4x the diameter if its not a star (this is what giants deep has)
if (config.Star == null) gravityRadius = Mathf.Min(gravityRadius, 4 * config.Base.surfaceSize);
else gravityRadius = Mathf.Min(gravityRadius, 15 * config.Base.surfaceSize);
if (config.Base.soiOverride != 0f) gravityRadius = config.Base.soiOverride;
else gravityRadius = Mathf.Min(gravityRadius, 4 * config.Base.surfaceSize);

var gravityGO = new GameObject("GravityWell");
gravityGO.transform.parent = planetGO.transform;
Expand Down Expand Up @@ -48,7 +49,7 @@ public static GravityVolume Make(GameObject planetGO, AstroObject ao, OWRigidbod
if (config.Base.surfaceGravity == 0) alignmentRadius = 0;

gravityVolume._alignmentRadius = config.Base.gravityAlignmentRadiusOverride ?? alignmentRadius;
gravityVolume._upperSurfaceRadius = config.Base.surfaceSize;
gravityVolume._upperSurfaceRadius = config.FocalPoint != null ? 0 : config.Base.surfaceSize;
gravityVolume._lowerSurfaceRadius = 0;
gravityVolume._layer = 3;
gravityVolume._priority = config.Base.gravityVolumePriority;
Expand Down
11 changes: 6 additions & 5 deletions NewHorizons/Builder/Orbital/FocalPointBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ public static void ValidateConfig(PlanetConfig config)
config.Base.surfaceGravity = gravitationalMass * GravityVolume.GRAVITATIONAL_CONSTANT;
config.Base.gravityFallOff = primary.Config.Base.gravityFallOff;

// Other stuff to make the barycenter not interact with anything in any way
config.Base.soiOverride = 0;

var separation = primary.Config.Orbit.semiMajorAxis + secondary.Config.Orbit.semiMajorAxis;
config.ReferenceFrame.bracketRadius = separation;
config.ReferenceFrame.targetColliderRadius = separation;
var separationRadius = (separation / 2);
config.Base.soiOverride = separationRadius * 1.5f;
config.ReferenceFrame.bracketRadius = separationRadius;
config.ReferenceFrame.targetColliderRadius = separationRadius;

config.Base.showMinimap = false;
}

private static float GetGravitationalMass(PlanetConfig config)
Expand Down
31 changes: 16 additions & 15 deletions NewHorizons/Builder/Props/DetailBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,23 @@ namespace NewHorizons.Builder.Props
{
public static class DetailBuilder
{
private static readonly Dictionary<DetailInfo, GameObject> _detailInfoToCorrespondingSpawnedGameObject = new();
private static readonly Dictionary<(Sector, string), (GameObject prefab, bool isItem)> _fixedPrefabCache = new();
private static GameObject _emptyPrefab;

private static readonly Dictionary<DetailInfo, GameObject> _detailInfoToGameObject = new();

public static GameObject GetGameObjectFromDetailInfo(DetailInfo info)
{
if (_detailInfoToGameObject.ContainsKey(info))
{
return _detailInfoToGameObject[info];
}
else
{
return null;
}
}

static DetailBuilder()
{
SceneManager.sceneUnloaded += SceneManager_sceneUnloaded;
Expand All @@ -48,19 +61,7 @@ private static void SceneManager_sceneUnloaded(Scene scene)
UnityEngine.Object.Destroy(prefab.prefab);
}
_fixedPrefabCache.Clear();
_detailInfoToCorrespondingSpawnedGameObject.Clear();
}

public static GameObject GetSpawnedGameObjectByDetailInfo(DetailInfo detail)
{
if (!_detailInfoToCorrespondingSpawnedGameObject.ContainsKey(detail))
{
return null;
}
else
{
return _detailInfoToCorrespondingSpawnedGameObject[detail];
}
_detailInfoToGameObject.Clear();
}

/// <summary>
Expand Down Expand Up @@ -300,7 +301,7 @@ public static GameObject Make(GameObject go, Sector sector, IModBehaviour mod, G
ConditionalObjectActivation.SetUp(prop, detail.deactivationCondition, detail.blinkWhenActiveChanged, false);
}

_detailInfoToCorrespondingSpawnedGameObject[detail] = prop;
_detailInfoToGameObject[detail] = prop;

return prop;
}
Expand Down
6 changes: 3 additions & 3 deletions NewHorizons/Builder/Props/ProjectionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using System.Linq;
using UnityEngine;
using UnityEngine.InputSystem;
using static NewHorizons.Main;
using static NewHorizons.Utility.Files.AssetBundleUtilities;

namespace NewHorizons.Builder.Props
{
Expand Down Expand Up @@ -543,12 +543,12 @@ private static (SlideReelAsyncImageLoader inverted, SlideReelAsyncImageLoader at
if (useInvertedCache && cacheExists)
{
// Load the inverted images used when displaying slide reels to a screen
invertedImageLoader.PathsToLoad.Add((i, Path.Combine(Instance.ModHelper.Manifest.ModFolderPath, "Assets/textures/inverted_blank_slide_reel.png")));
invertedImageLoader.PathsToLoad.Add((i, Path.Combine(Main.Instance.ModHelper.Manifest.ModFolderPath, "Assets/textures/inverted_blank_slide_reel.png")));
}
else
{
// Used to then make cached stuff
imageLoader.PathsToLoad.Add((i, Path.Combine(Instance.ModHelper.Manifest.ModFolderPath, "Assets/textures/blank_slide_reel.png")));
imageLoader.PathsToLoad.Add((i, Path.Combine(Main.Instance.ModHelper.Manifest.ModFolderPath, "Assets/textures/blank_slide_reel.png")));
}
}
else
Expand Down
33 changes: 6 additions & 27 deletions NewHorizons/Builder/Props/PropBuildManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ public static void Make(GameObject go, Sector sector, OWRigidbody planetBody, Ne
MakeGeneralProps(go, config.Props.audioSources, (audioSource) => AudioSourceBuilder.Make(go, sector, audioSource, mod), (audioSource) => audioSource.audio);
RemoteBuilder.MakeGeneralProps(go, sector, config.Props.remotes, nhBody);
if (Main.HasDLC) MakeGeneralProps(go, config.Props.projectionTotems, (totem) => ProjectionTotemBuilder.Make(go, sector, totem, mod));
// For quantum groups, make the details in advance
if (config.Props.socketQuantumGroups != null) MakeGeneralProps(go, config.Props.socketQuantumGroups.SelectMany(x => x.details), (detail) => DetailBuilder.Make(go, sector, mod, detail), (detail) => detail.path);
if (config.Props.stateQuantumGroups != null) MakeGeneralProps(go, config.Props.stateQuantumGroups.SelectMany(x => x.details), (detail) => DetailBuilder.Make(go, sector, mod, detail), (detail) => detail.path);
if (config.Props.lightningQuantumGroups != null) MakeGeneralProps(go, config.Props.lightningQuantumGroups, (lightning) => QuantumBuilder.MakeQuantumLightning(go, sector, mod, lightning));

RunMultiPass();

Expand All @@ -162,33 +166,8 @@ public static void Make(GameObject go, Sector sector, OWRigidbody planetBody, Ne
}
}

if (config.Props.quantumGroups != null)
{
Dictionary<string, List<GameObject>> propsByGroup = new Dictionary<string, List<GameObject>>();
foreach (var detail in config.Props.details)
{
if (detail.quantumGroupID != null)
{
if (!propsByGroup.ContainsKey(detail.quantumGroupID)) propsByGroup[detail.quantumGroupID] = new List<GameObject>();
propsByGroup[detail.quantumGroupID].Add(DetailBuilder.GetSpawnedGameObjectByDetailInfo(detail));
}
}

foreach (var quantumGroup in config.Props.quantumGroups)
{
if (!propsByGroup.ContainsKey(quantumGroup.id)) continue;
var propsInGroup = propsByGroup[quantumGroup.id];

try
{
QuantumBuilder.Make(go, sector, config, mod, quantumGroup, propsInGroup.ToArray());
}
catch (Exception ex)
{
NHLogger.LogError($"Couldn't make quantum group \"{quantumGroup.id}\" for [{go.name}]:\n{ex}");
}
}
}
if (config.Props.socketQuantumGroups != null) QuantumBuilder.Make(go, sector, mod, config.Props.socketQuantumGroups);
if (config.Props.stateQuantumGroups != null) QuantumBuilder.Make(go, sector, mod, config.Props.stateQuantumGroups);
}

private static bool _ignoreParent;
Expand Down
Loading

0 comments on commit 928033f

Please sign in to comment.