egs_game_server: On exit, don't try to leave the uni if it wasn't entered.
This commit is contained in:
parent
d5178a313e
commit
d043ab4d3d
@ -46,9 +46,14 @@ on_exit(Pid) ->
|
|||||||
psu_party:stop(PartyPid)
|
psu_party:stop(PartyPid)
|
||||||
end,
|
end,
|
||||||
egs_user_model:delete(User#egs_user_model.id),
|
egs_user_model:delete(User#egs_user_model.id),
|
||||||
egs_universes:leave(User#egs_user_model.uni),
|
case User#egs_user_model.uni of
|
||||||
{ok, List} = egs_user_model:select({neighbors, User}),
|
undefined ->
|
||||||
lists:foreach(fun(Other) -> Other#egs_user_model.pid ! {egs, player_unspawn, User} end, List),
|
ignore;
|
||||||
|
UniID ->
|
||||||
|
egs_universes:leave(UniID),
|
||||||
|
{ok, List} = egs_user_model:select({neighbors, User}),
|
||||||
|
lists:foreach(fun(Other) -> Other#egs_user_model.pid ! {egs, player_unspawn, User} end, List)
|
||||||
|
end,
|
||||||
io:format("game (~p): quit~n", [User#egs_user_model.id]);
|
io:format("game (~p): quit~n", [User#egs_user_model.id]);
|
||||||
{error, _Reason} ->
|
{error, _Reason} ->
|
||||||
ignore
|
ignore
|
||||||
|
Loading…
Reference in New Issue
Block a user