34 proto native
bool IsValid();
41 proto native
int GetType();
69 proto native
int GetSlot();
75 proto native
int GetIdx();
81 proto native
int GetRow();
87 proto native
int GetCol();
93 proto native
bool GetFlip();
99 proto native
vector GetPos();
105 proto native
void GetDir(out
float dir[4]);
121 proto native
void SetGroundEx(
EntityAI e,
vector pos,
float dir[4]);
129 proto native
void SetAttachment(notnull
EntityAI parent,
EntityAI e,
int slotId);
139 proto native
void SetCargoAuto(notnull
CargoBase cargo,
EntityAI e,
int row,
int col,
bool flip);
150 proto native
void SetCargo(notnull
EntityAI parent,
EntityAI e,
int idx,
int row,
int col,
bool flip);
163 proto native
void SetProxyCargo(notnull
EntityAI parent,
EntityAI e,
int idx,
int row,
int col,
bool flip);
176 proto native
void SetParent(notnull
EntityAI parent);
181 proto native
void SetItem(notnull
EntityAI item);
184 proto native
void SetSlot(
int slotId);
185 proto native
void SetIndex(
int idx);
186 proto native
void SetRow(
int row);
187 proto native
void SetCol(
int col);
188 proto native
void SetFlip(
bool flip);
193 proto native
void Reset();
221 return loc.DumpToString();
225 string DumpToString()
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();
255 res = res +
" idx=" + GetIdx() +
" row=" + GetRow() +
" col=" + GetCol() +
" f=" + GetFlip();
268 res = res +
" idx=" + GetIdx() +
" row=" + GetRow() +
" col=" + GetCol() +
" f=" + GetFlip();
313 #ifdef DIAG_DEVELOPER
315 Debug.Log(
string.Format(
"Item=%1 does not exist on server!",
Object.GetDebugName(item)),
"GROUND" ,
"n/a",
"ReadFromContext",
this.ToString() );
321 SetGroundEx(item, pos, dir);
326 if (!ctx.Read(parent))
334 if (!parent || !item)
336 #ifdef DIAG_DEVELOPER
338 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() );
344 SetAttachment(parent, item, slot);
349 if (!ctx.Read(parent))
362 if (!parent || !item)
364 #ifdef DIAG_DEVELOPER
366 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() );
372 SetCargo(parent, item, idx, row, col, flp);
377 if (!ctx.Read(parent))
382 if (!parent || !item)
384 #ifdef DIAG_DEVELOPER
386 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() );
392 SetHands(parent, item);
397 if (!ctx.Read(parent))
410 if (!parent || !item)
412 #ifdef DIAG_DEVELOPER
414 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() );
420 SetProxyCargo(parent, item, idx, row, col, flp);
425 ErrorEx(
"ReadFromContext - really unknown location type, this should not happen, type=" + type);
436 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed to write type");
450 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=item");
457 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=pos");
465 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=dir");
475 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=parent");
480 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=item");
483 if (!ctx.Write(GetSlot()))
485 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=slot");
494 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=parent");
499 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=item");
502 if (!ctx.Write(GetIdx()))
504 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=idx");
507 if (!ctx.Write(GetRow()))
509 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=row");
512 if (!ctx.Write(GetCol()))
514 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=col");
517 if (!ctx.Write(GetFlip()))
519 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=flp");
528 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed HND, arg=parent");
533 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed HND, arg=item");
542 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=parent");
547 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=item");
550 if (!ctx.Write(GetIdx()))
552 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=idx");
555 if (!ctx.Write(GetRow()))
557 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=row");
560 if (!ctx.Write(GetCol()))
562 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=col");
565 if (!ctx.Write(GetFlip()))
567 Error(
"InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=flp");
575 Error(
"WriteToContext - really unknown location type, this should not happen, type=" +
GetType());
587 if (!ctx.Write(
true))
589 Error(
"OptionalLocationWriteToContext - cannot write 1 to context!");
592 return loc.WriteToContext(ctx);
596 if (!ctx.Write(
false))
598 Error(
"OptionalLocationWriteToContext - cannot write 0 to context!");
607 bool present =
false;
608 if (!ctx.Read(present))
610 Error(
"OptionalLocationReadFromContext - cannot read bool from context!");
618 if (!loc.ReadFromContext(ctx))
620 Error(
"OptionalLocationReadFromContext - cannot read (present) inventorylocation from context!");