DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
PluginPresenceNotifier.c
См. документацию.
6
8{
9 protected float m_TimerLength;
10 protected int m_Value;
11
12 void PresenceNotifierNoiseEvent(float pValue, float pLength)
13 {
14 m_Value = pValue;
15 m_TimerLength = pLength;
16 }
17
19 {
20 return m_TimerLength;
21 }
22
24 {
25 return m_Value;
26 }
27}
28
30{
31 protected int m_Value;
32
34 protected ref Timer m_CooldownTimer;
35
43
44 void RegisterEvent(EPresenceNotifierNoiseEventType pEventType, int pValue, float pLength)
45 {
47 m_PresenceNotifierNotifierEvents.Insert(pEventType, pnne);
48 }
49
51 {
53
54 if (m_CooldownTimer.IsRunning())
55 m_CooldownTimer.Stop();
56
57 m_Value = pnne.GetValue();
58 m_CooldownTimer.Run(pnne.GetTimerLength(), this, "ResetEvent", null);
59 }
60
62 {
63 return m_Value;
64 }
65
66 protected void ResetEvent()
67 {
68 m_Value = 0;
69 }
70}
71
72
74{
76 const int windowPosX = 0;
77 const int windowPosY = 10;
78
79 const int mainPanelSizeX = 200;
80 const int mainPanelSizeY = 1;
81
82 const int margin = 10;
83
85 const int NOISE_LEVEL_MIN = 0;
86 const int NOISE_LEVEL_MAX = 5;
87
89 const int SURFACE_NOISE_LVL0 = 0;
90 const int SURFACE_NOISE_LVL1 = 1;
91 const int SURFACE_NOISE_LVL2 = 2;
92
93 const float SURFACE_LVL2_THRESHOLD = 1.0;
94 const float SURFACE_LVL1_THRESHOLD = 0.5;
95
97 const int LAND_NOISE_LVL1 = 2;
98 const int LAND_NOISE_LVL2 = 3;
99
101
104
106
113
114 void Init(PlayerBase player)
115 {
116 m_pPlayer = player;
118 }
119
120 void EnableDebug(bool pEnabled)
121 {
122 ShowCoefsDbg(pEnabled);
123 }
124
125 protected void ShowCoefsDbg(bool pEnabled)
126 {
128
129 if (pEnabled && m_pPlayer)
130 {
132 m_pPlayer.GetMovementState(hms);
133
134 string visualAlertLevel;
135 string noiseAlertLevel;
136
137 DbgUI.Begin("Presence Notifier", windowPosX + 10, windowPosY);
138 DbgUI.Panel("MinimumSize", mainPanelSizeX, mainPanelSizeY);
139
140 DbgUI.Text("Visual: ");
141 DbgUI.Text("Visibility: " + m_pPlayer.GetVisibilityCoef());
143 DbgUI.Text("Stance: " + GetMovementStanceVisualCoef());
144 DbgUI.Spacer(10);
145
146 DbgUI.Panel("-- Noises", mainPanelSizeX, 2);
147 DbgUI.Text("Noises: ");
150 DbgUI.Text("Surface: " + NoiseAIEvaluate.GetNoiseMultiplierBySurface(m_pPlayer) + " [ cfg: " + m_pPlayer.GetSurfaceNoise() + "]");
151 DbgUI.Spacer(10);
152
153 DbgUI.Panel("-- Noise reductions", mainPanelSizeX, 2);
154 DbgUI.Text("Noise reductions: ");
156 DbgUI.Spacer(10);
157
158 DbgUI.Panel("-- Result", mainPanelSizeX, 2);
159 DbgUI.Text("Result: ");
160 visualAlertLevel = "";
161 for (int iv = 0; iv < GetVisualPresence(); iv++)
162 {
163 visualAlertLevel += "!";
164 }
165 DbgUI.Text("Visual level: " + GetVisualPresence() + " [" + visualAlertLevel + "]");
166
167
168 noiseAlertLevel = "";
169 for (int ia = 0; ia < GetNoisePresence(); ia++)
170 {
171 noiseAlertLevel += "!";
172 }
173
174 DbgUI.Text("Noise level: " + GetNoisePresence() + " [" + noiseAlertLevel + "]");
175
176 DbgUI.End();
177
179 DbgUI.Begin("HumanMovementState", windowPosX + 250, windowPosY);
180 DbgUI.Panel("MinimumSize", mainPanelSizeX, mainPanelSizeY);
181 DbgUI.Text("Command ID: " + hms.m_CommandTypeId);
182 DbgUI.Text("Stance: " + hms.m_iStanceIdx);
183 DbgUI.Text("Movement: " + hms.m_iMovement);
184 DbgUI.End();
185 }
186
188 }
189
192 {
193 return ProcessNoiseComponents();
194 }
195
198 {
200 }
201
204 {
205 m_PresenceNotifierNoiseEvents.ProcessEvent(pEventType);
206 }
207
209 {
210 float visualMean = 0;
211 if (m_pPlayer)
212 {
213 visualMean = (m_pPlayer.GetVisibilityCoef() + GetMovementSpeedVisualCoef() + GetMovementStanceVisualCoef()) / 3;
214 }
215
216 return visualMean;
217 }
218
220 {
221 float noise = 0;
222 float reduction = 0;
223 if (m_pPlayer)
224 {
226 noise = Math.Round(noise * NOISE_LEVEL_MAX);
227 }
228
230 }
231
232
235 {
237 float speedCoef = 1.0;
238
239 m_pPlayer.GetMovementState(hms);
241 {
242 case DayZPlayerConstants.MOVEMENTIDX_RUN:
243 speedCoef = 0.66;
244 break;
245 case DayZPlayerConstants.MOVEMENTIDX_WALK:
246 speedCoef = 0.33;
247 break;
248 case DayZPlayerConstants.MOVEMENTIDX_IDLE:
249 speedCoef = 0;
250 break;
251 }
252
253 return speedCoef;
254 }
255
257 {
259 float stanceCoef = 1.0;
260
261 m_pPlayer.GetMovementState(hms);
262 switch (hms.m_iStanceIdx)
263 {
264 case DayZPlayerConstants.STANCEIDX_CROUCH:
265 case DayZPlayerConstants.STANCEIDX_RAISEDCROUCH:
266 stanceCoef = 0.33;
267 break;
268
269 case DayZPlayerConstants.STANCEIDX_PRONE:
270 case DayZPlayerConstants.STANCEIDX_RAISEDPRONE:
271 stanceCoef = 0.11;
272 break;
273 }
274
275 return stanceCoef;
276 }
277
279
280
283 // Not used since 1.12
284
288
291 protected int GetBootsNoiseComponent();
292
295
298}
map
Определения ControlsXboxNew.c:4
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
const int SURFACE_NOISE_LVL1
Определения PluginPresenceNotifier.c:90
void ProcessEvent(EPresenceNotifierNoiseEventType pEventType)
processing of external one-time events (land, fire, etc.)
Определения PluginPresenceNotifier.c:203
const int NOISE_LEVEL_MAX
Определения PluginPresenceNotifier.c:86
enum EPresenceNotifierNoiseEventType m_TimerLength
void PluginPresenceNotifier()
Определения PluginPresenceNotifier.c:107
void PresenceNotifierNoiseEvent(float pValue, float pLength)
Определения PluginPresenceNotifier.c:12
const float SURFACE_LVL1_THRESHOLD
Определения PluginPresenceNotifier.c:94
void ShowCoefsDbg(bool pEnabled)
Определения PluginPresenceNotifier.c:125
float GetMovementSpeedVisualCoef()
Visibility.
Определения PluginPresenceNotifier.c:234
int GetExternalNoiseEventsComponent()
DEPRECATED.
const int mainPanelSizeX
Определения PluginPresenceNotifier.c:79
int GetSurfaceNoiseComponent()
DEPRECATED.
int GetMovementSpeedNoiseComponent()
float GetMovementStanceVisualCoef()
Определения PluginPresenceNotifier.c:256
int ProcessVisualComponents()
Определения PluginPresenceNotifier.c:208
int GetVisualPresence()
returns actual visibility presence of player
Определения PluginPresenceNotifier.c:197
const int margin
Определения PluginPresenceNotifier.c:82
EPresenceNotifierNoiseEventType
Определения PluginPresenceNotifier.c:2
@ LAND_LIGHT
Определения PluginPresenceNotifier.c:3
@ LAND_HEAVY
Определения PluginPresenceNotifier.c:4
const int mainPanelSizeY
Определения PluginPresenceNotifier.c:80
const int SURFACE_NOISE_LVL0
noise component from surfaces
Определения PluginPresenceNotifier.c:89
const int LAND_NOISE_LVL2
Определения PluginPresenceNotifier.c:98
const int LAND_NOISE_LVL1
land noise
Определения PluginPresenceNotifier.c:97
float GetTimerLength()
Определения PluginPresenceNotifier.c:18
Weather m_Weather
Определения PluginPresenceNotifier.c:103
const int SURFACE_NOISE_LVL2
Определения PluginPresenceNotifier.c:91
const float SURFACE_LVL2_THRESHOLD
Определения PluginPresenceNotifier.c:93
const int NOISE_LEVEL_MIN
noise limits
Определения PluginPresenceNotifier.c:85
int ProcessNoiseComponents()
Определения PluginPresenceNotifier.c:219
void EnableDebug(bool pEnabled)
Определения PluginPresenceNotifier.c:120
ref PresenceNotifierNoiseEvents m_PresenceNotifierNoiseEvents
Определения PluginPresenceNotifier.c:105
int GetNoisePresence()
returns actual noise presence of player
Определения PluginPresenceNotifier.c:191
const int windowPosY
Определения PluginPresenceNotifier.c:77
int GetBootsNoiseComponent()
float GetValue()
Определения SyncedValue.c:55
static int StanceToMovementIdxTranslation(HumanMovementState pState)
Определения AITargetCallbacksPlayer.c:89
proto native Weather GetWeather()
Returns weather controller object.
Определения DbgUI.c:60
int m_iMovement
current stance (DayZPlayerConstants.STANCEIDX_ERECT, ...), only if the command has a stance
Определения human.c:1142
int m_iStanceIdx
current command's id
Определения human.c:1141
int m_CommandTypeId
Определения human.c:1140
Определения human.c:1139
Определения EnMath.c:7
static float GetNoiseMultiplierByPlayerSpeed(DayZPlayerImplement playerImplement)
Определения SensesAIEvaluate.c:27
static float GetNoiseMultiplierBySurface(DayZPlayerImplement playerImplement)
Определения SensesAIEvaluate.c:82
static float GetNoiseMultiplierByShoes(DayZPlayerImplement playerImplement)
Определения SensesAIEvaluate.c:63
static float GetNoiseMultiplier(DayZPlayerImplement playerImplement)
Определения SensesAIEvaluate.c:5
static float GetNoiseReduction(Weather weather)
Определения SensesAIEvaluate.c:18
Определения PlayerBaseClient.c:2
void Init()
Определения PluginCharPlacement.c:34
Определения PluginBase.c:2
ref Timer m_CooldownTimer
Определения PluginPresenceNotifier.c:34
static ref map< EPresenceNotifierNoiseEventType, ref PresenceNotifierNoiseEvent > m_PresenceNotifierNotifierEvents
Определения PluginPresenceNotifier.c:33
void RegisterEvent(EPresenceNotifierNoiseEventType pEventType, int pValue, float pLength)
Определения PluginPresenceNotifier.c:44
void PresenceNotifierNoiseEvents()
Определения PluginPresenceNotifier.c:36
void ProcessEvent(EPresenceNotifierNoiseEventType pEventType)
Определения PluginPresenceNotifier.c:50
Определения DayZPlayerImplement.c:63
Определения Weather.c:165
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
DayZPlayer m_pPlayer
data
Определения dayzplayer.c:135
proto native CGame GetGame()
static proto native void Panel(string label, int width, int height, int color=0xaa555555)
static proto native void End()
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto native void Text(string label)
static proto void BeginCleanupScope()
static proto native void Spacer(int height)
static proto native void EndCleanupScope()
string m_Value
Определения EnEntity.c:806
static proto float Round(float f)
Returns mathematical round of value.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8