0
0
Fork 0
mirror of https://github.com/Sanae6/SmoOnlineServer.git synced 2024-11-25 04:35:18 +00:00

Actually broadcast instead of sending to only one person

This commit is contained in:
Sanae 2022-03-31 16:21:20 -06:00
parent 6224234272
commit 886b57f16a

View file

@ -260,15 +260,15 @@ CommandHandler.RegisterCommand("tag", args => {
await Task.Delay(realTime); await Task.Delay(realTime);
await Task.WhenAll( await Task.WhenAll(
Parallel.ForEachAsync(seekers, async (seeker, _) => Parallel.ForEachAsync(seekers, async (seeker, _) =>
await seeker.Send(new TagPacket { await server.Broadcast(new TagPacket {
UpdateType = TagPacket.TagUpdate.State, UpdateType = TagPacket.TagUpdate.State,
IsIt = true IsIt = true
})), }, seeker)),
Parallel.ForEachAsync(server.Clients.Except(seekers), async (hider, _) => Parallel.ForEachAsync(server.Clients.Except(seekers), async (hider, _) =>
await hider.Send(new TagPacket { await server.Broadcast(new TagPacket {
UpdateType = TagPacket.TagUpdate.State, UpdateType = TagPacket.TagUpdate.State,
IsIt = false IsIt = false
}) }, hider)
) )
); );
consoleLogger.Info($"Started game with seekers {string.Join(", ", seekerNames)}"); consoleLogger.Info($"Started game with seekers {string.Join(", ", seekerNames)}");