TeamMoonstorm / Starstorm2

A Port/Continuation of the Risk of Rain 1 mod: Starstorm.
GNU General Public License v3.0
26 stars 31 forks source link

NRE with RelicOfTermination #393

Closed WondaMegapon closed 6 months ago

WondaMegapon commented 6 months ago

Howdy! I'm working on Refightilization and I'm running into compatibility issues with Starstorm. This is probably a problem on my end, but I want to raise the issue here in case there's something y'all can help with.

https://github.com/TeamMoonstorm/Starstorm2/blob/2336d4b85ce4c873ca00d474dfcd2301a83493c2/SS2-Project/Assets/Starstorm2/Modules/Pickups/Items/Lunar/RelicOfTermination.cs#L115

I've drilled it down to this line, but I can't figure out why it's causing errors for me. It might be because I'm doing funny stuff with inventories.

https://github.com/WondaMegapon/Refightilization/blob/d191e4fef09d6c3b628ce60b8de9c9d0f94f40c4/Refightilization/Refightilization.cs#L419

Exception Log ``` [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key= RoR2/Base/Tooth/DisplayToothNecklaceDecal.prefab , Type=UnityEngine.GameObject [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key= RoR2/Base/ShinyPearl/DisplayShinyPearl.prefab , Type=UnityEngine.GameObject [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=RoR2/Base/LunarSkillReplacements/LunarSecondaryReplacement.asset , Type=UnityEngine.Object [Error :Moonstorm Shared Utils] System.NullReferenceException: Could not load ItemDef from catalog with name AffixWhite (AddressableKeyAsset has loadAssetFrom set to ItemCatalog) at Moonstorm.AddressableAssets.AddressableKeyAsset+d__2.MoveNext () [0x000d1] in <0c2e01bd7cf74bc199f52f73d921b323>:IL_00D1 :: Line: 63, Method LoadAsset [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=DisplayEliteIceCrown, Type=UnityEngine.GameObject [Error :Moonstorm Shared Utils] System.NullReferenceException: Could not load ItemDef from catalog with name AffixRed (AddressableKeyAsset has loadAssetFrom set to ItemCatalog) at Moonstorm.AddressableAssets.AddressableKeyAsset+d__2.MoveNext () [0x000d1] in <0c2e01bd7cf74bc199f52f73d921b323>:IL_00D1 :: Line: 63, Method LoadAsset [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=DisplayEliteHorn, Type=UnityEngine.GameObject [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=DisplayEliteHorn, Type=UnityEngine.GameObject [Error :Moonstorm Shared Utils] System.NullReferenceException: Could not load ItemDef from catalog with name AffixBlue (AddressableKeyAsset has loadAssetFrom set to ItemCatalog) at Moonstorm.AddressableAssets.AddressableKeyAsset+d__2.MoveNext () [0x000d1] in <0c2e01bd7cf74bc199f52f73d921b323>:IL_00D1 :: Line: 63, Method LoadAsset [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=DisplayEliteRhinoHorn, Type=UnityEngine.GameObject [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=DisplayEliteRhinoHorn, Type=UnityEngine.GameObject [Error :Moonstorm Shared Utils] System.NullReferenceException: Could not load ItemDef from catalog with name AffixPoison (AddressableKeyAsset has loadAssetFrom set to ItemCatalog) at Moonstorm.AddressableAssets.AddressableKeyAsset+d__2.MoveNext () [0x000d1] in <0c2e01bd7cf74bc199f52f73d921b323>:IL_00D1 :: Line: 63, Method LoadAsset [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=DisplayEliteUrchinCrown, Type=UnityEngine.GameObject [Error :Moonstorm Shared Utils] System.NullReferenceException: Could not load ItemDef from catalog with name AffixLunar (AddressableKeyAsset has loadAssetFrom set to ItemCatalog) at Moonstorm.AddressableAssets.AddressableKeyAsset+d__2.MoveNext () [0x000d1] in <0c2e01bd7cf74bc199f52f73d921b323>:IL_00D1 :: Line: 63, Method LoadAsset [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=DisplayEliteLunar,eye, Type=UnityEngine.GameObject [Error :Moonstorm Shared Utils] System.NullReferenceException: Could not load ItemDef from catalog with name AffixHaunted (AddressableKeyAsset has loadAssetFrom set to ItemCatalog) at Moonstorm.AddressableAssets.AddressableKeyAsset+d__2.MoveNext () [0x000d1] in <0c2e01bd7cf74bc199f52f73d921b323>:IL_00D1 :: Line: 63, Method LoadAsset [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=DisplayEliteStealthCrown, Type=UnityEngine.GameObject [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=RoR2/DLC1/Characters/VoidSurvivor/idrsVoidSurvivor.asset, Type=RoR2.ItemDisplayRuleSet [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=RoR2/DLC1/Characters/VoidSurvivor/idrsVoidSurvivor.asset, Type=RoR2.ItemDisplayRuleSet [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=RoR2/DLC1/Characters/VoidSurvivor/idrsVoidSurvivor.asset, Type=RoR2.ItemDisplayRuleSet [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=RoR2/DLC1/Characters/VoidSurvivor/idrsVoidSurvivor.asset, Type=RoR2.ItemDisplayRuleSet [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=RoR2/DLC1/Characters/VoidSurvivor/idrsVoidSurvivor.asset, Type=RoR2.ItemDisplayRuleSet [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=RoR2/DLC1/Characters/VoidSurvivor/idrsVoidSurvivor.asset, Type=RoR2.ItemDisplayRuleSet [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=RoR2/DLC1/Characters/VoidSurvivor/idrsVoidSurvivor.asset, Type=RoR2.ItemDisplayRuleSet [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=RoR2/DLC1/Characters/VoidSurvivor/idrsVoidSurvivor.asset, Type=RoR2.ItemDisplayRuleSet [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key= RoR2/Base/FireBallDash/FireBallDash.asset , Type=UnityEngine.Object [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=RoR2/Base/Jetpack/Jetpack.asset , Type=UnityEngine.Object [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key= RoR2/Base/FireBallDash/FireBallDash.asset , Type=UnityEngine.Object [Error : Unity Log] UnityEngine.AddressableAssets.InvalidKeyException: Exception of type 'UnityEngine.AddressableAssets.InvalidKeyException' was thrown., Key=RoR2/Base/Meteor/Meteor.asset , Type=UnityEngine.Object [Info :Moonstorm Shared Utils] Initializing MSDCCSPool [Info :Moonstorm Shared Utils] Initializing MSDirectorCardCategorySelection [Info : Unity Log] NetworkManagerSystem.desiredHost={ hostType=Self listen=False maxPlayers=4 } [Info :R2API.Networking] Server Handlers registered [Error :R2API.Prefab] WAWA (UnityEngine.GameObject) don't have a NetworkIdentity Component but was marked for network registration. [Warning: Unity Log] The prefab 'TraderBody' has multiple NetworkIdentity components. There can only be one NetworkIdentity on a prefab, and it must be on the root object. [Warning: Unity Log] The prefab 'ArenaMissionController' has multiple NetworkIdentity components. There can only be one NetworkIdentity on a prefab, and it must be on the root object. [Warning: Unity Log] The prefab 'Moon2DropshipZone' has multiple NetworkIdentity components. There can only be one NetworkIdentity on a prefab, and it must be on the root object. [Warning: Unity Log] The prefab 'HOLDER_ Gauntlets' has multiple NetworkIdentity components. There can only be one NetworkIdentity on a prefab, and it must be on the root object. [Warning: Unity Log] The prefab 'VoidCamp' has multiple NetworkIdentity components. There can only be one NetworkIdentity on a prefab, and it must be on the root object. [Info :R2API.Networking] Client Handlers registered [Info : Unity Log] Unloaded scene title [Warning: R2API] This version of R2API was built for build id "1.2.4.1", you are running "1.2.4.4". [Warning: R2API] Should any problems arise, please check for a new version before reporting issues. [Info : Unity Log] Active scene changed from to lobby [Info : Unity Log] Loaded scene lobby loadSceneMode=Single [Info : Unity Log] Adding local player controller 0 on connection hostId: -1 connectionId: 0 isReady: False channel count: 0 [Info : Unity Log] NetworkManagerSystem.AddPlayerInternal(conn=hostId: -1 connectionId: 0 isReady: False channel count: 0, playerControllerId=0, extraMessageReader=NetBuf sz:259 pos:259 [Info : Unity Log] OnClientSceneChanged networkSceneName=lobby loadedScenes=lobby [Error : Unity Log] A connection has already been set as ready. There can only be one. [Info : Unity Log] Player 0 already added, aborting. [Info : Unity Log] SetSurvivorPreferenceClient survivorIndex=9, bodyIndex=67 [Info : Unity Log] Changinging body preference for Wonda (RoR2.NetworkUserId) from None to 67 [Info : Unity Log] Changinging body preference for Wonda (RoR2.NetworkUserId) from None to 67 [Debug :RoR2BepInExPack] Hook added by assembly: Starstorm2.dll for: RoR2.CharacterBody.AddBuff [Debug :RoR2BepInExPack] Hook added by assembly: Starstorm2.dll for: RoR2.PurchaseInteraction.OnInteractionBegin [Info : Unity Log] Loaded Pregame! [Info : Unity Log] Attempting to generate PreGameVoteController for Wonda [Info : Unity Log] PreGameRuleVoteController.ClientTransmitVotesToServer() [Info : Unity Log] Received vote from Wonda [Info : Unity Log] Accepting vote from Wonda [Info : Unity Log] Wonda connected. [Info : Unity Log] NetworkUser(Clone) (RoR2.NetworkUser) [Info : Unity Log] maxRuleCount=12, currentChoiceIndex=11 [Info : Unity Log] NetworkUser(Clone) (RoR2.NetworkUser) [Info : Unity Log] maxRuleCount=12, currentChoiceIndex=2 [Info : Unity Log] NetworkUser(Clone) (RoR2.NetworkUser) [Info : Unity Log] maxRuleCount=12, currentChoiceIndex=1 [Info : Unity Log] Run seed: 15213227053642820518 [Info : Unity Log] SetupUserCharacterMaster: Wonda [Info :Refightilization] Setting up players... [Info :Refightilization] Wonda added to PlayerStorage! [Info :Refightilization] Setting up players finished. [Info : Unity Log] PickupDropTable 'dtDoppelganger' has been loaded after the Run started. This might be an issue with asset duplication across bundles, or it might be fine. Regenerating... [Info : Unity Log] Unloaded scene lobby [Warning: R2API] This version of R2API was built for build id "1.2.4.1", you are running "1.2.4.4". [Warning: R2API] Should any problems arise, please check for a new version before reporting issues. [Info : Unity Log] Active scene changed from to blackbeach2 [Info : Unity Log] Loaded scene blackbeach2 loadSceneMode=Single [Info : Unity Log] OnClientSceneChanged networkSceneName=blackbeach2 loadedScenes=blackbeach2 [Info : Unity Log] Client ready. [Info : Unity Log] Player 0 already added, aborting. [Info : Unity Log] Spending 220 credits on interactables... [Info : Unity Log] SceneDirector.PopulateScene: PlayerCharacterMasterController count=1, PlatformSystems.lobbyManager.calculatedTotalPlayerCount=0 [Info : Unity Log] reorder list [Info : Unity Log] SurvivorPodBaseState.OnEnter Descent, Wonda [Info : Unity Log] Saved file "f82f27dd-4cdf-469f-99c5-c20ffd855b51.xml" (273838 bytes) [Info :Refightilization] Updating the stage whitelist. [Info :Refightilization] Whitelist cleared. [Info :Refightilization] Selection isn't null. [Info :Refightilization] Testing choice. [Info :Refightilization] We have found TitanBody. [Info :Refightilization] Testing choice. [Info :Refightilization] Testing choice. [Info :Refightilization] We have found VagrantBody. [Info :Refightilization] Testing choice. [Info :Refightilization] We have found LampBossBody. [Info :Refightilization] Testing choice. [Info :Refightilization] We have found GolemBody. [Info :Refightilization] Adding GolemBody to the currWhitelist. [Info :Refightilization] Testing choice. [Info :Refightilization] We have found GreaterWispBody. [Info :Refightilization] Adding GreaterWispBody to the currWhitelist. [Info :Refightilization] Testing choice. [Info :Refightilization] We have found LemurianBody. [Info :Refightilization] Adding LemurianBody to the currWhitelist. [Info :Refightilization] Testing choice. [Info :Refightilization] We have found WispBody. [Info :Refightilization] Testing choice. [Info :Refightilization] We have found BeetleBody. [Info :Refightilization] Testing choice. [Info :Refightilization] Testing choice. [Info :Refightilization] Testing choice. [Info :Refightilization] Testing choice. [Info :Refightilization] Testing choice. [Info :Refightilization] Testing choice. [Info :Refightilization] Testing choice. [Info :Refightilization] Done updating Whitelist. [Info :Refightilization] Updating the Elite whitelist. [Info :Refightilization] Added EQUIPMENT_AFFIXBLUE_NAME to the pool. [Info :Refightilization] Added EQUIPMENT_AFFIXWHITE_NAME to the pool. [Info :Refightilization] Added EQUIPMENT_AFFIXRED_NAME to the pool. [Info :Refightilization] Added EQUIPMENT_AFFIXEARTH_NAME to the pool. [Info :Refightilization] Added EQUIPMENT_AFFIXLUNAR_NAME to the pool. [Info :Refightilization] Done updating Whitelist. [Error : Unity Log] Object PodGroundImpact(Clone) (UnityEngine.GameObject) should not be instantiated by means other than EffectManager.SpawnEffect. This WILL result in an NRE!!! Use EffectManager.SpawnEffect or don't use EffectComponent!!!!! [Info : Unity Log] SurvivorPodBaseState.OnEnter Landed, Wonda [Info : Unity Log] SurvivorPodBaseState.OnEnter PreRelease, Wonda [Info : Unity Log] SurvivorPodBaseState.OnEnter Release, Wonda [Info : Unity Log] SurvivorPodBaseState.OnEnter ReleaseFinished, ??? [Info : Unity Log] Scripted Combat Encounter: currentBoostHpCoefficient=1.4, currentBoostDamageCoefficient=1.033333 [Info : Unity Log] Scripted Combat Encounter: currentBoostHpCoefficient=1.4, currentBoostDamageCoefficient=1.033333 [Info : Unity Log] Scripted Combat Encounter: currentBoostHpCoefficient=1.4, currentBoostDamageCoefficient=1.033333 [Info : Unity Log] You picked up Encrusted Key [Info :Refightilization] Respawn called! Waiting 5 seconds! [Info : Unity Log] DEAD [Info :Refightilization] Checking players... [Info :Refightilization] Wonda passed spawn check! [Error : Unity Log] NullReferenceException Stack trace: UnityEngine.Component.GetComponent[T] () (at <469e86e97fa2467ebffe49bbd6086325>:IL_0021) Moonstorm.Starstorm2.Items.RelicOfTermination.CheckTerminationBuff (RoR2.Inventory obj) (at <1aba86894bf64018849c1fc662731975>:IL_0000) RoR2.Inventory.HandleInventoryChanged () (at <1d532be543be416b9db3594e4b62447d>:IL_001A) RoR2.Inventory.AddItemsFrom (System.Int32[] otherItemStacks, System.Func`2[T,TResult] filter) (at <1d532be543be416b9db3594e4b62447d>:IL_0068) RoR2.Inventory.AddItemsFrom (RoR2.Inventory other, System.Func`2[T,TResult] filter) (at <1d532be543be416b9db3594e4b62447d>:IL_0015) RoR2.Inventory.CopyItemsFrom (RoR2.Inventory other, System.Func`2[T,TResult] filter) (at <1d532be543be416b9db3594e4b62447d>:IL_002F) RoR2.Inventory.CopyItemsFrom (RoR2.Inventory other) (at <1d532be543be416b9db3594e4b62447d>:IL_0015) Wonda.Refightilization+d__36.MoveNext () (at <5fe34b9f09a24632b9d8e5da21af1953>:IL_0235) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <469e86e97fa2467ebffe49bbd6086325>:IL_0026) [Info : Unity Log] Saved file "f82f27dd-4cdf-469f-99c5-c20ffd855b51.xml" (273836 bytes) [Info : Unity Log] in save archive convars [Info : Unity Log] Shutting down Steamworks... [Info : Unity Log] Shut down Steamworks. [Debug :RoR2BepInExPack] Hook added by assembly: for: RoR2.HealthComponent.TakeDamage [Debug :RoR2BepInExPack] Hook added by assembly: for: RoR2.HealthComponent.TakeDamage [Debug :RoR2BepInExPack] Hook removed by assembly: R2API.Difficulty.dll for: RoR2.DifficultyCatalog.GetDifficultyDef [Debug :RoR2BepInExPack] Hook removed by assembly: R2API.Difficulty.dll for: RoR2.RuleDef.FromDifficulty [Debug :RoR2BepInExPack] Hook removed by assembly: R2API.Director.dll for: RoR2.ClassicStageInfo.Start [Debug :RoR2BepInExPack] Hook removed by assembly: R2API.Director.dll for: RoR2.SceneCatalog.Init [Debug :RoR2BepInExPack] Hook removed by assembly: R2API.Language.dll for: RoR2.Language.GetLocalizedStringByToken [Debug :RoR2BepInExPack] Hook removed by assembly: R2API.Language.dll for: RoR2.Language.TokenIsRegistered [Debug :RoR2BepInExPack] Hook removed by assembly: R2API.Skins.dll for: RoR2.ModelSkinController.ApplySkin [Debug :RoR2BepInExPack] Hook removed by assembly: R2API.Sound.dll for: RoR2.MusicController.Start [Debug :RoR2BepInExPack] Hook removed by assembly: R2API.Sound.dll for: RoR2.MusicController.UpdateState [Info : Unity Log] Transfered 7.2 monster credits from Director (UnityEngine.GameObject) to Director (UnityEngine.GameObject) ```
Zenithrium commented 6 months ago

my guess is maybe the inventory given in the parameters doesn't actually exist, so it can't get component it. i could add a if(obj) check since that might be it

Zenithrium commented 6 months ago

added the extra check, do tell if it persists