mwg API
    Preparing search index...

    Class Blob

    Index
    height: number
    width: number
    • every cell holding at least minimum - the cells a game applies its effect on

      Parameters

      • minimum: number

      Returns { volume: number; x: number; y: number }[]

    • zeroes whatever sits on (x, y), leaving its neighbours alone; off-map is a no-op

      Parameters

      • x: number
      • y: number

      Returns void

    • adds amount to whatever is already on (x, y); off-map is a no-op

      Parameters

      • x: number
      • y: number
      • amount: number

      Returns void

    • One diffusion step: every cell shares spread of its volume equally among its open 4-neighbours (a cell with no open neighbour keeps it all), then every cell keeps only decay of what it ends up with. decay: 1 conserves volume and only moves it around; anything lower thins the effect out over time. open(x, y) decides whether the effect may cross into a cell, so the caller chooses what blocks it.

      Returns the cells this step emptied, in reading order: those holding a volume before the step and none after it. That is the moment a game turns the grass under a fire to embers, and reporting it here saves the game diffing cellsAbove between two steps to notice.

      Parameters

      • open: (x: number, y: number) => boolean
      • spread: number = 0.25
      • decay: number = 0.9

      Returns { x: number; y: number }[]

    • Returns { height: number; volume: number[]; width: number }

    • the total volume across the whole map - useful for "has it burned out yet"

      Returns number

    • how much effect sits on (x, y) right now; 0 off-map

      Parameters

      • x: number
      • y: number

      Returns number

    • Parameters

      • data: { height: number; volume: number[]; width: number }

      Returns Blob