DayZ 1.24
Loading...
Searching...
No Matches
DayZInfected.c
Go to the documentation of this file.
19
21{
26}
27
29{
34}
35
37{
41 proto native bool IsTurning();
42}
43
45
47
49{
50 proto native bool WasHit();
51}
53{
54 proto native bool WasLand();
55}
56
58
67{
71
72 //---------------------------------------------------------------
73 // usable everywhere
74
77
78 //---------------------------------------------------------------
79 // PrePhys Update
80
82 proto native bool PrePhys_GetTranslation(out vector pOutTransl); // vec3 in local space !
83 proto native bool PrePhys_GetRotation(out float pOutRot[4]); // quaternion in local space !
84 proto native void PrePhys_SetTranslation(vector pInTransl); // vec3 in local space !
85 proto native void PrePhys_SetRotation(float pInRot[4]); // quaternion in local space !
86
87 //---------------------------------------------------------------
88 // PostPhys Update
89
93 bool PostPhysUpdate(float pDt);
94
101}
102
103class DayZInfected extends DayZCreatureAI
104{
110 proto native void StartCommand_Hit(bool pHeavy, int pType, float pDirection);
111 proto native DayZInfectedCommandAttack StartCommand_Attack(EntityAI pTarget, int pType, float pSubtype);
113
115
119
124
127
128 const float LEG_CRIPPLE_THRESHOLD = 74.0;
129
131
132 //-------------------------------------------------------------
133 void DayZInfected();
134 void ~DayZInfected();
135
136 //-------------------------------------------------------------
138 {
140
141 int transferShockToDamageCoef = g_Game.ConfigGetInt(string.Format("%1 %2 DamageApplied transferShockToDamage", CFG_AMMO, ammo));
143 {
144 float damage = damageResult.GetDamage(dmgZone, "Shock");
146 AddHealth("", "Health", -ConvertNonlethalDamage(damage, damageType));
147 }
148
149 if (!IsAlive())
150 {
151 if (!m_DeathSyncSent) //to be sent only once on hit/death
152 {
153 Man killer = source.GetHierarchyRootPlayer();
154
155 if (!m_KillerData) //only one player is considered killer in the event of crossfire
156 {
157 m_KillerData = new KillerData();
158 m_KillerData.m_Killer = killer;
159 m_KillerData.m_MurderWeapon = source;
160 }
161
162 if (killer && killer.IsPlayer())
163 {
164 // was infected killed by headshot?
165 if (dmgZone == "Head") //no "Brain" damage zone defined (nor can it be caught like on player, due to missing command handler), "Head" is sufficient
166 {
167 m_KilledByHeadshot = true;
168 if (m_KillerData.m_Killer == killer)
169 m_KillerData.m_KillerHiTheBrain = true;
170 }
171 }
172
173 SyncEvents.SendEntityKilled(this, m_KillerData.m_Killer, m_KillerData.m_MurderWeapon, m_KillerData.m_KillerHiTheBrain);
174 m_DeathSyncSent = true;
175 }
176 }
177 }
178
179 override protected float ConvertNonlethalDamage(float damage, DamageType damageType)
180 {
181 switch (damageType)
182 {
183 case DamageType.CLOSE_COMBAT:
185 case DamageType.FIRE_ARM:
187 }
188
189 return super.ConvertNonlethalDamage(damage, damageType);
190 }
191
192 void HandleSpecialZoneDamage(string dmgZone, float damage)
193 {
195 return;
196
197 if (dmgZone == "LeftLeg" || dmgZone == "RightLeg")
198 SetHealth(dmgZone, "Health", 0.0);
199
200 if (dmgZone == "Torso" || dmgZone == "Head")
201 m_HeavyHitOverride = true;
202 }
203
204 override int GetHideIconMask()
205 {
206 return EInventoryIconVisibility.HIDE_VICINITY;
207 }
208}
override int GetHideIconMask()
DamageType
exposed from C++ (do not change)
proto native void PrePhys_SetRotation(float pInRot[4])
bool PostPhysUpdate(float pDt)
proto native void PostPhys_SetPosition(vector pInTransl)
quaternion in world space
class DayZAnimalCommandMove extends AnimCommandBase SetFlagFinished(bool pFinished)
DayZAnimalCommandScript fully scriptable command.
proto native bool PrePhys_GetRotation(out float pOutRot[4])
proto native void PostPhys_GetRotation(out float pOutRot[4])
vec3 in world space
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
proto native void PrePhys_SetTranslation(vector pInTransl)
proto native void PostPhys_LockRotation()
quaternion in world space
proto native void PostPhys_GetPosition(out vector pOutTransl)
script function usable in PostPhysUpdate
DayZGame g_Game
Definition DayZGame.c:3528
enum DayZInfectedConstants ANIM_DEATH_BACKSTAB
enum DayZInfectedConstants ANIM_DEATH_DEFAULT
enum DayZInfectedConstants MOVEMENTSTATE_WALK
enum DayZInfectedConstants ANIM_DEATH_IMPULSE
enum DayZInfectedConstants MOVEMENTSTATE_IDLE
DayZInfectedConstants
Definition DayZInfected.c:2
@ COMMANDID_MOVE
anim commands
Definition DayZInfected.c:4
@ MINDSTATE_CHASE
@ MINDSTATE_CALM
mind states
@ MINDSTATE_DISTURBED
@ COMMANDID_VAULT
Definition DayZInfected.c:5
@ COMMANDID_HIT
Definition DayZInfected.c:7
@ COMMANDID_CRAWL
Definition DayZInfected.c:9
@ COMMANDID_ATTACK
Definition DayZInfected.c:8
@ COMMANDID_SCRIPT
@ COMMANDID_DEATH
Definition DayZInfected.c:6
@ MINDSTATE_ALERTED
@ MINDSTATE_FIGHT
enum DayZInfectedConstants MOVEMENTSTATE_RUN
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
base class of all commands exposed to script to provide common functionality over animations
Definition AnimCommand.c:3
do not process rotations !
Definition DayZAnimal.c:573
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Definition ZombieBase.c:928
static void SendEntityKilled(EntityAI victim, EntityAI killer, EntityAI source, bool is_headshot)
Definition SyncEvents.c:54
const float NL_DAMAGE_CLOSECOMBAT_CONVERSION_INFECTED
Definition constants.c:864
const float NL_DAMAGE_FIREARM_CONVERSION_INFECTED
Definition constants.c:860
const string CFG_AMMO
Definition constants.c:212
proto native HumanCommandScript StartCommand_ScriptInst(typename pCallbackClass)
proto native bool WasHit()
is true only once after hit event
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
proto native HumanCommandScript GetCommand_Script()
is human is in command action - returns its callback, if current command is action
proto native HumanCommandScript StartCommand_Script(HumanCommandScript pHumanCommand)
— SCRIPTED COMMANDS