Пример #1
0
func AfterLobbyJoin(so *wsevent.Client, lob *lobby.Lobby, player *player.Player) {
	room := fmt.Sprintf("%s_private", GetLobbyRoom(lob.ID))
	//make all sockets join the private room, given the one the player joined the lobby on
	//might close, so lobbyStart and lobbyReadyUp can be sent to other tabs
	sockets, _ := sessions.GetSockets(player.SteamID)
	for _, so := range sockets {
		socket.AuthServer.Join(so, room)
	}
	if lob.State == lobby.InProgress { // player is a substitute
		lob.AfterPlayerNotInGameFunc(player, 5*time.Minute, func() {
			// if player doesn't join game server in 5 minutes,
			// substitute them
			message := player.Alias() + " has been reported for not joining the game within 5 minutes"
			chat.SendNotification(message, int(lob.ID))
			lob.Substitute(player)
		})
	}

	broadcaster.SendMessage(player.SteamID, "lobbyJoined", lobby.DecorateLobbyData(lob, false))
}