DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл Bot_Hunt.c

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

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

class  BotEventHuntedTargetInSight
 
class  BotEventHuntedTargetLost
 
class  BotStateBase
 represent weapon state base Подробнее...
 

Функции

Man BotSelectNearestTarget (EntityAI bot)
 

Функции

◆ BotSelectNearestTarget()

Man BotSelectNearestTarget ( EntityAI bot)
196{
197 /*ref array<Man> players = new array<Man>;
198 g_Game.GetWorld().GetPlayerList( players );
199
200 bool minimal_distance_ok = true;
201
202 float min_dist = 1234567.0;
203 int min_index = -1;
204 for ( int i = 0; i < players.Count(); i++ )
205 {
206 float d = vector.Distance(players.Get(i).GetPosition(), bot.GetPosition());
207 if ( d < min_dist )
208 {
209 min_dist = d;
210 min_index = i;
211 }
212 }
213
214 if (min_index != -1)
215 return players.Get(min_index);
216
217 return null;*/
218 vector pos = bot.GetPosition();
219 //vector dir = player.GetDirection();
220
223 GetGame().GetObjectsAtPosition(pos, 100.0, objects, proxyCargos);
224
225 float min_dist = 1234567.0;
226 int min_index = -1;
227 int c = objects.Count();
228 for (int i = 0; i < c; i++)
229 {
230 Object o = objects[i];
231 if (o == bot)
232 continue;
233
234 float d = vector.Distance(o.GetPosition(), bot.GetPosition());
235 if ( d < min_dist )
236 {
237 min_dist = d;
238 min_index = i;
239 }
240 }
241
242 if (min_index != -1)
243 {
244 botDebugPrint("[bot] + " + bot + " BotSelectNearestTarget idx=" + min_index + " dist=" + min_dist + " obj=" + o);
245 return Man.Cast( objects.Get(min_index) );
246 }
247 return null;
248}
void botDebugPrint(string s)
Definition Bot.c:122
Definition ObjectTyped.c:2
Definition EntityAI.c:95
Definition EnConvert.c:106
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()

Перекрестные ссылки botDebugPrint(), vector::Distance() и GetGame().

Используется в BotStateBase::SelectTarget().