DayZ 1.24
Loading...
Searching...
No Matches
PluginPresenceNotifier.c File Reference

Go to the source code of this file.

Classes

class  PresenceNotifierNoiseEvents
 

Enumerations

enum  EPresenceNotifierNoiseEventType { LAND_LIGHT , LAND_HEAVY }
 

Functions

void PresenceNotifierNoiseEvent (float pValue, float pLength)
 
float GetTimerLength ()
 
int GetValue ()
 
void PluginPresenceNotifier ()
 
void ~PluginPresenceNotifier ()
 
void Init (PlayerBase player)
 
void EnableDebug (bool pEnabled)
 
void ShowCoefsDbg (bool pEnabled)
 
int GetNoisePresence ()
 returns actual noise presence of player
 
int GetVisualPresence ()
 returns actual visibility presence of player
 
void ProcessEvent (EPresenceNotifierNoiseEventType pEventType)
 processing of external one-time events (land, fire, etc.)
 
int ProcessVisualComponents ()
 
int ProcessNoiseComponents ()
 
float GetMovementSpeedVisualCoef ()
 Visibility.
 
float GetMovementStanceVisualCoef ()
 
int GetMovementSpeedNoiseComponent ()
 
int GetBootsNoiseComponent ()
 
int GetSurfaceNoiseComponent ()
 DEPRECATED.
 
int GetExternalNoiseEventsComponent ()
 DEPRECATED.
 

Variables

enum EPresenceNotifierNoiseEventType m_TimerLength
 
int m_Value
 
class PresenceNotifierNoiseEvents windowPosX = 0
 dbgUI settings
 
const int windowPosY = 10
 
const int mainPanelSizeX = 200
 
const int mainPanelSizeY = 1
 
const int margin = 10
 
const int NOISE_LEVEL_MIN = 0
 noise limits
 
const int NOISE_LEVEL_MAX = 5
 
const int SURFACE_NOISE_LVL0 = 0
 noise component from surfaces
 
const int SURFACE_NOISE_LVL1 = 1
 
const int SURFACE_NOISE_LVL2 = 2
 
const float SURFACE_LVL2_THRESHOLD = 1.0
 
const float SURFACE_LVL1_THRESHOLD = 0.5
 
const int LAND_NOISE_LVL1 = 2
 land noise
 
const int LAND_NOISE_LVL2 = 3
 
PlayerBase m_pPlayer
 
ref PresenceNotifierNoiseEvents m_PresenceNotifierNoiseEvents
 

Enumeration Type Documentation

◆ EPresenceNotifierNoiseEventType

Enumerator
LAND_LIGHT 
LAND_HEAVY 

Definition at line 1 of file PluginPresenceNotifier.c.

2{
5}

Function Documentation

◆ EnableDebug()

void EnableDebug ( bool pEnabled)
protected

Definition at line 120 of file PluginPresenceNotifier.c.

121 {
123 }
void ShowCoefsDbg(bool pEnabled)

References ShowCoefsDbg().

◆ GetBootsNoiseComponent()

int GetBootsNoiseComponent ( )
protected

noise component of presence based on player's shoes DEPRECATED

◆ GetExternalNoiseEventsComponent()

int GetExternalNoiseEventsComponent ( )
protected

DEPRECATED.

◆ GetMovementSpeedNoiseComponent()

int GetMovementSpeedNoiseComponent ( )
protected

Noise related noise component of presence based on player's speed DEPRECATED

◆ GetMovementSpeedVisualCoef()

float GetMovementSpeedVisualCoef ( )
protected

Visibility.

Definition at line 222 of file PluginPresenceNotifier.c.

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 }
PlayerBase m_pPlayer
static int StanceToMovementIdxTranslation(HumanMovementState pState)
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References m_pPlayer, and AITargetCallbacksPlayer::StanceToMovementIdxTranslation().

Referenced by ProcessVisualComponents(), and ShowCoefsDbg().

◆ GetMovementStanceVisualCoef()

float GetMovementStanceVisualCoef ( )
protected

Definition at line 244 of file PluginPresenceNotifier.c.

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 }

References m_pPlayer.

Referenced by ProcessVisualComponents(), and ShowCoefsDbg().

◆ GetNoisePresence()

