11 protected float m_fMaxWeight;
13 [
Attribute(
"0",
UIWidgets.EditBox,
"The ID of slots the inserted items will be visible in")]
16 [
Attribute(
desc:
"Dictates how the entity gets other storage and sets them as linked storage or how it itself sets it as a linked storage of another storage. Do not use base class!")]
22 #ifndef DISABLE_INVENTORY
26 protected static const int MIN_VOLUME_TO_SHOW_ITEM_IN_SLOT = 200000;
45 const int weightBased =
Math.Floor((m_fMaxWeight - GetTotalWeight()) / itemWeight);
47 if (volumeBased < weightBased)
66 return parentStorage.IsAdditionalWeightOk(weight);
70 private SCR_ItemAttributeCollection GetAttributeCollection(
IEntity item )
76 return SCR_ItemAttributeCollection.Cast( pItemComp.GetAttributes() );
91 fWeight += GetTotalWeight() - m_Attributes.GetWeight();
93 return m_fMaxWeight >= fWeight;
99 if (!super.CanStoreItem(item, slotID))
170 if (!super.CanReplaceItem(nextItem, slotID))
193 float itemVolume = itemComp.GetTotalVolume();
194 float nextItemVolume = nextItemComp.GetTotalVolume();
206 bool bWeightOK =
IsAdditionalWeightOk(nextItemComp.GetTotalWeight() - itemComp.GetTotalWeight());
221 super.OnRemovedFromSlot(item, slotID);
225 pItemComponent.ShowOwner();
226 pItemComponent.EnablePhysics();
228 m_fWeight -= pItemComponent.GetTotalWeight();
231 if (refundItemAttributes && !refundItemAttributes.IsRefundable())
238 super.OnAddedToSlot(item, slotID);
242 if( !pItemComponent )
245 float fVol = pItemComponent.GetTotalVolume();
248 pItemComponent.ShowOwner();
252 if ( fVol >= MIN_VOLUME_TO_SHOW_ITEM_IN_SLOT )
253 pItemComponent.ShowOwner();
256 pItemComponent.DisablePhysics();
257 pItemComponent.ActivateOwner(
false);
259 m_fWeight += pItemComponent.GetTotalWeight();
262 if (refundItemAttributes && !refundItemAttributes.IsRefundable())
278 return linkedStorages.Count();
287 if (newLinkedStorage ==
this)
325 super.OnManagerChanged(manager);
347 private SCR_ItemAttributeCollection GetAttributeCollection(
IEntity item );
349 protected bool IsVolumeOk(
float fVolume );
350 protected bool IsWeightOk(
float fWeight );
ResourceName resourceName
override bool CanStoreItem(IEntity item, int slotID)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
bool IsStorageALinkedChild(notnull BaseInventoryStorageComponent storage)
void SetNonRefundableItemCount(int refundableItemCount)
ref SCR_BaseLinkedStorageLogic m_LinkedStorageLogic
int GetNonRefundableItemCount()
InventoryItemComponent GetItemComponent(IEntity pItem)
int GetEstimatedCountFitForResourceWeight(ResourceName prefab)
Get an estimate of how many times the resource can fit in in this storage.
bool IsAdditionalWeightOk(float fWeight)
ref array< int > m_aSlotsToShow
ref array< BaseInventoryStorageComponent > m_aLinkedStorages
Storages that will be automatically closed and opened when the parent (this) storage is closed or ope...
int m_iNrOfNonRefundableItems
float GetMaxLoad()
Returns how much weight the component can carry.
SCR_InventoryStorageManagerComponent pInventoryManager
int GetLinkedStorages(notnull out array< BaseInventoryStorageComponent > linkedStorages)
void SCR_UniversalInventoryStorageComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
bool CheckParentWeightLimit(float weight)
void AddLinkedStorage(BaseInventoryStorageComponent newLinkedStorage)
enum EVehicleType IEntity
proto external Managed FindComponent(typename typeName)
proto external IEntity GetParent()
IEntity GetOwner()
Owner entity of the fuel tank.
SCR_FieldOfViewSettings Attribute
void OnRemovedFromSlot(IEntity item, int slotID)
proto external int GetEstimatedCountFitForResource(ResourceName resourceName)
Get an estimate of how many times the resource can fit in the inventory.
proto external bool PerformVolumeValidationForResource(ResourceName resourceName, bool includeDimensionValidation=true)
Performs prefab volume and (optionally) dimension validation.
event bool CanStoreResource(ResourceName resourceName, int slotID)
Implemented logics for can insert here, Manager will provide slotID of -1 in case slot is irrelevant.
proto external float GetWeightFromResource(ResourceName resourceName)
Get the weight of a prefab.
proto external bool PerformDimensionValidation(IEntity item)
Performs dimension validation.
proto external float GetMaxVolumeCapacity()
event bool CanReplaceItem(IEntity nextItem, int slotID)
Implemented logics for can replace to nextItem at slotID,.
proto external bool PerformVolumeValidation(IEntity item, bool includeDimensionValidation=true)
Performs item volume and (optionally) dimension validation.
void OnAddedToSlot(IEntity item, int slotID)
void OnManagerChanged(InventoryStorageManagerComponent manager)
event bool CanRemoveItem(IEntity item)
Implemented logics for can remove here,.
proto external float GetOccupiedSpace()
Returns amount of space occupied by attached items.