diff --git a/annotations/build/libs/annotations-release.jar b/annotations/build/libs/annotations-release.jar index 32144bcc26..a369a0cff6 100644 Binary files a/annotations/build/libs/annotations-release.jar and b/annotations/build/libs/annotations-release.jar differ diff --git a/core/assets/.gifimages/frame0.png b/core/assets/.gifimages/frame0.png new file mode 100644 index 0000000000..982a3c348f Binary files /dev/null and b/core/assets/.gifimages/frame0.png differ diff --git a/core/assets/.gifimages/frame1.png b/core/assets/.gifimages/frame1.png new file mode 100644 index 0000000000..982a3c348f Binary files /dev/null and b/core/assets/.gifimages/frame1.png differ diff --git a/core/assets/.gifimages/frame2.png b/core/assets/.gifimages/frame2.png new file mode 100644 index 0000000000..982a3c348f Binary files /dev/null and b/core/assets/.gifimages/frame2.png differ diff --git a/core/assets/.gifimages/frame3.png b/core/assets/.gifimages/frame3.png new file mode 100644 index 0000000000..982a3c348f Binary files /dev/null and b/core/assets/.gifimages/frame3.png differ diff --git a/core/assets/.gifimages/frame4.png b/core/assets/.gifimages/frame4.png new file mode 100644 index 0000000000..982a3c348f Binary files /dev/null and b/core/assets/.gifimages/frame4.png differ diff --git a/core/assets/.gifimages/frame5.png b/core/assets/.gifimages/frame5.png new file mode 100644 index 0000000000..982a3c348f Binary files /dev/null and b/core/assets/.gifimages/frame5.png differ diff --git a/core/assets/.gifimages/frame6.png b/core/assets/.gifimages/frame6.png new file mode 100644 index 0000000000..982a3c348f Binary files /dev/null and b/core/assets/.gifimages/frame6.png differ diff --git a/core/assets/.gifimages/frame7.png b/core/assets/.gifimages/frame7.png new file mode 100644 index 0000000000..982a3c348f Binary files /dev/null and b/core/assets/.gifimages/frame7.png differ diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index 4361710df9..1c423c2234 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -42,7 +42,6 @@ public class Player extends Unit implements BlockPlacer{ static final float dashSpeed = 1.8f; public static final float placeDistance = 80f; - static final int timerDash = 0; static final int timerRegen = 3; static final Translator[] tmptr = {new Translator(), new Translator(), new Translator(), new Translator()}; @@ -229,7 +228,7 @@ public class Player extends Unit implements BlockPlacer{ @Override public void drawOver(){ if(!isShooting() && currentPlace != null) { - Draw.color("accent"); + Draw.color(distanceTo(currentPlace) > placeDistance ? "placeInvalid" : "accent"); float focusLen = 3.8f + Mathf.absin(Timers.time(), 1.1f, 0.6f); float px = x + Angles.trnsx(rotation, focusLen); float py = y + Angles.trnsy(rotation, focusLen); @@ -320,10 +319,6 @@ public class Player extends Unit implements BlockPlacer{ return placeQueue; } - private boolean invalidPlaceBlock(Tile check){ - return (!(check.block() instanceof BuildBlock) || distanceTo(check) > placeDistance); - } - protected void updateMech(){ Tile tile = world.tileWorld(x, y); @@ -334,21 +329,24 @@ public class Player extends Unit implements BlockPlacer{ } if(!isShooting()) { + //update placing queue if(currentPlace != null) { Tile check = currentPlace; - if (invalidPlaceBlock(currentPlace)) { + if (!(check.block() instanceof BuildBlock)) { currentPlace = null; - }else { + }else if(distanceTo(check) <= placeDistance){ BuildEntity entity = check.entity(); entity.progress += 1f / entity.result.health; rotation = Mathf.slerpDelta(rotation, angleTo(entity), 0.4f); } }else if(placeQueue.size > 0){ - PlaceRequest check = placeQueue.removeLast(); - if(Placement.validPlace(team, check.x, check.y, check.recipe.result, check.rotation)){ + PlaceRequest check = placeQueue.last(); + if(distanceTo(world.tile(check.x, check.y)) <= placeDistance && + Placement.validPlace(team, check.x, check.y, check.recipe.result, check.rotation)){ + placeQueue.removeLast(); Placement.placeBlock(team, check.x, check.y, check.recipe, check.rotation, true, true); currentPlace = world.tile(check.x, check.y); } diff --git a/core/src/io/anuke/mindustry/world/Placement.java b/core/src/io/anuke/mindustry/world/Placement.java index 5b88e3a533..1d909817c0 100644 --- a/core/src/io/anuke/mindustry/world/Placement.java +++ b/core/src/io/anuke/mindustry/world/Placement.java @@ -67,6 +67,7 @@ public class Placement { tile.setBlock(sub, rotation); tile.entity().result = result; + tile.entity().stacks = recipe.requirements; tile.setTeam(team); if(result.isMultiblock()){ @@ -88,9 +89,13 @@ public class Placement { if(effects) Effects.effect(Fx.none, worldx * tilesize, worldy * tilesize); } } - }else if(effects) Effects.effect(Fx.none, x * tilesize, y * tilesize); + }else if(effects){ + Effects.effect(Fx.none, x * tilesize, y * tilesize); + } - if(effects && sound) threads.run(() -> Effects.sound("place", x * tilesize, y * tilesize)); + if(effects && sound){ + threads.run(() -> Effects.sound("place", x * tilesize, y * tilesize)); + } } public static boolean validPlace(Team team, int x, int y, Block type, int rotation){ diff --git a/core/src/io/anuke/mindustry/world/blocks/types/BuildBlock.java b/core/src/io/anuke/mindustry/world/blocks/types/BuildBlock.java index 4ae9783fb0..124aac1975 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/BuildBlock.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/BuildBlock.java @@ -9,6 +9,7 @@ import io.anuke.mindustry.entities.effect.Rubble; import io.anuke.mindustry.game.Team; import io.anuke.mindustry.graphics.Layer; import io.anuke.mindustry.graphics.Shaders; +import io.anuke.mindustry.resource.ItemStack; import io.anuke.mindustry.resource.Recipe; import io.anuke.mindustry.world.BarType; import io.anuke.mindustry.world.Block; @@ -96,5 +97,6 @@ public class BuildBlock extends Block { public Block result; public Recipe recipe; public float progress = 0.05f; + public ItemStack[] stacks; } }