Animated oil extractor
Before Width: | Height: | Size: 268 B After Width: | Height: | Size: 239 B |
After Width: | Height: | Size: 341 B |
BIN
core/assets-raw/sprites/blocks/production/oilextractor-top.png
Normal file
After Width: | Height: | Size: 379 B |
Before Width: | Height: | Size: 695 B After Width: | Height: | Size: 473 B |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 98 KiB |
@ -1,7 +1,7 @@
|
||||
#Autogenerated file. Do not modify.
|
||||
#Wed Mar 28 19:56:26 EDT 2018
|
||||
#Wed Mar 28 21:22:01 EDT 2018
|
||||
version=release
|
||||
androidBuildCode=706
|
||||
androidBuildCode=708
|
||||
name=Mindustry
|
||||
code=3.4
|
||||
build=custom build
|
||||
|
@ -19,6 +19,7 @@ public class DebugBlocks {
|
||||
powerInfinite = new PowerDistributor("powerinfinite") {
|
||||
{
|
||||
powerCapacity = 10000f;
|
||||
powerSpeed = 100f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,6 +2,7 @@ package io.anuke.mindustry.content.blocks;
|
||||
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.blocks.types.production.*;
|
||||
|
||||
@ -86,6 +87,8 @@ public class ProductionBlocks {
|
||||
oilextractor = new Fracker("oilextractor") {{
|
||||
result = Liquids.oil;
|
||||
inputLiquid = Liquids.water;
|
||||
updateEffect = Fx.pulverize;
|
||||
updateEffectChance = 0.05f;
|
||||
inputLiquidUse = 0.3f;
|
||||
powerUse = 0.6f;
|
||||
pumpAmount = 0.06f;
|
||||
|
@ -187,9 +187,9 @@ public class Fx{
|
||||
});
|
||||
}),
|
||||
|
||||
pulverize = new Effect(25, e -> {
|
||||
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*5f, (x, y)->{
|
||||
Draw.color(Color.valueOf("eae4f0"), Color.GRAY, e.ifract());
|
||||
pulverize = new Effect(40, 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() * 2f + 0.5f, 45);
|
||||
Draw.reset();
|
||||
});
|
||||
@ -532,6 +532,7 @@ public class Fx{
|
||||
Draw.tscl(0.5f);
|
||||
Draw.reset();
|
||||
}),
|
||||
|
||||
transfer = new Effect(20, e -> {
|
||||
Draw.color(Color.SCARLET, Color.CLEAR, e.fract());
|
||||
Lines.square(e.x, e.y, 4);
|
||||
|
@ -1,9 +1,11 @@
|
||||
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.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
|
||||
public class Fracker extends SolidPump {
|
||||
protected Liquid inputLiquid;
|
||||
@ -13,6 +15,26 @@ public class Fracker extends SolidPump {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile) {
|
||||
FrackerEntity entity = tile.entity();
|
||||
|
||||
Draw.rect(name, tile.worldx(), tile.worldy());
|
||||
|
||||
Draw.color(tile.entity.liquid.liquid.color);
|
||||
Draw.alpha(tile.entity.liquid.amount/liquidCapacity);
|
||||
Draw.rect(name + "-liquid", tile.worldx(), tile.worldy());
|
||||
Draw.color();
|
||||
|
||||
Draw.rect(name + "-rotator", tile.worldx(), tile.worldy(), entity.pumpTime);
|
||||
Draw.rect(name + "-top", tile.worldx(), tile.worldy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion[] getIcon() {
|
||||
return new TextureRegion[]{Draw.region(name), Draw.region(name + "-rotator"), Draw.region(name + "-top")};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile) {
|
||||
FrackerEntity entity = tile.entity();
|
||||
@ -45,7 +67,7 @@ public class Fracker extends SolidPump {
|
||||
return new FrackerEntity();
|
||||
}
|
||||
|
||||
public static class FrackerEntity extends TileEntity{
|
||||
public static class FrackerEntity extends SolidPumpEntity{
|
||||
public float input;
|
||||
}
|
||||
}
|
||||
|
@ -2,15 +2,22 @@ package io.anuke.mindustry.world.blocks.types.production;
|
||||
|
||||
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.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.util.Mathf;
|
||||
|
||||
/**Pump that makes liquid from solids and takes in power. Only works on solid floor blocks.*/
|
||||
public class SolidPump extends Pump {
|
||||
protected Liquid result = Liquids.water;
|
||||
/**Power use per liquid unit.*/
|
||||
protected float powerUse = 0.1f;
|
||||
protected Effect updateEffect = Fx.none;
|
||||
protected float updateEffectChance = 0.02f;
|
||||
|
||||
protected final Array<Tile> drawTiles = new Array<>();
|
||||
|
||||
@ -22,6 +29,8 @@ public class SolidPump extends Pump {
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
SolidPumpEntity entity = tile.entity();
|
||||
|
||||
float used = Math.min(powerUse * Timers.delta(), powerCapacity);
|
||||
|
||||
float fraction = 0f;
|
||||
@ -41,8 +50,15 @@ public class SolidPump extends Pump {
|
||||
tile.entity.liquid.liquid = result;
|
||||
tile.entity.liquid.amount += maxPump;
|
||||
tile.entity.power.amount -= used;
|
||||
entity.warmup = Mathf.lerpDelta(entity.warmup, 1f, 0.02f);
|
||||
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);
|
||||
}
|
||||
|
||||
entity.pumpTime += entity.warmup * Timers.delta();
|
||||
|
||||
tryDumpLiquid(tile);
|
||||
}
|
||||
|
||||
@ -63,4 +79,14 @@ public class SolidPump extends Pump {
|
||||
protected boolean isValid(Tile tile){
|
||||
return !tile.floor().liquid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getEntity() {
|
||||
return new SolidPumpEntity();
|
||||
}
|
||||
|
||||
public static class SolidPumpEntity extends TileEntity{
|
||||
public float warmup;
|
||||
public float pumpTime;
|
||||
}
|
||||
}
|
||||
|