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

◆ ReadFromContext()

bool InventoryLocation::ReadFromContext ( ParamsReadContext ctx)
inlineprivate

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

297 {
298 EntityAI parent;
299 EntityAI item;
300 int type = 0;
301 int idx = -1;
302 int row = -1;
303 int col = -1;
304 bool flp = false;
305 if (!ctx.Read(type))
306 return false;
307
308 switch (type)
309 {
310 case InventoryLocationType.UNKNOWN:
311 {
312 break;
313 }
314 case InventoryLocationType.GROUND:
315 {
316 if (!ctx.Read(item))
317 return false;
318 vector pos;
319 if (!ctx.Read(pos))
320 return false;
321
322 float dir[4];
323 if (!ctx.Read(dir))
324 return false;
325
326 if (!item)
327 {
328#ifdef ENABLE_LOGGING
329#ifdef SERVER
330 Debug.Log(string.Format("Item=%1 does not exist on server!", Object.GetDebugName(item)), "GROUND" , "n/a", "ReadFromContext", this.ToString() );
331#endif
332#endif
333 break; // parent or item is possibly not spawned in bubble yet
334 }
335
336 SetGroundEx(item, pos, dir);
337 break;
338 }
339 case InventoryLocationType.ATTACHMENT:
340 {
341 if (!ctx.Read(parent))
342 return false;
343 if (!ctx.Read(item))
344 return false;
345 int slot;
346 if (!ctx.Read(slot))
347 return false;
348
349 if (!parent || !item)
350 {
351#ifdef ENABLE_LOGGING
352#ifdef SERVER
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() );
354#endif
355#endif
356 break; // parent or item is possibly not spawned in bubble yet
357 }
358
359 SetAttachment(parent, item, slot);
360 break;
361 }
362 case InventoryLocationType.CARGO:
363 {
364 if (!ctx.Read(parent))
365 return false;
366 if (!ctx.Read(item))
367 return false;
368 if (!ctx.Read(idx))
369 return false;
370 if (!ctx.Read(row))
371 return false;
372 if (!ctx.Read(col))
373 return false;
374 if (!ctx.Read(flp))
375 return false;
376
377 if (!parent || !item)
378 {
379#ifdef ENABLE_LOGGING
380#ifdef SERVER
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() );
382#endif
383#endif
384 break; // parent or item is possibly not spawned in bubble yet
385 }
386
387 SetCargo(parent, item, idx, row, col, flp);
388 break;
389 }
390 case InventoryLocationType.HANDS:
391 {
392 if (!ctx.Read(parent))
393 return false;
394 if (!ctx.Read(item))
395 return false;
396
397 if (!parent || !item)
398 {
399#ifdef ENABLE_LOGGING
400#ifdef SERVER
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() );
402#endif
403#endif
404 break; // parent or item is possibly not spawned in bubble yet
405 }
406
407 SetHands(parent, item);
408 break;
409 }
410 case InventoryLocationType.PROXYCARGO:
411 {
412 if (!ctx.Read(parent))
413 return false;
414 if (!ctx.Read(item))
415 return false;
416 if (!ctx.Read(idx))
417 return false;
418 if (!ctx.Read(row))
419 return false;
420 if (!ctx.Read(col))
421 return false;
422 if (!ctx.Read(flp))
423 return false;
424
425 if (!parent || !item)
426 {
427#ifdef ENABLE_LOGGING
428#ifdef SERVER
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() );
430#endif
431#endif
432 break; // parent or item is possibly not spawned in bubble yet
433 }
434
435 SetProxyCargo(parent, item, idx, row, col, flp);
436 break;
437 }
438 case InventoryLocationType.VEHICLE:
439 {
440 if (!ctx.Read(parent))
441 return false;
442 if (!ctx.Read(item))
443 return false;
444 if (!ctx.Read(idx))
445 return false;
446
447 if (!parent || !item)
448 {
449#ifdef ENABLE_LOGGING
450#ifdef SERVER
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() );
452#endif
453#endif
454 break; // parent or item is possibly not spawned in bubble yet
455 }
456
457 SetVehicle(parent, item, idx);
458 break;
459 }
460 default:
461 {
462 ErrorEx("ReadFromContext - really unknown location type, this should not happen, type=" + type);
463 return false;
464 }
465 }
466 return true;
467 }
class LogManager EntityAI
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
void Debug()
Определения UniversalTemperatureSource.c:349
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(), OnInventoryJunctureFailureFromServer(), GameInventory::OnServerInventoryCommandStatic(), FirearmActionAttachMagazine::ReadFromContext(), FirearmActionAttachMagazineQuick::ReadFromContext(), FirearmActionDetachMagazine::ReadFromContext(), FirearmActionDetachMagazine_Old::ReadFromContext(), HandEventBase::ReadFromContext(), HandEventRemove::ReadFromContext(), WeaponEventBase::ReadFromContext(), ValidateDestroy(), ValidateSwap() и ValidateSyncMove().