|
467 | 467 | InventoryStorageSlot newInvSlot = InventoryStorageSlot.Cast(newSlot);
|
468 | 468 | if (newInvSlot)
|
469 | 469 | {
|
470 |
| - if (EPF_Utils.IsInstanceAnyInherited(newInvSlot.GetStorage(), {EquipedLoadoutStorageComponent, BaseEquipmentStorageComponent, BaseEquipedWeaponStorageComponent})) |
471 |
| - EPF_BitFlags.SetFlags(m_eFlags, EPF_EPersistenceFlags.WAS_EQUIPPED); |
472 |
| - |
473 |
| - EPF_PersistenceComponent parentPersistence = EPF_Component<EPF_PersistenceComponent>.Find(parent); |
474 |
| - if (persistenceManager.GetState() == EPF_EPersistenceManagerState.ACTIVE && |
475 |
| - parentPersistence && EPF_BitFlags.CheckFlags(parentPersistence.GetFlags(), EPF_EPersistenceFlags.BAKED)) |
| 470 | + BaseInventoryStorageComponent storage = newInvSlot.GetStorage(); |
| 471 | + if (storage) |
476 | 472 | {
|
477 |
| - EPF_BakedStorageChange.OnAdded(this, newInvSlot); |
| 473 | + if (EPF_Utils.IsInstanceAnyInherited(storage, {EquipedLoadoutStorageComponent, BaseEquipmentStorageComponent, BaseEquipedWeaponStorageComponent})) |
| 474 | + EPF_BitFlags.SetFlags(m_eFlags, EPF_EPersistenceFlags.WAS_EQUIPPED); |
| 475 | + |
| 476 | + EPF_PersistenceComponent parentPersistence = EPF_Component<EPF_PersistenceComponent>.Find(parent); |
| 477 | + if (persistenceManager.GetState() == EPF_EPersistenceManagerState.ACTIVE && |
| 478 | + parentPersistence && EPF_BitFlags.CheckFlags(parentPersistence.GetFlags(), EPF_EPersistenceFlags.BAKED)) |
| 479 | + { |
| 480 | + EPF_BakedStorageChange.OnAdded(this, newInvSlot); |
| 481 | + } |
478 | 482 | }
|
479 | 483 | }
|
480 | 484 |
|
|
504 | 508 | InventoryStorageSlot oldInvSlot = InventoryStorageSlot.Cast(oldSlot);
|
505 | 509 | if (oldInvSlot && persistenceManager.GetState() == EPF_EPersistenceManagerState.ACTIVE)
|
506 | 510 | {
|
507 |
| - EPF_PersistenceComponent parentPersistence = EPF_Component<EPF_PersistenceComponent>.Find(oldInvSlot.GetOwner()); |
508 |
| - if (parentPersistence && EPF_BitFlags.CheckFlags(parentPersistence.GetFlags(), EPF_EPersistenceFlags.BAKED)) |
509 |
| - { |
510 |
| - EPF_BakedStorageChange.OnRemoved(this, oldInvSlot); |
511 |
| - } |
512 |
| - else |
| 511 | + // Some inv slots have no storages sometimes e.g. clothing attachments, so ignore those. |
| 512 | + BaseInventoryStorageComponent storage = oldInvSlot.GetStorage(); |
| 513 | + if (storage) |
513 | 514 | {
|
514 |
| - EPF_StorageChangeDetection.SetDirty(oldInvSlot.GetStorage()); |
| 515 | + EPF_PersistenceComponent parentPersistence = EPF_Component<EPF_PersistenceComponent>.Find(oldInvSlot.GetOwner()); |
| 516 | + if (parentPersistence && EPF_BitFlags.CheckFlags(parentPersistence.GetFlags(), EPF_EPersistenceFlags.BAKED)) |
| 517 | + { |
| 518 | + EPF_BakedStorageChange.OnRemoved(this, oldInvSlot); |
| 519 | + } |
| 520 | + else |
| 521 | + { |
| 522 | + EPF_StorageChangeDetection.SetDirty(storage); |
| 523 | + } |
515 | 524 | }
|
516 | 525 | }
|
517 | 526 |
|
|
0 commit comments