54 RegisterNetSyncVariableInt(
"m_MindState", -1, 5);
55 RegisterNetSyncVariableInt(
"m_OrientationSynced", 0, 359);
56 RegisterNetSyncVariableFloat(
"m_MovementSpeed", -1, 3);
57 RegisterNetSyncVariableBool(
"m_IsCrawling");
63 if ( !
g_Game.IsHeadlessOrDedicatedServer() )
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);
476 if ( moveCommand && !moveCommand.IsTurning() )
477 moveCommand.SetIdleState(0);
537 if (!
g_Game.IsHeadlessOrDedicatedServer())
540 if ( !soundParams.IsValid() )
547 soundObject = soundObjectBuilder.BuildSoundObject();
548 AttenuateSoundIfNecessary(soundObject);
550 return PlaySound(soundObject, soundObjectBuilder);
559 AnimSoundVoiceEvent voice_event = GetCreatureAIType().GetSoundVoiceEvent(event_id);
560 if (voice_event != null)
566 DebugSound(
"[Infected @ " +
this +
"][SoundEvent] InfectedSoundEventHandler - stop all");
572 DebugSound(
"[Infected @ " +
this +
"][AnimVoiceEvent] Stopping LastAW");
585 if (!
g_Game.IsHeadlessOrDedicatedServer())
588 if (NULL != objectBuilder)
591 SoundObject soundObject = objectBuilder.BuildSoundObject();
592 AttenuateSoundIfNecessary(soundObject);
593 aw =
PlaySound(soundObject, objectBuilder);
599 if (sound_event.m_NoiseParams != NULL)
600 GetGame().GetNoiseSystem().AddNoise(
this, sound_event.m_NoiseParams);
630 DayZInfectedCommandAttack attackCommand = GetCommand_Attack();
631 if (attackCommand && attackCommand.WasHit())
638 bool playerInBlockStance =
false;
640 vector hitPosWS = targetPos;
646 playerInBlockStance = playerTarget.GetMeleeFightLogic() && playerTarget.GetMeleeFightLogic().IsInBlock();
689 if ( pb && pb.GetCommand_Vehicle() )
698 if ( !CanAttackToPosition(targetPos) )
730 if (pb && pb.GetCommand_Vehicle())
746 if (!CanAttackToPosition(targetPos))
770 const float CENTER_EPS = 0.3;
771 const float TORSO_TO_HEAD_OFFSET = 0.55;
781 targetY = MiscGameplayFunctions.GetPlayerHeadPosition(playerTarget)[1];
786 vector def = target.GetDefaultHitPosition();
788 targetY = target.ModelToWorld(def)[1] + TORSO_TO_HEAD_OFFSET;
790 targetY = target.GetPosition()[1] + 1.0;
794 if (diff < CENTER_EPS)
797 if(myHeadY > targetY)
829 if ( pComponent ==
"LeftLeg" && GetHealth(pComponent,
"Health") == 0 )
831 else if ( pComponent ==
"RightLeg" && GetHealth(pComponent,
"Health") == 0 )
834 if ( pAnimType != -1 )
836 vector targetDirection = GetDirection();
839 targetDirection[1] = 0;
840 toSourceDirection[1] = 0;
845 float cosFi =
vector.
Dot(targetDirection, toSourceDirection);
850 return pAnimType != -1;
894 m_HeavyHitOverride =
false;
904 int invertHitDir = 0;
907 pHeavyHit = ((
g_Game.ConfigGetInt(
"cfgAmmo " + pAmmoType +
" hitAnimation") > 0) || m_HeavyHitOverride);
908 invertHitDir =
g_Game.ConfigGetInt(
"cfgAmmo " + pAmmoType +
" invertHitDir");
915 if ( pComponent ==
"Torso" )
917 else if ( pComponent ==
"Head" )
931 vector targetDirection = GetDirection();
934 targetDirection[1] = 0;
935 toSourceDirection[1] = 0;
940 float cosFi =
vector.
Dot(targetDirection, toSourceDirection);
941 vector cross = targetDirection * toSourceDirection;
945 dirAngle = -dirAngle;
952 vector targetDirection = GetDirection();
955 targetDirection[1] = 0;
956 toSourceDirection[1] = 0;
961 float cosFi =
vector.
Dot(targetDirection, toSourceDirection);
962 vector cross = targetDirection * toSourceDirection;
967 if ( invertHitDir > 0 )
971 dirAngle = -dirAngle;
983 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
985 m_TransportHitRegistered =
false;
989 ZombieHitData data =
new ZombieHitData;
991 data.m_DamageZone = dmgZone;
992 data.m_AmmoType = ammo;
997 int crawlTransitionType = -1;
1016 super.EEHitByRemote(damageType, source,
component, dmgZone, ammo, modelPos);
1040 RegisterTransportHit(transport);
1051 return super.CanReceiveAttachment(attachment, slotId);
1068 GetAIAgent().SetKeepInIdle(
true);
1071 switch (backstabType)
1074 m_DeathType = DayZInfectedDeathAnims.ANIM_DEATH_BACKSTAB;
1078 m_DeathType = DayZInfectedDeathAnims.ANIM_DEATH_NECKSTAB;
1082 m_DeathType = DayZInfectedDeathAnims.ANIM_DEATH_DEFAULT;
1099 GetAIAgent().SetKeepInIdle(
false);
1118 vector parentTransMat[4];
1123 GetTransformWS(parentTransMat);
1130 parentTransMat[0] = rotMatrix[0];
1131 parentTransMat[1] = rotMatrix[1];
1132 parentTransMat[2] = rotMatrix[2];
1133 parentTransMat[3] = closeBonePosWS;
1136 arrow.GetTransform(arrowTransMat);
1140 arrow.SetTransform(arrowTransMat);
1157 super.OnStepEvent(event_id, event_user_string);
1160 if (event_id % 2 == 0)
1162 surfaceInfo =
g_Game.GetSurfaceInfoUnderObjectByBone(
this, SurfaceAnimationBone.LeftBackLimb);
1164 else if (event_id % 2 == 1)
1166 surfaceInfo =
g_Game.GetSurfaceInfoUnderObjectByBone(
this, SurfaceAnimationBone.RightBackLimb);
1177 if (stepParticleID > 0)
1191 if (!
GetGame().IsDedicatedServer())
RepairTentActionReciveData m_DamageZone
void HandleCeilingDustStepEffect(SurfaceInfo surfaceInfo)
CodeLockComponent m_Component
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.
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
PluginManager GetPluginManager()
Returns registred plugin by class type, better is to use global funtion GetPlugin(typename plugin_typ...
static ref TStringArray ARRAY_STRING
void CommandHandler(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
int m_StanceVariation
server / singleplayer properties
void HandleCeilingDustStepEffect(SurfaceInfo surfaceInfo)
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()
override void OnStepEvent(int event_id, string event_user_string)
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
ref DustEffectCeilingHandlerLocal m_CeilingDustHandler
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)
proto int GetStepParticleId()
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 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()
const float AI_MAX_BLOCKABLE_ANGLE
const float AI_ATTACKSPEED
const int AI_SPRINT_STEP_MIN_ID
const int AI_SPRINT_STEP_MAX_ID
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)
vector GetPosition()
Get the world position of the Effect.
class SoundObject SoundParams(string name)