Skwizzy / SPT-LootingBots

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

When BotState becomes inactive while LootingLogic is running, bots are still executing looting transactions #66

Closed Skwizzy closed 1 year ago

Skwizzy commented 1 year ago

Reported by Props: Was looting a corpse with no bots around and while looting, all of the items were being transferred from the corpse to a bot that was deactivated due to AI Limiter.

[Error  :LootingBots] ([sptBear] Bot3) System.NullReferenceException
  at (wrapper managed-to-native) UnityEngine.Object.GetName(UnityEngine.Object)
  at UnityEngine.Object.get_name () [0x00001] in <ca21460feb9c47d0ac337b9893474cc6>:0 
  at LootingBots.Brain.Logics.LootingLogic.TryMoveToLoot () [0x000a8] in <bc930d82ee8e426d96c7ce1d79c18242>:0 
[Error  :LootingBots] ([assault] Bot13) System.NullReferenceException
  at (wrapper managed-to-native) UnityEngine.Object.GetName(UnityEngine.Object)
  at UnityEngine.Object.get_name () [0x00001] in <ca21460feb9c47d0ac337b9893474cc6>:0 
  at LootingBots.Brain.Logics.LootingLogic.TryMoveToLoot () [0x000a8] in <bc930d82ee8e426d96c7ce1d79c18242>:0 
[Error  :LootingBots] ([sptBear] Bot3) System.NullReferenceException
  at (wrapper managed-to-native) UnityEngine.Object.GetName(UnityEngine.Object)
  at UnityEngine.Object.get_name () [0x00001] in <ca21460feb9c47d0ac337b9893474cc6>:0 
  at LootingBots.Brain.Logics.LootingLogic.TryMoveToLoot () [0x000a8] in <bc930d82ee8e426d96c7ce1d79c18242>:0 
[Error  :LootingBots] ([assault] Bot13) System.NullReferenceException
  at (wrapper managed-to-native) UnityEngine.Object.GetName(UnityEngine.Object)
  at UnityEngine.Object.get_name () [0x00001] in <ca21460feb9c47d0ac337b9893474cc6>:0 
  at LootingBots.Brain.Logics.LootingLogic.TryMoveToLoot () [0x000a8] in <bc930d82ee8e426d96c7ce1d79c18242>:0 
[Error  :LootingBots] ([sptBear] Bot3) System.NullReferenceException
  at (wrapper managed-to-native) UnityEngine.Object.GetName(UnityEngine.Object)
  at UnityEngine.Object.get_name () [0x00001] in <ca21460feb9c47d0ac337b9893474cc6>:0 
  at LootingBots.Brain.Logics.LootingLogic.TryMoveToLoot () [0x000a8] in <bc930d82ee8e426d96c7ce1d79c18242>:0
Skwizzy commented 1 year ago

Should be fixed by only making sure the LootingLayer is active when BotState is Active aec2f01 As added protection, only run the Update logic in LootingLogic when bots are in the Active state 1e0eb56