54 RegisterNetSyncVariableInt(
"m_MindState", -1, 4);
55 RegisterNetSyncVariableInt(
"m_OrientationSynced", 0, 359);
56 RegisterNetSyncVariableFloat(
"m_MovementSpeed", -1, 3);
57 RegisterNetSyncVariableBool(
"m_IsCrawling");
63 if ( !
GetGame().IsDedicatedServer() )
82 DebugSound(
"[Infected @ " +
this +
"][OnVariablesSynchronized]");
157 return GetDayZInfectedType().GetHitComponentForAI();
163 return GetDayZInfectedType().GetDefaultHitComponent();
173 return GetSelectionPositionMS(pSelection);
179 return GetDayZInfectedType().GetSuitableFinisherHitComponents();
198 void CommandHandler(
float pDt,
int pCurrentCommandID,
bool pCurrentCommandFinished)
214 else if (!pCurrentCommandFinished)
225 if (pCurrentCommandFinished)
253 if ( inputController )
255 if (
HandleVault(pCurrentCommandID, inputController, pDt) )
265 if (
FightLogic(pCurrentCommandID, inputController, pDt) )
287 PluginDayZInfectedDebug infectedDebug = PluginDayZInfectedDebug.Cast(
GetPluginManager().GetPluginByType(PluginDayZInfectedDebug));
289 infectedDebug.CommandHandler(
this);
325 float angleDiffRad =
Math.
Atan2(
Math.
Sin(angleTargetRad - angleSourceRad),
Math.
Cos(angleSourceRad - angleTargetRad));
376 pAnimType = doPhxImpulse;
384 vector impulse = 80 * m_TransportHitVelocity;
385 impulse[1] = 80 * 1.5;
405 else if ( height <= 1.1 )
407 else if ( height <= 1.6 )
417 DayZInfectedCommandVault vaultCmd = GetCommand_Vault();
418 if ( vaultCmd && vaultCmd.WasLand() )
427 StartCommand_Vault(-1);
433 if ( pInputController.
IsVault() )
438 StartCommand_Vault(vaultType);
460 if ( moveCommand && !moveCommand.IsTurning() )
461 moveCommand.SetIdleState(0);
465 if ( moveCommand && !moveCommand.IsTurning() )
466 moveCommand.SetIdleState(1);
471 moveCommand.SetIdleState(2);
531 if (!
GetGame().IsDedicatedServer())
534 if ( !soundParams.IsValid() )
541 soundObject = soundObjectBuilder.BuildSoundObject();
542 AttenuateSoundIfNecessary(soundObject);
544 return PlaySound(soundObject, soundObjectBuilder);
553 AnimSoundVoiceEvent voice_event = GetCreatureAIType().GetSoundVoiceEvent(event_id);
554 if (voice_event != null)
560 DebugSound(
"[Infected @ " +
this +
"][SoundEvent] InfectedSoundEventHandler - stop all");
566 DebugSound(
"[Infected @ " +
this +
"][AnimVoiceEvent] Stopping LastAW");
579 if (!
GetGame().IsDedicatedServer())
582 if (NULL != objectBuilder)
585 SoundObject soundObject = objectBuilder.BuildSoundObject();
586 AttenuateSoundIfNecessary(soundObject);
587 aw =
PlaySound(soundObject, objectBuilder);
593 if (sound_event.m_NoiseParams != NULL)
624 DayZInfectedCommandAttack attackCommand = GetCommand_Attack();
625 if (attackCommand && attackCommand.WasHit())
632 bool playerInBlockStance =
false;
634 vector hitPosWS = targetPos;
640 playerInBlockStance = playerTarget.GetMeleeFightLogic() && playerTarget.GetMeleeFightLogic().IsInBlock();
683 if ( pb && pb.GetCommand_Vehicle() )
692 if ( !CanAttackToPosition(targetPos) )
724 if (pb && pb.GetCommand_Vehicle())
740 if (!CanAttackToPosition(targetPos))
766 attackRefPos = target.GetDefaultHitPosition();
770 attackRefPos = target.ModelToWorld(attackRefPos);
774 attackRefPos = target.GetPosition();
786 if ( headPosY > attackRefPos[1] )
817 if ( pComponent ==
"LeftLeg" && GetHealth(pComponent,
"Health") == 0 )
819 else if ( pComponent ==
"RightLeg" && GetHealth(pComponent,
"Health") == 0 )
822 if ( pAnimType != -1 )
824 vector targetDirection = GetDirection();
827 targetDirection[1] = 0;
828 toSourceDirection[1] = 0;
833 float cosFi =
vector.
Dot(targetDirection, toSourceDirection);
838 return pAnimType != -1;
882 m_HeavyHitOverride =
false;
892 int invertHitDir = 0;
895 pHeavyHit = ((
GetGame().
ConfigGetInt(
"cfgAmmo " + pAmmoType +
" hitAnimation") > 0) || m_HeavyHitOverride);
903 if ( pComponent ==
"Torso" )
905 else if ( pComponent ==
"Head" )
919 vector targetDirection = GetDirection();
922 targetDirection[1] = 0;
923 toSourceDirection[1] = 0;
928 float cosFi =
vector.
Dot(targetDirection, toSourceDirection);
929 vector cross = targetDirection * toSourceDirection;
933 dirAngle = -dirAngle;
940 vector targetDirection = GetDirection();
943 targetDirection[1] = 0;
944 toSourceDirection[1] = 0;
949 float cosFi =
vector.
Dot(targetDirection, toSourceDirection);
950 vector cross = targetDirection * toSourceDirection;
955 if ( invertHitDir > 0 )
959 dirAngle = -dirAngle;
971 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
973 m_TransportHitRegistered =
false;
977 ZombieHitData data =
new ZombieHitData;
979 data.m_DamageZone = dmgZone;
980 data.m_AmmoType = ammo;
985 int crawlTransitionType = -1;
1004 super.EEHitByRemote(damageType, source,
component, dmgZone, ammo, modelPos);
1028 RegisterTransportHit(transport);
1039 return super.CanReceiveAttachment(attachment, slotId);
1056 GetAIAgent().SetKeepInIdle(
true);
1059 switch (backstabType)
1062 m_DeathType = DayZInfectedDeathAnims.ANIM_DEATH_BACKSTAB;
1066 m_DeathType = DayZInfectedDeathAnims.ANIM_DEATH_NECKSTAB;
1070 m_DeathType = DayZInfectedDeathAnims.ANIM_DEATH_DEFAULT;
1087 GetAIAgent().SetKeepInIdle(
false);
1106 vector parentTransMat[4];
1111 GetTransformWS(parentTransMat);
1118 parentTransMat[0] = rotMatrix[0];
1119 parentTransMat[1] = rotMatrix[1];
1120 parentTransMat[2] = rotMatrix[2];
1121 parentTransMat[3] = closeBonePosWS;
1124 arrow.GetTransform(arrowTransMat);
1128 arrow.SetTransform(arrowTransMat);
RepairTentActionReciveData m_DamageZone
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
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 ZombieBase extends DayZInfected m_Component
an extendable data container
proto native NoiseSystem GetNoiseSystem()
proto native int ConfigGetInt(string path)
Get int value from config on path.
static ref TStringArray ARRAY_STRING
void CommandHandler(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
int m_StanceVariation
server / singleplayer properties
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)
bool m_FinisherInProgress
ref ArrowManagerBase m_ArrowManager
bool FightLogic(int pCurrentCommandID, DayZInfectedInputController pInputController, float pDt)
const float TARGET_CONE_ANGLE_CHASE
const float HIT_INTERVAL_MIN
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 bool IsSelfAdjustingTemperature()
const float SHOCK_TO_STUN_MULTIPLIER
float m_LastMovementSpeed
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
DayZInfectedAttackType m_ActualAttackType
AbstractWave ProcessVoiceFX(string pSoundSetName)
const float ORIENTATION_SYNC_THRESHOLD
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)
float m_DamageHitDirection
void HandleMove(int pCurrentCommandID)
void DebugSound(string s)
sound debug messages
float m_AttackCooldownTime
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 m_DamageHitToProcess
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()
const float TARGET_CONE_ANGLE_FIGHT
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)
static float GetNoiseReduction(Weather weather)
proto void AddNoise(EntityAI source_entity, NoiseParams noise_params, float external_strenght_multiplier=1.0)
proto native float GetDamage(string zoneName, string healthType)
Base native class for all motorized wheeled vehicles.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
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.
proto float Normalize()
Normalizes vector. Returns length.
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)
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
class JsonUndergroundAreaTriggerData GetPosition
class SoundObject SoundParams(string name)