Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл DayZInfectedType.c

См. исходные тексты.

Структуры данных

class  DayZInfectedAttackType
 

Перечисления

enum  DayZInfectedAttackGroupType
 

Функции

enum DayZInfectedAttackGroupType RegisterHitComponentsForAI ()
 register hit components for AI melee (used by attacking AI)
 
void RegisterAttacks ()
 
DayZInfectedAttackType ChooseAttack (DayZInfectedAttackGroupType pAttackGroupType, float pDistance, int pPitch)
 
string GetHitComponentForAI ()
 
string GetDefaultHitComponent ()
 
string GetDefaultHitPositionComponent ()
 
array< stringGetSuitableFinisherHitComponents ()
 
void RegisterAttack (DayZInfectedAttackGroupType pAttackGroupType, float pDistance, int pPitch, int pType, float pSubtype, string pAmmoType, int pIsHeavy, float pCooldown, float pProbability)
 
float ComputeAttackUtility (DayZInfectedAttackType pAttackType, float pTargetDistance, int pPitch, float pProbability)
 
array< ref DayZInfectedAttackTypeGetAttackGroup (DayZInfectedAttackGroupType pType)
 

Переменные

 CHASE
 
 FIGHT
 
ref array< ref DayZInfectedAttackTypem_ChaseAttacksGroup
 selected & sorted targets by utility function
 
ref array< ref DayZInfectedAttackTypem_FightAttacksGroup
 
ref array< ref DayZAIHitComponentm_HitComponentsForAI
 Melee hit components (AI targeting)
 
string m_DefaultHitComponent
 
string m_DefaultHitPositionComponent
 
ref array< stringm_SuitableFinisherHitComponents
 

Перечисления

◆ DayZInfectedAttackGroupType

14{
15 CHASE,
16 FIGHT
17}
CHASE
Definition DayZInfectedType.c:26
FIGHT
Definition DayZInfectedType.c:28

Функции

◆ ChooseAttack()

DayZInfectedAttackType ChooseAttack ( DayZInfectedAttackGroupType pAttackGroupType,
float pDistance,
int pPitch )
97 {
99 float rnd;
100 float highestUtility = -1;
102
104
105 for (int i = 0; i < attackGroup.Count(); ++i)
106 {
110 if (utility <= 0)
111 continue;
112
114 {
117 }
118 }
119
120 //Print("Most sutable attack selected: " + mostSuitableAttack);
121 return mostSuitableAttack;
122 }
float ComputeAttackUtility(DayZInfectedAttackType pAttackType, float pTargetDistance, int pPitch, float pProbability)
Definition DayZInfectedType.c:171
array< ref DayZInfectedAttackType > GetAttackGroup(DayZInfectedAttackGroupType pType)
Definition DayZInfectedType.c:199
Definition DayZInfectedType.c:2
Definition EnMath.c:7
Definition EntityAI.c:95
static proto int Randomize(int seed)
Sets the seed for the random number generator.
static float RandomFloat01()
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:126
proto native float GetWorldTime()

Перекрестные ссылки ComputeAttackUtility(), GetAttackGroup(), GetWorldTime(), Math::RandomFloat01() и Math::Randomize().

◆ ComputeAttackUtility()

float ComputeAttackUtility ( DayZInfectedAttackType pAttackType,
float pTargetDistance,
int pPitch,
float pProbability )
protected
172 {
173 // pitch
174 if (pAttackType.m_Pitch != pPitch)
175 return 0;
176
177 // distance
178 float distDiff = pAttackType.m_Distance - pTargetDistance;
179 if (distDiff < 0)
180 return 0;
181
182 float distDiffFrac = distDiff / 10;
183 float utilityDistance = (1 - distDiffFrac) * 100; // distance is most important
184
185 // probability
186 float probDiff = pAttackType.m_Probability - pProbability;
187 if (probDiff < 0)
188 return 0;
189
190 float utilityProbability = (1 - probDiff) * 10; // distance is most important
191
192 // total
194 //Print("Attack Utility " + util);
195
196 return util;
197 }

Используется в ChooseAttack().

◆ GetAttackGroup()

