Package horizons :: Package util :: Package pathfinding :: Module pathnodes :: Class IslandPathNodes
[hide private]
[frames] | no frames]

Class IslandPathNodes

source code

PathNodes --+
            |
           IslandPathNodes

List of path nodes for island Interface: self.nodes: List of nodes on island, where the terrain allows to be walked on self.road_nodes: dictionary of nodes, where a road is built on

(un)register_road has to be called for each coord, where a road is built on (destroyed) reset_tile_walkablity has to be called when the terrain changes the walkability (e.g. building construction, a flood, or whatever) is_walkable rechecks the walkability status of a coordinate

Instance Methods [hide private]
 
__init__(self, island) source code
 
register_road(self, road) source code
 
unregister_road(self, road) source code
 
is_road(self, x, y)
Return if there is a road on (x, y)
source code
 
is_walkable(self, coord)
Check if a unit may walk on the tile specified by coord on land...
source code
 
reset_tile_walkability(self, coord)
Reset the status of the walkability of a coordinate in the list of walkable tiles of the island.
source code
Class Variables [hide private]
    Inherited from PathNodes
  NODE_DEFAULT_SPEED = 1.0
  log = logging.getLogger("world.pathfinding")
Method Details [hide private]

__init__(self, island)
(Constructor)

source code 
Overrides: PathNodes.__init__

is_walkable(self, coord)

source code 
Check if a unit may walk on the tile specified by coord on land
NOTE: nature tiles (trees..) are considered to be walkable (or else they could be used as
      walls against enemies)
@param coord: tuple: (x, y)

reset_tile_walkability(self, coord)

source code 

Reset the status of the walkability of a coordinate in the list of walkable tiles of the island. Does not change the tile itself. You need to call this when a tile changes, e.g. when a building is built on it. this is currently done in add/remove_building

Parameters:
  • coord - tuple: (x, y)