function randInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min)) + min; } const grassTiles = [0x8, 0x9, 0x10, 0x11]; // Porymap callback when a block is painted. export function on_block_changed(x, y, prevBlock, newBlock) { try { // if (grassTiles.indexOf(newBlock.tile) != -1) { // const i = randInt(0, grassTiles.length); // map.setBlock(x, y, grassTiles[i], newBlock.collision, newBlock.elevation); // } console.log("ran", map.getWidth(), map.getHeight()); } catch(err) { console.log(err); } }