diff --git a/annotations/src/io/anuke/annotations/Annotations.java b/annotations/src/io/anuke/annotations/Annotations.java
index b405c437b9..325663f951 100644
--- a/annotations/src/io/anuke/annotations/Annotations.java
+++ b/annotations/src/io/anuke/annotations/Annotations.java
@@ -28,6 +28,8 @@ public class Annotations {
boolean unreliable() default false;
/**The simple class name where this method is placed.*/
String in() default "Call";
+ /**Priority of this event.*/
+ PacketPriority priority() default PacketPriority.normal;
}
/**Specifies that this method will be used to write classes of the type returned by {@link #value()}.
@@ -48,6 +50,15 @@ public class Annotations {
Class> value();
}
+ public enum PacketPriority {
+ /**Gets put in a queue and processed if not connected.*/
+ normal,
+ /**Gets handled immediately, regardless of connection status.*/
+ high,
+ /**Does not get handled unless client is connected.*/
+ low
+ }
+
/**A set of two booleans, one specifying server and one specifying client.*/
public enum Loc {
/**Method can only be invoked on the client from the server.*/
diff --git a/annotations/src/io/anuke/annotations/MethodEntry.java b/annotations/src/io/anuke/annotations/MethodEntry.java
index fd01caa772..ee47fccb4a 100644
--- a/annotations/src/io/anuke/annotations/MethodEntry.java
+++ b/annotations/src/io/anuke/annotations/MethodEntry.java
@@ -1,6 +1,7 @@
package io.anuke.annotations;
import io.anuke.annotations.Annotations.Loc;
+import io.anuke.annotations.Annotations.PacketPriority;
import io.anuke.annotations.Annotations.Variant;
import javax.lang.model.element.ExecutableElement;
@@ -26,9 +27,11 @@ public class MethodEntry {
public final int id;
/**The element method associated with this entry.*/
public final ExecutableElement element;
+ /**The assigned packet priority. Only used in clients.*/
+ public final PacketPriority priority;
public MethodEntry(String className, String targetMethod, Loc where, Variant target,
- Loc local, boolean unreliable, boolean forward, int id, ExecutableElement element) {
+ Loc local, boolean unreliable, boolean forward, int id, ExecutableElement element, PacketPriority priority) {
this.className = className;
this.forward = forward;
this.targetMethod = targetMethod;
@@ -38,6 +41,7 @@ public class MethodEntry {
this.id = id;
this.element = element;
this.unreliable = unreliable;
+ this.priority = priority;
}
@Override
diff --git a/annotations/src/io/anuke/annotations/RemoteMethodAnnotationProcessor.java b/annotations/src/io/anuke/annotations/RemoteMethodAnnotationProcessor.java
index 9635bf4226..037ec8129a 100644
--- a/annotations/src/io/anuke/annotations/RemoteMethodAnnotationProcessor.java
+++ b/annotations/src/io/anuke/annotations/RemoteMethodAnnotationProcessor.java
@@ -114,7 +114,7 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor {
//create and add entry
MethodEntry method = new MethodEntry(entry.name, Utils.getMethodName(element), annotation.targets(), annotation.variants(),
- annotation.called(), annotation.unreliable(), annotation.forward(), lastMethodID++, (ExecutableElement) element);
+ annotation.called(), annotation.unreliable(), annotation.forward(), lastMethodID++, (ExecutableElement) element, annotation.priority());
entry.methods.add(method);
methods.add(method);
diff --git a/annotations/src/io/anuke/annotations/RemoteReadGenerator.java b/annotations/src/io/anuke/annotations/RemoteReadGenerator.java
index a089619d89..ae2ab83de7 100644
--- a/annotations/src/io/anuke/annotations/RemoteReadGenerator.java
+++ b/annotations/src/io/anuke/annotations/RemoteReadGenerator.java
@@ -117,7 +117,7 @@ public class RemoteReadGenerator {
if(entry.forward && entry.where.isServer && needsPlayer){
//call forwarded method
readBlock.addStatement(packageName + "." + entry.className + "." + entry.element.getSimpleName() +
- "__forward(player.clientid" + (varResult.length() == 0 ? "" : ", ") + varResult.toString() + ")");
+ "__forward(player.con.id" + (varResult.length() == 0 ? "" : ", ") + varResult.toString() + ")");
}
readBlock.nextControlFlow("catch (java.lang.Exception e)");
diff --git a/annotations/src/io/anuke/annotations/RemoteWriteGenerator.java b/annotations/src/io/anuke/annotations/RemoteWriteGenerator.java
index 5c4b4d5a76..1d80dcbc67 100644
--- a/annotations/src/io/anuke/annotations/RemoteWriteGenerator.java
+++ b/annotations/src/io/anuke/annotations/RemoteWriteGenerator.java
@@ -132,6 +132,8 @@ public class RemoteWriteGenerator {
method.addStatement("$1N packet = $2N.obtain($1N.class)", "io.anuke.mindustry.net.Packets.InvokePacket", "com.badlogic.gdx.utils.Pools");
//assign buffer
method.addStatement("packet.writeBuffer = TEMP_BUFFER");
+ //assign priority
+ method.addStatement("packet.priority = (byte)" + methodEntry.priority.ordinal());
//assign method ID
method.addStatement("packet.type = (byte)" + methodEntry.id);
//rewind buffer
diff --git a/build.gradle b/build.gradle
index 64a541e770..08d957a06d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -27,7 +27,7 @@ allprojects {
gdxVersion = '1.9.8'
roboVMVersion = '2.3.0'
aiVersion = '1.8.1'
- uCoreVersion = '5f35012fef'
+ uCoreVersion = 'e7a37cff68'
getVersionString = {
String buildVersion = getBuildVersion()
diff --git a/core/assets-raw/sprites/blocks/production/powersmelter-top.png b/core/assets-raw/sprites/blocks/production/arc-smelter-top.png
similarity index 100%
rename from core/assets-raw/sprites/blocks/production/powersmelter-top.png
rename to core/assets-raw/sprites/blocks/production/arc-smelter-top.png
diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties
index 4dc6e8d7da..6b1429cf6f 100644
--- a/core/assets/bundles/bundle.properties
+++ b/core/assets/bundles/bundle.properties
@@ -76,6 +76,7 @@ text.server.kicked.recentKick=You have been kicked recently.\nWait before connec
text.server.kicked.nameInUse=There is someone with that name\nalready on this server.
text.server.kicked.nameEmpty=Your name must contain at least one character or number.
text.server.kicked.idInUse=You are already on this server! Connecting with two accounts is not permitted.
+text.server.kicked.customClient=This server does not support custom builds. Download an official version.
text.server.connected={0} has joined.
text.server.disconnected={0} has disconnected.
text.nohost=Can't host server on a custom map!
diff --git a/core/assets/sprites/sprites.atlas b/core/assets/sprites/sprites.atlas
index d7d0ae3611..337bea2f73 100644
--- a/core/assets/sprites/sprites.atlas
+++ b/core/assets/sprites/sprites.atlas
@@ -111,21 +111,21 @@ carbide-drill-top
index: -1
laser-drill
rotate: false
- xy: 184, 99
+ xy: 202, 99
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
laser-drill-rotator
rotate: false
- xy: 202, 99
+ xy: 184, 81
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
laser-drill-top
rotate: false
- xy: 184, 81
+ xy: 220, 99
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -874,7 +874,7 @@ cross-1
index: -1
cross-2
rotate: false
- xy: 339, 117
+ xy: 357, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -1299,107 +1299,121 @@ block-icon-arc-smelter
orig: 16, 16
offset: 0, 0
index: -1
-biomattercompressor
+arc-smelter-top
rotate: false
xy: 507, 191
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
-biomattercompressor-frame0
+silicon-smelter-top
+ rotate: false
+ xy: 507, 191
+ size: 16, 16
+ orig: 16, 16
+ offset: 0, 0
+ index: -1
+biomattercompressor
rotate: false
xy: 525, 191
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
-biomattercompressor-frame1
+biomattercompressor-frame0
rotate: false
xy: 543, 191
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
-biomattercompressor-frame2
+biomattercompressor-frame1
rotate: false
xy: 561, 191
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
-biomattercompressor-liquid
+biomattercompressor-frame2
rotate: false
xy: 713, 301
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
-biomattercompressor-top
+biomattercompressor-liquid
rotate: false
xy: 710, 283
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
-blast-mixer
+biomattercompressor-top
rotate: false
xy: 739, 310
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
+blast-mixer
+ rotate: false
+ xy: 977, 413
+ size: 16, 16
+ orig: 16, 16
+ offset: 0, 0
+ index: -1
block-icon-blast-mixer
rotate: false
- xy: 739, 310
+ xy: 977, 413
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
centrifuge-liquid
rotate: false
- xy: 303, 117
+ xy: 321, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
cryofluidmixer-bottom
rotate: false
- xy: 357, 117
+ xy: 375, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
cryofluidmixer-liquid
rotate: false
- xy: 375, 117
+ xy: 393, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
cryofluidmixer-top
rotate: false
- xy: 393, 117
+ xy: 411, 116
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
cultivator
rotate: false
- xy: 411, 116
+ xy: 429, 122
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
cultivator-middle
rotate: false
- xy: 429, 122
+ xy: 447, 122
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
cultivator-top
rotate: false
- xy: 447, 122
+ xy: 465, 122
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -1413,47 +1427,33 @@ lavasmelter
index: -1
phase-weaver
rotate: false
- xy: 220, 99
+ xy: 202, 81
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
phase-weaver-bottom
rotate: false
- xy: 202, 81
+ xy: 238, 99
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
phase-weaver-weave
rotate: false
- xy: 238, 99
+ xy: 220, 81
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
plastanium-compressor-top
- rotate: false
- xy: 220, 81
- size: 16, 16
- orig: 16, 16
- offset: 0, 0
- index: -1
-poweralloysmelter-top
rotate: false
xy: 256, 99
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
-powersmelter-top
- rotate: false
- xy: 238, 81
- size: 16, 16
- orig: 16, 16
- offset: 0, 0
- index: -1
-silicon-smelter-top
+poweralloysmelter-top
rotate: false
xy: 238, 81
size: 16, 16
@@ -1504,14 +1504,14 @@ block-1-top
index: -1
block-2
rotate: false
- xy: 977, 413
+ xy: 995, 419
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
block-2-top
rotate: false
- xy: 995, 419
+ xy: 995, 401
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -1616,14 +1616,14 @@ hail-heat
index: -1
lancer
rotate: false
- xy: 166, 89
+ xy: 166, 71
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
lancer-heat
rotate: false
- xy: 166, 71
+ xy: 184, 99
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -1714,28 +1714,28 @@ wave-liquid
index: -1
drone-factory-top
rotate: false
- xy: 849, 399
+ xy: 831, 380
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
drone-factory-top-open
rotate: false
- xy: 831, 380
+ xy: 849, 381
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
fabricator-factory-top
rotate: false
- xy: 849, 381
+ xy: 828, 362
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
fabricator-factory-top-open
rotate: false
- xy: 828, 362
+ xy: 829, 344
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -1749,21 +1749,21 @@ mech-factory
index: -1
dart-ship-factory-open
rotate: false
- xy: 465, 122
+ xy: 483, 122
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
delta-mech-factory-open
rotate: false
- xy: 483, 122
+ xy: 831, 398
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
javelin-ship-factory-open
rotate: false
- xy: 829, 308
+ xy: 166, 89
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -1791,7 +1791,7 @@ ship-factory
index: -1
door-large-open
rotate: false
- xy: 831, 398
+ xy: 849, 399
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2001,7 +2001,7 @@ block-icon-arc
index: -1
block-icon-biomattercompressor
rotate: false
- xy: 995, 401
+ xy: 427, 158
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2064,28 +2064,28 @@ carbide-wall
index: -1
block-icon-carbide-wall-large
rotate: false
- xy: 427, 158
+ xy: 445, 158
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
carbide-wall-large
rotate: false
- xy: 427, 158
+ xy: 445, 158
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
block-icon-centrifuge
rotate: false
- xy: 445, 158
+ xy: 420, 140
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
centrifuge
rotate: false
- xy: 445, 158
+ xy: 420, 140
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2141,14 +2141,14 @@ core
index: -1
block-icon-cryofluidmixer
rotate: false
- xy: 420, 140
+ xy: 438, 140
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
block-icon-cultivator
rotate: false
- xy: 438, 140
+ xy: 757, 310
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2162,14 +2162,14 @@ block-icon-cyclone
index: -1
block-icon-dart-ship-factory
rotate: false
- xy: 757, 310
+ xy: 775, 312
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
dart-ship-factory
rotate: false
- xy: 757, 310
+ xy: 775, 312
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2218,42 +2218,42 @@ block-icon-phase-wall
index: -1
block-icon-deflector-wall-large
rotate: false
- xy: 775, 312
+ xy: 487, 171
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
deflector-wall-large
rotate: false
- xy: 775, 312
+ xy: 487, 171
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
phase-wall-large
rotate: false
- xy: 775, 312
+ xy: 487, 171
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
block-icon-phase-wall-large
rotate: false
- xy: 775, 312
+ xy: 487, 171
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
block-icon-delta-mech-factory
rotate: false
- xy: 487, 171
+ xy: 579, 188
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
delta-mech-factory
rotate: false
- xy: 487, 171
+ xy: 579, 188
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2288,21 +2288,21 @@ door
index: -1
block-icon-door-large
rotate: false
- xy: 579, 188
+ xy: 597, 188
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
door-large
rotate: false
- xy: 579, 188
+ xy: 597, 188
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
block-icon-drone-factory
rotate: false
- xy: 597, 188
+ xy: 615, 188
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2330,7 +2330,7 @@ block-icon-duo
index: -1
block-icon-fabricator-factory
rotate: false
- xy: 615, 188
+ xy: 633, 188
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2442,14 +2442,14 @@ itemvoid
index: -1
block-icon-javelin-ship-factory
rotate: false
- xy: 633, 188
+ xy: 665, 187
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
javelin-ship-factory
rotate: false
- xy: 633, 188
+ xy: 665, 187
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2477,7 +2477,7 @@ block-icon-lancer
index: -1
block-icon-laser-drill
rotate: false
- xy: 665, 187
+ xy: 683, 187
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2610,14 +2610,14 @@ metalfloor1
index: -1
block-icon-multiplexer
rotate: false
- xy: 683, 187
+ xy: 456, 140
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
multiplexer
rotate: false
- xy: 683, 187
+ xy: 456, 140
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2715,7 +2715,7 @@ phase-conveyor
index: -1
block-icon-phase-weaver
rotate: false
- xy: 456, 140
+ xy: 463, 158
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2729,14 +2729,14 @@ block-icon-plasma-drill
index: -1
block-icon-plastanium-compressor
rotate: false
- xy: 463, 158
+ xy: 474, 140
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
plastanium-compressor
rotate: false
- xy: 463, 158
+ xy: 474, 140
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2757,14 +2757,14 @@ power-node
index: -1
block-icon-power-node-large
rotate: false
- xy: 474, 140
+ xy: 793, 344
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
power-node-large
rotate: false
- xy: 474, 140
+ xy: 793, 344
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2813,42 +2813,42 @@ block-icon-pulverizer
index: -1
block-icon-pyratite-mixer
rotate: false
- xy: 793, 344
+ xy: 793, 312
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
pyratite-mixer
rotate: false
- xy: 793, 344
+ xy: 793, 312
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
block-icon-reconstructor
rotate: false
- xy: 793, 312
+ xy: 811, 343
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
drone-factory
rotate: false
- xy: 793, 312
+ xy: 811, 343
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
fabricator-factory
rotate: false
- xy: 793, 312
+ xy: 811, 343
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
reconstructor
rotate: false
- xy: 793, 312
+ xy: 811, 343
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -2904,14 +2904,14 @@ rock1
index: -1
block-icon-rotary-pump
rotate: false
- xy: 811, 343
+ xy: 177, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
rotary-pump
rotate: false
- xy: 811, 343
+ xy: 177, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -3002,14 +3002,14 @@ shrub
index: -1
block-icon-silicon-smelter
rotate: false
- xy: 177, 117
+ xy: 195, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
silicon-smelter
rotate: false
- xy: 177, 117
+ xy: 195, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -3170,28 +3170,28 @@ block-icon-swarmer
index: -1
block-icon-thermal-generator
rotate: false
- xy: 195, 117
+ xy: 213, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
thermal-generator
rotate: false
- xy: 195, 117
+ xy: 213, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
block-icon-thermal-pump
rotate: false
- xy: 213, 117
+ xy: 231, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
thermal-pump
rotate: false
- xy: 213, 117
+ xy: 231, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -3212,14 +3212,14 @@ thorium-wall
index: -1
block-icon-thorium-wall-large
rotate: false
- xy: 231, 117
+ xy: 249, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
thorium-wall-large
rotate: false
- xy: 231, 117
+ xy: 249, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -3261,28 +3261,28 @@ tungsten-wall
index: -1
block-icon-tungsten-wall-large
rotate: false
- xy: 249, 117
+ xy: 267, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
tungsten-wall-large
rotate: false
- xy: 249, 117
+ xy: 267, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
block-icon-turbine-generator
rotate: false
- xy: 267, 117
+ xy: 285, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
turbine-generator
rotate: false
- xy: 267, 117
+ xy: 285, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -3345,7 +3345,7 @@ water
index: -1
block-icon-water-extractor
rotate: false
- xy: 285, 117
+ xy: 303, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4411,7 +4411,7 @@ discord-banner-over
index: -1
controller-cursor
rotate: false
- xy: 321, 117
+ xy: 339, 117
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4453,14 +4453,14 @@ icon-areaDelete
index: -1
icon-arrow
rotate: false
- xy: 829, 344
+ xy: 429, 104
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
icon-arrow-16
rotate: false
- xy: 829, 344
+ xy: 429, 104
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4495,7 +4495,7 @@ icon-arrow-up
index: -1
icon-back
rotate: false
- xy: 429, 104
+ xy: 447, 104
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4509,14 +4509,14 @@ icon-ban
index: -1
icon-break
rotate: false
- xy: 447, 104
+ xy: 465, 104
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
icon-cancel
rotate: false
- xy: 465, 104
+ xy: 483, 104
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4530,7 +4530,7 @@ icon-chat
index: -1
icon-check
rotate: false
- xy: 483, 104
+ xy: 867, 399
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4607,14 +4607,14 @@ icon-egg
index: -1
icon-elevation
rotate: false
- xy: 867, 399
+ xy: 867, 381
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
icon-eraser
rotate: false
- xy: 867, 381
+ xy: 885, 401
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4628,14 +4628,14 @@ icon-exit
index: -1
icon-file
rotate: false
- xy: 885, 401
+ xy: 885, 383
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
icon-file-image
rotate: false
- xy: 885, 383
+ xy: 903, 401
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4649,7 +4649,7 @@ icon-file-text
index: -1
icon-fill
rotate: false
- xy: 903, 401
+ xy: 903, 383
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4663,7 +4663,7 @@ icon-floppy
index: -1
icon-floppy-16
rotate: false
- xy: 903, 383
+ xy: 921, 401
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4705,7 +4705,7 @@ icon-google-play
index: -1
icon-grid
rotate: false
- xy: 921, 401
+ xy: 921, 383
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4761,7 +4761,7 @@ icon-items-none
index: -1
icon-line
rotate: false
- xy: 921, 383
+ xy: 939, 401
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4789,28 +4789,28 @@ icon-load
index: -1
icon-load-image
rotate: false
- xy: 939, 401
+ xy: 939, 383
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
icon-load-map
rotate: false
- xy: 939, 383
+ xy: 957, 401
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
icon-loading
rotate: false
- xy: 957, 401
+ xy: 957, 383
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
icon-locked
rotate: false
- xy: 957, 383
+ xy: 975, 395
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4838,7 +4838,7 @@ icon-menu
index: -1
icon-menu-large
rotate: false
- xy: 975, 395
+ xy: 975, 377
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4859,7 +4859,7 @@ icon-pause
index: -1
icon-pencil
rotate: false
- xy: 975, 377
+ xy: 993, 383
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4873,7 +4873,7 @@ icon-pencil-small
index: -1
icon-pick
rotate: false
- xy: 993, 383
+ xy: 993, 365
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4922,7 +4922,7 @@ icon-quit
index: -1
icon-redo
rotate: false
- xy: 993, 365
+ xy: 665, 169
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4943,7 +4943,7 @@ icon-rename
index: -1
icon-resize
rotate: false
- xy: 665, 169
+ xy: 683, 169
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -4985,14 +4985,14 @@ icon-save
index: -1
icon-save-image
rotate: false
- xy: 683, 169
+ xy: 701, 171
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
icon-save-map
rotate: false
- xy: 701, 171
+ xy: 719, 171
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -5006,7 +5006,7 @@ icon-settings
index: -1
icon-terrain
rotate: false
- xy: 719, 171
+ xy: 811, 325
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -5041,7 +5041,7 @@ icon-trash
index: -1
icon-trash-16
rotate: false
- xy: 811, 325
+ xy: 829, 326
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -5062,7 +5062,7 @@ icon-tutorial
index: -1
icon-undo
rotate: false
- xy: 829, 326
+ xy: 811, 307
size: 16, 16
orig: 16, 16
offset: 0, 0
@@ -5097,7 +5097,7 @@ icon-wiki
index: -1
icon-zoom
rotate: false
- xy: 811, 307
+ xy: 829, 308
size: 16, 16
orig: 16, 16
offset: 0, 0
diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png
index bd5f50ffbe..5aae50403c 100644
Binary files a/core/assets/sprites/sprites.png and b/core/assets/sprites/sprites.png differ
diff --git a/core/src/io/anuke/mindustry/content/Recipes.java b/core/src/io/anuke/mindustry/content/Recipes.java
index b9a0a89003..5ebcec9ec6 100644
--- a/core/src/io/anuke/mindustry/content/Recipes.java
+++ b/core/src/io/anuke/mindustry/content/Recipes.java
@@ -108,8 +108,8 @@ public class Recipes implements ContentList{
new Recipe(distribution, StorageBlocks.vault, new ItemStack(Items.carbide, 500), new ItemStack(Items.thorium, 350));
//DRILLS, PRODUCERS
- new Recipe(production, ProductionBlocks.tungstenDrill, new ItemStack(Items.tungsten, 30));
- new Recipe(production, ProductionBlocks.carbideDrill, new ItemStack(Items.tungsten, 60), new ItemStack(Items.carbide, 60));
+ new Recipe(production, ProductionBlocks.tungstenDrill, new ItemStack(Items.tungsten, 25));
+ new Recipe(production, ProductionBlocks.carbideDrill, new ItemStack(Items.tungsten, 50), new ItemStack(Items.carbide, 60));
new Recipe(production, ProductionBlocks.laserdrill, new ItemStack(Items.tungsten, 90), new ItemStack(Items.carbide, 110), new ItemStack(Items.silicon, 70), new ItemStack(Items.titanium, 80));
new Recipe(production, ProductionBlocks.waterextractor, new ItemStack(Items.tungsten, 50), new ItemStack(Items.carbide, 50), new ItemStack(Items.lead, 40));
diff --git a/core/src/io/anuke/mindustry/content/blocks/ProductionBlocks.java b/core/src/io/anuke/mindustry/content/blocks/ProductionBlocks.java
index 91b60aed91..6a7c9f8a18 100644
--- a/core/src/io/anuke/mindustry/content/blocks/ProductionBlocks.java
+++ b/core/src/io/anuke/mindustry/content/blocks/ProductionBlocks.java
@@ -18,7 +18,7 @@ public class ProductionBlocks extends BlockList implements ContentList {
public void load() {
tungstenDrill = new Drill("tungsten-drill") {{
tier = 2;
- drillTime = 360;
+ drillTime = 340;
}};
carbideDrill = new Drill("carbide-drill") {{
diff --git a/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java b/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java
index 2d1d6329a6..efcc0e9657 100644
--- a/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java
+++ b/core/src/io/anuke/mindustry/content/blocks/TurretBlocks.java
@@ -21,11 +21,12 @@ public class TurretBlocks extends BlockList implements ContentList {
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletPyratite, AmmoTypes.bulletSilicon};
reload = 25f;
restitution = 0.03f;
- range = 80f;
+ range = 90f;
shootCone = 15f;
ammoUseEffect = ShootFx.shellEjectSmall;
health = 80;
- inaccuracy = 3f;
+ inaccuracy = 2f;
+ rotatespeed = 10f;
}};
/*
scatter = new BurstTurret("scatter") {{
@@ -52,10 +53,10 @@ public class TurretBlocks extends BlockList implements ContentList {
scorch = new LiquidTurret("scorch") {{
ammoTypes = new AmmoType[]{AmmoTypes.basicFlame};
recoil = 0f;
- reload = 5f;
+ reload = 4f;
shootCone = 50f;
ammoUseEffect = ShootFx.shellEjectSmall;
- health = 140;
+ health = 160;
drawer = (tile, entity) -> Draw.rect(entity.target != null ? name + "-shoot" : name, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
}};
diff --git a/core/src/io/anuke/mindustry/core/NetClient.java b/core/src/io/anuke/mindustry/core/NetClient.java
index 2d95e4ded1..e67b1630d4 100644
--- a/core/src/io/anuke/mindustry/core/NetClient.java
+++ b/core/src/io/anuke/mindustry/core/NetClient.java
@@ -3,6 +3,7 @@ package io.anuke.mindustry.core;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Base64Coder;
import com.badlogic.gdx.utils.IntSet;
+import io.anuke.annotations.Annotations.PacketPriority;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.annotations.Annotations.Variant;
import io.anuke.mindustry.core.GameState.State;
@@ -222,7 +223,7 @@ public class NetClient extends Module {
}
}
- @Remote(variants = Variant.one)
+ @Remote(variants = Variant.one, priority = PacketPriority.high)
public static void onKick(KickReason reason){
netClient.disconnectQuietly();
state.set(State.menu);
@@ -247,7 +248,7 @@ public class NetClient extends Module {
playerGroup.removeByID(playerid);
}
- @Remote(variants = Variant.one, unreliable = true)
+ @Remote(variants = Variant.one, priority = PacketPriority.low, unreliable = true)
public static void onSnapshot(byte[] chunk, int snapshotID, short chunkID, short totalLength, int base){
if(NetServer.showSnapshotSize) Log.info("Recieved snapshot: len {0} ID {1} chunkID {2} totalLength {3} base {4} client-base {5}", chunk.length, snapshotID, chunkID, totalLength, base, netClient.lastSnapshotBaseID);
@@ -301,7 +302,7 @@ public class NetClient extends Module {
length = snapshot.length;
netClient.lastSnapshotBase = Arrays.copyOf(snapshot, snapshot.length);
} else { //otherwise, last snapshot must not be null, decode it
- if(NetServer.showSnapshotSize) Log.info("Base size: {0} Path size: {1}", netClient.lastSnapshotBase.length, snapshot.length);
+ if(NetServer.showSnapshotSize) Log.info("Base size: {0} Patch size: {1}", netClient.lastSnapshotBase.length, snapshot.length);
netClient.decoder.init(netClient.lastSnapshotBase, snapshot);
result = netClient.decoder.decode();
length = netClient.decoder.getDecodedLength();
diff --git a/core/src/io/anuke/mindustry/core/NetServer.java b/core/src/io/anuke/mindustry/core/NetServer.java
index 9c08b12020..da30e5efd2 100644
--- a/core/src/io/anuke/mindustry/core/NetServer.java
+++ b/core/src/io/anuke/mindustry/core/NetServer.java
@@ -74,6 +74,7 @@ public class NetServer extends Module{
if(player != null){
onDisconnect(player);
}
+ connections.remove(id);
});
Net.handleServer(ConnectPacket.class, (id, packet) -> {
@@ -97,6 +98,11 @@ public class NetServer extends Module{
return;
}
+ if(packet.version == -1 && Version.build != -1 && !admins.allowsCustomClients()){
+ kick(id, KickReason.customClient);
+ return;
+ }
+
boolean preventDuplicates = headless;
if(preventDuplicates) {
@@ -137,7 +143,7 @@ public class NetServer extends Module{
Player player = new Player();
player.isAdmin = admins.isAdmin(uuid, packet.usid);
- player.clientid = id;
+ player.con = Net.getConnection(id);
player.usid = packet.usid;
player.name = packet.name;
player.uuid = uuid;
@@ -322,9 +328,9 @@ public class NetServer extends Module{
//iterate through each player
for (Player player : connections.values()) {
- NetConnection connection = Net.getConnection(player.clientid);
+ NetConnection connection = player.con;
- if(connection == null || !connection.isConnected()){
+ if(!connection.isConnected()){
//player disconnected, ignore them
onDisconnect(player);
return;
@@ -406,18 +412,25 @@ public class NetServer extends Module{
byte[] bytes = syncStream.toByteArray();
- connection.lastSentRawSnapshot = bytes;
-
if(connection.currentBaseID == -1){
+ //assign to last sent snapshot so that there is only ever one unique snapshot with ID 0
+ if(connection.lastSentSnapshot != null){
+ bytes = connection.lastSentSnapshot;
+ }else{
+ connection.lastSentRawSnapshot = bytes;
+ connection.lastSentSnapshot = bytes;
+ }
+
if(showSnapshotSize) Log.info("Sent raw snapshot: {0} bytes.", bytes.length);
- ///Nothing to diff off of in this case, send the whole thing, but increment the counter
- connection.lastSentSnapshot = bytes;
+ ///Nothing to diff off of in this case, send the whole thing
sendSplitSnapshot(connection.id, bytes, 0, -1);
}else{
+ connection.lastSentRawSnapshot = bytes;
+
//send diff, otherwise
byte[] diff = ByteDeltaEncoder.toDiff(new ByteMatcherHash(connection.currentBaseSnapshot, bytes), encoder);
- if(showSnapshotSize) Log.info("Shrank snapshot: {0} -> {1}, Base {2} ID {3}", bytes.length, diff.length, connection.currentBaseID, connection.lastSentSnapshotID);
- sendSplitSnapshot(connection.id, diff, connection.lastSentSnapshotID + 1, connection.currentBaseID);
+ if(showSnapshotSize) Log.info("Shrank snapshot: {0} -> {1}, Base {2} ID {3} base length = {4}", bytes.length, diff.length, connection.currentBaseID, connection.currentBaseID + 1, connection.currentBaseSnapshot.length);
+ sendSplitSnapshot(connection.id, diff, connection.currentBaseID + 1, connection.currentBaseID);
connection.lastSentSnapshot = diff;
connection.lastSentSnapshotID = connection.currentBaseID + 1;
connection.lastSentBase = connection.currentBaseID;
@@ -432,7 +445,6 @@ public class NetServer extends Module{
/**Sends a raw byte[] snapshot to a client, splitting up into chunks when needed.*/
private static void sendSplitSnapshot(int userid, byte[] bytes, int snapshotID, int base){
if(bytes.length < maxSnapshotSize){
- if(showSnapshotSize) Log.info("Raw send() snapshot call: {0} bytes, sID {1}", bytes.length, snapshotID);
Call.onSnapshot(userid, bytes, snapshotID, (short)0, (short)bytes.length, base);
}else{
int remaining = bytes.length;
@@ -461,7 +473,7 @@ public class NetServer extends Module{
Call.sendMessage("[accent]" + player.name + " has disconnected.");
Call.onPlayerDisconnect(player.id);
player.remove();
- netServer.connections.remove(player.clientid);
+ netServer.connections.remove(player.con.id);
}
@Remote(targets = Loc.client, called = Loc.server)
@@ -469,7 +481,7 @@ public class NetServer extends Module{
if(!player.isAdmin){
Log.err("ACCESS DENIED: Player {0} / {1} attempted to perform admin action without proper security access.",
- player.name, Net.getConnection(player.clientid).address);
+ player.name, player.con.address);
return;
}
@@ -478,18 +490,19 @@ public class NetServer extends Module{
return;
}
- String ip = Net.getConnection(other.clientid).address;
+ String ip = player.con.address;
if(action == AdminAction.ban){
netServer.admins.banPlayerIP(ip);
- netServer.kick(other.clientid, KickReason.banned);
+ netServer.kick(other.con.id, KickReason.banned);
Log.info("&lc{0} has banned {1}.", player.name, other.name);
}else if(action == AdminAction.kick){
- netServer.kick(other.clientid, KickReason.kick);
+ netServer.kick(other.con.id, KickReason.kick);
Log.info("&lc{0} has kicked {1}.", player.name, other.name);
}else if(action == AdminAction.trace){
- if(player.clientid != -1) {
- Call.onTraceInfo(player.clientid, netServer.admins.getTraceByID(other.uuid));
+ //TODO
+ if(player.con != null) {
+ Call.onTraceInfo(player.con.id, netServer.admins.getTraceByID(other.uuid));
}else{
NetClient.onTraceInfo(netServer.admins.getTraceByID(other.uuid));
}
@@ -500,7 +513,7 @@ public class NetServer extends Module{
@Remote(targets = Loc.client)
public static void connectConfirm(Player player){
player.add();
- Net.getConnection(player.clientid).hasConnected = true;
+ player.con.hasConnected = true;
Call.sendMessage("[accent]" + player.name + " has connected.");
Log.info("&y{0} has connected.", player.name);
}
diff --git a/core/src/io/anuke/mindustry/editor/MapEditorDialog.java b/core/src/io/anuke/mindustry/editor/MapEditorDialog.java
index 2c8799cafa..33e9fe3a81 100644
--- a/core/src/io/anuke/mindustry/editor/MapEditorDialog.java
+++ b/core/src/io/anuke/mindustry/editor/MapEditorDialog.java
@@ -9,6 +9,7 @@ import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.ObjectMap;
+import io.anuke.mindustry.content.blocks.StorageBlocks;
import io.anuke.mindustry.core.Platform;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.io.Map;
@@ -587,7 +588,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
for(Block block : Block.all()){
TextureRegion[] regions = block.getCompactIcon();
- if((block.synthetic() && (Recipe.getByResult(block) == null || !control.database().isUnlocked(Recipe.getByResult(block)))) && !debug) continue;
+ if((block.synthetic() && (Recipe.getByResult(block) == null || !control.database().isUnlocked(Recipe.getByResult(block)))) && !debug && block != StorageBlocks.core) continue;
if(regions.length == 0 || regions[0] == Draw.region("jjfgj")) continue;
diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java
index 6d32b0f3fc..a115bda9a9 100644
--- a/core/src/io/anuke/mindustry/entities/Player.java
+++ b/core/src/io/anuke/mindustry/entities/Player.java
@@ -18,6 +18,7 @@ import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Trail;
import io.anuke.mindustry.net.In;
import io.anuke.mindustry.net.Net;
+import io.anuke.mindustry.net.NetConnection;
import io.anuke.mindustry.type.*;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
@@ -58,7 +59,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
public Color color = new Color();
public Mech mech;
- public int clientid = -1;
+ public NetConnection con;
public int playerIndex = 0;
public boolean isLocal = false;
public Timer timer = new Timer(4);
@@ -250,6 +251,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
@Override
public void removed() {
dropCarryLocal();
+
+ TileEntity core = getClosestCore();
+ if(core != null && ((CoreEntity)core).currentUnit == this){
+ ((CoreEntity)core).currentUnit = null;
+ }
}
@Override
diff --git a/core/src/io/anuke/mindustry/entities/effect/ItemDrop.java b/core/src/io/anuke/mindustry/entities/effect/ItemDrop.java
index aafc8ff57a..732b57afb3 100644
--- a/core/src/io/anuke/mindustry/entities/effect/ItemDrop.java
+++ b/core/src/io/anuke/mindustry/entities/effect/ItemDrop.java
@@ -28,7 +28,6 @@ import io.anuke.ucore.entities.trait.TimeTrait;
import io.anuke.ucore.entities.trait.VelocityTrait;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf;
-import io.anuke.ucore.util.Pooling;
import java.io.DataInput;
import java.io.DataOutput;
@@ -48,7 +47,7 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT
private float sinktime;
public static ItemDrop create(Item item, int amount, float x, float y, float angle){
- ItemDrop drop = Pooling.obtain(ItemDrop.class);
+ ItemDrop drop = new ItemDrop();
drop.item = item;
drop.amount = amount;
drop.velocity.set(4f, 0f).rotate(angle);
@@ -188,11 +187,6 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT
}
}
- @Override
- public void removed() {
- Pooling.free(this);
- }
-
@Override
public void reset() {
time = 0f;
diff --git a/core/src/io/anuke/mindustry/net/Administration.java b/core/src/io/anuke/mindustry/net/Administration.java
index 6a0df38c85..c63f628c2b 100644
--- a/core/src/io/anuke/mindustry/net/Administration.java
+++ b/core/src/io/anuke/mindustry/net/Administration.java
@@ -12,6 +12,7 @@ import io.anuke.mindustry.world.blocks.Rock;
import io.anuke.mindustry.world.blocks.StaticBlock;
import io.anuke.ucore.core.Settings;
+import static io.anuke.mindustry.Vars.headless;
import static io.anuke.mindustry.Vars.world;
public class Administration {
@@ -41,6 +42,15 @@ public class Administration {
return Settings.getBool("antigrief");
}
+ public boolean allowsCustomClients(){
+ return Settings.getBool("allow-custom", !headless);
+ }
+
+ public void setCustomClients(boolean allowed){
+ Settings.putBool("allow-custom", allowed);
+ Settings.save();
+ }
+
public boolean isValidateReplace(){
return false;
}
diff --git a/core/src/io/anuke/mindustry/net/Net.java b/core/src/io/anuke/mindustry/net/Net.java
index 06db5f2d56..a87ab23856 100644
--- a/core/src/io/anuke/mindustry/net/Net.java
+++ b/core/src/io/anuke/mindustry/net/Net.java
@@ -10,8 +10,6 @@ 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.net.Packet.ImportantPacket;
-import io.anuke.mindustry.net.Packet.UnimportantPacket;
import io.anuke.mindustry.net.Packets.StreamBegin;
import io.anuke.mindustry.net.Packets.StreamChunk;
import io.anuke.mindustry.net.Streamable.StreamBuilder;
@@ -183,13 +181,13 @@ public class Net{
}else if(clientListeners.get(object.getClass()) != null ||
listeners.get(object.getClass()) != null){
- if(clientLoaded || object instanceof ImportantPacket){
+ if(clientLoaded || ((object instanceof Packet) && ((Packet) object).isImportant())){
if(clientListeners.get(object.getClass()) != null) clientListeners.get(object.getClass()).accept(object);
if(listeners.get(object.getClass()) != null) listeners.get(object.getClass()).accept(object);
synchronized (packetPoolLock) {
Pooling.free(object);
}
- }else if(!(object instanceof UnimportantPacket)){
+ }else if(!((object instanceof Packet) && ((Packet) object).isUnimportant())){
packetQueue.add(object);
Log.info("Queuing packet {0}.", ClassReflection.getSimpleName(object.getClass()));
}else{
diff --git a/core/src/io/anuke/mindustry/net/Packet.java b/core/src/io/anuke/mindustry/net/Packet.java
index 4bbef9db0b..91f9b3a7de 100644
--- a/core/src/io/anuke/mindustry/net/Packet.java
+++ b/core/src/io/anuke/mindustry/net/Packet.java
@@ -5,11 +5,16 @@ import com.badlogic.gdx.utils.Pool.Poolable;
import java.nio.ByteBuffer;
public interface Packet extends Poolable{
- void read(ByteBuffer buffer);
- void write(ByteBuffer buffer);
+ default void read(ByteBuffer buffer){}
+ default void write(ByteBuffer buffer){}
default void reset() {}
- interface ImportantPacket{}
- interface UnimportantPacket{}
+ default boolean isImportant(){
+ return false;
+ }
+
+ default boolean isUnimportant(){
+ return false;
+ }
}
diff --git a/core/src/io/anuke/mindustry/net/Packets.java b/core/src/io/anuke/mindustry/net/Packets.java
index e627e3a19b..26041a4f55 100644
--- a/core/src/io/anuke/mindustry/net/Packets.java
+++ b/core/src/io/anuke/mindustry/net/Packets.java
@@ -6,8 +6,6 @@ import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.io.Version;
-import io.anuke.mindustry.net.Packet.ImportantPacket;
-import io.anuke.mindustry.net.Packet.UnimportantPacket;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.io.IOUtils;
import io.anuke.ucore.util.Mathf;
@@ -19,13 +17,23 @@ import static io.anuke.mindustry.Vars.world;
/**Class for storing all packets.*/
public class Packets {
- public static class Connect implements ImportantPacket{
+ public static class Connect implements Packet{
public int id;
public String addressTCP;
+
+ @Override
+ public boolean isImportant() {
+ return true;
+ }
}
- public static class Disconnect implements ImportantPacket{
+ public static class Disconnect implements Packet{
public int id;
+
+ @Override
+ public boolean isImportant() {
+ return true;
+ }
}
public static class WorldStream extends Streamable{
@@ -62,7 +70,7 @@ public class Packets {
}
public static class InvokePacket implements Packet{
- public byte type;
+ public byte type, priority;
public ByteBuffer writeBuffer;
public int writeLength;
@@ -70,6 +78,7 @@ public class Packets {
@Override
public void read(ByteBuffer buffer) {
type = buffer.get();
+ priority = buffer.get();
writeLength = buffer.getShort();
byte[] bytes = new byte[writeLength];
buffer.get(bytes);
@@ -79,6 +88,7 @@ public class Packets {
@Override
public void write(ByteBuffer buffer) {
buffer.put(type);
+ buffer.put(priority);
buffer.putShort((short)writeLength);
writeBuffer.position(0);
@@ -86,17 +96,20 @@ public class Packets {
buffer.put(writeBuffer.get());
}
}
- }
- public static class SnapshotPacket implements Packet, UnimportantPacket{
@Override
- public void read(ByteBuffer buffer) {
-
+ public void reset() {
+ priority = 0;
}
@Override
- public void write(ByteBuffer buffer) {
+ public boolean isImportant() {
+ return priority == 1;
+ }
+ @Override
+ public boolean isUnimportant() {
+ return priority == 2;
}
}
@@ -155,7 +168,7 @@ public class Packets {
}
public enum KickReason{
- kick, invalidPassword, clientOutdated, serverOutdated, banned, gameover(true), recentKick, nameInUse, idInUse, fastShoot, nameEmpty;
+ kick, invalidPassword, clientOutdated, serverOutdated, banned, gameover(true), recentKick, nameInUse, idInUse, fastShoot, nameEmpty, customClient;
public final boolean quiet;
KickReason(){ quiet = false; }
diff --git a/core/src/io/anuke/mindustry/net/Registrator.java b/core/src/io/anuke/mindustry/net/Registrator.java
index e8596b8a92..f35a991d50 100644
--- a/core/src/io/anuke/mindustry/net/Registrator.java
+++ b/core/src/io/anuke/mindustry/net/Registrator.java
@@ -13,7 +13,6 @@ public class Registrator {
WorldStream.class,
ConnectPacket.class,
ClientSnapshotPacket.class,
- SnapshotPacket.class,
InvokePacket.class
};
private static ObjectIntMap> ids = new ObjectIntMap<>();
diff --git a/core/src/io/anuke/mindustry/net/Streamable.java b/core/src/io/anuke/mindustry/net/Streamable.java
index 7a697f254e..5815fdd845 100644
--- a/core/src/io/anuke/mindustry/net/Streamable.java
+++ b/core/src/io/anuke/mindustry/net/Streamable.java
@@ -2,14 +2,13 @@ package io.anuke.mindustry.net;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.badlogic.gdx.utils.reflect.ReflectionException;
-import io.anuke.mindustry.net.Packet.ImportantPacket;
import io.anuke.mindustry.net.Packets.StreamBegin;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-public class Streamable implements ImportantPacket{
+public class Streamable implements Packet{
public transient ByteArrayInputStream stream;
public static class StreamBuilder{
@@ -47,4 +46,9 @@ public class Streamable implements ImportantPacket{
return stream.size() >= total;
}
}
+
+ @Override
+ public boolean isImportant() {
+ return true;
+ }
}
diff --git a/core/src/io/anuke/mindustry/ui/dialogs/AdminsDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/AdminsDialog.java
index f3b661ad38..c95577232f 100644
--- a/core/src/io/anuke/mindustry/ui/dialogs/AdminsDialog.java
+++ b/core/src/io/anuke/mindustry/ui/dialogs/AdminsDialog.java
@@ -2,8 +2,6 @@ package io.anuke.mindustry.ui.dialogs;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.net.Administration.PlayerInfo;
-import io.anuke.mindustry.net.Net;
-import io.anuke.mindustry.net.NetConnection;
import io.anuke.ucore.scene.ui.ScrollPane;
import io.anuke.ucore.scene.ui.layout.Table;
@@ -46,9 +44,8 @@ public class AdminsDialog extends FloatingDialog {
ui.showConfirm("$text.confirm", "$text.confirmunadmin", () -> {
netServer.admins.unAdminPlayer(info.id);
for(Player player : playerGroup.all()){
- NetConnection c = Net.getConnection(player.clientid);
- if(c != null){
- //CallClient.adminSet(player, false);
+ if(player.con != null){
+ player.isAdmin = false;
break;
}
}
diff --git a/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java b/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java
index 7249472f78..bcfee7c140 100644
--- a/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java
+++ b/core/src/io/anuke/mindustry/ui/fragments/BlocksFragment.java
@@ -182,7 +182,7 @@ public class BlocksFragment extends Fragment{
//add actual recipes
for (Recipe r : recipes) {
- if(r.debugOnly && !debug) continue;
+ if((r.debugOnly && !debug) || (r.desktopOnly && mobile)) continue;
ImageButton image = new ImageButton(new TextureRegion(), "select");
diff --git a/core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java b/core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java
index 3beaedda93..40d6598675 100644
--- a/core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java
+++ b/core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java
@@ -185,7 +185,7 @@ public class DebugFragment extends Fragment {
result.append(player.id);
result.append("\n");
result.append(" cid: ");
- result.append(player.clientid);
+ result.append(player.con.id);
result.append("\n");
result.append(" dead: ");
result.append(player.isDead());
diff --git a/core/src/io/anuke/mindustry/ui/fragments/PlayerListFragment.java b/core/src/io/anuke/mindustry/ui/fragments/PlayerListFragment.java
index eef477be68..3f5bb34777 100644
--- a/core/src/io/anuke/mindustry/ui/fragments/PlayerListFragment.java
+++ b/core/src/io/anuke/mindustry/ui/fragments/PlayerListFragment.java
@@ -87,7 +87,7 @@ public class PlayerListFragment extends Fragment{
float h = 74f;
for(Player player : playerGroup.all()){
- NetConnection connection = gwt ? null : Net.getConnection(player.clientid);
+ NetConnection connection = gwt ? null : player.con;
if(connection == null && Net.server() && !player.isLocal) continue;
diff --git a/core/src/io/anuke/mindustry/world/blocks/BreakBlock.java b/core/src/io/anuke/mindustry/world/blocks/BreakBlock.java
index b5930297be..2be166ba70 100644
--- a/core/src/io/anuke/mindustry/world/blocks/BreakBlock.java
+++ b/core/src/io/anuke/mindustry/world/blocks/BreakBlock.java
@@ -91,6 +91,8 @@ public class BreakBlock extends Block {
Shaders.blockbuild.color = Palette.remove;
+ if(entity.previous == null) return;
+
for(TextureRegion region : entity.previous.getBlockIcon()){
Shaders.blockbuild.region = region;
Shaders.blockbuild.progress = (float)(1f-entity.progress); //progress reversed
diff --git a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/BurstTurret.java b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/BurstTurret.java
index 3f00d99359..1093721863 100644
--- a/core/src/io/anuke/mindustry/world/blocks/defense/turrets/BurstTurret.java
+++ b/core/src/io/anuke/mindustry/world/blocks/defense/turrets/BurstTurret.java
@@ -29,9 +29,9 @@ public class BurstTurret extends ItemTurret {
entity.recoil = recoil;
tr.trns(entity.rotation, size * tilesize / 2, Mathf.range(xRand));
- useAmmo(tile);
bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy));
effects(tile);
+ useAmmo(tile);
});
}
}
diff --git a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java
index 6590444a8c..e9d4f2b57a 100644
--- a/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java
+++ b/core/src/io/anuke/mindustry/world/blocks/storage/CoreBlock.java
@@ -210,7 +210,7 @@ public class CoreBlock extends StorageBlock {
rect.setSize(supplyRadius*2).setCenter(tile.drawx(), tile.drawy());
Units.getNearby(tile.getTeam(), rect, unit -> {
- if(unit.isDead() || unit.distanceTo(tile.drawx(), tile.drawy()) > supplyRadius) return;
+ if(unit.isDead() || unit.distanceTo(tile.drawx(), tile.drawy()) > supplyRadius || unit.getGroup() == null) return;
for(int i = 0; i < tile.entity.items.items.length; i ++){
Item item = Item.getByID(i);
@@ -272,7 +272,7 @@ public class CoreBlock extends StorageBlock {
}
public class CoreEntity extends TileEntity{
- Unit currentUnit;
+ public Unit currentUnit;
int droneID = -1;
boolean solid = true;
float warmup;
diff --git a/server/src/io/anuke/mindustry/server/ServerControl.java b/server/src/io/anuke/mindustry/server/ServerControl.java
index fb127c26a7..8a217d5bc1 100644
--- a/server/src/io/anuke/mindustry/server/ServerControl.java
+++ b/server/src/io/anuke/mindustry/server/ServerControl.java
@@ -8,6 +8,7 @@ import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.game.Difficulty;
import io.anuke.mindustry.game.EventType.GameOverEvent;
import io.anuke.mindustry.game.GameMode;
+import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.io.Map;
import io.anuke.mindustry.io.SaveIO;
import io.anuke.mindustry.io.Version;
@@ -220,12 +221,7 @@ public class ServerControl extends Module {
if(playerGroup.size() > 0) {
info("&lyPlayers: {0}", playerGroup.size());
for (Player p : playerGroup.all()) {
- //TODO
- if(Net.getConnection(p.clientid) == null){
- netServer.onDisconnect(p);
- continue;
- }
- print(" &y{0} / Connection {1} / IP: {2}", p.name, p.clientid, Net.getConnection(p.clientid).address);
+ print(" &y{0} / Connection {1} / IP: {2}", p.name, p.con, p.con.address);
}
}else{
info("&lyNo players connected.");
@@ -239,7 +235,7 @@ public class ServerControl extends Module {
return;
}
- //netCommon.sendMessage("[GRAY][[Server]:[] " + arg[0]);
+ Call.sendMessage("[GRAY][[Server]:[] " + arg[0]);
info("&lyServer: &lb{0}", arg[0]);
});
@@ -296,6 +292,24 @@ public class ServerControl extends Module {
}
});
+ handler.register("allow-custom-clients", "[on/off]", "Allow or disallow custom clients.", arg -> {
+ if(arg.length == 0){
+ info("Custom clients are currently &lc{0}.", netServer.admins.allowsCustomClients() ? "allowed" : "disallowed");
+ return;
+ }
+
+ String s = arg[0];
+ if(s.equalsIgnoreCase("on")){
+ netServer.admins.setCustomClients(true);
+ info("Custom clients enabled.");
+ }else if(s.equalsIgnoreCase("off")){
+ netServer.admins.setCustomClients(false);
+ info("Custom clients disabled.");
+ }else{
+ err("Incorrect command usage.");
+ }
+ });
+
handler.register("shuffle", "", "Set map shuffling.", arg -> {
try{
@@ -324,7 +338,7 @@ public class ServerControl extends Module {
}
if(target != null){
- netServer.kick(target.clientid, KickReason.kick);
+ netServer.kick(target.con.id, KickReason.kick);
info("It is done.");
}else{
info("Nobody with that name could be found...");
@@ -347,10 +361,10 @@ public class ServerControl extends Module {
}
if(target != null){
- String ip = Net.getConnection(target.clientid).address;
+ String ip = target.con.address;
netServer.admins.banPlayerIP(ip);
netServer.admins.banPlayerID(target.uuid);
- netServer.kick(target.clientid, KickReason.banned);
+ netServer.kick(target.con.id, KickReason.banned);
info("Banned player by IP and ID: {0} / {1}", ip, target.uuid);
}else{
info("Nobody with that name could be found.");
@@ -391,10 +405,9 @@ public class ServerControl extends Module {
info("Banned player by IP: {0}.", arg[0]);
for(Player player : playerGroup.all()){
- if(Net.getConnection(player.clientid) != null &&
- Net.getConnection(player.clientid).address != null &&
- Net.getConnection(player.clientid).address.equals(arg[0])){
- netServer.kick(player.clientid, KickReason.banned);
+ if(player.con.address != null &&
+ player.con.address.equals(arg[0])){
+ netServer.kick(player.con.id, KickReason.banned);
break;
}
}
@@ -409,7 +422,7 @@ public class ServerControl extends Module {
for(Player player : playerGroup.all()){
if(player.uuid.equals(arg[0])){
- netServer.kick(player.clientid, KickReason.banned);
+ netServer.kick(player.con.id, KickReason.banned);
break;
}
}