3 const float TARGET_CONE_ANGLE_CHASE = 20;
4 const float TARGET_CONE_ANGLE_FIGHT = 30;
5 const float ORIENTATION_SYNC_THRESHOLD = 30;
7 const float SHOCK_TO_STUN_MULTIPLIER = 2.82;
10 protected int m_StanceVariation = 0;
11 protected int m_LastMindState = -1;
12 protected float m_LastMovementSpeed = -1;
14 protected bool m_KnuckleLand =
false;
15 protected float m_KnuckleOutTimer = 0;
17 protected int m_MindState = -1;
18 protected int m_OrientationLocal = -1;
19 protected int m_OrientationSynced = -1;
21 protected float m_MovementSpeed = -1;
36 protected bool m_FinisherInProgress =
false;
53 RegisterNetSyncVariableInt(
"m_MindState", -1, 4);
54 RegisterNetSyncVariableInt(
"m_OrientationSynced", 0, 359);
55 RegisterNetSyncVariableFloat(
"m_MovementSpeed", -1, 3);
56 RegisterNetSyncVariableBool(
"m_IsCrawling");
62 if (!
GetGame().IsDedicatedServer())
64 m_LastSoundVoiceAW =
null;
73 m_OrientationTimer = 0;
81 DebugSound(
"[Infected @ " +
this +
"][OnVariablesSynchronized]");
84 if (m_OrientationLocal != m_OrientationSynced)
85 m_OrientationLocal = m_OrientationSynced;
160 return m_DefaultHitPosition;
182 return m_OrientationSynced;
274 m_MovementSpeed =
ic.GetMovementSpeed();
275 if (
Math.
AbsFloat(m_LastMovementSpeed - m_MovementSpeed) >= 0.9 && m_LastMovementSpeed != m_MovementSpeed)
278 m_LastMovementSpeed = m_MovementSpeed;
288 m_OrientationTimer +=
pDt;
301 if (m_OrientationTimer >= 2.0 || m_OrientationSynced == -1 ||
Math.
AbsInt(
angleDiffRad) > ORIENTATION_SYNC_THRESHOLD)
303 m_OrientationTimer = 0.0;
308 m_OrientationSynced =
yaw;
319 float m_DamageHitDirection = 0;
324 if (!IsAlive() || m_FinisherInProgress)
327 m_MovementSpeed = -1;
372 int m_ActiveVaultType = -1;
393 m_KnuckleOutTimer = 0;
394 m_KnuckleLand =
true;
398 m_KnuckleOutTimer +=
pDt;
399 if (m_KnuckleOutTimer > 2.0)
410 m_KnuckleLand =
false;
428 if (m_LastMindState != m_MindState)
448 m_LastMindState = m_MindState;
449 m_AttackCooldownTime = 0.0;
463 if (!m_InfectedSoundEventHandler)
470 m_InfectedSoundEventHandler.Stop();
489 m_InfectedSoundEventHandler.Stop();
493 DebugSound(
"[Infected @ " +
this +
"][MindState]" +
typename.EnumToString(
DayZInfectedConstants, m_MindState));
494 DebugSound(
"[Infected @ " +
this +
"][SoundEventID]" +
typename.EnumToString(
EInfectedSoundEventID, m_InfectedSoundEventHandler.GetCurrentStateEventID()));
502 if (!
GetGame().IsDedicatedServer())
528 if (m_InfectedSoundEventHandler)
530 m_InfectedSoundEventHandler.Stop();
531 DebugSound(
"[Infected @ " +
this +
"][SoundEvent] InfectedSoundEventHandler - stop all");
535 if (m_LastSoundVoiceAW !=
null)
537 DebugSound(
"[Infected @ " +
this +
"][AnimVoiceEvent] Stopping LastAW");
538 m_LastSoundVoiceAW.
Stop();
542 ProcessSoundVoiceEvent(
voice_event, m_LastSoundVoiceAW);
550 if (!
GetGame().IsDedicatedServer())
575 float m_AttackCooldownTime = 0;
594 if (m_ActualTarget !=
null)
616 hitPosWS = m_ActualTarget.ModelToWorld(m_ActualTarget.GetDefaultHitPosition());
617 DamageSystem.CloseCombatDamageName(
this, m_ActualTarget, m_ActualTarget.GetHitComponentForAI(),
"MeleeZombie",
hitPosWS);
622 hitPosWS = m_ActualTarget.ModelToWorld(m_ActualTarget.GetDefaultHitPosition());
623 DamageSystem.CloseCombatDamageName(
this, m_ActualTarget, m_ActualTarget.GetHitComponentForAI(),
"Dummy_Light",
hitPosWS);
628 hitPosWS = m_ActualTarget.ModelToWorld(m_ActualTarget.GetDefaultHitPosition());
648 if (
pb &&
pb.GetCommand_Vehicle())
651 if (m_ActualTarget ==
NULL)
659 int pitch = GetAttackPitch(m_ActualTarget);
662 if (m_ActualAttackType)
666 if (m_ActualTarget !=
target)
672 StartCommand_Attack(m_ActualTarget, m_ActualAttackType.
m_Type, m_ActualAttackType.
m_Subtype);
673 m_AttackCooldownTime = m_ActualAttackType.
m_Cooldown;
687 if (
pb &&
pb.GetCommand_Vehicle())
690 if (m_AttackCooldownTime > 0)
696 if (m_ActualTarget ==
null)
701 int pitch = GetAttackPitch(m_ActualTarget);
707 if (m_ActualAttackType)
717 StartCommand_Attack(m_ActualTarget, m_ActualAttackType.
m_Type, m_ActualAttackType.
m_Subtype);
718 m_AttackCooldownTime = m_ActualAttackType.
m_Cooldown;
756 int m_CrawlTransition = -1;
760 if (m_CrawlTransition != -1)
764 m_CrawlTransition = -1;
805 bool m_DamageHitToProcess =
false;
807 bool m_DamageHitHeavy =
false;
808 int m_DamageHitType = 0;
809 float m_ShockDamage = 0;
811 const float HIT_INTERVAL_MIN = 0.3;
812 float m_HitElapsedTime = HIT_INTERVAL_MIN;
819 if (m_HitElapsedTime < HIT_INTERVAL_MIN)
821 m_HitElapsedTime += m_DeltaTime;
822 m_DamageHitToProcess =
false;
828 if (m_DamageHitToProcess)
831 float stunChange = SHOCK_TO_STUN_MULTIPLIER * m_ShockDamage;
835 StartCommand_Hit(m_DamageHitHeavy, m_DamageHitType, m_DamageHitDirection);
836 m_HitElapsedTime = 0;
839 m_DamageHitToProcess =
false;
932 m_TransportHitRegistered =
false;
940 EvaluateDeathAnimationEx(
source,
data, m_DeathType, m_DamageHitDirection);
951 if (EvaluateDamageHitAnimation(
source,
dmgZone,
ammo, m_DamageHitHeavy, m_DamageHitType, m_DamageHitDirection))
955 m_DamageHitToProcess =
true;
1005 return m_FinisherInProgress;
1011 GetAIAgent().SetKeepInIdle(
true);
1029 m_FinisherInProgress =
true;
1037 return m_IsCrawling;
1044 GetAIAgent().SetKeepInIdle(
false);
1047 m_FinisherInProgress =
false;
RepairCarChassisActionReciveData m_DamageZone
ref ArrowManagerBase m_ArrowManager
bool ModCommandHandlerInside(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
proto native int GetBoneIndexByName(string pBoneName)
returns bone index for a name (-1 if pBoneName doesn't exist)
bool ModCommandHandlerBefore(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
bool ModCommandHandlerAfter(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
DayZInfectedAttackGroupType
ref array< Object > m_AllTargetObjects
All potential targets found during most recent TargetSelection.
ref array< typename > m_TargetableObjects
Typenames of all directly/preferred targetable objects (1st Pass + 2nd Pass)
void DayZPlayerUtils()
cannot be instantiated
void InfectedSoundEventHandler(ZombieBase pInfected)
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
PluginManager GetPluginManager()
Returns registred plugin by class type, better is to use global funtion GetPlugin(typename plugin_typ...
class SoundObjectBuilder SoundObject(SoundParams soundParams)
void SoundObjectBuilder(SoundParams soundParams)
class JsonUndergroundAreaTriggerData GetPosition
class ZombieBase extends DayZInfected m_Component
an extendable data container
static ref TStringArray ARRAY_STRING
void CommandHandler(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
override void OnSoundVoiceEvent(int event_id, string event_user_string)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
ref ArrowManagerBase m_ArrowManager
bool FightLogic(int pCurrentCommandID, DayZInfectedInputController pInputController, float pDt)
ref InfectedSoundEventHandler m_InfectedSoundEventHandler
void CommandHandlerDebug(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
override bool IsManagingArrows()
bool HandleVault(int pCurrentCommandID, DayZInfectedInputController pInputController, float pDt)
override array< string > GetSuitableFinisherHitComponents()
returns suitable hit components for finisher attacks; DEPRECATED
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
void ProcessSoundVoiceEvent(AnimSoundVoiceEvent sound_event, out AbstractWave aw)
int GetOrientationSynced()
returns rounded zombie yaw for sync purposes
bool IsCrawling()
returns true if crawling; 'DayZInfectedCommandCrawl' is only for the transition, after that it remain...
override void EOnInit(IEntity other, int extra)
override void AddArrow(Object arrow, int componentIndex, vector closeBonePosWS, vector closeBoneRotWS)
void OnRecoverFromDeath()
override void EEHitByRemote(int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos)
ref array< Object > m_AllTargetObjects
AbstractWave ProcessVoiceFX(string pSoundSetName)
void HandleOrientation(float pDt, int pCurrentCommandID)
override bool CanBeSkinned()
bool HandleDamageHit(int pCurrentCommandID)
bool EvaluateCrawlTransitionAnimation(EntityAI pSource, string pComponent, string pAmmoType, out int pAnimType)
vector SetDefaultHitPosition(string pSelection)
AbstractWave m_LastSoundVoiceAW
override AnimBootsType GetBootsType()
bool FightAttackLogic(int pCurrentCommandID, DayZInfectedInputController pInputController, float pDt)
bool HandleCrawlTransition(int pCurrentCommandID)
void HandleMove(int pCurrentCommandID)
void DebugSound(string s)
sound debug messages
vector m_DefaultHitPosition
override bool IsHealthVisible()
bool EvaluateDeathAnimationEx(EntityAI pSource, ZombieHitData data, out int pAnimType, out float pAnimHitDir)
override bool IsRefresherSignalingViable()
bool EvaluateDamageHitAnimation(EntityAI pSource, string pComponent, string pAmmoType, out bool pHeavyHit, out int pAnimType, out float pAnimHitDir)
selects animation type and direction based on damage system data
override string GetDefaultHitComponent()
returns default hit component (fallback)
override bool IsBeingBackstabbed()
returns true if backstab is in progress; used for suspending of AI targeting and other useful things ...
void EOnContact(IEntity other, Contact extra)
override vector GetCenter()
bool HandleDeath(int pCurrentCommandID)
ref array< typename > m_TargetableObjects
override void OnVariablesSynchronized()
synced variable(s) handler
override string GetHitComponentForAI()
returns hit component for attacking AI
int GetAttackPitch(EntityAI target)
float ComputeHitDirectionAngleEx(EntityAI pSource, int invertHitDir=0)
override void SetBeingBackstabbed(int backstabType)
override bool IsZombieMilitary()
override bool CanBeBackstabbed()
int GetVaultType(float height)
override vector GetDefaultHitPosition()
bool EvaluateDeathAnimation(EntityAI pSource, string pComponent, string pAmmoType, out int pAnimType, out float pAnimHitDir)
bool HandleMindStateChange(int pCurrentCommandID, DayZInfectedInputController pInputController, float pDt)
float ComputeHitDirectionAngle(EntityAI pSource)
override ArrowManagerBase GetArrowManager()
bool ChaseAttackLogic(int pCurrentCommandID, DayZInfectedInputController pInputController, float pDt)
override int GetMeleeTargetType()
Base native class for all motorized wheeled vehicles.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
string GetDefaultHitPositionComponent()
proto native CGame GetGame()
const float AI_MAX_BLOCKABLE_ANGLE
const float AI_ATTACKSPEED
EntityEvent
Entity events for event-mask, or throwing event from code.
static proto float AngleFromPosition(vector origin, vector originDir, vector target)
Angle that a target is from the direction of an origin.
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.
static proto void MatrixInvMultiply4(vector mat0[4], vector mat1[4], out vector res[4])
Invert-transforms matrix.
static proto void MatrixOrthogonalize4(vector mat[4])
Orthogonalizes matrix.
static proto float NormalizeAngle(float ang)
Normalizes the angle (0...360)
static proto float Acos(float c)
Returns angle in radians from cosinus.
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto int AbsInt(int i)
Returns absolute value.
static proto float Round(float f)
Returns mathematical round of value.
static proto float Atan2(float y, float x)
Returns angle in radians from tangent.
static proto float Sin(float angle)
Returns sinus of angle in radians.
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
static const float RAD2DEG
static const float DEG2RAD
static proto float AbsFloat(float f)
Returns absolute value.
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
proto void dBodyApplyImpulse(notnull IEntity body, vector impulse)
Applies impuls on a rigidbody (origin)
proto native HumanCommandMove GetCommand_Move()
proto native HumanCommandMove StartCommand_Move()
--— MOVE --—
proto native HumanCommandDeathCallback StartCommand_Death(int pType, float pDirection, typename pCallbackClass, bool pKeepInLocalSpaceAfterLeave=false)
--— Death --—
enum HumanMoveCommandID GetTransformWS(out vector pTm[4])
gets human transform in World Space
proto native HumanInputController GetInputController()
returns human input controller