Merge branch 'dev' into traveler-anim-fixes

This commit is contained in:
JohnCorby 2022-12-28 13:54:18 -08:00
commit ea7d04da52
20 changed files with 340 additions and 70 deletions

View File

@ -9,7 +9,7 @@ namespace NewHorizons.Builder.Atmosphere
var airGO = new GameObject("Air");
airGO.SetActive(false);
airGO.layer = 17;
airGO.transform.parent = sector?.transform ? sector.transform : planetGO.transform;
airGO.transform.parent = sector?.transform ?? planetGO.transform;
var sc = airGO.AddComponent<SphereCollider>();
sc.isTrigger = true;

View File

@ -88,9 +88,8 @@ namespace NewHorizons.Builder.Body
Vector3 localPosition = singularity?.position == null ? Vector3.zero : singularity.position;
Vector3 localRotation = singularity?.rotation == null ? Vector3.zero : singularity.rotation;
GameObject newSingularity = null;
newSingularity = MakeSingularity(go, sector, localPosition, localRotation, polarity, horizonRadius, distortRadius,
hasHazardVolume, singularity.targetStarSystem, singularity.curve, singularity.hasWarpEffects, singularity.renderQueueOverride);
GameObject newSingularity = MakeSingularity(go, sector, localPosition, localRotation, polarity, horizonRadius, distortRadius,
hasHazardVolume, singularity.targetStarSystem, singularity.curve, singularity.hasWarpEffects, singularity.renderQueueOverride, singularity.rename, singularity.parentPath, singularity.isRelativeToParent);
var uniqueID = string.IsNullOrEmpty(singularity.uniqueID) ? config.name : singularity.uniqueID;
_singularitiesByID.Add(uniqueID, newSingularity);
@ -134,15 +133,32 @@ namespace NewHorizons.Builder.Body
}
public static GameObject MakeSingularity(GameObject planetGO, Sector sector, Vector3 position, Vector3 rotation, bool polarity, float horizon, float distort,
bool hasDestructionVolume, string targetStarSystem = null, TimeValuePair[] curve = null, bool warpEffects = true, int renderQueue = 2985)
bool hasDestructionVolume, string targetStarSystem = null, TimeValuePair[] curve = null, bool warpEffects = true, int renderQueue = 2985, string rename = null, string parentPath = null, bool isRelativeToParent = false)
{
InitPrefabs();
// polarity true = black, false = white
var singularity = new GameObject(polarity ? "BlackHole" : "WhiteHole");
var singularity = new GameObject(!string.IsNullOrEmpty(rename) ? rename : (polarity ? "BlackHole" : "WhiteHole"));
singularity.transform.parent = sector?.transform ?? planetGO.transform;
singularity.transform.position = planetGO.transform.TransformPoint(position);
if (!string.IsNullOrEmpty(parentPath))
{
var newParent = planetGO.transform.Find(parentPath);
if (newParent != null)
{
singularity.transform.parent = newParent;
}
else
{
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{parentPath}");
}
}
if (isRelativeToParent)
singularity.transform.localPosition = position;
else
singularity.transform.position = planetGO.transform.TransformPoint(position);
var singularityRenderer = MakeSingularityGraphics(singularity, polarity, horizon, distort, renderQueue);
@ -257,7 +273,11 @@ namespace NewHorizons.Builder.Body
whiteHoleFluidVolume.enabled = true;
}
singularity.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(rotation));
var rot = Quaternion.Euler(rotation);
if (isRelativeToParent)
singularity.transform.localRotation = rot;
else
singularity.transform.rotation = planetGO.transform.TransformRotation(rot);
singularity.SetActive(true);
return singularity;

View File

