26 #ifdef _DAYZ_CREATURE_DEBUG_SHADOW
93 GetTransform(parentTransMat);
100 parentTransMat[0] = rotMatrix[0];
101 parentTransMat[1] = rotMatrix[1];
102 parentTransMat[2] = rotMatrix[2];
103 parentTransMat[3] = closeBonePosWS;
106 arrow.GetTransform(arrowTransMat);
110 arrow.SetTransform(arrowTransMat);
122 proto native
void DebugDisableAIControl();
123 proto native
void DebugRestoreAIControl();
125 proto native
void AddDamageSphere(
string bone_name,
string ammo_name,
float radius,
float duration,
bool invertTeams);
140 RegisterAnimEvents();
147 m_EffectTriggerCount++;
152 m_EffectTriggerCount--;
157 AddDamageSphere(damage_params.m_sBoneName, damage_params.m_sAmmoName, damage_params.m_fRadius, damage_params.m_fDuration, damage_params.m_bInvertTeams);
162 super.EEKilled(killer);
185 AnimSoundEvent sound_event = GetCreatureAIType().GetSoundEvent(event_id);
186 if(sound_event != NULL)
188 ProcessSoundEvent(sound_event);
194 AnimSoundVoiceEvent voice_event = GetCreatureAIType().GetSoundVoiceEvent(event_id);
195 if(voice_event != NULL)
197 ProcessSoundVoiceEvent(voice_event);
203 AnimStepEvent step_event = GetCreatureAIType().GetStepEvent(event_id);
204 if(step_event != NULL)
206 ProcessStepEvent(step_event);
212 AnimDamageEvent damage_event = GetCreatureAIType().GetDamageEvent(event_id);
213 if(damage_event != NULL)
215 ProcessDamageEvent(damage_event);
223 Print(
"Error registering anim. event (Sound)");
228 Print(
"Error registering anim. event (SoundVoice)");
231 if(!
GetGame().IsDedicatedServer())
235 Print(
"Error registering anim. event (Step)");
241 Print(
"Error registering anim. event (Damage)");
247 if(!
GetGame().IsDedicatedServer())
250 if(NULL != objectBuilder)
260 if(sound_event.m_NoiseParams != NULL)
267 if(!
GetGame().IsDedicatedServer())
270 if(NULL != objectBuilder)
274 AttenuateSoundIfNecessary(soundObject);
281 if(sound_event.m_NoiseParams != NULL)
288 SoundObjectBuilder soundBuilder = step_event.GetSoundBuilder(GetSurfaceType().Hash());
289 if(soundBuilder == NULL)
294 AttenuateSoundIfNecessary(soundObject);
302 AddDamageSphere(damage_event.m_DamageParams);
309 soundObject.SetKind(
WaveKind.WAVEATTALWAYS);
313 soundObject.SetKind(
WaveKind.WAVEEFFECTEX);
343enum DayZAnimalConstants
491 return EInventoryIconVisibility.HIDE_VICINITY;
506 if( ModCommandHandlerBefore(dt, currentCommandID, currentCommandFinished) )
511 if (HandleDeath(currentCommandID, inputController))
516 if (currentCommandFinished)
518 if (currentCommandID == DayZAnimalConstants.COMMANDID_ATTACK)
520 SignalAIAttackEnded();
529 if( ModCommandHandlerInside(dt, currentCommandID, currentCommandFinished) )
534 if (HandleDamageHit(currentCommandID))
536 if (currentCommandID == DayZAnimalConstants.COMMANDID_ATTACK)
538 SignalAIAttackEnded();
543 if (currentCommandID == DayZAnimalConstants.COMMANDID_MOVE)
545 if (inputController.
IsJump())
553 StartCommand_Attack();
554 SignalAIAttackStarted();
560 if( ModCommandHandlerAfter(dt, currentCommandID, currentCommandFinished) )
587 bool m_DamageHitToProcess =
false;
588 int m_DamageHitType = 0;
589 int m_DamageHitDirection = 0;
593 if (inputController.
IsDead())
595 if (currentCommandID == DayZAnimalConstants.COMMANDID_DEATH)
600 if (m_DamageHitToProcess)
602 m_DamageHitToProcess =
false;
619 if (m_DamageHitToProcess)
621 m_DamageHitToProcess =
false;
623 if (currentCommandID != DayZAnimalConstants.COMMANDID_HIT)
625 StartCommand_Hit(m_DamageHitType, m_DamageHitDirection);
634 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
635 m_TransportHitRegistered =
false;
640 AddHealth(
"",
"Health",-ConvertNonlethalDamage(damageResult.
GetDamage(dmgZone,
"Shock")));
645 animal_bleeding.
CreateWound( damageResult, dmgZone, ammo );
650 if (ComputeDamageHitParams(source, dmgZone, ammo, type, direction) ==
true)
652 QueueDamageHit(type, direction);
659 m_DamageHitToProcess =
true;
660 m_DamageHitType = type;
661 m_DamageHitDirection = direction;
668 float angleDeg = ComputeHitDirectionAngleDeg(source);
669 direction = TranslateHitAngleDegToDirectionIndex(angleDeg);
671 direction += FindComponentDirectionOffset(dmgZone);
678 vector targetDirection = GetDirection();
681 targetDirection[1] = 0;
682 toSourceDirection[1] = 0;
687 float cosFi =
vector.
Dot(targetDirection, toSourceDirection);
688 vector cross = targetDirection * toSourceDirection;
692 dirAngleDeg = -dirAngleDeg;
699 if (angleDeg >= -20 && angleDeg <= 20)
703 else if (angleDeg < 0)
713 const int directionCount = 4;
722 offset = directionCount;
726 offset = 2 * directionCount;
730 offset = 3 * directionCount;
751 RegisterTransportHit(transport);
792 return m_DefaultHitPosition;
797 return GetSelectionPositionMS(pSelection);
803 return converted_dmg;
class AnimalBase extends DayZAnimal RegisterHitComponentsForAI()
proto native DayZCreatureAnimInterface GetAnimInterface()
proto native void PrePhys_SetRotation(float pInRot[4])
bool PostPhysUpdate(float pDt)
class DayZCreatureAI extends DayZCreature COMMANDID_ATTACK
proto native void SetAnimationInstanceByName(string animation_instance_name, int instance_uuid, float duration)
proto native void PostPhys_SetPosition(vector pInTransl)
quaternion in world space
class DayZCreatureAI extends DayZCreature COMMANDID_HIT
class DayZCreatureAnimInterface RegisterAnimationEvent(string event_name, string function_name)
class DayZAnimalCommandMove extends AnimCommandBase SetFlagFinished(bool pFinished)
DayZAnimalCommandScript fully scriptable command.
proto native void UpdateSimulationPrecision(int simLOD)
proto native bool PrePhys_GetRotation(out float pOutRot[4])
proto native int GetCurrentAnimationInstanceUUID()
proto native bool IsDeathProcessed()
proto native void PostPhys_GetRotation(out float pOutRot[4])
vec3 in world space
class DayZCreatureAI extends DayZCreature COMMANDID_MOVE
override void AddArrow(Object arrow, int componentIndex, vector closeBonePosWS, vector closeBoneRotWS)
proto native int GetBoneIndexByName(string pBoneName)
returns bone index for a name (-1 if pBoneName doesn't exist)
class DayZCreatureAI extends DayZCreature COMMANDID_SCRIPT
proto native bool PrePhys_GetTranslation(out vector pOutTransl)
script function usable in PrePhysUpdate
proto native void PostPhys_SetRotation(float pInRot[4])
vec3 in world space
override bool IsIgnoredByConstruction()
proto native void PrePhys_SetTranslation(vector pInTransl)
proto native void ResetDeath()
proto native void StartDeath()
class DayZCreatureAI extends DayZCreature COMMANDID_JUMP
proto native void PostPhys_LockRotation()
quaternion in world space
override bool CanBeSkinned()
proto native void ResetDeathCooldown()
class DayZCreatureAI extends DayZCreature COMMANDID_DEATH
override bool IsManagingArrows()
override bool IsDayZCreature()
proto native void PostPhys_GetPosition(out vector pOutTransl)
script function usable in PostPhysUpdate
proto native bool IsDeathConditionMet()
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
class SoundObjectBuilder SoundObject(SoundParams soundParams)
class JsonUndergroundAreaTriggerData GetPosition
proto void SetPosition(vector position)
base class of all commands exposed to script to provide common functionality over animations
proto native AbstractSoundScene GetSoundScene()
proto native NoiseSystem GetNoiseSystem()
static ref TStringArray ARRAY_STRING
void CreateWound(TotalDamageResult damage_result, string zone_name, string ammo)
static void RegisterHitComponent(array< ref DayZAIHitComponent > pHitComponents, string pName, float pWeight)
Register Hit Component for AI targeting.
static bool SelectMostProbableHitComponent(array< ref DayZAIHitComponent > pHitComponents, out string pHitComponent)
do not process rotations !
override bool IsInventoryVisible()
int FindComponentDirectionOffset(string component)
proto native void SignalAIAttackEnded()
bool ModCommandHandlerInside(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
void QueueDamageHit(int type, int direction)
void RegisterHitComponentsForAI()
register hit components for AI melee (used by attacking AI)
float ComputeHitDirectionAngleDeg(EntityAI source)
override string GetHitComponentForAI()
proto native void StartCommand_Attack()
protected string m_DefaultHitPositionComponent
proto native void StartCommand_Hit(int pType, int pDirection)
protected ref array< ref DayZAIHitComponent > m_HitComponentsForAI
Melee hit components (AI targeting)
bool ComputeDamageHitParams(EntityAI source, string dmgZone, string ammo, out int type, out int direction)
protected vector SetDefaultHitPosition(string pSelection)
protected string m_DefaultHitComponent
override string GetDefaultHitComponent()
proto native DayZAnimalCommandScript GetCommand_Script()
override string GetDefaultHitPositionComponent()
bool HandleDeath(int currentCommandID, DayZAnimalInputController inputController)
override vector GetDefaultHitPosition()
int TranslateHitAngleDegToDirectionIndex(float angleDeg)
proto native DayZAnimalCommandScript StartCommand_Script(DayZAnimalCommandScript pInfectedCommand)
scripted commands
proto native DayZAnimalInputController GetInputController()
override bool IsHealthVisible()
bool HandleDamageHit(int currentCommandID)
protected vector m_DefaultHitPosition
override int GetHideIconMask()
proto native void StartCommand_Move()
float ConvertNonlethalDamage(float damage)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
proto native DayZAnimalCommandScript StartCommand_ScriptInst(typename pCallbackClass)
void CommandHandler(float dt, int currentCommandID, bool currentCommandFinished)
proto native void SignalAIAttackStarted()
proto native void StartCommand_Jump()
bool ModCommandHandlerBefore(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
proto native void StartCommand_Death(int pType, int pDirection)
override protected void EOnContact(IEntity other, Contact extra)
bool ModCommandHandlerAfter(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished)
proto native TAnimGraphVariable BindVariableFloat(string pVariable)
proto native TAnimGraphEvent BindEvent(string pEventName)
private void DayZCreatureAnimInterface()
proto native TAnimGraphVariable BindVariableBool(string pVariable)
proto native TAnimGraphCommand BindCommand(string pCommandName)
returns command index -
private void ~DayZCreatureAnimInterface()
proto native TAnimGraphTag BindTag(string pTagName)
proto native TAnimGraphVariable BindVariableInt(string pVariable)
void OnSoundEvent(int event_id, string event_user_string)
void DecreaseEffectTriggerCount()
AbstractWave PlaySound(SoundObject so, SoundObjectBuilder sob)
void OnSoundVoiceEvent(int event_id, string event_user_string)
void OnStepEvent(int event_id, string event_user_string)
override void EEKilled(Object killer)
bool ResistContaminatedEffect()
private void ProcessStepEvent(AnimStepEvent step_event)
void IncreaseEffectTriggerCount()
proto native bool IsSoundInsideBuilding()
proto native void AddDamageSphere(string bone_name, string ammo_name, float radius, float duration, bool invertTeams)
protected void RegisterAnimEvents()
void OnDamageEvent(int event_id, string event_user_string)
proto native void InitAIAgent(AIGroup group)
private void ProcessDamageEvent(AnimDamageEvent damage_event)
proto native void DestroyAIAgent()
private void ProcessSoundVoiceEvent(AnimSoundVoiceEvent sound_event)
AnimBootsType GetBootsType()
protected void AttenuateSoundIfNecessary(SoundObject soundObject)
proto native AIAgent GetAIAgent()
proto native DayZCreatureAIType GetCreatureAIType()
private void ProcessSoundEvent(AnimSoundEvent sound_event)
void AddDamageSphere(AnimDamageParams damage_params)
proto void AddNoise(EntityAI source_entity, NoiseParams noise_params, float external_strenght_multiplier=1.0)
base "helper" class for nonlethal ammo handling
proto native void UpdateEnvSoundControllers(vector position)
SoundObject BuildSoundObject()
proto native float GetDamage(string zoneName, string healthType)
Base native class for all motorized wheeled vehicles.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto float Normalize()
Normalizes vector. Returns length.
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
protected string m_DefaultHitPositionComponent
protected ref array< ref DayZAIHitComponent > m_HitComponentsForAI
Melee hit components (AI targeting)
string GetDefaultHitComponent()
protected string m_DefaultHitComponent
string GetDefaultHitPositionComponent()
proto native CGame GetGame()
const int COMP_TYPE_ANIMAL_BLEEDING
const int COMP_TYPE_BODY_STAGING
proto void Print(void var)
Prints content of variable to console/log.
proto native void SetFlags(ShapeFlags flags)
const float PROJECTILE_CONVERSION_ANIMALS
Non-lethal projectile damage QuantityConversions.
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 const float RAD2DEG
proto native ToType()
Returns internal type representation. Can be used in runtime, or cached in variables and used for fas...
proto native HumanCommandMove StartCommand_Move()
returns current command ID
proto native HumanCommandDeathCallback StartCommand_Death(int pType, float pDirection, typename pCallbackClass)
--— Death --—
class HumanInputController TAnimGraphCommand
proto native HumanInputController GetInputController()
returns human input controller