diff --git a/NewHorizons/Assets/newhorizons_private b/NewHorizons/Assets/newhorizons_private index f15bd4c7b..f0e946e7b 100644 Binary files a/NewHorizons/Assets/newhorizons_private and b/NewHorizons/Assets/newhorizons_private differ diff --git a/NewHorizons/Assets/newhorizons_private.manifest b/NewHorizons/Assets/newhorizons_private.manifest index 71d62e919..34d430999 100644 --- a/NewHorizons/Assets/newhorizons_private.manifest +++ b/NewHorizons/Assets/newhorizons_private.manifest @@ -1,12 +1,12 @@ ManifestFileVersion: 0 -CRC: 3537427957 +CRC: 423323461 Hashes: AssetFileHash: serializedVersion: 2 - Hash: c4d8f41970054074bb375ac5cbe82855 + Hash: 4199cf66477e2054e4ac61871d811161 TypeTreeHash: serializedVersion: 2 - Hash: de71b9c55befb829b1640ea21774b932 + Hash: 83784250589f972ee0b86ea39a5a5305 HashAppended: 0 ClassTypes: - Class: 1 @@ -17,6 +17,8 @@ ClassTypes: Script: {instanceID: 0} - Class: 23 Script: {instanceID: 0} +- Class: 28 + Script: {instanceID: 0} - Class: 33 Script: {instanceID: 0} - Class: 43 @@ -75,6 +77,8 @@ ClassTypes: Script: {fileID: 11500000, guid: 040dd594681f07a4a975890a61d44be5, type: 3} - Class: 114 Script: {fileID: 11500000, guid: 327eb94566c9e284dae5d7b1cfe11ccd, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: 8d56b3759dd12424c8425ed62fc02796, type: 3} - Class: 114 Script: {fileID: 11500000, guid: c317f6a5634f15f4c80f89e306616924, type: 3} - Class: 114 @@ -97,10 +101,14 @@ ClassTypes: Script: {fileID: 11500000, guid: b4b79e57677045045a95bfe4fe447ce5, type: 3} - Class: 114 Script: {fileID: 11500000, guid: 64247dd7b0c5ac640a6d9ae5360a0f5a, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: f645b92850d716a4488617b651223700, type: 3} - Class: 114 Script: {fileID: 11500000, guid: 8ef66a28deb09ab4aaba30bb60b9f19a, type: 3} - Class: 114 Script: {fileID: 11500000, guid: 0863077874402f14dba0ca4ae81752dd, type: 3} +- Class: 114 + Script: {fileID: 11500000, guid: bf998978a8a701b4eb09fcd94048f916, type: 3} - Class: 114 Script: {fileID: 11500000, guid: a9da74c8b134add4ba1d884336a5e075, type: 3} - Class: 114 @@ -171,7 +179,24 @@ ClassTypes: Script: {instanceID: 0} SerializeReferenceClassIdentifiers: [] 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/SlideReels/Prefab_DW_Reel_8.prefab - Assets/Vessel_Body.prefab - Assets/AmbientLight_QM.png +- Assets/SlideReels/Prefab_IP_Reel_7.prefab Dependencies: [] diff --git a/NewHorizons/Builder/Props/ProjectionBuilder.cs b/NewHorizons/Builder/Props/ProjectionBuilder.cs index 7795f81cb..ed9d136a9 100644 --- a/NewHorizons/Builder/Props/ProjectionBuilder.cs +++ b/NewHorizons/Builder/Props/ProjectionBuilder.cs @@ -10,12 +10,29 @@ using System.IO; using System.Threading; using UnityEngine; +using static NewHorizons.Main; namespace NewHorizons.Builder.Props { 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 _visionTorchDetectorPrefab; private static GameObject _standingVisionTorchPrefab; @@ -29,14 +46,22 @@ internal static void InitPrefabs() _isInit = true; - if (_slideReelPrefab == null) - { - _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(); - if (_slideReelPrefab == null) - NHLogger.LogWarning($"Tried to make slide reel prefab but couldn't. Do you have the DLC installed?"); - else - _slideReelPrefab.AddComponent()._destroyOnDLCNotOwned = true; - } + SlideReelWholePrefab = NHPrivateAssetBundle.LoadAsset("Prefab_IP_Reel_Whole"); + SlideReelWholePristinePrefab = NHPrivateAssetBundle.LoadAsset("Prefab_DW_Reel_Whole"); + SlideReelWholeRustedPrefab = NHPrivateAssetBundle.LoadAsset("Prefab_IP_Reel_Rusted_Whole"); + SlideReelWholeDestroyedPrefab = NHPrivateAssetBundle.LoadAsset("Prefab_IP_Reel_Destroyed_Whole"); + SlideReel8Prefab = NHPrivateAssetBundle.LoadAsset("Prefab_IP_Reel_8"); + SlideReel8PristinePrefab = NHPrivateAssetBundle.LoadAsset("Prefab_DW_Reel_8"); + SlideReel8RustedPrefab = NHPrivateAssetBundle.LoadAsset("Prefab_IP_Reel_Rusted_8"); + SlideReel8DestroyedPrefab = NHPrivateAssetBundle.LoadAsset("Prefab_IP_Reel_Destroyed_8"); + SlideReel7Prefab = NHPrivateAssetBundle.LoadAsset("Prefab_IP_Reel_7"); + SlideReel7PristinePrefab = NHPrivateAssetBundle.LoadAsset("Prefab_DW_Reel_7"); + SlideReel7RustedPrefab = NHPrivateAssetBundle.LoadAsset("Prefab_IP_Reel_Rusted_7"); + SlideReel7DestroyedPrefab = NHPrivateAssetBundle.LoadAsset("Prefab_IP_Reel_Destroyed_7"); + SlideReel6Prefab = NHPrivateAssetBundle.LoadAsset("Prefab_IP_Reel_6"); + SlideReel6PristinePrefab = NHPrivateAssetBundle.LoadAsset("Prefab_DW_Reel_6"); + SlideReel6RustedPrefab = NHPrivateAssetBundle.LoadAsset("Prefab_IP_Reel_Rusted_6"); + SlideReel6DestroyedPrefab = NHPrivateAssetBundle.LoadAsset("Prefab_IP_Reel_Destroyed_6"); if (_autoPrefab == null) { @@ -92,9 +117,11 @@ private static GameObject MakeSlideReel(GameObject planetGO, Sector sector, Proj { InitPrefabs(); - if (_slideReelPrefab == null) return null; + GameObject prefab = GetSlideReelPrefab(info.reelModel, info.reelCondition); + + if (prefab == null) return null; - var slideReelObj = GeneralPropBuilder.MakeFromPrefab(_slideReelPrefab, $"Prefab_IP_Reel_{mod.ModHelper.Manifest.Name}", planetGO, sector, info); + var slideReelObj = GeneralPropBuilder.MakeFromPrefab(prefab, $"Prefab_IP_Reel_{GetSlideReelName(info.reelModel, info.reelCondition)}_{mod.ModHelper.Manifest.Name}", planetGO, sector, info); var slideReel = slideReelObj.GetComponent(); slideReel.SetSector(sector); @@ -124,25 +151,27 @@ private static GameObject MakeSlideReel(GameObject planetGO, Sector sector, Proj int displaySlidesLoaded = 0; imageLoader.imageLoadedEvent.AddListener( (Texture2D tex, int index) => - { + { slideCollection.slides[index]._image = ImageUtilities.Invert(tex); // Track the first 15 to put on the slide reel object if (index < textures.Length) { 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 - var slidesBack = slideReelObj.transform.Find("Props_IP_SlideReel_7/Slides_Back").GetComponent(); - var slidesFront = slideReelObj.transform.Find("Props_IP_SlideReel_7/Slides_Front").GetComponent(); + var slidesBack = slideReelObj.GetComponentInChildren().transform.Find("Slides_Back").GetComponent(); + var slidesFront = slideReelObj.GetComponentInChildren().transform.Find("Slides_Front").GetComponent(); // Now put together the textures into a 4x4 thing for the materials var reelTexture = ImageUtilities.MakeReelTexture(textures); slidesBack.material.mainTexture = reelTexture; slidesBack.material.SetTexture(EmissionMap, reelTexture); + slidesBack.material.name = reelTexture.name; slidesFront.material.mainTexture = reelTexture; slidesFront.material.SetTexture(EmissionMap, reelTexture); + slidesFront.material.name = reelTexture.name; } } } @@ -162,6 +191,97 @@ private static GameObject MakeSlideReel(GameObject planetGO, Sector sector, Proj 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; + } + } + } + } + + public 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 int GetSlideCount(ProjectionInfo.SlideReelType model) + { + switch (model) + { + case ProjectionInfo.SlideReelType.SixSlides: + return 6; + case ProjectionInfo.SlideReelType.SevenSlides: + case ProjectionInfo.SlideReelType.Whole: + return 7; + case ProjectionInfo.SlideReelType.EightSlides: + default: + return 8; + } + } + public static GameObject MakeAutoProjector(GameObject planetGO, Sector sector, ProjectionInfo info, IModBehaviour mod) { InitPrefabs(); @@ -314,6 +434,7 @@ private static ImageUtilities.AsyncImageLoader AddAsyncLoader(GameObject gameObj { var slide = new Slide(); var slideInfo = slides[i]; + slide._streamingImageID = i; // for SlideRotationModule if (string.IsNullOrEmpty(slideInfo.imagePath)) { @@ -388,6 +509,10 @@ private static void AddModules(SlideInfo slideInfo, ref Slide slide, IModBehavio }; modules.Add(shipLogEntry); } + if (slideInfo.rotate) + { + modules.Add(new SlideRotationModule()); + } Slide.WriteModules(modules, ref slide._modulesList, ref slide._modulesData, ref slide.lengths); } diff --git a/NewHorizons/External/Modules/Props/EchoesOfTheEye/ProjectionInfo.cs b/NewHorizons/External/Modules/Props/EchoesOfTheEye/ProjectionInfo.cs index f56e2cac4..ba6a98d40 100644 --- a/NewHorizons/External/Modules/Props/EchoesOfTheEye/ProjectionInfo.cs +++ b/NewHorizons/External/Modules/Props/EchoesOfTheEye/ProjectionInfo.cs @@ -21,6 +21,28 @@ public enum SlideShowType } + [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, + } + /// /// The ship log facts revealed after finishing this slide reel. /// @@ -43,6 +65,16 @@ public enum SlideShowType /// The type of object this is. /// [DefaultValue("slideReel")] public SlideShowType type = SlideShowType.SlideReel; + + /// + /// 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. + /// + [DefaultValue("sevenSlides")] public SlideReelType reelModel = SlideReelType.SevenSlides; + + /// + /// Exclusive to the slide reel type. Condition/material of the reel. Antique is the Stranger, Pristine is the Dreamworld, Rusted is a burned reel. + /// + [DefaultValue("antique")] public SlideReelCondition reelCondition = SlideReelCondition.Antique; } } diff --git a/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs b/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs index 26b6053d1..0b0079867 100644 --- a/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs +++ b/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs @@ -84,5 +84,12 @@ public class SlideInfo /// Set this to include ship log entry module. Base game default is "". /// public string reveal; + + // SlideRotationModule + + /// + /// Exclusive to slide reels. Whether this slide should rotate the reel item while inside a projector. + /// + [DefaultValue(true)] public bool rotate = true; } } \ No newline at end of file diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index b679d7d32..427f50c0c 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -2109,6 +2109,16 @@ "description": "The type of object this is.", "default": "slideReel", "$ref": "#/definitions/SlideShowType" + }, + "reelModel": { + "description": "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.", + "default": "sevenSlides", + "$ref": "#/definitions/SlideReelType" + }, + "reelCondition": { + "description": "Exclusive to the slide reel type. Condition/material of the reel. Antique is the Stranger, Pristine is the Dreamworld, Rusted is a burned reel.", + "default": "antique", + "$ref": "#/definitions/SlideReelCondition" } } }, @@ -2174,6 +2184,11 @@ "reveal": { "type": "string", "description": "Ship log fact revealed when viewing this slide.\nSet this to include ship log entry module. Base game default is \"\"." + }, + "rotate": { + "type": "boolean", + "description": "Exclusive to slide reels. Whether this slide should rotate the reel item while inside a projector.", + "default": true } } }, @@ -2193,6 +2208,36 @@ "standingVisionTorch" ] }, + "SlideReelType": { + "type": "string", + "description": "", + "x-enumNames": [ + "SixSlides", + "SevenSlides", + "EightSlides", + "Whole" + ], + "enum": [ + "sixSlides", + "sevenSlides", + "eightSlides", + "whole" + ] + }, + "SlideReelCondition": { + "type": "string", + "description": "", + "x-enumNames": [ + "Antique", + "Pristine", + "Rusted" + ], + "enum": [ + "antique", + "pristine", + "rusted" + ] + }, "QuantumGroupInfo": { "type": "object", "additionalProperties": false,