i am trying to make bot which mines ore from same place (I used some fleet mining script here). But my two hulks steal each other asteroids, because asteroid is picked firstOrdefault. I need to figure out how to pick random asteroid (which is in range) to by more optimalized.
i found script which pick random item from an array :
T RandomElement(IEnumerable sequence)
{
var array = (sequence as T[]) ?? sequence?.ToArray();
if (!(0 < array?.Length))
return default(T);
return array[RandomInt() % array.Length];
}
but cannot find way to make asteroidOverviewEntryNextNotTargeted to an array (tryed .where but it doesn work)
you have to make the random element to be between 0 and max of (int) index ListAsteroidOverviewEntry
then
var asteroidtotake = ListAsteroidOverviewEntry?.Elemetatordefault (random i)
or since you wanna mine in fleet
mark the asteroid you took with tag ( helped by window fleet window or menu)
and avoid to target marked asteroids; but you have to see if sanderling take tag collumn entry ( better look on raw, dont think is marked the same way like type or name
Thank you very much, but i undestand that i still need somewhat apply that entry: entry => !((entry?.MeTargeted ?? false) || (entry?.MeTargeting ?? false))