amethyst/apps/example_game/lib/example/game.ex
Kodi Craft d63bd0a9b2
Some checks failed
Build & Test / nix-build (push) Failing after 27s
Actually listen to the joinable? function
2024-09-04 11:24:04 +02:00

29 lines
623 B
Elixir

defmodule Example.Game do
require Logger
@behaviour Amethyst.API.Game
@impl true
def instantiate(supervisor) do
Logger.info("The supervisor for this game is at #{inspect(supervisor)}")
{:ok, %{}}
end
@impl true
def login(from, cfg, refs) do
Logger.info("Player logged in from #{inspect(from)}: #{inspect(cfg)}")
Logger.info("The refs for this game are #{inspect(refs)}")
:ok
end
@impl true
def player_position(from, {x, y, z}, refs) do
Logger.info("Player at #{inspect(from)} moved to #{x}, #{y}, #{z}")
:ok
end
@impl true
def joinable?(refs) do
true
end
end