array< ref DayZInfectedAttackType > GetAttackGroup ( DayZInfectedAttackGroupType pType)
protected
200 {
201 switch (pType)
202 {
204 return m_ChaseAttacksGroup;
205
207 return m_FightAttacksGroup;
208 }
209
210 return NULL;
211 }
ref array< ref DayZInfectedAttackType > m_ChaseAttacksGroup
selected & sorted targets by utility function
Definition DayZInfectedType.c:218
ref array< ref DayZInfectedAttackType > m_FightAttacksGroup
Definition DayZInfectedType.c:219
DayZInfectedAttackGroupType
Definition DayZInfectedType.c:14

Перекрестные ссылки m_ChaseAttacksGroup и m_FightAttacksGroup.

Используется в ChooseAttack() и RegisterAttack().

◆ GetDefaultHitComponent()

string GetDefaultHitComponent ( )
137 {
139 }
string m_DefaultHitComponent
Definition DayZInfectedType.c:223

Перекрестные ссылки m_DefaultHitComponent.

◆ GetDefaultHitPositionComponent()

string GetDefaultHitPositionComponent ( )
142 {
144 }
string m_DefaultHitPositionComponent
Definition DayZInfectedType.c:224

Перекрестные ссылки m_DefaultHitPositionComponent.

◆ GetHitComponentForAI()

string GetHitComponentForAI ( )
125 {
126 string hitComp;
127
129 {
130 return hitComp;
131 }
132
133 return GetDefaultHitComponent();
134 }
ref array< ref DayZAIHitComponent > m_HitComponentsForAI
Melee hit components (AI targeting)
Definition DayZInfectedType.c:222
string GetDefaultHitComponent()
Definition DayZInfectedType.c:136
Definition DayZAIHitComponents.c:9
static bool SelectMostProbableHitComponent(array< ref DayZAIHitComponent > pHitComponents, out string pHitComponent)
Definition DayZAIHitComponents.c:40

Перекрестные ссылки GetDefaultHitComponent(), m_HitComponentsForAI и DayZAIHitComponentHelpers::SelectMostProbableHitComponent().

◆ GetSuitableFinisherHitComponents()

array< string > GetSuitableFinisherHitComponents ( )
147 {
149 }
ref array< string > m_SuitableFinisherHitComponents
Definition DayZInfectedType.c:225

Перекрестные ссылки m_SuitableFinisherHitComponents.

◆ RegisterAttack()

void RegisterAttack ( DayZInfectedAttackGroupType pAttackGroupType,
float pDistance,
int pPitch,
int pType,
float pSubtype,
string pAmmoType,
int pIsHeavy,
float pCooldown,
float pProbability )
protected
156 {
158
159 newType.m_Distance = pDistance;
160 newType.m_Pitch = pPitch;
161 newType.m_Type = pType; //If attack is left or right
162 newType.m_Subtype = pSubtype; //If attack is center, down, up or run
163 newType.m_AmmoType = pAmmoType;
164 newType.m_IsHeavy = pIsHeavy;
165 newType.m_Cooldown = pCooldown;
166 newType.m_Probability = pProbability;
167
169 }

Перекрестные ссылки GetAttackGroup().

Используется в RegisterAttacks().

◆ RegisterAttacks()

void RegisterAttacks ( )

RegisterAttack(Group Type, Distance, Pitch, Type, Subtype, AmmoType, heavyFlag, Cooldown, Probability);


chase group

center attack


fight group

up attack

center attack

down attack

