Index: binaries/data/config/default.cfg =================================================================== --- binaries/data/config/default.cfg +++ binaries/data/config/default.cfg @@ -376,6 +376,7 @@ server = "lobby.wildfiregames.com" ; Address of lobby server xpartamupp = "wfgbot22" ; Name of the server-side xmpp client that manage games buddies = "," ; Comma separated list of playernames that the current user has marked as buddies +prefer_buddies = false ; Whether to assign lobby buddies to free playerslots and others to observermode in the gamesetup [lobby.columns] gamerating = false ; Show the average rating of the participating players in a column of the gamelist Index: binaries/data/mods/public/gui/gamesetup/gamesetup.js =================================================================== --- binaries/data/mods/public/gui/gamesetup/gamesetup.js +++ binaries/data/mods/public/gui/gamesetup/gamesetup.js @@ -1279,22 +1279,33 @@ function onClientJoin(newGUID, newAssignments) { + let playername = newAssignments[newGUID].name; + addChatMessage({ "type": "connect", "guid": newGUID, - "username": newAssignments[newGUID].name + "username": playername }); + let isRejoiningPlayer = newAssignments[newGUID].player != -1; + + // Assign the client (or only buddies if prefered) to an unused playerslot and rejoining players to their old slot + if (!isRejoiningPlayer && + playername != newAssignments[Engine.GetPlayerGUID()].name && + Engine.ConfigDB_GetValue("user", "lobby.prefer_buddies") == "true" && + g_Buddies.indexOf(splitRatingFromNick(playername)[0]) == -1) + return; + let freeSlot = g_GameAttributes.settings.PlayerData.findIndex((v,i) => Object.keys(g_PlayerAssignments).every(guid => g_PlayerAssignments[guid].player != i+1) ); // Client is not and cannot become assigned as player - if (newAssignments[newGUID].player == -1 && freeSlot == -1) + if (!isRejoiningPlayer && freeSlot == -1) return; // Assign the joining client to the free slot - if (g_IsController && newAssignments[newGUID].player == -1) + if (g_IsController && !isRejoiningPlayer) Engine.AssignNetworkPlayer(freeSlot + 1, newGUID); resetReadyData(); Index: binaries/data/mods/public/gui/options/options.json =================================================================== --- binaries/data/mods/public/gui/options/options.json +++ binaries/data/mods/public/gui/options/options.json @@ -275,6 +275,12 @@ "label": "Game Rating Column", "tooltip": "Show the average rating of the participating players in a column of the gamelist.", "parameters": { "config": "lobby.columns.gamerating" } + }, + { + "type": "boolean", + "label": "Prefer Buddies", + "tooltip": "Whether to assign lobby buddies to free playerslots and others to observermode in the gamesetup .", + "parameters": { "config": "lobby.prefer_buddies" } } ], "notificationSetting":