Oil extractor water now needed / new liquid physics / new plastic balance

This commit is contained in:
Anuken 2018-03-28 20:01:47 -04:00
parent 737c63da5e
commit fbf8655ea4
26 changed files with 675 additions and 459 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 B

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 638 B

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 497 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

@ -1,7 +1,7 @@
#Autogenerated file. Do not modify.
#Wed Mar 28 10:18:53 EDT 2018
#Wed Mar 28 19:56:26 EDT 2018
version=release
androidBuildCode=693
androidBuildCode=706
name=Mindustry
code=3.4
build=custom build

View File

@ -100,27 +100,29 @@ public class CraftingBlocks {
size = 2;
}},
plasticFormer = new GenericCrafter("plasticformer") {{
plasticFormer = new PlasticFormer("plasticformer") {{
inputLiquid = Liquids.oil;
liquidUse = 0.3f;
liquidCapacity = 60f;
powerUse = 0.3f;
powerUse = 0.5f;
craftTime = 80f;
output = Items.plastic;
itemCapacity = 30;
size = 2;
health = 320;
hasPower = hasLiquids = true;
craftEffect = Fx.formsmoke;
updateEffect = Fx.plasticburn;
}},
biomatterCompressor = new Compressor("biomattercompressor") {{
input = new ItemStack(Items.biomatter, 1);
liquidCapacity = 60f;
itemCapacity = 50;
powerUse = 0.05f;
craftTime = 10f;
powerUse = 0.06f;
craftTime = 25f;
outputLiquid = Liquids.oil;
outputLiquidAmount = 0.08f;
outputLiquidAmount = 0.1f;
size = 2;
health = 320;
hasLiquids = true;

View File

@ -1,55 +1,51 @@
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.defense.RepairTurret;
import io.anuke.mindustry.world.blocks.types.defense.ShieldBlock;
import io.anuke.mindustry.world.blocks.types.distribution.Teleporter;
import io.anuke.mindustry.world.blocks.types.power.ItemPowerGenerator;
import io.anuke.mindustry.world.blocks.types.power.*;
public class PowerBlocks {
public static final Block
coalgenerator = new io.anuke.mindustry.world.blocks.types.power.ItemPowerGenerator("coalgenerator") {{
generateItem = Items.coal;
coalgenerator = new BurnerGenerator("coalgenerator") {{
//generateItem = Items.coal;
powerOutput = 0.04f;
powerCapacity = 40f;
}},
thermalgenerator = new io.anuke.mindustry.world.blocks.types.power.LiquidPowerGenerator("thermalgenerator") {{
generateLiquid = Liquids.lava;
thermalgenerator = new LiquidHeatGenerator("thermalgenerator") {{
maxLiquidGenerate = 0.5f;
powerPerLiquid = 0.08f;
powerCapacity = 40f;
generateEffect = Fx.redgeneratespark;
}},
combustiongenerator = new io.anuke.mindustry.world.blocks.types.power.LiquidPowerGenerator("combustiongenerator") {{
generateLiquid = Liquids.oil;
combustiongenerator = new LiquidBurnerGenerator("combustiongenerator") {{
maxLiquidGenerate = 0.4f;
powerPerLiquid = 0.12f;
powerCapacity = 40f;
}},
rtgenerator = new ItemPowerGenerator("rtgenerator") {{
generateItem = Items.thorium;
rtgenerator = new BurnerGenerator("rtgenerator") {{
//generateItem = Items.thorium;
powerCapacity = 40f;
powerOutput = 0.03f;
itemDuration = 240f;
}},
solarpanel = new io.anuke.mindustry.world.blocks.types.power.SolarGenerator("solarpanel") {{
solarpanel = new SolarGenerator("solarpanel") {{
generation = 0.003f;
}},
largesolarpanel = new io.anuke.mindustry.world.blocks.types.power.SolarGenerator("largesolarpanel") {{
largesolarpanel = new SolarGenerator("largesolarpanel") {{
size = 3;
generation = 0.012f;
}},
nuclearReactor = new io.anuke.mindustry.world.blocks.types.power.NuclearReactor("nuclearreactor") {{
nuclearReactor = new NuclearReactor("nuclearreactor") {{
size = 3;
health = 600;
breaktime *= 2.3f;
@ -74,16 +70,16 @@ public class PowerBlocks {
health = 400;
}},
battery = new io.anuke.mindustry.world.blocks.types.power.PowerGenerator("battery") {{
battery = new PowerGenerator("battery") {{
powerCapacity = 320f;
}},
batteryLarge = new io.anuke.mindustry.world.blocks.types.power.PowerGenerator("batterylarge") {{
batteryLarge = new PowerGenerator("batterylarge") {{
size = 3;
powerCapacity = 2000f;
}},
powernode = new io.anuke.mindustry.world.blocks.types.power.PowerDistributor("powernode"),
powernode = new PowerDistributor("powernode"),
teleporter = new Teleporter("teleporter");
}

View File

@ -3,10 +3,7 @@ package io.anuke.mindustry.content.blocks;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.types.production.Cultivator;
import io.anuke.mindustry.world.blocks.types.production.Drill;
import io.anuke.mindustry.world.blocks.types.production.GenericDrill;
import io.anuke.mindustry.world.blocks.types.production.SolidPump;
import io.anuke.mindustry.world.blocks.types.production.*;
public class ProductionBlocks {
public static final Block
@ -86,8 +83,10 @@ public class ProductionBlocks {
liquidCapacity = 30f;
}},
oilextractor = new SolidPump("oilextractor") {{
oilextractor = new Fracker("oilextractor") {{
result = Liquids.oil;
inputLiquid = Liquids.water;
inputLiquidUse = 0.3f;
powerUse = 0.6f;
pumpAmount = 0.06f;
size = 3;

View File

@ -179,6 +179,14 @@ public class Fx{
});
}),
plasticburn = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.ifract()*5f, (x, y)->{
Draw.color(Color.valueOf("e9ead3"), Color.GRAY, e.ifract());
Fill.circle(e.x + x, e.y + y, e.fract()*1f);
Draw.reset();
});
}),
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());
@ -222,6 +230,14 @@ public class Fx{
});
}),
formsmoke = new Effect(40, e -> {
Angles.randLenVectors(e.id, 6, 5f + e.ifract()*8f, (x, y)->{
Draw.color(Color.valueOf("f1e479"), Color.LIGHT_GRAY, e.ifract());
Fill.poly(e.x + x, e.y + y, 4, 0.2f+e.fract()*2f, 45);
Draw.reset();
});
}),
blastsmoke = new Effect(26, e -> {
Angles.randLenVectors(e.id, 12, 1f + e.ifract()*23f, (x, y)->{
float size = 2f+e.fract()*6f;

View File

@ -3,7 +3,7 @@ package io.anuke.mindustry.world;
import com.badlogic.gdx.math.GridPoint2;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.Liquid;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Mathf;
public abstract class BaseBlock {
public boolean hasInventory = true;
@ -92,14 +92,17 @@ public abstract class BaseBlock {
if(ofract > fract) return;
float flow = Math.min((fract - ofract) * (liquidCapacity/(1.1f + tile.entity.liquid.liquid.viscosity)),
Math.min(tile.entity.liquid.amount/liquidFlowFactor * Math.max(Timers.delta(), 1f), tile.entity.liquid.amount));
float flow = Math.min(Mathf.clamp((fract - ofract)*(1f)) * (liquidCapacity), tile.entity.liquid.amount);
if(flow <= 0f || tile.entity.liquid.amount < flow) return;
flow = Math.min(flow, next.block().liquidCapacity - next.entity.liquid.amount - 0.001f);
if(next.block().acceptLiquid(next, tile, tile.entity.liquid.liquid, flow)){
next.block().handleLiquid(next, tile, tile.entity.liquid.liquid, flow);
tile.entity.liquid.amount -= flow;
if(flow <= 0f) return;
float amount = flow;
if(next.block().acceptLiquid(next, tile, tile.entity.liquid.liquid, amount)){
next.block().handleLiquid(next, tile, tile.entity.liquid.liquid, amount);
tile.entity.liquid.amount -= amount;
}
}
}

View File

@ -35,7 +35,8 @@ public class TunnelConduit extends LiquidBlock {
Tile to = tunnel.getNearby(tunnel.getRotation());
if (to == null || !(to.block().hasLiquids)) return;
if (to.block().acceptLiquid(tile, source, liquid, amount)) to.block().handleLiquid(to, tunnel, liquid, amount);
if (to.block().acceptLiquid(to, tunnel, liquid, amount))
to.block().handleLiquid(to, tunnel, liquid, amount);
}
@Override

View File

@ -1,6 +1,7 @@
package io.anuke.mindustry.world.blocks.types.power;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.world.BarType;
@ -13,22 +14,26 @@ import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Strings;
public class ItemPowerGenerator extends PowerGenerator {
public int itemCapacity = 20;
public Item generateItem;
public float powerOutput;
public float itemDuration = 70f;
public Effect generateEffect = Fx.generatespark;
public Color heatColor = Color.valueOf("ff9b59");
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public ItemPowerGenerator(String name) {
public class BurnerGenerator extends PowerGenerator {
protected float minFlammability = 0.2f;
protected float powerOutput;
protected float itemDuration = 70f;
protected Effect generateEffect = Fx.generatespark;
protected Color heatColor = Color.valueOf("ff9b59");
public BurnerGenerator(String name) {
super(name);
itemCapacity = 20;
}
@Override
public void setBars(){
super.setBars();
bars.replace(new BlockBar(BarType.inventory, true, tile -> (float)tile.entity.inventory.getItem(generateItem) / itemCapacity));
bars.replace(new BlockBar(BarType.inventory, true, tile -> (float)tile.entity.inventory.totalItems() / itemCapacity));
}
@Override
@ -36,7 +41,6 @@ public class ItemPowerGenerator extends PowerGenerator {
super.setStats();
stats.add("powergenerationsecond", Strings.toFixed(powerOutput*60f, 2));
stats.add("generationsecondsitem", Strings.toFixed(itemDuration/60f, 2));
stats.add("input", generateItem);
}
@Override
@ -47,7 +51,7 @@ public class ItemPowerGenerator extends PowerGenerator {
if(entity.generateTime > 0){
Draw.color(heatColor);
float alpha = (entity.inventory.hasItem(generateItem) ? 1f : Mathf.clamp(entity.generateTime));
float alpha = (entity.inventory.totalItems() > 0 ? 1f : Mathf.clamp(entity.generateTime));
alpha = alpha * 0.7f + Mathf.absin(Timers.time(), 12f, 0.3f) * alpha;
Draw.alpha(alpha);
Draw.rect(name + "-top", tile.worldx(), tile.worldy());
@ -57,14 +61,14 @@ public class ItemPowerGenerator extends PowerGenerator {
@Override
public boolean acceptItem(Item item, Tile tile, Tile source){
return item == generateItem && tile.entity.inventory.getItem(generateItem) < itemCapacity;
return item.flammability >= minFlammability && tile.entity.inventory.totalItems() < itemCapacity;
}
@Override
public void update(Tile tile){
GeneratorEntity entity = tile.entity();
BurnerEntity entity = tile.entity();
float maxPower = Math.min(powerCapacity - entity.power.amount, powerOutput * Timers.delta());
float maxPower = Math.min(powerCapacity - entity.power.amount, powerOutput * Timers.delta()) * entity.efficiency;
float mfract = maxPower/(powerOutput);
if(entity.generateTime > 0f){
@ -73,9 +77,15 @@ public class ItemPowerGenerator extends PowerGenerator {
entity.generateTime = Mathf.clamp(entity.generateTime);
}
if(entity.generateTime <= 0f && entity.inventory.hasItem(generateItem)){
if(entity.generateTime <= 0f && entity.inventory.totalItems() > 0){
Effects.effect(generateEffect, tile.worldx() + Mathf.range(3f), tile.worldy() + Mathf.range(3f));
entity.inventory.removeItem(generateItem, 1);
for(int i = 0; i < entity.inventory.items.length; i ++){
if(entity.inventory.items[i] > 0){
entity.inventory.items[i] --;
entity.efficiency = Item.getByID(i).flammability;
break;
}
}
entity.generateTime = 1f;
}
@ -83,4 +93,23 @@ public class ItemPowerGenerator extends PowerGenerator {
}
@Override
public TileEntity getEntity() {
return new BurnerEntity();
}
public static class BurnerEntity extends GeneratorEntity{
public float efficiency;
@Override
public void write(DataOutputStream stream) throws IOException {
stream.writeFloat(efficiency);
}
@Override
public void read(DataInputStream stream) throws IOException {
efficiency = stream.readFloat();
}
}
}

View File

@ -4,6 +4,7 @@ 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.mindustry.world.blocks.types.power.BurnerGenerator.BurnerEntity;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.core.Timers;
@ -11,14 +12,14 @@ import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Strings;
public class LiquidPowerGenerator extends io.anuke.mindustry.world.blocks.types.power.PowerGenerator {
public Liquid generateLiquid;
public float powerPerLiquid = 0.13f;
public class LiquidBurnerGenerator extends PowerGenerator {
protected float minEfficiency = 0.2f;
protected float powerPerLiquid = 0.13f;
/**Maximum liquid used per frame.*/
public float maxLiquidGenerate = 0.4f;
public Effect generateEffect = Fx.generatespark;
protected float maxLiquidGenerate = 0.4f;
protected Effect generateEffect = Fx.generatespark;
public LiquidPowerGenerator(String name) {
public LiquidBurnerGenerator(String name) {
super(name);
liquidCapacity = 30f;
hasLiquids = true;
@ -29,7 +30,6 @@ public class LiquidPowerGenerator extends io.anuke.mindustry.world.blocks.types.
super.setStats();
stats.add("powerliquid", Strings.toFixed(powerPerLiquid, 2) + " power/liquid");
stats.add("maxliquidsecond", Strings.toFixed(maxLiquidGenerate*60f, 2) + " liquid/s");
stats.add("input", generateLiquid);
}
@Override
@ -53,6 +53,7 @@ public class LiquidPowerGenerator extends io.anuke.mindustry.world.blocks.types.
TileEntity entity = tile.entity();
if(entity.liquid.amount > 0){
float powerPerLiquid = getEfficiency(entity.liquid.liquid)*this.powerPerLiquid;
float used = Math.min(entity.liquid.amount, maxLiquidGenerate * Timers.delta());
used = Math.min(used, (powerCapacity - entity.power.amount)/powerPerLiquid);
@ -60,7 +61,6 @@ public class LiquidPowerGenerator extends io.anuke.mindustry.world.blocks.types.
entity.power.amount += used * powerPerLiquid;
if(used > 0.001f && Mathf.chance(0.05 * Timers.delta())){
Effects.effect(generateEffect, tile.drawx() + Mathf.range(3f), tile.drawy() + Mathf.range(3f));
}
}
@ -70,6 +70,15 @@ public class LiquidPowerGenerator extends io.anuke.mindustry.world.blocks.types.
@Override
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
return liquid == generateLiquid && super.acceptLiquid(tile, source, liquid, amount);
return getEfficiency(liquid) >= minEfficiency && super.acceptLiquid(tile, source, liquid, amount);
}
@Override
public TileEntity getEntity() {
return new BurnerEntity();
}
protected float getEfficiency(Liquid liquid){
return liquid.flammability;
}
}

View File

@ -0,0 +1,15 @@
package io.anuke.mindustry.world.blocks.types.power;
import io.anuke.mindustry.resource.Liquid;
public class LiquidHeatGenerator extends LiquidBurnerGenerator {
public LiquidHeatGenerator(String name) {
super(name);
}
@Override
protected float getEfficiency(Liquid liquid){
return liquid.flammability;
}
}

View File

@ -1,12 +1,11 @@
package io.anuke.mindustry.world.blocks.types.power;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.effect.DamageArea;
import io.anuke.mindustry.graphics.Fx;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.resource.Liquid;
import io.anuke.mindustry.world.BarType;
import io.anuke.mindustry.world.BlockBar;
@ -24,7 +23,7 @@ import java.io.IOException;
import static io.anuke.mindustry.Vars.tilesize;
public class NuclearReactor extends io.anuke.mindustry.world.blocks.types.power.LiquidPowerGenerator {
public class NuclearReactor extends LiquidBurnerGenerator {
protected final int timerFuel = timers++;
protected final Translator tr = new Translator();
@ -44,7 +43,6 @@ public class NuclearReactor extends io.anuke.mindustry.world.blocks.types.power.
public NuclearReactor(String name) {
super(name);
generateItem = Items.thorium;
generateLiquid = Liquids.water;
itemCapacity = 30;
liquidCapacity = 50;
explosionEffect = Fx.nuclearShockwave;

View File

@ -82,5 +82,6 @@ public class PowerGenerator extends PowerBlock {
public static class GeneratorEntity extends TileEntity{
public float generateTime;
public float uptime;
}
}

View File

@ -3,7 +3,10 @@ package io.anuke.mindustry.world.blocks.types.production;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.types.production.GenericCrafter.GenericCrafterEntity;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf;
public class Compressor extends PowerCrafter {
@ -12,9 +15,41 @@ public class Compressor extends PowerCrafter {
hasLiquids = true;
}
@Override
public void update(Tile tile) {
GenericCrafterEntity entity = tile.entity();
float powerUsed = Math.min(Timers.delta() * powerUse, tile.entity.power.amount);
float liquidAdded = Math.min(outputLiquidAmount * Timers.delta(), liquidCapacity - entity.liquid.amount);
int itemsUsed = Mathf.ceil(1 + input.amount * entity.progress);
if(entity.power.amount > powerUsed && entity.inventory.hasItem(input.item, itemsUsed) && liquidAdded > 0.001f){
entity.progress += 1f/craftTime;
entity.totalProgress += Timers.delta();
handleLiquid(tile, tile, outputLiquid, liquidAdded);
}
if(entity.progress >= 1f){
entity.inventory.removeItem(input);
if(outputItem != null) offloadNear(tile, outputItem);
entity.progress = 0f;
}
if(outputItem != null && entity.timer.get(timerDump, 5)){
tryDump(tile, outputItem);
}
if(outputLiquid != null){
tryDumpLiquid(tile);
}
}
@Override
public void draw(Tile tile) {
GenericCrafterEntity entity = tile.entity();
Draw.rect(name, tile.drawx(), tile.drawy());
Draw.rect(name + "-frame" + (int) Mathf.absin(entity.totalProgress, 5f, 2.999f), tile.drawx(), tile.drawy());
Draw.color(Color.CLEAR, tile.entity.liquid.liquid.color, tile.entity.liquid.amount / liquidCapacity);
Draw.rect(name + "-liquid", tile.drawx(), tile.drawy());
Draw.color();

View File

@ -0,0 +1,51 @@
package io.anuke.mindustry.world.blocks.types.production;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.resource.Liquid;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Timers;
public class Fracker extends SolidPump {
protected Liquid inputLiquid;
protected float inputLiquidUse;
public Fracker(String name) {
super(name);
}
@Override
public void update(Tile tile) {
FrackerEntity entity = tile.entity();
if(entity.input >= inputLiquidUse * Timers.delta()){
super.update(tile);
entity.input -= inputLiquidUse * Timers.delta();
}
}
@Override
public void handleLiquid(Tile tile, Tile source, Liquid liquid, float amount) {
if(liquid != inputLiquid){
super.handleLiquid(tile, source, liquid, amount);
}else{
FrackerEntity entity = tile.entity();
entity.input += amount;
}
}
@Override
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount) {
FrackerEntity entity = tile.entity();
return (liquid == inputLiquid && entity.input < inputLiquidUse) || super.acceptLiquid(tile, source, liquid, amount);
}
@Override
public TileEntity getEntity() {
return new FrackerEntity();
}
public static class FrackerEntity extends TileEntity{
public float input;
}
}

View File

@ -14,6 +14,7 @@ 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;
import io.anuke.ucore.util.Strings;
public class GenericCrafter extends Block{
@ -29,6 +30,8 @@ public class GenericCrafter extends Block{
protected float powerUse;
protected float liquidUse;
protected Effect craftEffect = Fx.purify;
protected Effect updateEffect = Fx.none;
protected float updateEffectChance = 0.04f;
public GenericCrafter(String name) {
super(name);
@ -84,8 +87,12 @@ public class GenericCrafter extends Block{
(inputItem == null || entity.inventory.hasItem(inputItem.item, itemsUsed))){
entity.progress += 1f / craftTime * Timers.delta();
entity.totalProgress += Timers.delta();
if(hasPower) entity.power.amount -= powerUsed;
if(hasLiquids) entity.liquid.amount -= liquidUsed;
if(Mathf.chance(Timers.delta() * updateEffectChance))
Effects.effect(updateEffect, entity.x + Mathf.range(size*4f), entity.y + Mathf.range(size*4));
}
if(entity.progress >= 1f){
@ -119,5 +126,6 @@ public class GenericCrafter extends Block{
public static class GenericCrafterEntity extends TileEntity{
public float progress;
public float totalProgress;
}
}

View File

@ -0,0 +1,23 @@
package io.anuke.mindustry.world.blocks.types.production;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf;
public class PlasticFormer extends GenericCrafter {
public PlasticFormer(String name) {
super(name);
}
@Override
public void draw(Tile tile) {
super.draw(tile);
GenericCrafterEntity entity = tile.entity();
Draw.alpha(Mathf.absin(entity.totalProgress, 3f, 0.9f));
Draw.rect(name + "-top", tile.drawx(), tile.drawy());
Draw.reset();
}
}

View File

@ -39,12 +39,14 @@ public class PowerCrafter extends Block{
if(entity.power.amount > powerUsed && entity.inventory.hasItem(input.item, itemsUsed)){
entity.progress += 1f/craftTime;
entity.totalProgress += Timers.delta();
}
if(entity.progress >= 1f){
entity.inventory.removeItem(input);
if(outputItem != null) offloadNear(tile, outputItem);
if(outputLiquid != null) handleLiquid(tile, tile, outputLiquid, outputLiquidAmount);
entity.progress = 0f;
}
if(outputItem != null && entity.timer.get(timerDump, 5)){