int GetNoisePresence ( )
protected

returns actual noise presence of player

Definition at line 182 of file PluginPresenceNotifier.c.

183 {
184 return ProcessNoiseComponents();
185 }
int ProcessNoiseComponents()

References ProcessNoiseComponents().

Referenced by ShowCoefsDbg().

◆ GetSurfaceNoiseComponent()

int GetSurfaceNoiseComponent ( )
protected

DEPRECATED.

◆ GetTimerLength()

float GetTimerLength ( )
protected

Definition at line 18 of file PluginPresenceNotifier.c.

19 {
20 return m_TimerLength;
21 }
enum EPresenceNotifierNoiseEventType m_TimerLength

References m_TimerLength.

◆ GetValue()

int GetValue ( )
protected

Definition at line 23 of file PluginPresenceNotifier.c.

24 {
25 return m_Value;
26 }

References m_Value.

◆ GetVisualPresence()

int GetVisualPresence ( )
protected

returns actual visibility presence of player

Definition at line 188 of file PluginPresenceNotifier.c.

189 {
191 }
int ProcessVisualComponents()

References ProcessVisualComponents().

Referenced by ShowCoefsDbg().

◆ Init()

void Init ( PlayerBase player)
protected

Definition at line 115 of file PluginPresenceNotifier.c.

116 {
118 }

References m_pPlayer.

◆ PluginPresenceNotifier()

void PluginPresenceNotifier ( )
protected

Definition at line 106 of file PluginPresenceNotifier.c.

107 {
111 }
EPresenceNotifierNoiseEventType
const int LAND_NOISE_LVL2
const int LAND_NOISE_LVL1
land noise
ref PresenceNotifierNoiseEvents m_PresenceNotifierNoiseEvents

References LAND_NOISE_LVL1, LAND_NOISE_LVL2, and m_PresenceNotifierNoiseEvents.

Referenced by ManBase::OnSelectPlayer().

◆ PresenceNotifierNoiseEvent()

void PresenceNotifierNoiseEvent ( float pValue,
float pLength )
protected

◆ ProcessEvent()

void ProcessEvent ( EPresenceNotifierNoiseEventType pEventType)
protected

processing of external one-time events (land, fire, etc.)

Definition at line 194 of file PluginPresenceNotifier.c.

195 {
197 }

References m_PresenceNotifierNoiseEvents.

◆ ProcessNoiseComponents()

int ProcessNoiseComponents ( )
protected

Definition at line 208 of file PluginPresenceNotifier.c.

209 {
210 float noise = 0;
211 if (m_pPlayer)
212 {
215 }
216
218 }
const int NOISE_LEVEL_MAX
const int NOISE_LEVEL_MIN
noise limits
Definition EnMath.c:7
static float GetNoiseMultiplier(DayZPlayerImplement playerImplement)
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'.

References Math::Clamp(), NoiseAIEvaluate::GetNoiseMultiplier(), m_pPlayer, NOISE_LEVEL_MAX, NOISE_LEVEL_MIN, and Math::Round().

Referenced by GetNoisePresence().

◆ ProcessVisualComponents()

int ProcessVisualComponents ( )
protected

Definition at line 199 of file PluginPresenceNotifier.c.

200 {
201 float visualMean = 0;
202 if (m_pPlayer)
204
205 return visualMean;
206 }
float GetMovementSpeedVisualCoef()
Visibility.
float GetMovementStanceVisualCoef()

References GetMovementSpeedVisualCoef(), GetMovementStanceVisualCoef(), and m_pPlayer.

Referenced by GetVisualPresence().

◆ ShowCoefsDbg()

void ShowCoefsDbg ( bool pEnabled)
protected

HumanMovementState content

Definition at line 125 of file PluginPresenceNotifier.c.

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 }
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
const int mainPanelSizeX
int GetVisualPresence()
returns actual visibility presence of player
const int mainPanelSizeY
int GetNoisePresence()
returns actual noise presence of player
const int windowPosY
Definition DbgUI.c:60
static float GetNoiseMultiplierByPlayerSpeed(DayZPlayerImplement playerImplement)
static float GetNoiseMultiplierBySurface(DayZPlayerImplement playerImplement)
static float GetNoiseMultiplierByShoes(DayZPlayerImplement playerImplement)
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()

References DbgUI::Begin(), DbgUI::BeginCleanupScope(), DbgUI::End(), DbgUI::EndCleanupScope(), GetMovementSpeedVisualCoef(), GetMovementStanceVisualCoef(), NoiseAIEvaluate::GetNoiseMultiplierByPlayerSpeed(), NoiseAIEvaluate::GetNoiseMultiplierByShoes(), NoiseAIEvaluate::GetNoiseMultiplierBySurface(), GetNoisePresence(), GetVisualPresence(), m_pPlayer, mainPanelSizeX, mainPanelSizeY, DbgUI::Panel(), DbgUI::Spacer(), DbgUI::Text(), windowPosX, and windowPosY.

Referenced by EnableDebug().

◆ ~PluginPresenceNotifier()

void ~PluginPresenceNotifier ( )
protected

Definition at line 113 of file PluginPresenceNotifier.c.

113{}

Variable Documentation

◆ LAND_NOISE_LVL1

const int LAND_NOISE_LVL1 = 2
protected

land noise

Definition at line 97 of file PluginPresenceNotifier.c.

Referenced by PluginPresenceNotifier().

◆ LAND_NOISE_LVL2

const int LAND_NOISE_LVL2 = 3
protected

Definition at line 98 of file PluginPresenceNotifier.c.

Referenced by PluginPresenceNotifier().

◆ m_pPlayer

PlayerBase m_pPlayer
protected

Definition at line 102 of file PluginPresenceNotifier.c.

◆ m_PresenceNotifierNoiseEvents

ref PresenceNotifierNoiseEvents m_PresenceNotifierNoiseEvents
protected

Definition at line 104 of file PluginPresenceNotifier.c.

Referenced by PluginPresenceNotifier(), and ProcessEvent().

◆ m_TimerLength

◆ m_Value

int m_Value
protected

Definition at line 10 of file PluginPresenceNotifier.c.

◆ mainPanelSizeX

const int mainPanelSizeX = 200
protected

Definition at line 79 of file PluginPresenceNotifier.c.

Referenced by OnGUI(), and ShowCoefsDbg().

◆ mainPanelSizeY

const int mainPanelSizeY = 1
protected

Definition at line 80 of file PluginPresenceNotifier.c.

Referenced by OnGUI(), and ShowCoefsDbg().

◆ margin

const int margin = 10
protected

Definition at line 81 of file PluginPresenceNotifier.c.

Referenced by OnGUI().

◆ NOISE_LEVEL_MAX

const int NOISE_LEVEL_MAX = 5
protected

Definition at line 86 of file PluginPresenceNotifier.c.

Referenced by ProcessNoiseComponents().

◆ NOISE_LEVEL_MIN

const int NOISE_LEVEL_MIN = 0
protected

noise limits

Definition at line 85 of file PluginPresenceNotifier.c.

Referenced by ProcessNoiseComponents().

◆ SURFACE_LVL1_THRESHOLD

const float SURFACE_LVL1_THRESHOLD = 0.5
protected

Definition at line 94 of file PluginPresenceNotifier.c.

◆ SURFACE_LVL2_THRESHOLD

const float SURFACE_LVL2_THRESHOLD = 1.0
protected

Definition at line 93 of file PluginPresenceNotifier.c.

◆ SURFACE_NOISE_LVL0

const int SURFACE_NOISE_LVL0 = 0
protected

noise component from surfaces

Definition at line 89 of file PluginPresenceNotifier.c.

◆ SURFACE_NOISE_LVL1

const int SURFACE_NOISE_LVL1 = 1
protected

Definition at line 90 of file PluginPresenceNotifier.c.

◆ SURFACE_NOISE_LVL2

const int SURFACE_NOISE_LVL2 = 2
protected

Definition at line 91 of file PluginPresenceNotifier.c.

◆ windowPosX

class PresenceNotifierNoiseEvents windowPosX = 0
protected

dbgUI settings

Referenced by OnGUI(), and ShowCoefsDbg().

◆ windowPosY

const int windowPosY = 10
protected

Definition at line 78 of file PluginPresenceNotifier.c.

Referenced by OnGUI(), and ShowCoefsDbg().