mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
1.16.4 (#724)
## Bug fixes - Log an error when trying to orbit a body that doesn't have a gravity volume. - QuantumGroups of type "states" no longer ignore probe snapshots taken of them (resolves #598) - Unnamed Mystery is now playable again (oops sorry cigtu)
This commit is contained in:
commit
939d427774
@ -42,6 +42,11 @@ namespace NewHorizons.Builder.Body
|
||||
case StellarRemnantType.NeutronStar:
|
||||
MakeNeutronStar(go, sector, mod, star.Config.Star);
|
||||
|
||||
break;
|
||||
case StellarRemnantType.Pulsar:
|
||||
MakeNeutronStar(go, sector, mod, star.Config.Star);
|
||||
// TODO: add jets, up rotation speed (use a RotateTransform on the star instead of changing sidereal period)
|
||||
|
||||
break;
|
||||
case StellarRemnantType.BlackHole:
|
||||
MakeBlackhole(go, sector, star.Config.Star);
|
||||
@ -141,6 +146,8 @@ namespace NewHorizons.Builder.Body
|
||||
return MakeWhiteDwarf(planet, null, mod, progenitor, proxy);
|
||||
case StellarRemnantType.NeutronStar:
|
||||
return MakeNeutronStar(planet, null, mod, progenitor, proxy);
|
||||
case StellarRemnantType.Pulsar:
|
||||
return MakeNeutronStar(planet, null, mod, progenitor, proxy);
|
||||
case StellarRemnantType.BlackHole:
|
||||
return MakeBlackhole(planet, null, progenitor, proxy);
|
||||
default:
|
||||
|
||||
@ -143,13 +143,15 @@ namespace NewHorizons.Builder.General
|
||||
// It's a planet
|
||||
if (binaryFocalPoint.Primary != null && binaryFocalPoint.Secondary != null)
|
||||
{
|
||||
forceDetector._detectableFields = new ForceVolume[] { parentGravityVolume };
|
||||
if (!parentGravityVolume) NHLogger.LogError($"{astroObject?.name} trying to orbit {primaryBody?.name}, which has no gravity volume!");
|
||||
forceDetector._detectableFields = parentGravityVolume ? new ForceVolume[] { parentGravityVolume } : new ForceVolume[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forceDetector._detectableFields = new ForceVolume[] { parentGravityVolume };
|
||||
if (!parentGravityVolume) NHLogger.LogError($"{astroObject?.name} trying to orbit {primaryBody?.name}, which has no gravity volume!");
|
||||
forceDetector._detectableFields = parentGravityVolume ? new ForceVolume[] { parentGravityVolume } : new ForceVolume[0];
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,7 +166,7 @@ namespace NewHorizons.Builder.General
|
||||
var primaryGV = primary.GetGravityVolume();
|
||||
var secondaryGV = secondary.GetGravityVolume();
|
||||
|
||||
if (primaryGV._falloffType != secondaryGV._falloffType)
|
||||
if (primaryGV && secondaryGV && primaryGV._falloffType != secondaryGV._falloffType)
|
||||
{
|
||||
NHLogger.LogError($"Binaries must have the same gravity falloff! {primaryGV._falloffType} != {secondaryGV._falloffType}");
|
||||
return;
|
||||
@ -173,15 +175,17 @@ namespace NewHorizons.Builder.General
|
||||
var pointForceDetector = point.GetAttachedOWRigidbody().GetAttachedForceDetector();
|
||||
|
||||
// Set detectable fields
|
||||
primaryCFD._detectableFields = new ForceVolume[] { secondaryGV };
|
||||
if (!secondaryGV) NHLogger.LogError($"{point.PrimaryName} trying to orbit {point.SecondaryName}, which has no gravity volume!");
|
||||
primaryCFD._detectableFields = secondaryGV ? new ForceVolume[] { secondaryGV } : new ForceVolume[0];
|
||||
primaryCFD._inheritDetector = pointForceDetector;
|
||||
primaryCFD._activeInheritedDetector = pointForceDetector;
|
||||
primaryCFD._inheritElement0 = false;
|
||||
|
||||
secondaryCFD._detectableFields = new ForceVolume[] { primaryGV };
|
||||
if (!primaryGV) NHLogger.LogError($"{point.SecondaryName} trying to orbit {point.PrimaryName}, which has no gravity volume!");
|
||||
secondaryCFD._detectableFields = primaryGV ? new ForceVolume[] { primaryGV } : new ForceVolume[0];
|
||||
secondaryCFD._inheritDetector = pointForceDetector;
|
||||
secondaryCFD._activeInheritedDetector = pointForceDetector;
|
||||
secondaryCFD._inheritElement0 = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -382,8 +382,9 @@ namespace NewHorizons.Builder.Props
|
||||
else if (component is NomaiInterfaceOrb orb)
|
||||
{
|
||||
// detect planet gravity
|
||||
// somehow Intervention has GetAttachedOWRigidbody as null sometimes, idk why
|
||||
var gravityVolume = planetGO.GetAttachedOWRigidbody()?.GetAttachedGravityVolume();
|
||||
orb.GetComponent<ConstantForceDetector>()._detectableFields = gravityVolume ? new ForceVolume[] { gravityVolume } : new ForceVolume[] { };
|
||||
orb.GetComponent<ConstantForceDetector>()._detectableFields = gravityVolume ? new ForceVolume[] { gravityVolume } : new ForceVolume[0];
|
||||
}
|
||||
|
||||
else if (component is VisionTorchItem torchItem)
|
||||
|
||||
@ -11,11 +11,11 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
public static GameObject MakeFromExisting(GameObject go,
|
||||
GameObject planetGO, Sector sector, GeneralPointPropInfo info,
|
||||
MVector3 defaultPosition = null, string defaultParentPath = null, Transform parentOverride = null)
|
||||
MVector3 defaultPosition = null, string defaultParentPath = null, Transform defaultParent = null)
|
||||
{
|
||||
if (info == null) return go;
|
||||
|
||||
go.transform.parent = parentOverride ?? sector?.transform ?? planetGO?.transform;
|
||||
go.transform.parent = defaultParent ?? sector?.transform ?? planetGO?.transform;
|
||||
|
||||
if (info is GeneralSolarSystemPropInfo solarSystemInfo && !string.IsNullOrEmpty(solarSystemInfo.parentBody))
|
||||
{
|
||||
@ -87,20 +87,20 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
public static GameObject MakeNew(string defaultName,
|
||||
GameObject planetGO, Sector sector, GeneralPointPropInfo info,
|
||||
MVector3 defaultPosition = null, string defaultParentPath = null, Transform parentOverride = null)
|
||||
MVector3 defaultPosition = null, string defaultParentPath = null, Transform defaultParent = null)
|
||||
{
|
||||
var go = new GameObject(defaultName);
|
||||
go.SetActive(false);
|
||||
return MakeFromExisting(go, planetGO, sector, info, defaultPosition, defaultParentPath, parentOverride);
|
||||
return MakeFromExisting(go, planetGO, sector, info, defaultPosition, defaultParentPath, defaultParent);
|
||||
}
|
||||
|
||||
public static GameObject MakeFromPrefab(GameObject prefab, string defaultName,
|
||||
GameObject planetGO, Sector sector, GeneralPointPropInfo info,
|
||||
MVector3 defaultPosition = null, string defaultParentPath = null, Transform parentOverride = null)
|
||||
MVector3 defaultPosition = null, string defaultParentPath = null, Transform defaultParent = null)
|
||||
{
|
||||
var go = prefab.InstantiateInactive();
|
||||
go.name = defaultName;
|
||||
return MakeFromExisting(go, planetGO, sector, info, defaultPosition, defaultParentPath, parentOverride);
|
||||
return MakeFromExisting(go, planetGO, sector, info, defaultPosition, defaultParentPath, defaultParent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,7 +137,10 @@ namespace NewHorizons.Builder.Props
|
||||
orbBody._lastVelocity = velocity;
|
||||
orbBody._currentVelocity = velocity;
|
||||
|
||||
orb.GetComponent<ConstantForceDetector>()._detectableFields = new ForceVolume[] { planetGO.GetComponentInChildren<GravityVolume>() };
|
||||
// detect planet gravity
|
||||
// somehow Intervention has GetAttachedOWRigidbody as null sometimes, idk why
|
||||
var gravityVolume = planetGO.GetAttachedOWRigidbody()?.GetAttachedGravityVolume();
|
||||
orb.GetComponent<ConstantForceDetector>()._detectableFields = gravityVolume ? new ForceVolume[] { gravityVolume } : new ForceVolume[0];
|
||||
|
||||
Delay.RunWhenAndInNUpdates(() =>
|
||||
{
|
||||
|
||||
@ -214,7 +214,7 @@ namespace NewHorizons.Builder.Props
|
||||
// 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;
|
||||
var slidesCount = slides.Length;
|
||||
var slideCollection = new SlideCollection(slidesCount);
|
||||
var slideCollection = new SlideCollection(slidesCount); // TODO: uh I think that info.slides[i].playTimeDuration is not being read here... note to self for when I implement support for that: 0.7 is what to default to if playTimeDuration turns out to be 0
|
||||
|
||||
var imageLoader = AddAsyncLoader(g, mod, info.slides, ref slideCollection);
|
||||
imageLoader.imageLoadedEvent.AddListener((Texture2D tex, int index) => { slideCollection.slides[index]._image = tex; });
|
||||
|
||||
@ -8,17 +8,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
// BUGS THAT REQUIRE REWRITING MOBIUS CODE
|
||||
// 1) FIXED! - MultiStateQuantumObjects don't check to see if the new state would be visible before choosing it
|
||||
// 2) FIXED? no longer supporting shuffle - QuantumShuffleObjects don't respect rotation, they set rotation to 0 on collapse
|
||||
// 3) - MultiStateQuantumObjects don't get locked by pictures
|
||||
|
||||
// New features to support
|
||||
// 1) multiState._prerequisiteObjects
|
||||
// 2) Socket groups that have an equal number of props and sockets
|
||||
// 3) Nice to have: socket groups that specify a filledSocketObject and an emptySocketObject (eg the archway in the giant's deep tower)
|
||||
|
||||
namespace NewHorizons.Builder.Props
|
||||
{
|
||||
public static class QuantumBuilder
|
||||
@ -34,6 +23,8 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Socket groups that have an equal number of props and sockets
|
||||
// Nice to have: socket groups that specify a filledSocketObject and an emptySocketObject (eg the archway in the giant's deep tower)
|
||||
public static void MakeSocketGroup(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
|
||||
{
|
||||
var groupRoot = new GameObject("Quantum Sockets - " + quantumGroup.id);
|
||||
@ -46,10 +37,10 @@ namespace NewHorizons.Builder.Props
|
||||
{
|
||||
var socketInfo = quantumGroup.sockets[i];
|
||||
|
||||
var socket = GeneralPropBuilder.MakeNew("Socket " + i, go, sector, socketInfo, parentOverride: groupRoot.transform);
|
||||
var socket = GeneralPropBuilder.MakeNew("Socket " + i, go, sector, socketInfo, defaultParent: groupRoot.transform);
|
||||
|
||||
sockets[i] = socket.AddComponent<QuantumSocket>();
|
||||
sockets[i]._lightSources = new Light[0];
|
||||
sockets[i]._lightSources = new Light[0]; // TODO: make this customizable?
|
||||
socket.SetActive(true);
|
||||
}
|
||||
|
||||
@ -70,6 +61,12 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
public static void MakeStateGroup(GameObject go, Sector sector, PlanetConfig config, IModBehaviour mod, QuantumGroupInfo quantumGroup, GameObject[] propsInGroup)
|
||||
{
|
||||
// NOTE: States groups need special consideration that socket groups don't
|
||||
// this is because the base class QuantumObject (and this is important) IGNORES PICTURES TAKEN FROM OVER 100 METERS AWAY
|
||||
// why does this affect states and not sockets? Well because sockets put the QuantumObject component (QuantumSocketedObject) on the actual props themselves
|
||||
// while states put the QuantumObject component (NHMultiStateQuantumObject) on the parent, which is located at the center of the planet
|
||||
// this means that the distance measured by QuantumObject is not accurate, since it's not measuring from the active prop, but from the center of the planet
|
||||
|
||||
var groupRoot = new GameObject("Quantum States - " + quantumGroup.id);
|
||||
groupRoot.transform.parent = sector?.transform ?? go.transform;
|
||||
groupRoot.transform.localPosition = Vector3.zero;
|
||||
@ -110,8 +107,10 @@ namespace NewHorizons.Builder.Props
|
||||
multiState._loop = quantumGroup.loop;
|
||||
multiState._sequential = quantumGroup.sequential;
|
||||
multiState._states = states.ToArray();
|
||||
multiState._prerequisiteObjects = new MultiStateQuantumObject[0]; // TODO: support this
|
||||
multiState._prerequisiteObjects = new MultiStateQuantumObject[0]; // TODO: _prerequisiteObjects
|
||||
multiState._initialState = 0;
|
||||
// snapshot events arent listened to outside of the sector, so fortunately this isnt really infinite
|
||||
multiState._maxSnapshotLockRange = Mathf.Infinity; // TODO: maybe expose this at some point if it breaks a puzzle or something
|
||||
groupRoot.SetActive(true);
|
||||
}
|
||||
|
||||
@ -126,7 +125,7 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
var shuffle = shuffleParent.AddComponent<QuantumShuffleObject>();
|
||||
shuffle._shuffledObjects = propsInGroup.Select(p => p.transform).ToArray();
|
||||
shuffle.Awake(); // this doesn't get called on its own for some reason
|
||||
shuffle.Awake(); // this doesn't get called on its own for some reason. what? how?
|
||||
|
||||
AddBoundsVisibility(shuffleParent);
|
||||
shuffleParent.SetActive(true);
|
||||
@ -165,6 +164,7 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
|
||||
// BUG: ignores skinned guys. this coincidentally makes it work without BoxShapeFixer
|
||||
public static Bounds GetBoundsOfSelfAndChildMeshes(GameObject g)
|
||||
{
|
||||
var meshFilters = g.GetComponentsInChildren<MeshFilter>();
|
||||
@ -200,6 +200,13 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// for some reason mesh bounds are wrong unless we wait a bit
|
||||
/// so this script contiously checks everything until it is correct
|
||||
///
|
||||
/// this actually only seems to be a problem with skinned renderers. normal ones work fine
|
||||
/// TODO: at some point narrow this down to just skinned, instead of doing everything and checking every frame
|
||||
/// </summary>
|
||||
public class BoxShapeFixer : MonoBehaviour
|
||||
{
|
||||
public BoxShape shape;
|
||||
|
||||
@ -4,9 +4,12 @@ using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Components.Quantum
|
||||
{
|
||||
/// <summary>
|
||||
/// exists because MultiStateQuantumObject only checks visibility on the current state,
|
||||
/// whereas this one also checks on each new state, in case they are bigger
|
||||
/// </summary>
|
||||
public class NHMultiStateQuantumObject : MultiStateQuantumObject
|
||||
{
|
||||
|
||||
public override bool ChangeQuantumState(bool skipInstantVisibilityCheck)
|
||||
{
|
||||
for (int i = 0; i < _prerequisiteObjects.Length; i++)
|
||||
@ -43,15 +46,9 @@ namespace NewHorizons.Components.Quantum
|
||||
else
|
||||
{
|
||||
|
||||
// TODO: perform this roll for number of states, each time adding the selected state to the end of a list and removing it from the source list
|
||||
// this gets us a randomly ordered list that respects states' probability
|
||||
// then we can sequentially attempt collapsing to them, checking at each state whether the new state is invalid due to the player being able to see it, according to this:
|
||||
//
|
||||
// if (!((!IsPlayerEntangled()) ? (CheckIllumination() ? CheckVisibilityInstantly() : CheckPointInside(Locator.GetPlayerCamera().transform.position)) : CheckIllumination()))
|
||||
// {
|
||||
// return true; // this is a valid state
|
||||
// }
|
||||
//
|
||||
// Iterate over list of possible states to find a valid state to collapse to
|
||||
// current state is excluded, and states are randomly ordered using a weighted random roll to prioritize states with higher probability
|
||||
// NOTE: they aren't actually pre-sorted into this random order, this random ordering is done on the fly using RollState
|
||||
|
||||
List<int> indices = new List<int>();
|
||||
for (var i = 0; i < _states.Length; i++) if (i != stateIndex) indices.Add(i);
|
||||
@ -94,17 +91,15 @@ namespace NewHorizons.Components.Quantum
|
||||
{
|
||||
var isPlayerEntangled = IsPlayerEntangled();
|
||||
var illumination = CheckIllumination();
|
||||
// faster than full CheckVisibility
|
||||
var visibility = CheckVisibilityInstantly();
|
||||
var playerInside = CheckPointInside(Locator.GetPlayerCamera().transform.position);
|
||||
// does not check probe, but thats okay
|
||||
|
||||
var isVisible =
|
||||
isPlayerEntangled
|
||||
? illumination
|
||||
:
|
||||
illumination
|
||||
? visibility
|
||||
: playerInside
|
||||
;
|
||||
var notEntangledCheck = illumination ? visibility : playerInside;
|
||||
var isVisible = isPlayerEntangled ? illumination : notEntangledCheck;
|
||||
// I think this is what the above two lines simplify to but I don't want to test this:
|
||||
// illumination ? visibility || isPlayerEntangled : playerInside
|
||||
|
||||
return !isVisible;
|
||||
}
|
||||
|
||||
@ -154,6 +154,7 @@ namespace NewHorizons.External.Modules.VariableSize
|
||||
[EnumMember(Value = @"default")] Default,
|
||||
[EnumMember(Value = @"whiteDwarf")] WhiteDwarf,
|
||||
[EnumMember(Value = @"neutronStar")] NeutronStar,
|
||||
[EnumMember(Value = @"pulsar")] Pulsar,
|
||||
[EnumMember(Value = @"blackHole")] BlackHole,
|
||||
[EnumMember(Value = @"custom")] Custom
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ namespace NewHorizons.Handlers
|
||||
var attachWarpExitToVessel = system.Config.Vessel?.warpExit?.attachToVessel ?? false;
|
||||
var warpExitParent = vesselWarpController._targetWarpPlatform.transform.parent;
|
||||
|
||||
var warpExit = GeneralPropBuilder.MakeFromExisting(vesselWarpController._targetWarpPlatform.gameObject, planetGO, null, system.Config.Vessel?.warpExit, parentOverride: attachWarpExitToVessel ? warpExitParent : null);
|
||||
var warpExit = GeneralPropBuilder.MakeFromExisting(vesselWarpController._targetWarpPlatform.gameObject, planetGO, null, system.Config.Vessel?.warpExit, defaultParent: attachWarpExitToVessel ? warpExitParent : null);
|
||||
if (attachWarpExitToVessel)
|
||||
{
|
||||
warpExit.transform.parent = warpExitParent;
|
||||
|
||||
@ -15,9 +15,8 @@
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HarmonyX" Version="2.10.1" />
|
||||
<PackageReference Include="OuterWildsGameLibs" Version="1.1.13.457" />
|
||||
<PackageReference Include="OWML" Version="2.9.3" />
|
||||
<PackageReference Include="OWML" Version="2.9.7" />
|
||||
<Reference Include="../Lib/System.ComponentModel.Annotations.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
using HarmonyLib;
|
||||
using NewHorizons.Utility.OWML;
|
||||
|
||||
namespace NewHorizons.Patches.PlayerPatches
|
||||
namespace NewHorizons.Patches.DetectorPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(HazardDetector))]
|
||||
public static class PlayerHazardDetectorPatches
|
||||
@ -2047,13 +2047,11 @@
|
||||
"description": "",
|
||||
"x-enumNames": [
|
||||
"Sockets",
|
||||
"States",
|
||||
"FailedValidation"
|
||||
"States"
|
||||
],
|
||||
"enum": [
|
||||
"sockets",
|
||||
"states",
|
||||
"FailedValidation"
|
||||
"states"
|
||||
]
|
||||
},
|
||||
"QuantumSocketInfo": {
|
||||
@ -3509,6 +3507,7 @@
|
||||
"Default",
|
||||
"WhiteDwarf",
|
||||
"NeutronStar",
|
||||
"Pulsar",
|
||||
"BlackHole",
|
||||
"Custom"
|
||||
],
|
||||
@ -3516,6 +3515,7 @@
|
||||
"default",
|
||||
"whiteDwarf",
|
||||
"neutronStar",
|
||||
"pulsar",
|
||||
"blackHole",
|
||||
"custom"
|
||||
]
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
"author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book",
|
||||
"name": "New Horizons",
|
||||
"uniqueName": "xen.NewHorizons",
|
||||
"version": "1.16.3",
|
||||
"owmlVersion": "2.9.3",
|
||||
"version": "1.16.4",
|
||||
"owmlVersion": "2.9.7",
|
||||
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
|
||||
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],
|
||||
"pathsToPreserve": [ "planets", "systems", "translations" ]
|
||||
|
||||
@ -86,6 +86,8 @@ public static class SchemaExporter
|
||||
schema.Definitions["NomaiTextType"].EnumerationNames.Remove("Cairn");
|
||||
schema.Definitions["NomaiTextType"].Enumeration.Remove("cairnVariant");
|
||||
schema.Definitions["NomaiTextType"].EnumerationNames.Remove("CairnVariant");
|
||||
schema.Definitions["QuantumGroupType"].Enumeration.Remove("FailedValidation");
|
||||
schema.Definitions["QuantumGroupType"].EnumerationNames.Remove("FailedValidation");
|
||||
break;
|
||||
case "Star System Schema":
|
||||
schema.Definitions["NomaiCoordinates"].Properties["x"].UniqueItems = true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user