mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-26 22:42:41 -08:00
Merge
This commit is contained in:
commit
3ae8065cf1
163 changed files with 2568 additions and 1713 deletions
|
|
@ -106,8 +106,8 @@ public class ApplicationTests{
|
|||
Time.update();
|
||||
Time.update();
|
||||
Time.setDeltaProvider(() -> 1f);
|
||||
unitGroups[waveTeam.ordinal()].updateEvents();
|
||||
assertFalse(unitGroups[waveTeam.ordinal()].isEmpty(), "No enemies spawned.");
|
||||
unitGroup.update();
|
||||
assertFalse(unitGroup.isEmpty(), "No enemies spawned.");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -124,7 +124,7 @@ public class ApplicationTests{
|
|||
createMap();
|
||||
int bx = 4;
|
||||
int by = 4;
|
||||
world.setBlock(world.tile(bx, by), Blocks.coreShard, Team.sharded);
|
||||
world.tile(bx, by).set(Blocks.coreShard, Team.sharded);
|
||||
assertEquals(world.tile(bx, by).getTeam(), Team.sharded);
|
||||
for(int x = bx - 1; x <= bx + 1; x++){
|
||||
for(int y = by - 1; y <= by + 1; y++){
|
||||
|
|
@ -194,7 +194,7 @@ public class ApplicationTests{
|
|||
@Test
|
||||
void save(){
|
||||
world.loadMap(testMap);
|
||||
assertTrue(state.teams.get(defaultTeam).cores.size > 0);
|
||||
assertTrue(state.teams.playerCores().size > 0);
|
||||
SaveIO.save(saveDirectory.child("0.msav"));
|
||||
}
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ public class ApplicationTests{
|
|||
|
||||
assertEquals(world.width(), map.width);
|
||||
assertEquals(world.height(), map.height);
|
||||
assertTrue(state.teams.get(defaultTeam).cores.size > 0);
|
||||
assertTrue(state.teams.playerCores().size > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -375,12 +375,12 @@ public class ApplicationTests{
|
|||
createMap();
|
||||
|
||||
Tile core = world.tile(5, 5);
|
||||
world.setBlock(core, Blocks.coreShard, Team.sharded);
|
||||
core.set(Blocks.coreShard, Team.sharded);
|
||||
for(Item item : content.items()){
|
||||
core.entity.items.set(item, 3000);
|
||||
}
|
||||
|
||||
assertEquals(core, state.teams.get(Team.sharded).cores.first());
|
||||
assertEquals(core.entity, state.teams.get(Team.sharded).core());
|
||||
}
|
||||
|
||||
void depositTest(Block block, Item item){
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import arc.util.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.io.TypeIO;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import mindustry.io.*;
|
||||
import org.junit.jupiter.api.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.*;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
public class IOTests{
|
||||
|
||||
|
|
@ -49,5 +49,23 @@ public class IOTests{
|
|||
assertEquals(rules.attackMode, res.attackMode);
|
||||
}
|
||||
|
||||
@Test
|
||||
void writeRules2(){
|
||||
Rules rules = new Rules();
|
||||
rules.attackMode = true;
|
||||
rules.tags.put("blah", "bleh");
|
||||
rules.buildSpeedMultiplier = 99.1f;
|
||||
|
||||
String str = JsonIO.write(rules);
|
||||
Rules res = JsonIO.read(Rules.class, str);
|
||||
|
||||
assertEquals(rules.buildSpeedMultiplier, res.buildSpeedMultiplier);
|
||||
assertEquals(rules.attackMode, res.attackMode);
|
||||
assertEquals(rules.tags.get("blah"), res.tags.get("blah"));
|
||||
|
||||
String str2 = JsonIO.write(new Rules(){{
|
||||
attackMode = true;
|
||||
}});
|
||||
Log.info(str2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class ZoneTests{
|
|||
if(tile.drop() != null){
|
||||
resources.add(tile.drop());
|
||||
}
|
||||
if(tile.block() instanceof CoreBlock && tile.getTeam() == defaultTeam){
|
||||
if(tile.block() instanceof CoreBlock && tile.getTeam() == state.rules.defaultTeam){
|
||||
hasSpawnPoint = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ public class ZoneTests{
|
|||
}
|
||||
|
||||
assertTrue(hasSpawnPoint, "Zone \"" + zone.name + "\" has no spawn points.");
|
||||
assertTrue(spawner.countSpawns() > 0 || (state.rules.attackMode && !state.teams.get(waveTeam).cores.isEmpty()), "Zone \"" + zone.name + "\" has no enemy spawn points: " + spawner.countSpawns());
|
||||
assertTrue(spawner.countSpawns() > 0 || (state.rules.attackMode && state.teams.get(state.rules.waveTeam).hasCore()), "Zone \"" + zone.name + "\" has no enemy spawn points: " + spawner.countSpawns());
|
||||
|
||||
for(Item item : resources){
|
||||
assertTrue(zone.resources.contains(item), "Zone \"" + zone.name + "\" is missing item in resource list: \"" + item.name + "\"");
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public class PowerTestFixture{
|
|||
@BeforeAll
|
||||
static void initializeDependencies(){
|
||||
Core.graphics = new FakeGraphics();
|
||||
Vars.state = new GameState();
|
||||
Vars.content = new ContentLoader(){
|
||||
@Override
|
||||
public void handleMappableContent(MappableContent content){
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package power;
|
|||
import arc.*;
|
||||
import arc.math.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.core.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.power.*;
|
||||
import mindustry.world.consumers.*;
|
||||
|
|
@ -23,6 +25,7 @@ public class PowerTests extends PowerTestFixture{
|
|||
@BeforeAll
|
||||
static void init(){
|
||||
Core.graphics = new FakeGraphics();
|
||||
Vars.state = new GameState();
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue