DayZ 1.24
Loading...
Searching...
No Matches
DayZCreature Class Reference
Collaboration diagram for DayZCreature:
[legend]

Protected Member Functions

void DayZCreatureAI ()
 
void IncreaseEffectTriggerCount ()
 
void DecreaseEffectTriggerCount ()
 
void AddDamageSphere (AnimDamageParams damage_params)
 
override void EEKilled (Object killer)
 
AnimBootsType GetBootsType ()
 
AbstractWave PlaySound (SoundObject so, SoundObjectBuilder sob)
 
void OnSoundEvent (int event_id, string event_user_string)
 
void OnSoundVoiceEvent (int event_id, string event_user_string)
 
void OnStepEvent (int event_id, string event_user_string)
 
void OnDamageEvent (int event_id, string event_user_string)
 
void RegisterAnimEvents ()
 
void AttenuateSoundIfNecessary (SoundObject soundObject)
 
bool ResistContaminatedEffect ()
 
bool IsDanger ()
 
string CaptureSound ()
 
string ReleaseSound ()
 
void CinematicTakeControl (DayZPlayer player)
 
bool CinematicCanJump ()
 
override bool ModCommandHandlerBefore (float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
 

Protected Attributes

DayZPlayer m_CinematicPlayer
 

Private Member Functions

proto native AIAgent GetAIAgent ()
 
proto native bool IsSoundInsideBuilding ()
 
proto native void AddDamageSphere (string bone_name, string ammo_name, float radius, float duration, bool invertTeams)
 
proto native DayZCreatureAIType GetCreatureAIType ()
 
proto native void InitAIAgent (AIGroup group)
 
proto native void DestroyAIAgent ()
 
void ProcessSoundEvent (AnimSoundEvent sound_event)
 
void ProcessSoundVoiceEvent (AnimSoundVoiceEvent sound_event)
 
void ProcessStepEvent (AnimStepEvent step_event)
 
void ProcessDamageEvent (AnimDamageEvent damage_event)
 

Private Attributes

int m_EffectTriggerCount
 

Detailed Description

Definition at line 138 of file DayZAnimal.c.

Member Function Documentation

◆ AddDamageSphere() [1/2]

void DayZCreature::AddDamageSphere ( AnimDamageParams damage_params)
inlineprotected

Definition at line 179 of file DayZAnimal.c.

180 {
181 AddDamageSphere(damage_params.m_sBoneName, damage_params.m_sAmmoName, damage_params.m_fRadius, damage_params.m_fDuration, damage_params.m_bInvertTeams);
182 }
proto native void AddDamageSphere(string bone_name, string ammo_name, float radius, float duration, bool invertTeams)

◆ AddDamageSphere() [2/2]

proto native void DayZCreature::AddDamageSphere ( string bone_name,
string ammo_name,
float radius,
float duration,
bool invertTeams )
private

◆ AttenuateSoundIfNecessary()

void DayZCreature::AttenuateSoundIfNecessary ( SoundObject soundObject)
inlineprotected

Definition at line 311 of file DayZAnimal.c.

312 {
313 if (GetGame().GetPlayer() != NULL && (IsSoundInsideBuilding() != GetGame().GetPlayer().IsSoundInsideBuilding() || GetGame().GetPlayer().IsCameraInsideVehicle()))
314 soundObject.SetKind(WaveKind.WAVEATTALWAYS);
315 else
316 soundObject.SetKind(WaveKind.WAVEEFFECTEX);
317 }
PlayerBase GetPlayer()
WaveKind
Definition Sound.c:2
proto native bool IsSoundInsideBuilding()
proto native CGame GetGame()

References GetGame(), and GetPlayer().

◆ CaptureSound()

string DayZCreature::CaptureSound ( )
inlineprotected

Definition at line 334 of file DayZAnimal.c.

335 {
336 return "";
337 }

◆ CinematicCanJump()

bool DayZCreature::CinematicCanJump ( )
inlineprotected

Definition at line 353 of file DayZAnimal.c.

354 {
355 return true;
356 }

◆ CinematicTakeControl()

void DayZCreature::CinematicTakeControl ( DayZPlayer player)
inlineprotected

Definition at line 348 of file DayZAnimal.c.

349 {
351 }
DayZPlayer m_CinematicPlayer
Definition DayZAnimal.c:159

◆ DayZCreatureAI()

void DayZCreature::DayZCreatureAI ( )
inlineprotected

Definition at line 162 of file DayZAnimal.c.

163 {
165 SetFlags(EntityFlags.TOUCHTRIGGERS, false);
166 }
void RegisterAnimEvents()
Definition DayZAnimal.c:233
proto native void SetFlags(ShapeFlags flags)
EntityFlags
Entity flags.
Definition EnEntity.c:114

References SetFlags().

◆ DecreaseEffectTriggerCount()

void DayZCreature::DecreaseEffectTriggerCount ( )
inlineprotected

Definition at line 174 of file DayZAnimal.c.

175 {
177 }
int m_EffectTriggerCount
Definition DayZAnimal.c:157

◆ DestroyAIAgent()

proto native void DayZCreature::DestroyAIAgent ( )
private

◆ EEKilled()

override void DayZCreature::EEKilled ( Object killer)
inlineprotected

Definition at line 184 of file DayZAnimal.c.

185 {
186 super.EEKilled(killer);
187 CreateComponent(COMP_TYPE_BODY_STAGING); // TO DO: This is never called on clients in multiplayer! That's why skinning doesn't work properly in MP. DAYZ-28269
188 }
const int COMP_TYPE_BODY_STAGING
Definition Component.c:10

References COMP_TYPE_BODY_STAGING.

◆ GetAIAgent()

proto native AIAgent DayZCreature::GetAIAgent ( )
private

◆ GetBootsType()

AnimBootsType DayZCreature::GetBootsType ( )
inlineprotected

Definition at line 190 of file DayZAnimal.c.

191 {
192 return AnimBootsType.None;
193 }
AnimBootsType

◆ GetCreatureAIType()

proto native DayZCreatureAIType DayZCreature::GetCreatureAIType ( )
private

◆ IncreaseEffectTriggerCount()

void DayZCreature::IncreaseEffectTriggerCount ( )
inlineprotected

Definition at line 169 of file DayZAnimal.c.

170 {
172 }

◆ InitAIAgent()

proto native void DayZCreature::InitAIAgent ( AIGroup group)
private

AIAgent initialization. Manual ai initialization for creatures created with CreateObject(... init_ai = false...).

◆ IsDanger()

bool DayZCreature::IsDanger ( )
inlineprotected

Definition at line 329 of file DayZAnimal.c.

330 {
331 return false;
332 }

◆ IsSoundInsideBuilding()

proto native bool DayZCreature::IsSoundInsideBuilding ( )
private

◆ ModCommandHandlerBefore()

override bool DayZCreature::ModCommandHandlerBefore ( float pDt,
int pCurrentCommandID,
bool pCurrentCommandFinished )
inlineprotected

sprint

jog

walk

Definition at line 358 of file DayZAnimal.c.

359 {
361 return super.ModCommandHandlerBefore(pDt, pCurrentCommandID, pCurrentCommandFinished);
362
363 UAInterface input = m_CinematicPlayer.GetInputInterface();
364
366 GetGame().GameScript.CallFunction(this, "GetInputController", controller, 0);
367
368 if (!input || !controller)
369 return super.ModCommandHandlerBefore(pDt, pCurrentCommandID, pCurrentCommandFinished);
370
371 float movementX = input.SyncedValue_ID(UAAimRight) - input.SyncedValue_ID(UAAimLeft);
372
373 float maxTurnSpeed = 100.0;
374 movementX = Math.Clamp(movementX * maxTurnSpeed * pDt, -180, 180);
375
376 if (input.SyncedValue_ID(UALookAround) > 0)
377 movementX = 0;
378
379 bool isJump = input.SyncedValue_ID(UAGetOver) > 0;
380 bool isMove = input.SyncedValue_ID(UAMoveForward) > 0;
381
382 bool isRest = input.SyncedValue_ID(UAMoveBack) > 0;
383 bool isSleep = input.SyncedValue_ID(UAReloadMagazine) > 0;
384
385 float heading = GetOrientation()[0] + movementX;
386
387 int iAlert = 0;
388 float fAlert = 0;
389 int iSpeed = 0;
390 float fSpeed = 0;
391
392 if (isMove)
393 {
394 iAlert = 1;
395 fAlert = 0.2;
396
397 bool isSprint = input.SyncedValue_ID(UATurbo) > 0;
398 bool isJog = input.SyncedValue_ID(UAWalkRunTemp) > 0;
399 bool isWalk = !isSprint && !isJog;
400 if (isSprint)
401 {
403 iSpeed = 3;
404 }
405 else if (isJog)
406 {
408 iSpeed = 2;
409 }
410 else if (isWalk)
411 {
413 iSpeed = 1;
414 }
415 }
416
419 {
420 animalController.OverrideBehaviourSlot(true, DayZAnimalBehaviourSlot.NON_SPECIFIC_THREAT);
421 animalController.OverrideBehaviourAction(true, DayZAnimalBehaviourAction.TRAVELING_INPUT);
422
423 if (!isMove)
424 {
425 if (isRest)
426 {
427 iSpeed = 0;
428 animalController.OverrideBehaviourAction(true, DayZAnimalBehaviourAction.IDLE1_INPUT);
429 }
430
431 if (isSleep)
432 {
433 iSpeed = 0;
434 animalController.OverrideBehaviourAction(true, DayZAnimalBehaviourAction.WALKING_INPUT);
435 }
436 }
437 }
438
439 bool lowVel = GetVelocity(this).Length() < 0.5;
440 if (iSpeed > 0 && lowVel)
441 {
442 iAlert = 4;
443 fAlert = 1.0;
444
445 iSpeed = 3;
446 }
447
449 {
450 switch (iSpeed)
451 {
452 case 0:
453 fSpeed = 0;
454 break;
455 case 1:
456 fSpeed = 2;
457 break;
458 case 2:
459 fSpeed = 3;
460 break;
461 case 3:
462 fSpeed = 5;
463 break;
464 }
465 }
466
467 controller.OverrideTurnSpeed(true, Math.PI2 / pDt);
468 controller.OverrideMovementSpeed(true, fSpeed);
469 controller.OverrideHeading(true, heading * Math.DEG2RAD);
470 controller.OverrideAlertLevel(true, true, iAlert, fAlert);
471
472 if (CinematicCanJump() && isJump)
473 controller.OverrideJump(true, 101, 2.0);
474
475 return true;
476 }
vector GetOrientation()
DayZAnimalBehaviourSlot
defined in C++
DayZAnimalBehaviourAction
defined in C++
Super root of all classes in Enforce script.
Definition EnScript.c:11
bool CinematicCanJump()
Definition DayZAnimal.c:353
Definition EnMath.c:7
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static const float PI2
Definition EnMath.c:13
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'.
static const float DEG2RAD
Definition EnMath.c:17
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.

References Class::CastTo(), Math::Clamp(), Math::DEG2RAD, GetGame(), GetOrientation(), GetVelocity(), and Math::PI2.

◆ OnDamageEvent()

void DayZCreature::OnDamageEvent ( int event_id,
string event_user_string )
inlineprotected

Definition at line 226 of file DayZAnimal.c.

227 {
229 if (damage_event != NULL)
231 }
void ProcessDamageEvent(AnimDamageEvent damage_event)
Definition DayZAnimal.c:306
proto native DayZCreatureAIType GetCreatureAIType()

◆ OnSoundEvent()

void DayZCreature::OnSoundEvent ( int event_id,
string event_user_string )
inlineprotected

Definition at line 205 of file DayZAnimal.c.

206 {
208 if (sound_event != NULL)
210 }
void ProcessSoundEvent(AnimSoundEvent sound_event)
Definition DayZAnimal.c:251

◆ OnSoundVoiceEvent()

void DayZCreature::OnSoundVoiceEvent ( int event_id,
string event_user_string )
inlineprotected

Definition at line 212 of file DayZAnimal.c.

213 {
215 if (voice_event != NULL)
217 }
void ProcessSoundVoiceEvent(AnimSoundVoiceEvent sound_event)
Definition DayZAnimal.c:271

◆ OnStepEvent()

void DayZCreature::OnStepEvent ( int event_id,
string event_user_string )
inlineprotected

Definition at line 219 of file DayZAnimal.c.

220 {
222 if (step_event != NULL)
224 }
void ProcessStepEvent(AnimStepEvent step_event)
Definition DayZAnimal.c:292

◆ PlaySound()

AbstractWave DayZCreature::PlaySound ( SoundObject so,
SoundObjectBuilder sob )
inlineprotected

Definition at line 195 of file DayZAnimal.c.

196 {
197 if (so == NULL)
198 return NULL;
199
200 so.SetPosition(GetPosition());
201 AbstractWave wave = GetGame().GetSoundScene().Play3D(so, sob);
202 return wave;
203 }
class JsonUndergroundAreaTriggerData GetPosition

References GetGame(), and GetPosition.

◆ ProcessDamageEvent()

void DayZCreature::ProcessDamageEvent ( AnimDamageEvent damage_event)
inlineprivate

Definition at line 306 of file DayZAnimal.c.

307 {
308 AddDamageSphere(damage_event.m_DamageParams);
309 }

◆ ProcessSoundEvent()

void DayZCreature::ProcessSoundEvent ( AnimSoundEvent sound_event)
inlineprivate

Definition at line 251 of file DayZAnimal.c.

252 {
253 if (!GetGame().IsDedicatedServer())
254 {
255 SoundObjectBuilder objectBuilder = sound_event.GetSoundBuilder();
256 if (NULL != objectBuilder)
257 {
258 objectBuilder.AddEnvSoundVariables(GetPosition());
259 SoundObject soundObject = objectBuilder.BuildSoundObject();
261 }
262 }
263
264 if (GetGame().IsServer())
265 {
266 if (sound_event.m_NoiseParams != NULL)
267 GetGame().GetNoiseSystem().AddNoise(this, sound_event.m_NoiseParams);
268 }
269 }
void PlaySound()
class SoundObjectBuilder SoundObject(SoundParams soundParams)

References GetGame(), GetPosition, PlaySound(), and SoundObject().

◆ ProcessSoundVoiceEvent()

void DayZCreature::ProcessSoundVoiceEvent ( AnimSoundVoiceEvent sound_event)
inlineprivate

Definition at line 271 of file DayZAnimal.c.

272 {
273 if (!GetGame().IsDedicatedServer())
274 {
275 SoundObjectBuilder objectBuilder = sound_event.GetSoundBuilder();
276 if (NULL != objectBuilder)
277 {
278 objectBuilder.AddEnvSoundVariables(GetPosition());
279 SoundObject soundObject = objectBuilder.BuildSoundObject();
282 }
283 }
284
285 if (GetGame().IsServer())
286 {
287 if (sound_event.m_NoiseParams != NULL)
288 GetGame().GetNoiseSystem().AddNoise(this, sound_event.m_NoiseParams);
289 }
290 }
void AttenuateSoundIfNecessary(SoundObject soundObject)
Definition DayZAnimal.c:311

References GetGame(), GetPosition, PlaySound(), and SoundObject().

◆ ProcessStepEvent()

void DayZCreature::ProcessStepEvent ( AnimStepEvent step_event)
inlineprivate

Definition at line 292 of file DayZAnimal.c.

293 {
294 SoundObjectBuilder soundBuilder = step_event.GetSoundBuilder(GetSurfaceType().Hash());
295 if (soundBuilder == NULL)
296 return;
297
298 soundBuilder.AddEnvSoundVariables(GetPosition());
299 SoundObject soundObject = soundBuilder.BuildSoundObject();
302
303 //TODO effects
304 }

References GetPosition, PlaySound(), and SoundObject().

◆ RegisterAnimEvents()

void DayZCreature::RegisterAnimEvents ( )
inlineprotected

Definition at line 233 of file DayZAnimal.c.

234 {
235 if (!RegisterAnimationEvent("Sound", "OnSoundEvent"))
236 Print("Error registering anim. event (Sound)");
237
238 if (!RegisterAnimationEvent("SoundVoice", "OnSoundVoiceEvent"))
239 Print("Error registering anim. event (SoundVoice)");
240
241 if (!GetGame().IsDedicatedServer())
242 {
243 if (!RegisterAnimationEvent("Step", "OnStepEvent"))
244 Print("Error registering anim. event (Step)");
245 }
246
247 if (!RegisterAnimationEvent("Damage", "OnDamageEvent"))
248 Print("Error registering anim. event (Damage)");
249 }
class DayZCreatureAnimInterface RegisterAnimationEvent(string event_name, string function_name)
proto void Print(void var)
Prints content of variable to console/log.

References GetGame(), Print(), and RegisterAnimationEvent().

◆ ReleaseSound()

string DayZCreature::ReleaseSound ( )
inlineprotected

Definition at line 339 of file DayZAnimal.c.

340 {
341 return "";
342 }

◆ ResistContaminatedEffect()

bool DayZCreature::ResistContaminatedEffect ( )
inlineprotected

Definition at line 319 of file DayZAnimal.c.

320 {
321 return false;
322 }

Member Data Documentation

◆ m_CinematicPlayer

DayZPlayer DayZCreature::m_CinematicPlayer
protected

Definition at line 159 of file DayZAnimal.c.

◆ m_EffectTriggerCount

int DayZCreature::m_EffectTriggerCount
private

Definition at line 157 of file DayZAnimal.c.


The documentation for this class was generated from the following file: