DayZ 1.24
Loading...
Searching...
No Matches
CargoContainer.c
Go to the documentation of this file.
1//cargo grid wrapper
2class CargoContainer extends Container
3{
4 protected const int ROWS_NUMBER_XBOX = 5;
5
6 protected CargoBase m_Cargo;
7 protected int m_CargoIndex = -1;
8
9 protected int m_FocusedItemPosition = -1;
14
15 protected float m_IconSize;
16 protected float m_SpaceSize;
17
18 protected bool m_IsAttachment;
20 protected TextWidget m_AlternateFalseHeaderTextWidget; //to be set and updated along with the main one
24#ifndef PLATFORM_CONSOLE
26#endif
29
30 void CargoContainer(LayoutHolder parent, bool is_attachment = false)
31 {
32 m_IsAttachment = is_attachment;
34 m_Icons = new array<ref Icon>;
35 m_ShowedItemPositions = new map<EntityAI, ref Param3<ref Icon, int, int>>;
36 m_ShowedLockPositions = new map<EntityAI, ref Param3<ref Icon, int, int>>;
37
38 m_CargoContainer = m_RootWidget.FindAnyWidget("grid_background");
39 m_ItemsContainer = m_RootWidget.FindAnyWidget("grid_overlay");
40 m_CargoHeader = m_RootWidget.FindAnyWidget("grid_container_header_spacer");
41#ifndef PLATFORM_CONSOLE
42 m_RootWidget.GetScript(m_Resizer1);
43#endif
44 m_RootWidget.FindAnyWidget("grid_container").GetScript(m_Resizer2);
45 m_CargoHeader.Show(is_attachment);
46 m_FalseHeaderTextWidget = TextWidget.Cast(m_CargoHeader.FindAnyWidget("TextWidget0"));
47
48 m_MainWidget = m_CargoContainer;
49 m_FocusedItemPosition = -1;
50 }
51
53 {
54 if (m_Entity)
55 {
56 m_Entity.GetOnItemAddedIntoCargo().Remove(AddedToCargo);
57 m_Entity.GetOnItemRemovedFromCargo().Remove(RemovedFromCargo);
58 m_Entity.GetOnItemMovedInCargo().Remove(MovedInCargo);
59 m_Entity.GetOnSetLock().Remove(SetLock);
60 m_Entity.GetOnReleaseLock().Remove(ReleaseLock);
61 }
62 }
63
64 int GetCargoIndex() { return m_CargoIndex; }
65
67 {
69 item.GetInventory().GetCurrentInventoryLocation(il);
70 int x = il.GetCol();
71 int y = il.GetRow();
72
73 if (m_ShowedItemPositions.Contains(item))
74 {
75 Param3<ref Icon, int, int> item_pos = m_ShowedItemPositions.Get(item);
76 InitIconEx(item_pos.param1, item, x, y, refresh);
77 item_pos.param2 = x;
78 item_pos.param3 = y;
79 }
80 else
81 {
82 ref Icon icon = new Icon(this, false);
83 m_Icons.Insert(icon);
85 m_ShowedItemPositions.Insert(item, new Param3<ref Icon, int, int>(icon, x, y));
86 }
87
88 if (refresh)
90
91#ifdef PLATFORM_CONSOLE
92 for (int i = 0; i < m_Cargo.GetItemCount(); i++)
93 {
94 EntityAI item2 = m_Cargo.GetItem(i);
95 Param3<ref Icon, int, int> data = m_ShowedItemPositions.Get(item2);
96 if (data)
97 {
98 data.param1.SetCargoPos(i);
99 data.param1.SetPos();
100 }
101 }
102
103 m_FocusedItemPosition = Math.Min(m_ShowedItemPositions.Count() - 1, m_FocusedItemPosition);
104
105 if (refresh)
106 Refresh();
107#endif
108 }
109
114
116 {
117 Param3<ref Icon, int, int> data = m_ShowedItemPositions.Get(item);
118 if (data)
119 {
120 m_Icons.RemoveItem(data.param1);
121 m_ShowedItemPositions.Remove(item);
122 }
123
125
126#ifdef PLATFORM_CONSOLE
127 for (int i = 0; i < m_Cargo.GetItemCount(); i++)
128 {
129 EntityAI item2 = m_Cargo.GetItem(i);
130 data = m_ShowedItemPositions.Get(item2);
131 if (data && data.param1)
132 {
133 data.param1.SetCargoPos(i);
134 data.param1.SetPos();
135 }
136 }
137
138 m_FocusedItemPosition = Math.Min(m_ShowedItemPositions.Count() - 1, m_FocusedItemPosition);
139
140 Refresh();
141#endif
142 }
143
145 {
147 item.GetInventory().GetCurrentInventoryLocation(il);
148
149 int x = il.GetCol();
150#ifdef PLATFORM_CONSOLE
151 int y = il.GetRow() - 1;
152#else
153 int y = il.GetRow();
154#endif
155 if (m_ShowedItemPositions.Contains(item))
156 {
157 ref Param3<ref Icon, int, int> data = m_ShowedItemPositions.Get(item);
158 if (data.param1)
159 {
160 if (data.param2 != x || data.param3 != y)
161 {
162 data.param2 = x;
163 data.param3 = y;
164#ifdef PLATFORM_CONSOLE
165 data.param1.SetCargoPos(data.param3);
166#endif
167#ifdef PLATFORM_WINDOWS
168 data.param1.SetPosX(data.param2);
169 data.param1.SetPosY(data.param3);
170#endif
171 }
172 data.param1.UpdateInterval();
173 }
174 }
176 }
177
179 {
180#ifndef PLATFORM_CONSOLE
181 if (GetGame().GetPlayer())
182 {
184 int index = GetGame().GetPlayer().GetHumanInventory().FindUserReservedLocationIndex(item);
185 if (index >= 0)
186 {
187 GetGame().GetPlayer().GetHumanInventory().GetUserReservedLocation(index, il);
188
189 ref Icon icon = new Icon(this, false);
190 m_Icons.Insert(icon);
191 icon.InitLock(m_Entity, item, il.GetCol(), il.GetRow(), il.GetFlip());
192 m_ShowedLockPositions.Insert(item, new Param3<ref Icon, int, int>(icon, 1, 1));
193 item.GetOnReleaseLock().Insert(ReleaseLock);
194 }
195 }
196#endif
197 }
198
200 {
201#ifndef PLATFORM_CONSOLE
202 if (m_ShowedLockPositions.Contains(item))
203 {
204 Icon ic = m_ShowedLockPositions.Get(item).param1;
205 m_Icons.RemoveItem(ic);
206 m_ShowedLockPositions.Remove(item);
207 item.GetOnReleaseLock().Remove(ReleaseLock);
208 }
209#endif
210 }
211
212 override void SetLayoutName()
213 {
214#ifdef PLATFORM_CONSOLE
216#else
217 switch (InventoryMenu.GetWidthType())
218 {
219 case ScreenWidthType.NARROW:
220 {
222 break;
223 }
224 case ScreenWidthType.MEDIUM:
225 {
227 break;
228 }
229 case ScreenWidthType.WIDE:
230 {
232 break;
233 }
234 }
235#endif
236
237 }
238
239 void SetEntity(EntityAI item, int cargo_index = 0, bool immedUpdate = true)
240 {
241 if (item)
242 {
243 m_Entity = item;
244 m_Cargo = item.GetInventory().GetCargoFromIndex(cargo_index);
245 m_CargoIndex = cargo_index;
246
247 m_Entity.GetOnItemAddedIntoCargo().Insert(AddedToCargo);
248 m_Entity.GetOnItemRemovedFromCargo().Insert(RemovedFromCargo);
249 m_Entity.GetOnItemMovedInCargo().Insert(MovedInCargo);
250 m_Entity.GetOnSetLock().Insert(SetLock);
251 m_Entity.GetOnReleaseLock().Insert(ReleaseLock);
252
253 if (immedUpdate)
255
257 m_MainWidget = m_ItemsContainer;
258
259 if (m_Cargo)
260 {
261 int i;
262 int prev_count = m_ShowedItemPositions.Count();
263
264 //START - Add new item Icons
265 for (i = 0; i < m_Cargo.GetItemCount(); i++)
266 {
267 EntityAI cargo_item = m_Cargo.GetItem(i);
268 if (cargo_item)
270 }
271
272#ifdef PLATFORM_CONSOLE
273 if (immedUpdate)
274 Refresh();
275#endif
276 }
277 }
278 }
279
281 {
282 return m_Entity;
283 }
284
286 {
288 string name = m_Entity.GetDisplayName();
289 name.ToUpper();
290
291 if (m_Entity.CanDisplayCargo() && m_Entity.GetInventory().GetCargoFromIndex(m_CargoIndex))
292 {
293 name = name + " (" + GetCargoCapacity().ToString() + "/" + GetMaxCargoCapacity() + ")";
294 if (m_IsAttachment && m_CargoHeader)
295 {
296 m_FalseHeaderTextWidget.SetText(name);
297 float x, y;
298 m_FalseHeaderTextWidget.Update();
299 m_FalseHeaderTextWidget.GetScreenSize(x, y);
300 m_CargoHeader.FindAnyWidget("grid_container_header").SetSize(1, y + InventoryMenu.GetHeightMultiplied(10));
301 m_CargoHeader.Update();
302
303 if (m_AlternateFalseHeaderTextWidget)
304 m_AlternateFalseHeaderTextWidget.SetText(name);
305 return;
306 }
307 }
308
309 if (Container.Cast(GetParent()) && Container.Cast(GetParent()).GetHeader())
310 Container.Cast(GetParent()).GetHeader().SetName(name);
311 }
312
314 {
315 m_Rows.Clear();
316 m_ShowedItemPositions.Clear();
317
319
320#ifdef PLATFORM_CONSOLE
321 int cargo_height = 1;
322#else
323 int cargo_height = m_Entity.GetInventory().GetCargoFromIndex(m_CargoIndex).GetHeight();
324#endif
325
326 for (int j = 0; j < cargo_height; j++)
327 {
328 row = new CargoContainerRow(this);
329
330 row.SetNumber(j);
331 row.SetEntity(m_Entity);
332
333#ifdef PLATFORM_WINDOWS
334#ifndef PLATFORM_CONSOLE
335 row.SetWidth(m_Entity.GetInventory().GetCargoFromIndex(m_CargoIndex).GetWidth(), false);
336#endif
337#endif
338
339 row.GetRootWidget().SetSort(j, false);
340 m_Rows.Insert(row);
341 }
342
343 float y;
344 row.GetRootWidget().FindAnyWidget("Icon0").GetScreenSize(y, m_IconSize);
345#ifdef PLATFORM_WINDOWS
346#ifndef PLATFORM_CONSOLE
347 row.GetRootWidget().FindAnyWidget("Spacer0").GetScreenSize(m_SpaceSize, y);
348#endif
349#endif
350
351 m_Resizer2.ResizeParentToChild();
352#ifndef PLATFORM_CONSOLE
353 m_Resizer1.ResizeParentToChild();
354#endif
355 }
356
358 {
359#ifndef PLATFORM_CONSOLE
360 m_Resizer1.ResizeParentToChild();
361#else
362 m_Resizer2.ResizeParentToChild();
363#endif
364 }
365
367 {
368 return m_IconSize;
369 }
370
372 {
373 return m_SpaceSize;
374 }
375
377 {
378#ifdef PLATFORM_CONSOLE
379#ifndef PLATFORM_WINDOWS
380 return CargoList.Cast(m_Cargo).GetTotalWeight(null);
381#endif
382#endif
383 int total_size = 0;
384 for (int i = 0; i < m_Cargo.GetItemCount(); ++i)
385 {
386 int x, y;
387 m_Cargo.GetItemSize(i, x, y);
388 total_size += x * y;
389 }
390 return total_size;
391 }
392
394 {
395#ifdef PLATFORM_CONSOLE
396#ifndef PLATFORM_WINDOWS
397 return CargoList.Cast(m_Cargo).GetMaxWeight();
398#endif
399#endif
400 return m_Cargo.GetWidth() * m_Cargo.GetHeight();
401 }
402
404 {
405 if (item && m_ShowedItemPositions.Contains(item))
406 {
407 Param3<ref Icon, int, int> data = m_ShowedItemPositions.Get(item);
408 return data.param1;
409 }
410 return null;
411 }
412
414 {
415 if (m_Cargo == null)
416 return null;
417
418 if (index >= 0 && m_Cargo.GetItemCount() > index)
419 return GetIcon(m_Cargo.GetItem(index));
420 return null;
421 }
422
424 {
425 return GetIcon(m_FocusedItemPosition);
426 }
427
428 override float GetFocusedContainerHeight(bool contents = false)
429 {
430 float x, y;
431 if (contents && GetFocusedIcon())
432 GetFocusedIcon().GetRootWidget().GetScreenSize(x, y);
433 else
434 GetRootWidget().GetScreenSize(x, y);
435 return y;
436 }
437
438 override float GetFocusedContainerYPos(bool contents = false)
439 {
440 float x, y;
441 if (contents && GetFocusedIcon())
442 GetFocusedIcon().GetRootWidget().GetPos(x, y);
443 else
444 GetRootWidget().GetPos(x, y);
445 return y;
446 }
447
448 override float GetFocusedContainerYScreenPos(bool contents = false)
449 {
450 float x, y;
451 if (contents && GetFocusedIcon())
452 GetFocusedIcon().GetRootWidget().GetScreenPos(x, y);
453 else
454 GetRootWidget().GetScreenPos(x, y);
455 return y;
456 }
457
459 {
460 if (m_IsActive)
461 {
462 if (m_FocusedItemPosition >= m_Icons.Count())
463 m_FocusedItemPosition = m_Icons.Count() - 1;
464 Icon icon = GetIcon(m_FocusedItemPosition);
465 if (icon && !icon.IsActive())
466 {
467 icon.SetActive(true);
468 Inventory.GetInstance().UpdateConsoleToolbar();
469 }
470 }
471 }
472
474 {
475 int i;
476 int rows = Math.Max(1, Math.Ceil((count + 1) / ROWS_NUMBER_XBOX));
477 int diff = rows - m_Rows.Count();
478
479 if (diff < 0)
480 {
481 for (i = m_Rows.Count() - 1; i >= rows; i--)
482 m_Rows.Remove(i);
483 }
484 else if (diff > 0)
485 {
486 m_MainWidget = m_CargoContainer;
487 for (i = m_Rows.Count(); i < rows; i++)
488 {
490
491 row.SetNumber(i);
492 row.SetEntity(m_Entity);
493 row.GetRootWidget().SetSort(i);
494 m_Rows.Insert(row);
495 }
496 m_MainWidget = m_ItemsContainer;
497 }
498
499 m_Resizer2.ResizeParentToChild();
500#ifndef PLATFORM_CONSOLE
501 m_Resizer1.ResizeParentToChild();
502#endif
503 }
504
505 override void Refresh()
506 {
507#ifdef PLATFORM_CONSOLE
508 if (!m_ResizeTimer)
509 m_ResizeTimer = new Timer();
510 if (m_ResizeTimer.IsRunning())
511 m_ResizeTimer.Stop();
512 m_ResizeTimer.Run(0.05, this, "RefreshImpl");
513#endif
514 }
515
517 {
518 UpdateRowVisibility(m_ShowedItemPositions.Count());
520 }
521
522 override void UpdateInterval()
523 {
525 {
526 if (data.param1)
527 data.param1.UpdateInterval();
528 }
529 }
530
532 {
533#ifdef PLATFORM_CONSOLE
534 icon.SetSize(1, 1);
535#ifdef PLATFORM_WINDOWS
536 pos_y = pos_y * 5 + pos_x;
537#endif
538 icon.SetCargoPos(pos_y);
539 icon.SetPosY(pos_y);
540 icon.SetPosEx(refresh);
541#else
542 int size_x, size_y;
543 GetGame().GetInventoryItemSize(InventoryItem.Cast(item), size_x, size_y);
544
545 if (item.GetInventory().GetFlipCargo())
546 icon.SetSize(size_y, size_x);
547 else
548 icon.SetSize(size_x, size_y);
549
550 icon.SetPosX(pos_x);
551 icon.SetPosY(pos_y);
552 icon.SetPosEx(refresh);
553#endif
554 icon.InitEx(item, refresh);
555 return icon;
556 }
557
559 {
560 return InitIconEx(icon, item, pos_x, pos_y);
561 }
562
564 {
565 return m_ShowedItemPositions.Contains(item);
566 }
567
569 {
570 if (CanDrop())
571 {
572 Man player = GetGame().GetPlayer();
573 if (GetFocusedIcon())
574 {
576 if (item && player.CanDropEntity(item))
577 {
578 if (item.GetTargetQuantityMax() < item.GetQuantity())
579 item.SplitIntoStackMaxClient(null, -1);
580 else
581 player.PhysicalPredictiveDropItem(item);
582 return true;
583 }
584 }
585 }
586 return false;
587 }
588
589 override void SetDefaultFocus(bool while_micromanagment_mode = false)
590 {
591 super.SetDefaultFocus(while_micromanagment_mode);
592
593 Unfocus();
594 m_FocusedItemPosition = 0;
596 }
597
598 override void SetLastFocus()
599 {
601 }
602
603 override void Unfocus()
604 {
606 if (icon)
607 icon.SetActive(false);
608 }
609
610 override void UnfocusAll()
611 {
612 if (m_Icons)
613 {
614 foreach (Icon icon : m_Icons)
615 icon.SetActive(false);
616 }
617 m_FocusedItemPosition = 0;
618 }
619
620 override void SetNextActive()
621 {
622 Unfocus();
623 int focused_row = m_FocusedItemPosition / ROWS_NUMBER_XBOX;
624 int max_row = (m_Icons.Count() - 1) / ROWS_NUMBER_XBOX;
625
626 if (max_row > focused_row)
627 {
628 m_FocusedItemPosition += ROWS_NUMBER_XBOX;
629 if (m_FocusedItemPosition >= m_Icons.Count())
630 m_FocusedItemPosition = m_Icons.Count() - 1;
632 }
633 else
634 SetActive(false);
635 }
636
637 override void SetPreviousActive(bool force = false)
638 {
639 Unfocus();
640 int focused_row = m_FocusedItemPosition / ROWS_NUMBER_XBOX;
641
642 if (focused_row > 0)
643 {
644 m_FocusedItemPosition = m_FocusedItemPosition - ROWS_NUMBER_XBOX;
646 }
647 else
648 SetActive(false);
649 }
650
651
652 override void SetNextRightActive()
653 {
654 if (m_Icons.Count() > 0)
655 {
656 Unfocus();
657 int focused_row = m_FocusedItemPosition / ROWS_NUMBER_XBOX;
659 int row_max = row_min + ROWS_NUMBER_XBOX - 1;
660
661 if (row_max >= m_Icons.Count())
662 row_max = m_Icons.Count() - 1;
663
664 m_FocusedItemPosition++;
665 if (m_FocusedItemPosition > row_max)
666 m_FocusedItemPosition = row_min;
667
669 }
670 }
671
672 override void SetNextLeftActive()
673 {
674 if (m_Icons.Count() > 0)
675 {
676 Unfocus();
677 int focused_row = m_FocusedItemPosition / ROWS_NUMBER_XBOX;
679 int row_max = row_min + ROWS_NUMBER_XBOX - 1;
680
681 if (row_max >= m_Icons.Count())
682 row_max = m_Icons.Count() - 1;
683
684 m_FocusedItemPosition--;
685 if (m_FocusedItemPosition < row_min)
686 m_FocusedItemPosition = row_max;
687
689 }
690 }
691
693 {
695 if (icon)
696 return EntityAI.Cast(icon.GetObject());
697
698 return null;
699 }
700
701 override void SetLastActive()
702 {
703 super.SetLastActive();
704 if (GetFocusedIcon())
705 GetFocusedIcon().SetActive(false);
706 m_FocusedItemPosition = ((m_Rows.Count() - 1) * ROWS_NUMBER_XBOX);
708 }
709
710 override void SetActive(bool active)
711 {
712 super.SetActive(active);
714 }
715
716 override bool IsItemActive()
717 {
718 if (GetFocusedIcon())
719 {
721 return (item != null);
722 }
723 return false;
724 }
725
727 {
728 if (GetFocusedIcon())
729 {
731 return (!IsEmpty() && QuantityConversions.HasItemQuantity(item) && item.CanBeSplit());
732 }
733 return false;
734 }
735
736 override bool IsEmpty()
737 {
738 return m_Icons.Count() == 0;
739 }
740
742 {
743 PluginRecipesManager recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
744 return recipes_manager.GetValidRecipes(entity1, entity2, null, player);
745 }
746
747 override bool CanCombineAmmo()
748 {
749 if (GetFocusedIcon())
750 {
752
754 ItemBase item_in_hands = ItemBase.Cast(GetGame().GetPlayer().GetHumanInventory().GetEntityInHands());
755
756 return (amc.CanPerformActionFromInventory(item_in_hands, entity) || amc.CanSetActionFromInventory(item_in_hands, entity));
757 }
758 return false;
759 }
760
761 override bool TransferItem()
762 {
763 if (CanTakeToInventory())
764 {
765 if (GetFocusedIcon())
766 {
768 if (entity)
769 {
770 GetGame().GetPlayer().PredictiveTakeEntityToInventory(FindInventoryLocationType.CARGO, entity);
771 return true;
772 }
773 }
774 }
775 return false;
776 }
777
778 override bool SplitItem()
779 {
780 if (CanSplit())
781 {
782 if (GetFocusedIcon())
783 {
785 if (entity)
786 {
787 if (entity.HasQuantity() && entity.CanBeSplit())
788 {
789 entity.OnRightClick();
790 Icon icon = m_ShowedItemPositions.Get(entity).param1;
791
792 if (icon)
793 icon.SetQuantity();
794 }
795 }
796 }
797 }
798 return false;
799 }
800
801 override bool EquipItem()
802 {
803 if (CanEquip())
804 {
805 if (GetFocusedIcon())
806 {
808 if (entity)
809 {
810 GetGame().GetPlayer().PredictiveTakeEntityToInventory(FindInventoryLocationType.ATTACHMENT, entity);
811 return true;
812 }
813 }
814 }
815 return false;
816 }
817
818 override bool SelectItem()
819 {
821 if (focused_item)
822 {
823 ItemBase item = ItemBase.Cast(focused_item.GetObject());
824 if (item && item.IsTakeable() && item.CanPutIntoHands(null))
825 {
826 ItemManager.GetInstance().SetSelectedItemEx(item, this, focused_item);
827 return true;
828 }
829 }
830 return false;
831 }
832
833 override bool Select()
834 {
836 EntityAI selected_item = ItemManager.GetInstance().GetSelectedItem();
837 DayZPlayer player = GetGame().GetPlayer();
838
839
841 {
842 if (selected_item)
843 {
844 if (selected_item.GetInventory().CanRemoveEntity() && m_Entity)
845 {
846 bool can_add = m_Entity.GetInventory().CanAddEntityInCargo(selected_item, selected_item.GetInventory().GetFlipCargo());
847 bool in_cargo = !player.GetInventory().HasEntityInInventory(selected_item) || !m_Entity.GetInventory().HasEntityInCargo(selected_item);
848 if (can_add && in_cargo)
849 {
850 player.PredictiveTakeEntityToTargetCargo(m_Entity, selected_item);
851 Container selected_cont2 = ItemManager.GetInstance().GetSelectedContainer();
852 if (selected_cont2)
853 selected_cont2.SetActive(false);
854
855 SetActive(true);
856 m_FocusedItemPosition = 0;
857 return true;
858 }
859 else
860 {
861 Container selected_cont = ItemManager.GetInstance().GetSelectedContainer();
862 if (selected_cont)
863 selected_cont.SetActive(false);
864
865 SetActive(true);
866 SetDefaultFocus(true);
867 }
868 }
869 }
870 else if (focused_item && focused_item.GetInventory().CanRemoveEntity())
871 {
872 EntityAI item_in_hands = GetGame().GetPlayer().GetHumanInventory().GetEntityInHands();
873 if (item_in_hands)
874 {
876 {
877 player.PredictiveSwapEntities(item_in_hands, focused_item);
878 return true;
879 }
880 }
881 else
882 {
883 if (player.GetHumanInventory().CanAddEntityInHands(focused_item))
884 {
885 player.PredictiveTakeEntityToHands(focused_item);
886 return true;
887 }
888 }
889 }
890 }
891 return false;
892 }
893
894 override bool Combine()
895 {
896 if (CanCombine())
897 {
898 if (GetFocusedIcon())
899 {
901 if (icon)
902 {
903 EntityAI item_in_hands = GetGame().GetPlayer().GetHumanInventory().GetEntityInHands();
904 EntityAI prev_item = EntityAI.Cast(icon.GetObject());
906 return icon.CombineItems(item_in_hands, prev_item);
907 }
908 }
909 }
910 return false;
911 }
912
913 void ShowFalseCargoHeader(bool show)
914 {
915 m_CargoHeader.Show(show);
916 }
917
919 {
921 m_AlternateFalseHeaderTextWidget = w;
922 if (update)
924 }
925}
void Inventory(LayoutHolder parent)
Definition Inventory.c:76
EntityAI m_Entity
Definition ActionDebug.c:11
Object GetObject()
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
void GetActionManager()
Icon x
Icon y
FindInventoryLocationType
flags for searching locations in inventory
ScreenWidthType
void InventoryMenu()
void SetLock(bool state)
bool m_IsActive
PlayerBase GetPlayer()
string GetIcon()
PluginBase GetPlugin(typename plugin_type)
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
void SetActive()
Definition TrapBase.c:409
represents base for cargo storage for entities
Definition Cargo.c:7
proto native int GetWidth()
proto native int GetHeight()
proto bool GetItemSize(int index, out int w, out int h)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
Widget m_ItemsContainer
override void SetLastFocus()
ref SizeToChild m_Resizer2
void ~CargoContainer()
Widget m_CargoHeader
float GetIconSize()
override void SetActive(bool active)
Icon GetFocusedIcon()
float GetSpaceSize()
override bool Combine()
void MovedInCargo(EntityAI item)
TextWidget m_FalseHeaderTextWidget
override void SetNextActive()
void UpdateSize()
override void SetLayoutName()
override void Unfocus()
void SetLock(EntityAI item)
override EntityAI GetFocusedItem()
int GetCargoIndex()
void ShowFalseCargoHeader(bool show)
override bool Select()
ref Timer m_ResizeTimer
ref array< ref Icon > m_Icons
override float GetFocusedContainerYPos(bool contents=false)
int GetMaxCargoCapacity()
void UpdateSelection()
ref SizeToChild m_Resizer1
override void UnfocusAll()
Widget m_CargoContainer
override bool EquipItem()
override float GetFocusedContainerHeight(bool contents=false)
override bool IsItemActive()
const int ROWS_NUMBER_XBOX
int GetCargoCapacity()
void SetEntity(EntityAI item, int cargo_index=0, bool immedUpdate=true)
void AddedToCargoEx(EntityAI item, bool refresh=true)
override bool SelectItem()
override bool TransferItemToVicinity()
override bool TransferItem()
Icon InitIcon(Icon icon, EntityAI item, int pos_x, int pos_y)
bool HasItem(EntityAI item)
EntityAI GetEntity()
override void SetPreviousActive(bool force=false)
override Header GetHeader()
override bool SplitItem()
override float GetFocusedContainerYScreenPos(bool contents=false)
void RemovedFromCargo(EntityAI item)
void AddedToCargo(EntityAI item)
override void SetDefaultFocus(bool while_micromanagment_mode=false)
void UpdateRowVisibility(int count)
float m_SpaceSize
float m_IconSize
override bool IsItemWithQuantityActive()
void SetAlternateFalseTextHeaderWidget(TextWidget w)
override void SetNextLeftActive()
ref map< EntityAI, ref Param3< ref Icon, int, int > > m_ShowedItemPositions
ref map< EntityAI, ref Param3< ref Icon, int, int > > m_ShowedLockPositions
CargoBase m_Cargo
override bool CanCombineAmmo()
bool m_IsAttachment
override void SetLastActive()
Icon GetIcon(EntityAI item)
Icon GetIcon(int index)
override bool IsEmpty()
void ReleaseLock(EntityAI item)
void RefreshImpl()
override void Refresh()
TextWidget m_AlternateFalseHeaderTextWidget
override void SetNextRightActive()
void CargoContainer(LayoutHolder parent, bool is_attachment=false)
void UpdateHeaderText()
int GetRecipeCount(bool recipe_anywhere, ItemBase entity1, ItemBase entity2, PlayerBase player)
Icon InitIconEx(Icon icon, EntityAI item, int pos_x, int pos_y, bool refresh=true)
void InitGridHeight()
ref array< ref CargoContainerRow > m_Rows
override void UpdateInterval()
script counterpart to engine's class Inventory
Definition Inventory.c:79
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition Inventory.c:610
Definition Icon.c:2
override void SetActive(bool active)
Definition Icon.c:103
InventoryLocation.
static ItemManager GetInstance()
Definition EnMath.c:7
static int HasItemQuantity(notnull EntityAI item)
const string CargoContainerXbox
const string CargoContainerWide
const string CargoContainerNarrow
const string CargoContainerMedium
proto native CGame GetGame()
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Ceil(float f)
Returns ceil of value.
proto native Widget GetParent()
Get parent of the Effect.
Definition Effect.c:389