Fixed tests

This commit is contained in:
Anuken
2019-12-26 19:57:24 -05:00
parent d8629100db
commit c449302d28
3 changed files with 25 additions and 20 deletions

View File

@@ -80,7 +80,7 @@ public class Build{
return false; return false;
} }
if(!state.teams.eachEnemyCore(team, core -> Mathf.dst(x * tilesize + type.offset(), y * tilesize + type.offset(), core.x, core.y) < state.rules.enemyCoreBuildRadius + type.size * tilesize / 2f)){ if(state.teams.eachEnemyCore(team, core -> Mathf.dst(x * tilesize + type.offset(), y * tilesize + type.offset(), core.x, core.y) < state.rules.enemyCoreBuildRadius + type.size * tilesize / 2f)){
return false; return false;
} }

View File

@@ -135,7 +135,7 @@ public class ServerControl implements ApplicationListener{
if(state.rules.waves){ if(state.rules.waves){
info("&lcGame over! Reached wave &ly{0}&lc with &ly{1}&lc players online on map &ly{2}&lc.", state.wave, playerGroup.size(), Strings.capitalize(world.getMap().name())); info("&lcGame over! Reached wave &ly{0}&lc with &ly{1}&lc players online on map &ly{2}&lc.", state.wave, playerGroup.size(), Strings.capitalize(world.getMap().name()));
}else{ }else{
info("&lcGame over! Team &ly{0}&lc is victorious with &ly{1}&lc players online on map &ly{2}&lc.", event.winner.name(), playerGroup.size(), Strings.capitalize(world.getMap().name())); info("&lcGame over! Team &ly{0}&lc is victorious with &ly{1}&lc players online on map &ly{2}&lc.", event.winner.name, playerGroup.size(), Strings.capitalize(world.getMap().name()));
} }
//set next map to be played //set next map to be played
@@ -143,7 +143,7 @@ public class ServerControl implements ApplicationListener{
nextMapOverride = null; nextMapOverride = null;
if(map != null){ if(map != null){
Call.onInfoMessage((state.rules.pvp Call.onInfoMessage((state.rules.pvp
? "[YELLOW]The " + event.winner.name() + " team is victorious![]" : "[SCARLET]Game over![]") ? "[YELLOW]The " + event.winner.name + " team is victorious![]" : "[SCARLET]Game over![]")
+ "\nNext selected map:[accent] " + map.name() + "[]" + "\nNext selected map:[accent] " + map.name() + "[]"
+ (map.tags.containsKey("author") && !map.tags.get("author").trim().isEmpty() ? " by[accent] " + map.author() + "[]" : "") + "." + + (map.tags.containsKey("author") && !map.tags.get("author").trim().isEmpty() ? " by[accent] " + map.author() + "[]" : "") + "." +
"\nNew game begins in " + roundExtraTime + "[] seconds."); "\nNew game begins in " + roundExtraTime + "[] seconds.");
@@ -292,7 +292,7 @@ public class ServerControl implements ApplicationListener{
info(" &lyPlaying on map &fi{0}&fb &lb/&ly Wave {1}", Strings.capitalize(world.getMap().name()), state.wave); info(" &lyPlaying on map &fi{0}&fb &lb/&ly Wave {1}", Strings.capitalize(world.getMap().name()), state.wave);
if(state.rules.waves){ if(state.rules.waves){
info("&ly {0} enemies.", unitGroups[(int)Team.crux.id].size()); info("&ly {0} enemies.", state.enemies);
}else{ }else{
info("&ly {0} seconds until next wave.", (int)(state.wavetime / 60)); info("&ly {0} seconds until next wave.", (int)(state.wavetime / 60));
} }
@@ -418,24 +418,26 @@ public class ServerControl implements ApplicationListener{
return; return;
} }
try{ Team team = arg.length == 0 ? Team.sharded : Structs.find(Team.all(), t -> t.name.equals(arg[0]));
Team team = arg.length == 0 ? Team.sharded : Team.valueOf(arg[0]);
if(state.teams.cores(team).isEmpty()){ if(team == null){
err("That team has no cores."); err("No team with that name found.");
return; return;
}
for(Item item : content.items()){
if(item.type == ItemType.material){
state.teams.cores(team).first().entity.items.set(item, state.teams.cores(team).first().block().itemCapacity);
}
}
info("Core filled.");
}catch(IllegalArgumentException ignored){
err("No such team exists.");
} }
if(state.teams.cores(team).isEmpty()){
err("That team has no cores.");
return;
}
for(Item item : content.items()){
if(item.type == ItemType.material){
state.teams.cores(team).first().items.set(item, state.teams.cores(team).first().block.itemCapacity);
}
}
info("Core filled.");
}); });
handler.register("name", "[name...]", "Change the server display name.", arg -> { handler.register("name", "[name...]", "Change the server display name.", arg -> {

View File

@@ -3,6 +3,8 @@ package power;
import arc.*; import arc.*;
import arc.math.*; import arc.math.*;
import arc.util.*; import arc.util.*;
import mindustry.*;
import mindustry.core.*;
import mindustry.world.*; import mindustry.world.*;
import mindustry.world.blocks.power.*; import mindustry.world.blocks.power.*;
import mindustry.world.consumers.*; import mindustry.world.consumers.*;
@@ -23,6 +25,7 @@ public class PowerTests extends PowerTestFixture{
@BeforeAll @BeforeAll
static void init(){ static void init(){
Core.graphics = new FakeGraphics(); Core.graphics = new FakeGraphics();
Vars.state = new GameState();
} }
@Nested @Nested