196{
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218 vector pos = bot.GetPosition();
219
220
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 {
231 if (o == bot)
232 continue;
233
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)
proto native void GetObjectsAtPosition(vector pos, float radius, out array< Object > objects, out array< CargoBase > proxyCargos)
Returns list of all objects in circle "radius" around position "pos".
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()