Allow view access of inventory if in free camera. Write access is elsewhere
Allow view access of inventory if in free camera. Write access is elsewhere
323 {
325
326 if (!player)
327 return;
328
329 super.UpdateInterval();
330
332 vector pos = player.GetPosition();
333 ref array<EntityAI> objects;
334
335 VicinityItemManager.GetInstance().Update( player.GetDeltaT() );
336 objects = VicinityItemManager.GetInstance().GetVicinityItems();
337
338
339 array<EntityAI> showable_items = new array<EntityAI>;
340 bool isUsedMicromanagment = false;
341 EntityAI selectesItem = ItemManager.GetInstance().GetSelectedItem();
343
344 if (selectesItem && ItemManager.GetInstance().IsMicromanagmentMode())
345 {
347 {
348 isUsedMicromanagment = true;
349 }
350 }
352
353 GameInventory game_inventory = player.GetInventory();
354 for ( int i = 0; i < objects.Count(); i++ )
355 {
356 eai = objects.Get( i );
358 continue;
359
362 continue;
363
365 {
366 showable_items.Insert(eai);
367
369 {
371 }
372 }
373 }
374
376 {
377
378 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
379 isUsedMicromanagment = false;
380 }
381
382
385
386 for ( i = 0; i < showable_items.Count(); i++ )
387 {
388 new_showed_items.Insert(showable_items[i],null);
389 }
390
391
392 bool need_update_focus = false;
394 {
398 if ( !new_showed_items.Contains( ent ) )
399 {
400 if ( selectesItem && selectesItem.GetHierarchyRoot() == ent)
401 {
402
403 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
404 }
405 GetMainWidget().Update();
406 if ( con.IsActive() )
407 need_update_focus = true;
410 }
411 else
412 {
414 }
415 }
417
418 bool accessInventory = PlayerBase.DEBUG_INVENTORY_ACCESS;
419 accessInventory |= FreeDebugCamera.GetInstance() && FreeDebugCamera.GetInstance().IsActive();
420
421
422
423 new_showed_items.Clear();
425 for ( i = 0; i < showable_items.Count(); i++ )
426 {
427 EntityAI entity = showable_items.Get( i );
428 if ( entity )
429 {
431 {
432 string config = "CfgVehicles " + entity.GetType() + " GUIInventoryAttachmentsProps";
433
434 if (
GetGame().ConfigIsExisting( config ) )
435 {
436 AttachmentCategoriesContainer ac =
new AttachmentCategoriesContainer(
m_Parent, -1 );
438 new_showed_items.Insert( entity, ac );
439 showed_items_IDs.Insert( entity.GetID(), ac);
440 }
441 else if ( entity.GetSlotsCountCorrect() > 0 && entity.GetInventory().GetCargo() )
442 {
443 if ( entity.IsInherited( DayZInfected ) )
444 {
445 if ( entity.IsAlive() )
446 {
447 continue;
448 }
449 ZombieContainer zmb_cnt =
new ZombieContainer(
m_Parent, -1 );
451 new_showed_items.Insert( entity, zmb_cnt );
452 showed_items_IDs.Insert( entity.GetID(), zmb_cnt );
454 }
455 else
456 {
457 ContainerWithCargoAndAttachments iwca = new ContainerWithCargoAndAttachments( this, -1 );
458 iwca.SetEntity( entity, false );
459 new_showed_items.Insert( entity, iwca );
460 showed_items_IDs.Insert( entity.GetID(), iwca );
461 }
462 }
463 else if ( entity.GetInventory().GetCargo() )
464 {
465 ContainerWithCargo iwc = new ContainerWithCargo( this, -1 );
466 iwc.SetEntity( entity, 0, false );
467 new_showed_items.Insert( entity, iwc );
468 showed_items_IDs.Insert( entity.GetID(), iwc );
469 iwc.UpdateInterval();
470 }
471 else if ( entity.GetSlotsCountCorrect() > 0 )
472 {
473 if ( entity.HasEnergyManager() )
474 {
475 ContainerWithElectricManager iwem = new ContainerWithElectricManager( this, -1 );
477 new_showed_items.Insert( entity, iwem );
478 showed_items_IDs.Insert( entity.GetID(), iwem );
479 }
480 else
481 {
482 if ( entity.IsInherited( PlayerBase ) )
483 {
485 if (accessInventory == false)
486 {
487 if ( entity.IsAlive() && ( !PlayerBase.Cast( entity ).IsUnconscious() && !PlayerBase.Cast( entity ).IsRestrained() ) )
488 {
489 continue;
490 }
491 }
492
493 PlayerContainer plyr_cnt =
new PlayerContainer(
m_Parent,
false );
494 plyr_cnt.
SetPlayer( PlayerBase.Cast( entity ) );
497 new_showed_items.Insert( entity, plyr_cnt );
498 showed_items_IDs.Insert( entity.GetID(), plyr_cnt);
499 }
500 else
501 {
502 ContainerWithCargoAndAttachments iwcas = new ContainerWithCargoAndAttachments( this, -1 );
503 iwcas.SetEntity( entity, false );
504 new_showed_items.Insert( entity, iwcas );
505 showed_items_IDs.Insert( entity.GetID(), iwcas );
506 iwcas.UpdateInterval();
507 }
508 }
509 }
510 }
511 else
512 {
513
515 if ( con )
516 {
517 if ( entity.IsInherited( PlayerBase ) )
518 {
520 if ( !accessInventory && entity.IsAlive() && ( !PlayerBase.Cast( entity ).IsUnconscious() && !PlayerBase.Cast( entity ).IsRestrained() ) )
521 {
522 GetMainWidget().Update();
523 if ( con.IsActive() )
524 need_update_focus = true;
527 continue;
528 }
529 }
530
532 {
534 {
535 GetMainWidget().Update();
536 if ( con.IsActive() )
537 need_update_focus = true;
540 continue;
541 }
542 }
543
544 new_showed_items.Insert( entity,
m_ShowedItems.Get( entity ) );
545 showed_items_IDs.Insert( entity.GetID(),
m_ShowedItemsIDs.Get( entity.GetID() ) );
546 }
547 }
548 }
549 }
550
552 auto cargoes = VicinityItemManager.GetInstance().GetVicinityCargos();
553 for ( i = 0; i < cargoes.Count(); i++ )
554 {
555 CargoBase cgo = cargoes.Get( i );
556 if ( cgo )
557 {
559 {
560 ContainerWithCargo pxc = new ContainerWithCargo( this, -1 );
562 new_showed_cargos.Insert( cgo, pxc );
563 pxc.UpdateInterval();
564 }
565 else
566 {
568 {
570 }
571 }
572 }
573 }
574
576 {
579 if ( !new_showed_cargos.Contains( cgo2 ) )
580 {
582 if( con2.IsActive() )
583 need_update_focus = true;
584 GetMainWidget().Update();
587 }
588 }
589
593
595 if (need_update_focus)
596 SetFirstActive();
597
600
602 {
604 if ( in )
605 in.UpdateConsoleToolbar();
606 }
607 }
void Inventory(LayoutHolder parent)
void SetEntity(EntityAI entity)
override bool IsPlayerInside(PlayerBase player, string selection)
proto native EntityAI GetCargoOwner()
get the entity that owns the cargo
proto native int GetOwnerCargoIndex()
override void Remove(LayoutHolder container)
void UpdateCollapseButtons()
override void SetEntity(EntityAI entity, bool immedUpdate=true)
override bool DisableVicinityIcon()
override bool IsInventoryVisible()
proto native bool IsPlaceholderEntity(notnull Object e)
void SetPlayer(PlayerBase player)
void UpdateHeader(EntityAI entity, Container cont, PlayerBase player)
Updates header dragability to be consistent with current 'icon' behaviour.
ref VicinitySlotsContainer m_VicinityIconsContainer
ref map< int, ref Container > m_ShowedItemsIDs
ref map< CargoBase, ref Container > m_ShowedCargos
ref array< EntityAI > m_ShowedItemIcons
ref map< EntityAI, ref Container > m_ShowedItems
void SetEntity(EntityAI zombie_entity)
proto native CGame GetGame()
proto void Insert(int index, string input)
Inserts a string into the n-th index, increasing the string length by the size of the input.