@ -192,7 +192,7 @@ namespace NewHorizons.Builder.Props
var outerFogWarpVolume = GetOuterFogWarpVolumeFromAstroObject(go);
var fogLight = brambleNode.GetComponent<FogLight>();
brambleNode.transform.parent = sector.transform;
brambleNode.transform.parent = sector?.transform ?? go.transform;
brambleNode.transform.position = go.transform.TransformPoint(config.position ?? Vector3.zero);
brambleNode.transform.rotation = go.transform.TransformRotation(Quaternion.Euler(config.rotation ?? Vector3.zero));
brambleNode.name = config.name ?? "Bramble Node to " + config.linksTo;
@ -385,6 +385,8 @@ namespace NewHorizons.Builder.Props
}
}
StreamingHandler.SetUpStreaming(brambleNode, sector);
// Done!
brambleNode.SetActive(true);
return brambleNode;

View File

@ -1,6 +1,8 @@
using NewHorizons.External.Modules;
using NewHorizons.Utility;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Props
{
public static class GeyserBuilder
@ -17,8 +19,21 @@ namespace NewHorizons.Builder.Props
InitPrefab();
var geyserGO = _geyserPrefab.InstantiateInactive();
geyserGO.name = !string.IsNullOrEmpty(info.rename) ? info.rename : "Geyser";
geyserGO.transform.parent = sector?.transform ?? planetGO.transform;
geyserGO.name = "Geyser";
if (!string.IsNullOrEmpty(info.parentPath))
{
var newParent = planetGO.transform.Find(info.parentPath);
if (newParent != null)
{
geyserGO.transform.parent = newParent;
}
else
{
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
}
}
var pos = (Vector3)info.position;

View File

@ -614,7 +614,7 @@ namespace NewHorizons.Builder.Props
nomaiWallText.SetTextAsset(text);
// #433 fuzzy stranger text
if (info.arcInfo.Any(x => x.type == PropModule.NomaiTextArcInfo.NomaiTextArcType.Stranger))
if (info.arcInfo != null && info.arcInfo.Any(x => x.type == PropModule.NomaiTextArcInfo.NomaiTextArcType.Stranger))
{
StreamingHandler.SetUpStreaming(AstroObject.Name.RingWorld, sector);
}

View File

@ -94,7 +94,7 @@ namespace NewHorizons.Builder.Props
if (_slideReelPrefab == null) return null;
var slideReelObj = _slideReelPrefab.InstantiateInactive();
slideReelObj.name = $"Prefab_IP_Reel_{mod.ModHelper.Manifest.Name}";
slideReelObj.name = !string.IsNullOrEmpty(info.rename) ? info.rename : $"Prefab_IP_Reel_{mod.ModHelper.Manifest.Name}";
var slideReel = slideReelObj.GetComponent<SlideReelItem>();
slideReel.SetSector(sector);
@ -196,7 +196,7 @@ namespace NewHorizons.Builder.Props
if (_autoPrefab == null) return null;
var projectorObj = _autoPrefab.InstantiateInactive();
projectorObj.name = $"Prefab_IP_AutoProjector_{mod.ModHelper.Manifest.Name}";
projectorObj.name = !string.IsNullOrEmpty(info.rename) ? info.rename : $"Prefab_IP_AutoProjector_{mod.ModHelper.Manifest.Name}";
var autoProjector = projectorObj.GetComponent<AutoSlideProjector>();
autoProjector._sector = sector;
@ -276,7 +276,7 @@ namespace NewHorizons.Builder.Props
return null;
}
g.name = "VisionStaffDetector";
g.name = !string.IsNullOrEmpty(info.rename) ? info.rename : "VisionStaffDetector";
// The number of slides is unlimited, 15 is only for texturing the actual slide reel item. This is not a slide reel item
var slides = info.slides;
@ -312,7 +312,8 @@ namespace NewHorizons.Builder.Props
position = info.position,
rotation = info.rotation,
parentPath = info.parentPath,
isRelativeToParent = info.isRelativeToParent
isRelativeToParent = info.isRelativeToParent,
rename = info.rename
};
var standingTorch = DetailBuilder.Make(planetGO, sector, _standingVisionTorchPrefab, detailInfo);

View File

@ -41,7 +41,7 @@ namespace NewHorizons.Builder.Props
public static void MakeSocketGroup(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, PropModule.QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
{
var groupRoot = new GameObject("Quantum Sockets - " + quantumGroup.id);
groupRoot.transform.parent = sector.transform;
groupRoot.transform.parent = sector?.transform ?? go.transform;
groupRoot.transform.localPosition = Vector3.zero;
groupRoot.transform.localEulerAngles = Vector3.zero;
@ -79,7 +79,7 @@ namespace NewHorizons.Builder.Props
public static void MakeStateGroup(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, PropModule.QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
{
var groupRoot = new GameObject("Quantum States - " + quantumGroup.id);
groupRoot.transform.parent = sector.transform;
groupRoot.transform.parent = sector?.transform ?? go.transform;
groupRoot.transform.localPosition = Vector3.zero;
var states = new List<QuantumState>();
@ -128,7 +128,7 @@ namespace NewHorizons.Builder.Props
//var averagePosition = propsInGroup.Aggregate(Vector3.zero, (avg, prop) => avg + prop.transform.position) / propsInGroup.Count();
GameObject shuffleParent = new GameObject("Quantum Shuffle - " + quantumGroup.id);
shuffleParent.SetActive(false);
shuffleParent.transform.parent = sector.transform;
shuffleParent.transform.parent = sector?.transform ?? go.transform;
shuffleParent.transform.localPosition = Vector3.zero;
propsInGroup.ToList().ForEach(p => p.transform.parent = shuffleParent.transform);

View File

@ -53,10 +53,34 @@ namespace NewHorizons.Builder.Props
if (_prefab == null || sector == null) return null;
GameObject raftObject = _prefab.InstantiateInactive();
raftObject.name = "Raft_Body";
raftObject.name = !string.IsNullOrEmpty(info.rename) ? info.rename : "Raft_Body";
raftObject.transform.parent = sector?.transform ?? planetGO.transform;
raftObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
raftObject.transform.rotation = planetGO.transform.TransformRotation(Quaternion.identity);
if (!string.IsNullOrEmpty(info.parentPath))
{
var newParent = planetGO.transform.Find(info.parentPath);
if (newParent != null)
{
raftObject.transform.parent = newParent;
}
else
{
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
}
}
var pos = (Vector3)(info.position ?? Vector3.zero);
var rot = Quaternion.identity;
if (info.isRelativeToParent)
{
raftObject.transform.localPosition = pos;
raftObject.transform.localRotation = rot;
}
else
{
raftObject.transform.position = planetGO.transform.TransformPoint(pos);
raftObject.transform.rotation = planetGO.transform.TransformRotation(rot);
}
StreamingHandler.SetUpStreaming(raftObject, sector);

View File

@ -252,14 +252,7 @@ namespace NewHorizons.Builder.Props
{
var shareStone = _shareStonePrefab.InstantiateInactive();
if (!string.IsNullOrEmpty(info.rename))
{
shareStone.name = info.rename;
}
else
{
shareStone.name = "ShareStone_" + id.ToString();
}
shareStone.name = !string.IsNullOrEmpty(info.rename) ? info.rename : ("ShareStone_" + id.ToString());
shareStone.transform.parent = sector?.transform ?? go.transform;

View File

@ -99,10 +99,10 @@ namespace NewHorizons.Builder.Props
private static void MakeTornado(GameObject planetGO, Sector sector, PropModule.TornadoInfo info, Vector3 position, bool downwards)
{
var tornadoGO = downwards ? _downPrefab.InstantiateInactive() : _upPrefab.InstantiateInactive();
tornadoGO.name = downwards ? "Tornado_Down" : "Tornado_Up";
tornadoGO.transform.parent = sector.transform;
tornadoGO.name = !string.IsNullOrEmpty(info.rename) ? info.rename : (downwards ? "Tornado_Down" : "Tornado_Up");
tornadoGO.transform.parent = sector?.transform ?? planetGO.transform;
tornadoGO.transform.position = planetGO.transform.TransformPoint(position);
tornadoGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, sector.transform.TransformDirection(position.normalized));
tornadoGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, planetGO.transform.TransformDirection(position.normalized));
// Add the sound thing before changing the scale
var soundGO = _soundPrefab.InstantiateInactive();
@ -168,7 +168,7 @@ namespace NewHorizons.Builder.Props
if (info.wanderRate != 0)
{
ApplyWanderer(tornadoGO, sector, info);
ApplyWanderer(tornadoGO, planetGO, info);
}
soundGO.SetActive(true);
@ -179,9 +179,9 @@ namespace NewHorizons.Builder.Props
{
var hurricaneGO = _hurricanePrefab.InstantiateInactive();
hurricaneGO.name = "Hurricane";
hurricaneGO.transform.parent = sector.transform;
hurricaneGO.transform.parent = sector?.transform ?? planetGO.transform;
hurricaneGO.transform.position = planetGO.transform.TransformPoint(position);
hurricaneGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, sector.transform.TransformDirection(position.normalized));
hurricaneGO.transform.rotation = Quaternion.FromToRotation(Vector3.up, planetGO.transform.TransformDirection(position.normalized));
var fluidVolume = hurricaneGO.GetComponentInChildren<HurricaneFluidVolume>();
fluidVolume._fluidType = info.fluidType.ConvertToOW(FluidVolume.Type.CLOUD);
@ -227,7 +227,7 @@ namespace NewHorizons.Builder.Props
if (info.wanderRate != 0)
{
ApplyWanderer(hurricaneGO, sector, info);
ApplyWanderer(hurricaneGO, planetGO, info);
}
hurricaneGO.SetActive(true);
@ -263,13 +263,13 @@ namespace NewHorizons.Builder.Props
}
}
private static void ApplyWanderer(GameObject go, Sector sector, PropModule.TornadoInfo info)
private static void ApplyWanderer(GameObject go, GameObject planetGO, PropModule.TornadoInfo info)
{
var wanderer = go.AddComponent<NHTornadoWanderController>();
wanderer.wanderRate = info.wanderRate;
wanderer.wanderDegreesX = info.wanderDegreesX;
wanderer.wanderDegreesZ = info.wanderDegreesZ;
wanderer.sector = sector;
wanderer.planetGO = planetGO;
}
}
}

