From cec5b36cfa89f42ff134473ebc7d1c050bcab725 Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 24 Aug 2023 14:56:47 -0400 Subject: [PATCH 01/16] Update CONTRIBUTING.md --- CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e289605..a8477288 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,6 +18,9 @@ This will automatically build to your mods directory in OWML (so long as it's in To save yourself the pain of decoding where in a function an error occured, you can [download this dll file](https://cdn.discordapp.com/attachments/929787137895854100/936860223983976448/mono-2.0-bdwgc.dll) and place it in `MonoBleedingEdge/EmbedRuntime` of the game's folder. Then (so long as you build targeting `Debug`), line numbers will be shown in any error that comes from New Horizons +## Provide examples +When adding a new feature, include a complete set of planet config files that will sufficiently demonstrate the functionality of the feature/bug fix/improvement. This way reviewers can just copy paste these files into the New Horizons planets folder. + ## Updating The Schema When you add fields to config classes, please document them using XML documentation so that our action can generate a proper schema. From c3009c692e9b960985490b7df7d042ee2e79f9e0 Mon Sep 17 00:00:00 2001 From: clay Date: Thu, 31 Aug 2023 23:02:11 -0400 Subject: [PATCH 02/16] removed FailedValidation from docs --- NewHorizons/External/Modules/Props/Quantum/QuantumGroupType.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/External/Modules/Props/Quantum/QuantumGroupType.cs b/NewHorizons/External/Modules/Props/Quantum/QuantumGroupType.cs index 8fb3a78f..9c9755b9 100644 --- a/NewHorizons/External/Modules/Props/Quantum/QuantumGroupType.cs +++ b/NewHorizons/External/Modules/Props/Quantum/QuantumGroupType.cs @@ -11,6 +11,6 @@ namespace NewHorizons.External.Modules.Props.Quantum [EnumMember(Value = @"states")] States = 1, - FailedValidation = 10 + [JsonIgnore] FailedValidation = 10 } } From 6286c7907d7bb8dde55215c382d2c13df3e9c34a Mon Sep 17 00:00:00 2001 From: clay Date: Thu, 31 Aug 2023 23:04:09 -0400 Subject: [PATCH 03/16] rearranged for for readability --- .../Components/Quantum/NHMultiStateQuantumObject.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs b/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs index 17279ec5..db4d7a35 100644 --- a/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs +++ b/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs @@ -6,7 +6,6 @@ namespace NewHorizons.Components.Quantum { public class NHMultiStateQuantumObject : MultiStateQuantumObject { - public override bool ChangeQuantumState(bool skipInstantVisibilityCheck) { for (int i = 0; i < _prerequisiteObjects.Length; i++) @@ -97,14 +96,10 @@ namespace NewHorizons.Components.Quantum var visibility = CheckVisibilityInstantly(); var playerInside = CheckPointInside(Locator.GetPlayerCamera().transform.position); - 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; } From 4641ab9004b87786754e397c92302e7906d7f563 Mon Sep 17 00:00:00 2001 From: clay Date: Fri, 1 Sep 2023 03:06:51 -0400 Subject: [PATCH 04/16] fixed bug causing states objects to ignore probe pictures --- NewHorizons/Builder/Props/QuantumBuilder.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/QuantumBuilder.cs b/NewHorizons/Builder/Props/QuantumBuilder.cs index 2848ee87..78246bbf 100644 --- a/NewHorizons/Builder/Props/QuantumBuilder.cs +++ b/NewHorizons/Builder/Props/QuantumBuilder.cs @@ -70,9 +70,14 @@ 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; + groupRoot.transform.position = Vector3.zero; ////propsInGroup.Select(prop => prop.transform.position).Aggregate(Vector3.zero, (runningTotal, position) => runningTotal + position) / propsInGroup.Length; var states = new List(); foreach(var prop in propsInGroup) @@ -112,6 +117,7 @@ namespace NewHorizons.Builder.Props multiState._states = states.ToArray(); multiState._prerequisiteObjects = new MultiStateQuantumObject[0]; // TODO: support this multiState._initialState = 0; + multiState._maxSnapshotLockRange = Mathf.Infinity; groupRoot.SetActive(true); } From c80dcdf0623901bb17502bb7d8b1ea8bed5f1ce9 Mon Sep 17 00:00:00 2001 From: clay Date: Fri, 1 Sep 2023 03:15:15 -0400 Subject: [PATCH 05/16] refactors for readability --- .../Components/Quantum/NHMultiStateQuantumObject.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs b/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs index db4d7a35..ba961a47 100644 --- a/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs +++ b/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs @@ -42,15 +42,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 indices = new List(); for (var i = 0; i < _states.Length; i++) if (i != stateIndex) indices.Add(i); From badea22cfc42769f6f2fcab42d5999890c88b3c8 Mon Sep 17 00:00:00 2001 From: clay Date: Fri, 1 Sep 2023 03:15:41 -0400 Subject: [PATCH 06/16] added todo and removed comment --- NewHorizons/Builder/Props/ProjectionBuilder.cs | 2 +- NewHorizons/Builder/Props/QuantumBuilder.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Props/ProjectionBuilder.cs b/NewHorizons/Builder/Props/ProjectionBuilder.cs index cbc10091..c73b330e 100644 --- a/NewHorizons/Builder/Props/ProjectionBuilder.cs +++ b/NewHorizons/Builder/Props/ProjectionBuilder.cs @@ -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; }); diff --git a/NewHorizons/Builder/Props/QuantumBuilder.cs b/NewHorizons/Builder/Props/QuantumBuilder.cs index 78246bbf..0df75a2f 100644 --- a/NewHorizons/Builder/Props/QuantumBuilder.cs +++ b/NewHorizons/Builder/Props/QuantumBuilder.cs @@ -75,9 +75,10 @@ namespace NewHorizons.Builder.Props // 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.position = Vector3.zero; ////propsInGroup.Select(prop => prop.transform.position).Aggregate(Vector3.zero, (runningTotal, position) => runningTotal + position) / propsInGroup.Length; + groupRoot.transform.position = Vector3.zero; var states = new List(); foreach(var prop in propsInGroup) From 574de12c745662357a9f44277ad702675ee9d6a4 Mon Sep 17 00:00:00 2001 From: clay Date: Fri, 1 Sep 2023 03:19:42 -0400 Subject: [PATCH 07/16] position -> localPosition --- NewHorizons/Builder/Props/QuantumBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/QuantumBuilder.cs b/NewHorizons/Builder/Props/QuantumBuilder.cs index 0df75a2f..3988f386 100644 --- a/NewHorizons/Builder/Props/QuantumBuilder.cs +++ b/NewHorizons/Builder/Props/QuantumBuilder.cs @@ -78,7 +78,7 @@ namespace NewHorizons.Builder.Props var groupRoot = new GameObject("Quantum States - " + quantumGroup.id); groupRoot.transform.parent = sector?.transform ?? go.transform; - groupRoot.transform.position = Vector3.zero; + groupRoot.transform.localPosition = Vector3.zero; var states = new List(); foreach(var prop in propsInGroup) From 7343d52307fe9d680e106e3c73ee785f371a4ad6 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sun, 3 Sep 2023 14:20:43 -0700 Subject: [PATCH 08/16] this doenst do anything --- NewHorizons/External/Modules/Props/Quantum/QuantumGroupType.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/External/Modules/Props/Quantum/QuantumGroupType.cs b/NewHorizons/External/Modules/Props/Quantum/QuantumGroupType.cs index 9c9755b9..8fb3a78f 100644 --- a/NewHorizons/External/Modules/Props/Quantum/QuantumGroupType.cs +++ b/NewHorizons/External/Modules/Props/Quantum/QuantumGroupType.cs @@ -11,6 +11,6 @@ namespace NewHorizons.External.Modules.Props.Quantum [EnumMember(Value = @"states")] States = 1, - [JsonIgnore] FailedValidation = 10 + FailedValidation = 10 } } From 76a196a457d987e47e68096af1dc5458c518c9b7 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sun, 3 Sep 2023 14:48:42 -0700 Subject: [PATCH 09/16] lots of comments --- NewHorizons/Builder/Props/QuantumBuilder.cs | 14 ++++++++++---- .../Quantum/NHMultiStateQuantumObject.cs | 5 +++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/NewHorizons/Builder/Props/QuantumBuilder.cs b/NewHorizons/Builder/Props/QuantumBuilder.cs index 3988f386..dbe2b1d7 100644 --- a/NewHorizons/Builder/Props/QuantumBuilder.cs +++ b/NewHorizons/Builder/Props/QuantumBuilder.cs @@ -12,7 +12,7 @@ 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 +// 3) FIXED! - MultiStateQuantumObjects don't get locked by pictures // New features to support // 1) multiState._prerequisiteObjects @@ -49,7 +49,7 @@ namespace NewHorizons.Builder.Props var socket = GeneralPropBuilder.MakeNew("Socket " + i, go, sector, socketInfo, parentOverride: groupRoot.transform); sockets[i] = socket.AddComponent(); - sockets[i]._lightSources = new Light[0]; + sockets[i]._lightSources = new Light[0]; // TODO: make this customizable? socket.SetActive(true); } @@ -118,7 +118,8 @@ namespace NewHorizons.Builder.Props multiState._states = states.ToArray(); multiState._prerequisiteObjects = new MultiStateQuantumObject[0]; // TODO: support this multiState._initialState = 0; - multiState._maxSnapshotLockRange = Mathf.Infinity; + // bound to the sector, as snapshot events are listened to then + multiState._maxSnapshotLockRange = Mathf.Infinity; // TODO: maybe expose this at some point if it breaks a puzzle or something groupRoot.SetActive(true); } @@ -133,7 +134,7 @@ namespace NewHorizons.Builder.Props var shuffle = shuffleParent.AddComponent(); 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); @@ -172,6 +173,7 @@ namespace NewHorizons.Builder.Props } } + // BUG: does this even work? since it runs before BoxShapeFixer can fix stuff and also doesnt care about skinned guys public static Bounds GetBoundsOfSelfAndChildMeshes(GameObject g) { var meshFilters = g.GetComponentsInChildren(); @@ -207,6 +209,10 @@ namespace NewHorizons.Builder.Props } } + /// + /// for some reason mesh bounds are wrong unless we wait a bit + /// so this script contiously checks everything until it is correct + /// public class BoxShapeFixer : MonoBehaviour { public BoxShape shape; diff --git a/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs b/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs index ba961a47..684e33e2 100644 --- a/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs +++ b/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs @@ -4,6 +4,10 @@ using UnityEngine; namespace NewHorizons.Components.Quantum { + /// + /// exists because MultiStateQuantumObject only checks visibility on the current state, + /// whereas this one also checks on each new state, in case they are bigger + /// public class NHMultiStateQuantumObject : MultiStateQuantumObject { public override bool ChangeQuantumState(bool skipInstantVisibilityCheck) @@ -87,6 +91,7 @@ namespace NewHorizons.Components.Quantum { var isPlayerEntangled = IsPlayerEntangled(); var illumination = CheckIllumination(); + // faster than full CheckVisibility var visibility = CheckVisibilityInstantly(); var playerInside = CheckPointInside(Locator.GetPlayerCamera().transform.position); From ee18a39ea1fae4c96825d3b8e6161219afa27a1a Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sun, 3 Sep 2023 14:58:45 -0700 Subject: [PATCH 10/16] better comment --- NewHorizons/Builder/Props/QuantumBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/QuantumBuilder.cs b/NewHorizons/Builder/Props/QuantumBuilder.cs index dbe2b1d7..4fb4c17e 100644 --- a/NewHorizons/Builder/Props/QuantumBuilder.cs +++ b/NewHorizons/Builder/Props/QuantumBuilder.cs @@ -118,7 +118,7 @@ namespace NewHorizons.Builder.Props multiState._states = states.ToArray(); multiState._prerequisiteObjects = new MultiStateQuantumObject[0]; // TODO: support this multiState._initialState = 0; - // bound to the sector, as snapshot events are listened to then + // snapshot events arent listened to outside of the sector, so this isnt really infintie fortunately multiState._maxSnapshotLockRange = Mathf.Infinity; // TODO: maybe expose this at some point if it breaks a puzzle or something groupRoot.SetActive(true); } From 110fa467120e1278866152eed04b8afd37f01bd4 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sun, 3 Sep 2023 15:27:18 -0700 Subject: [PATCH 11/16] typo --- NewHorizons/Builder/Props/QuantumBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/QuantumBuilder.cs b/NewHorizons/Builder/Props/QuantumBuilder.cs index 4fb4c17e..60459ef6 100644 --- a/NewHorizons/Builder/Props/QuantumBuilder.cs +++ b/NewHorizons/Builder/Props/QuantumBuilder.cs @@ -118,7 +118,7 @@ namespace NewHorizons.Builder.Props multiState._states = states.ToArray(); multiState._prerequisiteObjects = new MultiStateQuantumObject[0]; // TODO: support this multiState._initialState = 0; - // snapshot events arent listened to outside of the sector, so this isnt really infintie fortunately + // 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); } From d0ba74f4cd59a0dad5b3e1e7795e61621f2d115a Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sun, 3 Sep 2023 15:30:23 -0700 Subject: [PATCH 12/16] undo that GeneralPropBuilder rename i made a while ago cuz its dumb --- NewHorizons/Builder/Props/GeneralPropBuilder.cs | 12 ++++++------ NewHorizons/Builder/Props/QuantumBuilder.cs | 2 +- NewHorizons/Handlers/VesselWarpHandler.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/NewHorizons/Builder/Props/GeneralPropBuilder.cs b/NewHorizons/Builder/Props/GeneralPropBuilder.cs index 70c164c2..9b709bae 100644 --- a/NewHorizons/Builder/Props/GeneralPropBuilder.cs +++ b/NewHorizons/Builder/Props/GeneralPropBuilder.cs @@ -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); } } } diff --git a/NewHorizons/Builder/Props/QuantumBuilder.cs b/NewHorizons/Builder/Props/QuantumBuilder.cs index 60459ef6..33c7e44e 100644 --- a/NewHorizons/Builder/Props/QuantumBuilder.cs +++ b/NewHorizons/Builder/Props/QuantumBuilder.cs @@ -46,7 +46,7 @@ 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(); sockets[i]._lightSources = new Light[0]; // TODO: make this customizable? diff --git a/NewHorizons/Handlers/VesselWarpHandler.cs b/NewHorizons/Handlers/VesselWarpHandler.cs index 07277776..12859c3a 100644 --- a/NewHorizons/Handlers/VesselWarpHandler.cs +++ b/NewHorizons/Handlers/VesselWarpHandler.cs @@ -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; From 47f2c083b738be572a039788077de7d6455ed3a9 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 6 Sep 2023 16:22:02 -0700 Subject: [PATCH 13/16] doc --- NewHorizons/Builder/Props/QuantumBuilder.cs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/NewHorizons/Builder/Props/QuantumBuilder.cs b/NewHorizons/Builder/Props/QuantumBuilder.cs index 33c7e44e..dff1d3a7 100644 --- a/NewHorizons/Builder/Props/QuantumBuilder.cs +++ b/NewHorizons/Builder/Props/QuantumBuilder.cs @@ -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) FIXED! - 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); @@ -116,7 +107,7 @@ 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 @@ -173,7 +164,7 @@ namespace NewHorizons.Builder.Props } } - // BUG: does this even work? since it runs before BoxShapeFixer can fix stuff and also doesnt care about skinned guys + // BUG: ignores skinned guys. this coincidentally makes it work without BoxShapeFixer public static Bounds GetBoundsOfSelfAndChildMeshes(GameObject g) { var meshFilters = g.GetComponentsInChildren(); @@ -212,6 +203,9 @@ namespace NewHorizons.Builder.Props /// /// 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 /// public class BoxShapeFixer : MonoBehaviour { From 12a114d4a01cc6e8679923c5e3d526ca7d0cc140 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Thu, 7 Sep 2023 14:53:15 -0700 Subject: [PATCH 14/16] revert "remove pulsar" else it explodes --- NewHorizons/Builder/Body/StellarRemnantBuilder.cs | 7 +++++++ NewHorizons/External/Modules/VariableSize/StarModule.cs | 1 + 2 files changed, 8 insertions(+) diff --git a/NewHorizons/Builder/Body/StellarRemnantBuilder.cs b/NewHorizons/Builder/Body/StellarRemnantBuilder.cs index 5dd00158..8cfd7520 100644 --- a/NewHorizons/Builder/Body/StellarRemnantBuilder.cs +++ b/NewHorizons/Builder/Body/StellarRemnantBuilder.cs @@ -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: diff --git a/NewHorizons/External/Modules/VariableSize/StarModule.cs b/NewHorizons/External/Modules/VariableSize/StarModule.cs index 21875dd8..3b833051 100644 --- a/NewHorizons/External/Modules/VariableSize/StarModule.cs +++ b/NewHorizons/External/Modules/VariableSize/StarModule.cs @@ -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 } From d49ffeb5b4b0c22ab17addb204b2efe3d291bb80 Mon Sep 17 00:00:00 2001 From: Ben C Date: Thu, 7 Sep 2023 22:06:41 +0000 Subject: [PATCH 15/16] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 380c4dfb..a63e8eb5 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -3507,6 +3507,7 @@ "Default", "WhiteDwarf", "NeutronStar", + "Pulsar", "BlackHole", "Custom" ], @@ -3514,6 +3515,7 @@ "default", "whiteDwarf", "neutronStar", + "pulsar", "blackHole", "custom" ] From 4877af788a902a3e3089f3f84a0d86e497b73fa3 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Thu, 7 Sep 2023 15:12:29 -0700 Subject: [PATCH 16/16] doc --- NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs b/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs index 684e33e2..7f11f8d7 100644 --- a/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs +++ b/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs @@ -94,6 +94,7 @@ namespace NewHorizons.Components.Quantum // faster than full CheckVisibility var visibility = CheckVisibilityInstantly(); var playerInside = CheckPointInside(Locator.GetPlayerCamera().transform.position); + // does not check probe, but thats okay var notEntangledCheck = illumination ? visibility : playerInside; var isVisible = isPlayerEntangled ? illumination : notEntangledCheck;