Skwizzy / SPT-LootingBots

AI Looting mod for Singleplayer Tarkov
https://hub.sp-tarkov.com/files/file/1096-looting-bots/#overview
29 stars 11 forks source link

Exception on Customs #103

Closed Skwizzy closed 5 months ago

Skwizzy commented 6 months ago
[Exception] : NullReferenceException: Object reference not set to an instance of an object

LootingBots.Patch.Components.LootFinder.IsLootInRange (LootingBots.Patch.Components.LootFinder+LootType lootType, UnityEngine.Vector3 destination, System.Single& dist) (at <2787f1cb930c4f15a81adf55f5146aa4>:0)

LootingBots.Patch.Components.LootFinder+<FindLootable>d__13.MoveNext () (at <2787f1cb930c4f15a81adf55f5146aa4>:0)

UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <ca21460feb9c47d0ac337b9893474cc6>:0)

UnityEngine.DebugLogHandler:LogException(Exception, Object)

Class327:UnityEngine.ILogHandler.LogException(Exception, Object)

UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)

LootingBots.Patch.Components.LootFinder:BeginSearch()

LootingBots.Brain.Logics.FindLootLogic:Update()

DrakiaXYZ.BigBrain.Internal.CustomLogicWrapper:Update()

DrakiaXYZ.BigBrain.Patches.BotAgentUpdatePatch:PatchPrefix(Object)

AICoreAgentClass:DMD<AICoreAgentClass[[BotLogicDecision, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]::Update>(AICoreAgentClass)

AICoreControllerClass:Update()

EFT.BotsController:method_0()

EFT.BaseLocalGame`1:Update()
Skwizzy commented 5 months ago

I added some null reference protection to a lot of methods in the looting logic. I found some scenarios where items can be null such as when a player loots a loose item that was marked active by a bot. 7c9899f

Skwizzy commented 5 months ago

Will try to reproduce again in the beta build