GetNearestEntity fixgit statusgit statusgit statusgit statusgit statusgit status

This commit is contained in:
dginovker 2019-06-09 11:08:07 -04:00
parent 4f6a431f65
commit ee5b8deacc
3 changed files with 6 additions and 4 deletions

View file

@ -27,7 +27,7 @@ public class GeneralBotCreator {
AIPlayer.deregister(bot.getUid());
return true;
}
System.out.println("Running script");
if (!bot.getPulseManager().hasPulseRunning())
{
botScript.runLoop();

View file

@ -26,14 +26,13 @@ public class ScriptAPI {
double minDistance = Double.MAX_VALUE;
for (Node e : RegionManager.forId(me.getLocation().getRegionId()).getPlanes()[me.getLocation().getZ()].getEntities())
{
if (e != null && e.getName().equals(entityName) && distance(me, e) < minDistance && Pathfinder.find(me, e, false, Pathfinder.SMART).isSuccessful())
if (e != null && e.getName().equals(entityName) && distance(me, e) < minDistance && !Pathfinder.find(me, e).isMoveNear())
{
entity = e;
minDistance = distance(me, e);
}
}
System.out.println("Start: " + me.getLocation() + ". End: " + entity.getLocation());
return entity;
}

View file

@ -8,6 +8,9 @@ public class ManThiever extends Script {
public void runLoop() {
Node man = scriptAPI.getNearestEntity(me, "Man");
man.getInteraction().handle(me, man.getInteraction().get(2));
if (man != null)
{
man.getInteraction().handle(me, man.getInteraction().get(2));
}
}
}