diff --git a/core/assets/sprites/sprites.atlas b/core/assets/sprites/sprites.atlas index a69675dcfd..4d3147d281 100644 --- a/core/assets/sprites/sprites.atlas +++ b/core/assets/sprites/sprites.atlas @@ -552,7 +552,7 @@ blocks/extra/cross-1 index: -1 blocks/extra/cross-2 rotate: false - xy: 468, 113 + xy: 213, 90 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -585,13 +585,6 @@ blocks/production/alloysmelter orig: 8, 8 offset: 0, 0 index: -1 -blocks/production/biomatterextractor - rotate: false - xy: 763, 426 - size: 16, 16 - orig: 16, 16 - offset: 0, 0 - index: -1 blocks/production/coaldrill rotate: false xy: 590, 155 @@ -627,6 +620,13 @@ blocks/production/combustiongenerator orig: 8, 8 offset: 0, 0 index: -1 +blocks/production/cultivator + rotate: false + xy: 468, 113 + size: 16, 16 + orig: 16, 16 + offset: 0, 0 + index: -1 blocks/production/fluxpump rotate: false xy: 847, 431 @@ -1063,7 +1063,7 @@ blocks/turrets/block-1 index: -1 blocks/turrets/block-2 rotate: false - xy: 727, 365 + xy: 763, 426 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -1077,7 +1077,7 @@ blocks/turrets/block-3 index: -1 blocks/turrets/chainturret rotate: false - xy: 637, 292 + xy: 727, 365 size: 16, 16 orig: 16, 16 offset: 0, 0 @@ -1869,7 +1869,7 @@ ui/cursor index: -1 ui/icons/controller-cursor rotate: false - xy: 213, 90 + xy: 637, 292 size: 16, 16 orig: 16, 16 offset: 0, 0 diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index 0a9075e4cf..061c27605b 100644 Binary files a/core/assets/sprites/sprites.png and b/core/assets/sprites/sprites.png differ diff --git a/core/assets/version.properties b/core/assets/version.properties index b6758cacc7..42c1c61e3d 100644 --- a/core/assets/version.properties +++ b/core/assets/version.properties @@ -1,7 +1,7 @@ #Autogenerated file. Do not modify. -#Thu Mar 08 23:00:40 EST 2018 +#Fri Mar 09 20:56:36 EST 2018 version=release -androidBuildCode=412 +androidBuildCode=417 name=Mindustry code=3.4 build=custom build diff --git a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java index caf6f79dac..bff11d4395 100644 --- a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java @@ -147,7 +147,7 @@ public class ProductionBlocks{ { resource = Blocks.stone; result = Item.stone; - time = 4; + drillTime = 40; } }, @@ -155,7 +155,7 @@ public class ProductionBlocks{ { resource = Blocks.iron; result = Item.iron; - time = 6; + drillTime = 60; } }, @@ -163,7 +163,7 @@ public class ProductionBlocks{ { resource = Blocks.coal; result = Item.coal; - time = 6; + drillTime = 60; } }, @@ -171,7 +171,7 @@ public class ProductionBlocks{ { resource = Blocks.uranium; result = Item.uranium; - time = 7; + drillTime = 70; } }, @@ -179,29 +179,29 @@ public class ProductionBlocks{ { resource = Blocks.titanium; result = Item.titanium; - time = 7; + drillTime = 70; } }, - laserdrill = new PowerDrill("laserdrill"){ + laserdrill = new GenericDrill("laserdrill"){ { - time = 4; + drillTime = 40; size = 2; powerUse = 0.08f; } }, - plasmadrill = new PowerDrill("plasmadrill"){ + plasmadrill = new GenericDrill("plasmadrill"){ { - time = 4; + drillTime = 40; size = 3; powerUse = 0.16f; } }, - nucleardrill = new PowerDrill("nucleardrill"){ + nucleardrill = new GenericDrill("nucleardrill"){ { - time = 4; + drillTime = 40; size = 4; powerUse = 0.32f; } @@ -211,18 +211,18 @@ public class ProductionBlocks{ { resource = Blocks.sand; result = Item.quartz; - time = 5; + drillTime = 50; size = 2; } }, - cultivator = new LiquidDrill("cultivator"){ + cultivator = new GenericDrill("cultivator"){ { resource = Blocks.grass; result = Item.biomatter; inputLiquid = Liquid.water; - inputLiquidAmount = 0.1f; - time = 5; + liquidUse = 0.1f; + drillTime = 50; size = 2; } }, diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java index e4cd19a637..f50f7288b4 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/Drill.java @@ -21,7 +21,7 @@ public class Drill extends Block{ protected Block resource; protected Item result; - protected float time = 5; + protected float drillTime = 5; protected Effect drillEffect = Fx.spark; public Drill(String name) { @@ -35,7 +35,7 @@ public class Drill extends Block{ @Override public void setStats(){ super.setStats(); - stats.add("secondsitem", time); + stats.add("secondsitem", drillTime); } @Override @@ -54,7 +54,7 @@ public class Drill extends Block{ if(isValid(tile)) mines = 1; } - if(mines > 0 && entity.timer.get(timerDrill, 60 * time) && tile.entity.inventory.getItem(result) < itemCapacity){ + if(mines > 0 && entity.timer.get(timerDrill, drillTime) && tile.entity.inventory.getItem(result) < itemCapacity){ for(int i = 0; i < mines; i ++) offloadNear(tile, result); Effects.effect(drillEffect, tile.drawx(), tile.drawy()); } diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/GenericDrill.java b/core/src/io/anuke/mindustry/world/blocks/types/production/GenericDrill.java new file mode 100644 index 0000000000..d1debf562e --- /dev/null +++ b/core/src/io/anuke/mindustry/world/blocks/types/production/GenericDrill.java @@ -0,0 +1,83 @@ +package io.anuke.mindustry.world.blocks.types.production; + +import com.badlogic.gdx.utils.Array; +import io.anuke.mindustry.entities.TileEntity; +import io.anuke.mindustry.resource.Item; +import io.anuke.mindustry.resource.Liquid; +import io.anuke.mindustry.world.Tile; +import io.anuke.ucore.core.Effects; +import io.anuke.ucore.core.Timers; + +/**Generic drill, can use both power and liquids. Set 'resource' to null to make it drill any block with drops.*/ +public class GenericDrill extends Drill{ + /**power use per frame.*/ + public float powerUse = 0.08f; + /**liquid use per frame.*/ + protected float liquidUse = 0.1f; + protected Liquid inputLiquid = Liquid.water; + + private Array toAdd = new Array<>(); + + public GenericDrill(String name){ + super(name); + } + + @Override + public void update(Tile tile){ + toAdd.clear(); + + DrillEntity entity = tile.entity(); + + float powerUsed = Math.min(powerCapacity, powerUse * Timers.delta()); + float liquidUsed = Math.min(liquidCapacity, liquidUse * Timers.delta()); + + if((!hasPower || entity.power.amount >= powerUsed) + && (!hasLiquids || entity.liquid.amount >= liquidUsed)){ + if(hasPower) entity.power.amount -= powerUsed; + if(hasLiquids) entity.liquid.amount -= liquidUsed; + entity.time += Timers.delta(); + }else{ + return; + } + + for(Tile other : tile.getLinkedTiles(tempTiles)){ + if(isValid(other)){ + toAdd.add(result == null ? other.floor().drops.item : result); + } + } + + if(toAdd.size > 0 && entity.power.amount > powerUse && entity.time >= drillTime + && tile.entity.inventory.totalItems() < itemCapacity){ + for(Item item : toAdd) offloadNear(tile, item); + Effects.effect(drillEffect, tile.drawx(), tile.drawy()); + entity.time = 0f; + } + + if(entity.timer.get(timerDump, 30)){ + tryDump(tile); + } + } + + @Override + protected boolean isValid(Tile tile){ + if(resource == null) { + return tile.floor().drops != null; + }else{ + return tile.floor() == resource || (resource.drops != null && resource.drops.equals(tile.floor().drops)); + } + } + + @Override + public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount) { + return super.acceptLiquid(tile, source, liquid, amount) && liquid == inputLiquid; + } + + @Override + public TileEntity getEntity() { + return new DrillEntity(); + } + + static class DrillEntity extends TileEntity{ + public float time; + } +} diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidDrill.java b/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidDrill.java deleted file mode 100644 index e1ac1cfc2b..0000000000 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/LiquidDrill.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.anuke.mindustry.world.blocks.types.production; - -import io.anuke.mindustry.resource.Liquid; -import io.anuke.mindustry.world.Tile; -import io.anuke.ucore.core.Timers; - -/**A drill that uses liquid as fuel.*/ -public class LiquidDrill extends Drill { - protected Liquid inputLiquid = Liquid.water; - protected float inputLiquidAmount = 0.1f; //per frame - - public LiquidDrill(String name){ - super(name); - - hasLiquids = true; - } - - @Override - public void update(Tile tile){ - float consume = Math.min(liquidCapacity, inputLiquidAmount * Timers.delta()); - - if(tile.entity.liquid.amount >= consume){ - tile.entity.liquid.amount -= consume; - super.update(tile); - } - } - - @Override - public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount) { - return super.acceptLiquid(tile, source, liquid, amount) && liquid == inputLiquid; - } -} diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/Omnidrill.java b/core/src/io/anuke/mindustry/world/blocks/types/production/Omnidrill.java deleted file mode 100644 index f59cd1142f..0000000000 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/Omnidrill.java +++ /dev/null @@ -1,58 +0,0 @@ -package io.anuke.mindustry.world.blocks.types.production; - -import com.badlogic.gdx.graphics.g2d.TextureRegion; -import io.anuke.mindustry.entities.TileEntity; -import io.anuke.mindustry.graphics.Fx; -import io.anuke.mindustry.resource.Item; -import io.anuke.mindustry.world.Block; -import io.anuke.mindustry.world.Tile; -import io.anuke.ucore.graphics.Draw; -import io.anuke.ucore.core.Effects; -import io.anuke.ucore.util.Tmp; - -public class Omnidrill extends Drill { - - public Omnidrill(String name){ - super(name); - drillEffect = Fx.sparkbig; - resource = null; - result = null; - } - - @Override - public void draw(Tile tile){ - super.draw(tile); - - if(tile.floor().drops == null) return; - Item item = tile.floor().drops.item; - - TextureRegion region = item.region; - Tmp.tr1.setRegion(region, 4, 4, 1, 1); - - Draw.rect(Tmp.tr1, tile.worldx(), tile.worldy(), 2f, 2f); - } - - @Override - public boolean canReplace(Block other) { - return other instanceof Drill && other != this; - } - - @Override - public void update(Tile tile){ - TileEntity entity = tile.entity; - - if(tile.floor().drops != null && entity.timer.get(timerDrill, 60 * time)){ - offloadNear(tile, tile.floor().drops.item); - Effects.effect(drillEffect, tile.worldx(), tile.worldy()); - } - - if(entity.timer.get(timerDump, 30)){ - tryDump(tile); - } - } - - @Override - public boolean isLayer(Tile tile){ - return tile.floor().drops == null; - } -} diff --git a/core/src/io/anuke/mindustry/world/blocks/types/production/PowerDrill.java b/core/src/io/anuke/mindustry/world/blocks/types/production/PowerDrill.java deleted file mode 100644 index 7ee1706200..0000000000 --- a/core/src/io/anuke/mindustry/world/blocks/types/production/PowerDrill.java +++ /dev/null @@ -1,55 +0,0 @@ -package io.anuke.mindustry.world.blocks.types.production; - -import com.badlogic.gdx.utils.Array; -import io.anuke.mindustry.resource.ItemStack; -import io.anuke.mindustry.world.Tile; -import io.anuke.mindustry.world.blocks.types.PowerBlock.PowerEntity; -import io.anuke.ucore.core.Effects; -import io.anuke.ucore.core.Timers; - -public class PowerDrill extends Drill{ - /**power use per frame.*/ - public float powerUse = 0.08f; - - private Array toAdd = new Array<>(); - - public PowerDrill(String name){ - super(name); - - hasPower = true; - } - - @Override - public void update(Tile tile){ - toAdd.clear(); - - PowerEntity entity = tile.entity(); - - float used = Math.min(powerUse * Timers.delta(), powerCapacity-0.1f); - - if(entity.power.amount >= used){ - entity.power.amount -= used; - } - - for(Tile other : tile.getLinkedTiles(tempTiles)){ - if(isValid(other)){ - toAdd.add(other.floor().drops); - } - } - - if(toAdd.size > 0 && entity.power.amount > powerUse && entity.timer.get(timerDrill, 60 * time) - && tile.entity.inventory.totalItems() < itemCapacity){ - for(ItemStack stack : toAdd) offloadNear(tile, stack.item); - Effects.effect(drillEffect, tile.drawx(), tile.drawy()); - } - - if(entity.timer.get(timerDump, 30)){ - tryDump(tile); - } - } - - @Override - protected boolean isValid(Tile tile){ - return tile.floor().drops != null; - } -}