50 {
56
57 string lightAttPath = string.Format("cfgVehicles %1 AttackActions AttackShort ammoType", GetName());
58 string heavyAttPath = string.Format("cfgVehicles %1 AttackActions AttackLong ammoType", GetName());
59 string chaseAttPath = string.Format("cfgVehicles %1 AttackActions AttackRun ammoType", GetName());
60
61 string lightAttAmmo;
62 GetGame().ConfigGetText(lightAttPath, lightAttAmmo);
63 string heavyAttAmmo;
64 GetGame().ConfigGetText(heavyAttPath, heavyAttAmmo);
65 string chaseAttAmmo;
66 GetGame().ConfigGetText(chaseAttPath, chaseAttAmmo);
67
70
72 RegisterAttack(DayZInfectedAttackGroupType.CHASE, /*3.0*/2.4, -1, 0, 1, chaseAttAmmo, 0, 0.3, 1.0); // center left & light
73 RegisterAttack(DayZInfectedAttackGroupType.CHASE, /*3.0*/2.4, -1, 1, 1, chaseAttAmmo, 0, 0.4, 1.0); // center right & light
74
78
80 RegisterAttack(DayZInfectedAttackGroupType.FIGHT, /*2.0*/1.7, 1, 0, 0, lightAttAmmo, 0, 0.3, 0.7); // up left & light
81 RegisterAttack(DayZInfectedAttackGroupType.FIGHT, /*2.0*/1.7, 1, 1, 0, lightAttAmmo, 0, 0.4, 0.7); // up right & light
82
84 RegisterAttack(DayZInfectedAttackGroupType.FIGHT, /*2.0*/1.7, 0, 0, 1, lightAttAmmo, 0, 0.1, 0.9); // center left & light
85 RegisterAttack(DayZInfectedAttackGroupType.FIGHT, /*2.0*/1.7, 0, 1, 1, lightAttAmmo, 0, 0.2, 0.9); // center right & light
86 RegisterAttack(DayZInfectedAttackGroupType.FIGHT, /*2.5*/1.4, 0, 2, 1, heavyAttAmmo, 0/*1*/, 0.3, 0.6); // center left & heavy
87 RegisterAttack(DayZInfectedAttackGroupType.FIGHT, /*2.5*/1.4, 0, 3, 1, heavyAttAmmo, 0/*1*/, 0.4, 0.6); // center right & heavy
88
90 RegisterAttack(DayZInfectedAttackGroupType.FIGHT, /*2.0*/1.7, -1, 0, 2, lightAttAmmo, 0, 0.2, 0.5); // down left & light
91 RegisterAttack(DayZInfectedAttackGroupType.FIGHT, /*2.0*/1.7, -1, 1, 2, lightAttAmmo, 0, 0.3, 0.4); // down right & light
92 RegisterAttack(DayZInfectedAttackGroupType.FIGHT, /*2.5*/1.4, -1, 2, 2, heavyAttAmmo, 0/*1*/, 0.5, 0.8); // down left & heavy
93 RegisterAttack(DayZInfectedAttackGroupType.FIGHT, /*2.5*/1.4, -1, 3, 2, heavyAttAmmo, 0/*1*/, 0.6, 0.8); // down right & heavy
94 }
void RegisterAttack(DayZInfectedAttackGroupType pAttackGroupType, float pDistance, int pPitch, int pType, float pSubtype, string pAmmoType, int pIsHeavy, float pCooldown, float pProbability)
Definition DayZInfectedType.c:155
proto native CGame GetGame()
proto native owned string GetName()
Definition SyncedValue.c:117

Перекрестные ссылки GetGame(), GetName(), m_ChaseAttacksGroup, m_FightAttacksGroup и RegisterAttack().

◆ RegisterHitComponentsForAI()

enum DayZInfectedAttackGroupType RegisterHitComponentsForAI ( )

register hit components for AI melee (used by attacking AI)

registers default hit compoent for the entity

registers default hit position component for entity

list of components suitable for melee finisher attacks (used in fight logic)

register hit components that are selected by probability

26 {
28
30 m_DefaultHitComponent = "Torso";
33
38 m_SuitableFinisherHitComponents.Insert("Torso");
39
47 }
static void RegisterHitComponent(array< ref DayZAIHitComponent > pHitComponents, string pName, float pWeight)
Register Hit Component for AI targeting.
Definition DayZAIHitComponents.c:21

Переменные

◆ CHASE

CHASE

◆ FIGHT

FIGHT

◆ m_ChaseAttacksGroup

ref array<ref DayZInfectedAttackType> m_ChaseAttacksGroup
private

selected & sorted targets by utility function

Используется в GetAttackGroup() и RegisterAttacks().

◆ m_DefaultHitComponent

string m_DefaultHitComponent
protected

◆ m_DefaultHitPositionComponent

string m_DefaultHitPositionComponent
protected

◆ m_FightAttacksGroup

ref array<ref DayZInfectedAttackType> m_FightAttacksGroup
private

Используется в GetAttackGroup() и RegisterAttacks().

◆ m_HitComponentsForAI

ref array<ref DayZAIHitComponent> m_HitComponentsForAI
protected

Melee hit components (AI targeting)

◆ m_SuitableFinisherHitComponents

ref array<string> m_SuitableFinisherHitComponents
protected