This commit is contained in:
parent
acc814a056
commit
9842195b8e
@ -31,6 +31,9 @@ defmodule Amethyst.API.Game do
|
|||||||
`login/3` is called when a new player logs into a game instance.
|
`login/3` is called when a new player logs into a game instance.
|
||||||
You may either :accept or :reject the player for whatever reason, avoid
|
You may either :accept or :reject the player for whatever reason, avoid
|
||||||
rejecting the player in your default game as that will disconnect the player.
|
rejecting the player in your default game as that will disconnect the player.
|
||||||
|
|
||||||
|
Note that if no new players can join for any reason, your game should return false from `joinable?/1`.
|
||||||
|
|
||||||
The PID received in 'from' will be the one that calls all callbacks
|
The PID received in 'from' will be the one that calls all callbacks
|
||||||
caused directly by this player, such as their movement or interactions --
|
caused directly by this player, such as their movement or interactions --
|
||||||
You can expect that PID to never be used by any other player and that this same
|
You can expect that PID to never be used by any other player and that this same
|
||||||
|
@ -13,7 +13,7 @@ defmodule GameCoordinatorTestGame do
|
|||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def login(from, cfg, refs) do
|
def login(from, cfg, refs) do
|
||||||
:ok
|
:accept
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
@ -12,7 +12,7 @@ defmodule Example.Game do
|
|||||||
def login(from, cfg, refs) do
|
def login(from, cfg, refs) do
|
||||||
Logger.info("Player logged in from #{inspect(from)}: #{inspect(cfg)}")
|
Logger.info("Player logged in from #{inspect(from)}: #{inspect(cfg)}")
|
||||||
Logger.info("The refs for this game are #{inspect(refs)}")
|
Logger.info("The refs for this game are #{inspect(refs)}")
|
||||||
:ok
|
:accept
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
|
Loading…
Reference in New Issue
Block a user