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 -> {
if(state.rules.pvp && !Net.active()){
try{

View File

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

View File

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

View File

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

View File

@ -1,10 +1,11 @@
package io.anuke.mindustry.world.modules;
import io.anuke.annotations.Annotations.NonNull;
import io.anuke.arc.collection.IntArray;
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{
/**
@ -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.
*/
public float satisfaction = 0.0f;
/** Specifies power which is required additionally, e.g. while a force projector is being shot at. */
public float extraUse = 0f;
public @NonNull
PowerGraph graph = new PowerGraph();
public PowerGraph graph = new PowerGraph();
public IntArray links = new IntArray();
@Override

View File

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

View File

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