DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
InventoryLocation.c
См. документацию.
1//@NOTE: DO NOT EDIT! enum values are overwritten from c++
14
15//@NOTE: DO NOT EDIT! enum values are overwritten from c++
27
30{
36 proto native bool IsValid();
43 proto native int GetType();
52 proto native EntityAI GetParent();
62 proto native EntityAI GetItem();
71 proto native int GetSlot();
77 proto native int GetIdx();
83 proto native int GetRow();
89 proto native int GetCol();
95 proto native bool GetFlip();
101 proto native vector GetPos();
107 proto native void GetDir(out float dir[4]);
108
115 proto native void SetGround(EntityAI e, vector mat[4]);
123 proto native void SetGroundEx(EntityAI e, vector pos, float dir[4]);
131 proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId);
132
141 proto native void SetCargoAuto(notnull CargoBase cargo, EntityAI e, int row, int col, bool flip);
142
152 proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip);
165 proto native void SetProxyCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip);
172 proto native void SetHands(notnull EntityAI parent, EntityAI e);
173
179 proto native void SetVehicle(notnull EntityAI parent, EntityAI e, int idx);
180
185 proto native void SetTemporary(notnull EntityAI parent, EntityAI e);
186
191 proto native void SetParent(notnull EntityAI parent);
196 proto native void SetItem(notnull EntityAI item);
197
198 // direct set methods
199 proto native void SetSlot(int slotId);
200 proto native void SetIndex(int idx);
201 proto native void SetRow(int row);
202 proto native void SetCol(int col);
203 proto native void SetFlip(bool flip);
204
208 proto native void Reset();
209
210 proto native bool CompareLocationOnly(notnull InventoryLocation other);
211
216 proto native bool CollidesWith(notnull InventoryLocation rhs);
217
224 proto native InventoryLocation Copy(notnull InventoryLocation rhs);
231 proto native InventoryLocation CopyLocationFrom(notnull InventoryLocation rhs, bool copyFlip);
232
234 {
235 if (loc)
236 return loc.DumpToString();
237 return "{ null }";
238 }
239
241 {
242 string res = "{ type=" + typename.EnumToString(InventoryLocationType, GetType());
243 switch (GetType())
244 {
245 case InventoryLocationType.UNKNOWN:
246 {
247 break;
248 }
249 case InventoryLocationType.GROUND:
250 {
251 res = res + " item=" + Object.GetDebugName(GetItem());
252 vector pos = GetPos();
253 float dir[4];
254 GetDir(dir);
255 res = res + " pos=(" + pos[0] + ", " + pos[1] + ", " + pos[2] + ")";
256 res = res + " dir=(" + dir[0] + ", " + dir[1] + ", " + dir[2] + ", " + dir[3] + ")";
257 break;
258 }
259 case InventoryLocationType.ATTACHMENT:
260 {
261 res = res + " item=" + Object.GetDebugName(GetItem());
262 res = res + " parent=" + Object.GetDebugName(GetParent());
263 res = res + " slot=" + GetSlot();
264 break;
265 }
266 case InventoryLocationType.CARGO:
267 {
268 res = res + " item=" + Object.GetDebugName(GetItem());
269 res = res + " parent=" + Object.GetDebugName(GetParent());
270 res = res + " idx=" + GetIdx() + " row=" + GetRow() + " col=" + GetCol() + " f=" + GetFlip();
271 break;
272 }
273 case InventoryLocationType.HANDS:
274 {
275 res = res + " item=" + Object.GetDebugName(GetItem());
276 res = res + " parent=" + Object.GetDebugName(GetParent());
277 break;
278 }
279 case InventoryLocationType.PROXYCARGO:
280 {
281 res = res + " item=" + Object.GetDebugName(GetItem());
282 res = res + " parent=" + Object.GetDebugName(GetParent());
283 res = res + " idx=" + GetIdx() + " row=" + GetRow() + " col=" + GetCol() + " f=" + GetFlip();
284 break;
285 }
286 case InventoryLocationType.VEHICLE:
287 {
288 res = res + " item=" + Object.GetDebugName(GetItem());
289 res = res + " parent=" + Object.GetDebugName(GetParent());
290 res = res + " idx=" + GetIdx();
291 break;
292 }
293
294 case InventoryLocationType.TEMP:
295 {
296 res = res + " item=" + Object.GetDebugName(GetItem());
297 res = res + " parent=" + Object.GetDebugName(GetParent());
298 break;
299 }
300 default:
301 {
302 res = res + "??";
303 break;
304 }
305 }
306 res = res + " }";
307 return res;
308 }
309
311 {
312 EntityAI parent;
313 EntityAI item;
314 int type = 0;
315 int idx = -1;
316 int row = -1;
317 int col = -1;
318 bool flp = false;
319 if (!ctx.Read(type))
320 return false;
321
322 switch (type)
323 {
324 case InventoryLocationType.UNKNOWN:
325 {
326 break;
327 }
328 case InventoryLocationType.GROUND:
329 {
330 if (!ctx.Read(item))
331 return false;
332 vector pos;
333 if (!ctx.Read(pos))
334 return false;
335
336 float dir[4];
337 if (!ctx.Read(dir))
338 return false;
339
340 if (!item)
341 {
342#ifdef ENABLE_LOGGING
343#ifdef SERVER
344 Debug.Log(string.Format("Item=%1 does not exist on server!", Object.GetDebugName(item)), "GROUND" , "n/a", "ReadFromContext", this.ToString() );
345#endif
346#endif
347 break; // parent or item is possibly not spawned in bubble yet
348 }
349
350 SetGroundEx(item, pos, dir);
351 break;
352 }
353 case InventoryLocationType.ATTACHMENT:
354 {
355 if (!ctx.Read(parent))
356 return false;
357 if (!ctx.Read(item))
358 return false;
359 int slot;
360 if (!ctx.Read(slot))
361 return false;
362
363 if (!parent || !item)
364 {
365#ifdef ENABLE_LOGGING
366#ifdef SERVER
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() );
368#endif
369#endif
370 break; // parent or item is possibly not spawned in bubble yet
371 }
372
373 SetAttachment(parent, item, slot);
374 break;
375 }
376 case InventoryLocationType.CARGO:
377 {
378 if (!ctx.Read(parent))
379 return false;
380 if (!ctx.Read(item))
381 return false;
382 if (!ctx.Read(idx))
383 return false;
384 if (!ctx.Read(row))
385 return false;
386 if (!ctx.Read(col))
387 return false;
388 if (!ctx.Read(flp))
389 return false;
390
391 if (!parent || !item)
392 {
393#ifdef ENABLE_LOGGING
394#ifdef SERVER
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() );
396#endif
397#endif
398 break; // parent or item is possibly not spawned in bubble yet
399 }
400
401 SetCargo(parent, item, idx, row, col, flp);
402 break;
403 }
404 case InventoryLocationType.HANDS:
405 {
406 if (!ctx.Read(parent))
407 return false;
408 if (!ctx.Read(item))
409 return false;
410
411 if (!parent || !item)
412 {
413#ifdef ENABLE_LOGGING
414#ifdef SERVER
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() );
416#endif
417#endif
418 break; // parent or item is possibly not spawned in bubble yet
419 }
420
421 SetHands(parent, item);
422 break;
423 }
424 case InventoryLocationType.PROXYCARGO:
425 {
426 if (!ctx.Read(parent))
427 return false;
428 if (!ctx.Read(item))
429 return false;
430 if (!ctx.Read(idx))
431 return false;
432 if (!ctx.Read(row))
433 return false;
434 if (!ctx.Read(col))
435 return false;
436 if (!ctx.Read(flp))
437 return false;
438
439 if (!parent || !item)
440 {
441#ifdef ENABLE_LOGGING
442#ifdef SERVER
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() );
444#endif
445#endif
446 break; // parent or item is possibly not spawned in bubble yet
447 }
448
449 SetProxyCargo(parent, item, idx, row, col, flp);
450 break;
451 }
452 case InventoryLocationType.VEHICLE:
453 {
454 if (!ctx.Read(parent))
455 return false;
456 if (!ctx.Read(item))
457 return false;
458 if (!ctx.Read(idx))
459 return false;
460
461 if (!parent || !item)
462 {
463#ifdef ENABLE_LOGGING
464#ifdef SERVER
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() );
466#endif
467#endif
468 break; // parent or item is possibly not spawned in bubble yet
469 }
470
471 SetVehicle(parent, item, idx);
472 break;
473 }
474
475 case InventoryLocationType.TEMP:
476 {
477 if (!ctx.Read(parent))
478 return false;
479 if (!ctx.Read(item))
480 return false;
481
482 int tmp;
483 if (!ctx.Read(tmp))
484 return false;
485
486 if (!parent || !item)
487 {
488#ifdef ENABLE_LOGGING
489#ifdef SERVER
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() );
491#endif
492#endif
493 break;
494 }
495 SetAttachment(parent, item, -1);
496 //SetTemporary(parent, item);
497 }
498 default:
499 {
500 ErrorEx("ReadFromContext - really unknown location type, this should not happen, type=" + type);
501 return false;
502 }
503 }
504 return true;
505 }
506
508 {
509 if (GetType() == InventoryLocationType.TEMP)
510 {
511 int type = InventoryLocationType.ATTACHMENT;
512 if (!ctx.Write(type))
513 {
514 Error("InventoryLocation::WriteToContext - cannot write to context! failed to write temp type");
515 return false;
516 }
517 }
518 else if (!ctx.Write(GetType()))
519 {
520 Error("InventoryLocation::WriteToContext - cannot write to context! failed to write type");
521 return false;
522 }
523
524 switch (GetType())
525 {
526 case InventoryLocationType.UNKNOWN:
527 {
528 break;
529 }
530 case InventoryLocationType.GROUND:
531 {
532 if (!ctx.Write(GetItem()))
533 {
534 Error("InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=item");
535 return false;
536 }
537
538 vector pos = GetPos();
539 if (!ctx.Write(pos))
540 {
541 Error("InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=pos");
542 return false;
543 }
544
545 float dir[4];
546 GetDir(dir);
547 if (!ctx.Write(dir))
548 {
549 Error("InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=dir");
550 return false;
551 }
552
553 break;
554 }
555 case InventoryLocationType.ATTACHMENT:
556 {
557 if (!ctx.Write(GetParent()))
558 {
559 Error("InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=parent");
560 return false;
561 }
562 if (!ctx.Write(GetItem()))
563 {
564 Error("InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=item");
565 return false;
566 }
567 if (!ctx.Write(GetSlot()))
568 {
569 Error("InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=slot");
570 return false;
571 }
572 break;
573 }
574 case InventoryLocationType.CARGO:
575 {
576 if (!ctx.Write(GetParent()))
577 {
578 Error("InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=parent");
579 return false;
580 }
581 if (!ctx.Write(GetItem()))
582 {
583 Error("InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=item");
584 return false;
585 }
586 if (!ctx.Write(GetIdx()))
587 {
588 Error("InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=idx");
589 return false;
590 }
591 if (!ctx.Write(GetRow()))
592 {
593 Error("InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=row");
594 return false;
595 }
596 if (!ctx.Write(GetCol()))
597 {
598 Error("InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=col");
599 return false;
600 }
601 if (!ctx.Write(GetFlip()))
602 {
603 Error("InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=flp");
604 return false;
605 }
606 break;
607 }
608 case InventoryLocationType.HANDS:
609 {
610 if (!ctx.Write(GetParent()))
611 {
612 Error("InventoryLocation::WriteToContext - cannot write to context! failed HND, arg=parent");
613 return false;
614 }
615 if (!ctx.Write(GetItem()))
616 {
617 Error("InventoryLocation::WriteToContext - cannot write to context! failed HND, arg=item");
618 return false;
619 }
620 break;
621 }
622 case InventoryLocationType.PROXYCARGO:
623 {
624 if (!ctx.Write(GetParent()))
625 {
626 Error("InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=parent");
627 return false;
628 }
629 if (!ctx.Write(GetItem()))
630 {
631 Error("InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=item");
632 return false;
633 }
634 if (!ctx.Write(GetIdx()))
635 {
636 Error("InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=idx");
637 return false;
638 }
639 if (!ctx.Write(GetRow()))
640 {
641 Error("InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=row");
642 return false;
643 }
644 if (!ctx.Write(GetCol()))
645 {
646 Error("InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=col");
647 return false;
648 }
649 if (!ctx.Write(GetFlip()))
650 {
651 Error("InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=flp");
652 return false;
653 }
654
655 break;
656 }
657
658 case InventoryLocationType.VEHICLE:
659 {
660 if (!ctx.Write(GetParent()))
661 {
662 Error("InventoryLocation::WriteToContext - cannot write to context! failed VHC, arg=parent");
663 return false;
664 }
665 if (!ctx.Write(GetItem()))
666 {
667 Error("InventoryLocation::WriteToContext - cannot write to context! failed VHC, arg=item");
668 return false;
669 }
670 if (!ctx.Write(GetIdx()))
671 {
672 Error("InventoryLocation::WriteToContext - cannot write to context! failed VHC, arg=idx");
673 return false;
674 }
675 break;
676 }
677
678 case InventoryLocationType.TEMP:
679 {
680 if (!ctx.Write(GetParent()))
681 {
682 Error("InventoryLocation::WriteToContext - cannot write to context! failed TMP, arg=parent");
683 return false;
684 }
685
686 if (!ctx.Write(GetItem()))
687 {
688 Error("InventoryLocation::WriteToContext - cannot write to context! failed TMP, arg=item");
689 return false;
690 }
691
692 if (!ctx.Write(-1))
693 {
694 Error("InventoryLocation::WriteToContext - cannot write to context! failed TMP, idx=-1");
695 return false;
696 }
697
698 break;
699 }
700 default:
701 {
702 Error("WriteToContext - really unknown location type, this should not happen, type=" + GetType());
703 return false;
704 }
705 }
706 return true;
707 }
708};
709
711{
712 if (loc)
713 {
714 if (!ctx.Write(true))
715 {
716 Error("OptionalLocationWriteToContext - cannot write 1 to context!");
717 return false;
718 }
719 return loc.WriteToContext(ctx);
720 }
721 else
722 {
723 if (!ctx.Write(false))
724 {
725 Error("OptionalLocationWriteToContext - cannot write 0 to context!");
726 return false;
727 }
728 }
729 return true;
730}
731
733{
734 bool present = false;
735 if (!ctx.Read(present))
736 {
737 Error("OptionalLocationReadFromContext - cannot read bool from context!");
738 return false;
739 }
740
741 if (!present)
742 return true;
743
744 loc = new InventoryLocation();
745 if (!loc.ReadFromContext(ctx))
746 {
747 Error("OptionalLocationReadFromContext - cannot read (present) inventorylocation from context!");
748 return false;
749 }
750 return true;
751}
@ UNKNOWN
24 - Any other error. Can be returned from any call.
Определения BIOSErrorModule.c:56
@ TEMP
Определения DayZPhysics.c:42
@ VEHICLE
Определения DayZPhysics.c:8
@ ANY
Определения ECachedEquipmentPlacement.c:3
@ CARGO
CGO.
Определения ECachedEquipmentPlacement.c:5
@ ATTACHMENT
ATT.
Определения ECachedEquipmentPlacement.c:4
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:18
@ PROXYCARGO
cargo of a large object (building,...)
Определения InventoryLocation.c:10
@ ANY_CARGO
CGO | PXY.
Определения InventoryLocation.c:23
@ HANDS
hands of another entity
Определения InventoryLocation.c:9
@ NO_SLOT_AUTO_ASSIGN
skips auto-assign test
Определения InventoryLocation.c:25
bool OptionalLocationReadFromContext(out InventoryLocation loc, notnull ParamsReadContext ctx)
Определения InventoryLocation.c:732
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
@ GROUND
Определения InventoryLocation.c:6
bool OptionalLocationWriteToContext(InventoryLocation loc, notnull ParamsWriteContext ctx)
Определения InventoryLocation.c:710
represents base for cargo storage for entities
Определения Cargo.c:7
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.
Определения 3_Game/DayZ/tools/Debug.c:182
Определения 3_Game/DayZ/tools/Debug.c:2
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)
Определения InventoryLocation.c:233
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 void SetTemporary(notnull EntityAI parent, EntityAI e)
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)
Определения InventoryLocation.c:507
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)
Определения InventoryLocation.c:310
string DumpToString()
Определения InventoryLocation.c:240
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
InventoryLocation.
Определения InventoryLocation.c:30
Определения ObjectTyped.c:2
proto bool Write(void value_out)
proto bool Read(void value_in)
Определения EnConvert.c:119
Serializer ParamsReadContext
Определения gameplay.c:15
Serializer ParamsWriteContext
Определения gameplay.c:16
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx