Package horizons :: Package util :: Package pathfinding :: Module pather :: Class RoadPather
[hide private]
[frames] | no frames]

Class RoadPather

source code

AbstractPather --+
                 |
                RoadPather

Pather for collectors, that depend on roads (e.g. the one used for the warehouse)

Instance Methods [hide private]
 
__init__(self, unit, *args, **kwargs) source code
 
_get_path_nodes(self)
Returns nodes, where unit can walk on.
source code
    Inherited from AbstractPather
 
_check_for_obstacles(self, point)
Check if the path is unexpectedly blocked by e.g.
source code
 
_get_blocked_coords(self)
Returns blocked coordinates Return value type must be supported by FindPath
source code
 
_get_position(self)
Returns current position considering movement status and being in a building
source code
 
calc_path(self, destination, destination_in_building=False, check_only=False, source=None)
Calculates a path to destination
source code
 
end_move(self)
Pretends that the path is finished in order to make the unit stop
source code
 
get_move_source(self)
Returns the source Point of the current movement.
source code
 
get_move_target(self)
Returns the point where the path leads
source code
 
get_next_step(self)
Returns the next step in the current movement
source code
 
load(self, db, worldid)
Returns: Bool, whether a path was loaded
source code
 
move_on_path(self, path, source=None, destination_in_building=False)
Start moving on a precalculated path.
source code
 
save(self, db, unitid) source code
 
unit(self) source code
Class Variables [hide private]
    Inherited from AbstractPather
  log = logging.getLogger("world.pathfinding")
Method Details [hide private]

__init__(self, unit, *args, **kwargs)
(Constructor)

source code 
Parameters:
  • unit - instance of unit, to which the pather belongs
  • move_diagonal - whether the unit may walk diagonally
  • make_target_walkable - whether we should assume, that we can walk on the tiles that make up the target
Overrides: AbstractPather.__init__
(inherited documentation)

_get_path_nodes(self)

source code 

Returns nodes, where unit can walk on. Return value type must be supported by FindPath

Overrides: AbstractPather._get_path_nodes
(inherited documentation)