Logo FSBarV1_Archived

MapGrid Module

Functions for loading, refreshing, and querying MapGrid data. Provides terrain classification, passability analysis, and active patterns for pattern matching.

Functions and values

Function or value Description

loadFromEngine stream

Full Usage: loadFromEngine stream

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.

Returns: MapGrid A fully populated MapGrid.

Loads all map layers (height, slope, resource, LOS, radar) from the engine and assembles them into a MapGrid record with properly shaped 2D arrays.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

Returns: MapGrid

A fully populated MapGrid.

Exception Thrown if any layer returns empty data or has a dimension mismatch.

passability grid moveType

Full Usage: passability grid moveType

Parameters:
    grid : MapGrid - The map grid containing height and slope data.
    moveType : MoveType - The unit movement type to compute passability for.

Returns: bool[,] A 2D boolean array where true indicates a passable cell.

Computes a boolean passability grid for the given movement type. Each cell is true if the movement type can traverse it, based on slope thresholds and water traversal rules: Kbot (slope < 0.8, no water), Tank (slope < 0.4, no water), Hover (slope < 0.6, can cross water), Ship (water only).

grid : MapGrid

The map grid containing height and slope data.

moveType : MoveType

The unit movement type to compute passability for.

Returns: bool[,]

A 2D boolean array where true indicates a passable cell.

refreshLos stream grid

Full Usage: refreshLos stream grid

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    grid : MapGrid - The existing map grid to update.

Returns: MapGrid A new MapGrid with the LOS layer refreshed.

Refreshes only the line-of-sight layer from the engine, returning an updated grid. Call this each frame to get current visibility data without reloading static layers.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

grid : MapGrid

The existing map grid to update.

Returns: MapGrid

A new MapGrid with the LOS layer refreshed.

refreshRadar stream grid

Full Usage: refreshRadar stream grid

Parameters:
    stream : NetworkStream - Active network stream to the HighBar V2 proxy.
    grid : MapGrid - The existing map grid to update.

Returns: MapGrid A new MapGrid with the radar layer refreshed.

Refreshes only the radar layer from the engine, returning an updated grid. Call this each frame to get current radar coverage without reloading static layers.

stream : NetworkStream

Active network stream to the HighBar V2 proxy.

grid : MapGrid

The existing map grid to update.

Returns: MapGrid

A new MapGrid with the radar layer refreshed.

terrainAt grid x z

Full Usage: terrainAt grid x z

Parameters:
    grid : MapGrid - The map grid containing height and slope data.
    x : int - Heightmap grid X coordinate.
    z : int - Heightmap grid Z coordinate.

Returns: Terrain The Terrain classification for the cell.

Classifies the terrain at a heightmap grid cell based on height and slope. Cells below sea level are Water, cells with slope above 0.6 are Cliff, otherwise Land.

grid : MapGrid

The map grid containing height and slope data.

x : int

Heightmap grid X coordinate.

z : int

Heightmap grid Z coordinate.

Returns: Terrain

The Terrain classification for the cell.

Active patterns

Active pattern Description

(|Land|Water|Cliff|) arg1

Full Usage: (|Land|Water|Cliff|) arg1

Parameters:
Returns: Choice<float32, float32, float32> Land with slope, Water with depth, or Cliff with slope value.

Active pattern that decomposes a Terrain value into Land, Water, or Cliff.

arg0 : Terrain
Returns: Choice<float32, float32, float32>

Land with slope, Water with depth, or Cliff with slope value.

(|Passable|Impassable|) grid moveType x z

Full Usage: (|Passable|Impassable|) grid moveType x z

Parameters:
    grid : MapGrid - The map grid containing height and slope data.
    moveType : MoveType - The unit movement type to check passability for.
    x : int - Heightmap grid X coordinate.
    z : int - Heightmap grid Z coordinate.

Returns: Choice<unit, unit> Passable or Impassable.

Active pattern that checks whether a heightmap cell is passable for a given movement type. Returns Passable if the cell is within bounds and traversable, Impassable otherwise.

grid : MapGrid

The map grid containing height and slope data.

moveType : MoveType

The unit movement type to check passability for.

x : int

Heightmap grid X coordinate.

z : int

Heightmap grid Z coordinate.

Returns: Choice<unit, unit>

Passable or Impassable.

Type something to start searching.