Start of drill re-tiering / Animated drills / Fixed fracker bugs
BIN
core/assets-raw/sprites/blocks/production/irondrill-rotator.png
Normal file
After Width: | Height: | Size: 174 B |
BIN
core/assets-raw/sprites/blocks/production/irondrill-top.png
Normal file
After Width: | Height: | Size: 188 B |
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 188 B |
BIN
core/assets-raw/sprites/blocks/production/laserdrill-rotator.png
Normal file
After Width: | Height: | Size: 261 B |
BIN
core/assets-raw/sprites/blocks/production/laserdrill-top.png
Normal file
After Width: | Height: | Size: 286 B |
Before Width: | Height: | Size: 496 B After Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 428 B After Width: | Height: | Size: 428 B |
Before Width: | Height: | Size: 397 B After Width: | Height: | Size: 411 B |
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 224 B After Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 98 KiB |
@ -1,7 +1,7 @@
|
||||
#Autogenerated file. Do not modify.
|
||||
#Wed Mar 28 21:22:01 EDT 2018
|
||||
#Wed Mar 28 22:57:35 EDT 2018
|
||||
version=release
|
||||
androidBuildCode=708
|
||||
androidBuildCode=718
|
||||
name=Mindustry
|
||||
code=3.4
|
||||
build=custom build
|
||||
|
@ -69,11 +69,11 @@ public class Recipes {
|
||||
|
||||
//new Recipe(production, ProductionBlocks.stonedrill, stack(Item.stone, 12)),
|
||||
new Recipe(production, ProductionBlocks.irondrill, stack(Items.iron, 25)),
|
||||
new Recipe(production, ProductionBlocks.leaddrill, stack(Items.iron, 25)),
|
||||
new Recipe(production, ProductionBlocks.coaldrill, stack(Items.iron, 25), stack(Items.iron, 40)),
|
||||
new Recipe(production, ProductionBlocks.titaniumdrill, stack(Items.iron, 50), stack(Items.steel, 50)),
|
||||
new Recipe(production, ProductionBlocks.thoriumdrill, stack(Items.iron, 40), stack(Items.steel, 40)),
|
||||
new Recipe(production, ProductionBlocks.quartzextractor, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
|
||||
//new Recipe(production, ProductionBlocks.leaddrill, stack(Items.iron, 25)),
|
||||
//new Recipe(production, ProductionBlocks.coaldrill, stack(Items.iron, 25), stack(Items.iron, 40)),
|
||||
//new Recipe(production, ProductionBlocks.titaniumdrill, stack(Items.iron, 50), stack(Items.steel, 50)),
|
||||
//new Recipe(production, ProductionBlocks.thoriumdrill, stack(Items.iron, 40), stack(Items.steel, 40)),
|
||||
//new Recipe(production, ProductionBlocks.quartzextractor, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
|
||||
new Recipe(production, ProductionBlocks.cultivator, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
|
||||
new Recipe(production, ProductionBlocks.laserdrill, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
|
||||
new Recipe(production, ProductionBlocks.waterextractor, stack(Items.titanium, 40), stack(Items.densealloy, 40)),
|
||||
|
@ -132,19 +132,16 @@ public class Blocks {
|
||||
rock = new Rock("rock") {{
|
||||
variants = 2;
|
||||
varyShadow = true;
|
||||
drops = new ItemStack(Items.stone, 3);
|
||||
}},
|
||||
|
||||
icerock = new Rock("icerock") {{
|
||||
variants = 2;
|
||||
varyShadow = true;
|
||||
drops = new ItemStack(Items.stone, 3);
|
||||
}},
|
||||
|
||||
blackrock = new Rock("blackrock") {{
|
||||
variants = 1;
|
||||
varyShadow = true;
|
||||
drops = new ItemStack(Items.stone, 3);
|
||||
}},
|
||||
|
||||
dirtblock = new StaticBlock("dirtblock") {{
|
||||
|
@ -93,7 +93,7 @@ public class ProductionBlocks {
|
||||
powerUse = 0.6f;
|
||||
pumpAmount = 0.06f;
|
||||
size = 3;
|
||||
liquidCapacity = 80f;
|
||||
liquidCapacity = 30f;
|
||||
}},
|
||||
|
||||
cultivator = new Cultivator("cultivator") {{
|
||||
|
@ -194,6 +194,14 @@ public class Fx{
|
||||
Draw.reset();
|
||||
});
|
||||
}),
|
||||
|
||||
pulverizeSmall = new Effect(30, e -> {
|
||||
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*8f, (x, y)->{
|
||||
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.ifract());
|
||||
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 1f + 0.5f, 45);
|
||||
Draw.reset();
|
||||
});
|
||||
}),
|
||||
|
||||
laserspark = new Effect(14, e -> {
|
||||
Angles.randLenVectors(e.id, 8, 1f + e.ifract()*11f, (x, y)->{
|
||||
@ -344,18 +352,12 @@ public class Fx{
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
spark = new Effect(10, e -> {
|
||||
Lines.stroke(1f);
|
||||
Draw.color(Color.WHITE, Color.GRAY, e.ifract());
|
||||
Lines.spikes(e.x, e.y, e.ifract() * 5f, 2, 8);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
sparkbig = new Effect(11, e -> {
|
||||
Lines.stroke(1f);
|
||||
Draw.color(lightRed, Color.GRAY, e.ifract());
|
||||
Lines.spikes(e.x, e.y, e.ifract() * 5f, 2.3f, 8);
|
||||
Draw.reset();
|
||||
mine = new Effect(20, e -> {
|
||||
Angles.randLenVectors(e.id, 6, 3f + e.ifract()*6f, (x, y)->{
|
||||
Draw.color(Color.WHITE, Color.GRAY, e.ifract());
|
||||
Fill.poly(e.x + x, e.y + y, 4, e.fract() * 2f, 45);
|
||||
Draw.reset();
|
||||
});
|
||||
}),
|
||||
|
||||
smelt = new Effect(10, e -> {
|
||||
|
@ -1,12 +1,13 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.graphics.Layer;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.BlockGroup;
|
||||
import io.anuke.mindustry.graphics.Layer;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Effects.Effect;
|
||||
@ -14,6 +15,7 @@ import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
import io.anuke.ucore.util.Tmp;
|
||||
|
||||
public class Drill extends Block{
|
||||
protected final int timerDrill = timers++;
|
||||
@ -24,7 +26,8 @@ public class Drill extends Block{
|
||||
protected Block resource;
|
||||
protected Item result;
|
||||
protected float drillTime = 300;
|
||||
protected Effect drillEffect = Fx.spark;
|
||||
protected Effect drillEffect = Fx.mine;
|
||||
protected float rotateSpeed = 2f;
|
||||
|
||||
public Drill(String name) {
|
||||
super(name);
|
||||
@ -34,6 +37,23 @@ public class Drill extends Block{
|
||||
itemCapacity = 5;
|
||||
group = BlockGroup.drills;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile) {
|
||||
Draw.rect(name, tile.drawx(), tile.drawy());
|
||||
Draw.rect(name + "-rotator", tile.drawx(), tile.drawy(), Timers.time() * rotateSpeed);
|
||||
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
|
||||
|
||||
TextureRegion region = result.region;
|
||||
Tmp.tr1.setRegion(region, 4, 4, 1, 1);
|
||||
|
||||
Draw.rect(Tmp.tr1, tile.drawx(), tile.drawy(), 2f, 2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] getIcon() {
|
||||
return new TextureRegion[]{Draw.region(name), Draw.region(name + "-rotator"), Draw.region(name + "-top")};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStats(){
|
||||
|
@ -19,15 +19,15 @@ public class Fracker extends SolidPump {
|
||||
public void draw(Tile tile) {
|
||||
FrackerEntity entity = tile.entity();
|
||||
|
||||
Draw.rect(name, tile.worldx(), tile.worldy());
|
||||
Draw.rect(name, tile.drawx(), tile.drawy());
|
||||
|
||||
Draw.color(tile.entity.liquid.liquid.color);
|
||||
Draw.alpha(tile.entity.liquid.amount/liquidCapacity);
|
||||
Draw.rect(name + "-liquid", tile.worldx(), tile.worldy());
|
||||
Draw.rect(name + "-liquid", tile.drawx(), tile.drawy());
|
||||
Draw.color();
|
||||
|
||||
Draw.rect(name + "-rotator", tile.worldx(), tile.worldy(), entity.pumpTime);
|
||||
Draw.rect(name + "-top", tile.worldx(), tile.worldy());
|
||||
Draw.rect(name + "-rotator", tile.drawx(), tile.drawy(), entity.pumpTime);
|
||||
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,6 +42,8 @@ public class Fracker extends SolidPump {
|
||||
if(entity.input >= inputLiquidUse * Timers.delta()){
|
||||
super.update(tile);
|
||||
entity.input -= inputLiquidUse * Timers.delta();
|
||||
}else{
|
||||
tryDumpLiquid(tile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,18 @@
|
||||
package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
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.Effects.Effect;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
/**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{
|
||||
@ -17,12 +22,30 @@ public class GenericDrill extends Drill{
|
||||
protected float liquidUse = 0.1f;
|
||||
protected Liquid inputLiquid = Liquids.water;
|
||||
|
||||
protected float rotateSpeed = 1.5f;
|
||||
protected Effect updateEffect = Fx.pulverizeSmall;
|
||||
protected float updateEffectChance = 0.02f;
|
||||
|
||||
private Array<Item> toAdd = new Array<>();
|
||||
|
||||
public GenericDrill(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile) {
|
||||
DrillEntity entity = tile.entity();
|
||||
|
||||
Draw.rect(name, tile.drawx(), tile.drawy());
|
||||
Draw.rect(name + "-rotator", tile.drawx(), tile.drawy(), entity.drillTime * rotateSpeed);
|
||||
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] getIcon() {
|
||||
return new TextureRegion[]{Draw.region(name), Draw.region(name + "-rotator"), Draw.region(name + "-top")};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
toAdd.clear();
|
||||
@ -38,26 +61,34 @@ public class GenericDrill extends Drill{
|
||||
}
|
||||
}
|
||||
|
||||
entity.drillTime += entity.warmup * Timers.delta();
|
||||
|
||||
float powerUsed = Math.min(powerCapacity, powerUse * Timers.delta());
|
||||
float liquidUsed = Math.min(liquidCapacity, liquidUse * Timers.delta());
|
||||
|
||||
//TODO slow down when no space.
|
||||
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() * multiplier;
|
||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, 0.02f);
|
||||
entity.progress += Timers.delta() * multiplier;
|
||||
|
||||
if(Mathf.chance(Timers.delta() * updateEffectChance))
|
||||
Effects.effect(updateEffect, entity.x + Mathf.range(size*2f), entity.y + Mathf.range(size*2f));
|
||||
}else{
|
||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 0f, 0.02f);
|
||||
return;
|
||||
}
|
||||
|
||||
if(toAdd.size > 0 && entity.time >= drillTime
|
||||
if(toAdd.size > 0 && entity.progress >= drillTime
|
||||
&& tile.entity.inventory.totalItems() < itemCapacity){
|
||||
|
||||
int index = entity.index % toAdd.size;
|
||||
offloadNear(tile, toAdd.get(index));
|
||||
|
||||
entity.index ++;
|
||||
entity.time = 0f;
|
||||
entity.progress = 0f;
|
||||
|
||||
Effects.effect(drillEffect, tile.drawx(), tile.drawy());
|
||||
}
|
||||
@ -87,7 +118,9 @@ public class GenericDrill extends Drill{
|
||||
}
|
||||
|
||||
public static class DrillEntity extends TileEntity{
|
||||
public float time;
|
||||
public float progress;
|
||||
public int index;
|
||||
public float warmup;
|
||||
public float drillTime;
|
||||
}
|
||||
}
|
||||
|