Added Steam player limit + reduced votekick cooldown

This commit is contained in:
Anuken
2020-01-23 17:49:53 -05:00
parent 235142c869
commit d031efe1f2
4 changed files with 21 additions and 10 deletions

View File

@@ -668,6 +668,7 @@ setting.mutesound.name = Mute Sound
setting.crashreport.name = Send Anonymous Crash Reports setting.crashreport.name = Send Anonymous Crash Reports
setting.savecreate.name = Auto-Create Saves setting.savecreate.name = Auto-Create Saves
setting.publichost.name = Public Game Visibility setting.publichost.name = Public Game Visibility
setting.playerlimit.name = Player Limit
setting.chatopacity.name = Chat Opacity setting.chatopacity.name = Chat Opacity
setting.lasersopacity.name = Power Laser Opacity setting.lasersopacity.name = Power Laser Opacity
setting.bridgeopacity.name = Bridge Opacity setting.bridgeopacity.name = Bridge Opacity

View File

@@ -284,7 +284,11 @@ public class NetServer implements ApplicationListener{
}); });
//duration of a a kick in seconds //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{ class VoteSession{
Player target; Player target;
@@ -302,7 +306,7 @@ public class NetServer implements ApplicationListener{
map[0] = null; map[0] = null;
task.cancel(); task.cancel();
} }
}, 60 * 1); }, voteDuration);
} }
void vote(Player player, int d){ void vote(Player player, int d){
@@ -326,9 +330,7 @@ public class NetServer implements ApplicationListener{
} }
} }
//cooldown between votes Timekeeper vtime = new Timekeeper(voteCooldown);
int voteTime = 60 * 3;
Timekeeper vtime = new Timekeeper(voteTime);
//current kick sessions //current kick sessions
VoteSession[] currentlyKicking = {null}; VoteSession[] currentlyKicking = {null};
@@ -375,7 +377,7 @@ public class NetServer implements ApplicationListener{
player.sendMessage("[scarlet]Only players on your team can be kicked."); player.sendMessage("[scarlet]Only players on your team can be kicked.");
}else{ }else{
if(!vtime.get()){ 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; return;
} }

View File

@@ -1,7 +1,6 @@
package mindustry.ui.dialogs; package mindustry.ui.dialogs;
import arc.*; import arc.*;
import arc.struct.*;
import arc.files.*; import arc.files.*;
import arc.graphics.*; import arc.graphics.*;
import arc.graphics.Texture.*; import arc.graphics.Texture.*;
@@ -12,6 +11,7 @@ import arc.scene.ui.*;
import arc.scene.ui.SettingsDialog.SettingsTable.*; import arc.scene.ui.SettingsDialog.SettingsTable.*;
import arc.scene.ui.TextButton.*; import arc.scene.ui.TextButton.*;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
import arc.struct.*;
import arc.util.*; import arc.util.*;
import mindustry.core.GameState.*; import mindustry.core.GameState.*;
import mindustry.core.*; import mindustry.core.*;
@@ -240,10 +240,17 @@ public class SettingsMenuDialog extends SettingsDialog{
game.checkPref("buildautopause", false); game.checkPref("buildautopause", false);
} }
if(steam && !Version.modifier.contains("beta")){ if(steam){
game.checkPref("publichost", false, i -> { game.sliderPref("playerlimit", 16, 2, 32, i -> {
platform.updateLobby(); platform.updateLobby();
return i + "";
}); });
if(!Version.modifier.contains("beta")){
game.checkPref("publichost", false, i -> {
platform.updateLobby();
});
}
} }
game.pref(new Setting(){ game.pref(new Setting(){

View File

@@ -172,7 +172,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
@Override @Override
public void hostServer(int port) throws IOException{ public void hostServer(int port) throws IOException{
provider.hostServer(port); 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())))); 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(){ public void updateLobby(){
if(currentLobby != null && net.server()){ if(currentLobby != null && net.server()){
smat.setLobbyType(currentLobby, Core.settings.getBool("publichost") ? LobbyType.Public : LobbyType.FriendsOnly); smat.setLobbyType(currentLobby, Core.settings.getBool("publichost") ? LobbyType.Public : LobbyType.FriendsOnly);
smat.setLobbyMemberLimit(currentLobby, Core.settings.getInt("playerlimit"));
} }
} }