Implement #389 playWithShipLogFacts, fix #392

This commit is contained in:
Damián Garro 2022-10-10 19:00:42 -03:00
parent ed5052c169
commit 3159b7590f
2 changed files with 23 additions and 8 deletions

View File

@ -130,8 +130,7 @@ namespace NewHorizons.Builder.Props
slideCollectionContainer.slideCollection = slideCollection; slideCollectionContainer.slideCollection = slideCollection;
// Idk why but it wants reveals to be comma delimited not a list LinkShipLogFacts(info, slideCollectionContainer);
if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals);
StreamingHandler.SetUpStreaming(slideReelObj, sector); StreamingHandler.SetUpStreaming(slideReelObj, sector);
@ -245,8 +244,7 @@ namespace NewHorizons.Builder.Props
target.slideCollection = g.AddComponent<MindSlideCollection>(); target.slideCollection = g.AddComponent<MindSlideCollection>();
target.slideCollection._slideCollectionContainer = slideCollectionContainer; target.slideCollection._slideCollectionContainer = slideCollectionContainer;
// Idk why but it wants reveals to be comma delimited not a list LinkShipLogFacts(info, slideCollectionContainer);
if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals);
return g; return g;
} }
@ -324,11 +322,12 @@ namespace NewHorizons.Builder.Props
mindSlideCollection._slideCollectionContainer = slideCollectionContainer; mindSlideCollection._slideCollectionContainer = slideCollectionContainer;
// Make sure that these slides play when the player wanders into the beam // 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); mindSlideProjector.SetMindSlideCollection(mindSlideCollection);
slideCollectionContainer._initialized = false;
// Idk why but it wants reveals to be comma delimited not a list LinkShipLogFacts(info, slideCollectionContainer);
if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals);
return standingTorch; return standingTorch;
} }
@ -405,6 +404,14 @@ namespace NewHorizons.Builder.Props
Slide.WriteModules(modules, ref slide._modulesList, ref slide._modulesData, ref slide.lengths); 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<string>();
}
} }
public class VisionTorchTarget : MonoBehaviour public class VisionTorchTarget : MonoBehaviour

View File

@ -612,10 +612,18 @@ namespace NewHorizons.External.Modules
public MVector3 position; public MVector3 position;
/// <summary> /// <summary>
/// The ship log entries revealed after finishing this slide reel. /// The ship log facts revealed after finishing this slide reel.
/// </summary> /// </summary>
public string[] reveals; public string[] reveals;
/// <summary>
/// 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.
/// </summary>
public string[] playWithShipLogFacts;
/// <summary> /// <summary>
/// The rotation of this slideshow. /// The rotation of this slideshow.
/// </summary> /// </summary>
@ -707,7 +715,7 @@ namespace NewHorizons.External.Modules
// SlideShipLogEntryModule // SlideShipLogEntryModule
/// <summary> /// <summary>
/// Ship log entry revealed when viewing this slide /// Ship log fact revealed when viewing this slide
/// </summary> /// </summary>
public string reveal; public string reveal;