Fixed unit tests
This commit is contained in:
@@ -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{
|
||||||
|
|||||||
@@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,10 @@ public interface Entity extends MoveTrait{
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
default void add(){
|
default void add(){
|
||||||
|
if(targetGroup() != null){
|
||||||
targetGroup().add(this);
|
targetGroup().add(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
default void remove(){
|
default void remove(){
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|
||||||
|
|||||||
@@ -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){
|
||||||
|
|||||||
Reference in New Issue
Block a user