Add different slide reel prefabs

This commit is contained in:
Noah Pilarski 2024-06-01 23:45:33 -04:00
parent fb9e10fee7
commit e40460845c
4 changed files with 180 additions and 18 deletions

View File

@ -1,12 +1,12 @@
ManifestFileVersion: 0 ManifestFileVersion: 0
CRC: 3537427957 CRC: 423323461
Hashes: Hashes:
AssetFileHash: AssetFileHash:
serializedVersion: 2 serializedVersion: 2
Hash: c4d8f41970054074bb375ac5cbe82855 Hash: 4199cf66477e2054e4ac61871d811161
TypeTreeHash: TypeTreeHash:
serializedVersion: 2 serializedVersion: 2
Hash: de71b9c55befb829b1640ea21774b932 Hash: 83784250589f972ee0b86ea39a5a5305
HashAppended: 0 HashAppended: 0
ClassTypes: ClassTypes:
- Class: 1 - Class: 1
@ -17,6 +17,8 @@ ClassTypes:
Script: {instanceID: 0} Script: {instanceID: 0}
- Class: 23 - Class: 23
Script: {instanceID: 0} Script: {instanceID: 0}
- Class: 28
Script: {instanceID: 0}
- Class: 33 - Class: 33
Script: {instanceID: 0} Script: {instanceID: 0}
- Class: 43 - Class: 43
@ -75,6 +77,8 @@ ClassTypes:
Script: {fileID: 11500000, guid: 040dd594681f07a4a975890a61d44be5, type: 3} Script: {fileID: 11500000, guid: 040dd594681f07a4a975890a61d44be5, type: 3}
- Class: 114 - Class: 114
Script: {fileID: 11500000, guid: 327eb94566c9e284dae5d7b1cfe11ccd, type: 3} Script: {fileID: 11500000, guid: 327eb94566c9e284dae5d7b1cfe11ccd, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: 8d56b3759dd12424c8425ed62fc02796, type: 3}
- Class: 114 - Class: 114
Script: {fileID: 11500000, guid: c317f6a5634f15f4c80f89e306616924, type: 3} Script: {fileID: 11500000, guid: c317f6a5634f15f4c80f89e306616924, type: 3}
- Class: 114 - Class: 114
@ -97,10 +101,14 @@ ClassTypes:
Script: {fileID: 11500000, guid: b4b79e57677045045a95bfe4fe447ce5, type: 3} Script: {fileID: 11500000, guid: b4b79e57677045045a95bfe4fe447ce5, type: 3}
- Class: 114 - Class: 114
Script: {fileID: 11500000, guid: 64247dd7b0c5ac640a6d9ae5360a0f5a, type: 3} Script: {fileID: 11500000, guid: 64247dd7b0c5ac640a6d9ae5360a0f5a, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: f645b92850d716a4488617b651223700, type: 3}
- Class: 114 - Class: 114
Script: {fileID: 11500000, guid: 8ef66a28deb09ab4aaba30bb60b9f19a, type: 3} Script: {fileID: 11500000, guid: 8ef66a28deb09ab4aaba30bb60b9f19a, type: 3}
- Class: 114 - Class: 114
Script: {fileID: 11500000, guid: 0863077874402f14dba0ca4ae81752dd, type: 3} Script: {fileID: 11500000, guid: 0863077874402f14dba0ca4ae81752dd, type: 3}
- Class: 114
Script: {fileID: 11500000, guid: bf998978a8a701b4eb09fcd94048f916, type: 3}
- Class: 114 - Class: 114
Script: {fileID: 11500000, guid: a9da74c8b134add4ba1d884336a5e075, type: 3} Script: {fileID: 11500000, guid: a9da74c8b134add4ba1d884336a5e075, type: 3}
- Class: 114 - Class: 114
@ -171,7 +179,24 @@ ClassTypes:
Script: {instanceID: 0} Script: {instanceID: 0}
SerializeReferenceClassIdentifiers: [] SerializeReferenceClassIdentifiers: []
Assets: Assets:
- Assets/SlideReels/Prefab_DW_Reel_Whole.prefab
- Assets/SlideReels/Prefab_IP_Reel_Rusted_7.prefab
- Assets/SlideReels/Prefab_IP_Reel_Destroyed_6.prefab
- Assets/SlideReels/Effects_IP_SIM_SlideReel.prefab
- Assets/SlideReels/Prefab_DW_Reel_7.prefab
- Assets/SlideReels/Prefab_IP_Reel_Rusted_6.prefab
- Assets/SlideReels/Prefab_IP_Reel_Rusted_8.prefab
- Assets/SlideReels/Prefab_DW_Reel_6.prefab
- Assets/SlideReels/Prefab_IP_Reel_8.prefab
- Assets/SlideReels/Prefab_IP_Reel_6.prefab
- Assets/SlideReels/Prefab_IP_Reel_Destroyed_7.prefab
- Assets/SlideReels/Prefab_IP_Reel_Destroyed_Whole.prefab
- Assets/SlideReels/Prefab_IP_Reel_Destroyed_8.prefab
- Assets/SlideReels/Prefab_IP_Reel_Whole.prefab
- Assets/SlideReels/Prefab_IP_Reel_Rusted_Whole.prefab
- Assets/BrambleCollision.prefab - Assets/BrambleCollision.prefab
- Assets/SlideReels/Prefab_DW_Reel_8.prefab
- Assets/Vessel_Body.prefab - Assets/Vessel_Body.prefab
- Assets/AmbientLight_QM.png - Assets/AmbientLight_QM.png
- Assets/SlideReels/Prefab_IP_Reel_7.prefab
Dependencies: [] Dependencies: []