View File

@ -1,6 +1,8 @@
using NewHorizons.External.Modules;
using NewHorizons.Utility;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Props
{
public static class VolcanoBuilder
@ -44,10 +46,30 @@ namespace NewHorizons.Builder.Props
InitPrefab();
var launcherGO = _meteorLauncherPrefab.InstantiateInactive();
launcherGO.transform.parent = sector.transform;
launcherGO.name = !string.IsNullOrEmpty(info.rename) ? info.rename : "MeteorLauncher";
launcherGO.transform.parent = sector?.transform ?? planetGO.transform;
launcherGO.transform.position = planetGO.transform.TransformPoint(info.position == null ? Vector3.zero : (Vector3)info.position);
launcherGO.transform.rotation = Quaternion.FromToRotation(launcherGO.transform.TransformDirection(Vector3.up), ((Vector3)info.position).normalized).normalized;
launcherGO.name = "MeteorLauncher";
if (!string.IsNullOrEmpty(info.parentPath))
{
var newParent = planetGO.transform.Find(info.parentPath);
if (newParent != null)
{
launcherGO.transform.parent = newParent;
}
else
{
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
}
}
var pos = (Vector3)(info.position ?? Vector3.zero);
if (info.isRelativeToParent)
launcherGO.transform.localPosition = pos;
else
launcherGO.transform.position = planetGO.transform.TransformPoint(pos);
launcherGO.transform.rotation = Quaternion.FromToRotation(launcherGO.transform.TransformDirection(Vector3.up), pos.normalized).normalized;
var meteorLauncher = launcherGO.GetComponent<MeteorLauncher>();
meteorLauncher._audioSector = sector;

View File

@ -2,6 +2,8 @@ using NewHorizons.External.Modules;
using OWML.Common;
using System.Collections.Generic;
using UnityEngine;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.ShipLog
{
public static class EntryLocationBuilder
@ -9,10 +11,29 @@ namespace NewHorizons.Builder.ShipLog
private static readonly List<ShipLogEntryLocation> _locationsToInitialize = new List<ShipLogEntryLocation>();
public static void Make(GameObject go, Sector sector, PropModule.EntryLocationInfo info, IModBehaviour mod)
{
GameObject entryLocationGameObject = new GameObject("Entry Location (" + info.id + ")");
GameObject entryLocationGameObject = new GameObject(!string.IsNullOrEmpty(info.rename) ? info.rename : ("Entry Location (" + info.id + ")"));
entryLocationGameObject.SetActive(false);
entryLocationGameObject.transform.parent = sector?.transform ?? go.transform;
entryLocationGameObject.transform.position = go.transform.TransformPoint(info.position ?? Vector3.zero);
if (!string.IsNullOrEmpty(info.parentPath))
{
var newParent = go.transform.Find(info.parentPath);
if (newParent != null)
{
entryLocationGameObject.transform.parent = newParent;
}
else
{
Logger.LogWarning($"Cannot find parent object at path: {go.name}/{info.parentPath}");
}
}
var pos = (Vector3)(info.position ?? Vector3.zero);
if (info.isRelativeToParent)
entryLocationGameObject.transform.localPosition = pos;
else
entryLocationGameObject.transform.position = go.transform.TransformPoint(pos);
ShipLogEntryLocation newLocation = entryLocationGameObject.AddComponent<ShipLogEntryLocation>();
newLocation._entryID = info.id;
newLocation._outerFogWarpVolume = go.GetComponentInChildren<OuterFogWarpVolume>();

View File

@ -7,7 +7,7 @@ namespace NewHorizons.Components
public float wanderRate;
public float wanderDegreesX;
public float wanderDegreesZ;
public Sector sector;
public GameObject planetGO;
private float noiseOffset;
private float startDegreesX;
@ -47,7 +47,7 @@ namespace NewHorizons.Components
var newPos = new Vector3(newX, newY, newZ);
transform.localPosition = newPos;
transform.rotation = Quaternion.FromToRotation(Vector3.up, sector.transform.TransformDirection(newPos.normalized));
transform.rotation = Quaternion.FromToRotation(Vector3.up, planetGO.transform.TransformDirection(newPos.normalized));
}
}
}

View File

@ -243,6 +243,21 @@ namespace NewHorizons.External.Modules
/// Acceleration of the raft. Default acceleration is 5.
/// </summary>
[DefaultValue(5f)] public float acceleration = 5f;
/// <summary>
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
/// </summary>
public string parentPath;
/// <summary>
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
/// </summary>
public bool isRelativeToParent;
/// <summary>
/// An optional rename of this object
/// </summary>
public string rename;
}
[JsonObject]
@ -287,6 +302,16 @@ namespace NewHorizons.External.Modules
/// Loudness of the geyser
/// </summary>
[DefaultValue(0.7f)] public float volume = 0.7f;
/// <summary>
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
/// </summary>
public string parentPath;
/// <summary>
/// An optional rename of this object
/// </summary>
public string rename;
}
[JsonObject]
@ -354,6 +379,21 @@ namespace NewHorizons.External.Modules
/// Fluid type for sounds/effects when colliding with this tornado.
/// </summary>
[DefaultValue("cloud")] public FluidType fluidType = FluidType.Cloud;
/// <summary>
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
/// </summary>
public string parentPath;
/// <summary>
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
/// </summary>
public bool isRelativeToParent;
/// <summary>
/// An optional rename of this object
/// </summary>
public string rename;
}
[JsonObject]
@ -402,6 +442,21 @@ namespace NewHorizons.External.Modules
/// The colour of the meteor's stone.
/// </summary>
public MColor stoneTint;
/// <summary>
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
/// </summary>
public string parentPath;
/// <summary>
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
/// </summary>
public bool isRelativeToParent;
/// <summary>
/// An optional rename of this object
/// </summary>
public string rename;
}
[JsonObject]
@ -489,6 +544,21 @@ namespace NewHorizons.External.Modules
/// The position of this entry location
/// </summary>
public MVector3 position;
/// <summary>
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
/// </summary>
public string parentPath;
/// <summary>
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
/// </summary>
public bool isRelativeToParent;
/// <summary>
/// An optional rename of this object
/// </summary>
public string rename;
}
[JsonObject]
@ -680,6 +750,11 @@ namespace NewHorizons.External.Modules
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
/// </summary>
public bool isRelativeToParent;
/// <summary>
/// An optional rename of this object
/// </summary>
public string rename;
}
[JsonObject]

