From 8323707d3a2945f8fbd4d4e925a04d1eb6f0a3b7 Mon Sep 17 00:00:00 2001 From: sanine Date: Sat, 11 Nov 2023 14:14:30 -0600 Subject: prevent movement when frozen and allow seeing past the lattice edge --- src/simulation/senses.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/simulation/senses.js') diff --git a/src/simulation/senses.js b/src/simulation/senses.js index d3e7c1e..9cc6c41 100644 --- a/src/simulation/senses.js +++ b/src/simulation/senses.js @@ -99,8 +99,9 @@ function vision_idx_to_world_pos(world, agent, idx) { function see_cell(world, x, y) { const team = 0; const orientation = 0; - if (!world.lattice[y][x]) { - throw new Error(`${x}, ${y}`); + if (!world.lattice[y] || !world.lattice[y][x]) { + // beyond the map edge + return [ 0, 0, 0 ]; } const type = { active: -0.8, -- cgit v1.2.1