View File

@ -10,12 +10,29 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
using UnityEngine; using UnityEngine;
using static NewHorizons.Main;
namespace NewHorizons.Builder.Props namespace NewHorizons.Builder.Props
{ {
public static class ProjectionBuilder public static class ProjectionBuilder
{ {
private static GameObject _slideReelPrefab; public static GameObject SlideReelWholePrefab { get; private set; }
public static GameObject SlideReelWholePristinePrefab { get; private set; }
public static GameObject SlideReelWholeRustedPrefab { get; private set; }
public static GameObject SlideReelWholeDestroyedPrefab { get; private set; }
public static GameObject SlideReel8Prefab { get; private set; }
public static GameObject SlideReel8PristinePrefab { get; private set; }
public static GameObject SlideReel8RustedPrefab { get; private set; }
public static GameObject SlideReel8DestroyedPrefab { get; private set; }
public static GameObject SlideReel7Prefab { get; private set; }
public static GameObject SlideReel7PristinePrefab { get; private set; }
public static GameObject SlideReel7RustedPrefab { get; private set; }
public static GameObject SlideReel7DestroyedPrefab { get; private set; }
public static GameObject SlideReel6Prefab { get; private set; }
public static GameObject SlideReel6PristinePrefab { get; private set; }
public static GameObject SlideReel6RustedPrefab { get; private set; }
public static GameObject SlideReel6DestroyedPrefab { get; private set; }
private static GameObject _autoPrefab; private static GameObject _autoPrefab;
private static GameObject _visionTorchDetectorPrefab; private static GameObject _visionTorchDetectorPrefab;
private static GameObject _standingVisionTorchPrefab; private static GameObject _standingVisionTorchPrefab;
@ -29,14 +46,22 @@ namespace NewHorizons.Builder.Props
_isInit = true; _isInit = true;
if (_slideReelPrefab == null) SlideReelWholePrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_IP_Reel_Whole");
{ SlideReelWholePristinePrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_DW_Reel_Whole");
_slideReelPrefab = SearchUtilities.Find("RingWorld_Body/Sector_RingInterior/Sector_Zone1/Sector_SlideBurningRoom_Zone1/Interactables_SlideBurningRoom_Zone1/Prefab_IP_SecretAlcove/RotationPivot/SlideReelSocket/Prefab_IP_Reel_1_LibraryPath")?.gameObject?.InstantiateInactive()?.Rename("Prefab_IP_Reel")?.DontDestroyOnLoad(); SlideReelWholeRustedPrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_IP_Reel_Rusted_Whole");
if (_slideReelPrefab == null) SlideReelWholeDestroyedPrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_IP_Reel_Destroyed_Whole");
NHLogger.LogWarning($"Tried to make slide reel prefab but couldn't. Do you have the DLC installed?"); SlideReel8Prefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_IP_Reel_8");
else SlideReel8PristinePrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_DW_Reel_8");
_slideReelPrefab.AddComponent<DestroyOnDLC>()._destroyOnDLCNotOwned = true; SlideReel8RustedPrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_IP_Reel_Rusted_8");
} SlideReel8DestroyedPrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_IP_Reel_Destroyed_8");
SlideReel7Prefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_IP_Reel_7");
SlideReel7PristinePrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_DW_Reel_7");
SlideReel7RustedPrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_IP_Reel_Rusted_7");
SlideReel7DestroyedPrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_IP_Reel_Destroyed_7");
SlideReel6Prefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_IP_Reel_6");
SlideReel6PristinePrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_DW_Reel_6");
SlideReel6RustedPrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_IP_Reel_Rusted_6");
SlideReel6DestroyedPrefab = NHPrivateAssetBundle.LoadAsset<GameObject>("Prefab_IP_Reel_Destroyed_6");
if (_autoPrefab == null) if (_autoPrefab == null)
{ {
@ -92,9 +117,11 @@ namespace NewHorizons.Builder.Props
{ {
InitPrefabs(); InitPrefabs();
if (_slideReelPrefab == null) return null; GameObject prefab = GetSlideReelPrefab(info.reelModel, info.reelCondition);
var slideReelObj = GeneralPropBuilder.MakeFromPrefab(_slideReelPrefab, $"Prefab_IP_Reel_{mod.ModHelper.Manifest.Name}", planetGO, sector, info); if (prefab == null) return null;
var slideReelObj = GeneralPropBuilder.MakeFromPrefab(prefab, $"Prefab_IP_Reel_{GetSlideReelName(info.reelModel, info.reelCondition)}_{mod.ModHelper.Manifest.Name}", planetGO, sector, info);
var slideReel = slideReelObj.GetComponent<SlideReelItem>(); var slideReel = slideReelObj.GetComponent<SlideReelItem>();
slideReel.SetSector(sector); slideReel.SetSector(sector);
@ -131,18 +158,20 @@ namespace NewHorizons.Builder.Props
if (index < textures.Length) if (index < textures.Length)
{ {
textures[index] = tex; textures[index] = tex;
if (Interlocked.Increment(ref displaySlidesLoaded) == textures.Length) if (Interlocked.Increment(ref displaySlidesLoaded) >= textures.Length)
{ {
// all textures required to build the reel's textures have been loaded // all textures required to build the reel's textures have been loaded
var slidesBack = slideReelObj.transform.Find("Props_IP_SlideReel_7/Slides_Back").GetComponent<MeshRenderer>(); var slidesBack = slideReelObj.GetComponentInChildren<TransformAnimator>().transform.Find("Slides_Back").GetComponent<MeshRenderer>();
var slidesFront = slideReelObj.transform.Find("Props_IP_SlideReel_7/Slides_Front").GetComponent<MeshRenderer>(); var slidesFront = slideReelObj.GetComponentInChildren<TransformAnimator>().transform.Find("Slides_Front").GetComponent<MeshRenderer>();
// Now put together the textures into a 4x4 thing for the materials // Now put together the textures into a 4x4 thing for the materials
var reelTexture = ImageUtilities.MakeReelTexture(textures); var reelTexture = ImageUtilities.MakeReelTexture(textures);
slidesBack.material.mainTexture = reelTexture; slidesBack.material.mainTexture = reelTexture;
slidesBack.material.SetTexture(EmissionMap, reelTexture); slidesBack.material.SetTexture(EmissionMap, reelTexture);
slidesBack.material.name = reelTexture.name;
slidesFront.material.mainTexture = reelTexture; slidesFront.material.mainTexture = reelTexture;
slidesFront.material.SetTexture(EmissionMap, reelTexture); slidesFront.material.SetTexture(EmissionMap, reelTexture);
slidesFront.material.name = reelTexture.name;
} }
} }
} }
@ -162,6 +191,82 @@ namespace NewHorizons.Builder.Props
return slideReelObj; return slideReelObj;
} }
private static GameObject GetSlideReelPrefab(ProjectionInfo.SlideReelType model, ProjectionInfo.SlideReelCondition condition)
{
switch (model)
{
case ProjectionInfo.SlideReelType.SixSlides:
{
switch (condition)
{
case ProjectionInfo.SlideReelCondition.Antique:
default:
return SlideReel6Prefab;
case ProjectionInfo.SlideReelCondition.Pristine:
return SlideReel6PristinePrefab;
case ProjectionInfo.SlideReelCondition.Rusted:
return SlideReel6RustedPrefab;
}
}
case ProjectionInfo.SlideReelType.SevenSlides:
default:
{
switch (condition)
{
case ProjectionInfo.SlideReelCondition.Antique:
default:
return SlideReel7Prefab;
case ProjectionInfo.SlideReelCondition.Pristine:
return SlideReel7PristinePrefab;
case ProjectionInfo.SlideReelCondition.Rusted:
return SlideReel7RustedPrefab;
}
}
case ProjectionInfo.SlideReelType.EightSlides:
{
switch (condition)
{
case ProjectionInfo.SlideReelCondition.Antique:
default:
return SlideReel8Prefab;
case ProjectionInfo.SlideReelCondition.Pristine:
return SlideReel8PristinePrefab;
case ProjectionInfo.SlideReelCondition.Rusted:
return SlideReel8RustedPrefab;
}
}
case ProjectionInfo.SlideReelType.Whole:
{
switch (condition)
{
case ProjectionInfo.SlideReelCondition.Antique:
default:
return SlideReelWholePrefab;
case ProjectionInfo.SlideReelCondition.Pristine:
return SlideReelWholePristinePrefab;
case ProjectionInfo.SlideReelCondition.Rusted:
return SlideReelWholeRustedPrefab;
}
}
}
}
private static string GetSlideReelName(ProjectionInfo.SlideReelType model, ProjectionInfo.SlideReelCondition condition)
{
switch (model)
{
case ProjectionInfo.SlideReelType.SixSlides:
return $"6_{condition}";
case ProjectionInfo.SlideReelType.SevenSlides:
return $"7_{condition}";
case ProjectionInfo.SlideReelType.EightSlides:
return $"8_{condition}";
case ProjectionInfo.SlideReelType.Whole:
default:
return $"{model}_{condition}";
}
}
public static GameObject MakeAutoProjector(GameObject planetGO, Sector sector, ProjectionInfo info, IModBehaviour mod) public static GameObject MakeAutoProjector(GameObject planetGO, Sector sector, ProjectionInfo info, IModBehaviour mod)
{ {
InitPrefabs(); InitPrefabs();

View File

@ -21,6 +21,28 @@ namespace NewHorizons.External.Modules.Props.EchoesOfTheEye
} }
[JsonConverter(typeof(StringEnumConverter))]
public enum SlideReelType
{
[EnumMember(Value = @"sixSlides")] SixSlides = 6,
[EnumMember(Value = @"sevenSlides")] SevenSlides = 7,
[EnumMember(Value = @"eightSlides")] EightSlides = 8,
[EnumMember(Value = @"whole")] Whole = 9,
}
[JsonConverter(typeof(StringEnumConverter))]
public enum SlideReelCondition
{
[EnumMember(Value = @"antique")] Antique = 0,
[EnumMember(Value = @"pristine")] Pristine = 1,
[EnumMember(Value = @"rusted")] Rusted = 2,
}
/// <summary> /// <summary>
/// The ship log facts revealed after finishing this slide reel. /// The ship log facts revealed after finishing this slide reel.
/// </summary> /// </summary>
@ -43,6 +65,16 @@ namespace NewHorizons.External.Modules.Props.EchoesOfTheEye
/// The type of object this is. /// The type of object this is.
/// </summary> /// </summary>
[DefaultValue("slideReel")] public SlideShowType type = SlideShowType.SlideReel; [DefaultValue("slideReel")] public SlideShowType type = SlideShowType.SlideReel;
/// <summary>
/// Exclusive to the slide reel type. Model/mesh of the reel. Each model has a different number of slides on it. Whole has 7 slides but a full ring like 8.
/// </summary>
[DefaultValue("sevenSlides")] public SlideReelType reelModel = SlideReelType.SevenSlides;
/// <summary>
/// Exclusive to the slide reel type. Condition/material of the reel. Antique is the Stranger, Pristine is the Dreamworld, Rusted is a burned reel.
/// </summary>
[DefaultValue("antique")] public SlideReelCondition reelCondition = SlideReelCondition.Antique;
} }
} }