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;
bool around_box = false;
for (int i = 0; i < directions.Length; i++)
{
if (s_array.InRange(next_pos + directions[i]))
{
around_box = true;
break;
}
}
if (!around_box)
{
for (int i = 0; i < corners.Length; i++)
{
if (s_array.InRange(next_pos + corners[i]))
{
around_box = true;
break;
}
}
}
XYZi inset_pos = new(
next_pos.x - Maths.sign(next_pos.x),
next_pos.y - Maths.sign(next_pos.y),
next_pos.z - Maths.sign(next_pos.z)
);
bool around_box = s_array.InRange(inset_pos);
if (!around_box)
{
return;