Auto-play server sectors / Difficulty decrease / Improved d/c messages
This commit is contained in:
@@ -149,7 +149,13 @@ public class NetClient extends Module{
|
||||
public static void onKick(KickReason reason){
|
||||
netClient.disconnectQuietly();
|
||||
state.set(State.menu);
|
||||
if(!reason.quiet) ui.showError("$text.server.kicked." + reason.name());
|
||||
if(!reason.quiet){
|
||||
if(reason.extraText() != null){
|
||||
ui.showText(reason.toString(), reason.extraText());
|
||||
}else{
|
||||
ui.showText("$text.disconnect", reason.toString());
|
||||
}
|
||||
}
|
||||
ui.loadfrag.hide();
|
||||
}
|
||||
|
||||
|
||||
@@ -363,6 +363,12 @@ public class NetServer extends Module{
|
||||
admins.clearTraces();
|
||||
}
|
||||
|
||||
public void kickAll(KickReason reason){
|
||||
for(NetConnection con : Net.getConnections()){
|
||||
kick(con.id, reason);
|
||||
}
|
||||
}
|
||||
|
||||
public void kick(int connection, KickReason reason){
|
||||
NetConnection con = Net.getConnection(connection);
|
||||
if(con == null){
|
||||
|
||||
@@ -283,6 +283,13 @@ public class UI extends SceneModule{
|
||||
}}.show();
|
||||
}
|
||||
|
||||
public void showText(String title, String text){
|
||||
new Dialog(title, "dialog"){{
|
||||
content().margin(15).add(text).width(400f).wrap().get().setAlignment(Align.center, Align.center);
|
||||
buttons().addButton("$text.ok", this::hide).size(90, 50).pad(4);
|
||||
}}.show();
|
||||
}
|
||||
|
||||
public void showConfirm(String title, String text, Runnable confirmed){
|
||||
FloatingDialog dialog = new FloatingDialog(title);
|
||||
dialog.content().add(text).width(400f).wrap().pad(4f).get().setAlignment(Align.center, Align.center);
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.badlogic.gdx.utils.IntMap;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
import io.anuke.mindustry.net.Packets.KickReason;
|
||||
import io.anuke.mindustry.net.Packets.StreamBegin;
|
||||
import io.anuke.mindustry.net.Packets.StreamChunk;
|
||||
import io.anuke.mindustry.net.Streamable.StreamBuilder;
|
||||
@@ -88,7 +90,7 @@ public class Net{
|
||||
}
|
||||
|
||||
/**
|
||||
* Host a server at an address
|
||||
* Host a server at an address.
|
||||
*/
|
||||
public static void host(int port) throws IOException{
|
||||
serverProvider.host(port);
|
||||
@@ -102,6 +104,10 @@ public class Net{
|
||||
* Closes the server.
|
||||
*/
|
||||
public static void closeServer(){
|
||||
for(NetConnection con : getConnections()){
|
||||
Call.onKick(con.id, KickReason.serverClose);
|
||||
}
|
||||
|
||||
serverProvider.close();
|
||||
server = false;
|
||||
active = false;
|
||||
|
||||
@@ -10,6 +10,7 @@ import io.anuke.mindustry.game.Version;
|
||||
import io.anuke.mindustry.type.Recipe;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.io.IOUtils;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -22,16 +23,27 @@ import static io.anuke.mindustry.Vars.world;
|
||||
public class Packets{
|
||||
|
||||
public enum KickReason{
|
||||
kick, invalidPassword, clientOutdated, serverOutdated, banned, gameover(true), recentKick, nameInUse, idInUse, fastShoot, nameEmpty, customClient, sectorComplete(true);
|
||||
kick, clientOutdated, serverOutdated, banned, gameover(true), recentKick,
|
||||
nameInUse, idInUse, nameEmpty, customClient, sectorComplete, serverClose;
|
||||
|
||||
public final boolean quiet;
|
||||
|
||||
KickReason(){
|
||||
quiet = false;
|
||||
this(false);
|
||||
}
|
||||
|
||||
KickReason(boolean quiet){
|
||||
this.quiet = quiet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return Bundles.get("text.server.kicked." + name());
|
||||
}
|
||||
|
||||
public String extraText(){
|
||||
return Bundles.getOrNull("text.server.kicked." + name() + ".text");
|
||||
}
|
||||
}
|
||||
|
||||
public enum AdminAction{
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.anuke.mindustry.content.fx.BlockFx;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.graphics.Layer;
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.ItemStack;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.consumers.ConsumeLiquid;
|
||||
@@ -233,7 +234,8 @@ public class Drill extends Block{
|
||||
}
|
||||
|
||||
protected boolean isValid(Tile tile){
|
||||
return tile.floor().drops != null && tile.floor().drops.item.hardness <= tier;
|
||||
ItemStack drops = tile.floor().drops;
|
||||
return drops != null && drops.item.hardness <= tier;
|
||||
}
|
||||
|
||||
public static class DrillEntity extends TileEntity{
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class UnitPad extends Block{
|
||||
protected float gracePeriodMultiplier = 22f;
|
||||
protected float gracePeriodMultiplier = 23f;
|
||||
protected float speedupTime = 60f * 60f * 20;
|
||||
protected float maxSpeedup = 7f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user