Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
dayzinfected.c
Go to the documentation of this file.
2 {
11 
18 }
19 
20 enum DayZInfectedConstantsMovement
21 {
25  MOVEMENTSTATE_SPRINT
26 }
27 
28 enum DayZInfectedDeathAnims
29 {
34 }
35 
37 {
38  proto native void SetStanceVariation(int pStanceVariation);
39  proto native void SetIdleState(int pIdleState);
40  proto native void StartTurn(float pDirection, int pSpeedType);
41  proto native bool IsTurning();
42 }
43 
44 class DayZInfectedCommandDeath extends AnimCommandBase {}
45 
46 class DayZInfectedCommandHit extends AnimCommandBase {}
47 
48 class DayZInfectedCommandAttack extends AnimCommandBase
49 {
50  proto native bool WasHit();
51 }
52 class DayZInfectedCommandVault extends AnimCommandBase
53 {
54  proto native bool WasLand();
55 }
56 
57 class DayZInfectedCommandCrawl extends AnimCommandBase {}
58 
66 class DayZInfectedCommandScript extends AnimCommandBase
67 {
69  void DayZInfectedCommandScript(DayZInfected pInfected) {}
70  void ~DayZInfectedCommandScript() {}
71 
72  //---------------------------------------------------------------
73  // usable everywhere
74 
76  proto native void SetFlagFinished(bool pFinished);
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 
96  proto native void PostPhys_GetPosition(out vector pOutTransl);
97  proto native void PostPhys_GetRotation(out float pOutRot[4]);
98  proto native void PostPhys_SetPosition(vector pInTransl);
99  proto native void PostPhys_SetRotation(float pInRot[4]);
100  proto native void PostPhys_LockRotation();
101 }
102 
103 class DayZInfected extends DayZCreatureAI
104 {
105  proto native DayZInfectedType GetDayZInfectedType();
108  proto native DayZInfectedCommandVault StartCommand_Vault(int pType);
109  proto native void StartCommand_Death(int pType, float pDirection);
110  proto native void StartCommand_Hit(bool pHeavy, int pType, float pDirection);
111  proto native DayZInfectedCommandAttack StartCommand_Attack(EntityAI pTarget, int pType, float pSubtype);
112  proto native void StartCommand_Crawl(int pType);
113 
114  proto native bool CanAttackToPosition(vector pTargetPosition);
115 
117  proto native DayZInfectedCommandVault GetCommand_Vault();
118  proto native DayZInfectedCommandAttack GetCommand_Attack();
119 
121  proto native DayZInfectedCommandScript StartCommand_Script(DayZInfectedCommandScript pInfectedCommand);
122  proto native DayZInfectedCommandScript StartCommand_ScriptInst(typename pCallbackClass);
123  proto native DayZInfectedCommandScript GetCommand_Script();
124 
126  proto native void GetTransformWS(out vector pTm[4]);
127 
128  const float LEG_CRIPPLE_THRESHOLD = 74.0;
129 
130  bool m_HeavyHitOverride;
131 
132  //-------------------------------------------------------------
133  void DayZInfected();
134  void ~DayZInfected();
135 
136  //-------------------------------------------------------------
137  override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
138  {
139  super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
140 
141  int transferShockToDamageCoef = g_Game.ConfigGetInt(string.Format("%1 %2 DamageApplied transferShockToDamage", CFG_AMMO, ammo));
142  if (transferShockToDamageCoef == 1)
143  {
144  float damage = damageResult.GetDamage(dmgZone, "Shock");
145  HandleSpecialZoneDamage(dmgZone, damage);
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:
184  return damage * GameConstants.NL_DAMAGE_CLOSECOMBAT_CONVERSION_INFECTED;
185  case DamageType.FIRE_ARM:
186  return damage * GameConstants.NL_DAMAGE_FIREARM_CONVERSION_INFECTED;
187  }
188 
189  return super.ConvertNonlethalDamage(damage, damageType);
190  }
191 
192  void HandleSpecialZoneDamage(string dmgZone, float damage)
193  {
194  if (damage < LEG_CRIPPLE_THRESHOLD)
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 }
MINDSTATE_FIGHT
@ MINDSTATE_FIGHT
Definition: dayzinfected.c:17
GetHideIconMask
override int GetHideIconMask()
Definition: basebuildingbase.c:87
PrePhys_SetRotation
proto native void PrePhys_SetRotation(float pInRot[4])
DayZInfectedInputController
Definition: dayzinfectedinputcontroller.c:1
MOVEMENTSTATE_RUN
enum DayZInfectedConstants MOVEMENTSTATE_RUN
COMMANDID_SCRIPT
@ COMMANDID_SCRIPT
Definition: dayzinfected.c:10
PostPhys_LockRotation
proto native void PostPhys_LockRotation()
quaternion in world space
StartCommand_Script
proto native HumanCommandScript StartCommand_Script(HumanCommandScript pHumanCommand)
— SCRIPTED COMMANDS
PrePhys_GetRotation
proto native bool PrePhys_GetRotation(out float pOutRot[4])
MINDSTATE_CALM
@ MINDSTATE_CALM
mind states
Definition: dayzinfected.c:13
MINDSTATE_DISTURBED
@ MINDSTATE_DISTURBED
Definition: dayzinfected.c:14
ANIM_DEATH_NECKSTAB
DayZInfectedInputController ANIM_DEATH_NECKSTAB
COMMANDID_DEATH
@ COMMANDID_DEATH
Definition: dayzinfected.c:6
PostPhys_GetRotation
proto native void PostPhys_GetRotation(out float pOutRot[4])
vec3 in world space
PostPhysUpdate
bool PostPhysUpdate(float pDt)
DayZInfected
Definition: zombiebase.c:1
GetTransformWS
enum HumanMoveCommandID GetTransformWS(out vector pTm[4])
gets human transform in World Space
MINDSTATE_CHASE
@ MINDSTATE_CHASE
Definition: dayzinfected.c:16
DayZCreatureAI
do not process rotations !
Definition: dayzanimal.c:606
component
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
DayZInfectedCommandMove
Definition: dayzinfectedimplement.c:1
COMMANDID_ATTACK
@ COMMANDID_ATTACK
Definition: dayzinfected.c:8
AnimCommandBase
base class of all commands exposed to script to provide common functionality over animations
Definition: animcommand.c:2
COMMANDID_MOVE
@ COMMANDID_MOVE
anim commands
Definition: dayzinfected.c:4
vector
Definition: enconvert.c:105
MINDSTATE_ALERTED
@ MINDSTATE_ALERTED
Definition: dayzinfected.c:15
ANIM_DEATH_DEFAULT
enum DayZInfectedConstants ANIM_DEATH_DEFAULT
PostPhys_GetPosition
proto native void PostPhys_GetPosition(out vector pOutTransl)
script function usable in PostPhysUpdate
TotalDamageResult
Definition: damagesystem.c:1
DamageType
DamageType
exposed from C++ (do not change)
Definition: damagesystem.c:10
g_Game
DayZGame g_Game
Definition: dayzgame.c:3727
GetInputController
proto native HumanInputController GetInputController()
returns human input controller
DayZInfectedConstants
DayZInfectedConstants
Definition: dayzinfected.c:1
KillerData
Definition: killerdata.c:1
MOVEMENTSTATE_IDLE
enum DayZInfectedConstants MOVEMENTSTATE_IDLE
PrePhys_SetTranslation
proto native void PrePhys_SetTranslation(vector pInTransl)
WasHit
proto native bool WasHit()
is true only once after hit event
COMMANDID_CRAWL
@ COMMANDID_CRAWL
Definition: dayzinfected.c:9
ANIM_DEATH_BACKSTAB
enum DayZInfectedConstants ANIM_DEATH_BACKSTAB
SyncEvents
Definition: syncevents.c:1
GetCommand_Script
proto native HumanCommandScript GetCommand_Script()
is human is in command action - returns its callback, if current command is action
StartCommand_ScriptInst
proto native HumanCommandScript StartCommand_ScriptInst(typename pCallbackClass)
MOVEMENTSTATE_WALK
enum DayZInfectedConstants MOVEMENTSTATE_WALK
PostPhys_SetPosition
proto native void PostPhys_SetPosition(vector pInTransl)
quaternion in world space
SetFlagFinished
enum DayZAnimalBehaviourSlot SetFlagFinished
StartCommand_Move
proto native HumanCommandMove StartCommand_Move()
--— MOVE --—
GameConstants
Definition: constants.c:612
StartCommand_Death
proto native HumanCommandDeathCallback StartCommand_Death(int pType, float pDirection, typename pCallbackClass, bool pKeepInLocalSpaceAfterLeave=false)
--— Death --—
COMMANDID_VAULT
@ COMMANDID_VAULT
Definition: dayzinfected.c:5
PrePhys_GetTranslation
proto native bool PrePhys_GetTranslation(out vector pOutTransl)
script function usable in PrePhysUpdate
COMMANDID_HIT
@ COMMANDID_HIT
Definition: dayzinfected.c:7
CFG_AMMO
const string CFG_AMMO
Definition: constants.c:212
EntityAI
Definition: building.c:5
ANIM_DEATH_IMPULSE
enum DayZInfectedConstants ANIM_DEATH_IMPULSE
PostPhys_SetRotation
proto native void PostPhys_SetRotation(float pInRot[4])
vec3 in world space
GetCommand_Move
proto native HumanCommandMove GetCommand_Move()