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 foreach (
EntityAI showableItem : showable_items)
406 {
407 new_showed_items.Insert(showableItem,null);
408 }
409
410 bool need_update_focus = false;
412 {
413 cont.UpdateInterval();
414 if (!new_showed_items.Contains(ent))
415 {
416 if (selectesItem && selectesItem.GetHierarchyRoot() == ent)
417 {
418 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
419 }
420 GetMainWidget().Update();
421 if (cont.IsActive())
422 need_update_focus = true;
425 }
426 else
427 {
429 }
430 }
432
433 bool accessInventory = PlayerBase.DEBUG_INVENTORY_ACCESS;
434 accessInventory |= FreeDebugCamera.GetInstance() && FreeDebugCamera.GetInstance().IsActive();
435
436
437
438 new_showed_items.Clear();
439 map<int, ref Container> showed_items_IDs = new map<int, ref Container>;
440 for ( i = 0; i < showable_items.Count(); i++ )
441 {
442 EntityAI entity = showable_items.Get( i );
443 if ( entity )
444 {
446 {
447 string config = "CfgVehicles " + entity.GetType() + " GUIInventoryAttachmentsProps";
448
449 if (
g_Game.ConfigIsExisting( config ) )
450 {
451 AttachmentCategoriesContainer ac =
new AttachmentCategoriesContainer(
m_Parent, -1 );
453 new_showed_items.Insert( entity, ac );
454 showed_items_IDs.Insert( entity.GetID(), ac);
455 }
456 else if ( entity.GetSlotsCountCorrect() > 0 && entity.GetInventory().GetCargo() )
457 {
458 if ( entity.IsInherited( DayZInfected ) )
459 {
460 if ( entity.IsAlive() )
461 {
462 continue;
463 }
464 ZombieContainer zmb_cnt =
new ZombieContainer(
m_Parent, -1 );
466 new_showed_items.Insert( entity, zmb_cnt );
467 showed_items_IDs.Insert( entity.GetID(), zmb_cnt );
469 }
470 else
471 {
472 ContainerWithCargoAndAttachments iwca = new ContainerWithCargoAndAttachments( this, -1 );
473 iwca.SetEntity( entity, false );
474 new_showed_items.Insert( entity, iwca );
475 showed_items_IDs.Insert( entity.GetID(), iwca );
476 }
477 }
478 else if ( entity.GetInventory().GetCargo() )
479 {
480 ContainerWithCargo iwc = new ContainerWithCargo( this, -1 );
481 iwc.SetEntity( entity, 0, false );
482 new_showed_items.Insert( entity, iwc );
483 showed_items_IDs.Insert( entity.GetID(), iwc );
484 iwc.UpdateInterval();
485 }
486 else if ( entity.GetSlotsCountCorrect() > 0 )
487 {
488 if ( entity.HasEnergyManager() )
489 {
490 ContainerWithElectricManager iwem = new ContainerWithElectricManager( this, -1 );
492 new_showed_items.Insert( entity, iwem );
493 showed_items_IDs.Insert( entity.GetID(), iwem );
494 }
495 else
496 {
497 if ( entity.IsInherited( PlayerBase ) )
498 {
500 if (accessInventory == false)
501 {
502 if ( entity.IsAlive() && ( !PlayerBase.Cast( entity ).IsUnconscious() && !PlayerBase.Cast( entity ).IsRestrained() ) )
503 {
504 continue;
505 }
506 }
507
508 PlayerContainer plyr_cnt =
new PlayerContainer(
m_Parent,
false );
509 plyr_cnt.
SetPlayer( PlayerBase.Cast( entity ) );
512 new_showed_items.Insert( entity, plyr_cnt );
513 showed_items_IDs.Insert( entity.GetID(), plyr_cnt);
514 }
515 else
516 {
517 ContainerWithCargoAndAttachments iwcas = new ContainerWithCargoAndAttachments( this, -1 );
518 iwcas.SetEntity( entity, false );
519 new_showed_items.Insert( entity, iwcas );
520 showed_items_IDs.Insert( entity.GetID(), iwcas );
521 iwcas.UpdateInterval();
522 }
523 }
524 }
525 }
526 else
527 {
528
530 if ( con )
531 {
532 if ( entity.IsInherited( PlayerBase ) )
533 {
535 if ( !accessInventory && entity.IsAlive() && ( !PlayerBase.Cast( entity ).IsUnconscious() && !PlayerBase.Cast( entity ).IsRestrained() ) )
536 {
537 GetMainWidget().Update();
538 if ( con.IsActive() )
539 need_update_focus = true;
542 continue;
543 }
544 }
545
547 {
549 {
550 GetMainWidget().Update();
551 if ( con.IsActive() )
552 need_update_focus = true;
555 continue;
556 }
557 }
558
559 new_showed_items.Insert( entity,
m_ShowedItems.Get( entity ) );
560 showed_items_IDs.Insert( entity.GetID(),
m_ShowedItemsIDs.Get( entity.GetID() ) );
561 }
562 }
563 }
564 }
565
566 map<CargoBase, ref Container> new_showed_cargos = new map<CargoBase, ref Container>;
567 auto cargoes = VicinityItemManager.GetInstance().GetVicinityCargos();
568 for ( i = 0; i < cargoes.Count(); i++ )
569 {
570 CargoBase cgo = cargoes.Get( i );
571 if ( cgo )
572 {
574 {
575 ContainerWithCargo pxc = new ContainerWithCargo( this, -1 );
577 new_showed_cargos.Insert( cgo, pxc );
578 pxc.UpdateInterval();
579 }
580 else
581 {
583 {
585 }
586 }
587 }
588 }
589
591 {
594 if ( !new_showed_cargos.Contains( cgo2 ) )
595 {
597 if( con2.IsActive() )
598 need_update_focus = true;
599 GetMainWidget().Update();
602 }
603 }
604
608
610 if (need_update_focus)
611 SetFirstActive();
612
615
617 {
619 if ( in )
620 in.UpdateConsoleToolbar();
621 }
622
623 #ifndef PLATFORM_CONSOLE
626 {
627 float width, height;
630 {
632 }
634 {
636 }
637 else
638 {
640 }
641 }
642 #endif
643 }
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.