forked from 2009Scape/Server
GetNearestEntity fixgit statusgit statusgit statusgit statusgit statusgit status
This commit is contained in:
parent
4f6a431f65
commit
ee5b8deacc
3 changed files with 6 additions and 4 deletions
|
|
@ -27,7 +27,7 @@ public class GeneralBotCreator {
|
|||
AIPlayer.deregister(bot.getUid());
|
||||
return true;
|
||||
}
|
||||
System.out.println("Running script");
|
||||
|
||||
if (!bot.getPulseManager().hasPulseRunning())
|
||||
{
|
||||
botScript.runLoop();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue