From 85e603d08285b234a98b45b24ca81fd7baba98f5 Mon Sep 17 00:00:00 2001 From: Joseph Manley Date: Fri, 21 Aug 2020 02:18:58 -0400 Subject: [PATCH] Send intial player data --- server/plugin/control/control.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/plugin/control/control.go b/server/plugin/control/control.go index babd87b..216b870 100644 --- a/server/plugin/control/control.go +++ b/server/plugin/control/control.go @@ -108,6 +108,16 @@ func (m *Match) MatchJoin(ctx context.Context, logger runtime.Logger, db *sql.DB logger.Error(sendErr.Error()) } } + for _, player := range mState.players { + // Broadcast player data to client + if jsonObj, err := player.GetPosJSON(); err != nil { + logger.Error(err.Error()) + } else { + if sendErr := dispatcher.BroadcastMessage(OpCodeTileUpdate, jsonObj, []runtime.Presence{precense}, player.Presence, true); sendErr != nil { + logger.Error(sendErr.Error()) + } + } + } } return mState }