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] 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;