54 RegisterNetSyncVariableInt(
"m_MindState", -1, 4);
55 RegisterNetSyncVariableInt(
"m_OrientationSynced", 0, 359);
56 RegisterNetSyncVariableFloat(
"m_MovementSpeed", -1, 3);
57 RegisterNetSyncVariableBool(
"m_IsCrawling");
63 if ( !
g_Game.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));
373 bool doPhxImpulse =
g_Game.ConfigGetInt(
"cfgAmmo " + pAmmoType +
" doPhxImpulse") > 0;
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 (!
g_Game.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 (!
g_Game.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 = ((
g_Game.ConfigGetInt(
"cfgAmmo " + pAmmoType +
" hitAnimation") > 0) || m_HeavyHitOverride);
896 invertHitDir =
g_Game.ConfigGetInt(
"cfgAmmo " + pAmmoType +
" invertHitDir");
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
static ref TStringArray ARRAY_STRING
float m_DamageHitDirection
HandleDeath.
float m_AttackCooldownTime
const float ORIENTATION_SYNC_THRESHOLD
int GetVaultType(float height)
override array< string > GetSuitableFinisherHitComponents()
returns suitable hit components for finisher attacks; DEPRECATED
EntityAI m_ActualTarget
Combat.
override bool IsSelfAdjustingTemperature()
float m_LastMovementSpeed
bool EvaluateCrawlTransitionAnimation(EntityAI pSource, string pComponent, string pAmmoType, out int pAnimType)
void ProcessSoundVoiceEvent(AnimSoundVoiceEvent sound_event, out AbstractWave aw)
bool FightAttackLogic(int pCurrentCommandID, DayZInfectedInputController pInputController, float pDt)
vector SetDefaultHitPosition(string pSelection)
ref ArrowManagerBase m_ArrowManager
override string GetHitComponentForAI()
returns hit component for attacking AI
void EOnContact(IEntity other, Contact extra)
Phx contact event.
AbstractWave m_LastSoundVoiceAW
bool HandleDeath(int pCurrentCommandID)
bool HandleVault(int pCurrentCommandID, DayZInfectedInputController pInputController, float pDt)
int GetAttackPitch(EntityAI target)
vector m_DefaultHitPosition
void HandleSoundEvents()
Sound (client only).
bool ChaseAttackLogic(int pCurrentCommandID, DayZInfectedInputController pInputController, float pDt)
override ArrowManagerBase GetArrowManager()
void CommandHandler(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
CommandHandler.
bool m_DamageHitToProcess
Damage hits.
override string GetDefaultHitComponent()
returns default hit component (fallback)
bool HandleDamageHit(int pCurrentCommandID)
override bool CanBeBackstabbed()
float ComputeHitDirectionAngleEx(EntityAI pSource, int invertHitDir=0)
void HandleMove(int pCurrentCommandID)
HandleMove.
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
ref InfectedSoundEventHandler m_InfectedSoundEventHandler
bool EvaluateDeathAnimationEx(EntityAI pSource, ZombieHitData data, out int pAnimType, out float pAnimHitDir)
override vector GetDefaultHitPosition()
bool EvaluateDeathAnimation(EntityAI pSource, string pComponent, string pAmmoType, out int pAnimType, out float pAnimHitDir)
override void OnSoundVoiceEvent(int event_id, string event_user_string)
ref array< Object > m_AllTargetObjects
float ComputeHitDirectionAngle(EntityAI pSource)
override void SetBeingBackstabbed(int backstabType)
override bool IsHealthVisible()
override void AddArrow(Object arrow, int componentIndex, vector closeBonePosWS, vector closeBoneRotWS)
int GetOrientationSynced()
returns rounded zombie yaw for sync purposes
void OnRecoverFromDeath()
int m_StanceVariation
server / singleplayer properties
override void EEHitByRemote(int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos)
bool FightLogic(int pCurrentCommandID, DayZInfectedInputController pInputController, float pDt)
bool m_FinisherInProgress
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Events from damage system.
const float TARGET_CONE_ANGLE_FIGHT
void HandleOrientation(float pDt, int pCurrentCommandID)
HandleOrientation.
override bool IsRefresherSignalingViable()
int m_ActiveVaultType
HandleVault.
override void EOnInit(IEntity other, int extra)
void DebugSound(string s)
sound debug messages
DayZInfectedAttackType m_ActualAttackType
bool IsCrawling()
returns true if crawling; 'DayZInfectedCommandCrawl' is only for the transition, after that it remain...
override bool IsBeingBackstabbed()
returns true if backstab is in progress; used for suspending of AI targeting and other useful things ...
int m_CrawlTransition
Crawl transition.
const float TARGET_CONE_ANGLE_CHASE
override bool CanBeSkinned()
override vector GetCenter()
AbstractWave ProcessVoiceFX(string pSoundSetName)
override void OnVariablesSynchronized()
synced variable(s) handler
bool HandleCrawlTransition(int pCurrentCommandID)
ref array< typename > m_TargetableObjects
bool HandleMindStateChange(int pCurrentCommandID, DayZInfectedInputController pInputController, float pDt)
Mind state change.
const float HIT_INTERVAL_MIN
override AnimBootsType GetBootsType()
override bool IsManagingArrows()
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool IsZombieMilitary()
void CommandHandlerDebug(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
CommandHandlerDebug.
const float SHOCK_TO_STUN_MULTIPLIER
Internal ancestor of all Entity implementations.
static float GetNoiseReduction(Weather weather)
proto native float GetDamage(string zoneName, string healthType)
Native class for boats - handles physics simulation.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto float Normalize()
Normalizes vector.
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.
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)
ModOverrides.
bool ModCommandHandlerAfter(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
DayZInfectedAttackGroupType
string GetDefaultHitPositionComponent()
void DayZPlayerUtils()
cannot be instantiated
const float AI_ATTACKSPEED
const float AI_MAX_BLOCKABLE_ANGLE
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 MatrixOrthogonalize4(vector mat[4])
Orthogonalizes matrix.
static proto void MatrixInvMultiply4(vector mat0[4], vector mat1[4], out vector res[4])
Invert-transforms matrix.
static proto void YawPitchRollMatrix(vector ang, out vector mat[3])
Creates rotation matrix from angles.
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 RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
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 int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
static proto float AbsFloat(float f)
Returns absolute value.
static proto float NormalizeAngle(float ang)
Normalizes the angle (0...360).
static const float RAD2DEG
static const float DEG2RAD
static proto float Sin(float angle)
Returns sinus of angle in radians.
static proto int AbsInt(int i)
Returns absolute value.
proto void dBodyApplyImpulse(notnull IEntity body, vector impulse)
Applies impuls on a rigidbody (origin).
vector GetPosition()
Get the world position of the Effect.
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
class SoundObject SoundParams(string name)
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