diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index e1d2571bf5..192a83863a 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -32,7 +32,7 @@ public class Blocks implements ContentList{ public static Block //environment - air, blockpart, spawn, space, metalfloor, deepwater, water, tar, stone, craters, blackstone, dirt, sand, ice, snow, + air, part, spawn, space, metalfloor, deepwater, water, tar, stone, craters, blackstone, dirt, sand, ice, snow, grass, shrub, rock, icerock, blackrock, rocks, //crafting @@ -85,7 +85,7 @@ public class Blocks implements ContentList{ public void init(){} }; - blockpart = new BlockPart(); + part = new BlockPart(); spawn = new Block("spawn"){ public void drawShadow(Tile tile){} diff --git a/core/src/io/anuke/mindustry/core/World.java b/core/src/io/anuke/mindustry/core/World.java index 83091cd07c..fb8ef784b6 100644 --- a/core/src/io/anuke/mindustry/core/World.java +++ b/core/src/io/anuke/mindustry/core/World.java @@ -434,7 +434,7 @@ public class World implements ApplicationListener{ for(int x = 0; x < data.width(); x++){ data.read(marker); - tiles[x][y] = new Tile(x, y, marker.floor, marker.wall == Blocks.blockpart.id ? 0 : marker.wall, marker.rotation, marker.team); + tiles[x][y] = new Tile(x, y, marker.floor, marker.wall == Blocks.part.id ? 0 : marker.wall, marker.rotation, marker.team); } } diff --git a/core/src/io/anuke/mindustry/editor/MapEditor.java b/core/src/io/anuke/mindustry/editor/MapEditor.java index de94861990..4c8b274b34 100644 --- a/core/src/io/anuke/mindustry/editor/MapEditor.java +++ b/core/src/io/anuke/mindustry/editor/MapEditor.java @@ -95,7 +95,7 @@ public class MapEditor{ public void draw(int x, int y, Block drawBlock, double chance){ byte writeID = drawBlock.id; - byte partID = Blocks.blockpart.id; + byte partID = Blocks.part.id; byte rotationTeam = Pack.byteByte(drawBlock.rotate ? (byte)rotation : 0, drawBlock.synthetic() ? (byte)drawTeam.ordinal() : 0); boolean isfloor = drawBlock instanceof Floor && drawBlock != Blocks.air; diff --git a/core/src/io/anuke/mindustry/editor/MapRenderer.java b/core/src/io/anuke/mindustry/editor/MapRenderer.java index 2a52081aca..c994c9978a 100644 --- a/core/src/io/anuke/mindustry/editor/MapRenderer.java +++ b/core/src/io/anuke/mindustry/editor/MapRenderer.java @@ -8,6 +8,7 @@ import io.anuke.arc.graphics.g2d.Draw; import io.anuke.arc.graphics.g2d.TextureRegion; import io.anuke.arc.util.Disposable; import io.anuke.arc.util.Pack; +import io.anuke.mindustry.content.Blocks; import io.anuke.mindustry.game.Team; import io.anuke.mindustry.graphics.IndexedRenderer; import io.anuke.mindustry.maps.MapTileData.DataPosition; @@ -110,15 +111,18 @@ public class MapRenderer implements Disposable{ TextureRegion region; - if(bw != 0){ + int idxWall = (wx % chunksize) + (wy % chunksize) * chunksize; + int idxDecal = (wx % chunksize) + (wy % chunksize) * chunksize + chunksize * chunksize; + + if(bw != 0 && (wall.synthetic() || wall == Blocks.part)){ region = wall.icon(Icon.full) == Core.atlas.find("____") ? Core.atlas.find("clear") : wall.icon(Icon.full); if(wall.rotate){ - mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize, region, + mesh.draw(idxWall, region, wx * tilesize + wall.offset(), wy * tilesize + wall.offset(), region.getWidth() * Draw.scl, region.getHeight() * Draw.scl, rotation * 90 - 90); }else{ - mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize, region, + mesh.draw(idxWall, region, wx * tilesize + wall.offset() + (tilesize - region.getWidth() * Draw.scl)/2f, wy * tilesize + wall.offset() + (tilesize - region.getHeight() * Draw.scl)/2f, region.getWidth() * Draw.scl, region.getHeight() * Draw.scl); @@ -126,17 +130,19 @@ public class MapRenderer implements Disposable{ }else{ region = floor.icon(Icon.full); - mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize, region, wx * tilesize, wy * tilesize, 8, 8); + mesh.draw(idxWall, region, wx * tilesize, wy * tilesize, 8, 8); } if(wall.update || wall.destructible){ mesh.setColor(team.color); region = Core.atlas.find("block-border"); + }else if(!wall.synthetic() && bw != 0){ + region = wall.icon(Icon.full) == Core.atlas.find("____") ? Core.atlas.find("clear") : wall.icon(Icon.full); }else{ region = Core.atlas.find("clear"); } - mesh.draw((wx % chunksize) + (wy % chunksize) * chunksize + chunksize * chunksize, region, + mesh.draw(idxDecal, region, wx * tilesize - (wall.size/3) * tilesize, wy * tilesize - (wall.size/3) * tilesize, region.getWidth() * Draw.scl, region.getHeight() * Draw.scl); mesh.setColor(Color.WHITE); diff --git a/core/src/io/anuke/mindustry/io/MapIO.java b/core/src/io/anuke/mindustry/io/MapIO.java index 1c65e45859..7a72f06f54 100644 --- a/core/src/io/anuke/mindustry/io/MapIO.java +++ b/core/src/io/anuke/mindustry/io/MapIO.java @@ -87,7 +87,7 @@ public class MapIO{ int worldy = dy - 1 + y; if(Structs.inBounds(worldx, worldy, pixmap.getWidth(), pixmap.getHeight())){ - data.write(worldx, worldy, DataPosition.wall, Blocks.blockpart.id); + data.write(worldx, worldy, DataPosition.wall, Blocks.part.id); data.write(worldx, worldy, DataPosition.rotationTeam, Pack.byteByte((byte)0, (byte)Team.blue.ordinal())); data.write(worldx, worldy, DataPosition.link, Pack.byteByte((byte) (dx - 1 + 8), (byte) (dy - 1 + 8))); } diff --git a/core/src/io/anuke/mindustry/io/SaveFileVersion.java b/core/src/io/anuke/mindustry/io/SaveFileVersion.java index 939cd98741..b7f3c2784e 100644 --- a/core/src/io/anuke/mindustry/io/SaveFileVersion.java +++ b/core/src/io/anuke/mindustry/io/SaveFileVersion.java @@ -101,7 +101,7 @@ public abstract class SaveFileVersion{ Tile tile = new Tile(x, y, floorid, wallid); - if(wallid == Blocks.blockpart.id){ + if(wallid == Blocks.part.id){ tile.link = stream.readByte(); }else if(tile.entity != null){ byte tr = stream.readByte(); diff --git a/core/src/io/anuke/mindustry/maps/MapTileData.java b/core/src/io/anuke/mindustry/maps/MapTileData.java index e61eb31673..9ffac4cd02 100644 --- a/core/src/io/anuke/mindustry/maps/MapTileData.java +++ b/core/src/io/anuke/mindustry/maps/MapTileData.java @@ -48,7 +48,7 @@ public class MapTileData{ read(marker); //strip blockparts from map data, as they can be invalid - if(marker.wall == Blocks.blockpart.id){ + if(marker.wall == Blocks.part.id){ marker.wall = Blocks.air.id; } @@ -72,7 +72,7 @@ public class MapTileData{ int worldy = dy + offsety + y; if(Structs.inBounds(worldx, worldy, width, height) && !(dx + offsetx == 0 && dy + offsety == 0)){ - write(worldx, worldy, DataPosition.wall, Blocks.blockpart.id); + write(worldx, worldy, DataPosition.wall, Blocks.part.id); write(worldx, worldy, DataPosition.link, Pack.byteByte((byte) (dx + offsetx + 8), (byte) (dy + offsety + 8))); } } diff --git a/core/src/io/anuke/mindustry/maps/generators/MapGenerator.java b/core/src/io/anuke/mindustry/maps/generators/MapGenerator.java index ee729259f9..9fd5c2be77 100644 --- a/core/src/io/anuke/mindustry/maps/generators/MapGenerator.java +++ b/core/src/io/anuke/mindustry/maps/generators/MapGenerator.java @@ -64,7 +64,7 @@ public class MapGenerator extends Generator{ marker.wall = 0; } - tiles[x][y] = new Tile(x, y, marker.floor, marker.wall == Blocks.blockpart.id ? 0 : marker.wall, marker.rotation, marker.team); + tiles[x][y] = new Tile(x, y, marker.floor, marker.wall == Blocks.part.id ? 0 : marker.wall, marker.rotation, marker.team); } } diff --git a/core/src/io/anuke/mindustry/world/Tile.java b/core/src/io/anuke/mindustry/world/Tile.java index ca437d9131..7ce5e6453f 100644 --- a/core/src/io/anuke/mindustry/world/Tile.java +++ b/core/src/io/anuke/mindustry/world/Tile.java @@ -212,9 +212,9 @@ public class Tile implements Position, TargetTrait{ return link != 0; } - /** Sets this to a linked tile, which sets the block to a blockpart. dx and dy can only be -8-7. */ + /** Sets this to a linked tile, which sets the block to a part. dx and dy can only be -8-7. */ public void setLinked(byte dx, byte dy){ - setBlock(Blocks.blockpart); + setBlock(Blocks.part); link = Pack.byteByte((byte)(dx + 8), (byte)(dy + 8)); } diff --git a/core/src/io/anuke/mindustry/world/blocks/BlockPart.java b/core/src/io/anuke/mindustry/world/blocks/BlockPart.java index 20c7e20778..2e06d62177 100644 --- a/core/src/io/anuke/mindustry/world/blocks/BlockPart.java +++ b/core/src/io/anuke/mindustry/world/blocks/BlockPart.java @@ -6,14 +6,14 @@ import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; /** - * Used for multiblocks. Each block that is not the center of the multiblock is a blockpart. + * Used for multiblocks. Each block that is not the center of the multiblock is a part. * Think of these as delegates to the actual block; all events are passed to the target block. * They are made to share all properties from the linked tile/block. */ public class BlockPart extends Block{ public BlockPart(){ - super("blockpart"); + super("part"); solid = false; hasPower = hasItems = hasLiquids = true; } diff --git a/tests/src/test/java/ApplicationTests.java b/tests/src/test/java/ApplicationTests.java index eeab0b2642..0c90191680 100644 --- a/tests/src/test/java/ApplicationTests.java +++ b/tests/src/test/java/ApplicationTests.java @@ -145,7 +145,7 @@ public class ApplicationTests{ if(x == bx && by == y){ assertEquals(world.tile(x, y).block(), Blocks.core); }else{ - assertTrue(world.tile(x, y).block() == Blocks.blockpart && world.tile(x, y).getLinked() == world.tile(bx, by)); + assertTrue(world.tile(x, y).block() == Blocks.part && world.tile(x, y).getLinked() == world.tile(bx, by)); } } } @@ -236,7 +236,7 @@ public class ApplicationTests{ assertEquals(Blocks.copperWallLarge, world.tile(0, 0).block()); assertEquals(Blocks.air, world.tile(2, 2).block()); - assertEquals(Blocks.blockpart, world.tile(1, 1).block()); + assertEquals(Blocks.part, world.tile(1, 1).block()); } @Test