Advertisement
jkpker

First Woodcutter script v2

Jun 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. public RSTile getNewPosition() {//
  2. RSArea areaPlayer = new RSArea(Player.getPosition(), 1);
  3. ArrayList<RSTile> usableTiles = new ArrayList<RSTile>();
  4. for (RSTile tile : areaPlayer.getAllTiles()) {
  5. if (!PathFinding.isTileWalkable(tile))
  6. continue; // The player is unable to walk here. Do not add this tile to the usable tiles
  7. // list.
  8. RSObject[] objects = Objects.getAt(tile);
  9. if (objects.length > 0) {
  10. for (int i = 0; i < objects.length; i++) {
  11. RSObjectDefinition def = objects[i].getDefinition();
  12. if (def != null) {
  13. String name = def.getName();
  14. if (name != null)
  15. if (!name.equals("null")) // If the object has an actual name, other than "null" (fungus,
  16. // flowers etc.)
  17. continue; // This tile is not usable. Do not add it to the usable tiles list.
  18. }
  19. }
  20. // Objects found on the tile, but they are named "null" and they are
  21. // non-interactable
  22. usableTiles.add(tile); // This tile is usable and can be added to the
  23. } else {
  24. // No objects found on the tile. This tile is usable and can be added to the
  25. // list.
  26. usableTiles.add(tile);
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement