diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index a98c8ed03f..afb24e5f50 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -668,6 +668,7 @@ setting.mutesound.name = Mute Sound setting.crashreport.name = Send Anonymous Crash Reports setting.savecreate.name = Auto-Create Saves setting.publichost.name = Public Game Visibility +setting.playerlimit.name = Player Limit setting.chatopacity.name = Chat Opacity setting.lasersopacity.name = Power Laser Opacity setting.bridgeopacity.name = Bridge Opacity diff --git a/core/src/mindustry/core/NetServer.java b/core/src/mindustry/core/NetServer.java index 423026f5f4..4a0564ce42 100644 --- a/core/src/mindustry/core/NetServer.java +++ b/core/src/mindustry/core/NetServer.java @@ -284,7 +284,11 @@ public class NetServer implements ApplicationListener{ }); //duration of a a kick in seconds - int kickDuration = 15 * 60; + int kickDuration = 20 * 60; + //voting round duration in seconds + float voteDuration = 0.5f * 60; + //cooldown between votes + int voteCooldown = 60 * 2; class VoteSession{ Player target; @@ -302,7 +306,7 @@ public class NetServer implements ApplicationListener{ map[0] = null; task.cancel(); } - }, 60 * 1); + }, voteDuration); } void vote(Player player, int d){ @@ -326,9 +330,7 @@ public class NetServer implements ApplicationListener{ } } - //cooldown between votes - int voteTime = 60 * 3; - Timekeeper vtime = new Timekeeper(voteTime); + Timekeeper vtime = new Timekeeper(voteCooldown); //current kick sessions VoteSession[] currentlyKicking = {null}; @@ -375,7 +377,7 @@ public class NetServer implements ApplicationListener{ player.sendMessage("[scarlet]Only players on your team can be kicked."); }else{ if(!vtime.get()){ - player.sendMessage("[scarlet]You must wait " + voteTime/60 + " minutes between votekicks."); + player.sendMessage("[scarlet]You must wait " + voteCooldown/60 + " minutes between votekicks."); return; } diff --git a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java index df13b270ec..05c1a08b11 100644 --- a/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java +++ b/core/src/mindustry/ui/dialogs/SettingsMenuDialog.java @@ -1,7 +1,6 @@ package mindustry.ui.dialogs; import arc.*; -import arc.struct.*; import arc.files.*; import arc.graphics.*; import arc.graphics.Texture.*; @@ -12,6 +11,7 @@ import arc.scene.ui.*; import arc.scene.ui.SettingsDialog.SettingsTable.*; import arc.scene.ui.TextButton.*; import arc.scene.ui.layout.*; +import arc.struct.*; import arc.util.*; import mindustry.core.GameState.*; import mindustry.core.*; @@ -240,10 +240,17 @@ public class SettingsMenuDialog extends SettingsDialog{ game.checkPref("buildautopause", false); } - if(steam && !Version.modifier.contains("beta")){ - game.checkPref("publichost", false, i -> { + if(steam){ + game.sliderPref("playerlimit", 16, 2, 32, i -> { platform.updateLobby(); + return i + ""; }); + + if(!Version.modifier.contains("beta")){ + game.checkPref("publichost", false, i -> { + platform.updateLobby(); + }); + } } game.pref(new Setting(){ diff --git a/desktop/src/mindustry/desktop/steam/SNet.java b/desktop/src/mindustry/desktop/steam/SNet.java index 579b2b39c6..218b02ca42 100644 --- a/desktop/src/mindustry/desktop/steam/SNet.java +++ b/desktop/src/mindustry/desktop/steam/SNet.java @@ -172,7 +172,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback, @Override public void hostServer(int port) throws IOException{ provider.hostServer(port); - smat.createLobby(Core.settings.getBool("publichost") ? LobbyType.Public : LobbyType.FriendsOnly, 16); + smat.createLobby(Core.settings.getBool("publichost") ? LobbyType.Public : LobbyType.FriendsOnly, Core.settings.getInt("playerlimit")); Core.app.post(() -> Core.app.post(() -> Core.app.post(() -> Log.info("Server: {0}\nClient: {1}\nActive: {2}", net.server(), net.client(), net.active())))); } @@ -180,6 +180,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback, public void updateLobby(){ if(currentLobby != null && net.server()){ smat.setLobbyType(currentLobby, Core.settings.getBool("publichost") ? LobbyType.Public : LobbyType.FriendsOnly); + smat.setLobbyMemberLimit(currentLobby, Core.settings.getInt("playerlimit")); } }