DayZ 1.24
Loading...
Searching...
No Matches
PluginPresenceNotifier.c
Go to the documentation of this file.
6
8{
9 protected float m_TimerLength;
10 protected int m_Value;
11
17
19 {
20 return m_TimerLength;
21 }
22
24 {
25 return m_Value;
26 }
27}
28
72
73
75{
77 const int windowPosX = 0;
78 const int windowPosY = 10;
79 const int mainPanelSizeX = 200;
80 const int mainPanelSizeY = 1;
81 const int margin = 10;
82
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
103
105
112
114
116 {
118 }
119
121 {
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("-- Result", mainPanelSizeX, 2);
154 DbgUI.Text("Result: ");
155 visualAlertLevel = "";
156 for (int iv = 0; iv < GetVisualPresence(); iv++)
157 visualAlertLevel += "!";
158 DbgUI.Text("Visual level: " + GetVisualPresence() + " [" + visualAlertLevel + "]");
159
160
161 noiseAlertLevel = "";
162 for (int ia = 0; ia < GetNoisePresence(); ia++)
163 noiseAlertLevel += "!";
164
165 DbgUI.Text("Noise level: " + GetNoisePresence() + " [" + noiseAlertLevel + "]");
166
167 DbgUI.End();
168
170 DbgUI.Begin("HumanMovementState", windowPosX + 250, windowPosY);
171 DbgUI.Panel("MinimumSize", mainPanelSizeX, mainPanelSizeY);
172 DbgUI.Text("Command ID: " + hms.m_CommandTypeId);
173 DbgUI.Text("Stance: " + hms.m_iStanceIdx);
174 DbgUI.Text("Movement: " + hms.m_iMovement);
175 DbgUI.End();
176 }
177
179 }
180
183 {
184 return ProcessNoiseComponents();
185 }
186
189 {
191 }
192
198
200 {
201 float visualMean = 0;
202 if (m_pPlayer)
204
205 return visualMean;
206 }
207
209 {
210 float noise = 0;
211 if (m_pPlayer)
212 {
215 }
216
218 }
219
220
223 {
225 float speedCoef = 1.0;
226
227 m_pPlayer.GetMovementState(hms);
229 {
230 case DayZPlayerConstants.MOVEMENTIDX_RUN:
231 speedCoef = 0.66;
232 break;
233 case DayZPlayerConstants.MOVEMENTIDX_WALK:
234 speedCoef = 0.33;
235 break;
236 case DayZPlayerConstants.MOVEMENTIDX_IDLE:
237 speedCoef = 0;
238 break;
239 }
240
241 return speedCoef;
242 }
243
245 {
247 float stanceCoef = 1.0;
248
249 m_pPlayer.GetMovementState(hms);
250 switch (hms.m_iStanceIdx)
251 {
252 case DayZPlayerConstants.STANCEIDX_CROUCH:
253 case DayZPlayerConstants.STANCEIDX_RAISEDCROUCH:
254 stanceCoef = 0.33;
255 break;
256
257 case DayZPlayerConstants.STANCEIDX_PRONE:
258 case DayZPlayerConstants.STANCEIDX_RAISEDPRONE:
259 stanceCoef = 0.11;
260 break;
261 }
262
263 return stanceCoef;
264 }
265
267
268
271 // Not used since 1.12
272
276
279 protected int GetBootsNoiseComponent();
280
283
286}
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
const int SURFACE_NOISE_LVL1
void ProcessEvent(EPresenceNotifierNoiseEventType pEventType)
processing of external one-time events (land, fire, etc.)
const int NOISE_LEVEL_MAX
enum EPresenceNotifierNoiseEventType m_TimerLength
void PluginPresenceNotifier()
void PresenceNotifierNoiseEvent(float pValue, float pLength)
const float SURFACE_LVL1_THRESHOLD
void ShowCoefsDbg(bool pEnabled)
float GetMovementSpeedVisualCoef()
Visibility.
int GetExternalNoiseEventsComponent()
DEPRECATED.
const int mainPanelSizeX
int GetSurfaceNoiseComponent()
DEPRECATED.
int GetMovementSpeedNoiseComponent()
void ~PluginPresenceNotifier()
float GetMovementStanceVisualCoef()
int ProcessVisualComponents()
int GetVisualPresence()
returns actual visibility presence of player
const int margin
EPresenceNotifierNoiseEventType
const int mainPanelSizeY
const int SURFACE_NOISE_LVL0
noise component from surfaces
const int LAND_NOISE_LVL2
const int LAND_NOISE_LVL1
land noise
float GetTimerLength()
const int SURFACE_NOISE_LVL2
const float SURFACE_LVL2_THRESHOLD
const int NOISE_LEVEL_MIN
noise limits
int ProcessNoiseComponents()
void EnableDebug(bool pEnabled)
ref PresenceNotifierNoiseEvents m_PresenceNotifierNoiseEvents
int GetNoisePresence()
returns actual noise presence of player
const int windowPosY
int GetBootsNoiseComponent()
float GetValue()
Definition SyncedValue.c:55
static int StanceToMovementIdxTranslation(HumanMovementState pState)
Definition DbgUI.c:60
Definition EnMath.c:7
static float GetNoiseMultiplierByPlayerSpeed(DayZPlayerImplement playerImplement)
static float GetNoiseMultiplierBySurface(DayZPlayerImplement playerImplement)
static float GetNoiseMultiplierByShoes(DayZPlayerImplement playerImplement)
static float GetNoiseMultiplier(DayZPlayerImplement playerImplement)
static ref map< EPresenceNotifierNoiseEventType, ref PresenceNotifierNoiseEvent > m_PresenceNotifierNotifierEvents
void RegisterEvent(EPresenceNotifierNoiseEventType pEventType, int pValue, float pLength)
void ProcessEvent(EPresenceNotifierNoiseEventType pEventType)
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
DayZPlayer m_pPlayer
data
Definition 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
Definition EnEntity.c:805
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
Definition tools.c:8