inset_pos in range refactor

This commit is contained in:
ethan merchant 2024-11-08 21:56:48 -05:00
parent 9914948a50
commit 59c0d5ee4d

View file

@ -90,26 +90,12 @@ static class Mono
} }
XYZi next_pos = snake[0] + snake_dir; XYZi next_pos = snake[0] + snake_dir;
bool around_box = false; XYZi inset_pos = new(
for (int i = 0; i < directions.Length; i++) next_pos.x - Maths.sign(next_pos.x),
{ next_pos.y - Maths.sign(next_pos.y),
if (s_array.InRange(next_pos + directions[i])) next_pos.z - Maths.sign(next_pos.z)
{ );
around_box = true; bool around_box = s_array.InRange(inset_pos);
break;
}
}
if (!around_box)
{
for (int i = 0; i < corners.Length; i++)
{
if (s_array.InRange(next_pos + corners[i]))
{
around_box = true;
break;
}
}
}
if (!around_box) if (!around_box)
{ {
return; return;