10 [
Attribute(
"0", UIWidgets.EditBox,
"How much weight it can carry")]
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;
61 return m_fMaxWeight >= fWeight;
67 if (!super.CanStoreItem(item, slotID))
81 bool bWeightOK =
IsWeightOk( pItemComp.GetTotalWeight() );
89 return bVolumeOK && bWeightOK && bDimensionsOK;
95 if (!super.CanStoreResource(resourceName, slotID))
113 return bVolumeOK && bWeightOK;
119 if (!super.CanReplaceItem(nextItem, slotID))
125 IEntity item =
Get(slotID);
142 float itemVolume = itemComp.GetTotalVolume();
143 float nextItemVolume = nextItemComp.GetTotalVolume();
152 bool bWeightOK =
IsWeightOk(nextItemComp.GetTotalWeight() - itemComp.GetTotalWeight());
159 return bVolumeOK && bWeightOK && bDimensionsOK;
165 super.OnRemovedFromSlot(item, slotID);
169 pItemComponent.ShowOwner();
170 pItemComponent.EnablePhysics();
172 m_fWeight -= pItemComponent.GetTotalWeight();
178 super.OnAddedToSlot(item, slotID);
182 if( !pItemComponent )
185 float fVol = pItemComponent.GetTotalVolume();
188 pItemComponent.ShowOwner();
192 if ( fVol >= MIN_VOLUME_TO_SHOW_ITEM_IN_SLOT )
193 pItemComponent.ShowOwner();
196 pItemComponent.DisablePhysics();
197 pItemComponent.ActivateOwner(
false);
199 m_fWeight += pItemComponent.GetTotalWeight();
214 return linkedStorages.Count();
223 if (newLinkedStorage ==
this)
249 super.OnManagerChanged(manager);
273 protected bool IsVolumeOk(
float fVolume );
279 protected override void OnAddedToSlot(IEntity item,
int slotID);