DayZ 1.30
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;
117 m_Weather = g_Game.GetWeather();
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: ");
155 NoiseSystem noiseSys = g_Game.GetNoiseSystem();
156 float weatherReduction = 0;
157 if (noiseSys)
158 weatherReduction = noiseSys.GetEnvironmentNoiseReduction(m_pPlayer.GetPosition());
159 DbgUI.Text("Weather reduction: " + weatherReduction);
160 DbgUI.Spacer(10);
161
162 DbgUI.Panel("-- Result", mainPanelSizeX, 2);
163 DbgUI.Text("Result: ");
164 visualAlertLevel = "";
165 for (int iv = 0; iv < GetVisualPresence(); iv++)
166 {
167 visualAlertLevel += "!";
168 }
169 DbgUI.Text("Visual level: " + GetVisualPresence() + " [" + visualAlertLevel + "]");
170
171
172 noiseAlertLevel = "";
173 for (int ia = 0; ia < GetNoisePresence(); ia++)
174 {
175 noiseAlertLevel += "!";
176 }
177
178 DbgUI.Text("Noise level: " + GetNoisePresence() + " [" + noiseAlertLevel + "]");
179
180 DbgUI.End();
181
183 DbgUI.Begin("HumanMovementState", windowPosX + 250, windowPosY);
184 DbgUI.Panel("MinimumSize", mainPanelSizeX, mainPanelSizeY);
185 DbgUI.Text("Command ID: " + hms.m_CommandTypeId);
186 DbgUI.Text("Stance: " + hms.m_iStanceIdx);
187 DbgUI.Text("Movement: " + hms.m_iMovement);
188 DbgUI.End();
189 }
190
192 }
193
196 {
197 return ProcessNoiseComponents();
198 }
199
202 {
204 }
205
208 {
209 m_PresenceNotifierNoiseEvents.ProcessEvent(pEventType);
210 }
211
213 {
214 float visualMean = 0;
215 if (m_pPlayer)
216 {
217 visualMean = (m_pPlayer.GetVisibilityCoef() + GetMovementSpeedVisualCoef() + GetMovementStanceVisualCoef()) / 3;
218 }
219
220 return visualMean;
221 }
222
224 {
225 float noise = 0;
226 float reduction = 0;
227 if (m_pPlayer)
228 {
229 // weather dampening is applied engine-side now, so this HUD shows only the player noise multiplier
231 noise = Math.Round(noise * NOISE_LEVEL_MAX);
232 }
233
235 }
236
237
240 {
242 float speedCoef = 1.0;
243
244 m_pPlayer.GetMovementState(hms);
246 {
247 case DayZPlayerConstants.MOVEMENTIDX_RUN:
248 speedCoef = 0.66;
249 break;
250 case DayZPlayerConstants.MOVEMENTIDX_WALK:
251 speedCoef = 0.33;
252 break;
253 case DayZPlayerConstants.MOVEMENTIDX_IDLE:
254 speedCoef = 0;
255 break;
256 }
257
258 return speedCoef;
259 }
260
262 {
264 float stanceCoef = 1.0;
265
266 m_pPlayer.GetMovementState(hms);
267 switch (hms.m_iStanceIdx)
268 {
269 case DayZPlayerConstants.STANCEIDX_CROUCH:
270 case DayZPlayerConstants.STANCEIDX_RAISEDCROUCH:
271 stanceCoef = 0.33;
272 break;
273
274 case DayZPlayerConstants.STANCEIDX_PRONE:
275 case DayZPlayerConstants.STANCEIDX_RAISEDPRONE:
276 stanceCoef = 0.11;
277 break;
278 }
279
280 return stanceCoef;
281 }
282
284
285
288 // Not used since 1.12
289
293
296 protected int GetBootsNoiseComponent();
297
300
303}
DayZGame g_Game
Определения DayZGame.c:4074
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:207
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:239
int GetExternalNoiseEventsComponent()
DEPRECATED.
const int mainPanelSizeX
Определения PluginPresenceNotifier.c:79
int GetSurfaceNoiseComponent()
DEPRECATED.
int GetMovementSpeedNoiseComponent()
float GetMovementStanceVisualCoef()
Определения PluginPresenceNotifier.c:261
int ProcessVisualComponents()
Определения PluginPresenceNotifier.c:212
int GetVisualPresence()
returns actual visibility presence of player
Определения PluginPresenceNotifier.c:201
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:223
void EnableDebug(bool pEnabled)
Определения PluginPresenceNotifier.c:120
ref PresenceNotifierNoiseEvents m_PresenceNotifierNoiseEvents
Определения PluginPresenceNotifier.c:105
int GetNoisePresence()
returns actual noise presence of player
Определения PluginPresenceNotifier.c:195
const int windowPosY
Определения PluginPresenceNotifier.c:77
int GetBootsNoiseComponent()
float GetValue()
Определения SyncedValue.c:55
static int StanceToMovementIdxTranslation(HumanMovementState pState)
Определения AITargetCallbacksPlayer.c:88
Определения DbgUI.c:60
int m_iMovement
current stance (DayZPlayerConstants.STANCEIDX_ERECT, ...), only if the command has a stance
Определения human.c:1184
int m_iStanceIdx
current command's id
Определения human.c:1183
int m_CommandTypeId
Определения human.c:1182
Определения human.c:1181
Определения EnMath.c:7
static float GetNoiseMultiplierByPlayerSpeed(DayZPlayerImplement playerImplement)
Определения SensesAIEvaluate.c:29
static float GetNoiseMultiplierBySurface(DayZPlayerImplement playerImplement)
Определения SensesAIEvaluate.c:84
static float GetNoiseMultiplierByShoes(DayZPlayerImplement playerImplement)
Определения SensesAIEvaluate.c:65
static float GetNoiseMultiplier(DayZPlayerImplement playerImplement)
Определения SensesAIEvaluate.c:5
proto native float GetEnvironmentNoiseReduction(vector pos)
Absolute noise-strength reduction the environment (weather/sandstorm/sea) applies at 'pos'....
Определения Noise.c:2
Определения PlayerBaseClient.c:2
void Init()
Определения PluginCharPlacement.c:34
Plugin interface for controlling of agent pool system.
Определения 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:39
Определения Weather.c:168
Определения Transport.c:70
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
DayZPlayer m_pPlayer
data
Определения dayzplayer.c:135
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:808
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
Определения 3_Game/DayZ/tools/tools.c:8