Experiment with a different map
All checks were successful
Build & Test / nix-build (push) Successful in 1m29s
All checks were successful
Build & Test / nix-build (push) Successful in 1m29s
This commit is contained in:
parent
eff1ff0a5e
commit
1e7cc32af7
@ -18,7 +18,7 @@ defmodule Example.Game do
|
||||
@impl true
|
||||
@spec player_position(any(), {any(), any(), any()}, any()) :: :ok
|
||||
def player_position(from, {x, y, z}, _refs) do
|
||||
# Logger.info("Player at #{inspect(from)} moved to #{x}, #{y}, #{z}")
|
||||
Logger.info("Player at #{inspect(from)} moved to #{x}, #{y}, #{z}")
|
||||
send(from, {:set_position, {x, y, z}})
|
||||
:ok
|
||||
end
|
||||
@ -41,13 +41,16 @@ defmodule Example.Game do
|
||||
end
|
||||
|
||||
@impl true
|
||||
def chunk(_from, {_cx, _cz}, _state_refs) do
|
||||
def chunk(_from, {cx, cz}, _state_refs) do
|
||||
# Logger.info("Player at #{inspect(from)} wants to know chunk #{cx}, #{cz}")
|
||||
(0..255) |> Enum.map(fn y ->
|
||||
(0..15) |> Enum.map(fn z ->
|
||||
(0..15) |> Enum.map(fn x ->
|
||||
if y <= x + z do
|
||||
3
|
||||
gx = cx*16 + x
|
||||
gz = cz*16 + z
|
||||
gy = y
|
||||
if rem(gx, 4) == 0 && rem(gy, 4) == 0 && rem(gz, 4) == 0 do
|
||||
1
|
||||
else
|
||||
0
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user