Documentation ¶
Index ¶
- Constants
- Variables
- func DistanceFromMe(d game.Data, p data.Position) int
- func DistanceFromPoint(from data.Position, to data.Position) int
- func FindFirstWalkable(from data.Position, areaOriginPos data.Position, grid [][]bool, radius int) (int, int)
- func IsNarrowMap(a area.ID) bool
- func IsWalkable(pos data.Position, areaOriginPos data.Position, collisionGrid [][]bool) bool
- func LineOfSight(d game.Data, origin data.Position, destination data.Position) bool
- type PathFinder
- func (pf *PathFinder) GameCoordsToScreenCords(playerX, playerY, destinationX, destinationY int) (int, int)
- func (pf *PathFinder) GetClosestWalkablePath(d game.Data, dest data.Position, blacklistedCoords ...[2]int) (path Pather, distance int, found bool)
- func (pf *PathFinder) GetPath(d game.Data, to data.Position, blacklistedCoords ...[2]int) (path Pather, distance int, found bool)
- func (pf *PathFinder) GetWalkableRooms(d game.Data) []data.Position
- func (pf *PathFinder) MoveCharacter(d game.Data, x, y int)
- func (pf *PathFinder) MoveThroughPath(d game.Data, p Pather, distance int)
- func (pf *PathFinder) RandomMovement(d game.Data)
- type Pather
- type Tile
- type World
Constants ¶
View Source
const ( // KindPlain (.) is a plain tile with a movement cost of 1. KindPlain uint8 = iota // KindSoftBlocker (S) is a tile to fake some blocking areas with increased cost of moving, like Arcane Sanctuary platforms KindSoftBlocker // KindBlocker (X) is a tile which blocks movement. KindBlocker )
Kind* constants refer to tile kinds for input and output.
Variables ¶
View Source
var KindCosts = map[uint8]float64{ KindPlain: 1.0, KindSoftBlocker: 1000, }
KindCosts map tile kinds to movement costs.
Functions ¶
func FindFirstWalkable ¶ added in v0.4.0
func FindFirstWalkable(from data.Position, areaOriginPos data.Position, grid [][]bool, radius int) (int, int)
FindFirstWalkable finds the first walkable position from a given position and radius
func IsNarrowMap ¶ added in v0.3.0
func IsWalkable ¶ added in v0.4.0
Types ¶
type PathFinder ¶ added in v0.4.0
type PathFinder struct {
// contains filtered or unexported fields
}
func NewPathFinder ¶ added in v0.4.0
func NewPathFinder(gr *game.MemoryReader, hid *game.HID, cfg *config.CharacterCfg) *PathFinder
func (*PathFinder) GameCoordsToScreenCords ¶ added in v0.4.0
func (pf *PathFinder) GameCoordsToScreenCords(playerX, playerY, destinationX, destinationY int) (int, int)
func (*PathFinder) GetClosestWalkablePath ¶ added in v0.4.0
func (*PathFinder) GetPath ¶ added in v0.4.0
func (pf *PathFinder) GetPath(d game.Data, to data.Position, blacklistedCoords ...[2]int) (path Pather, distance int, found bool)
The GetPath method definition, combined and corrected
func (*PathFinder) GetWalkableRooms ¶ added in v0.5.0
func (pf *PathFinder) GetWalkableRooms(d game.Data) []data.Position
func (*PathFinder) MoveCharacter ¶ added in v0.4.0
func (pf *PathFinder) MoveCharacter(d game.Data, x, y int)
func (*PathFinder) MoveThroughPath ¶ added in v0.4.0
func (pf *PathFinder) MoveThroughPath(d game.Data, p Pather, distance int)
func (*PathFinder) RandomMovement ¶ added in v0.4.0
func (pf *PathFinder) RandomMovement(d game.Data)
type Tile ¶
A Tile is a tile in a grid which implements Pather.
func (*Tile) PathEstimatedCost ¶
PathEstimatedCost uses Manhattan distance to estimate orthogonal distance between non-adjacent nodes.
func (*Tile) PathNeighborCost ¶
PathNeighborCost returns the movement cost of the directly neighboring tile.
func (*Tile) PathNeighbors ¶
func (t *Tile) PathNeighbors() []astar.Pather
PathNeighbors returns the neighbors of the tile, excluding blockers and tiles off the edge of the board.
Click to show internal directories.
Click to hide internal directories.