Fixed unit tests

This commit is contained in:
Anuken
2019-04-26 11:23:41 -04:00
parent 6e1fb71194
commit e7ad797d4e
7 changed files with 21 additions and 27 deletions

View File

@@ -123,7 +123,7 @@ public class Control implements ApplicationListener{
} }
}); });
//autohost for pvp sectors //autohost for pvp maps
Events.on(WorldLoadEvent.class, event -> { Events.on(WorldLoadEvent.class, event -> {
if(state.rules.pvp && !Net.active()){ if(state.rules.pvp && !Net.active()){
try{ try{

View File

@@ -85,13 +85,11 @@ public class World implements ApplicationListener{
return tiles == null ? 0 : tiles[0].length; return tiles == null ? 0 : tiles[0].length;
} }
public @Nullable public @Nullable Tile tile(int pos){
Tile tile(int pos){
return tiles == null ? null : tile(Pos.x(pos), Pos.y(pos)); return tiles == null ? null : tile(Pos.x(pos), Pos.y(pos));
} }
public @Nullable public @Nullable Tile tile(int x, int y){
Tile tile(int x, int y){
if(tiles == null){ if(tiles == null){
return null; return null;
} }
@@ -103,8 +101,7 @@ public class World implements ApplicationListener{
return tiles[x][y]; return tiles[x][y];
} }
public @Nullable public @Nullable Tile tileWorld(float x, float y){
Tile tileWorld(float x, float y){
return tile(Math.round(x / tilesize), Math.round(y / tilesize)); return tile(Math.round(x / tilesize), Math.round(y / tilesize));
} }

View File

@@ -21,7 +21,9 @@ public interface Entity extends MoveTrait{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
default void add(){ default void add(){
targetGroup().add(this); if(targetGroup() != null){
targetGroup().add(this);
}
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -122,7 +122,6 @@ public class CrashSender{
} }
} }
private static String parseException(Throwable e){ private static String parseException(Throwable e){
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw); PrintWriter pw = new PrintWriter(sw);

View File

@@ -1,10 +1,11 @@
package io.anuke.mindustry.world.modules; package io.anuke.mindustry.world.modules;
import io.anuke.annotations.Annotations.NonNull;
import io.anuke.arc.collection.IntArray; import io.anuke.arc.collection.IntArray;
import io.anuke.mindustry.world.blocks.power.PowerGraph; import io.anuke.mindustry.world.blocks.power.PowerGraph;
import java.io.*; import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class PowerModule extends BlockModule{ public class PowerModule extends BlockModule{
/** /**
@@ -13,10 +14,7 @@ public class PowerModule extends BlockModule{
* In case of buffered consumers, this is the percentage of power stored in relation to the maximum capacity. * In case of buffered consumers, this is the percentage of power stored in relation to the maximum capacity.
*/ */
public float satisfaction = 0.0f; public float satisfaction = 0.0f;
/** Specifies power which is required additionally, e.g. while a force projector is being shot at. */ public PowerGraph graph = new PowerGraph();
public float extraUse = 0f;
public @NonNull
PowerGraph graph = new PowerGraph();
public IntArray links = new IntArray(); public IntArray links = new IntArray();
@Override @Override

View File

@@ -46,13 +46,13 @@ public class ServerControl implements ApplicationListener{
public ServerControl(String[] args){ public ServerControl(String[] args){
Core.settings.defaults( Core.settings.defaults(
"shufflemode", "normal", "shufflemode", "normal",
"bans", "", "bans", "",
"admins", "", "admins", "",
"shuffle", true, "shuffle", true,
"crashreport", false, "crashreport", false,
"port", port, "port", port,
"logging", true "logging", true
); );
Log.setLogger(new LogHandler(){ Log.setLogger(new LogHandler(){
@@ -90,10 +90,8 @@ public class ServerControl implements ApplicationListener{
}); });
Time.setDeltaProvider(() -> Core.graphics.getDeltaTime() * 60f); Time.setDeltaProvider(() -> Core.graphics.getDeltaTime() * 60f);
Effects.setScreenShakeProvider((a, b) -> { Effects.setScreenShakeProvider((a, b) -> {});
}); Effects.setEffectProvider((a, b, c, d, e, f) -> {});
Effects.setEffectProvider((a, b, c, d, e, f) -> {
});
registerCommands(); registerCommands();

View File

@@ -27,7 +27,7 @@ public class ItemLiquidGeneratorTests extends PowerTestFixture{
private ItemLiquidGenerator generator; private ItemLiquidGenerator generator;
private Tile tile; private Tile tile;
private ItemLiquidGenerator.ItemLiquidGeneratorEntity entity; private ItemLiquidGenerator.ItemLiquidGeneratorEntity entity;
private final float fakeItemDuration = 60f; // 60 ticks private final float fakeItemDuration = 60f; //ticks
private final float maximumLiquidUsage = 0.5f; private final float maximumLiquidUsage = 0.5f;
public void createGenerator(InputType inputType){ public void createGenerator(InputType inputType){