Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
replaceitemwithnewlambda.c
Go to the documentation of this file.
1 
5 {
6  PlayerBase m_Player;
7  int m_IndexQB;
8 
9  void ReplaceItemWithNewLambda(EntityAI old_item, string new_item_type, PlayerBase player)
10  {
11  m_Player = player;
12  m_IndexQB = -1;
13 
14  if (m_Player)
15  m_IndexQB = m_Player.FindQuickBarEntityIndex(old_item);
16  }
17 
23  override void CopyOldPropertiesToNew(notnull EntityAI old_item, EntityAI new_item)
24  {
25  super.CopyOldPropertiesToNew(old_item, new_item);
26 
27  if (m_Player && m_IndexQB != -1)
28  {
29  m_Player.SetQuickBarEntityShortcut(new_item, m_IndexQB, true);
30  }
31  }
32 
33  override void OnSuccess(EntityAI new_item)
34  {
35  super.OnSuccess(new_item);
36 
37  if (m_Player && m_IndexQB != -1)
38  {
39  m_Player.SetQuickBarEntityShortcut(new_item, m_IndexQB, true);
40  }
41  }
42 };
43 
ReplaceItemWithNewLambda
adds automatic QuickBar handling
Definition: miscgameplayfunctions.c:1
PlayerBase
Definition: playerbaseclient.c:1
m_Player
DayZPlayer m_Player
Definition: hand_events.c:42
ReplaceItemWithNewLambdaBase
base class for transformation operations (creating one item from another)
Definition: replaceitemwithnewlambdabase.c:4
EntityAI
Definition: building.c:5