Implement #389 playWithShipLogFacts, fix #392 (#418)

## Major features
- Added `playWithShipLogFacts ` to `slideShows` to make reels play in
ship log computer.. #389

## Bug fixes
- Fix NRE errors caused by visions (`visionTorchTarget` and
`standingVisionTorch`) initialization. #392
- Fix reels (`slideReel`) showing up in Echoes of the Eye entries
replacing the vanilla reel:

![reel](https://user-images.githubusercontent.com/22490080/194959455-9a1d02d7-a5d3-41d8-8d3f-f9c15f92b9ea.jpg)
This commit is contained in:
Will Corby 2022-10-10 17:27:04 -07:00 committed by GitHub
commit b3c7d30f5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 13 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;
} }
@ -323,13 +321,10 @@ namespace NewHorizons.Builder.Props
var mindSlideCollection = standingTorch.AddComponent<MindSlideCollection>(); var mindSlideCollection = standingTorch.AddComponent<MindSlideCollection>();
mindSlideCollection._slideCollectionContainer = slideCollectionContainer; mindSlideCollection._slideCollectionContainer = slideCollectionContainer;
// Make sure that these slides play when the player wanders into the beam LinkShipLogFacts(info, slideCollectionContainer);
mindSlideProjector.SetMindSlideCollection(mindSlideCollection); mindSlideProjector.SetMindSlideCollection(mindSlideCollection);
// Idk why but it wants reveals to be comma delimited not a list
if (info.reveals != null) slideCollectionContainer._shipLogOnComplete = string.Join(",", info.reveals);
return standingTorch; return standingTorch;
} }
@ -405,6 +400,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

@ -617,10 +617,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>
@ -712,7 +720,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;

View File

@ -1425,7 +1425,14 @@
}, },
"reveals": { "reveals": {
"type": "array", "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": { "items": {
"type": "string" "type": "string"
} }
@ -1504,7 +1511,7 @@
}, },
"reveal": { "reveal": {
"type": "string", "type": "string",
"description": "Ship log entry revealed when viewing this slide" "description": "Ship log fact revealed when viewing this slide"
}, },
"spotIntensityMod": { "spotIntensityMod": {
"type": "number", "type": "number",