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
Adjust left cargo container scroller height depending on visible items in the vicinity
342 {
343 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer() );
344
345 if (!player)
346 return;
347
348 super.UpdateInterval();
349
351 vector pos = player.GetPosition();
352 array<EntityAI> objects;
353
354 VicinityItemManager.GetInstance().Update( player.GetDeltaT() );
355 objects = VicinityItemManager.GetInstance().GetVicinityItems();
356
357
358 array<EntityAI> showable_items = new array<EntityAI>;
359 bool isUsedMicromanagment = false;
360 EntityAI selectesItem = ItemManager.GetInstance().GetSelectedItem();
362
363 if (selectesItem && ItemManager.GetInstance().IsMicromanagmentMode())
364 {
366 {
367 isUsedMicromanagment = true;
368 }
369 }
371
372 GameInventory game_inventory = player.GetInventory();
373 for ( int i = 0; i < objects.Count(); i++ )
374 {
375 eai = objects.Get( i );
377 continue;
378
381 continue;
382
383 if (eai.IsInventoryVisible())
384 {
385 showable_items.Insert(eai);
386
388 {
390 }
391 }
392 }
393
395 {
396
397 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
398 isUsedMicromanagment = false;
399 }
400
401
402 map<EntityAI, ref Container> new_showed_items = new map<EntityAI, ref Container>;
404
405 for ( i = 0; i < showable_items.Count(); i++ )
406 {
407 new_showed_items.Insert(showable_items[i],null);
408 }
409
410
411 bool need_update_focus = false;
413 {
417 if ( !new_showed_items.Contains( ent ) )
418 {
419 if ( selectesItem && selectesItem.GetHierarchyRoot() == ent)
420 {
421
422 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
423 }
424 GetMainWidget().Update();
425 if ( con.IsActive() )
426 need_update_focus = true;
429 }
430 else
431 {
433 }
434 }
436
437 bool accessInventory = PlayerBase.DEBUG_INVENTORY_ACCESS;
438 accessInventory |= FreeDebugCamera.GetInstance() && FreeDebugCamera.GetInstance().IsActive();
439
440
441
442 new_showed_items.Clear();
444 for ( i = 0; i < showable_items.Count(); i++ )
445 {
446 EntityAI entity = showable_items.Get( i );
447 if ( entity )
448 {
450 {
451 string config = "CfgVehicles " + entity.GetType() + " GUIInventoryAttachmentsProps";
452
453 if (
g_Game.ConfigIsExisting( config ) )
454 {
455 AttachmentCategoriesContainer ac =
new AttachmentCategoriesContainer(
m_Parent, -1 );
457 new_showed_items.Insert( entity, ac );
458 showed_items_IDs.Insert( entity.GetID(), ac);
459 }
460 else if ( entity.GetSlotsCountCorrect() > 0 && entity.GetInventory().GetCargo() )
461 {
462 if ( entity.IsInherited( DayZInfected ) )
463 {
464 if ( entity.IsAlive() )
465 {
466 continue;
467 }
468 ZombieContainer zmb_cnt =
new ZombieContainer(
m_Parent, -1 );
470 new_showed_items.Insert( entity, zmb_cnt );
471 showed_items_IDs.Insert( entity.GetID(), zmb_cnt );
473 }
474 else
475 {
476 ContainerWithCargoAndAttachments iwca = new ContainerWithCargoAndAttachments( this, -1 );
477 iwca.SetEntity( entity, false );
478 new_showed_items.Insert( entity, iwca );
479 showed_items_IDs.Insert( entity.GetID(), iwca );
480 }
481 }
482 else if ( entity.GetInventory().GetCargo() )
483 {
484 ContainerWithCargo iwc = new ContainerWithCargo( this, -1 );
485 iwc.SetEntity( entity, 0, false );
486 new_showed_items.Insert( entity, iwc );
487 showed_items_IDs.Insert( entity.GetID(), iwc );
488 iwc.UpdateInterval();
489 }
490 else if ( entity.GetSlotsCountCorrect() > 0 )
491 {
492 if ( entity.HasEnergyManager() )
493 {
494 ContainerWithElectricManager iwem = new ContainerWithElectricManager( this, -1 );
496 new_showed_items.Insert( entity, iwem );
497 showed_items_IDs.Insert( entity.GetID(), iwem );
498 }
499 else
500 {
501 if ( entity.IsInherited( PlayerBase ) )
502 {
504 if (accessInventory == false)
505 {
506 if ( entity.IsAlive() && ( !PlayerBase.Cast( entity ).IsUnconscious() && !PlayerBase.Cast( entity ).IsRestrained() ) )
507 {
508 continue;
509 }
510 }
511
512 PlayerContainer plyr_cnt =
new PlayerContainer(
m_Parent,
false );
513 plyr_cnt.
SetPlayer( PlayerBase.Cast( entity ) );
516 new_showed_items.Insert( entity, plyr_cnt );
517 showed_items_IDs.Insert( entity.GetID(), plyr_cnt);
518 }
519 else
520 {
521 ContainerWithCargoAndAttachments iwcas = new ContainerWithCargoAndAttachments( this, -1 );
522 iwcas.SetEntity( entity, false );
523 new_showed_items.Insert( entity, iwcas );
524 showed_items_IDs.Insert( entity.GetID(), iwcas );
525 iwcas.UpdateInterval();
526 }
527 }
528 }
529 }
530 else
531 {
532
534 if ( con )
535 {
536 if ( entity.IsInherited( PlayerBase ) )
537 {
539 if ( !accessInventory && entity.IsAlive() && ( !PlayerBase.Cast( entity ).IsUnconscious() && !PlayerBase.Cast( entity ).IsRestrained() ) )
540 {
541 GetMainWidget().Update();
542 if ( con.IsActive() )
543 need_update_focus = true;
546 continue;
547 }
548 }
549
551 {
553 {
554 GetMainWidget().Update();
555 if ( con.IsActive() )
556 need_update_focus = true;
559 continue;
560 }
561 }
562
563 new_showed_items.Insert( entity,
m_ShowedItems.Get( entity ) );
564 showed_items_IDs.Insert( entity.GetID(),
m_ShowedItemsIDs.Get( entity.GetID() ) );
565 }
566 }
567 }
568 }
569
570 map<CargoBase, ref Container> new_showed_cargos = new map<CargoBase, ref Container>;
571 auto cargoes = VicinityItemManager.GetInstance().GetVicinityCargos();
572 for ( i = 0; i < cargoes.Count(); i++ )
573 {
574 CargoBase cgo = cargoes.Get( i );
575 if ( cgo )
576 {
578 {
579 ContainerWithCargo pxc = new ContainerWithCargo( this, -1 );
581 new_showed_cargos.Insert( cgo, pxc );
582 pxc.UpdateInterval();
583 }
584 else
585 {
587 {
589 }
590 }
591 }
592 }
593
595 {
598 if ( !new_showed_cargos.Contains( cgo2 ) )
599 {
601 if( con2.IsActive() )
602 need_update_focus = true;
603 GetMainWidget().Update();
606 }
607 }
608
612
614 if (need_update_focus)
615 SetFirstActive();
616
619
621 {
623 if ( in )
624 in.UpdateConsoleToolbar();
625 }
626
627 #ifndef PLATFORM_CONSOLE
630 {
631 float width, height;
634 {
636 }
638 {
640 }
641 else
642 {
644 }
645 }
646 #endif
647 }
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()
proto native bool IsPlaceholderEntity(notnull Object e)
void SetPlayer(PlayerBase player)
ScrollWidget m_CargoScrollWidget
const int ITEMS_PER_COLUMN_MAX
void UpdateHeader(EntityAI entity, Container cont, PlayerBase player)
Updates header dragability to be consistent with current 'icon' behaviour.
ref VicinitySlotsContainer m_VicinityIconsContainer
const float VICINITY_CARGO_SCROLLER_HEIGHT_MID
ref map< int, ref Container > m_ShowedItemsIDs
const float VICINITY_CARGO_SCROLLER_HEIGHT_MIN
ref map< CargoBase, ref Container > m_ShowedCargos
ref array< EntityAI > m_ShowedItemIcons
ref map< EntityAI, ref Container > m_ShowedItems
const float VICINITY_CARGO_SCROLLER_HEIGHT_MAX
void SetEntity(EntityAI zombie_entity)
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.