diff --git a/binaries/data/config/default.cfg b/binaries/data/config/default.cfg
index 6922280262..e3fc4a42fe 100644
--- a/binaries/data/config/default.cfg
+++ b/binaries/data/config/default.cfg
@@ -353,6 +353,7 @@ enabledmods = "mod public"
[network]
duplicateplayernames = false ; Rename joining player to "User (2)" if "User" is already connected, otherwise prohibit join.
+lateobserverjoins = false ; Allow observers to join the game after it started
[overlay]
fps = "false" ; Show frames per second in top right corner
diff --git a/binaries/data/mods/public/gui/gamesetup/gamesetup.js b/binaries/data/mods/public/gui/gamesetup/gamesetup.js
index ccbeb8e44c..5324cfb48b 100644
--- a/binaries/data/mods/public/gui/gamesetup/gamesetup.js
+++ b/binaries/data/mods/public/gui/gamesetup/gamesetup.js
@@ -299,7 +299,7 @@ function initMapFilters()
*/
function resizeMoreOptionsWindow()
{
- // For singleplayer reduce the size of more options dialog by three options (cheats, rated game, observer late join = 90px)
+ // For singleplayer reduce the size of more options dialog by three options (cheats, rated game = 60px)
if (!g_IsNetworked)
{
Engine.GetGUIObjectByName("moreOptions").size = "50%-200 50%-195 50%+200 50%+160";
@@ -308,9 +308,8 @@ function resizeMoreOptionsWindow()
// For non-lobby multiplayergames reduce the size of the dialog by one option (rated game, 30px)
else if (!Engine.HasXmppClient())
{
- Engine.GetGUIObjectByName("moreOptions").size = "50%-200 50%-195 50%+200 50%+220";
- Engine.GetGUIObjectByName("hideMoreOptions").size = "50%-70 370 50%+70 396";
- Engine.GetGUIObjectByName("optionObserverLateJoin").size = "14 338 94% 366";
+ Engine.GetGUIObjectByName("moreOptions").size = "50%-200 50%-195 50%+200 50%+190";
+ Engine.GetGUIObjectByName("hideMoreOptions").size = "50%-70 340 50%+70 366";
}
}
@@ -425,8 +424,7 @@ function initRadioButtons()
"ExploreMap": "exploreMap",
"DisableTreasures": "disableTreasures",
"LockTeams": "lockTeams",
- "CheatsEnabled": "enableCheats",
- "ObserverLateJoin": "observerLateJoin"
+ "CheatsEnabled": "enableCheats"
};
Object.keys(options).forEach(attribute => {
@@ -502,7 +500,6 @@ function initMultiplayerSettings()
Engine.GetGUIObjectByName("chatPanel").hidden = !g_IsNetworked;
Engine.GetGUIObjectByName("optionCheats").hidden = !g_IsNetworked;
Engine.GetGUIObjectByName("optionRating").hidden = !Engine.HasXmppClient();
- Engine.GetGUIObjectByName("optionObserverLateJoin").hidden = !g_IsNetworked;
Engine.GetGUIObjectByName("enableCheats").enabled = !Engine.IsRankedGame();
Engine.GetGUIObjectByName("lockTeams").enabled = !Engine.IsRankedGame();
@@ -512,7 +509,6 @@ function initMultiplayerSettings()
hideControl("enableCheats", "enableCheatsText");
hideControl("enableRating", "enableRatingText");
- hideControl("observerLateJoin", "observerLateJoinText");
}
/**
@@ -1282,7 +1278,6 @@ function updateGUIObjects()
setGUIBoolean("exploreMap", "exploreMapText", !!mapSettings.ExploreMap);
setGUIBoolean("revealMap", "revealMapText", !!mapSettings.RevealMap);
setGUIBoolean("lockTeams", "lockTeamsText", !!mapSettings.LockTeams);
- setGUIBoolean("observerLateJoin", "observerLateJoinText", !!mapSettings.ObserverLateJoin);
setGUIBoolean("enableRating", "enableRatingText", !!mapSettings.RatingEnabled);
Engine.GetGUIObjectByName("cheatWarningText").hidden = !g_IsNetworked || !mapSettings.CheatsEnabled;
diff --git a/binaries/data/mods/public/gui/gamesetup/gamesetup.xml b/binaries/data/mods/public/gui/gamesetup/gamesetup.xml
index 6fd27e7e5d..7699aea527 100644
--- a/binaries/data/mods/public/gui/gamesetup/gamesetup.xml
+++ b/binaries/data/mods/public/gui/gamesetup/gamesetup.xml
@@ -271,7 +271,7 @@
-
-
-
- Late Observer Joins:
-
-
-
- Allow observers to join after the game started.
-
-
-
diff --git a/binaries/data/mods/public/gui/options/options.json b/binaries/data/mods/public/gui/options/options.json
index 4f833e8d72..3f7487c20b 100644
--- a/binaries/data/mods/public/gui/options/options.json
+++ b/binaries/data/mods/public/gui/options/options.json
@@ -60,6 +60,12 @@
"label": "Persist Match Settings",
"tooltip": "Save and restore match settings for quick reuse when hosting another game",
"parameters": { "config": "persistmatchsettings" }
+ },
+ {
+ "type": "boolean",
+ "label": "Late Observer Joins",
+ "tooltip": "Allow observers to join the game after it started",
+ "parameters": { "config": "network.lateobserverjoins" }
}
],
"graphicsSetting":
diff --git a/source/network/NetServer.cpp b/source/network/NetServer.cpp
index f15aaf2572..8b5126f92e 100644
--- a/source/network/NetServer.cpp
+++ b/source/network/NetServer.cpp
@@ -927,13 +927,7 @@ bool CNetServerWorker::OnAuthenticate(void* context, CFsmEvent* event)
// Optionally allow observers to join after the game has started
bool observerLateJoin = false;
- ScriptInterface& scriptInterface = server.GetScriptInterface();
- JSContext* cx = scriptInterface.GetContext();
- JSAutoRequest rq(cx);
- JS::RootedValue settings(cx);
- scriptInterface.GetProperty(server.m_GameAttributes.get(), "settings", &settings);
- if (scriptInterface.HasProperty(settings, "ObserverLateJoin"))
- scriptInterface.GetProperty(settings, "ObserverLateJoin", observerLateJoin);
+ CFG_GET_VAL("network.lateobserverjoins", observerLateJoin);
// If the game has already started, only allow rejoins
bool isRejoining = false;