diff --git a/core/assets/maps/craters.mmap b/core/assets/maps/craters.mmap index 92baaff531..0382c65d84 100644 Binary files a/core/assets/maps/craters.mmap and b/core/assets/maps/craters.mmap differ diff --git a/core/assets/maps/ruinousShores.mmap b/core/assets/maps/ruinousShores.mmap index 861c13a1f6..8723b5daad 100644 Binary files a/core/assets/maps/ruinousShores.mmap and b/core/assets/maps/ruinousShores.mmap differ diff --git a/core/src/io/anuke/mindustry/editor/EditorTile.java b/core/src/io/anuke/mindustry/editor/EditorTile.java index b35ae191f6..5c9146e188 100644 --- a/core/src/io/anuke/mindustry/editor/EditorTile.java +++ b/core/src/io/anuke/mindustry/editor/EditorTile.java @@ -88,6 +88,14 @@ public class EditorTile extends Tile{ protected void changed(){ entity = null; + if(wall == null){ + wall = Blocks.air; + } + + if(floor == null){ + floor = (Floor)Blocks.air; + } + Block block = block(); if(block.hasEntity()){ diff --git a/core/src/io/anuke/mindustry/editor/WaveInfoDialog.java b/core/src/io/anuke/mindustry/editor/WaveInfoDialog.java index 45eef72a81..39666616d3 100644 --- a/core/src/io/anuke/mindustry/editor/WaveInfoDialog.java +++ b/core/src/io/anuke/mindustry/editor/WaveInfoDialog.java @@ -166,7 +166,7 @@ public class WaveInfoDialog extends FloatingDialog{ t.table(p -> { p.add("$waves.every").padRight(4); p.addField(group.spacing + "", TextFieldFilter.digitsOnly, text -> { - if(Strings.canParsePostiveInt(text)){ + if(Strings.canParsePostiveInt(text) && Strings.parseInt(text) > 0){ group.spacing = Strings.parseInt(text); updateWaves(); } @@ -228,7 +228,7 @@ public class WaveInfoDialog extends FloatingDialog{ dialog.hide(); buildGroups(); }).pad(2).margin(12f).fillX(); - if(++i % 2 == 0)dialog.cont.row(); + if(++i % 3 == 0)dialog.cont.row(); } dialog.show(); } diff --git a/core/src/io/anuke/mindustry/io/MapIO.java b/core/src/io/anuke/mindustry/io/MapIO.java index 6db9e18a2f..1f0e2de7fc 100644 --- a/core/src/io/anuke/mindustry/io/MapIO.java +++ b/core/src/io/anuke/mindustry/io/MapIO.java @@ -69,25 +69,25 @@ public class MapIO{ public static Pixmap generatePreview(Map map) throws IOException{ Time.mark(); - Pixmap floor = new Pixmap(map.width, map.height, Format.RGBA8888); - Pixmap wall = new Pixmap(map.width, map.height, Format.RGBA8888); + Pixmap floors = new Pixmap(map.width, map.height, Format.RGBA8888); + Pixmap walls = new Pixmap(map.width, map.height, Format.RGBA8888); int black = Color.rgba8888(Color.BLACK); CachedTile tile = new CachedTile(){ @Override public void setFloor(Floor type){ - floor.drawPixel(x, floor.getHeight() - 1 - y, colorFor(type, Blocks.air, Blocks.air, getTeam())); + floors.drawPixel(x, floors.getHeight() - 1 - y, colorFor(type, Blocks.air, Blocks.air, getTeam())); } @Override public void setOreByte(byte b){ - if(b != 0) floor.drawPixel(x, floor.getHeight() - 1 - y, colorFor(floor(), Blocks.air, content.block(b), getTeam())); + if(b != 0) floors.drawPixel(x, floors.getHeight() - 1 - y, colorFor(floor(), Blocks.air, content.block(b), getTeam())); } @Override protected void changed(){ super.changed(); int c = colorFor(Blocks.air, block(), Blocks.air, getTeam()); - if(c != black) wall.drawPixel(x, floor.getHeight() - 1 - y, c); + if(c != black) walls.drawPixel(x, floors.getHeight() - 1 - y, c); } }; readTiles(map, (x, y) -> { @@ -95,9 +95,9 @@ public class MapIO{ tile.y = (short)y; return tile; }); - floor.drawPixmap(wall, 0, 0); - wall.dispose(); - return floor; + floors.drawPixmap(walls, 0, 0); + walls.dispose(); + return floors; } public static Pixmap generatePreview(Tile[][] tiles){ diff --git a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java index 2727032970..883985349c 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/HudFragment.java @@ -16,13 +16,13 @@ import io.anuke.arc.scene.ui.ImageButton; import io.anuke.arc.scene.ui.TextButton; import io.anuke.arc.scene.ui.layout.Stack; import io.anuke.arc.scene.ui.layout.Table; +import io.anuke.arc.scene.ui.layout.Unit; import io.anuke.arc.scene.utils.Elements; import io.anuke.arc.util.Align; import io.anuke.arc.util.Scaling; import io.anuke.arc.util.Time; import io.anuke.arc.util.Tmp; import io.anuke.mindustry.core.GameState.State; -import io.anuke.mindustry.game.EventType.PlayEvent; import io.anuke.mindustry.game.EventType.StateChangeEvent; import io.anuke.mindustry.game.UnlockableContent; import io.anuke.mindustry.gen.Call; @@ -49,16 +49,6 @@ public class HudFragment extends Fragment{ private float coreAttackTime; private float lastCoreHP; private float coreAttackOpacity = 0f; - private Table goshDarnHeckingFlippedTableWhyDoesThisHappen; - - { - Events.on(PlayEvent.class, event -> { - if(goshDarnHeckingFlippedTableWhyDoesThisHappen != null){ - goshDarnHeckingFlippedTableWhyDoesThisHappen.invalidateHierarchy(); - goshDarnHeckingFlippedTableWhyDoesThisHappen.pack(); - } - }); - } public void build(Group parent){ @@ -67,8 +57,13 @@ public class HudFragment extends Fragment{ cont.top().left().visible(() -> !state.is(State.menu)); if(mobile){ - cont.table(select -> { - goshDarnHeckingFlippedTableWhyDoesThisHappen = select; + + { + Table select = new Table(){ + public float getPrefWidth(){ return Unit.dp.scl(dsize*4 + 3); } + public float getPrefHeight(){ return Unit.dp.scl(dsize); } + }; + select.left(); select.defaults().size(dsize).left(); @@ -111,7 +106,8 @@ public class HudFragment extends Fragment{ }).get(); select.addImage("blank").color(Pal.accent).width(3f).fillY(); - }).left(); + cont.add(select).prefSize(dsize*4 + 3, dsize).left(); + } cont.row(); cont.addImage("blank").height(3f).color(Pal.accent).fillX(); diff --git a/core/src/io/anuke/mindustry/world/Build.java b/core/src/io/anuke/mindustry/world/Build.java index 9d77ee82f5..65e056cad5 100644 --- a/core/src/io/anuke/mindustry/world/Build.java +++ b/core/src/io/anuke/mindustry/world/Build.java @@ -153,7 +153,7 @@ public class Build{ Tile other = world.tile(x + dx + offsetx, y + dy + offsety); if(other == null || (other.block() != Blocks.air && !other.block().alwaysReplace) || !other.floor().placeableOn || - (other.floor().isLiquid && !type.floating)){ + (other.floor().isDeep() && !type.floating)){ return false; } } @@ -162,7 +162,7 @@ public class Build{ }else{ return tile.interactable(team) && contactsGround(tile.x, tile.y, type) - && (!tile.floor().isLiquid || type.floating) + && (!tile.floor().isDeep() || type.floating) && tile.floor().placeableOn && ((type.canReplace(tile.block()) && !(type == tile.block() && rotation == tile.getRotation() && type.rotate)) || tile.block().alwaysReplace || tile.block() == Blocks.air) @@ -174,19 +174,19 @@ public class Build{ if(block.isMultiblock()){ for(Point2 point : Edges.getInsideEdges(block.size)){ Tile tile = world.tile(x + point.x, y + point.y); - if(tile != null && !tile.floor().isLiquid) return true; + if(tile != null && !tile.floor().isDeep()) return true; } for(Point2 point : Edges.getEdges(block.size)){ Tile tile = world.tile(x + point.x, y + point.y); - if(tile != null && !tile.floor().isLiquid) return true; + if(tile != null && !tile.floor().isDeep()) return true; } }else{ for(Point2 point : Geometry.d4){ Tile tile = world.tile(x + point.x, y + point.y); - if(tile != null && !tile.floor().isLiquid) return true; + if(tile != null && !tile.floor().isDeep()) return true; } - return world.tile(x, y) != null && !world.tile(x, y).floor().isLiquid; + return world.tile(x, y) != null && !world.tile(x, y).floor().isDeep(); } return false; } diff --git a/core/src/io/anuke/mindustry/world/Tile.java b/core/src/io/anuke/mindustry/world/Tile.java index 6bd1f201a3..6fd2165d67 100644 --- a/core/src/io/anuke/mindustry/world/Tile.java +++ b/core/src/io/anuke/mindustry/world/Tile.java @@ -34,8 +34,8 @@ public class Tile implements Position, TargetTrait{ /** Tile entity, usually null. */ public TileEntity entity; public short x, y; - private Block wall; - private Floor floor; + protected Block wall; + protected Floor floor; /** Rotation, 0-3. Also used to store offload location, in which case it can be any number. */ private byte rotation; /** Team ordinal. */ diff --git a/core/src/io/anuke/mindustry/world/blocks/Floor.java b/core/src/io/anuke/mindustry/world/blocks/Floor.java index 023224df81..a6cab7a61d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/Floor.java +++ b/core/src/io/anuke/mindustry/world/blocks/Floor.java @@ -118,6 +118,9 @@ public class Floor extends Block{ } } + public boolean isDeep(){ + return drownTime > 0; + } public void drawNonLayer(Tile tile){ Mathf.random.setSeed(tile.pos()); diff --git a/server/src/io/anuke/mindustry/server/ServerControl.java b/server/src/io/anuke/mindustry/server/ServerControl.java index b93eb19721..ca3d3a68d9 100644 --- a/server/src/io/anuke/mindustry/server/ServerControl.java +++ b/server/src/io/anuke/mindustry/server/ServerControl.java @@ -198,7 +198,7 @@ public class ServerControl implements ApplicationListener{ if(lastTask != null) lastTask.cancel(); - Map result = world.maps.all().find(map -> map.name().equalsIgnoreCase(arg[0])); + Map result = world.maps.all().find(map -> map.name().equalsIgnoreCase(arg[0].replace('_', ' '))); if(result == null){ err("No map with name &y'{0}'&lr found.", arg[0]);