This fixes a cell change crash provoked by bugs in Actor::SetActorInventory(), but really a bug in the downcall to EquipManager::UnequipAll() which invokes skyrim-native TUnequipAll.
SetActorInventory() effectively calls UnequipAll(), RemoveAllItems(), then sets the new inventory with AddRemoveItem(). But the RemoveAllItems() script also Unequips() each item, which seems to trigger a bug because the UnequipAll is still animating unequips.
First fix is comment out the unequipall.
Second fix is remove as many SetActorInventory() calls as possible. In particular, when you set the inventory on a local Actor, you don't also have to set it again when the change reflects back to you in OnRemoteSpawnDataReceived(). That's just a more elaborate way of provoking overlapping Unequips (basically, back-to-back RemoveAllItems())
This fixes a cell change crash provoked by bugs in Actor::SetActorInventory(), but really a bug in the downcall to EquipManager::UnequipAll() which invokes skyrim-native TUnequipAll.
SetActorInventory() effectively calls UnequipAll(), RemoveAllItems(), then sets the new inventory with AddRemoveItem(). But the RemoveAllItems() script also Unequips() each item, which seems to trigger a bug because the UnequipAll is still animating unequips.
First fix is comment out the unequipall.
Second fix is remove as many SetActorInventory() calls as possible. In particular, when you set the inventory on a local Actor, you don't also have to set it again when the change reflects back to you in OnRemoteSpawnDataReceived(). That's just a more elaborate way of provoking overlapping Unequips (basically, back-to-back RemoveAllItems())
Partially addresses https://github.com/tiltedphoques/TiltedEvolution/issues/723 (0x140443C43 crash site)