MinchinWeb's MetaLibrary v.11
Library functions for OpenTTD AI (and GS) writers.
|
Spiral Walker. More...
Public Member Functions | |
function | Start (Tile) |
Sets the starting tile for SpiralWalker. | |
function | Reset () |
Resets the variables for the SpiralWalker. | |
function | Restart () |
Moves the SpiralWalker to the original starting position. | |
function | Walk () |
'Walks' the SpiralWalker one tile at a tile | |
function | GetStart () |
Returns the tile the SpiralWalker is starting on. | |
function | GetStage () |
Returns the Stage the SpiralWalker is on. | |
function | GetTile () |
Returns the Tile the SpiralWalker is on. | |
function | GetStep () |
Returns the number of steps the SpiralWalker has done. |
Private Member Functions | |
constructor () |
Private Attributes | |
_start = null | |
start tile | |
_start_x = null | |
x value of start tile | |
_start_y = null | |
y value of start tile | |
_x = null | |
x value of current tile | |
_y = null | |
y value of current tile | |
_current_tile = null | |
current tile | |
_dx = null | |
_dy = null | |
_Steps = null | |
see GetStep() | |
_Stage = null | |
see GetStage() | |
_StageMax = null | |
_StageSteps = null |
Spiral Walker.
The SpiralWalker class allows you to define a starting point, and then 'walk' all the tiles in a spiral outward. It was originally used to find a build-able spot for my HQ in WmDOT, but is useful for many other things as well.
add image showing the walk out pattern
cap at map bounds
Definition at line 45 of file Spiral.Walker.nut.
|
inlineprivate |
Definition at line 59 of file Spiral.Walker.nut.
|
inline |
Returns the Stage the SpiralWalker is on.
Basically, the line segments its completed plus one; it takes four stages to complete a revolution.
Definition at line 105 of file Spiral.Walker.nut.
|
inline |
Returns the tile the SpiralWalker is starting on.
Definition at line 95 of file Spiral.Walker.nut.
|
inline |
Returns the number of steps the SpiralWalker has done.
Definition at line 119 of file Spiral.Walker.nut.
|
inline |
Returns the Tile the SpiralWalker is on.
Definition at line 112 of file Spiral.Walker.nut.
function _MinchinWeb_SW_::Reset | ( | ) |
Resets the variables for the SpiralWalker.
Definition at line 140 of file Spiral.Walker.nut.
function _MinchinWeb_SW_::Restart | ( | ) |
Moves the SpiralWalker to the original starting position.
Definition at line 149 of file Spiral.Walker.nut.
function _MinchinWeb_SW_::Start | ( | Tile | ) |
Sets the starting tile for SpiralWalker.
Definition at line 124 of file Spiral.Walker.nut.
function _MinchinWeb_SW_::Walk | ( | ) |
'Walks' the SpiralWalker one tile at a tile
Definition at line 162 of file Spiral.Walker.nut.
|
private |
current tile
Definition at line 51 of file Spiral.Walker.nut.
|
private |
Definition at line 52 of file Spiral.Walker.nut.
|
private |
Definition at line 53 of file Spiral.Walker.nut.
|
private |
see GetStage()
Definition at line 55 of file Spiral.Walker.nut.
|
private |
Definition at line 56 of file Spiral.Walker.nut.
|
private |
Definition at line 57 of file Spiral.Walker.nut.
|
private |
start tile
Definition at line 46 of file Spiral.Walker.nut.
|
private |
x value of start tile
Definition at line 47 of file Spiral.Walker.nut.
|
private |
y value of start tile
Definition at line 48 of file Spiral.Walker.nut.
|
private |
see GetStep()
Definition at line 54 of file Spiral.Walker.nut.
|
private |
x value of current tile
Definition at line 49 of file Spiral.Walker.nut.
|
private |
y value of current tile
Definition at line 50 of file Spiral.Walker.nut.