Merge branch 'master' of https://github.com/Anuken/Mindustry
This commit is contained in:
@@ -263,7 +263,7 @@ text.mapeditor = Map Editor
|
|||||||
text.donate = Donate
|
text.donate = Donate
|
||||||
|
|
||||||
text.connectfail = [crimson]Failed to connect to server\:\n\n[accent]{0}
|
text.connectfail = [crimson]Failed to connect to server\:\n\n[accent]{0}
|
||||||
text.error.unreachable = Server unreachable.
|
text.error.unreachable = Server unreachable.\nIs the address spelled correctly?
|
||||||
text.error.invalidaddress = Invalid address.
|
text.error.invalidaddress = Invalid address.
|
||||||
text.error.timedout = Timed out!\nMake sure the host has port forwarding set up, and that the address is correct!
|
text.error.timedout = Timed out!\nMake sure the host has port forwarding set up, and that the address is correct!
|
||||||
text.error.mismatch = Packet error:\npossible client/server version mismatch.\nMake sure you and the host have the latest version of Mindustry!
|
text.error.mismatch = Packet error:\npossible client/server version mismatch.\nMake sure you and the host have the latest version of Mindustry!
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ public class BlockIndexer{
|
|||||||
for(int x = quadrantX * structQuadrantSize; x < world.width() && x < (quadrantX + 1) * structQuadrantSize; x++){
|
for(int x = quadrantX * structQuadrantSize; x < world.width() && x < (quadrantX + 1) * structQuadrantSize; x++){
|
||||||
for(int y = quadrantY * structQuadrantSize; y < world.height() && y < (quadrantY + 1) * structQuadrantSize; y++){
|
for(int y = quadrantY * structQuadrantSize; y < world.height() && y < (quadrantY + 1) * structQuadrantSize; y++){
|
||||||
Tile result = world.tile(x, y);
|
Tile result = world.tile(x, y);
|
||||||
if(result.block().drops == null || !scanOres.contains(result.block().drops.item)) continue;
|
if( result == null || result.block().drops == null || !scanOres.contains(result.block().drops.item)) continue;
|
||||||
|
|
||||||
itemSet.add(result.block().drops.item);
|
itemSet.add(result.block().drops.item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ public class UI extends SceneModule{
|
|||||||
load = new LoadDialog();
|
load = new LoadDialog();
|
||||||
levels = new CustomGameDialog();
|
levels = new CustomGameDialog();
|
||||||
language = new LanguageDialog();
|
language = new LanguageDialog();
|
||||||
|
unlocks = new UnlocksDialog();
|
||||||
settings = new SettingsMenuDialog();
|
settings = new SettingsMenuDialog();
|
||||||
host = new HostDialog();
|
host = new HostDialog();
|
||||||
paused = new PausedDialog();
|
paused = new PausedDialog();
|
||||||
@@ -165,7 +166,6 @@ public class UI extends SceneModule{
|
|||||||
traces = new TraceDialog();
|
traces = new TraceDialog();
|
||||||
maps = new MapsDialog();
|
maps = new MapsDialog();
|
||||||
localplayers = new LocalPlayerDialog();
|
localplayers = new LocalPlayerDialog();
|
||||||
unlocks = new UnlocksDialog();
|
|
||||||
content = new ContentInfoDialog();
|
content = new ContentInfoDialog();
|
||||||
sectors = new SectorsDialog();
|
sectors = new SectorsDialog();
|
||||||
missions = new MissionDialog();
|
missions = new MissionDialog();
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ public class SectorPresets{
|
|||||||
Missions.blockRecipe(ProductionBlocks.waterExtractor),
|
Missions.blockRecipe(ProductionBlocks.waterExtractor),
|
||||||
new ContentMission(Items.biomatter),
|
new ContentMission(Items.biomatter),
|
||||||
Missions.blockRecipe(CraftingBlocks.biomatterCompressor),
|
Missions.blockRecipe(CraftingBlocks.biomatterCompressor),
|
||||||
new ContentMission(Liquids.oil)
|
new ContentMission(Liquids.oil),
|
||||||
|
new BattleMission()
|
||||||
),
|
),
|
||||||
Array.with(Items.copper, Items.lead, Items.coal, Items.titanium)));
|
Array.with(Items.copper, Items.lead, Items.coal, Items.titanium)));
|
||||||
}
|
}
|
||||||
@@ -69,6 +70,8 @@ public class SectorPresets{
|
|||||||
return presets.get(x, y);
|
return presets.get(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GridMap<SectorPreset> getPresets() { return presets; }
|
||||||
|
|
||||||
private void add(SectorPreset preset){
|
private void add(SectorPreset preset){
|
||||||
presets.put(preset.x, preset.y, preset);
|
presets.put(preset.x, preset.y, preset);
|
||||||
orePresets.put(preset.x, preset.y, preset.ores);
|
orePresets.put(preset.x, preset.y, preset.ores);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class Net{
|
|||||||
}
|
}
|
||||||
|
|
||||||
String error = t.getMessage() == null ? "" : t.getMessage().toLowerCase();
|
String error = t.getMessage() == null ? "" : t.getMessage().toLowerCase();
|
||||||
String type = error.getClass().toString().toLowerCase();
|
String type = t.getClass().toString().toLowerCase();
|
||||||
|
|
||||||
if(error.equals("mismatch")){
|
if(error.equals("mismatch")){
|
||||||
error = Bundles.get("text.error.mismatch");
|
error = Bundles.get("text.error.mismatch");
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ public class PausedDialog extends FloatingDialog{
|
|||||||
hide();
|
hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
content().row();
|
||||||
|
content().addButton("$text.unlocks", ui.unlocks::show);
|
||||||
|
|
||||||
content().row();
|
content().row();
|
||||||
content().addButton("$text.settings", ui.settings::show);
|
content().addButton("$text.settings", ui.settings::show);
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class HudFragment extends Fragment{
|
|||||||
|
|
||||||
Stack stack = new Stack();
|
Stack stack = new Stack();
|
||||||
TextButton waves = new TextButton("");
|
TextButton waves = new TextButton("");
|
||||||
Table btable = new Table().margin(14);
|
Table btable = new Table().margin(0);
|
||||||
|
|
||||||
stack.add(waves);
|
stack.add(waves);
|
||||||
stack.add(btable);
|
stack.add(btable);
|
||||||
@@ -375,7 +375,7 @@ public class HudFragment extends Fragment{
|
|||||||
(!state.mode.disableWaveTimer ?
|
(!state.mode.disableWaveTimer ?
|
||||||
Bundles.format("text.wave.waiting", (int)(state.wavetime/60)) :
|
Bundles.format("text.wave.waiting", (int)(state.wavetime/60)) :
|
||||||
Bundles.get("text.waiting"))) :
|
Bundles.get("text.waiting"))) :
|
||||||
Bundles.format("text.mission.display", world.getSector().currentMission().displayString())).growX();
|
Bundles.format("text.mission.display", world.getSector().currentMission().displayString())).growX().pad(8f);
|
||||||
|
|
||||||
table.clicked(() -> {
|
table.clicked(() -> {
|
||||||
if(world.getSector() != null && world.getSector().currentMission().hasMessage()){
|
if(world.getSector() != null && world.getSector().currentMission().hasMessage()){
|
||||||
|
|||||||
54
tests/src/test/java/SectorTests.java
Normal file
54
tests/src/test/java/SectorTests.java
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import io.anuke.mindustry.Vars;
|
||||||
|
import io.anuke.mindustry.core.ContentLoader;
|
||||||
|
import io.anuke.mindustry.maps.SectorPresets;
|
||||||
|
import io.anuke.mindustry.maps.generation.Generation;
|
||||||
|
import io.anuke.mindustry.maps.missions.Mission;
|
||||||
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
/** This class is responsible for testing predefined sectors. */
|
||||||
|
public class SectorTests{
|
||||||
|
|
||||||
|
private SectorPresets presets;
|
||||||
|
private Generation fakeGen;
|
||||||
|
|
||||||
|
@BeforeAll
|
||||||
|
static void initializeDependencies(){
|
||||||
|
Vars.content = new ContentLoader();
|
||||||
|
Vars.content.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void initTest(){
|
||||||
|
this.presets = new SectorPresets();
|
||||||
|
|
||||||
|
// Fake away the Generation dependency
|
||||||
|
this.fakeGen = new Generation(null, null, 250, 250, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns true if at least one mission provides a spawn point. */
|
||||||
|
private boolean spawnPointIsDefined(Array<Mission> missions){
|
||||||
|
for(Mission mission : missions){
|
||||||
|
if(mission.getSpawnPoints(this.fakeGen).size > 0){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// No spawn point provided
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes sure that every predefined sector has a position for the player core defined.
|
||||||
|
* This is achieved by adding at least one mission which defines a spawn point.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
void test_sectorHasACore(){
|
||||||
|
for(SectorPresets.SectorPreset preset : this.presets.getPresets().values()){
|
||||||
|
assertTrue(spawnPointIsDefined(preset.missions), "Sector at (" + preset.x + "|" + preset.y + ") contains no missions which define a spawn point. Add a battle or wave mission.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user