Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
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
base class for transformation operations (creating one item from another)
adds automatic QuickBar handling
DayZPlayer m_Player
Definition hand_events.c:42