Actually listen to the joinable? function
Some checks failed
Build & Test / nix-build (push) Failing after 27s

This commit is contained in:
Kodi Craft 2024-09-04 11:24:04 +02:00
parent 8ae0c08e8d
commit d63bd0a9b2
Signed by: kodi
GPG Key ID: 69D9EED60B242822
2 changed files with 6 additions and 1 deletions

View File

@ -96,7 +96,7 @@ defmodule Amethyst.GameCoordinator do
end end
defp _find(type, state) do defp _find(type, state) do
case state.games |> Enum.find(fn {_, game} -> game.mod == type end) do case state.games |> Enum.find(fn {_, game} -> game.mod == type && game[:mod].joinable?(game[:refs]) end) do
nil -> {nil, state} nil -> {nil, state}
{_, game} -> {game, state} {_, game} -> {game, state}
end end

View File

@ -20,4 +20,9 @@ defmodule Example.Game do
Logger.info("Player at #{inspect(from)} moved to #{x}, #{y}, #{z}") Logger.info("Player at #{inspect(from)} moved to #{x}, #{y}, #{z}")
:ok :ok
end end
@impl true
def joinable?(refs) do
true
end
end end