106 proto native
void GetDir(out
float dir[4]);
248 res = res +
" pos=(" + pos[0] +
", " + pos[1] +
", " + pos[2] +
")";
249 res = res +
" dir=(" + dir[0] +
", " + dir[1] +
", " + dir[2] +
", " + dir[3] +
")";
256 res = res +
" slot=" +
GetSlot();
283 res = res +
" idx=" +
GetIdx();
330 Debug.
Log(
string.Format(
"Item=%1 does not exist on server!",
Object.GetDebugName(item)),
"GROUND" ,
"n/a",
"ReadFromContext",
this.ToString() );
341 if (!ctx.
Read(parent))
349 if (!parent || !item)
353 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() );
364 if (!ctx.
Read(parent))
377 if (!parent || !item)
381 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() );
387 SetCargo(parent, item, idx, row, col, flp);
392 if (!ctx.
Read(parent))
397 if (!parent || !item)
401 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() );
412 if (!ctx.
Read(parent))
425 if (!parent || !item)
429 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() );
440 if (!ctx.
Read(parent))
447 if (!parent || !item)
451 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() );
462 ErrorEx(
"ReadFromContext - really unknown location type, this should not happen, type=" + type);
473 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed to write type");
487 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=item");
494 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=pos");
502 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=dir");
512 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=parent");
517 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=item");
522 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=slot");
531 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=parent");
536 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=item");
541 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=idx");
546 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=row");
551 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=col");
556 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=flp");
565 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed HND, arg=parent");
570 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed HND, arg=item");
579 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=parent");
584 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=item");
589 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=idx");
594 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=row");
599 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=col");
604 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=flp");
615 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed VHC, arg=parent");
620 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed VHC, arg=item");
625 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed VHC, arg=idx");
632 Error(
"WriteToContext - really unknown location type, this should not happen, type=" +
GetType());
644 if (!ctx.Write(
true))
646 Error(
"OptionalLocationWriteToContext - cannot write 1 to context!");
653 if (!ctx.Write(
false))
655 Error(
"OptionalLocationWriteToContext - cannot write 0 to context!");
664 bool present =
false;
665 if (!ctx.Read(present))
667 Error(
"OptionalLocationReadFromContext - cannot read bool from context!");
675 if (!loc.ReadFromContext(ctx))
677 Error(
"OptionalLocationReadFromContext - cannot read (present) inventorylocation from context!");
@ UNKNOWN
24 - Any other error. Can be returned from any call.
class DynamicMusicTrackData ANY
FindInventoryLocationType
flags for searching locations in inventory
@ PROXYCARGO
cargo of a large object (building,...)
@ 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
bool OptionalLocationWriteToContext(InventoryLocation loc, notnull ParamsWriteContext ctx)
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 bool IsValid()
verify current set inventory location
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
proto native void SetIndex(int idx)
proto native EntityAI GetParent()
returns parent of current inventory location
static string DumpToStringNullSafe(InventoryLocation loc)
proto native void SetSlot(int slotId)
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 SetVehicle(notnull EntityAI parent, EntityAI e, int idx)
proto native vector GetPos()
returns position of item in world if type is Ground
proto native void GetDir(out float dir[4])
returns direction of item in world if type is Ground
proto native void SetRow(int row)
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 int GetSlot()
returns slot id if current type is Attachment
proto native InventoryLocation CopyLocationFrom(notnull InventoryLocation rhs, bool copyFlip)
copies location to another location without m_item member
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native bool CollidesWith(notnull InventoryLocation rhs)
checks if inventory locations collides each with other
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetFlip(bool flip)
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
proto native void SetParent(notnull EntityAI parent)
proto native InventoryLocation Copy(notnull InventoryLocation rhs)
copies location data to another location
proto native void SetCargoAuto(notnull CargoBase cargo, EntityAI e, int row, int col, bool flip)
based on Cargo.IsProxyCargo uses SetProxyCargo or SetCargo respectively
bool WriteToContext(ParamsWriteContext ctx)
proto native bool CompareLocationOnly(notnull InventoryLocation other)
proto native void SetItem(notnull EntityAI item)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index 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 bool GetFlip()
returns flip status of cargo
bool ReadFromContext(ParamsReadContext ctx)
proto native EntityAI GetItem()
returns item of current inventory location
proto native void Reset()
proto native void SetGroundEx(EntityAI e, vector pos, float dir[4])
sets current inventory location type to Ground with transformation mat
proto bool Write(void value_out)
proto bool Read(void value_in)
Serializer ParamsReadContext
Serializer ParamsWriteContext
void Error(string err)
Messagebox with error message.