58 {
59 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
60 InventoryLocation ilTemp = new InventoryLocation;
61
64 item.GetInventory().GetCurrentInventoryLocation(ilTemp);
65
67 {
69 InventoryLocation ilCargoItem = new InventoryLocation;
70 CargoBase cargo = parent.GetInventory().GetCargo();
72 {
74 if (itemInCargo != item)
75 {
76 itemInCargo.GetInventory().GetCurrentInventoryLocation(ilCargoItem);
78 {
80 {
81 return false;
82 }
83 }
84 }
85 }
86 break;
88 EntityAI entityInAttachment = parent.GetInventory().FindAttachment(ilCorrect.
GetSlot());
89
90 if(entityInAttachment)
91 {
93 {
94 return false;
95 }
96 }
97
98 break;
100 EntityAI entityInHands = player.GetItemInHands();
101 if(entityInHands)
102 {
104 {
105 return false;
106 }
107 }
108
109 break;
110 default:
111 break;
112 }
113
114 if (!GameInventory.LocationSyncMoveEntity(ilTemp, ilCorrect))
115 {
118 return false;
119 }
120
121 return true;
122 }
InventoryLocationType
types of Inventory Location
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native bool CollidesWith(notnull InventoryLocation rhs)
checks if inventory locations collides each with other
proto native int GetType()
returns type of InventoryLocation
proto native EntityAI GetItem()
returns item of current inventory location
bool RepairItem(EntityAI itemToRepair)