3 #ifndef DISABLE_INVENTORY
5 protected bool m_bShowFromOutside;
8 protected bool m_bShowInside;
10 [
Attribute(
"0",
desc:
"If true will get Inventory from self even if parent (eg vehicle) also has an inventory.")]
11 protected bool m_bForceInventoryFromSelf;
13 protected IEntity m_Vehicle;
14 protected IEntity m_InventoryOwner;
16 protected FactionAffiliationComponent m_VehicleAffiliation;
19 override protected void PerformActionInternal(SCR_InventoryStorageManagerComponent manager, IEntity pOwnerEntity, IEntity pUserEntity)
21 manager.SetStorageToOpen(m_InventoryOwner);
22 manager.OpenInventory();
26 override bool CanBeShownScript(IEntity user)
28 if (!user || !
m_Vehicle || !m_InventoryOwner)
34 ChimeraCharacter character = ChimeraCharacter.Cast(user);
37 CompartmentAccessComponent compAccess = character.GetCompartmentAccessComponent();
38 if (compAccess && (compAccess.IsGettingIn() || compAccess.IsGettingOut()))
41 if (!m_bShowFromOutside && !character.IsInVehicle())
44 if (!m_bShowInside && character.IsInVehicle())
48 if (!m_VehicleAffiliation)
51 Faction vehicleFaction = m_VehicleAffiliation.GetAffiliatedFaction();
55 FactionAffiliationComponent userAffiliation = FactionAffiliationComponent.Cast(user.FindComponent(FactionAffiliationComponent));
59 Faction userFaction = userAffiliation.GetAffiliatedFaction();
63 return !vehicleFaction.IsFactionEnemy(userFaction);
67 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
70 GetGame().GetCallqueue().CallLater(DelayedInit, param1: pOwnerEntity, param2: pManagerComponent);
74 protected void DelayedInit(IEntity pOwnerEntity, GenericComponent pManagerComponent)
76 if (!Vehicle.Cast(pOwnerEntity) && pOwnerEntity.GetParent())
82 if (!m_bForceInventoryFromSelf)
86 m_InventoryOwner = pOwnerEntity;
92 m_VehicleAffiliation = FactionAffiliationComponent.Cast(
m_Vehicle.FindComponent(FactionAffiliationComponent));