105 proto native
void GetDir (out
float dir[4]);
240 res = res +
" pos=(" + pos[0] +
", " + pos[1] +
", " + pos[2] +
")";
241 res = res +
" dir=(" + dir[0] +
", " + dir[1] +
", " + dir[2] +
", " + dir[3] +
")";
248 res = res +
" slot=" +
GetSlot();
319 if (!ctx.
Read(parent))
327 if (!parent || !item)
335 if (!ctx.
Read(parent))
348 if (!parent || !item)
351 SetCargo(parent, item, idx, row, col, flp);
356 if (!ctx.
Read(parent))
361 if (!parent || !item)
369 if (!ctx.
Read(parent))
382 if (!parent || !item)
390 Error(
"ReadFromContext - really unknown location type, this should not happen, type=" + type);
401 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed to write type");
415 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=item");
422 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=pos");
430 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=dir");
440 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=parent");
445 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=item");
450 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=slot");
459 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=parent");
464 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=item");
469 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=idx");
474 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=row");
479 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=col");
484 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=flp");
493 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed HND, arg=parent");
498 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed HND, arg=item");
507 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=parent");
512 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=item");
517 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=idx");
522 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=row");
527 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=col");
532 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=flp");
540 Error(
"WriteToContext - really unknown location type, this should not happen, type=" +
GetType());
552 if (!ctx.Write(
true))
554 Error(
"OptionalLocationWriteToContext - cannot write 1 to context!");
561 if (!ctx.Write(
false))
563 Error(
"OptionalLocationWriteToContext - cannot write 0 to context!");
572 bool present =
false;
573 if (!ctx.Read(present))
575 Error(
"OptionalLocationReadFromContext - cannot read bool from context!");
583 if (!loc.ReadFromContext(ctx))
585 Error(
"OptionalLocationReadFromContext - cannot read (present) inventorylocation from context!");
FindInventoryLocationType
flags for searching locations in inventory
@ PROXYCARGO
cargo of a large object (building,...)
@ ANY
ATT | CGO | PXY | HND.
@ HANDS
hands of another entity
@ CARGO
cargo of another entity
@ NO_SLOT_AUTO_ASSIGN
skips auto-assign test
bool OptionalLocationReadFromContext(out InventoryLocation loc, notnull ParamsReadContext ctx)
InventoryLocationType
types of Inventory Location
@ UNKNOWN
unknown, usually freshly created object
bool OptionalLocationWriteToContext(InventoryLocation loc, notnull ParamsWriteContext ctx)
represents base for cargo storage for entities
proto native void SetCol(int col)
proto native int GetType()
returns type of InventoryLocation
proto native vector GetPos()
returns position of item in world if type is Ground
proto native void SetParent(notnull EntityAI parent)
proto native bool IsValid()
verify current set inventory location
proto native void SetRow(int row)
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native void SetCargoAuto(notnull CargoBase cargo, EntityAI e, int row, int col, bool flip)
based on Cargo.IsProxyCargo uses SetProxyCargo or SetCargo respectively
proto native void SetGroundEx(EntityAI e, vector pos, float dir[4])
sets current inventory location type to Ground with transformation mat
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native InventoryLocation CopyLocationFrom(notnull InventoryLocation rhs, bool copyFlip)
copies location to another location without m_item member
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
proto native bool CollidesWith(notnull InventoryLocation rhs)
checks if inventory locations collides each with other
proto native bool CompareLocationOnly(notnull InventoryLocation other)
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetProxyCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to ProxyCargo with coordinates (idx, row, col) @NOTE: typical us...
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
proto native InventoryLocation Copy(notnull InventoryLocation rhs)
copies location data to another location
proto native void SetIndex(int idx)
proto native void SetSlot(int slotId)
proto native void SetFlip(bool flip)
proto native EntityAI GetParent()
returns parent of current inventory location
bool ReadFromContext(ParamsReadContext ctx)
proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
sets current inventory location type to Attachment with slot id set to <slotId>
proto native void GetDir(out float dir[4])
returns direction of item in world if type is Ground
proto native EntityAI GetItem()
returns item of current inventory location
proto native void Reset()
proto native bool GetFlip()
returns flip status of cargo
proto native int GetSlot()
returns slot id if current type is Attachment
static string DumpToStringNullSafe(InventoryLocation loc)
proto native void SetItem(notnull EntityAI item)
bool WriteToContext(ParamsWriteContext ctx)
Serialization general interface. Serializer API works with:
proto bool Write(void value_out)
proto bool Read(void value_in)
void Error(string err)
Messagebox with error message.