Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2018-12-05 19:00:18 -05:00
12 changed files with 35 additions and 29 deletions

View File

@@ -127,7 +127,7 @@ public class NetServer extends Module{
return;
}
if(packet.versionType == null || ((packet.version == -1 || !packet.versionType.equals("official")) && Version.build != -1 && !admins.allowsCustomClients())){
if(packet.versionType == null || ((packet.version == -1 || !packet.versionType.equals(Version.type)) && Version.build != -1 && !admins.allowsCustomClients())){
kick(id, KickReason.customClient);
return;
}

View File

@@ -11,7 +11,7 @@ public enum GameMode{
freebuild{{
disableWaveTimer = true;
}},
noWaves{{
attack{{
disableWaves = true;
hidden = true;
enemyCheat = true;

View File

@@ -202,7 +202,7 @@ public class OverlayRenderer{
void drawBar(Color color, float x, float y, float finion){
finion = Mathf.clamp(finion);
if(finion > 0) finion = Mathf.clamp(finion + 0.2f, 0.24f, 1f);
if(finion > 0) finion = Mathf.clamp(finion, 0.24f, 1f);
float len = 3;

View File

@@ -38,7 +38,7 @@ public class BattleMission extends MissionWithStartingCore{
@Override
public GameMode getMode(){
return GameMode.noWaves;
return GameMode.attack;
}
@Override

View File

@@ -2,10 +2,8 @@ package io.anuke.mindustry.maps.missions;
import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.blocks.StorageBlocks;
import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.game.SpawnGroup;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.mindustry.maps.Sector;
import io.anuke.mindustry.maps.generation.Generation;
@@ -34,7 +32,7 @@ public abstract class Mission{
}
public GameMode getMode(){
return GameMode.noWaves;
return GameMode.attack;
}
/**Sets the message displayed on mission begin. Returns this mission for chaining.*/

View File

@@ -74,7 +74,7 @@ public class WaveMission extends MissionWithStartingCore{
@Override
public void update(){
if(state.wave > target){
state.mode = GameMode.noWaves;
state.mode = GameMode.attack;
}
}

View File

@@ -1,5 +1,7 @@
package io.anuke.mindustry.net;
import io.anuke.mindustry.game.GameMode;
public class Host{
public final String name;
public final String address;
@@ -8,8 +10,9 @@ public class Host{
public final int players;
public final int version;
public final String versionType;
public final GameMode mode;
public Host(String name, String address, String mapname, int wave, int players, int version, String versionType){
public Host(String name, String address, String mapname, int wave, int players, int version, String versionType, GameMode mode){
this.name = name;
this.address = address;
this.players = players;
@@ -17,5 +20,6 @@ public class Host{
this.wave = wave;
this.version = version;
this.versionType = versionType;
this.mode = mode;
}
}

View File

@@ -21,6 +21,7 @@ import io.anuke.ucore.util.Bits;
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import static io.anuke.mindustry.Vars.*;
@@ -305,17 +306,18 @@ public class NetworkIO{
ByteBuffer buffer = ByteBuffer.allocate(128);
buffer.put((byte) host.getBytes().length);
buffer.put(host.getBytes());
buffer.put((byte) host.getBytes(StandardCharsets.UTF_8).length);
buffer.put(host.getBytes(StandardCharsets.UTF_8));
buffer.put((byte) map.getBytes().length);
buffer.put(map.getBytes());
buffer.put((byte) map.getBytes(StandardCharsets.UTF_8).length);
buffer.put(map.getBytes(StandardCharsets.UTF_8));
buffer.putInt(playerGroup.size());
buffer.putInt(state.wave);
buffer.putInt(Version.build);
buffer.put((byte)Version.type.getBytes().length);
buffer.put(Version.type.getBytes());
buffer.put((byte)Version.type.getBytes(StandardCharsets.UTF_8).length);
buffer.put(Version.type.getBytes(StandardCharsets.UTF_8));
buffer.put((byte)state.mode.ordinal());
return buffer;
}
@@ -328,8 +330,8 @@ public class NetworkIO{
byte[] mb = new byte[mlength];
buffer.get(mb);
String host = new String(hb);
String map = new String(mb);
String host = new String(hb, StandardCharsets.UTF_8);
String map = new String(mb, StandardCharsets.UTF_8);
int players = buffer.getInt();
int wave = buffer.getInt();
@@ -337,8 +339,9 @@ public class NetworkIO{
byte tlength = buffer.get();
byte[] tb = new byte[tlength];
buffer.get(tb);
String vertype = new String(tb);
String vertype = new String(tb, StandardCharsets.UTF_8);
GameMode mode = GameMode.values()[buffer.get()];
return new Host(host, hostAddress, map, wave, players, version, vertype);
return new Host(host, hostAddress, map, wave, players, version, vertype, mode);
}
}

View File

@@ -252,7 +252,6 @@ public class PowerNode extends PowerBlock{
Draw.color(Palette.powerLight, Palette.power, Mathf.absin(Timers.time(), 8f, 1f));
Lines.stroke(2f);
Lines.line(x1, y1, x2, y2);
}
}