DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
ZombieContainer.c
См. документацию.
2{
4 protected ref ContainerWithCargo m_CargoGrid;
8
9 void ZombieContainer( LayoutHolder parent, int sort = -1 )
10 {
13
14 m_Container.SetHeader(GetHeader());
16 SetHeader(null);
17 m_Body.Insert( m_Container );
18
19 m_MainWidget = m_RootWidget.FindAnyWidget( "body" );
20
21 WidgetEventHandler.GetInstance().RegisterOnChildAdd( m_MainWidget, this, "OnChildAdd" );
22 WidgetEventHandler.GetInstance().RegisterOnChildRemove( m_MainWidget, this, "OnChildRemove" );
23
24
25 RecomputeOpenedContainers();
26 }
27
29 {
30 if( m_ZombieEntity )
31 {
32 m_ZombieEntity.GetOnItemAttached().Remove(ItemAttached);
33 m_ZombieEntity.GetOnItemDetached().Remove(ItemDetached);
34 }
35 }
36
37 void SetEntity( EntityAI zombie_entity )
38 {
39 m_ZombieEntity = zombie_entity;
40 m_ZombieEntity.GetOnItemAttached().Insert(ItemAttached);
41 m_ZombieEntity.GetOnItemDetached().Insert(ItemDetached);
43 m_Parent.Refresh();
44 }
45
46 override void UpdateRadialIcon()
47 {
48 if ( m_SlotIcon )
49 {
50 bool show_radial_icon;
51 show_radial_icon = IsHidden();
52 Widget rip = m_SlotIcon.GetRadialIconPanel();
53 Widget icon_open = m_SlotIcon.GetRadialIcon();
54 Widget icon_closed = m_SlotIcon.GetRadialIconClosed();
55 rip.Show( !m_ZombieEntity.GetInventory().IsInventoryLockedForLockType( HIDE_INV_FROM_SCRIPT ) && m_ZombieEntity.CanDisplayCargo());
56 icon_open.Show( show_radial_icon );
57 icon_closed.Show( !show_radial_icon );
58 }
59 }
60
62 {
64 return ent && QuantityConversions.HasItemQuantity( ent ) && ent.CanBeSplit();
65 }
66
68 {
69 return GetFocusedContainer().IsInherited( ContainerWithCargo );
70 }
71
73 {
74 return GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments );
75 }
76
78 {
79 return GetFocusedContainer() == m_Container;
80 }
81
83 {
85 return ent && ( ent.GetInventory().GetCargo() || ent.GetSlotsCountCorrect() > 0 );
86 }
87
89 {
90 return !GetFocusedItem();
91 }
92
94 {
96 {
97 ItemPreviewWidget item_preview = GetFocusedSlotsIcon().GetRender();
98 ToggleContainer( item_preview.GetParent() );
99 }
100 }
101
102 override void OnDropReceivedFromHeader( Widget w, int x, int y, Widget receiver )
103 {
104 ItemPreviewWidget ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( "Render" ) );
105 if( !ipw )
106 {
107 string name = w.GetName();
108 name.Replace( "PanelWidget", "Render" );
109 ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
110 }
111 if( !ipw )
112 {
113 ipw = ItemPreviewWidget.Cast( w );
114 }
115
116 if( !ipw.IsInherited( ItemPreviewWidget ) )
117 {
118 return;
119 }
120
121 EntityAI item = ipw.GetItem();
122
123 if( !item.GetInventory().CanRemoveEntity() )
124 return;
125
126 if (m_ZombieEntity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() ))
127 GetGame().GetPlayer().PredictiveTakeEntityToTargetCargo( m_ZombieEntity, item );
128 else if( m_ZombieEntity.GetInventory().CanAddEntityToInventory( item ) )
129 {
130 GetGame().GetPlayer().PredictiveTakeEntityToTargetInventory( m_ZombieEntity, FindInventoryLocationType.CARGO, item );
131 }
132 }
133
134 override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
135 {
136 ItemPreviewWidget ipw = ItemPreviewWidget.Cast(w.FindAnyWidget( "Render" ));
137 string name = receiver.GetName();
138 name.Replace("PanelWidget", "Render");
139 ItemPreviewWidget receiver_iw = ItemPreviewWidget.Cast( receiver.FindAnyWidget( name ) );
140 EntityAI receiver_item;
141 if (receiver_iw)
142 {
143 receiver_item = receiver_iw.GetItem();
144 }
145
146 if(!ipw)
147 {
148 name = w.GetName();
149 name.Replace("PanelWidget", "Render");
150 ipw = ItemPreviewWidget.Cast(w.FindAnyWidget(name));
151 }
152 if(!ipw)
153 {
154 ipw = ItemPreviewWidget.Cast(w);
155 }
156
157 if( !ipw.IsInherited(ItemPreviewWidget))
158 {
159 return;
160 }
161
162 EntityAI item = ipw.GetItem();
163 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
164
165 if(!item.GetInventory().CanRemoveEntity())
166 return;
167 }
168
169 void OnDropReceivedFromGhostArea(Widget w, int x, int y, Widget receiver)
170 {
171 ItemPreviewWidget ipw = ItemPreviewWidget.Cast( w.FindAnyWidget("Render"));
172 string name = receiver.GetName();
173 name.Replace("PanelWidget", "Render");
174 ItemPreviewWidget receiver_iw = ItemPreviewWidget.Cast( receiver.FindAnyWidget(name));
175 EntityAI receiver_item;
176 if (receiver_iw)
177 {
178 receiver_item = receiver_iw.GetItem();
179 }
180
181 if( !ipw )
182 {
183 name = w.GetName();
184 name.Replace( "PanelWidget", "Render" );
185 ipw = ItemPreviewWidget.Cast( w.FindAnyWidget(name));
186 }
187 if(!ipw)
188 {
189 ipw = ItemPreviewWidget.Cast(w);
190 }
191
192 if(!ipw.IsInherited(ItemPreviewWidget))
193 {
194 return;
195 }
196
197 EntityAI item = ipw.GetItem();
198 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
199
200 if(!item.GetInventory().CanRemoveEntity())
201 {
202 return;
203 }
204
205 if(receiver_item)
206 {
207 if(receiver_item.GetInventory().CanAddAttachment(item))
208 {
209 player.PredictiveTakeEntityToTargetAttachment(receiver_item, item);
210 return;
211 }
212 else if(receiver_item.GetInventory().CanAddEntityInCargo(item, item.GetInventory().GetFlipCargo()) && !receiver_item.GetInventory().HasEntityInCargo(item))
213 {
214 player.PredictiveTakeEntityToTargetInventory(receiver_item, FindInventoryLocationType.ANY, item);
215 return;
216 }
217 }
218
219 if(item)
220 {
221 if(m_ZombieEntity.GetInventory().CanAddAttachment(item))
222 {
223 player.PredictiveTakeEntityToTargetAttachment(m_ZombieEntity, item);
224 }
225 else if(m_ZombieEntity.GetInventory().CanAddEntityToInventory(item))
226 {
227 player.PredictiveTakeEntityToTargetInventory(m_ZombieEntity, FindInventoryLocationType.ANY, item);
228 }
229 }
230
231 if( item )
232 {
233 if( m_ZombieEntity.GetInventory().CanAddEntityInto(item, FindInventoryLocationType.CARGO ))
234 {
235 player.PredictiveTakeEntityToTargetInventory(m_ZombieEntity, FindInventoryLocationType.CARGO, item);
236 }
237 }
238 }
239
241 {
242 m_CollapsibleHeader.SetName( "#container_inventory" );
243 }
244
245 void ItemAttached(EntityAI item, string slot_name)
246 {
247 int slot = InventorySlots.GetSlotIdFromString( slot_name );
248 SlotsIcon icon = m_InventorySlots.Get( slot );
249 if( icon )
250 {
251 icon.Init( item );
252
253 if( m_ShowedItems.Contains( item ) == false )
254 {
255 string name;
256
257 if( item.GetSlotsCountCorrect() > 0 )
258 {
259 ContainerWithCargoAndAttachments iwca = new ContainerWithCargoAndAttachments( this, false );
260 iwca.SetEntity( item );
261 WidgetEventHandler.GetInstance().RegisterOnMouseButtonUp( icon.GetPanelWidget(), this, "ToggleContainer" );
262
263 icon.GetRadialIconPanel().Show( true );
264 m_ShowedItems.Insert( item, iwca );
265
266 Refresh();
267 }
268 else if( item.GetInventory().GetCargo() )
269 {
270 ContainerWithCargo iwc = new ContainerWithCargo( this, false );
271 iwc.SetEntity( item );
272 iwc.UpdateInterval();
273 WidgetEventHandler.GetInstance().RegisterOnMouseButtonUp( icon.GetPanelWidget(), this, "ToggleContainer" );
274 m_ShowedItems.Insert( item, iwc );
275 icon.GetRadialIconPanel().Show(true);
276
277 Refresh();
278 }
279 }
280
281 ClosableContainer conta = ClosableContainer.Cast( m_ShowedItems.Get( item ) );
282 string config = "CfgVehicles " + item.GetType() + " GUIInventoryAttachmentsProps";
283 if( conta && conta.IsInherited( ClosableContainer ) )
284 {
285 bool show_radial_icon = ( item.GetInventory().GetCargo() || item.GetSlotsCountCorrect() > 0 ) && !GetGame().ConfigIsExisting( config );
286 Widget rip = icon.GetRadialIconPanel();
287 Widget icon_open = icon.GetRadialIcon();
288 Widget icon_closed = icon.GetRadialIconClosed();
289 rip.Show( show_radial_icon );
290 icon_open.Show( conta.IsOpened() );
291 icon_closed.Show( !conta.IsOpened() );
292 }
293 RecomputeOpenedContainers();
294 }
295 }
296
297 void ItemDetached(EntityAI item, string slot_name)
298 {
299 int slot = InventorySlots.GetSlotIdFromString( slot_name );
300 SlotsIcon icon = m_InventorySlots.Get( slot );
301
302 if( icon )
303 {
304 Container con = m_ShowedItems.Get( item );
305 if( con )
306 {
307 ( Container.Cast( con.m_Parent ) ).Remove( con );
308 RecomputeOpenedContainers();
309 GetMainWidget().Update();
310 Refresh();
311 m_ShowedItems.Remove( item );
312 }
313
314 icon.Clear();
315 Inventory in = Inventory.Cast( GetRoot() );
316 if( in )
317 in.UpdateConsoleToolbar();
318 }
319 }
320
321 override bool CanOpenCloseContainerEx(EntityAI focusedEntity)
322 {
324 if (focusedEntity)
325 {
326 c = ClosableContainer.Cast( m_ShowedItems.Get( focusedEntity ) );
327 }
328 else
329 {
330 SlotsIcon icon = GetFocusedSlotsIcon();
331 if (icon)
332 {
333 c = ClosableContainer.Cast(icon.GetContainer());
334 }
335 }
336
337 if (c && c.IsDisplayable())
338 {
339 return true;
340 }
341
342 return false;
343 }
344
345 // mouse button UP or call from ExpandCollapseContainer
347 {
348 EntityAI item;
349 SlotsIcon icon;
351 w.GetUserData(icon);
352 if (icon)
353 item = icon.GetEntity();
354
355 if (item)
356 c = ClosableContainer.Cast(m_ShowedItems.Get(item));
357 else
358 c = ClosableContainer.Cast(icon.GetContainer());
359
360
361 if (c)
362 c.Toggle();
363
364 RecomputeOpenedContainers();
365 }
366
367 void MouseClick(Widget w, int x, int y, int button)
368 {
369 ItemBase selectedItem;
370 SlotsIcon icon;
371 w.GetUserData(icon);
372 if (icon)
373 selectedItem = ItemBase.Cast(icon.GetEntity());
374
375 if (selectedItem)
376 {
377 switch (button)
378 {
379 case MouseState.RIGHT:
380 #ifdef DIAG_DEVELOPER
381 if (GetDayZGame().IsLeftCtrlDown())
382 ShowActionMenu(selectedItem);
383 #endif
384 break;
385
386 case MouseState.MIDDLE:
387 InspectItem(selectedItem);
388 break;
389
390 case MouseState.LEFT:
391 if (g_Game.IsLeftCtrlDown())
392 {
393 PlayerBase controlledPlayer = PlayerBase.Cast(GetGame().GetPlayer());
394 if (controlledPlayer.CanDropEntity(selectedItem))
395 {
396 if (selectedItem.GetTargetQuantityMax() < selectedItem.GetQuantity())
397 selectedItem.SplitIntoStackMaxClient(null, -1);
398 else
399 controlledPlayer.PhysicalPredictiveDropItem(selectedItem);
400
402 }
403 }
404 break;
405 }
406 }
407 }
408
409 SlotsIcon GetSlotsIcon( int row, int column )
410 {
411 return SlotsContainer.Cast( m_Container.Get( row ) ).GetSlotIcon( column );
412 }
413
415 {
416 int row, column;
417 SlotsIcon icon;
418 bool has_cargo = m_ZombieEntity.GetInventory().GetCargo() != null;
419
420 string config_path_ghosts_slots = "CfgVehicles ZombieBase InventoryEquipment playerSlots";
421 array<string> player_ghosts_slots = new array<string>();
422 GetGame().ConfigGetTextArray( config_path_ghosts_slots, player_ghosts_slots );
423
424 for ( int i = 0; i < player_ghosts_slots.Count(); i++ )
425 {
426 string slot_name = player_ghosts_slots.Get ( i );
427 string path = "CfgSlots" + " " + slot_name;
428
429 if ( GetGame().ConfigIsExisting( path ) )
430 {
431 string icon_name; //icon_name must be in format "set:<setname> image:<imagename>"
432 GetGame().ConfigGetText( path + " ghostIcon", icon_name );
433 column = i % ITEMS_IN_ROW;
434
435 //START - GetWidgetSlot
436 row = i / ITEMS_IN_ROW;
437 if( row >= m_Container.Count() )
438 {
439 if ( has_cargo )
440 {
441 if( row < ( (player_ghosts_slots.Count() + 1 )/ ITEMS_IN_ROW ) )
443 else
444 AddSlotsContainer( ( player_ghosts_slots.Count() + 1 ) % ITEMS_IN_ROW );
445
446 }
447 else
448 {
449 if ( row < ( player_ghosts_slots.Count() / ITEMS_IN_ROW ) )
451 else
452 AddSlotsContainer( player_ghosts_slots.Count() % ITEMS_IN_ROW );
453 }
454
455 }
456
457 icon = GetSlotsIcon( row, column );
458
459 icon.GetMainWidget().Show( true );
460 icon.Clear();
461
463
464 //END - GetWidgetSlot
465 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetPanelWidget(), this, "OnDropReceivedFromGhostArea" );
466 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetGhostSlot(), this, "OnDropReceivedFromGhostArea" );
468 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetGhostSlot(), this, "DraggingOver" );
471
473 //END - LoadIconIntoWidgetSlot
474
475 GetGame().ConfigGetText( path + " name", slot_name );
476 int slot_id = InventorySlots.GetSlotIdFromString( slot_name );
477 icon.SetSlotID( slot_id );
479 m_InventorySlots.Set( slot_id, icon );
480
481 int slot = InventorySlots.GetSlotIdFromString( slot_name );
482 ItemBase item = ItemBase.Cast( m_ZombieEntity.GetInventory().FindAttachment( slot ) );
483
484 if( item )
485 ItemAttached( item, slot_name );
486 }
487 }
488
489 if( m_ZombieEntity.GetInventory().GetCargo() )
490 {
491 row = player_ghosts_slots.Count() / ITEMS_IN_ROW;
492 column = player_ghosts_slots.Count() % ITEMS_IN_ROW;
493 if( row >= m_Container.Count() )
494 {
495 if( row < ( player_ghosts_slots.Count() + 1 / ITEMS_IN_ROW ) )
497 else
498 AddSlotsContainer( ( player_ghosts_slots.Count() + 1 ) % ITEMS_IN_ROW );
499 }
500
501 icon = GetSlotsIcon( row, column );
502 icon.GetMainWidget().Show( true );
503 icon.Clear();
504 icon.GetGhostSlot().LoadImageFile( 0, StaticGUIUtils.VerifyIconImageString(StaticGUIUtils.IMAGESETGROUP_INVENTORY,m_ZombieEntity.ConfigGetString("GUIInventoryCargoIcon")) );
505 icon.SetSlotDisplayName( m_ZombieEntity.ConfigGetString("GUIInventoryCargoName") );
506 icon.GetRadialIconPanel().Show( true );
507 icon.GetRadialIcon().Show( true );
508
509 WidgetEventHandler.GetInstance().RegisterOnMouseButtonUp( icon.GetGhostSlot(), this, "ToggleContainer" );
510 m_CargoGrid = new ContainerWithCargo( this, false );
511 m_CargoGrid.SetEntity( m_ZombieEntity );
512 m_CargoGrid.GetHeader().GetMainWidget().ClearFlags( WidgetFlags.DRAGGABLE );
515 }
516
517 RecomputeOpenedContainers();
518 }
519
520 void AddSlotsContainer( int row_count )
521 {
523 s_cont.SetColumnCount( row_count );
524 m_Container.Insert( s_cont );
525 }
526
527 Widget GetWidgetSlot( int slot_number )
528 {
529 int row = slot_number / ITEMS_IN_ROW;
530 int column = slot_number % ITEMS_IN_ROW;
531
532 return m_Container.Get( row ).GetMainWidget().FindAnyWidget( "Render" + column );
533 }
534
535 void DoubleClick(Widget w, int x, int y, int button)
536 {
537 if( button == MouseState.LEFT && !g_Game.IsLeftCtrlDown())
538 {
539 if( w == null )
540 {
541 return;
542 }
543 ItemPreviewWidget iw = ItemPreviewWidget.Cast( w.FindAnyWidget( "Render" ) );
544 if( !iw )
545 {
546 string name = w.GetName();
547 name.Replace( "PanelWidget", "Render" );
548 iw = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
549 }
550
551 if( !iw )
552 {
553 iw = ItemPreviewWidget.Cast( w );
554 }
555
556 ItemBase item = ItemBase.Cast( iw.GetItem() );
557 if( !item )
558 {
559 return;
560 }
561
562 PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
563
564 if( player.GetInventory().HasInventoryReservation( item, null ) || player.IsItemsToDelete() )
565 {
566 return;
567 }
568
569 if( !item.GetInventory().CanRemoveEntity() )
570 return;
571
572 if ( player.GetInventory().HasEntityInInventory( item ) && GetGame().GetPlayer().GetHumanInventory().CanAddEntityInHands( item ) )
573 {
574 player.PredictiveTakeEntityToHands( item );
575 }
576 else
577 {
579 if( player.GetInventory().FindFreeLocationFor( item, FindInventoryLocationType.ANY, il) )
580 {
581 if( item.GetTargetQuantityMax(il.GetSlot()) < item.GetQuantity() )
582 item.SplitIntoStackMaxToInventoryLocationClient( il );
583 else
584 player.PredictiveTakeEntityToInventory( FindInventoryLocationType.ANY, item );
585 }
586 else if( GetGame().GetPlayer().GetHumanInventory().CanAddEntityInHands( item ) )
587 {
588 if( item.GetTargetQuantityMax() < item.GetQuantity() )
589 item.SplitIntoStackMaxHandsClient( player );
590 else
591 player.PredictiveTakeEntityToHands( item );
592 }
593 }
594
595 HideOwnedTooltip();
596 InventoryMenu menu = InventoryMenu.Cast( GetGame().GetUIManager().FindMenu( MENU_INVENTORY ) );
597 if( menu )
598 {
599 menu.RefreshQuickbar();
600 }
601 }
602 }
603
605 {
606 super.CollapseButtonOnMouseButtonDown(w);
607 }
608
609 override bool EquipItem()
610 {
611 if (CanEquip())
612 {
613 if ( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
614 {
615 return GetFocusedContainer().EquipItem();
616 }
617 else
618 {
619 EntityAI item = GetFocusedItem();
620 if( item )
621 {
622 GetGame().GetPlayer().PredictiveTakeEntityToInventory( FindInventoryLocationType.ATTACHMENT, item );
623 return true;
624 }
625 }
626 }
627 return false;
628 }
629
630 override bool TransferItem()
631 {
632 LeftArea left_area = LeftArea.Cast( GetParent() );
633 EntityAI item;
634 if (CanTakeToInventory())
635 {
636
637 if (left_area)
638 {
639 if (GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ))
640 {
641 return GetFocusedContainer().TransferItem();
642 }
643 else
644 {
645 item = GetFocusedItem();
646 if( item )
647 {
648 GetGame().GetPlayer().PredictiveTakeEntityToInventory( FindInventoryLocationType.CARGO, item );
649 return true;
650 }
651 }
652 }
653 else
654 {
655 if (!GetFocusedContainer().IsInherited( ContainerWithCargo ) && !GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ))
656 {
657 item = GetFocusedItem();
658 if (item)
659 {
660 GetGame().GetPlayer().PredictiveTakeEntityToInventory( FindInventoryLocationType.CARGO, item );
661 return true;
662 }
663 }
664 }
665 }
666 return false;
667 }
668
669 override bool Select()
670 {
671 if( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
672 {
673 return GetFocusedContainer().Select();
674 }
675 else
676 {
678 EntityAI focused_item = GetFocusedItem();
680 if( !(selected_slot && selected_slot.IsOutOfReach() ) )
681 {
682 if( selected_item )
683 {
684 if( selected_item != focused_item)
685 {
686 if( selected_item.GetInventory().CanRemoveEntity() )
687 {
688 GetGame().GetPlayer().PredictiveTakeEntityToTargetInventory( m_ZombieEntity, FindInventoryLocationType.ANY, selected_item );
689 ItemManager.GetInstance().SetSelectedItemEx(null, null, null);
690 return true;
691 }
692 }
693 }
694 else
695 {
696 if( focused_item && focused_item.GetInventory().CanRemoveEntity() )
697 {
698 EntityAI item_in_hands = GetGame().GetPlayer().GetHumanInventory().GetEntityInHands();
699 if( item_in_hands && item_in_hands.GetInventory().CanRemoveEntity() )
700 {
701 if( GameInventory.CanSwapEntitiesEx( item_in_hands, focused_item ) )
702 {
703 GetGame().GetPlayer().PredictiveSwapEntities( item_in_hands, focused_item );
704 return true;
705 }
706 else
707 {
708 InventoryLocation il_hands_dst = new InventoryLocation;
709 if( GetGame().GetPlayer().GetHumanInventory().FindFreeLocationFor( item_in_hands, FindInventoryLocationType.ANY, il_hands_dst ) )
710 {
711 InventoryMode invMode = InventoryMode.PREDICTIVE;
712
713 if ( GetGame().GetPlayer().NeedInventoryJunctureFromServer(item_in_hands, item_in_hands.GetHierarchyParent(), il_hands_dst.GetParent()) || GetGame().GetPlayer().NeedInventoryJunctureFromServer(focused_item, focused_item.GetHierarchyParent(), GetGame().GetPlayer()) )
714 invMode = InventoryMode.JUNCTURE;
715
716 GetGame().GetPlayer().GetHumanInventory().ForceSwapEntities( InventoryMode.JUNCTURE, focused_item, item_in_hands, il_hands_dst );
717 return true;
718 }
719 }
720 }
721 else
722 {
723 if( GetGame().GetPlayer().GetHumanInventory().CanAddEntityInHands( focused_item ) )
724 {
725 GetGame().GetPlayer().PredictiveTakeEntityToHands( focused_item );
726 return true;
727 }
728 }
729 }
730 }
731 }
732 }
733 return false;
734 }
735
737 {
738 if (CanDrop())
739 {
740 if ( GetFocusedContainer().IsInherited( ContainerWithCargo ) || GetFocusedContainer().IsInherited( ContainerWithCargoAndAttachments ) )
741 {
742 return GetFocusedContainer().TransferItemToVicinity();
743 }
744 else
745 {
746 Man player = GetGame().GetPlayer();
747 ItemBase item = ItemBase.Cast( GetFocusedItem() );
748 if( item && player.CanDropEntity( item ) )
749 {
750 if( item.GetTargetQuantityMax() < item.GetQuantity() )
751 item.SplitIntoStackMaxClient( null, -1 );
752 else
753 player.PhysicalPredictiveDropItem( item );
754 return true;
755 }
756 }
757 }
758 return false;
759 }
760}
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
const int ITEMS_IN_ROW
Определения Attachments.c:1
void Inventory(LayoutHolder parent)
Определения Inventory.c:74
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
map
Определения ControlsXboxNew.c:4
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
Icon x
Icon y
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
void InventoryMenu()
Определения InventoryMenu.c:20
PlayerBase GetPlayer()
Определения ModifierBase.c:51
string path
Определения OptionSelectorMultistate.c:142
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
Определения PluginRemotePlayerDebugClient.c:14
Widget m_Parent
Определения SizeToChild.c:92
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
proto native DayZPlayer GetPlayer()
override bool IsOpened()
Определения ContainerWithCargo.c:102
override bool IsDisplayable()
Определения ContainerWithCargo.c:19
void CollapsibleContainer(LayoutHolder parent, int sort=-1)
Определения CollapsibleContainer.c:6
ref CollapsibleHeader m_CollapsibleHeader
Определения CollapsibleContainer.c:3
bool IsHidden()
Определения CollapsibleContainer.c:126
override void Refresh()
Определения CollapsibleContainer.c:31
override Header GetHeader()
Определения CollapsibleContainer.c:176
override void SetHeader(Header header)
Определения CollapsibleContainer.c:181
override EntityAI GetFocusedItem()
Определения CargoContainer.c:733
void ClosableContainer(LayoutHolder parent, int sort=-1)
Определения ClosableContainer.c:6
Определения CargoContainer.c:3
Определения Building.c:6
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Определения Inventory.c:628
script counterpart to engine's class Inventory
Определения Inventory.c:79
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
InventoryLocation.
Определения InventoryLocation.c:29
static proto native owned string GetSlotDisplayName(int id)
converts slot_id to string
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
provides access to slot configuration
Определения InventorySlots.c:6
Определения InventoryItem.c:731
void SetSelectedItemEx(EntityAI selected_item, Container selected_container, LayoutHolder selected_icon)
Определения ItemManager.c:113
SlotsIcon GetSelectedIcon()
Определения ItemManager.c:100
EntityAI GetSelectedItem()
Определения ItemManager.c:85
void SetWidgetDraggable(Widget w, bool draggable)
Определения ItemManager.c:693
static ItemManager GetInstance()
Определения ItemManager.c:282
Определения ItemManager.c:2
proto native EntityAI GetItem()
Определения gameplay.c:277
Определения Container.c:2
Определения LeftArea.c:2
Определения PlayerBaseClient.c:2
static int HasItemQuantity(notnull EntityAI item)
Определения QuantityConversions.c:143
SlotsIcon GetSlotIcon(int index)
Определения SlotsContainer.c:207
Определения SlotsContainer.c:2
Container GetContainer()
Определения SlotsIcon.c:149
Widget GetPanelWidget()
Определения SlotsIcon.c:205
EntityAI GetEntity()
Определения SlotsIcon.c:365
Widget GetRadialIconClosed()
Определения SlotsIcon.c:305
void Init(EntityAI obj, bool reservation=false)
Определения SlotsIcon.c:501
void SetSlotID(int slot_ID)
Определения SlotsIcon.c:195
bool IsOutOfReach()
Определения SlotsIcon.c:729
void SetSlotDisplayName(string text)
Определения SlotsIcon.c:144
Widget GetRadialIcon()
Определения SlotsIcon.c:310
void SetContainer(Container container)
Определения SlotsIcon.c:139
void Clear()
Определения SlotsIcon.c:612
Widget GetRadialIconPanel()
Определения SlotsIcon.c:300
ImageWidget GetGhostSlot()
Определения SlotsIcon.c:235
Определения SlotsIcon.c:2
static const int IMAGESETGROUP_INVENTORY
Определения StaticGUIUtils.c:3
static string VerifyIconImageString(int imageset_group=IMAGESETGROUP_INVENTORY, string icon_name="")
Checks for improperly formated, legacy image names and corrects them to default format.
Определения StaticGUIUtils.c:7
Определения StaticGUIUtils.c:2
void RegisterOnDropReceived(Widget w, Managed eventHandler, string functionName)
Определения WidgetEventHandler.c:91
void RegisterOnDraggingOver(Widget w, Managed eventHandler, string functionName)
Определения WidgetEventHandler.c:112
void RegisterOnChildRemove(Widget w, Managed eventHandler, string functionName)
Определения WidgetEventHandler.c:167
static WidgetEventHandler GetInstance()
Определения WidgetEventHandler.c:22
void RegisterOnMouseButtonDown(Widget w, Managed eventHandler, string functionName)
Определения WidgetEventHandler.c:70
void RegisterOnMouseButtonUp(Widget w, Managed eventHandler, string functionName)
Определения WidgetEventHandler.c:77
void RegisterOnChildAdd(Widget w, Managed eventHandler, string functionName)
Определения WidgetEventHandler.c:160
void RegisterOnDoubleClick(Widget w, Managed eventHandler, string functionName)
Определения WidgetEventHandler.c:140
Определения EnWidgets.c:190
override bool TransferItem()
Определения ZombieContainer.c:630
ref map< EntityAI, ref Container > m_ShowedItems
Определения ZombieContainer.c:6
override bool TransferItemToVicinity()
Определения ZombieContainer.c:736
override void ExpandCollapseContainer()
Определения ZombieContainer.c:93
Widget GetWidgetSlot(int slot_number)
Определения ZombieContainer.c:527
override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
Определения ZombieContainer.c:134
void DoubleClick(Widget w, int x, int y, int button)
Определения ZombieContainer.c:535
ref AttachmentsGroupContainer m_Container
Определения ZombieContainer.c:3
bool IsItemWithAttachmentsActive()
Определения ZombieContainer.c:72
void ZombieContainer(LayoutHolder parent, int sort=-1)
Определения ZombieContainer.c:9
void InitGhostSlots()
Определения ZombieContainer.c:414
void OnDropReceivedFromGhostArea(Widget w, int x, int y, Widget receiver)
Определения ZombieContainer.c:169
EntityAI m_ZombieEntity
Определения ZombieContainer.c:7
void ItemAttached(EntityAI item, string slot_name)
Определения ZombieContainer.c:245
override void OnDropReceivedFromHeader(Widget w, int x, int y, Widget receiver)
Определения ZombieContainer.c:102
void MouseClick(Widget w, int x, int y, int button)
Определения ZombieContainer.c:367
void SetHeaderName()
Определения ZombieContainer.c:240
void ItemDetached(EntityAI item, string slot_name)
Определения ZombieContainer.c:297
override void CollapseButtonOnMouseButtonDown(Widget w)
Определения ZombieContainer.c:604
override bool CanOpenCloseContainerEx(EntityAI focusedEntity)
Определения ZombieContainer.c:321
void ~ZombieContainer()
Определения ZombieContainer.c:28
ref ContainerWithCargo m_CargoGrid
Определения ZombieContainer.c:4
void AddSlotsContainer(int row_count)
Определения ZombieContainer.c:520
bool IsZombieEquipmentActive()
Определения ZombieContainer.c:77
bool IsContainerWithCargoActive()
Определения ZombieContainer.c:67
SlotsIcon GetSlotsIcon(int row, int column)
Определения ZombieContainer.c:409
override bool EquipItem()
Определения ZombieContainer.c:609
override bool IsItemWithQuantityActive()
Определения ZombieContainer.c:61
void ToggleContainer(Widget w)
Определения ZombieContainer.c:346
override bool Select()
Определения ZombieContainer.c:669
override void UpdateRadialIcon()
Определения ZombieContainer.c:46
bool IsEmptyItemActive()
Определения ZombieContainer.c:88
bool IsItemWithContainerActive()
Определения ZombieContainer.c:82
ref map< int, SlotsIcon > m_InventorySlots
Определения ZombieContainer.c:5
void SetEntity(EntityAI zombie_entity)
Определения ZombieContainer.c:37
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
const int MENU_INVENTORY
Определения constants.c:180
MouseState
Определения EnSystem.c:311
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:407
WidgetFlags
Определения EnWidgets.c:58