DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ReadFromContext()

bool InventoryLocation::ReadFromContext ( ParamsReadContext ctx)
inlineprivate

См. определение в файле InventoryLocation.c строка 310

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 }
class LogManager EntityAI
string Debug()
Определения CachedEquipmentStorageBase.c:29
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
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 SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
sets current inventory location type to Attachment with slot id set to <slotId>
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 void SetGroundEx(EntityAI e, vector pos, float dir[4])
sets current inventory location type to Ground with transformation mat
proto bool Read(void value_in)
class LOD Object
enum ShapeType ErrorEx

Перекрестные ссылки ErrorEx, Debug::Log(), Serializer::Read(), SetAttachment(), SetCargo(), SetGroundEx(), SetHands(), SetProxyCargo() и SetVehicle().

Используется в ManBase::HandleRemoteItemManipulation(), WeaponManager::OnInputUserDataProcess(), OnInventoryCheck(), OnInventoryJunctureFailureFromServer(), PluginBase::OnRPC(), GameInventory::OnServerInventoryCommandStatic(), FirearmActionAttachMagazine::ReadFromContext(), FirearmActionAttachMagazineQuick::ReadFromContext(), FirearmActionDetachMagazine::ReadFromContext(), FirearmActionDetachMagazine_Old::ReadFromContext(), HandEventBase::ReadFromContext(), HandEventRemove::ReadFromContext(), WeaponEventBase::ReadFromContext(), ValidateDestroy() и ValidateSyncMove().