View File

@ -75,5 +75,20 @@ namespace NewHorizons.External.Modules.VariableSize
/// Optional override for the render queue. If the singularity is rendering oddly, increasing this to 3000 can help
/// </summary>
[Range(2501f, 3500f)] public int renderQueueOverride = 2985;
/// <summary>
/// The relative path from the planet to the parent of this object. Optional (will default to the root sector).
/// </summary>
public string parentPath;
/// <summary>
/// Whether the positional and rotational coordinates are relative to parent instead of the root planet object.
/// </summary>
public bool isRelativeToParent;
/// <summary>
/// An optional rename of this object
/// </summary>
public string rename;
}
}

View File

@ -24,16 +24,23 @@ namespace NewHorizons.Handlers
{
var group = GetStreamingGroup(name);
sector.OnOccupantEnterSector += _ =>
if (sector)
{
if (sector.ContainsAnyOccupants(DynamicOccupant.Player | DynamicOccupant.Probe))
group.RequestGeneralAssets();
};
sector.OnOccupantExitSector += _ =>
sector.OnOccupantEnterSector += _ =>
{
if (sector.ContainsAnyOccupants(DynamicOccupant.Player | DynamicOccupant.Probe))
group.RequestGeneralAssets();
};
sector.OnOccupantExitSector += _ =>
{
if (!sector.ContainsAnyOccupants(DynamicOccupant.Player | DynamicOccupant.Probe))
group.ReleaseGeneralAssets();
};
}
else
{
if (!sector.ContainsAnyOccupants(DynamicOccupant.Player | DynamicOccupant.Probe))
group.ReleaseGeneralAssets();
};
group.RequestGeneralAssets();
}
}
/// <summary>
@ -87,8 +94,6 @@ namespace NewHorizons.Handlers
foreach (var assetBundle in assetBundles)
{
StreamingManager.LoadStreamingAssets(assetBundle);
// Track the sector even if its null. null means stay loaded forever
if (!_sectorCache.TryGetValue(assetBundle, out var sectors))
{
@ -106,15 +111,17 @@ namespace NewHorizons.Handlers
foreach (var assetBundle in assetBundles)
StreamingManager.LoadStreamingAssets(assetBundle);
};
/*
sector.OnOccupantExitSector += _ =>
{
// UnloadStreamingAssets is patched to check IsBundleInUse first before unloading
if (!sector.ContainsAnyOccupants(DynamicOccupant.Player | DynamicOccupant.Probe))
foreach (var assetBundle in assetBundles)
StreamingManager.UnloadStreamingAssets(assetBundle);
};
*/
}
else
{
foreach (var assetBundle in assetBundles)
StreamingManager.LoadStreamingAssets(assetBundle);
}
}
@ -136,7 +143,7 @@ namespace NewHorizons.Handlers
}
else
{
return Locator.GetAstroObject(name)?.GetComponentInChildren<StreamingGroup>();
return Locator.GetAstroObject(name).GetComponentInChildren<StreamingGroup>();
}
}
}

View File

@ -14,10 +14,9 @@ namespace NewHorizons.Patches
[HarmonyPatch(typeof(ProbeDestructionDetector), nameof(ProbeDestructionDetector.FixedUpdate))]
public static bool ProbeDestructionDetector_FixedUpdate(ProbeDestructionDetector __instance)
{
if (!AchievementHandler.Enabled) return true;
if (__instance._activeVolumes.Count > 0 && __instance._safetyVolumes.Count == 0)
{
// Mobius does SetConditionState even when you are in solar system because probe never get destroyed anywhere else but the Eye.
if (LoadManager.GetCurrentScene() == OWScene.EyeOfTheUniverse)
{
DialogueConditionManager.SharedInstance.SetConditionState("PROBE_ENTERED_EYE", conditionState: true);
@ -26,7 +25,8 @@ namespace NewHorizons.Patches
else
Debug.Log("PROBE DESTROYED");
ProbeLostAchievement.Earn();
if (AchievementHandler.Enabled) ProbeLostAchievement.Earn();
Object.Destroy(__instance._probe.gameObject);
}
__instance.enabled = false;

View File

@ -1,10 +1,11 @@
using HarmonyLib;
using NewHorizons.Handlers;
using OWML.Logging;
namespace NewHorizons.Patches
{
[HarmonyPatch]
public static class StreamingManagerPatches
public static class StreamingPatches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(StreamingManager), nameof(StreamingManager.UnloadStreamingAssets))]
@ -12,6 +13,14 @@ namespace NewHorizons.Patches
{
// Only let it unload stuff that isn't being used
return !StreamingHandler.IsBundleInUse(assetBundleName);
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UnityLogger), "OnLogMessageReceived")]
public static bool UnityLogger_OnLogMessageReceived(string message)
{
// Filter out goofy error that doesn't actually break anything
return !message.EndsWith(") is out of bounds (size=0)");
}
}
}

View File

@ -1162,6 +1162,18 @@
"position": {
"description": "The position of this entry location",
"$ref": "#/definitions/MVector3"
},
"parentPath": {
"type": "string",
"description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)."
},
"isRelativeToParent": {
"type": "boolean",
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
},
"rename": {
"type": "string",
"description": "An optional rename of this object"
}
}
},
@ -1218,6 +1230,14 @@
"description": "Loudness of the geyser",
"format": "float",
"default": 0.7
},
"parentPath": {
"type": "string",
"description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)."
},
"rename": {
"type": "string",
"description": "An optional rename of this object"
}
}
},
@ -1390,6 +1410,18 @@
"description": "Acceleration of the raft. Default acceleration is 5.",
"format": "float",
"default": 5.0
},
"parentPath": {
"type": "string",
"description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)."
},
"isRelativeToParent": {
"type": "boolean",
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
},
"rename": {
"type": "string",
"description": "An optional rename of this object"
}
}
},
@ -1505,6 +1537,10 @@
"isRelativeToParent": {
"type": "boolean",
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
},
"rename": {
"type": "string",
"description": "An optional rename of this object"
}
}
},
@ -1707,6 +1743,18 @@
"description": "Fluid type for sounds/effects when colliding with this tornado.",
"default": "cloud",
"$ref": "#/definitions/FluidType"
},
"parentPath": {
"type": "string",
"description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)."
},
"isRelativeToParent": {
"type": "boolean",
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
},
"rename": {
"type": "string",
"description": "An optional rename of this object"
}
}
},
@ -1768,6 +1816,18 @@
"stoneTint": {
"description": "The colour of the meteor's stone.",
"$ref": "#/definitions/MColor"
},
"parentPath": {
"type": "string",
"description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)."
},
"isRelativeToParent": {
"type": "boolean",
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
},
"rename": {
"type": "string",
"description": "An optional rename of this object"
}
}
},
@ -1828,6 +1888,18 @@
"format": "int32",
"maximum": 3500.0,
"minimum": 2501.0
},
"parentPath": {
"type": "string",
"description": "The relative path from the planet to the parent of this object. Optional (will default to the root sector)."
},
"isRelativeToParent": {
"type": "boolean",
"description": "Whether the positional and rotational coordinates are relative to parent instead of the root planet object."
},
"rename": {
"type": "string",
"description": "An optional rename of this object"
}
}
},

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Json.Net.Unity3D" version="9.0.1" targetFramework="net48" />
<package id="Lib.Harmony" version="2.1.1" targetFramework="net48" />
<package id="OWML" version="2.1.0" targetFramework="net48" />
</packages>