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.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

View File

@@ -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;
}

View File

@@ -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(){

View File

@@ -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"));
}
}