Index: ps/trunk/binaries/data/config/default.cfg =================================================================== --- ps/trunk/binaries/data/config/default.cfg +++ ps/trunk/binaries/data/config/default.cfg @@ -332,6 +332,7 @@ [gui.gamesetup] enabletips = true ; Enable/Disable tips during gamesetup (for newcomers) +assignplayers = everyone ; Whether to assign joining clients to free playerslots. Possible values: everyone, buddies, noone. [gui.session] camerajump.threshold = 40 ; How close do we have to be to the actual location in order to jump back to the previous one? Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.js =================================================================== --- ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.js +++ ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.js @@ -1279,22 +1279,35 @@ 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) + { + let assignOption = Engine.ConfigDB_GetValue("user", "gui.gamesetup.assignplayers"); + if (assignOption == "noone" || + assignOption == "buddies" && 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: ps/trunk/binaries/data/mods/public/gui/options/options.json =================================================================== --- ps/trunk/binaries/data/mods/public/gui/options/options.json +++ ps/trunk/binaries/data/mods/public/gui/options/options.json @@ -80,6 +80,19 @@ "parameters": { "config": "persistmatchsettings" } }, { + "type": "dropdown", + "label": "Assign Players", + "tooltip": "Whether to assign joining clients to free playerslots in the gamesetup.", + "parameters": { + "config": "gui.gamesetup.assignplayers", + "list": [ + { "value": "everyone", "label": "Everyone" }, + { "value": "buddies", "label": "Buddies" }, + { "value": "noone", "label": "No one" } + ] + } + }, + { "type": "boolean", "label": "Late Observer Joins", "tooltip": "Allow observers to join the game after it started", Index: ps/trunk/binaries/data/mods/public/gui/options/options.xml =================================================================== --- ps/trunk/binaries/data/mods/public/gui/options/options.xml +++ ps/trunk/binaries/data/mods/public/gui/options/options.xml @@ -13,11 +13,11 @@ - + Game Options - + General @@ -30,7 +30,7 @@ - + Graphics Settings @@ -44,7 +44,7 @@ - + Sound Settings @@ -57,7 +57,7 @@ - + Lobby Settings @@ -70,7 +70,7 @@ - + Chat Notification Settings