export const BLOCK_SIZE = 64 // each block is 64̨̣̌̇x64 pixel in size and equals 1m
export const RECIPROCAL = 1 / BLOCK_SIZE

export const STAGE_WIDTH = 20 // 20*64 = 1280 pixel wide stage
// export const STAGE_HEIGHT = ~~(STAGE_WIDTH * 0.5625) // 16:9 😎
export const STAGE_HEIGHT = 12 // 12*64 = 768 pixel high stage

export const GRAVITY = 10 // blocks per second

export type Block = {
  type: string,
  hp: number,
  walkable: boolean,
  climbable?: boolean,
  transparent?: boolean,
}

export const blockTypes: Record<string, Block> = {
  air: { type: 'air', hp: Infinity, walkable: true, transparent: true },
  grass: { type: 'grass', hp: 1, walkable: false },

  treeCrown: { type: 'treeCrown', hp: 5, walkable: true, transparent: true },
  treeLeaves: { type: 'treeLeaves', hp: 5, walkable: true, transparent: true },
  treeTrunk: { type: 'treeTrunk', hp: 15, walkable: true, climbable: true, transparent: true },
  treeRoot: { type: 'treeRoot', hp: 15, walkable: true, climbable: true },

  soil: { type: 'soil', hp: 2, walkable: false },
  soilGravel: { type: 'soilGravel', hp: 5, walkable: false },
  stoneGravel: { type: 'stoneGravel', hp: 5, walkable: false },
  stone: { type: 'stone', hp: 10, walkable: false },
  bedrock: { type: 'bedrock', hp: 25, walkable: false },
  cave: { type: 'cave', hp: Infinity, walkable: true, transparent: true },
}

export const level = {
  treeTop: 9,
  ground: 14,
  rock: 16,
  underground: 24,
  caveMax: 250,
}

export const probability = {
  tree: 0.3,
  soilHole: 0.3,
  soilGravel: 0.2,
  stoneGravel: 0.1,
  cave: 0.5,
  fray: 0.4,
}
