DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
PluginDayzPlayerDebug_OtherCmds.c
См. документацию.
1// *************************************************************************************
2// ! PluginDayzPlayerDebug_OtherCmds
3// *************************************************************************************
4
6{
7 // widgets
9
10 XComboBoxWidget m_DeathTypeCB;
12 ButtonWidget m_DeathStartButton;
13
14 XComboBoxWidget m_HitTypeCB;
15 ButtonWidget m_HitStartButton;
16
17 XComboBoxWidget m_UnconTypeCB;
18 ButtonWidget m_UnconStartButton;
19 ButtonWidget m_UnconEndButton;
20
21 // command handler properties
22 bool m_CH_DeathStart = false;
23 bool m_CH_HitStart = false;
24 bool m_CH_UnconStart = false;
25 bool m_CH_UnconEnd = false;
26
27
28 //---------------------------------------------------
29 // gui stuff
30
32 {
33 m_MainWnd = pMainWnd;
35 }
36
37
42
43
45 {
46 m_DeathTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("DeathTypeCB") );
47 m_DeathDirectionEdit = EditBoxWidget.Cast( m_MainWnd.FindAnyWidget("DeathDirectionEdit") );
48 m_DeathStartButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("DeathStartButton") );
49
50 m_HitTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("HitTypeCB") );
51 m_HitStartButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("HitStartButton") );
52
53 m_UnconTypeCB = XComboBoxWidget.Cast( m_MainWnd.FindAnyWidget("UnconTypeCB") );
54 m_UnconStartButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("UnconStartButton") );
55 m_UnconEndButton = ButtonWidget.Cast( m_MainWnd.FindAnyWidget("UnconEndButton") );
56 }
57
59 {
60 }
61
62 //---------------------------------------------------
63 // window ui clicks
64
66 bool OnClick(Widget w, int x, int y, int button)
67 {
68 if( w == m_DeathStartButton )
69 {
70 Print("PluginPlayerDebug: Death Start");
71 m_CH_DeathStart = true;
72 return true;
73 }
74 else if( w == m_HitStartButton )
75 {
76 Print("PluginPlayerDebug: Uncon Start");
77 m_CH_HitStart = true;
78 return true;
79 }
80 else if( w == m_UnconStartButton )
81 {
82 Print("PluginPlayerDebug: Uncon Start");
83 m_CH_UnconStart = true;
84 return true;
85 }
86 else if( w == m_UnconEndButton )
87 {
88 Print("PluginPlayerDebug: Uncon End");
89 m_CH_UnconEnd = true;
90 return true;
91 }
92
93 return false;
94 }
95
96
97 //---------------------------------------------------
98 // Global handler to handle commands from player
99
101 {
102 if( m_CH_DeathStart )
103 {
104 Death_Start();
105 m_CH_DeathStart = false;
106 }
107 if( m_CH_HitStart )
108 {
109 Hit_Start();
110 m_CH_HitStart = false;
111 }
112 if( m_CH_UnconStart )
113 {
114 Uncon_Start();
115 m_CH_UnconStart = false;
116 }
117 if( m_CH_UnconEnd )
118 {
119 Uncon_End();
120 m_CH_UnconEnd = false;
121 }
122 }
123
124 //---------------------------------------------------
125 // Commands start functions
126
128 {
129 DayZPlayer player = DayZPlayer.Cast( GetGame().GetPlayer() );
130 if( !player )
131 return;
132
133 int deathType = m_DeathTypeCB.GetCurrentItem();
134 if( deathType > 0 )
135 deathType += 9;
136
137 float deathDirection = m_DeathDirectionEdit.GetText().ToInt();
138
139
140 player.StartCommand_Death(deathType, deathDirection, HumanCommandDeathCallback);
141 }
142
144 {
145 DayZPlayer player = DayZPlayer.Cast( GetGame().GetPlayer() );
146 if( !player )
147 return;
148
149 float hitDirection = m_DeathDirectionEdit.GetText().ToInt();
150 int hitType = m_HitTypeCB.GetCurrentItem();
151 if( hitType == 0 )
152 {
153 player.AddCommandModifier_Damage(0, hitDirection);
154 }
155 else
156 {
157 player.StartCommand_Damage(0, hitDirection);
158 }
159 }
160
162 {
164 if( !player )
165 return;
166
167 int type = m_UnconTypeCB.GetCurrentItem();
168
169 player.m_UnconsciousDebug = true;
170 player.StartCommand_Unconscious(type);
171 }
172
174 {
176 if( !player )
177 return;
178
179 player.m_UnconsciousDebug = false;
180 HumanCommandUnconscious hcu = player.GetCommand_Unconscious();
181 if( hcu )
182 hcu.WakeUp();
183 }
184}
Icon x
Icon y
PlayerBase GetPlayer()
Определения ModifierBase.c:51
Определения ManBase.c:2
Определения EnWidgets.c:354
proto native void WakeUp(int targetStance=-1)
Определения human.c:620
void PluginDayzPlayerDebug_OtherCmds(Widget pMainWnd)
bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Определения EnWidgets.c:190
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.