DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ FindFreeLocationsFor()

proto native int GameInventory::FindFreeLocationsFor ( notnull EntityAI item,
FindInventoryLocationType flags,
out notnull array< ref InventoryLocation > locs )
protected

searches inventory for suitable location for @item

Аргументы
[in]itemitem that would be placed in inventory
[in]flagsflags affecting selection (
См. также
FindInventoryLocation )
Аргументы
[out]locsarray of InventoryLocations the item can be placed to
Возвращает
number of suitable inventory locations

Example:

Entity bino = GetGame().CreateObject("Binoculars", "3312 0 854");
EntityAI bino2;
if (Class.CastTo(bino2, bino))
{
array<ref InventoryLocation> a = new array<ref InventoryLocation>; // 1) allocate memory for array
for (int i = 0; i < 10; ++i)
{
a.Insert(new InventoryLocation); // 2) pre-allocate inventorylocations from script. engine only fills them in, engine does not allocate memory to avoid mixing.
}
int sz = player.FindFreeLocationsFor(bino, FindInventoryLocationType.ANY_CARGO | FindInventoryLocationType.ATTACHMENT, a); // 3) ask engine to fill the locations
if (sz > 0)
{
bino2.GetCurrentInventoryLocation(src); // 5) get current location
InventoryLocation dst = a[0]; // 6) get first (this is only example)
... use src and dst
}
}
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
proto native Object CreateObject(string type, vector pos, bool create_local=false, bool init_ai=false, bool create_physics=true)
Creates object of certain type.
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения Building.c:6
Определения Camera.c:2
InventoryLocation.
Определения InventoryLocation.c:29
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.