Compare commits

...

14 Commits
v41 ... v44

Author SHA1 Message Date
Anuken
423f5f16bb Fixed extremely glitchy player pickup 2018-07-04 12:31:09 -04:00
Anuken
1c8c702afd Made flying units appear later in waves 2018-07-04 11:58:41 -04:00
Anuken
d2a739262d Added admin wave sending / Admin system fixes / Build fix 2018-07-04 11:57:04 -04:00
Anuken
76d0285e3f Added freebuild / Power system fix / Net packet pool fix / Crash fixes 2018-07-04 11:38:59 -04:00
Anuken
12f444750c Fixed custom client inversion 2018-07-03 20:03:51 -04:00
Anuken
5fdf7e3a12 Updated annotations module 2018-07-03 19:58:24 -04:00
Anuken
60deb9205b uCore update / Kick packet priority / Custom client lock / Net fixes 2018-07-03 19:48:29 -04:00
Anuken
359a392cca Fixed various bugs and crashes 2018-07-03 15:53:06 -04:00
Anuken
4d600f973a Added max power output display to item power generator 2018-07-03 13:20:01 -04:00
Anuken
4a626bc920 Various net crashes fixed 2018-07-03 13:13:02 -04:00
Anuken
3597860074 Additional crashes/synchronizations fixed 2018-07-03 12:57:22 -04:00
Anuken
68d2c30c38 More bugfixes 2018-07-03 12:48:20 -04:00
Anuken
e210d9c08e Fixed server verifying mobile player positions 2018-07-03 12:29:14 -04:00
Anuken
c9b77e4e23 Crash fixes 2018-07-03 12:27:37 -04:00
70 changed files with 576 additions and 428 deletions

View File

