107 proto native
void GetDir(out
float dir[4]);
255 res = res +
" pos=(" + pos[0] +
", " + pos[1] +
", " + pos[2] +
")";
256 res = res +
" dir=(" + dir[0] +
", " + dir[1] +
", " + dir[2] +
", " + dir[3] +
")";
263 res = res +
" slot=" +
GetSlot();
290 res = res +
" idx=" +
GetIdx();
344 Debug.
Log(
string.Format(
"Item=%1 does not exist on server!",
Object.GetDebugName(item)),
"GROUND" ,
"n/a",
"ReadFromContext",
this.ToString() );
355 if (!ctx.
Read(parent))
363 if (!parent || !item)
367 Debug.
Log(
string.Format(
"Parent=%1 or Item=%2 does not exist on server!",
Object.GetDebugName(parent),
Object.GetDebugName(item)),
"ATTACHMENT" ,
"n/a",
"ReadFromContext",
this.ToString() );
378 if (!ctx.
Read(parent))
391 if (!parent || !item)
395 Debug.
Log(
string.Format(
"Parent=%1 or Item=%2 does not exist on server!",
Object.GetDebugName(parent),
Object.GetDebugName(item)),
"CARGO" ,
"n/a",
"ReadFromContext",
this.ToString() );
401 SetCargo(parent, item, idx, row, col, flp);
406 if (!ctx.
Read(parent))
411 if (!parent || !item)
415 Debug.
Log(
string.Format(
"Parent=%1 or Item=%2 does not exist on server!",
Object.GetDebugName(parent),
Object.GetDebugName(item)),
"HANDS" ,
"n/a",
"ReadFromContext",
this.ToString() );
426 if (!ctx.
Read(parent))
439 if (!parent || !item)
443 Debug.
Log(
string.Format(
"Parent=%1 or Item=%2 does not exist on server!",
Object.GetDebugName(parent),
Object.GetDebugName(item)),
"PROXYCARGO" ,
"n/a",
"ReadFromContext",
this.ToString() );
454 if (!ctx.
Read(parent))
461 if (!parent || !item)
465 Debug.
Log(
string.Format(
"Parent=%1 or Item=%2 does not exist on server!",
Object.GetDebugName(parent),
Object.GetDebugName(item)),
"VEHICLE" ,
"n/a",
"ReadFromContext",
this.ToString() );
477 if (!ctx.
Read(parent))
486 if (!parent || !item)
490 Debug.
Log(
string.Format(
"Parent=%1 or Item=%2 does not exist on server!",
Object.GetDebugName(parent),
Object.GetDebugName(item)),
"TEMP" ,
"n/a",
"ReadFromContext",
this.ToString() );
500 ErrorEx(
"ReadFromContext - really unknown location type, this should not happen, type=" + type);
512 if (!ctx.
Write(type))
514 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed to write temp type");
520 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed to write type");
534 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=item");
541 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=pos");
549 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=dir");
559 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=parent");
564 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=item");
569 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=slot");
578 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=parent");
583 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=item");
588 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=idx");
593 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=row");
598 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=col");
603 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=flp");
612 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed HND, arg=parent");
617 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed HND, arg=item");
626 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=parent");
631 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=item");
636 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=idx");
641 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=row");
646 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=col");
651 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=flp");
662 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed VHC, arg=parent");
667 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed VHC, arg=item");
672 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed VHC, arg=idx");
682 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed TMP, arg=parent");
688 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed TMP, arg=item");
694 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed TMP, idx=-1");
702 Error(
"WriteToContext - really unknown location type, this should not happen, type=" +
GetType());
714 if (!ctx.Write(
true))
716 Error(
"OptionalLocationWriteToContext - cannot write 1 to context!");
723 if (!ctx.Write(
false))
725 Error(
"OptionalLocationWriteToContext - cannot write 0 to context!");
734 bool present =
false;
735 if (!ctx.Read(present))
737 Error(
"OptionalLocationReadFromContext - cannot read bool from context!");
745 if (!loc.ReadFromContext(ctx))
747 Error(
"OptionalLocationReadFromContext - cannot read (present) inventorylocation from context!");
@ UNKNOWN
24 - Any other error. Can be returned from any call.
represents base for cargo storage for entities
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
proto native void SetCol(int col)
proto native int GetSlot()
returns slot id if current type is Attachment
proto native bool GetFlip()
returns flip status of cargo
proto native void SetItem(notnull EntityAI item)
proto native EntityAI GetParent()
returns parent of current inventory location
proto native bool IsValid()
verify current set inventory location
proto native void SetRow(int row)
proto native int GetType()
returns type of InventoryLocation
proto native void SetCargoAuto(notnull CargoBase cargo, EntityAI e, int row, int col, bool flip)
proto native bool CollidesWith(notnull InventoryLocation rhs)
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetParent(notnull EntityAI parent)
proto native void GetDir(out float dir[4])
proto native vector GetPos()
returns position of item in world if type is Ground
proto native void SetVehicle(notnull EntityAI parent, EntityAI e, int idx)
proto native InventoryLocation CopyLocationFrom(notnull InventoryLocation rhs, bool copyFlip)
proto native bool CompareLocationOnly(notnull InventoryLocation other)
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetGroundEx(EntityAI e, vector pos, float dir[4])
proto native void Reset()
proto native void SetIndex(int idx)
proto native void SetSlot(int slotId)
proto native void SetFlip(bool flip)
proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
proto native void SetHands(notnull EntityAI parent, EntityAI e)
bool ReadFromContext(ParamsReadContext ctx)
proto native EntityAI GetItem()
returns item of current inventory location
proto native void SetTemporary(notnull EntityAI parent, EntityAI e)
proto native InventoryLocation Copy(notnull InventoryLocation rhs)
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
proto native void SetGround(EntityAI e, vector mat[4])
static string DumpToStringNullSafe(InventoryLocation loc)
proto native void SetProxyCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
Serializer ParamsReadContext
Serializer ParamsWriteContext
void Error(string err)
Messagebox with error message.
FindInventoryLocationType
flags for searching locations in inventory
@ PROXYCARGO
cargo of a large object (building,...)
@ HANDS
hands of another entity
@ NO_SLOT_AUTO_ASSIGN
skips auto-assign test
bool OptionalLocationReadFromContext(out InventoryLocation loc, notnull ParamsReadContext ctx)
InventoryLocationType
types of Inventory Location
bool OptionalLocationWriteToContext(InventoryLocation loc, notnull ParamsWriteContext ctx)