porymap icon indicating copy to clipboard operation
porymap copied to clipboard

Add rawValue overload of setBlock, handle all possible collision values

Open GriffinRichards opened this issue 1 year ago • 0 comments

  • Collision is a 2 bit value, and setBlock / setCollision allow users to assign any value in this range. Porymap incorrectly renders collisions of 2 or 3 as the entire collision/elevation image. The games treat any nonzero collision value as "impassable," and now so does Porymap.
  • Adds an overload of setBlock that takes the raw value given by getBlock or onBlockChanged, so you could more easily for instance disable drawing by doing:
export function onBlockChanged(x, y, prevBlock, newBlock) {
    if (prevBlock.rawValue != newBlock.rawValue)
        map.setBlock(x, y, prevBlock.rawValue);
}

GriffinRichards avatar Aug 03 '22 19:08 GriffinRichards