@@ -28,6 +28,8 @@ public class Annotations {
boolean unreliable() default false; boolean unreliable() default false;
/**The simple class name where this method is placed.*/ /**The simple class name where this method is placed.*/
String in() default "Call"; 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()}.<br> /**Specifies that this method will be used to write classes of the type returned by {@link #value()}.<br>
@@ -48,6 +50,15 @@ public class Annotations {
Class<?> value(); 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.*/ /**A set of two booleans, one specifying server and one specifying client.*/
public enum Loc { public enum Loc {
/**Method can only be invoked on the client from the server.*/ /**Method can only be invoked on the client from the server.*/

View File

@@ -1,6 +1,7 @@
package io.anuke.annotations; package io.anuke.annotations;
import io.anuke.annotations.Annotations.Loc; import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.PacketPriority;
import io.anuke.annotations.Annotations.Variant; import io.anuke.annotations.Annotations.Variant;
import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ExecutableElement;
@@ -26,9 +27,11 @@ public class MethodEntry {
public final int id; public final int id;
/**The element method associated with this entry.*/ /**The element method associated with this entry.*/
public final ExecutableElement element; 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, 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.className = className;
this.forward = forward; this.forward = forward;
this.targetMethod = targetMethod; this.targetMethod = targetMethod;
@@ -38,6 +41,7 @@ public class MethodEntry {
this.id = id; this.id = id;
this.element = element; this.element = element;
this.unreliable = unreliable; this.unreliable = unreliable;
this.priority = priority;
} }
@Override @Override

View File

@@ -114,7 +114,7 @@ public class RemoteMethodAnnotationProcessor extends AbstractProcessor {
//create and add entry //create and add entry
MethodEntry method = new MethodEntry(entry.name, Utils.getMethodName(element), annotation.targets(), annotation.variants(), 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); entry.methods.add(method);
methods.add(method); methods.add(method);

View File

@@ -117,7 +117,7 @@ public class RemoteReadGenerator {
if(entry.forward && entry.where.isServer && needsPlayer){ if(entry.forward && entry.where.isServer && needsPlayer){
//call forwarded method //call forwarded method
readBlock.addStatement(packageName + "." + entry.className + "." + entry.element.getSimpleName() + 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)"); readBlock.nextControlFlow("catch (java.lang.Exception e)");

View File

@@ -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"); method.addStatement("$1N packet = $2N.obtain($1N.class)", "io.anuke.mindustry.net.Packets.InvokePacket", "com.badlogic.gdx.utils.Pools");
//assign buffer //assign buffer
method.addStatement("packet.writeBuffer = TEMP_BUFFER"); method.addStatement("packet.writeBuffer = TEMP_BUFFER");
//assign priority
method.addStatement("packet.priority = (byte)" + methodEntry.priority.ordinal());
//assign method ID //assign method ID
method.addStatement("packet.type = (byte)" + methodEntry.id); method.addStatement("packet.type = (byte)" + methodEntry.id);
//rewind buffer //rewind buffer

View File

@@ -27,7 +27,7 @@ allprojects {
gdxVersion = '1.9.8' gdxVersion = '1.9.8'
roboVMVersion = '2.3.0' roboVMVersion = '2.3.0'
aiVersion = '1.8.1' aiVersion = '1.8.1'
uCoreVersion = 'bc1c2e0848' uCoreVersion = 'e7a37cff68'
getVersionString = { getVersionString = {
String buildVersion = getBuildVersion() String buildVersion = getBuildVersion()

View File

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 220 B

View File

@@ -1,7 +1,6 @@
text.about=Created by [ROYAL]Anuken[] - [SKY]anukendev@gmail.com[] text.about=Created by [ROYAL]Anuken[] - [SKY]anukendev@gmail.com[]
text.credits=Credits text.credits=Credits
text.discord=Join the mindustry discord! text.discord=Join the mindustry discord!
text.changes=[SCARLET]Attention!\n[]Some important game mechanics have been changed.\n\n- [accent]Teleporters[] now use power.\n- [accent]Smelteries[] and [accent]crucibles[] now have a maximum item capacity.\n- [accent]Crucibles[] now require coal as fuel.
text.link.discord.description=the official Mindustry discord chatroom text.link.discord.description=the official Mindustry discord chatroom
text.link.github.description=Game source code text.link.github.description=Game source code
text.link.dev-builds.description=Unstable development builds text.link.dev-builds.description=Unstable development builds
@@ -76,6 +75,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.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.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.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.connected={0} has joined.
text.server.disconnected={0} has disconnected. text.server.disconnected={0} has disconnected.
text.nohost=Can't host server on a custom map! text.nohost=Can't host server on a custom map!
@@ -270,15 +270,6 @@ text.info.title=[accent]Info
text.error.title=[crimson]An error has occured text.error.title=[crimson]An error has occured
text.error.crashmessage=[SCARLET]An unexpected error has occured, which would have caused a crash.\n[]Please report the exact circumstances under which this error occured to the developer: \n[ORANGE]anukendev@gmail.com[] text.error.crashmessage=[SCARLET]An unexpected error has occured, which would have caused a crash.\n[]Please report the exact circumstances under which this error occured to the developer: \n[ORANGE]anukendev@gmail.com[]
text.error.crashtitle=An error has occured text.error.crashtitle=An error has occured
text.mode.break=Break mode: {0}
text.mode.place=Place mode: {0}
placemode.hold.name=line
placemode.areadelete.name=area
placemode.touchdelete.name=touch
placemode.holddelete.name=hold
placemode.none.name=none
placemode.touch.name=touch
placemode.cursor.name=cursor
text.blocks.blockinfo=Block Info text.blocks.blockinfo=Block Info
text.blocks.powercapacity=Power Capacity text.blocks.powercapacity=Power Capacity
text.blocks.powershot=Power/Shot text.blocks.powershot=Power/Shot

View File

@@ -111,21 +111,21 @@ carbide-drill-top
index: -1 index: -1
laser-drill laser-drill
rotate: false rotate: false
xy: 184, 99 xy: 202, 99
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
laser-drill-rotator laser-drill-rotator
rotate: false rotate: false
xy: 202, 99 xy: 184, 81
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
laser-drill-top laser-drill-top
rotate: false rotate: false
xy: 184, 81 xy: 220, 99
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -874,7 +874,7 @@ cross-1
index: -1 index: -1
cross-2 cross-2
rotate: false rotate: false
xy: 339, 117 xy: 357, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -1299,107 +1299,121 @@ block-icon-arc-smelter
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
biomattercompressor arc-smelter-top
rotate: false rotate: false
xy: 507, 191 xy: 507, 191
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 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 rotate: false
xy: 525, 191 xy: 525, 191
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
biomattercompressor-frame1 biomattercompressor-frame0
rotate: false rotate: false
xy: 543, 191 xy: 543, 191
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
biomattercompressor-frame2 biomattercompressor-frame1
rotate: false rotate: false
xy: 561, 191 xy: 561, 191
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
biomattercompressor-liquid biomattercompressor-frame2
rotate: false rotate: false
xy: 713, 301 xy: 713, 301
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
biomattercompressor-top biomattercompressor-liquid
rotate: false rotate: false
xy: 710, 283 xy: 710, 283
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blast-mixer biomattercompressor-top
rotate: false rotate: false
xy: 739, 310 xy: 739, 310
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
blast-mixer
rotate: false
xy: 977, 413
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
block-icon-blast-mixer block-icon-blast-mixer
rotate: false rotate: false
xy: 739, 310 xy: 977, 413
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
centrifuge-liquid centrifuge-liquid
rotate: false rotate: false
xy: 303, 117 xy: 321, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
cryofluidmixer-bottom cryofluidmixer-bottom
rotate: false rotate: false
xy: 357, 117 xy: 375, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
cryofluidmixer-liquid cryofluidmixer-liquid
rotate: false rotate: false
xy: 375, 117 xy: 393, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
cryofluidmixer-top cryofluidmixer-top
rotate: false rotate: false
xy: 393, 117 xy: 411, 116
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
cultivator cultivator
rotate: false rotate: false
xy: 411, 116 xy: 429, 122
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
cultivator-middle cultivator-middle
rotate: false rotate: false
xy: 429, 122 xy: 447, 122
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
cultivator-top cultivator-top
rotate: false rotate: false
xy: 447, 122 xy: 465, 122
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -1413,47 +1427,33 @@ lavasmelter
index: -1 index: -1
phase-weaver phase-weaver
rotate: false rotate: false
xy: 220, 99 xy: 202, 81
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
phase-weaver-bottom phase-weaver-bottom
rotate: false rotate: false
xy: 202, 81 xy: 238, 99
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
phase-weaver-weave phase-weaver-weave
rotate: false rotate: false
xy: 238, 99 xy: 220, 81
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
plastanium-compressor-top plastanium-compressor-top
rotate: false
xy: 220, 81
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
poweralloysmelter-top
rotate: false rotate: false
xy: 256, 99 xy: 256, 99
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
powersmelter-top poweralloysmelter-top
rotate: false
xy: 238, 81
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
silicon-smelter-top
rotate: false rotate: false
xy: 238, 81 xy: 238, 81
size: 16, 16 size: 16, 16
@@ -1504,14 +1504,14 @@ block-1-top
index: -1 index: -1
block-2 block-2
rotate: false rotate: false
xy: 977, 413 xy: 995, 419
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
block-2-top block-2-top
rotate: false rotate: false
xy: 995, 419 xy: 995, 401
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -1616,14 +1616,14 @@ hail-heat
index: -1 index: -1
lancer lancer
rotate: false rotate: false
xy: 166, 89 xy: 166, 71
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
lancer-heat lancer-heat
rotate: false rotate: false
xy: 166, 71 xy: 184, 99
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -1714,28 +1714,28 @@ wave-liquid
index: -1 index: -1
drone-factory-top drone-factory-top
rotate: false rotate: false
xy: 849, 399 xy: 831, 380
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
drone-factory-top-open drone-factory-top-open
rotate: false rotate: false
xy: 831, 380 xy: 849, 381
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
fabricator-factory-top fabricator-factory-top
rotate: false rotate: false
xy: 849, 381 xy: 828, 362
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
fabricator-factory-top-open fabricator-factory-top-open
rotate: false rotate: false
xy: 828, 362 xy: 829, 344
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -1749,21 +1749,21 @@ mech-factory
index: -1 index: -1
dart-ship-factory-open dart-ship-factory-open
rotate: false rotate: false
xy: 465, 122 xy: 483, 122
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
delta-mech-factory-open delta-mech-factory-open
rotate: false rotate: false
xy: 483, 122 xy: 831, 398
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
javelin-ship-factory-open javelin-ship-factory-open
rotate: false rotate: false
xy: 829, 308 xy: 166, 89
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -1791,7 +1791,7 @@ ship-factory
index: -1 index: -1
door-large-open door-large-open
rotate: false rotate: false
xy: 831, 398 xy: 849, 399
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2001,7 +2001,7 @@ block-icon-arc
index: -1 index: -1
block-icon-biomattercompressor block-icon-biomattercompressor
rotate: false rotate: false
xy: 995, 401 xy: 427, 158
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2064,28 +2064,28 @@ carbide-wall
index: -1 index: -1
block-icon-carbide-wall-large block-icon-carbide-wall-large
rotate: false rotate: false
xy: 427, 158 xy: 445, 158
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
carbide-wall-large carbide-wall-large
rotate: false rotate: false
xy: 427, 158 xy: 445, 158
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
block-icon-centrifuge block-icon-centrifuge
rotate: false rotate: false
xy: 445, 158 xy: 420, 140
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
centrifuge centrifuge
rotate: false rotate: false
xy: 445, 158 xy: 420, 140
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2141,14 +2141,14 @@ core
index: -1 index: -1
block-icon-cryofluidmixer block-icon-cryofluidmixer
rotate: false rotate: false
xy: 420, 140 xy: 438, 140
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
block-icon-cultivator block-icon-cultivator
rotate: false rotate: false
xy: 438, 140 xy: 757, 310
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2162,14 +2162,14 @@ block-icon-cyclone
index: -1 index: -1
block-icon-dart-ship-factory block-icon-dart-ship-factory
rotate: false rotate: false
xy: 757, 310 xy: 775, 312
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
dart-ship-factory dart-ship-factory
rotate: false rotate: false
xy: 757, 310 xy: 775, 312
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2218,42 +2218,42 @@ block-icon-phase-wall
index: -1 index: -1
block-icon-deflector-wall-large block-icon-deflector-wall-large
rotate: false rotate: false
xy: 775, 312 xy: 487, 171
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
deflector-wall-large deflector-wall-large
rotate: false rotate: false
xy: 775, 312 xy: 487, 171
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
phase-wall-large phase-wall-large
rotate: false rotate: false
xy: 775, 312 xy: 487, 171
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
block-icon-phase-wall-large block-icon-phase-wall-large
rotate: false rotate: false
xy: 775, 312 xy: 487, 171
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
block-icon-delta-mech-factory block-icon-delta-mech-factory
rotate: false rotate: false
xy: 487, 171 xy: 579, 188
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
delta-mech-factory delta-mech-factory
rotate: false rotate: false
xy: 487, 171 xy: 579, 188
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2288,21 +2288,21 @@ door
index: -1 index: -1
block-icon-door-large block-icon-door-large
rotate: false rotate: false
xy: 579, 188 xy: 597, 188
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
door-large door-large
rotate: false rotate: false
xy: 579, 188 xy: 597, 188
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
block-icon-drone-factory block-icon-drone-factory
rotate: false rotate: false
xy: 597, 188 xy: 615, 188
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2330,7 +2330,7 @@ block-icon-duo
index: -1 index: -1
block-icon-fabricator-factory block-icon-fabricator-factory
rotate: false rotate: false
xy: 615, 188 xy: 633, 188
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2442,14 +2442,14 @@ itemvoid
index: -1 index: -1
block-icon-javelin-ship-factory block-icon-javelin-ship-factory
rotate: false rotate: false
xy: 633, 188 xy: 665, 187
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
javelin-ship-factory javelin-ship-factory
rotate: false rotate: false
xy: 633, 188 xy: 665, 187
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2477,7 +2477,7 @@ block-icon-lancer
index: -1 index: -1
block-icon-laser-drill block-icon-laser-drill
rotate: false rotate: false
xy: 665, 187 xy: 683, 187
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2610,14 +2610,14 @@ metalfloor1
index: -1 index: -1
block-icon-multiplexer block-icon-multiplexer
rotate: false rotate: false
xy: 683, 187 xy: 456, 140
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
multiplexer multiplexer
rotate: false rotate: false
xy: 683, 187 xy: 456, 140
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2715,7 +2715,7 @@ phase-conveyor
index: -1 index: -1
block-icon-phase-weaver block-icon-phase-weaver
rotate: false rotate: false
xy: 456, 140 xy: 463, 158
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2729,14 +2729,14 @@ block-icon-plasma-drill
index: -1 index: -1
block-icon-plastanium-compressor block-icon-plastanium-compressor
rotate: false rotate: false
xy: 463, 158 xy: 474, 140
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
plastanium-compressor plastanium-compressor
rotate: false rotate: false
xy: 463, 158 xy: 474, 140
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2757,14 +2757,14 @@ power-node
index: -1 index: -1
block-icon-power-node-large block-icon-power-node-large
rotate: false rotate: false
xy: 474, 140 xy: 793, 344
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
power-node-large power-node-large
rotate: false rotate: false
xy: 474, 140 xy: 793, 344
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2813,42 +2813,42 @@ block-icon-pulverizer
index: -1 index: -1
block-icon-pyratite-mixer block-icon-pyratite-mixer
rotate: false rotate: false
xy: 793, 344 xy: 793, 312
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
pyratite-mixer pyratite-mixer
rotate: false rotate: false
xy: 793, 344 xy: 793, 312
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
block-icon-reconstructor block-icon-reconstructor
rotate: false rotate: false
xy: 793, 312 xy: 811, 343
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
drone-factory drone-factory
rotate: false rotate: false
xy: 793, 312 xy: 811, 343
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
fabricator-factory fabricator-factory
rotate: false rotate: false
xy: 793, 312 xy: 811, 343
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
reconstructor reconstructor
rotate: false rotate: false
xy: 793, 312 xy: 811, 343
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -2904,14 +2904,14 @@ rock1
index: -1 index: -1
block-icon-rotary-pump block-icon-rotary-pump
rotate: false rotate: false
xy: 811, 343 xy: 177, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
rotary-pump rotary-pump
rotate: false rotate: false
xy: 811, 343 xy: 177, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -3002,14 +3002,14 @@ shrub
index: -1 index: -1
block-icon-silicon-smelter block-icon-silicon-smelter
rotate: false rotate: false
xy: 177, 117 xy: 195, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
silicon-smelter silicon-smelter
rotate: false rotate: false
xy: 177, 117 xy: 195, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -3170,28 +3170,28 @@ block-icon-swarmer
index: -1 index: -1
block-icon-thermal-generator block-icon-thermal-generator
rotate: false rotate: false
xy: 195, 117 xy: 213, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
thermal-generator thermal-generator
rotate: false rotate: false
xy: 195, 117 xy: 213, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
block-icon-thermal-pump block-icon-thermal-pump
rotate: false rotate: false
xy: 213, 117 xy: 231, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
thermal-pump thermal-pump
rotate: false rotate: false
xy: 213, 117 xy: 231, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -3212,14 +3212,14 @@ thorium-wall
index: -1 index: -1
block-icon-thorium-wall-large block-icon-thorium-wall-large
rotate: false rotate: false
xy: 231, 117 xy: 249, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
thorium-wall-large thorium-wall-large
rotate: false rotate: false
xy: 231, 117 xy: 249, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -3261,28 +3261,28 @@ tungsten-wall
index: -1 index: -1
block-icon-tungsten-wall-large block-icon-tungsten-wall-large
rotate: false rotate: false
xy: 249, 117 xy: 267, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
tungsten-wall-large tungsten-wall-large
rotate: false rotate: false
xy: 249, 117 xy: 267, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
block-icon-turbine-generator block-icon-turbine-generator
rotate: false rotate: false
xy: 267, 117 xy: 285, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
turbine-generator turbine-generator
rotate: false rotate: false
xy: 267, 117 xy: 285, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -3345,7 +3345,7 @@ water
index: -1 index: -1
block-icon-water-extractor block-icon-water-extractor
rotate: false rotate: false
xy: 285, 117 xy: 303, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4411,7 +4411,7 @@ discord-banner-over
index: -1 index: -1
controller-cursor controller-cursor
rotate: false rotate: false
xy: 321, 117 xy: 339, 117
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4453,14 +4453,14 @@ icon-areaDelete
index: -1 index: -1
icon-arrow icon-arrow
rotate: false rotate: false
xy: 829, 344 xy: 429, 104
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-arrow-16 icon-arrow-16
rotate: false rotate: false
xy: 829, 344 xy: 429, 104
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4495,7 +4495,7 @@ icon-arrow-up
index: -1 index: -1
icon-back icon-back
rotate: false rotate: false
xy: 429, 104 xy: 447, 104
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4509,14 +4509,14 @@ icon-ban
index: -1 index: -1
icon-break icon-break
rotate: false rotate: false
xy: 447, 104 xy: 465, 104
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-cancel icon-cancel
rotate: false rotate: false
xy: 465, 104 xy: 483, 104
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4530,7 +4530,7 @@ icon-chat
index: -1 index: -1
icon-check icon-check
rotate: false rotate: false
xy: 483, 104 xy: 867, 399
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4607,14 +4607,14 @@ icon-egg
index: -1 index: -1
icon-elevation icon-elevation
rotate: false rotate: false
xy: 867, 399 xy: 867, 381
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-eraser icon-eraser
rotate: false rotate: false
xy: 867, 381 xy: 885, 401
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4628,14 +4628,14 @@ icon-exit
index: -1 index: -1
icon-file icon-file
rotate: false rotate: false
xy: 885, 401 xy: 885, 383
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-file-image icon-file-image
rotate: false rotate: false
xy: 885, 383 xy: 903, 401
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4649,7 +4649,7 @@ icon-file-text
index: -1 index: -1
icon-fill icon-fill
rotate: false rotate: false
xy: 903, 401 xy: 903, 383
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4663,7 +4663,7 @@ icon-floppy
index: -1 index: -1
icon-floppy-16 icon-floppy-16
rotate: false rotate: false
xy: 903, 383 xy: 921, 401
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4705,7 +4705,7 @@ icon-google-play
index: -1 index: -1
icon-grid icon-grid
rotate: false rotate: false
xy: 921, 401 xy: 921, 383
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4761,7 +4761,7 @@ icon-items-none
index: -1 index: -1
icon-line icon-line
rotate: false rotate: false
xy: 921, 383 xy: 939, 401
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4789,28 +4789,28 @@ icon-load
index: -1 index: -1
icon-load-image icon-load-image
rotate: false rotate: false
xy: 939, 401 xy: 939, 383
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-load-map icon-load-map
rotate: false rotate: false
xy: 939, 383 xy: 957, 401
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-loading icon-loading
rotate: false rotate: false
xy: 957, 401 xy: 957, 383
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-locked icon-locked
rotate: false rotate: false
xy: 957, 383 xy: 975, 395
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4838,7 +4838,7 @@ icon-menu
index: -1 index: -1
icon-menu-large icon-menu-large
rotate: false rotate: false
xy: 975, 395 xy: 975, 377
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4859,7 +4859,7 @@ icon-pause
index: -1 index: -1
icon-pencil icon-pencil
rotate: false rotate: false
xy: 975, 377 xy: 993, 383
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4873,7 +4873,7 @@ icon-pencil-small
index: -1 index: -1
icon-pick icon-pick
rotate: false rotate: false
xy: 993, 383 xy: 993, 365
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4922,7 +4922,7 @@ icon-quit
index: -1 index: -1
icon-redo icon-redo
rotate: false rotate: false
xy: 993, 365 xy: 665, 169
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4943,7 +4943,7 @@ icon-rename
index: -1 index: -1
icon-resize icon-resize
rotate: false rotate: false
xy: 665, 169 xy: 683, 169
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -4985,14 +4985,14 @@ icon-save
index: -1 index: -1
icon-save-image icon-save-image
rotate: false rotate: false
xy: 683, 169 xy: 701, 171
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
index: -1 index: -1
icon-save-map icon-save-map
rotate: false rotate: false
xy: 701, 171 xy: 719, 171
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -5006,7 +5006,7 @@ icon-settings
index: -1 index: -1
icon-terrain icon-terrain
rotate: false rotate: false
xy: 719, 171 xy: 811, 325
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -5041,7 +5041,7 @@ icon-trash
index: -1 index: -1
icon-trash-16 icon-trash-16
rotate: false rotate: false
xy: 811, 325 xy: 829, 326
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -5062,7 +5062,7 @@ icon-tutorial
index: -1 index: -1
icon-undo icon-undo
rotate: false rotate: false
xy: 829, 326 xy: 811, 307
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0
@@ -5097,7 +5097,7 @@ icon-wiki
index: -1 index: -1
icon-zoom icon-zoom
rotate: false rotate: false
xy: 811, 307 xy: 829, 308
size: 16, 16 size: 16, 16
orig: 16, 16 orig: 16, 16
offset: 0, 0 offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 131 KiB

View File

@@ -108,8 +108,8 @@ public class Recipes implements ContentList{
new Recipe(distribution, StorageBlocks.vault, new ItemStack(Items.carbide, 500), new ItemStack(Items.thorium, 350)); new Recipe(distribution, StorageBlocks.vault, new ItemStack(Items.carbide, 500), new ItemStack(Items.thorium, 350));
//DRILLS, PRODUCERS //DRILLS, PRODUCERS
new Recipe(production, ProductionBlocks.tungstenDrill, new ItemStack(Items.tungsten, 30)); new Recipe(production, ProductionBlocks.tungstenDrill, new ItemStack(Items.tungsten, 25));
new Recipe(production, ProductionBlocks.carbideDrill, new ItemStack(Items.tungsten, 60), new ItemStack(Items.carbide, 60)); 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.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)); new Recipe(production, ProductionBlocks.waterextractor, new ItemStack(Items.tungsten, 50), new ItemStack(Items.carbide, 50), new ItemStack(Items.lead, 40));

View File

@@ -13,7 +13,7 @@ public class PowerBlocks extends BlockList implements ContentList {
@Override @Override
public void load() { public void load() {
combustionGenerator = new BurnerGenerator("combustion-generator") {{ combustionGenerator = new BurnerGenerator("combustion-generator") {{
powerOutput = 0.06f; powerOutput = 0.09f;
powerCapacity = 40f; powerCapacity = 40f;
itemDuration = 40f; itemDuration = 40f;
}}; }};
@@ -27,7 +27,7 @@ public class PowerBlocks extends BlockList implements ContentList {
}}; }};
turbineGenerator = new TurbineGenerator("turbine-generator") {{ turbineGenerator = new TurbineGenerator("turbine-generator") {{
powerOutput = 0.15f; powerOutput = 0.25f;
powerCapacity = 40f; powerCapacity = 40f;
itemDuration = 30f; itemDuration = 30f;
size = 2; size = 2;

View File

@@ -18,7 +18,7 @@ public class ProductionBlocks extends BlockList implements ContentList {
public void load() { public void load() {
tungstenDrill = new Drill("tungsten-drill") {{ tungstenDrill = new Drill("tungsten-drill") {{
tier = 2; tier = 2;
drillTime = 360; drillTime = 340;
}}; }};
carbideDrill = new Drill("carbide-drill") {{ carbideDrill = new Drill("carbide-drill") {{

View File

@@ -21,11 +21,12 @@ public class TurretBlocks extends BlockList implements ContentList {
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletPyratite, AmmoTypes.bulletSilicon}; ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletPyratite, AmmoTypes.bulletSilicon};
reload = 25f; reload = 25f;
restitution = 0.03f; restitution = 0.03f;
range = 80f; range = 90f;
shootCone = 15f; shootCone = 15f;
ammoUseEffect = ShootFx.shellEjectSmall; ammoUseEffect = ShootFx.shellEjectSmall;
health = 80; health = 80;
inaccuracy = 3f; inaccuracy = 2f;
rotatespeed = 10f;
}}; }};
/* /*
scatter = new BurstTurret("scatter") {{ scatter = new BurstTurret("scatter") {{
@@ -52,10 +53,10 @@ public class TurretBlocks extends BlockList implements ContentList {
scorch = new LiquidTurret("scorch") {{ scorch = new LiquidTurret("scorch") {{
ammoTypes = new AmmoType[]{AmmoTypes.basicFlame}; ammoTypes = new AmmoType[]{AmmoTypes.basicFlame};
recoil = 0f; recoil = 0f;
reload = 5f; reload = 4f;
shootCone = 50f; shootCone = 50f;
ammoUseEffect = ShootFx.shellEjectSmall; 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); drawer = (tile, entity) -> Draw.rect(entity.target != null ? name + "-shoot" : name, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
}}; }};

View File

@@ -1,6 +1,9 @@
package io.anuke.mindustry.core; package io.anuke.mindustry.core;
import com.badlogic.gdx.utils.*; import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.ObjectSet;
import com.badlogic.gdx.utils.OrderedMap;
import com.badlogic.gdx.utils.OrderedSet;
import io.anuke.mindustry.content.*; import io.anuke.mindustry.content.*;
import io.anuke.mindustry.content.blocks.*; import io.anuke.mindustry.content.blocks.*;
import io.anuke.mindustry.content.bullets.*; import io.anuke.mindustry.content.bullets.*;
@@ -28,6 +31,7 @@ public class ContentLoader {
private static boolean loaded = false; private static boolean loaded = false;
private static ObjectSet<Array<? extends Content>> contentSet = new OrderedSet<>(); private static ObjectSet<Array<? extends Content>> contentSet = new OrderedSet<>();
private static OrderedMap<String, Array<Content>> contentMap = new OrderedMap<>(); private static OrderedMap<String, Array<Content>> contentMap = new OrderedMap<>();
private static ObjectSet<Consumer<Content>> initialization = new ObjectSet<>();
private static ContentList[] content = { private static ContentList[] content = {
//effects //effects
new BlockFx(), new BlockFx(),
@@ -132,11 +136,15 @@ public class ContentLoader {
/**Initializes all content with the specified function.*/ /**Initializes all content with the specified function.*/
public static void initialize(Consumer<Content> callable){ public static void initialize(Consumer<Content> callable){
if(initialization.contains(callable)) return;
for(Array<? extends Content> arr : contentSet){ for(Array<? extends Content> arr : contentSet){
for(Content content : arr){ for(Content content : arr){
callable.accept(content); callable.accept(content);
} }
} }
initialization.add(callable);
} }
public static void dispose(){ public static void dispose(){

View File

@@ -13,10 +13,10 @@ import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.game.Content; import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.game.ContentDatabase; import io.anuke.mindustry.game.ContentDatabase;
import io.anuke.mindustry.game.EventType.*; import io.anuke.mindustry.game.EventType.*;
import io.anuke.mindustry.input.MobileInput;
import io.anuke.mindustry.input.DefaultKeybinds; import io.anuke.mindustry.input.DefaultKeybinds;
import io.anuke.mindustry.input.DesktopInput; import io.anuke.mindustry.input.DesktopInput;
import io.anuke.mindustry.input.InputHandler; import io.anuke.mindustry.input.InputHandler;
import io.anuke.mindustry.input.MobileInput;
import io.anuke.mindustry.io.Map; import io.anuke.mindustry.io.Map;
import io.anuke.mindustry.io.Saves; import io.anuke.mindustry.io.Saves;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
@@ -285,6 +285,7 @@ public class Control extends Module{
@Override @Override
public void dispose(){ public void dispose(){
Platform.instance.onGameExit(); Platform.instance.onGameExit();
ContentLoader.dispose();
Net.dispose(); Net.dispose();
ui.editor.dispose(); ui.editor.dispose();
} }
@@ -321,6 +322,18 @@ public class Control extends Module{
}); });
} }
if(!Settings.has("4.0-no-sound")){
Settings.putBool("4.0-no-sound", true);
Timers.runTask(4f, () -> {
FloatingDialog dialog = new FloatingDialog("[orange]Attention![]");
dialog.buttons().addButton("$text.ok", dialog::hide).size(100f, 60f);
dialog.content().add("You might have noticed that 4.0 does not have any sound.\nThis is [orange]intentional![] Sound will be added in a later update.\n\n[LIGHT_GRAY](now stop reporting this as a bug)").wrap().width(500f);
dialog.show();
});
}
} }
/**Called from main logic thread.*/ /**Called from main logic thread.*/
@@ -355,7 +368,7 @@ public class Control extends Module{
} }
//check unlocks every 2 seconds //check unlocks every 2 seconds
if(!state.mode.infiniteResources && !state.mode.disableWaveTimer && Timers.get("timerCheckUnlock", 120)){ if(!state.mode.infiniteResources && Timers.get("timerCheckUnlock", 120)){
checkUnlockableBlocks(); checkUnlockableBlocks();
//save if the db changed, but don't save unlocks //save if the db changed, but don't save unlocks

View File

@@ -12,8 +12,6 @@ public class GameState{
public int wave = 1; public int wave = 1;
public float wavetime; public float wavetime;
public float extrawavetime;
public int enemies = 0;
public boolean gameOver = false; public boolean gameOver = false;
public GameMode mode = GameMode.waves; public GameMode mode = GameMode.waves;
public Difficulty difficulty = Difficulty.normal; public Difficulty difficulty = Difficulty.normal;

View File

@@ -70,9 +70,7 @@ public class Logic extends Module {
public void reset(){ public void reset(){
state.wave = 1; state.wave = 1;
state.extrawavetime = maxwavespace * state.difficulty.maxTimeScaling;
state.wavetime = wavespace * state.difficulty.timeScaling; state.wavetime = wavespace * state.difficulty.timeScaling;
state.enemies = 0;
state.gameOver = false; state.gameOver = false;
state.teams = new TeamInfo(); state.teams = new TeamInfo();
state.teams.add(Team.blue, true); state.teams.add(Team.blue, true);
@@ -89,7 +87,6 @@ public class Logic extends Module {
state.spawner.spawnEnemies(); state.spawner.spawnEnemies();
state.wave ++; state.wave ++;
state.wavetime = wavespace * state.difficulty.timeScaling; state.wavetime = wavespace * state.difficulty.timeScaling;
state.extrawavetime = maxwavespace * state.difficulty.maxTimeScaling;
Events.fire(WaveEvent.class); Events.fire(WaveEvent.class);
} }
@@ -133,15 +130,10 @@ public class Logic extends Module {
if(!state.is(State.paused) || Net.active()){ if(!state.is(State.paused) || Net.active()){
if(!state.mode.disableWaveTimer){ if(!state.mode.disableWaveTimer){
state.wavetime -= Timers.delta();
if(state.enemies <= 0){
if(!world.getMap().name.equals("tutorial")) state.wavetime -= Timers.delta();
}else{
state.extrawavetime -= Timers.delta();
}
} }
if(!Net.client() && (state.wavetime <= 0 || state.extrawavetime <= 0)){ if(!Net.client() && state.wavetime <= 0){
runWave(); runWave();
} }

View File

@@ -3,6 +3,7 @@ package io.anuke.mindustry.core;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Base64Coder; import com.badlogic.gdx.utils.Base64Coder;
import com.badlogic.gdx.utils.IntSet; import com.badlogic.gdx.utils.IntSet;
import io.anuke.annotations.Annotations.PacketPriority;
import io.anuke.annotations.Annotations.Remote; import io.anuke.annotations.Annotations.Remote;
import io.anuke.annotations.Annotations.Variant; import io.anuke.annotations.Annotations.Variant;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
@@ -218,11 +219,12 @@ public class NetClient extends Module {
new Random().nextBytes(bytes); new Random().nextBytes(bytes);
String result = new String(Base64Coder.encode(bytes)); String result = new String(Base64Coder.encode(bytes));
Settings.putString("usid-" + ip, result); Settings.putString("usid-" + ip, result);
Settings.save();
return result; return result;
} }
} }
@Remote(variants = Variant.one) @Remote(variants = Variant.one, priority = PacketPriority.high)
public static void onKick(KickReason reason){ public static void onKick(KickReason reason){
netClient.disconnectQuietly(); netClient.disconnectQuietly();
state.set(State.menu); state.set(State.menu);
@@ -247,7 +249,7 @@ public class NetClient extends Module {
playerGroup.removeByID(playerid); 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){ 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); 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 +303,7 @@ public class NetClient extends Module {
length = snapshot.length; length = snapshot.length;
netClient.lastSnapshotBase = Arrays.copyOf(snapshot, snapshot.length); netClient.lastSnapshotBase = Arrays.copyOf(snapshot, snapshot.length);
} else { //otherwise, last snapshot must not be null, decode it } 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); netClient.decoder.init(netClient.lastSnapshotBase, snapshot);
result = netClient.decoder.decode(); result = netClient.decoder.decode();
length = netClient.decoder.getDecodedLength(); length = netClient.decoder.getDecodedLength();

View File

@@ -74,6 +74,7 @@ public class NetServer extends Module{
if(player != null){ if(player != null){
onDisconnect(player); onDisconnect(player);
} }
connections.remove(id);
}); });
Net.handleServer(ConnectPacket.class, (id, packet) -> { Net.handleServer(ConnectPacket.class, (id, packet) -> {
@@ -97,6 +98,11 @@ public class NetServer extends Module{
return; return;
} }
if(packet.version == -1 && Version.build != -1 && !admins.allowsCustomClients()){
kick(id, KickReason.customClient);
return;
}
boolean preventDuplicates = headless; boolean preventDuplicates = headless;
if(preventDuplicates) { if(preventDuplicates) {
@@ -137,7 +143,7 @@ public class NetServer extends Module{
Player player = new Player(); Player player = new Player();
player.isAdmin = admins.isAdmin(uuid, packet.usid); player.isAdmin = admins.isAdmin(uuid, packet.usid);
player.clientid = id; player.con = Net.getConnection(id);
player.usid = packet.usid; player.usid = packet.usid;
player.name = packet.name; player.name = packet.name;
player.uuid = uuid; player.uuid = uuid;
@@ -169,7 +175,7 @@ public class NetServer extends Module{
NetConnection connection = Net.getConnection(id); NetConnection connection = Net.getConnection(id);
if(player == null || connection == null || packet.snapid < connection.lastRecievedClientSnapshot) return; if(player == null || connection == null || packet.snapid < connection.lastRecievedClientSnapshot) return;
boolean verifyPosition = !player.isDead() && !debug && headless; boolean verifyPosition = !player.isDead() && !debug && headless && !player.mech.flying && player.getCarrier() == null;
if(connection.lastRecievedClientTime == 0) connection.lastRecievedClientTime = TimeUtils.millis() - 16; if(connection.lastRecievedClientTime == 0) connection.lastRecievedClientTime = TimeUtils.millis() - 16;
@@ -322,9 +328,9 @@ public class NetServer extends Module{
//iterate through each player //iterate through each player
for (Player player : connections.values()) { 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 //player disconnected, ignore them
onDisconnect(player); onDisconnect(player);
return; return;
@@ -406,18 +412,25 @@ public class NetServer extends Module{
byte[] bytes = syncStream.toByteArray(); byte[] bytes = syncStream.toByteArray();
connection.lastSentRawSnapshot = bytes;
if(connection.currentBaseID == -1){ 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); 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 ///Nothing to diff off of in this case, send the whole thing
connection.lastSentSnapshot = bytes;
sendSplitSnapshot(connection.id, bytes, 0, -1); sendSplitSnapshot(connection.id, bytes, 0, -1);
}else{ }else{
connection.lastSentRawSnapshot = bytes;
//send diff, otherwise //send diff, otherwise
byte[] diff = ByteDeltaEncoder.toDiff(new ByteMatcherHash(connection.currentBaseSnapshot, bytes), encoder); 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); 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.lastSentSnapshotID + 1, connection.currentBaseID); sendSplitSnapshot(connection.id, diff, connection.currentBaseID + 1, connection.currentBaseID);
connection.lastSentSnapshot = diff; connection.lastSentSnapshot = diff;
connection.lastSentSnapshotID = connection.currentBaseID + 1; connection.lastSentSnapshotID = connection.currentBaseID + 1;
connection.lastSentBase = connection.currentBaseID; 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.*/ /**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){ private static void sendSplitSnapshot(int userid, byte[] bytes, int snapshotID, int base){
if(bytes.length < maxSnapshotSize){ 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); Call.onSnapshot(userid, bytes, snapshotID, (short)0, (short)bytes.length, base);
}else{ }else{
int remaining = bytes.length; int remaining = bytes.length;
@@ -457,11 +469,11 @@ public class NetServer extends Module{
} }
} }
private static void onDisconnect(Player player){ public static void onDisconnect(Player player){
Call.sendMessage("[accent]" + player.name + " has disconnected."); Call.sendMessage("[accent]" + player.name + " has disconnected.");
Call.onPlayerDisconnect(player.id); Call.onPlayerDisconnect(player.id);
player.remove(); player.remove();
netServer.connections.remove(player.clientid); netServer.connections.remove(player.con.id);
} }
@Remote(targets = Loc.client, called = Loc.server) @Remote(targets = Loc.client, called = Loc.server)
@@ -469,27 +481,32 @@ public class NetServer extends Module{
if(!player.isAdmin){ if(!player.isAdmin){
Log.err("ACCESS DENIED: Player {0} / {1} attempted to perform admin action without proper security access.", 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; return;
} }
if(other == null || other.isAdmin){ if(other == null || (other.isAdmin && other != player)){ //fun fact: this means you can ban yourself
Log.err("{0} attempted to perform admin action on nonexistant or admin player.", player.name); Log.err("{0} attempted to perform admin action on nonexistant or admin player.", player.name);
return; return;
} }
String ip = Net.getConnection(other.clientid).address; String ip = player.con.address;
if(action == AdminAction.ban){ if(action == AdminAction.wave) {
//no verification is done, so admins can hypothetically spam waves
//not a real issue, because server owners may want to do just that
state.wavetime = 0f;
}else if(action == AdminAction.ban){
netServer.admins.banPlayerIP(ip); 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); Log.info("&lc{0} has banned {1}.", player.name, other.name);
}else if(action == AdminAction.kick){ }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); Log.info("&lc{0} has kicked {1}.", player.name, other.name);
}else if(action == AdminAction.trace){ }else if(action == AdminAction.trace){
if(player.clientid != -1) { //TODO
Call.onTraceInfo(player.clientid, netServer.admins.getTraceByID(other.uuid)); if(player.con != null) {
Call.onTraceInfo(player.con.id, netServer.admins.getTraceByID(other.uuid));
}else{ }else{
NetClient.onTraceInfo(netServer.admins.getTraceByID(other.uuid)); NetClient.onTraceInfo(netServer.admins.getTraceByID(other.uuid));
} }
@@ -500,7 +517,7 @@ public class NetServer extends Module{
@Remote(targets = Loc.client) @Remote(targets = Loc.client)
public static void connectConfirm(Player player){ public static void connectConfirm(Player player){
player.add(); player.add();
Net.getConnection(player.clientid).hasConnected = true; player.con.hasConnected = true;
Call.sendMessage("[accent]" + player.name + " has connected."); Call.sendMessage("[accent]" + player.name + " has connected.");
Log.info("&y{0} has connected.", player.name); Log.info("&y{0} has connected.", player.name);
} }

View File

@@ -306,11 +306,18 @@ public class Renderer extends RendererModule{
} }
} }
//TODO extremely hacky
if(t instanceof Player && ((Player) t).getCarry() != null && ((Player) t).getCarry() instanceof Player && ((Player) ((Player) t).getCarry()).isLocal){
((Player) t).x = ((Player) t).getCarry().getX();
((Player) t).y = ((Player) t).getCarry().getY();
}
drawer.accept(t); drawer.accept(t);
t.setX(lastx);
t.setY(lasty);
if(threads.doInterpolate() && threads.isEnabled()) { if(threads.doInterpolate() && threads.isEnabled()) {
t.setX(lastx);
t.setY(lasty);
if (t instanceof SolidTrait) { if (t instanceof SolidTrait) {
((SolidTrait) t).setRotation(lastrot); ((SolidTrait) t).setRotation(lastrot);

View File

@@ -92,8 +92,6 @@ public class UI extends SceneModule{
Settings.setErrorHandler(()-> Timers.run(1f, ()-> showError("[crimson]Failed to access local storage.\nSettings will not be saved."))); Settings.setErrorHandler(()-> Timers.run(1f, ()-> showError("[crimson]Failed to access local storage.\nSettings will not be saved.")));
Settings.defaults("pixelate", true);
Dialog.closePadR = -1; Dialog.closePadR = -1;
Dialog.closePadT = 5; Dialog.closePadT = 5;

View File

@@ -44,6 +44,12 @@ public class MapEditor{
this.brushSize = 1; this.brushSize = 1;
this.tags = tags; this.tags = tags;
for (int x = 0; x < map.width(); x++) {
for (int y = 0; y < map.height(); y++) {
map.write(x, y, DataPosition.floor, (byte)Blocks.stone.id);
}
}
drawBlock = Blocks.stone; drawBlock = Blocks.stone;
renderer.resize(map.width(), map.height()); renderer.resize(map.width(), map.height());
} }
@@ -262,6 +268,11 @@ public class MapEditor{
public void resize(int width, int height){ public void resize(int width, int height){
map = new MapTileData(width, height); map = new MapTileData(width, height);
for (int x = 0; x < map.width(); x++) {
for (int y = 0; y < map.height(); y++) {
map.write(x, y, DataPosition.floor, (byte)Blocks.stone.id);
}
}
renderer.resize(width, height); renderer.resize(width, height);
} }
} }

View File

@@ -9,12 +9,14 @@ import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Disposable; import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.ObjectMap; import com.badlogic.gdx.utils.ObjectMap;
import io.anuke.mindustry.content.blocks.StorageBlocks;
import io.anuke.mindustry.core.Platform; import io.anuke.mindustry.core.Platform;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.io.Map; import io.anuke.mindustry.io.Map;
import io.anuke.mindustry.io.MapIO; import io.anuke.mindustry.io.MapIO;
import io.anuke.mindustry.io.MapMeta; import io.anuke.mindustry.io.MapMeta;
import io.anuke.mindustry.io.MapTileData; import io.anuke.mindustry.io.MapTileData;
import io.anuke.mindustry.type.Recipe;
import io.anuke.mindustry.ui.dialogs.FloatingDialog; import io.anuke.mindustry.ui.dialogs.FloatingDialog;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.ucore.core.Core; import io.anuke.ucore.core.Core;
@@ -367,8 +369,8 @@ public class MapEditorDialog extends Dialog implements Disposable{
public void updateSelectedBlock(){ public void updateSelectedBlock(){
Block block = editor.getDrawBlock(); Block block = editor.getDrawBlock();
int i = 0; int i = 0;
for(Block test : Block.all()){ for(int j = 0; j < Block.all().size; j ++){
if(block == test){ if(block.id == j){
blockgroup.getButtons().get(i).setChecked(true); blockgroup.getButtons().get(i).setChecked(true);
break; break;
} }
@@ -586,6 +588,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
for(Block block : Block.all()){ for(Block block : Block.all()){
TextureRegion[] regions = block.getCompactIcon(); TextureRegion[] regions = block.getCompactIcon();
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; if(regions.length == 0 || regions[0] == Draw.region("jjfgj")) continue;

View File

@@ -61,7 +61,7 @@ public class MapRenderer implements Disposable{
while(it.hasNext){ while(it.hasNext){
int i = it.next(); int i = it.next();
int x = i % width; int x = i % width;
int y = i / height; int y = i / width;
render(x, y); render(x, y);
} }
updates.clear(); updates.clear();

View File

@@ -18,6 +18,7 @@ import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Trail; import io.anuke.mindustry.graphics.Trail;
import io.anuke.mindustry.net.In; import io.anuke.mindustry.net.In;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.net.NetConnection;
import io.anuke.mindustry.type.*; import io.anuke.mindustry.type.*;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
@@ -29,10 +30,7 @@ import io.anuke.ucore.entities.EntityGroup;
import io.anuke.ucore.entities.trait.SolidTrait; import io.anuke.ucore.entities.trait.SolidTrait;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Lines; import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.*;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.ThreadQueue;
import io.anuke.ucore.util.Timer;
import java.io.DataInput; import java.io.DataInput;
import java.io.DataOutput; import java.io.DataOutput;
@@ -58,7 +56,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
public Color color = new Color(); public Color color = new Color();
public Mech mech; public Mech mech;
public int clientid = -1; public NetConnection con;
public int playerIndex = 0; public int playerIndex = 0;
public boolean isLocal = false; public boolean isLocal = false;
public Timer timer = new Timer(4); public Timer timer = new Timer(4);
@@ -250,6 +248,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
@Override @Override
public void removed() { public void removed() {
dropCarryLocal(); dropCarryLocal();
TileEntity core = getClosestCore();
if(core != null && ((CoreEntity)core).currentUnit == this){
((CoreEntity)core).currentUnit = null;
}
} }
@Override @Override
@@ -445,6 +448,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
updateBuilding(this); //building happens even with non-locals updateBuilding(this); //building happens even with non-locals
status.update(this); //status effect updating also happens with non locals for effect purposes status.update(this); //status effect updating also happens with non locals for effect purposes
if(getCarrier() != null){
x = getCarrier().getX();
y = getCarrier().getY();
}
if(Net.server()){ if(Net.server()){
updateShooting(); //server simulates player shooting updateShooting(); //server simulates player shooting
} }
@@ -526,11 +534,16 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
movement.limit(speed); movement.limit(speed);
velocity.add(movement); if(getCarrier() == null){
velocity.add(movement);
float prex = x, prey = y; float prex = x, prey = y;
updateVelocityStatus(mech.drag, 10f); updateVelocityStatus(mech.drag, 10f);
moved = distanceTo(prex, prey) > 0.01f; moved = distanceTo(prex, prey) > 0.01f;
}else{
velocity.setZero();
x = Mathf.lerpDelta(x, getCarrier().getX(), 0.1f);
y = Mathf.lerpDelta(y, getCarrier().getY(), 0.1f);
}
if(!isShooting()){ if(!isShooting()){
if(!movement.isZero()) { if(!movement.isZero()) {
@@ -604,7 +617,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
if (target == null) { if (target == null) {
isShooting = false; isShooting = false;
target = Units.getClosestTarget(team, x, y, inventory.getAmmoRange()); target = Units.getClosestTarget(team, x, y, inventory.getAmmoRange());
} else { } else if(target.isValid()){
//rotate toward and shoot the target //rotate toward and shoot the target
rotation = Mathf.slerpDelta(rotation, angleTo(target), 0.2f); rotation = Mathf.slerpDelta(rotation, angleTo(target), 0.2f);
@@ -691,12 +704,18 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
public void readSave(DataInput stream) throws IOException { public void readSave(DataInput stream) throws IOException {
boolean local = stream.readBoolean(); boolean local = stream.readBoolean();
if(local){ if(local && !headless){
byte mechid = stream.readByte(); byte mechid = stream.readByte();
int index = stream.readByte(); int index = stream.readByte();
players[index].readSaveSuper(stream); players[index].readSaveSuper(stream);
players[index].mech = Upgrade.getByID(mechid); players[index].mech = Upgrade.getByID(mechid);
players[index].dead = false; players[index].dead = false;
}else if(local){
byte mechid = stream.readByte();
stream.readByte();
readSaveSuper(stream);
mech = Upgrade.getByID(mechid);
dead = false;
} }
} }

View File

@@ -6,6 +6,7 @@ import io.anuke.mindustry.entities.traits.Saveable;
import io.anuke.mindustry.type.StatusEffect; import io.anuke.mindustry.type.StatusEffect;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Pooling; import io.anuke.ucore.util.Pooling;
import io.anuke.ucore.util.ThreadArray;
import java.io.DataInput; import java.io.DataInput;
import java.io.DataOutput; import java.io.DataOutput;
@@ -14,9 +15,9 @@ import java.io.IOException;
/**Class for controlling status effects on an entity.*/ /**Class for controlling status effects on an entity.*/
public class StatusController implements Saveable{ public class StatusController implements Saveable{
private static final StatusEntry globalResult = new StatusEntry(); private static final StatusEntry globalResult = new StatusEntry();
private static final Array<StatusEntry> removals = new Array<>(); private static final Array<StatusEntry> removals = new ThreadArray<>();
private Array<StatusEntry> statuses = new Array<>(); private Array<StatusEntry> statuses = new ThreadArray<>();
private float speedMultiplier; private float speedMultiplier;
private float damageMultiplier; private float damageMultiplier;

View File

@@ -196,7 +196,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
public void avoidOthers(float avoidRange){ public void avoidOthers(float avoidRange){
EntityPhysics.getNearby(getGroup(), x, y, avoidRange*2f, t -> { EntityPhysics.getNearby(getGroup(), x, y, avoidRange*2f, t -> {
if(t == this || (t instanceof Unit && (((Unit) t).isDead() || (((Unit) t).isFlying() != isFlying())))) return; if(t == this || (t instanceof Unit && (((Unit) t).isDead() || (((Unit) t).isFlying() != isFlying()) || ((Unit) t).getCarrier() == this) || getCarrier() == t)) return;
float dst = distanceTo(t); float dst = distanceTo(t);
if(dst > avoidRange) return; if(dst > avoidRange) return;
velocity.add(moveVector.set(x, y).sub(t.getX(), t.getY()).setLength(1f * (1f - (dst / avoidRange)))); velocity.add(moveVector.set(x, y).sub(t.getX(), t.getY()).setLength(1f * (1f - (dst / avoidRange))));

View File

@@ -43,7 +43,7 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable
/**Start a fire on the tile. If there already is a file there, refreshes its lifetime.*/ /**Start a fire on the tile. If there already is a file there, refreshes its lifetime.*/
public static void create(Tile tile){ public static void create(Tile tile){
if(Net.client()) return; //not clientside. if(Net.client() || tile == null) return; //not clientside.
Fire fire = map.get(tile.packedPosition()); Fire fire = map.get(tile.packedPosition());
@@ -62,7 +62,7 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable
/**Attempts to extinguish a fire by shortening its life. If there is no fire here, does nothing.*/ /**Attempts to extinguish a fire by shortening its life. If there is no fire here, does nothing.*/
public static void extinguish(Tile tile, float intensity) { public static void extinguish(Tile tile, float intensity) {
if (map.containsKey(tile.packedPosition())) { if (tile != null && map.containsKey(tile.packedPosition())) {
map.get(tile.packedPosition()).time += intensity * Timers.delta(); map.get(tile.packedPosition()).time += intensity * Timers.delta();
} }
} }

View File

@@ -28,7 +28,6 @@ import io.anuke.ucore.entities.trait.TimeTrait;
import io.anuke.ucore.entities.trait.VelocityTrait; import io.anuke.ucore.entities.trait.VelocityTrait;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Pooling;
import java.io.DataInput; import java.io.DataInput;
import java.io.DataOutput; import java.io.DataOutput;
@@ -48,7 +47,7 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT
private float sinktime; private float sinktime;
public static ItemDrop create(Item item, int amount, float x, float y, float angle){ 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.item = item;
drop.amount = amount; drop.amount = amount;
drop.velocity.set(4f, 0f).rotate(angle); drop.velocity.set(4f, 0f).rotate(angle);
@@ -70,6 +69,7 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT
Effects.effect(UnitFx.pickup, drop); Effects.effect(UnitFx.pickup, drop);
} }
itemGroup.removeByID(itemid); itemGroup.removeByID(itemid);
netClient.addRemovedEntity(itemid);
} }
/**Internal use only!*/ /**Internal use only!*/
@@ -188,11 +188,6 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT
} }
} }
@Override
public void removed() {
Pooling.free(this);
}
@Override @Override
public void reset() { public void reset() {
time = 0f; time = 0f;

View File

@@ -99,7 +99,9 @@ public interface BuilderTrait {
/**Return the build requests currently active, or the one at the top of the queue. /**Return the build requests currently active, or the one at the top of the queue.
* May return null.*/ * May return null.*/
default BuildRequest getCurrentRequest(){ default BuildRequest getCurrentRequest(){
return getPlaceQueue().size == 0 ? null : getPlaceQueue().first(); synchronized (getPlaceQueue()) {
return getPlaceQueue().size == 0 ? null : getPlaceQueue().first();
}
} }
/**Update building mechanism for this unit. /**Update building mechanism for this unit.

View File

@@ -4,12 +4,13 @@ import io.anuke.ucore.util.Bundles;
public enum GameMode{ public enum GameMode{
waves, waves,
sandbox{ //disabled for technical reasons
/*sandbox{
{ {
infiniteResources = true; infiniteResources = true;
disableWaveTimer = true; disableWaveTimer = true;
} }
}, },*/
freebuild{ freebuild{
{ {
disableWaveTimer = true; disableWaveTimer = true;

View File

@@ -17,8 +17,8 @@ public class WaveCreator{
}}, }},
new SpawnGroup(UnitTypes.vtol){{ new SpawnGroup(UnitTypes.vtol){{
begin = 4; begin = 6;
end = 6; end = 8;
}}, }},
new SpawnGroup(UnitTypes.scout){{ new SpawnGroup(UnitTypes.scout){{
@@ -29,7 +29,7 @@ public class WaveCreator{
}}, }},
new SpawnGroup(UnitTypes.titan){{ new SpawnGroup(UnitTypes.titan){{
begin = 8; begin = 9;
spacing = 3; spacing = 3;
unitScaling = 2; unitScaling = 2;
@@ -71,7 +71,7 @@ public class WaveCreator{
}}, }},
new SpawnGroup(UnitTypes.vtol){{ new SpawnGroup(UnitTypes.vtol){{
begin = 14; begin = 16;
unitScaling = 2; unitScaling = 2;
spacing = 2; spacing = 2;
@@ -120,9 +120,10 @@ public class WaveCreator{
}}, }},
new SpawnGroup(UnitTypes.monsoon){{ new SpawnGroup(UnitTypes.monsoon){{
begin = 35; begin = 40;
ammoItem = Items.blastCompound; ammoItem = Items.blastCompound;
unitAmount = 2; unitAmount = 2;
spacing = 2;
unitScaling = 3; unitScaling = 3;
max = 8; max = 8;
}}, }},

View File

@@ -6,9 +6,11 @@ import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.blocks.Blocks; import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Unit; import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.game.TeamInfo.TeamData; import io.anuke.mindustry.game.TeamInfo.TeamData;
import io.anuke.mindustry.input.InputHandler; import io.anuke.mindustry.input.InputHandler;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.meta.BlockBar;
import io.anuke.ucore.core.Graphics; import io.anuke.ucore.core.Graphics;
@@ -66,9 +68,7 @@ public class OverlayRenderer {
Tile tile = world.tileWorld(vec.x, vec.y); Tile tile = world.tileWorld(vec.x, vec.y);
if (tile != null && tile.block() != Blocks.air) { if (tile != null && tile.block() != Blocks.air) {
Tile target = tile; Tile target = tile.target();
if (tile.isLinked())
target = tile.getLinked();
if (showBlockDebug && target.entity != null) { if (showBlockDebug && target.entity != null) {
Draw.color(Color.RED); Draw.color(Color.RED);
@@ -93,49 +93,51 @@ public class OverlayRenderer {
Draw.reset(); Draw.reset();
} }
if (target.entity != null) {
int[] values = {0, 0};
Tile t = target;
boolean[] doDraw = {false};
Callable drawbars = () -> {
for (BlockBar bar : t.block().bars.list()) {
//TODO fix.
float offset = Mathf.sign(bar.top) * (t.block().size / 2f * tilesize + 2f + (bar.top ? values[0] : values[1]));
float value = bar.value.get(t);
if (MathUtils.isEqual(value, -1f)) continue;
if(doDraw[0]){
drawBar(bar.type.color, t.drawx(), t.drawy() + offset, value);
}
if (bar.top)
values[0]++;
else
values[1]++;
}
};
drawbars.run();
if(values[0] > 0){
drawEncloser(target.drawx(), target.drawy() + target.block().size * tilesize/2f + 2f + values[0]/2f - 0.5f + (values[0] > 2 ? 0.5f : 0), values[0]);
}
if(values[1] > 0){
drawEncloser(target.drawx(), target.drawy() - target.block().size * tilesize/2f - 2f - values[1]/2f - 0.5f, values[1]);
}
doDraw[0] = true;
values[0] = 0;
values[1] = 1;
drawbars.run();
}
synchronized (Tile.tileSetLock) { synchronized (Tile.tileSetLock) {
Block block = target.block();
TileEntity entity = target.entity;
if (entity != null) {
int[] values = {0, 0};
boolean[] doDraw = {false};
Callable drawbars = () -> {
for (BlockBar bar : block.bars.list()) {
float offset = Mathf.sign(bar.top) * (block.size / 2f * tilesize + 2f + (bar.top ? values[0] : values[1]));
float value = bar.value.get(target);
if (MathUtils.isEqual(value, -1f)) continue;
if(doDraw[0]){
drawBar(bar.type.color, target.drawx(), target.drawy() + offset, value);
}
if (bar.top)
values[0]++;
else
values[1]++;
}
};
drawbars.run();
if(values[0] > 0){
drawEncloser(target.drawx(), target.drawy() + block.size * tilesize/2f + 2f + values[0]/2f - 0.5f + (values[0] > 1 ? 0.75f : 0), values[0]);
}
if(values[1] > 0){
drawEncloser(target.drawx(), target.drawy() - block.size * tilesize/2f - 2f - values[1]/2f - 0.5f, values[1]);
}
doDraw[0] = true;
values[0] = 0;
values[1] = 1;
drawbars.run();
}
target.block().drawSelect(target); target.block().drawSelect(target);
} }
} }

View File

@@ -313,7 +313,7 @@ public class DesktopInput extends InputHandler{
float ya = Inputs.getAxis(section, "cursor_y"); float ya = Inputs.getAxis(section, "cursor_y");
if(Math.abs(xa) > controllerMin || Math.abs(ya) > controllerMin) { if(Math.abs(xa) > controllerMin || Math.abs(ya) > controllerMin) {
float scl = Settings.getInt("sensitivity")/100f * Unit.dp.scl(1f); float scl = Settings.getInt("sensitivity", 100)/100f * Unit.dp.scl(1f);
controlx += xa*baseControllerSpeed*scl; controlx += xa*baseControllerSpeed*scl;
controly -= ya*baseControllerSpeed*scl; controly -= ya*baseControllerSpeed*scl;
controlling = true; controlling = true;

View File

@@ -279,10 +279,12 @@ public abstract class InputHandler extends InputAdapter{
@Remote(targets = Loc.both, forward = true, called = Loc.server, in = In.blocks) @Remote(targets = Loc.both, forward = true, called = Loc.server, in = In.blocks)
public static void transferInventory(Player player, Tile tile){ public static void transferInventory(Player player, Tile tile){
if(Net.server() && (!player.inventory.hasItem() || player.isTransferring)){ if(Net.server() && (!player.inventory.hasItem() || player.isTransferring)) {
throw new ValidateException(player, "Player cannot transfer an item."); throw new ValidateException(player, "Player cannot transfer an item.");
} }
if(player == null) return;
player.isTransferring = true; player.isTransferring = true;
ItemStack stack = player.inventory.getItem(); ItemStack stack = player.inventory.getItem();

View File

@@ -337,8 +337,8 @@ public class MobileInput extends InputHandler implements GestureListener{
drawRequest(request); drawRequest(request);
//draw last placed request //draw last placed request
if(!request.remove && request == lastPlaced){ if(!request.remove && request == lastPlaced && request.recipe != null){
recipe.result.drawPlace(tile.x, tile.y, rotation, validPlace(tile.x, tile.y, recipe.result, rotation)); request.recipe.result.drawPlace(tile.x, tile.y, rotation, validPlace(tile.x, tile.y, request.recipe.result, rotation));
} }
} }
@@ -353,7 +353,7 @@ public class MobileInput extends InputHandler implements GestureListener{
if(tile != null){ if(tile != null){
//draw placing //draw placing
if(mode == placing) { if(mode == placing && recipe != null) {
NormalizeDrawResult dresult = PlaceUtils.normalizeDrawArea(recipe.result, lineStartX, lineStartY, tile.x, tile.y, true, maxLength, lineScale); NormalizeDrawResult dresult = PlaceUtils.normalizeDrawArea(recipe.result, lineStartX, lineStartY, tile.x, tile.y, true, maxLength, lineScale);
Lines.rect(dresult.x, dresult.y, dresult.x2 - dresult.x, dresult.y2 - dresult.y); Lines.rect(dresult.x, dresult.y, dresult.x2 - dresult.x, dresult.y2 - dresult.y);
@@ -465,7 +465,7 @@ public class MobileInput extends InputHandler implements GestureListener{
if (tile == null) return false; if (tile == null) return false;
if(mode == placing) { if(mode == placing && recipe != null) {
//normalize area //normalize area
NormalizeResult result = PlaceUtils.normalizeArea(lineStartX, lineStartY, tile.x, tile.y, rotation, true, 100); NormalizeResult result = PlaceUtils.normalizeArea(lineStartX, lineStartY, tile.x, tile.y, rotation, true, 100);
@@ -599,6 +599,10 @@ public class MobileInput extends InputHandler implements GestureListener{
selection.clear(); selection.clear();
} }
if(lineMode && mode == placing && recipe == null){
lineMode = false;
}
//if there is no mode and there's a recipe, switch to placing //if there is no mode and there's a recipe, switch to placing
if(recipe != null && mode == none){ if(recipe != null && mode == none){
mode = placing; mode = placing;

View File

@@ -19,7 +19,6 @@ import io.anuke.ucore.entities.Entities;
import io.anuke.ucore.entities.EntityGroup; import io.anuke.ucore.entities.EntityGroup;
import io.anuke.ucore.entities.trait.Entity; import io.anuke.ucore.entities.trait.Entity;
import io.anuke.ucore.util.Bits; import io.anuke.ucore.util.Bits;
import io.anuke.ucore.util.Log;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
@@ -51,7 +50,6 @@ public class Save16 extends SaveFileVersion {
state.difficulty = Difficulty.values()[difficulty]; state.difficulty = Difficulty.values()[difficulty];
state.mode = GameMode.values()[mode]; state.mode = GameMode.values()[mode];
state.enemies = 0; //TODO display enemies correctly!
state.wave = wave; state.wave = wave;
state.wavetime = wavetime; state.wavetime = wavetime;

View File

@@ -12,6 +12,7 @@ import io.anuke.mindustry.world.blocks.Rock;
import io.anuke.mindustry.world.blocks.StaticBlock; import io.anuke.mindustry.world.blocks.StaticBlock;
import io.anuke.ucore.core.Settings; import io.anuke.ucore.core.Settings;
import static io.anuke.mindustry.Vars.headless;
import static io.anuke.mindustry.Vars.world; import static io.anuke.mindustry.Vars.world;
public class Administration { public class Administration {
@@ -41,6 +42,15 @@ public class Administration {
return Settings.getBool("antigrief"); 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(){ public boolean isValidateReplace(){
return false; return false;
} }

View File

@@ -10,8 +10,6 @@ import com.badlogic.gdx.utils.IntMap;
import com.badlogic.gdx.utils.ObjectMap; import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.reflect.ClassReflection; import com.badlogic.gdx.utils.reflect.ClassReflection;
import io.anuke.mindustry.core.Platform; 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.StreamBegin;
import io.anuke.mindustry.net.Packets.StreamChunk; import io.anuke.mindustry.net.Packets.StreamChunk;
import io.anuke.mindustry.net.Streamable.StreamBuilder; import io.anuke.mindustry.net.Streamable.StreamBuilder;
@@ -33,7 +31,6 @@ public class Net{
private static boolean active; private static boolean active;
private static boolean clientLoaded; private static boolean clientLoaded;
private static Array<Object> packetQueue = new Array<>(); private static Array<Object> packetQueue = new Array<>();
private static ObjectMap<Class<?>, Consumer> listeners = new ObjectMap<>();
private static ObjectMap<Class<?>, Consumer> clientListeners = new ObjectMap<>(); private static ObjectMap<Class<?>, Consumer> clientListeners = new ObjectMap<>();
private static ObjectMap<Class<?>, BiConsumer<Integer, Object>> serverListeners = new ObjectMap<>(); private static ObjectMap<Class<?>, BiConsumer<Integer, Object>> serverListeners = new ObjectMap<>();
private static ClientProvider clientProvider; private static ClientProvider clientProvider;
@@ -148,11 +145,6 @@ public class Net{
Net.serverProvider = provider; Net.serverProvider = provider;
} }
/**Registers a common listener for when an object is recieved. Fired on both client and serve.r*/
public static <T> void handle(Class<T> type, Consumer<T> listener){
listeners.put(type, listener);
}
/**Registers a client listener for when an object is recieved.*/ /**Registers a client listener for when an object is recieved.*/
public static <T> void handleClient(Class<T> type, Consumer<T> listener){ public static <T> void handleClient(Class<T> type, Consumer<T> listener){
clientListeners.put(type, listener); clientListeners.put(type, listener);
@@ -180,16 +172,14 @@ public class Net{
streams.remove(builder.id); streams.remove(builder.id);
handleClientReceived(builder.build()); handleClientReceived(builder.build());
} }
}else if(clientListeners.get(object.getClass()) != null || }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(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) { synchronized (packetPoolLock) {
Pooling.free(object); Pooling.free(object);
} }
}else if(!(object instanceof UnimportantPacket)){ }else if(!((object instanceof Packet) && ((Packet) object).isUnimportant())){
packetQueue.add(object); packetQueue.add(object);
Log.info("Queuing packet {0}.", ClassReflection.getSimpleName(object.getClass())); Log.info("Queuing packet {0}.", ClassReflection.getSimpleName(object.getClass()));
}else{ }else{
@@ -205,9 +195,8 @@ public class Net{
/**Call to handle a packet being recieved for the server.*/ /**Call to handle a packet being recieved for the server.*/
public static void handleServerReceived(int connection, Object object){ public static void handleServerReceived(int connection, Object object){
if(serverListeners.get(object.getClass()) != null || listeners.get(object.getClass()) != null){ if(serverListeners.get(object.getClass()) != null){
if(serverListeners.get(object.getClass()) != null) serverListeners.get(object.getClass()).accept(connection, object); if(serverListeners.get(object.getClass()) != null) serverListeners.get(object.getClass()).accept(connection, object);
if(listeners.get(object.getClass()) != null) listeners.get(object.getClass()).accept(object);
synchronized (packetPoolLock) { synchronized (packetPoolLock) {
Pooling.free(object); Pooling.free(object);
} }

View File

@@ -5,11 +5,16 @@ import com.badlogic.gdx.utils.Pool.Poolable;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
public interface Packet extends Poolable{ public interface Packet extends Poolable{
void read(ByteBuffer buffer); default void read(ByteBuffer buffer){}
void write(ByteBuffer buffer); default void write(ByteBuffer buffer){}
default void reset() {} default void reset() {}
interface ImportantPacket{} default boolean isImportant(){
interface UnimportantPacket{} return false;
}
default boolean isUnimportant(){
return false;
}
} }

View File

@@ -6,8 +6,6 @@ import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.Unit; import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.io.Version; 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.mindustry.world.Tile;
import io.anuke.ucore.io.IOUtils; import io.anuke.ucore.io.IOUtils;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
@@ -19,13 +17,23 @@ import static io.anuke.mindustry.Vars.world;
/**Class for storing all packets.*/ /**Class for storing all packets.*/
public class Packets { public class Packets {
public static class Connect implements ImportantPacket{ public static class Connect implements Packet{
public int id; public int id;
public String addressTCP; public String addressTCP;
@Override
public boolean isImportant() {
return true;
}
} }
public static class Disconnect implements ImportantPacket{ public static class Disconnect implements Packet{
public int id; public int id;
@Override
public boolean isImportant() {
return true;
}
} }
public static class WorldStream extends Streamable{ public static class WorldStream extends Streamable{
@@ -62,7 +70,7 @@ public class Packets {
} }
public static class InvokePacket implements Packet{ public static class InvokePacket implements Packet{
public byte type; public byte type, priority;
public ByteBuffer writeBuffer; public ByteBuffer writeBuffer;
public int writeLength; public int writeLength;
@@ -70,6 +78,7 @@ public class Packets {
@Override @Override
public void read(ByteBuffer buffer) { public void read(ByteBuffer buffer) {
type = buffer.get(); type = buffer.get();
priority = buffer.get();
writeLength = buffer.getShort(); writeLength = buffer.getShort();
byte[] bytes = new byte[writeLength]; byte[] bytes = new byte[writeLength];
buffer.get(bytes); buffer.get(bytes);
@@ -79,6 +88,7 @@ public class Packets {
@Override @Override
public void write(ByteBuffer buffer) { public void write(ByteBuffer buffer) {
buffer.put(type); buffer.put(type);
buffer.put(priority);
buffer.putShort((short)writeLength); buffer.putShort((short)writeLength);
writeBuffer.position(0); writeBuffer.position(0);
@@ -86,17 +96,20 @@ public class Packets {
buffer.put(writeBuffer.get()); buffer.put(writeBuffer.get());
} }
} }
}
public static class SnapshotPacket implements Packet, UnimportantPacket{
@Override @Override
public void read(ByteBuffer buffer) { public void reset() {
priority = 0;
} }
@Override @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{ 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; public final boolean quiet;
KickReason(){ quiet = false; } KickReason(){ quiet = false; }
@@ -166,7 +179,7 @@ public class Packets {
} }
public enum AdminAction{ public enum AdminAction{
kick, ban, trace kick, ban, trace, wave
} }
/**Marks the beginning of a stream.*/ /**Marks the beginning of a stream.*/

View File

@@ -13,7 +13,6 @@ public class Registrator {
WorldStream.class, WorldStream.class,
ConnectPacket.class, ConnectPacket.class,
ClientSnapshotPacket.class, ClientSnapshotPacket.class,
SnapshotPacket.class,
InvokePacket.class InvokePacket.class
}; };
private static ObjectIntMap<Class<?>> ids = new ObjectIntMap<>(); private static ObjectIntMap<Class<?>> ids = new ObjectIntMap<>();

View File

@@ -2,14 +2,13 @@ package io.anuke.mindustry.net;
import com.badlogic.gdx.utils.reflect.ClassReflection; import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.badlogic.gdx.utils.reflect.ReflectionException; import com.badlogic.gdx.utils.reflect.ReflectionException;
import io.anuke.mindustry.net.Packet.ImportantPacket;
import io.anuke.mindustry.net.Packets.StreamBegin; import io.anuke.mindustry.net.Packets.StreamBegin;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
public class Streamable implements ImportantPacket{ public class Streamable implements Packet{
public transient ByteArrayInputStream stream; public transient ByteArrayInputStream stream;
public static class StreamBuilder{ public static class StreamBuilder{
@@ -47,4 +46,9 @@ public class Streamable implements ImportantPacket{
return stream.size() >= total; return stream.size() >= total;
} }
} }
@Override
public boolean isImportant() {
return true;
}
} }

View File

@@ -12,9 +12,10 @@ import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Bundles; import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Log; import io.anuke.ucore.util.Log;
import io.anuke.ucore.util.Strings; import io.anuke.ucore.util.Strings;
import io.anuke.ucore.util.ThreadArray;
public class Item implements Comparable<Item>, UnlockableContent{ public class Item implements Comparable<Item>, UnlockableContent{
private static final Array<Item> items = new Array<>(); private static final ThreadArray<Item> items = new ThreadArray<>();
public final int id; public final int id;
public final String name; public final String name;

View File

@@ -163,6 +163,8 @@ public class Weapon extends Upgrade {
AmmoType type = shooter.getInventory().getAmmo(); AmmoType type = shooter.getInventory().getAmmo();
if(type == null) return;
weapon.tr.trns(rotation + 180f, type.recoil); weapon.tr.trns(rotation + 180f, type.recoil);
shooter.getVelocity().add(weapon.tr); shooter.getVelocity().add(weapon.tr);

View File

@@ -2,8 +2,6 @@ package io.anuke.mindustry.ui.dialogs;
import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.net.Administration.PlayerInfo; 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.ScrollPane;
import io.anuke.ucore.scene.ui.layout.Table; import io.anuke.ucore.scene.ui.layout.Table;
@@ -46,9 +44,8 @@ public class AdminsDialog extends FloatingDialog {
ui.showConfirm("$text.confirm", "$text.confirmunadmin", () -> { ui.showConfirm("$text.confirm", "$text.confirmunadmin", () -> {
netServer.admins.unAdminPlayer(info.id); netServer.admins.unAdminPlayer(info.id);
for(Player player : playerGroup.all()){ for(Player player : playerGroup.all()){
NetConnection c = Net.getConnection(player.clientid); if(player.con != null){
if(c != null){ player.isAdmin = false;
//CallClient.adminSet(player, false);
break; break;
} }
} }

View File

@@ -4,19 +4,20 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.Align;
import io.anuke.mindustry.game.Difficulty; import io.anuke.mindustry.game.Difficulty;
import io.anuke.mindustry.game.EventType.ResizeEvent;
import io.anuke.mindustry.game.GameMode; import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.io.Map; import io.anuke.mindustry.io.Map;
import io.anuke.mindustry.ui.BorderImage; import io.anuke.mindustry.ui.BorderImage;
import io.anuke.ucore.core.Events;
import io.anuke.ucore.core.Settings; import io.anuke.ucore.core.Settings;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.scene.event.Touchable; import io.anuke.ucore.scene.event.Touchable;
import io.anuke.ucore.scene.ui.ButtonGroup;
import io.anuke.ucore.scene.ui.ImageButton; import io.anuke.ucore.scene.ui.ImageButton;
import io.anuke.ucore.scene.ui.ScrollPane; import io.anuke.ucore.scene.ui.ScrollPane;
import io.anuke.ucore.scene.ui.TextButton;
import io.anuke.ucore.scene.ui.layout.Table; import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.scene.utils.Cursors; import io.anuke.ucore.scene.utils.Cursors;
import io.anuke.ucore.scene.utils.Elements;
import io.anuke.ucore.util.Bundles; import io.anuke.ucore.util.Bundles;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
@@ -42,7 +43,7 @@ public class LevelDialog extends FloatingDialog{
int maxwidth = (Gdx.graphics.getHeight() > Gdx.graphics.getHeight() ? 2 : 4); int maxwidth = (Gdx.graphics.getHeight() > Gdx.graphics.getHeight() ? 2 : 4);
/*Table selmode = new Table(); Table selmode = new Table();
ButtonGroup<TextButton> group = new ButtonGroup<>(); ButtonGroup<TextButton> group = new ButtonGroup<>();
selmode.add("$text.level.mode").padRight(15f); selmode.add("$text.level.mode").padRight(15f);
@@ -50,14 +51,13 @@ public class LevelDialog extends FloatingDialog{
TextButton[] b = {null}; TextButton[] b = {null};
b[0] = Elements.newButton("$mode." + mode.name() + ".name", "toggle", () -> state.mode = mode); b[0] = Elements.newButton("$mode." + mode.name() + ".name", "toggle", () -> state.mode = mode);
b[0].update(() -> b[0].setChecked(state.mode == mode)); b[0].update(() -> b[0].setChecked(state.mode == mode));
b[0].setDisabled(true);
group.add(b[0]); group.add(b[0]);
selmode.add(b[0]).size(130f, 54f); selmode.add(b[0]).size(130f, 54f);
} }
selmode.addButton("?", this::displayGameModeHelp).size(50f, 54f).padLeft(18f); selmode.addButton("?", this::displayGameModeHelp).size(50f, 54f).padLeft(18f);
content().add(selmode); content().add(selmode);
content().row();*/ content().row();
Difficulty[] ds = Difficulty.values(); Difficulty[] ds = Difficulty.values();

View File

@@ -181,6 +181,8 @@ public class BlockInventoryFragment extends Fragment {
@Remote(called = Loc.server, targets = Loc.both, in = In.blocks, forward = true) @Remote(called = Loc.server, targets = Loc.both, in = In.blocks, forward = true)
public static void requestItem(Player player, Tile tile, Item item, int amount){ public static void requestItem(Player player, Tile tile, Item item, int amount){
if(player == null) return;
int removed = tile.block().removeStack(tile, item, amount); int removed = tile.block().removeStack(tile, item, amount);
player.inventory.addItem(item, removed); player.inventory.addItem(item, removed);

View File

@@ -182,7 +182,7 @@ public class BlocksFragment extends Fragment{
//add actual recipes //add actual recipes
for (Recipe r : 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"); ImageButton image = new ImageButton(new TextureRegion(), "select");

View File

@@ -185,7 +185,7 @@ public class DebugFragment extends Fragment {
result.append(player.id); result.append(player.id);
result.append("\n"); result.append("\n");
result.append(" cid: "); result.append(" cid: ");
result.append(player.clientid); result.append(player.con == null ? -1 : player.con.id);
result.append("\n"); result.append("\n");
result.append(" dead: "); result.append(" dead: ");
result.append(player.isDead()); result.append(player.isDead());

View File

@@ -7,7 +7,10 @@ import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Scaling; import com.badlogic.gdx.utils.Scaling;
import io.anuke.mindustry.core.GameState.State; import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.net.Packets.AdminAction;
import io.anuke.mindustry.type.Recipe; import io.anuke.mindustry.type.Recipe;
import io.anuke.mindustry.ui.IntFormat; import io.anuke.mindustry.ui.IntFormat;
import io.anuke.mindustry.ui.Minimap; import io.anuke.mindustry.ui.Minimap;
@@ -288,10 +291,11 @@ public class HudFragment extends Fragment{
} }
private String getEnemiesRemaining() { private String getEnemiesRemaining() {
if(state.enemies == 1) { int enemies = unitGroups[Team.red.ordinal()].size();
return Bundles.format("text.enemies.single", state.enemies); if(enemies == 1) {
return Bundles.format("text.enemies.single", enemies);
} else { } else {
return Bundles.format("text.enemies", state.enemies); return Bundles.format("text.enemies", enemies);
} }
} }
@@ -310,7 +314,7 @@ public class HudFragment extends Fragment{
row(); row();
new label(() -> state.enemies > 0 ? new label(() -> unitGroups[Team.red.ordinal()].size() > 0 && state.mode.disableWaveTimer ?
getEnemiesRemaining() : getEnemiesRemaining() :
(state.mode.disableWaveTimer) ? "$text.waiting" (state.mode.disableWaveTimer) ? "$text.waiting"
: timef.get((int) (state.wavetime / 60f))) : timef.get((int) (state.wavetime / 60f)))
@@ -329,14 +333,17 @@ public class HudFragment extends Fragment{
private void playButton(float uheight){ private void playButton(float uheight){
new imagebutton("icon-play", 30f, () -> { new imagebutton("icon-play", 30f, () -> {
state.wavetime = 0f; if(Net.client() && players[0].isAdmin){
Call.onAdminRequest(players[0], AdminAction.wave);
}else {
state.wavetime = 0f;
}
}).height(uheight).fillX().right().padTop(-8f).padBottom(-12f).padLeft(-15).padRight(-10).width(40f).update(l->{ }).height(uheight).fillX().right().padTop(-8f).padBottom(-12f).padLeft(-15).padRight(-10).width(40f).update(l->{
boolean vis = state.mode.disableWaveTimer && (Net.server() || !Net.active()); boolean vis = state.mode.disableWaveTimer && ((Net.server() || players[0].isAdmin) || !Net.active());
boolean paused = state.is(State.paused) || !vis; boolean paused = state.is(State.paused) || !vis;
l.setVisible(vis);
l.getStyle().imageUp = Core.skin.getDrawable(vis ? "icon-play" : "clear"); l.getStyle().imageUp = Core.skin.getDrawable(vis ? "icon-play" : "clear");
l.setTouchable(!paused ? Touchable.enabled : Touchable.disabled); l.setTouchable(!paused ? Touchable.enabled : Touchable.disabled);
}); }).visible(() -> state.mode.disableWaveTimer && ((Net.server() || players[0].isAdmin) || !Net.active()) && unitGroups[Team.red.ordinal()].size() == 0);
} }
} }

View File

@@ -87,7 +87,7 @@ public class PlayerListFragment extends Fragment{
float h = 74f; float h = 74f;
for(Player player : playerGroup.all()){ 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; if(connection == null && Net.server() && !player.isLocal) continue;

View File

@@ -207,7 +207,8 @@ public abstract class BaseBlock {
Tile other; Tile other;
Tile in; Tile in;
for(Item item : Item.all()){ for(int ii = 0; ii < Item.all().size; ii ++){
Item item = Item.getByID(ii);
other = tile.getNearby(nearby[i]); other = tile.getNearby(nearby[i]);
in = tile.getNearby(Edges.getInsideEdges(size)[i]); in = tile.getNearby(Edges.getInsideEdges(size)[i]);

View File

@@ -235,8 +235,8 @@ public class Block extends BaseBlock implements Content{
//TODO make this easier to config. //TODO make this easier to config.
public void setBars(){ public void setBars(){
if(hasPower) bars.add(new io.anuke.mindustry.world.meta.BlockBar(BarType.power, true, tile -> tile.entity.power.amount / powerCapacity)); if(hasPower) bars.add(new BlockBar(BarType.power, true, tile -> tile.entity.power.amount / powerCapacity));
if(hasLiquids) bars.add(new io.anuke.mindustry.world.meta.BlockBar(BarType.liquid, true, tile -> tile.entity.liquids.amount / liquidCapacity)); if(hasLiquids) bars.add(new BlockBar(BarType.liquid, true, tile -> tile.entity.liquids.amount / liquidCapacity));
if(hasItems) bars.add(new BlockBar(BarType.inventory, true, tile -> (float)tile.entity.items.totalItems() / itemCapacity)); if(hasItems) bars.add(new BlockBar(BarType.inventory, true, tile -> (float)tile.entity.items.totalItems() / itemCapacity));
} }
@@ -343,9 +343,9 @@ public class Block extends BaseBlock implements Content{
return 0; return 0;
}else{ }else{
float result = 0f; float result = 0f;
for(Item item : Item.all()){ for (int i = 0; i < Item.all().size; i++) {
int amount = tile.entity.items.getItem(item); int amount = tile.entity.items.items[i];
result += item.flammability*amount; result += Item.getByID(i).flammability*amount;
} }
if(hasLiquids){ if(hasLiquids){
result += tile.entity.liquids.amount * tile.entity.liquids.liquid.flammability/3f; result += tile.entity.liquids.amount * tile.entity.liquids.liquid.flammability/3f;
@@ -432,7 +432,7 @@ public class Block extends BaseBlock implements Content{
if(shadowRegions != null) { if(shadowRegions != null) {
Draw.rect(shadowRegions[(Mathf.randomSeed(tile.id(), 0, variants - 1))], tile.worldx(), tile.worldy()); Draw.rect(shadowRegions[(Mathf.randomSeed(tile.id(), 0, variants - 1))], tile.worldx(), tile.worldy());
}else{ }else if(shadowRegion != null){
Draw.rect(shadowRegion, tile.drawx(), tile.drawy()); Draw.rect(shadowRegion, tile.drawx(), tile.drawy());
} }
} }

View File

@@ -76,7 +76,7 @@ public class BreakBlock extends Block {
public void afterDestroyed(Tile tile, TileEntity e){ public void afterDestroyed(Tile tile, TileEntity e){
BreakEntity entity = (BreakEntity)e; BreakEntity entity = (BreakEntity)e;
if(entity.previous.synthetic()){ if(entity != null && entity.previous != null && entity.previous.synthetic()){
tile.setBlock(entity.previous); tile.setBlock(entity.previous);
} }
} }
@@ -91,6 +91,8 @@ public class BreakBlock extends Block {
Shaders.blockbuild.color = Palette.remove; Shaders.blockbuild.color = Palette.remove;
if(entity.previous == null) return;
for(TextureRegion region : entity.previous.getBlockIcon()){ for(TextureRegion region : entity.previous.getBlockIcon()){
Shaders.blockbuild.region = region; Shaders.blockbuild.region = region;
Shaders.blockbuild.progress = (float)(1f-entity.progress); //progress reversed Shaders.blockbuild.progress = (float)(1f-entity.progress); //progress reversed
@@ -143,7 +145,9 @@ public class BreakBlock extends Block {
if(tile.entity instanceof BreakEntity){ if(tile.entity instanceof BreakEntity){
BreakEntity entity = tile.entity(); BreakEntity entity = tile.entity();
Effects.effect(Fx.breakBlock, tile.drawx(), tile.drawy(), entity.previous.size); if(entity.previous != null){
Effects.effect(Fx.breakBlock, tile.drawx(), tile.drawy(), entity.previous.size);
}
} }
world.removeBlock(tile); world.removeBlock(tile);
@@ -184,6 +188,10 @@ public class BreakBlock extends Block {
} }
progress += add; progress += add;
if(progress > 1.0001f){
progress = 1.0001f;
}
} }
public float progress(){ public float progress(){

View File

@@ -48,7 +48,7 @@ public class BuildBlock extends Block {
@Override @Override
public boolean isSolidFor(Tile tile) { public boolean isSolidFor(Tile tile) {
BuildEntity entity = tile.entity(); BuildEntity entity = tile.entity();
return entity.recipe.result.solid || entity.previous.solid; return entity == null || entity.recipe ==null || entity.recipe.result.solid || entity.previous.solid;
} }
@Override @Override
@@ -88,7 +88,7 @@ public class BuildBlock extends Block {
public void draw(Tile tile){ public void draw(Tile tile){
BuildEntity entity = tile.entity(); BuildEntity entity = tile.entity();
if(entity.previous.synthetic()) { if(entity.previous != null && entity.previous.synthetic()) {
for (TextureRegion region : entity.previous.getBlockIcon()) { for (TextureRegion region : entity.previous.getBlockIcon()) {
Draw.rect(region, tile.drawx(), tile.drawy(), entity.recipe.result.rotate ? tile.getRotation() * 90 : 0); Draw.rect(region, tile.drawx(), tile.drawy(), entity.recipe.result.rotate ? tile.getRotation() * 90 : 0);
} }
@@ -131,7 +131,7 @@ public class BuildBlock extends Block {
CallBlocks.onBuildDeath(tile); CallBlocks.onBuildDeath(tile);
} }
if(!entity.updated){ if(!entity.updated && entity.recipe != null){
entity.progress -= 1f/entity.recipe.cost/decaySpeedScl; entity.progress -= 1f/entity.recipe.cost/decaySpeedScl;
} }
@@ -151,7 +151,7 @@ public class BuildBlock extends Block {
@Remote(called = Loc.server, in = In.blocks) @Remote(called = Loc.server, in = In.blocks)
public static void onBuildFinish(Tile tile, Player lastBuilder){ public static void onBuildFinish(Tile tile, Player lastBuilder){
if(tile.entity == null) return; if(tile.entity == null || !(tile.entity instanceof BuildEntity)) return;
BuildEntity entity = tile.entity(); BuildEntity entity = tile.entity();
Team team = tile.getTeam(); Team team = tile.getTeam();
@@ -179,6 +179,8 @@ public class BuildBlock extends Block {
@Remote(called = Loc.server, targets = Loc.both, in = In.blocks, forward = true) @Remote(called = Loc.server, targets = Loc.both, in = In.blocks, forward = true)
public static void onBuildDeselect(Player player){ public static void onBuildDeselect(Player player){
if(player == null) return;
player.getPlaceQueue().clear(); player.getPlaceQueue().clear();
} }
@@ -206,6 +208,10 @@ public class BuildBlock extends Block {
lastProgress = maxProgress; lastProgress = maxProgress;
updated = true; updated = true;
if(progress > 1.0001f){
progress = 1.0001f;
}
} }
public double checkRequired(InventoryModule inventory, double amount){ public double checkRequired(InventoryModule inventory, double amount){

View File

@@ -17,7 +17,6 @@ import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Geometry; import io.anuke.ucore.util.Geometry;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.headless;
import static io.anuke.mindustry.Vars.world; import static io.anuke.mindustry.Vars.world;
public class Floor extends Block{ public class Floor extends Block{
@@ -141,7 +140,7 @@ public class Floor extends Block{
Draw.rect(variantRegions[Mathf.randomSeed(tile.id(), 0, Math.max(0, variantRegions.length-1))], tile.worldx(), tile.worldy()); Draw.rect(variantRegions[Mathf.randomSeed(tile.id(), 0, Math.max(0, variantRegions.length-1))], tile.worldx(), tile.worldy());
if(tile.cliffs != 0){ if(tile.cliffs != 0 && cliffRegions != null){
for(int i = 0; i < 4; i ++){ for(int i = 0; i < 4; i ++){
if((tile.cliffs & (1 << i*2)) != 0) { if((tile.cliffs & (1 << i*2)) != 0) {
Draw.colorl(i > 1 ? 0.6f : 1f); Draw.colorl(i > 1 ? 0.6f : 1f);

View File

@@ -29,9 +29,9 @@ public class BurstTurret extends ItemTurret {
entity.recoil = recoil; entity.recoil = recoil;
tr.trns(entity.rotation, size * tilesize / 2, Mathf.range(xRand)); tr.trns(entity.rotation, size * tilesize / 2, Mathf.range(xRand));
useAmmo(tile);
bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy)); bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy));
effects(tile); effects(tile);
useAmmo(tile);
}); });
} }
} }

View File

@@ -41,6 +41,13 @@ public class ItemTurret extends CooledTurret {
return Math.min((int)((maxAmmo - entity.totalAmmo) / ammoMap.get(item).quantityMultiplier), amount); return Math.min((int)((maxAmmo - entity.totalAmmo) / ammoMap.get(item).quantityMultiplier), amount);
} }
@Override
public void handleStack(Item item, int amount, Tile tile, Unit source){
for (int i = 0; i < amount; i++) {
handleItem(item, tile, null);
}
}
//currently can't remove items from turrets. //currently can't remove items from turrets.
@Override @Override
public int removeStack(Tile tile, Item item, int amount) { public int removeStack(Tile tile, Item item, int amount) {

View File

@@ -8,6 +8,7 @@ import io.anuke.mindustry.world.BarType;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.meta.BlockBar; import io.anuke.mindustry.world.meta.BlockBar;
import io.anuke.mindustry.world.meta.BlockStat; import io.anuke.mindustry.world.meta.BlockStat;
import io.anuke.mindustry.world.meta.StatUnit;
import io.anuke.mindustry.world.meta.values.ItemFilterValue; import io.anuke.mindustry.world.meta.values.ItemFilterValue;
import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect; import io.anuke.ucore.core.Effects.Effect;
@@ -40,6 +41,7 @@ public abstract class ItemGenerator extends PowerGenerator {
super.setStats(); super.setStats();
stats.add(BlockStat.inputItems, new ItemFilterValue(item -> getItemEfficiency(item) >= minItemEfficiency)); stats.add(BlockStat.inputItems, new ItemFilterValue(item -> getItemEfficiency(item) >= minItemEfficiency));
stats.add(BlockStat.maxPowerGeneration, powerOutput * 60f, StatUnit.powerSecond);
} }
@Override @Override

View File

@@ -51,7 +51,9 @@ public class PowerDistributor extends PowerBlock {
} }
protected boolean shouldDistribute(Tile tile, Tile other) { protected boolean shouldDistribute(Tile tile, Tile other) {
return !(other.block() instanceof PowerGenerator) || other.entity.power.amount / other.block().powerCapacity < tile.entity.power.amount / powerCapacity; //only generators can distribute to other generators
return (!(other.block() instanceof PowerGenerator) || tile.block() instanceof PowerGenerator)
&& other.entity.power.amount / other.block().powerCapacity < tile.entity.power.amount / powerCapacity;
} }
@Override @Override

View File

@@ -129,14 +129,14 @@ public class PowerNode extends PowerBlock{
Tile link = world.tile(x, y); Tile link = world.tile(x, y);
if(link != null) link = link.target(); if(link != null) link = link.target();
if(link != tile && linkValid(tile, link)){ if(link != tile && linkValid(tile, link, false)){
boolean linked = linked(tile, link); boolean linked = linked(tile, link);
Draw.color(linked ? Palette.place : Palette.breakInvalid); Draw.color(linked ? Palette.place : Palette.breakInvalid);
Lines.square(link.drawx(), link.drawy(), Lines.square(link.drawx(), link.drawy(),
link.block().size * tilesize / 2f + 1f + (linked ? 0f : Mathf.absin(Timers.time(), 4f, 1f))); link.block().size * tilesize / 2f + 1f + (linked ? 0f : Mathf.absin(Timers.time(), 4f, 1f)));
if(entity.links.size >= maxNodes && !linked){ if((entity.links.size >= maxNodes || (link.block() instanceof PowerNode && ((DistributorEntity)link.entity).links.size >= ((PowerNode)link.block()).maxNodes)) && !linked){
Draw.color(); Draw.color();
Draw.rect("cross-" + link.block().size, link.drawx(), link.drawy()); Draw.rect("cross-" + link.block().size, link.drawx(), link.drawy());
} }
@@ -190,11 +190,13 @@ public class PowerNode extends PowerBlock{
} }
protected boolean shouldDistribute(Tile tile, Tile other) { protected boolean shouldDistribute(Tile tile, Tile other) {
return other.entity.power.amount / other.block().powerCapacity <= tile.entity.power.amount / powerCapacity; return other.entity.power.amount / other.block().powerCapacity <= tile.entity.power.amount / powerCapacity &&
!(other.block() instanceof PowerGenerator); //do not distribute to power generators
} }
protected boolean shouldLeechPower(Tile tile, Tile other){ protected boolean shouldLeechPower(Tile tile, Tile other){
return !(other.block() instanceof PowerNode) return !(other.block() instanceof PowerNode)
&& other.block() instanceof PowerDistributor //only suck power from batteries and power generators
&& other.entity.power.amount / other.block().powerCapacity > tile.entity.power.amount / powerCapacity; && other.entity.power.amount / other.block().powerCapacity > tile.entity.power.amount / powerCapacity;
} }
@@ -242,6 +244,10 @@ public class PowerNode extends PowerBlock{
} }
protected boolean linkValid(Tile tile, Tile link){ protected boolean linkValid(Tile tile, Tile link){
return linkValid(tile, link, true);
}
protected boolean linkValid(Tile tile, Tile link, boolean checkMaxNodes){
if(!(tile != link && link != null && link.block().hasPower)) return false; if(!(tile != link && link != null && link.block().hasPower)) return false;
if(link.block() instanceof PowerNode){ if(link.block() instanceof PowerNode){
@@ -250,7 +256,7 @@ public class PowerNode extends PowerBlock{
return Vector2.dst(tile.drawx(), tile.drawy(), link.drawx(), link.drawy()) <= Math.max(laserRange * tilesize, return Vector2.dst(tile.drawx(), tile.drawy(), link.drawx(), link.drawy()) <= Math.max(laserRange * tilesize,
((PowerNode)link.block()).laserRange * tilesize) - tilesize/2f ((PowerNode)link.block()).laserRange * tilesize) - tilesize/2f
+ (link.block().size-1)*tilesize/2f + (tile.block().size-1)*tilesize/2f && + (link.block().size-1)*tilesize/2f + (tile.block().size-1)*tilesize/2f &&
(oe.links.size < ((PowerNode)link.block()).maxNodes || oe.links.contains(tile.packedPosition())); (!checkMaxNodes || (oe.links.size < ((PowerNode)link.block()).maxNodes || oe.links.contains(tile.packedPosition())));
}else{ }else{
return Vector2.dst(tile.drawx(), tile.drawy(), link.drawx(), link.drawy()) return Vector2.dst(tile.drawx(), tile.drawy(), link.drawx(), link.drawy())
<= laserRange * tilesize - tilesize/2f + (link.block().size-1)*tilesize; <= laserRange * tilesize - tilesize/2f + (link.block().size-1)*tilesize;
@@ -276,8 +282,9 @@ public class PowerNode extends PowerBlock{
return new DistributorEntity(); return new DistributorEntity();
} }
@Remote(targets = Loc.both, called = Loc.both, in = In.blocks, forward = true) @Remote(targets = Loc.both, called = Loc.server, in = In.blocks, forward = true)
public static void linkPowerDistributors(Player player, Tile tile, Tile other){ public static void linkPowerDistributors(Player player, Tile tile, Tile other){
DistributorEntity entity = tile.entity(); DistributorEntity entity = tile.entity();
if(!entity.links.contains(other.packedPosition())){ if(!entity.links.contains(other.packedPosition())){

View File

@@ -210,7 +210,7 @@ public class CoreBlock extends StorageBlock {
rect.setSize(supplyRadius*2).setCenter(tile.drawx(), tile.drawy()); rect.setSize(supplyRadius*2).setCenter(tile.drawx(), tile.drawy());
Units.getNearby(tile.getTeam(), rect, unit -> { 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 ++){ for(int i = 0; i < tile.entity.items.items.length; i ++){
Item item = Item.getByID(i); Item item = Item.getByID(i);
@@ -272,7 +272,7 @@ public class CoreBlock extends StorageBlock {
} }
public class CoreEntity extends TileEntity{ public class CoreEntity extends TileEntity{
Unit currentUnit; public Unit currentUnit;
int droneID = -1; int droneID = -1;
boolean solid = true; boolean solid = true;
float warmup; float warmup;

View File

@@ -154,6 +154,9 @@ public class MechFactory extends Block{
MechFactoryEntity entity = tile.entity(); MechFactoryEntity entity = tile.entity();
Effects.effect(Fx.spawn, entity); Effects.effect(Fx.spawn, entity);
if(entity.player == null) return;
Mech result = ((MechFactory)tile.block()).mech; Mech result = ((MechFactory)tile.block()).mech;
if(entity.player.mech == result){ if(entity.player.mech == result){

View File

@@ -26,9 +26,6 @@ public class ByteSerializer implements Serialization {
throw new RuntimeException("Unregistered class: " + ClassReflection.getSimpleName(o.getClass())); throw new RuntimeException("Unregistered class: " + ClassReflection.getSimpleName(o.getClass()));
byteBuffer.put(id); byteBuffer.put(id);
((Packet) o).write(byteBuffer); ((Packet) o).write(byteBuffer);
synchronized (packetPoolLock) {
Pooling.free(o);
}
} }
} }

View File

@@ -15,6 +15,7 @@ import io.anuke.mindustry.net.NetworkIO;
import io.anuke.mindustry.net.Packets.Connect; import io.anuke.mindustry.net.Packets.Connect;
import io.anuke.mindustry.net.Packets.Disconnect; import io.anuke.mindustry.net.Packets.Disconnect;
import io.anuke.ucore.function.Consumer; import io.anuke.ucore.function.Consumer;
import io.anuke.ucore.util.Pooling;
import io.anuke.ucore.util.Strings; import io.anuke.ucore.util.Strings;
import java.io.IOException; import java.io.IOException;
@@ -26,6 +27,7 @@ import java.nio.channels.ClosedSelectorException;
import java.util.List; import java.util.List;
import static io.anuke.mindustry.Vars.*; import static io.anuke.mindustry.Vars.*;
import static io.anuke.mindustry.net.Net.packetPoolLock;
public class KryoClient implements ClientProvider{ public class KryoClient implements ClientProvider{
Client client; Client client;
@@ -134,6 +136,10 @@ public class KryoClient implements ClientProvider{
}else{ }else{
client.sendUDP(object); client.sendUDP(object);
} }
synchronized (packetPoolLock) {
Pooling.free(object);
}
} }
@Override @Override

View File

@@ -6,9 +6,7 @@ import io.anuke.ucore.util.ColorCodes;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import static io.anuke.mindustry.Vars.headless; import static io.anuke.mindustry.Vars.headless;
@@ -65,25 +63,4 @@ public class KryoCore {
private static int calculateLag() { private static int calculateLag() {
return fakeLagMin + (int)(Math.random() * (fakeLagMax - fakeLagMin)); return fakeLagMin + (int)(Math.random() * (fakeLagMax - fakeLagMin));
} }
/**Executes something in a potentially unreliable way. Used to simulate lag and packet errors with UDP.*/
public static void recieveUnreliable(Runnable run){
if(fakeLag && threadPool == null){
threadPool = Executors.newScheduledThreadPool(1, r -> {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
return t;
});
}
if(fakeLag){
do {
if (Math.random() >= fakeLagDrop) {
threadPool.schedule(run, calculateLag(), TimeUnit.MILLISECONDS);
}
} while (Math.random() < fakeLagDuplicate);
}else{
run.run();
}
}
} }

View File

@@ -15,10 +15,7 @@ import io.anuke.mindustry.net.Net.SendMode;
import io.anuke.mindustry.net.Net.ServerProvider; import io.anuke.mindustry.net.Net.ServerProvider;
import io.anuke.mindustry.net.NetConnection; import io.anuke.mindustry.net.NetConnection;
import io.anuke.mindustry.net.NetworkIO; import io.anuke.mindustry.net.NetworkIO;
import io.anuke.mindustry.net.Packets.Connect; import io.anuke.mindustry.net.Packets.*;
import io.anuke.mindustry.net.Packets.Disconnect;
import io.anuke.mindustry.net.Packets.StreamBegin;
import io.anuke.mindustry.net.Packets.StreamChunk;
import io.anuke.mindustry.net.Streamable; import io.anuke.mindustry.net.Streamable;
import io.anuke.ucore.UCore; import io.anuke.ucore.UCore;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;

View File

@@ -8,6 +8,8 @@ import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.game.Difficulty; import io.anuke.mindustry.game.Difficulty;
import io.anuke.mindustry.game.EventType.GameOverEvent; import io.anuke.mindustry.game.EventType.GameOverEvent;
import io.anuke.mindustry.game.GameMode; import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.io.Map; import io.anuke.mindustry.io.Map;
import io.anuke.mindustry.io.SaveIO; import io.anuke.mindustry.io.SaveIO;
import io.anuke.mindustry.io.Version; import io.anuke.mindustry.io.Version;
@@ -137,7 +139,7 @@ public class ServerControl extends Module {
Log.info("Stopped server."); Log.info("Stopped server.");
}); });
handler.register("host", "[mapname] [mode]", "Open the server with a specific map.", arg -> { handler.register("host", "[mode] [mapname]", "Open the server with a specific map.", arg -> {
if(state.is(State.playing)){ if(state.is(State.playing)){
err("Already hosting. Type 'stop' to stop hosting first."); err("Already hosting. Type 'stop' to stop hosting first.");
return; return;
@@ -146,34 +148,39 @@ public class ServerControl extends Module {
Map result = null; Map result = null;
if(arg.length > 0) { if(arg.length > 0) {
String search = arg[0];
for (Map map : world.maps().all()) {
if (map.name.equalsIgnoreCase(search))
result = map;
}
if(result == null){
err("No map with name &y'{0}'&lr found.", search);
return;
}
GameMode mode; GameMode mode;
try{ try{
mode = arg.length < 2 ? GameMode.waves : GameMode.valueOf(arg[1]); mode = GameMode.valueOf(arg[0]);
}catch (IllegalArgumentException e){ }catch (IllegalArgumentException e){
err("No gamemode '{0}' found.", arg[1]); err("No gamemode '{0}' found.", arg[0]);
return; return;
} }
info("Loading map..."); info("Loading map...");
state.mode = mode; state.mode = mode;
logic.reset(); if(arg.length > 1) {
world.loadMap(result); String search = arg[1];
for (Map map : world.maps().all()) {
if (map.name.equalsIgnoreCase(search))
result = map;
}
if (result == null) {
err("No map with name &y'{0}'&lr found.", search);
return;
}
logic.reset();
world.loadMap(result);
}else{
Log.info("&ly&fiNo map specified, so a procedural one was generated.");
world.loadProceduralMap();
}
}else{ }else{
world.loadProceduralMap();
Log.info("&ly&fiNo map specified, so a procedural one was generated."); Log.info("&ly&fiNo map specified, so a procedural one was generated.");
world.loadProceduralMap();
} }
logic.play(); logic.play();
@@ -193,10 +200,10 @@ public class ServerControl extends Module {
if(state.is(State.menu)){ if(state.is(State.menu)){
info("&lyStatus: &rserver closed"); info("&lyStatus: &rserver closed");
}else{ }else{
info("&lyStatus: &lcPlaying on map &fi{0}&fb &lb/&lc Wave {1} &lb/&lc {2}", info("&lyStatus: &lcPlaying on map &fi{0}&fb &lb/&lc Wave {1} &lb/&lc {2} &lb/&lc {3}",
Strings.capitalize(world.getMap().name), state.wave, Strings.capitalize(state.difficulty.name())); Strings.capitalize(world.getMap().name), state.wave, Strings.capitalize(state.difficulty.name()), Strings.capitalize(state.mode.name()));
if(state.enemies > 0){ if(state.mode.disableWaveTimer){
info("&ly{0} enemies remaining.", state.enemies); info("&ly{0} enemies.", unitGroups[Team.red.ordinal()].size());
}else{ }else{
info("&ly{0} seconds until next wave.", (int)(state.wavetime / 60)); info("&ly{0} seconds until next wave.", (int)(state.wavetime / 60));
} }
@@ -220,7 +227,7 @@ public class ServerControl extends Module {
if(playerGroup.size() > 0) { if(playerGroup.size() > 0) {
info("&lyPlayers: {0}", playerGroup.size()); info("&lyPlayers: {0}", playerGroup.size());
for (Player p : playerGroup.all()) { for (Player p : playerGroup.all()) {
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.id, p.con.address);
} }
}else{ }else{
info("&lyNo players connected."); info("&lyNo players connected.");
@@ -234,7 +241,7 @@ public class ServerControl extends Module {
return; return;
} }
//netCommon.sendMessage("[GRAY][[Server]:[] " + arg[0]); Call.sendMessage("[GRAY][[Server]:[] " + arg[0]);
info("&lyServer: &lb{0}", arg[0]); info("&lyServer: &lb{0}", arg[0]);
}); });
@@ -291,6 +298,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", "<normal/custom/both/off>", "Set map shuffling.", arg -> { handler.register("shuffle", "<normal/custom/both/off>", "Set map shuffling.", arg -> {
try{ try{
@@ -319,7 +344,7 @@ public class ServerControl extends Module {
} }
if(target != null){ if(target != null){
netServer.kick(target.clientid, KickReason.kick); netServer.kick(target.con.id, KickReason.kick);
info("It is done."); info("It is done.");
}else{ }else{
info("Nobody with that name could be found..."); info("Nobody with that name could be found...");
@@ -342,10 +367,10 @@ public class ServerControl extends Module {
} }
if(target != null){ if(target != null){
String ip = Net.getConnection(target.clientid).address; String ip = target.con.address;
netServer.admins.banPlayerIP(ip); netServer.admins.banPlayerIP(ip);
netServer.admins.banPlayerID(target.uuid); 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); info("Banned player by IP and ID: {0} / {1}", ip, target.uuid);
}else{ }else{
info("Nobody with that name could be found."); info("Nobody with that name could be found.");
@@ -386,10 +411,9 @@ public class ServerControl extends Module {
info("Banned player by IP: {0}.", arg[0]); info("Banned player by IP: {0}.", arg[0]);
for(Player player : playerGroup.all()){ for(Player player : playerGroup.all()){
if(Net.getConnection(player.clientid) != null && if(player.con.address != null &&
Net.getConnection(player.clientid).address != null && player.con.address.equals(arg[0])){
Net.getConnection(player.clientid).address.equals(arg[0])){ netServer.kick(player.con.id, KickReason.banned);
netServer.kick(player.clientid, KickReason.banned);
break; break;
} }
} }
@@ -404,7 +428,7 @@ public class ServerControl extends Module {
for(Player player : playerGroup.all()){ for(Player player : playerGroup.all()){
if(player.uuid.equals(arg[0])){ if(player.uuid.equals(arg[0])){
netServer.kick(player.clientid, KickReason.banned); netServer.kick(player.con.id, KickReason.banned);
break; break;
} }
} }
@@ -446,6 +470,7 @@ public class ServerControl extends Module {
if(target != null){ if(target != null){
netServer.admins.adminPlayer(target.uuid, target.usid); netServer.admins.adminPlayer(target.uuid, target.usid);
target.isAdmin = true;
info("Admin-ed player by ID: {0} / {1}", target.uuid, arg[0]); info("Admin-ed player by ID: {0} / {1}", target.uuid, arg[0]);
}else{ }else{
info("Nobody with that name could be found."); info("Nobody with that name could be found.");
@@ -469,6 +494,7 @@ public class ServerControl extends Module {
if(target != null){ if(target != null){
netServer.admins.unAdminPlayer(target.uuid); netServer.admins.unAdminPlayer(target.uuid);
target.isAdmin = false;
info("Un-admin-ed player by ID: {0} / {1}", target.uuid, arg[0]); info("Un-admin-ed player by ID: {0} / {1}", target.uuid, arg[0]);
}else{ }else{
info("Nobody with that name could be found."); info("Nobody with that name could be found.");
@@ -491,8 +517,6 @@ public class ServerControl extends Module {
handler.register("runwave", "Trigger the next wave.", arg -> { handler.register("runwave", "Trigger the next wave.", arg -> {
if(!state.is(State.playing)) { if(!state.is(State.playing)) {
err("Not hosting. Host a game first."); err("Not hosting. Host a game first.");
}else if(state.enemies > 0){
err("There are still {0} enemies remaining.", state.enemies);
}else{ }else{
logic.runWave(); logic.runWave();
info("Wave spawned."); info("Wave spawned.");