From 3159b7590fbd37782c25664d084e90f2fa0c32d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Garro?= Date: Mon, 10 Oct 2022 19:00:42 -0300 Subject: [PATCH 1/3] Implement #389 playWithShipLogFacts, fix #392 --- .../Builder/Props/ProjectionBuilder.cs | 19 +++++++++++++------ NewHorizons/External/Modules/PropModule.cs | 12 ++++++++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/NewHorizons/Builder/Props/ProjectionBuilder.cs b/NewHorizons/Builder/Props/ProjectionBuilder.cs index 32876489..bcd4c663 100644 --- a/NewHorizons/Builder/Props/ProjectionBuilder.cs +++ b/NewHorizons/Builder/Props/ProjectionBuilder.cs @@ -130,8 +130,7 @@ namespace NewHorizons.Builder.Props slideCollectionContainer.slideCollection = slideCollection; - // Idk why but it wants reveals to be comma delimited not a list - if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals); + LinkShipLogFacts(info, slideCollectionContainer); StreamingHandler.SetUpStreaming(slideReelObj, sector); @@ -245,8 +244,7 @@ namespace NewHorizons.Builder.Props target.slideCollection = g.AddComponent(); target.slideCollection._slideCollectionContainer = slideCollectionContainer; - // Idk why but it wants reveals to be comma delimited not a list - if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals); + LinkShipLogFacts(info, slideCollectionContainer); return g; } @@ -324,11 +322,12 @@ namespace NewHorizons.Builder.Props mindSlideCollection._slideCollectionContainer = slideCollectionContainer; // Make sure that these slides play when the player wanders into the beam + slideCollectionContainer._initialized = true; // Hack to avoid initialization in the following call (it would throw NRE) mindSlideProjector.SetMindSlideCollection(mindSlideCollection); + slideCollectionContainer._initialized = false; - // Idk why but it wants reveals to be comma delimited not a list - if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals); + LinkShipLogFacts(info, slideCollectionContainer); return standingTorch; } @@ -405,6 +404,14 @@ namespace NewHorizons.Builder.Props Slide.WriteModules(modules, ref slide._modulesList, ref slide._modulesData, ref slide.lengths); } + + private static void LinkShipLogFacts(ProjectionInfo info, SlideCollectionContainer slideCollectionContainer) + { + // Idk why but it wants reveals to be comma delimited not a list + if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals); + // Don't use null value, NRE in SlideCollectionContainer.Initialize + slideCollectionContainer._playWithShipLogFacts = info.playWithShipLogFacts ?? Array.Empty(); + } } public class VisionTorchTarget : MonoBehaviour diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index 807aa9d6..3852a0ab 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -612,10 +612,18 @@ namespace NewHorizons.External.Modules public MVector3 position; /// - /// The ship log entries revealed after finishing this slide reel. + /// The ship log facts revealed after finishing this slide reel. /// public string[] reveals; + /// + /// The ship log facts that make the reel play when they are displayed in the computer (by selecting entries or arrows). + /// You should probably include facts from `reveals` here. + /// If you only specify a rumor fact, then it would only play in its ship log entry if this has revealed only + /// rumor facts because an entry with revealed explore facts doesn't display rumor facts. + /// + public string[] playWithShipLogFacts; + /// /// The rotation of this slideshow. /// @@ -707,7 +715,7 @@ namespace NewHorizons.External.Modules // SlideShipLogEntryModule /// - /// Ship log entry revealed when viewing this slide + /// Ship log fact revealed when viewing this slide /// public string reveal; From bec7560a9f850c9f095aac8d2fd689c80cfc7d11 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 10 Oct 2022 22:02:42 +0000 Subject: [PATCH 2/3] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index ddfb16c5..d3097dc2 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1419,7 +1419,14 @@ }, "reveals": { "type": "array", - "description": "The ship log entries revealed after finishing this slide reel.", + "description": "The ship log facts revealed after finishing this slide reel.", + "items": { + "type": "string" + } + }, + "playWithShipLogFacts": { + "type": "array", + "description": "The ship log facts that make the reel play when they are displayed in the computer (by selecting entries or arrows).\nYou should probably include facts from `reveals` here.\nIf you only specify a rumor fact, then it would only play in its ship log entry if this has revealed only\nrumor facts because an entry with revealed explore facts doesn't display rumor facts.", "items": { "type": "string" } @@ -1498,7 +1505,7 @@ }, "reveal": { "type": "string", - "description": "Ship log entry revealed when viewing this slide" + "description": "Ship log fact revealed when viewing this slide" }, "spotIntensityMod": { "type": "number", From 308a83e6f3f344efe69429f31337a06a5362e68d Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Mon, 10 Oct 2022 17:26:14 -0700 Subject: [PATCH 3/3] LinkShipLogFacts before SetMindSlideCollection to prevent NRE --- NewHorizons/Builder/Props/ProjectionBuilder.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/NewHorizons/Builder/Props/ProjectionBuilder.cs b/NewHorizons/Builder/Props/ProjectionBuilder.cs index bcd4c663..de4060bd 100644 --- a/NewHorizons/Builder/Props/ProjectionBuilder.cs +++ b/NewHorizons/Builder/Props/ProjectionBuilder.cs @@ -321,14 +321,10 @@ namespace NewHorizons.Builder.Props var mindSlideCollection = standingTorch.AddComponent(); mindSlideCollection._slideCollectionContainer = slideCollectionContainer; - // Make sure that these slides play when the player wanders into the beam - slideCollectionContainer._initialized = true; // Hack to avoid initialization in the following call (it would throw NRE) - mindSlideProjector.SetMindSlideCollection(mindSlideCollection); - slideCollectionContainer._initialized = false; - - LinkShipLogFacts(info, slideCollectionContainer); + mindSlideProjector.SetMindSlideCollection(mindSlideCollection); + return standingTorch; }