From 5dcf50446e98a91de5da01a4a39a3dd7fc59e5a3 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Sun, 1 Nov 2020 04:48:40 +0000 Subject: [PATCH] show other people when they spawn --- internal/server/sim/player.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/server/sim/player.go b/internal/server/sim/player.go index ce1add2..cb9b9b1 100644 --- a/internal/server/sim/player.go +++ b/internal/server/sim/player.go @@ -53,7 +53,7 @@ type SpawnPlayer struct { var lastEntityID = 0 -func (s *SpawnPlayer) exec(r *room, _ *player, seq int) result { +func (s *SpawnPlayer) exec(r *room, p *player, seq int) result { if !s.queued { r.Info("spawn player requested for: %s", s.Name) @@ -108,7 +108,14 @@ func (s *SpawnPlayer) exec(r *room, _ *player, seq int) result { Room: r.name, } } - return result{reply: welcome} + return result{ + reply: welcome, + announce: wire.Entity{ + ID: p.avatar.ID, + Position: p.avatar.Position, + Glyph: p.avatar.Glyph, + }, + } } func (SpawnPlayer) NetTag() string { return "player/spawn" }