Added armored conduit / Lighting improvements / Moved liquid package
BIN
core/assets-raw/sprites/blocks/liquid/plated-conduit-cap.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
core/assets-raw/sprites/blocks/liquid/plated-conduit-top-0.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
core/assets-raw/sprites/blocks/liquid/plated-conduit-top-1.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
core/assets-raw/sprites/blocks/liquid/plated-conduit-top-2.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
core/assets-raw/sprites/blocks/liquid/plated-conduit-top-3.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
core/assets-raw/sprites/blocks/liquid/plated-conduit-top-4.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
core/assets-raw/sprites/blocks/liquid/plated-conduit-top-5.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
core/assets-raw/sprites/blocks/liquid/plated-conduit-top-6.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
@ -963,6 +963,7 @@ block.fortress-factory.name = Fortress Mech Factory
|
||||
block.revenant-factory.name = Revenant Fighter Factory
|
||||
block.repair-point.name = Repair Point
|
||||
block.pulse-conduit.name = Pulse Conduit
|
||||
block.plated-conduit.name = Plated Conduit
|
||||
block.phase-conduit.name = Phase Conduit
|
||||
block.liquid-router.name = Liquid Router
|
||||
block.liquid-tank.name = Liquid Tank
|
||||
@ -1131,6 +1132,7 @@ block.rotary-pump.description = An advanced pump. Pumps more liquid, but require
|
||||
block.thermal-pump.description = The ultimate pump.
|
||||
block.conduit.description = Basic liquid transport block. Moves liquids forward. Used in conjunction with pumps and other conduits.
|
||||
block.pulse-conduit.description = An advanced liquid transport block. Transports liquids faster and stores more than standard conduits.
|
||||
block.plated-conduit.description = Moves liquids at the same rate as pulse conduits, but possesses more armor. Does not accept fluids from the sides by anything other than conduits.\nLeaks less.
|
||||
block.liquid-router.description = Accepts liquids from one direction and outputs them to up to 3 other directions equally. Can also store a certain amount of liquid. Useful for splitting the liquids from one source to multiple targets.
|
||||
block.liquid-tank.description = Stores a large amount of liquids. Use for creating buffers in situations with non-constant demand of materials or as a safeguard for cooling vital blocks.
|
||||
block.liquid-junction.description = Acts as a bridge for two crossing conduits. Useful in situations with two different conduits carrying different liquids to different locations.
|
||||
|
Before Width: | Height: | Size: 742 B After Width: | Height: | Size: 745 B |
Before Width: | Height: | Size: 736 KiB After Width: | Height: | Size: 740 KiB |
Before Width: | Height: | Size: 260 KiB After Width: | Height: | Size: 261 KiB |
Before Width: | Height: | Size: 897 KiB After Width: | Height: | Size: 905 KiB |
@ -19,6 +19,8 @@ import io.anuke.mindustry.world.blocks.*;
|
||||
import io.anuke.mindustry.world.blocks.defense.*;
|
||||
import io.anuke.mindustry.world.blocks.defense.turrets.*;
|
||||
import io.anuke.mindustry.world.blocks.distribution.*;
|
||||
import io.anuke.mindustry.world.blocks.liquid.Conduit;
|
||||
import io.anuke.mindustry.world.blocks.liquid.LiquidTank;
|
||||
import io.anuke.mindustry.world.blocks.logic.*;
|
||||
import io.anuke.mindustry.world.blocks.power.*;
|
||||
import io.anuke.mindustry.world.blocks.production.*;
|
||||
@ -59,7 +61,7 @@ public class Blocks implements ContentList{
|
||||
conveyor, titaniumConveyor, armoredConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, invertedSorter, router, overflowGate, massDriver,
|
||||
|
||||
//liquids
|
||||
mechanicalPump, rotaryPump, thermalPump, conduit, pulseConduit, liquidRouter, liquidTank, liquidJunction, bridgeConduit, phaseConduit,
|
||||
mechanicalPump, rotaryPump, thermalPump, conduit, pulseConduit, platedConduit, liquidRouter, liquidTank, liquidJunction, bridgeConduit, phaseConduit,
|
||||
|
||||
//power
|
||||
combustionGenerator, thermalGenerator, turbineGenerator, differentialGenerator, rtgGenerator, solarPanel, largeSolarPanel, thoriumReactor,
|
||||
@ -926,7 +928,7 @@ public class Blocks implements ContentList{
|
||||
}};
|
||||
|
||||
armoredConveyor = new ArmoredConveyor("armored-conveyor"){{
|
||||
requirements(Category.distribution, ItemStack.with(Items.metaglass, 1, Items.thorium, 1));
|
||||
requirements(Category.distribution, ItemStack.with(Items.plastanium, 1, Items.thorium, 1, Items.metaglass, 1));
|
||||
health = 180;
|
||||
speed = 0.08f;
|
||||
}};
|
||||
@ -1010,7 +1012,7 @@ public class Blocks implements ContentList{
|
||||
size = 3;
|
||||
}};
|
||||
|
||||
conduit = new Conduit("conduit"){{
|
||||
conduit = new io.anuke.mindustry.world.blocks.liquid.Conduit("conduit"){{
|
||||
requirements(Category.liquid, ItemStack.with(Items.metaglass, 1));
|
||||
health = 45;
|
||||
}};
|
||||
@ -1022,7 +1024,14 @@ public class Blocks implements ContentList{
|
||||
health = 90;
|
||||
}};
|
||||
|
||||
liquidRouter = new LiquidRouter("liquid-router"){{
|
||||
platedConduit = new io.anuke.mindustry.world.blocks.liquid.ArmoredConduit("plated-conduit"){{
|
||||
requirements(Category.liquid, ItemStack.with(Items.thorium, 2, Items.metaglass, 1));
|
||||
liquidCapacity = 16f;
|
||||
liquidPressure = 1.025f;
|
||||
health = 220;
|
||||
}};
|
||||
|
||||
liquidRouter = new io.anuke.mindustry.world.blocks.liquid.LiquidRouter("liquid-router"){{
|
||||
requirements(Category.liquid, ItemStack.with(Items.graphite, 4, Items.metaglass, 2));
|
||||
liquidCapacity = 20f;
|
||||
}};
|
||||
@ -1034,17 +1043,17 @@ public class Blocks implements ContentList{
|
||||
health = 500;
|
||||
}};
|
||||
|
||||
liquidJunction = new LiquidJunction("liquid-junction"){{
|
||||
liquidJunction = new io.anuke.mindustry.world.blocks.liquid.LiquidJunction("liquid-junction"){{
|
||||
requirements(Category.liquid, ItemStack.with(Items.graphite, 2, Items.metaglass, 2));
|
||||
}};
|
||||
|
||||
bridgeConduit = new LiquidExtendingBridge("bridge-conduit"){{
|
||||
bridgeConduit = new io.anuke.mindustry.world.blocks.liquid.LiquidExtendingBridge("bridge-conduit"){{
|
||||
requirements(Category.liquid, ItemStack.with(Items.graphite, 4, Items.metaglass, 8));
|
||||
range = 4;
|
||||
hasPower = false;
|
||||
}};
|
||||
|
||||
phaseConduit = new LiquidBridge("phase-conduit"){{
|
||||
phaseConduit = new io.anuke.mindustry.world.blocks.liquid.LiquidBridge("phase-conduit"){{
|
||||
requirements(Category.liquid, ItemStack.with(Items.phasefabric, 5, Items.silicon, 7, Items.metaglass, 20, Items.titanium, 10));
|
||||
range = 12;
|
||||
hasPower = true;
|
||||
|
@ -19,6 +19,7 @@ public class Liquids implements ContentList{
|
||||
temperature = 1f;
|
||||
viscosity = 0.8f;
|
||||
effect = StatusEffects.melting;
|
||||
lightColor = Color.valueOf("f0511d").a(0.4f);
|
||||
}};
|
||||
|
||||
oil = new Liquid("oil", Color.valueOf("313131")){{
|
||||
@ -34,6 +35,7 @@ public class Liquids implements ContentList{
|
||||
heatCapacity = 0.9f;
|
||||
temperature = 0.25f;
|
||||
effect = StatusEffects.freezing;
|
||||
lightColor = Color.valueOf("0097f5").a(0.2f);
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
@ -199,6 +199,10 @@ public class TechTree implements ContentList{
|
||||
node(phaseConduit, () -> {
|
||||
|
||||
});
|
||||
|
||||
node(platedConduit, () -> {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
node(rotaryPump, () -> {
|
||||
|
@ -237,6 +237,12 @@ public class Puddle extends SolidEntity implements SaveTrait, Poolable, DrawTrai
|
||||
seeds++;
|
||||
});
|
||||
Draw.color();
|
||||
|
||||
if(liquid.lightColor.a > 0.001f && f > 0){
|
||||
Color color = liquid.lightColor;
|
||||
float opacity = color.a * f;
|
||||
renderer.lights.add(tile.drawx(), tile.drawy(), 30f * f, color, opacity * 0.8f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -311,13 +311,17 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
|
||||
loops.play(block.idleSound, this, block.idleSoundVolume);
|
||||
}
|
||||
|
||||
Block previous = block;
|
||||
block.update(tile);
|
||||
if(block == previous && cons != null){
|
||||
|
||||
if(liquids != null){
|
||||
liquids.update();
|
||||
}
|
||||
|
||||
if(cons != null){
|
||||
cons.update();
|
||||
}
|
||||
|
||||
if(block == previous && power != null){
|
||||
if(power != null){
|
||||
power.graph.update();
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.game.Teams.*;
|
||||
import io.anuke.mindustry.ui.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
|
||||
import static io.anuke.arc.Core.camera;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
@ -218,7 +219,7 @@ public class BlockRenderer implements Disposable{
|
||||
addRequest(tile, Layer.block);
|
||||
}
|
||||
|
||||
if(state.rules.lighting){
|
||||
if(state.rules.lighting && tile.block().synthetic() && !(tile.block() instanceof BlockPart)){
|
||||
addRequest(tile, Layer.lights);
|
||||
}
|
||||
|
||||
|
@ -150,6 +150,7 @@ public class ContentParser{
|
||||
"io.anuke.mindustry.world.blocks.defense",
|
||||
"io.anuke.mindustry.world.blocks.defense.turrets",
|
||||
"io.anuke.mindustry.world.blocks.distribution",
|
||||
"io.anuke.mindustry.world.blocks.liquid",
|
||||
"io.anuke.mindustry.world.blocks.logic",
|
||||
"io.anuke.mindustry.world.blocks.power",
|
||||
"io.anuke.mindustry.world.blocks.production",
|
||||
|
@ -13,6 +13,8 @@ public class Liquid extends UnlockableContent{
|
||||
|
||||
/** Color used in bars. */
|
||||
public @Nullable Color barColor;
|
||||
/** Color used to draw lights. Note that the alpha channel is used to dictate brightness. */
|
||||
public Color lightColor = Color.clear.cpy();
|
||||
/** 0-1, 0 is completely inflammable, anything above that may catch fire when exposed to heat, 0.5+ is very flammable. */
|
||||
public float flammability;
|
||||
/** temperature: 0.5 is 'room' temperature, 0 is very cold, 1 is molten hot */
|
||||
|
@ -89,6 +89,8 @@ public class Block extends BlockStorage{
|
||||
public boolean configurable;
|
||||
/** Whether this block consumes touchDown events when tapped. */
|
||||
public boolean consumesTap;
|
||||
/** Whether to draw the glow of the liquid for this block, if it has one. */
|
||||
public boolean drawLiquidLight = true;
|
||||
/** Whether the config is positional and needs to be shifted. */
|
||||
public boolean posConfig;
|
||||
/** Whether this block uses conveyor-type placement mode.*/
|
||||
@ -293,7 +295,20 @@ public class Block extends BlockStorage{
|
||||
}
|
||||
|
||||
public void drawLight(Tile tile){
|
||||
if(hasLiquids && drawLiquidLight && tile.entity.liquids.current().lightColor.a > 0.001f){
|
||||
drawLiquidLight(tile, tile.entity.liquids.current(), tile.entity.liquids.smoothAmount());
|
||||
}
|
||||
}
|
||||
|
||||
public void drawLiquidLight(Tile tile, Liquid liquid, float amount){
|
||||
if(amount > 0.01f){
|
||||
Color color = liquid.lightColor;
|
||||
float fract = 1f;
|
||||
float opacity = color.a * fract;
|
||||
if(opacity > 0.001f){
|
||||
renderer.lights.add(tile.drawx(), tile.drawy(), size * 30f * fract, color, opacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void drawTeam(Tile tile){
|
||||
@ -610,7 +625,7 @@ public class Block extends BlockStorage{
|
||||
|
||||
if(hasLiquids){
|
||||
|
||||
tile.entity.liquids.forEach((liquid, amount) -> {
|
||||
tile.entity.liquids.each((liquid, amount) -> {
|
||||
float splash = Mathf.clamp(amount / 4f, 0f, 10f);
|
||||
|
||||
for(int i = 0; i < Mathf.clamp(amount / 5, 0, 30); i++){
|
||||
|
@ -116,7 +116,7 @@ public abstract class BlockStorage extends UnlockableContent{
|
||||
Tile other = proximity.get((i + dump) % proximity.size);
|
||||
Tile in = Edges.getFacingEdge(tile, other);
|
||||
|
||||
other = other.block().getLiquidDestination(other, in);
|
||||
other = other.block().getLiquidDestination(other, in, liquid);
|
||||
|
||||
if(other != null && other.getTeam() == tile.getTeam() && other.block().hasLiquids && canDumpLiquid(tile, other, liquid) && other.entity.liquids != null){
|
||||
float ofract = other.entity.liquids.get(liquid) / other.block().liquidCapacity;
|
||||
@ -142,10 +142,14 @@ public abstract class BlockStorage extends UnlockableContent{
|
||||
}
|
||||
|
||||
public float tryMoveLiquid(Tile tile, Tile next, boolean leak, Liquid liquid){
|
||||
return tryMoveLiquid(tile, next, leak ? 1.5f : 100, liquid);
|
||||
}
|
||||
|
||||
public float tryMoveLiquid(Tile tile, Tile next, float leakResistance, Liquid liquid){
|
||||
if(next == null) return 0;
|
||||
|
||||
next = next.link();
|
||||
next = next.block().getLiquidDestination(next, tile);
|
||||
next = next.block().getLiquidDestination(next, tile, liquid);
|
||||
|
||||
if(next.getTeam() == tile.getTeam() && next.block().hasLiquids && tile.entity.liquids.get(liquid) > 0f){
|
||||
|
||||
@ -175,15 +179,15 @@ public abstract class BlockStorage extends UnlockableContent{
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(leak && !next.block().solid && !next.block().hasLiquids){
|
||||
float leakAmount = tile.entity.liquids.get(liquid) / 1.5f;
|
||||
}else if(leakResistance != 100f && !next.block().solid && !next.block().hasLiquids){
|
||||
float leakAmount = tile.entity.liquids.get(liquid) / leakResistance;
|
||||
Puddle.deposit(next, tile, liquid, leakAmount);
|
||||
tile.entity.liquids.remove(liquid, leakAmount);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Tile getLiquidDestination(Tile tile, Tile from){
|
||||
public Tile getLiquidDestination(Tile tile, Tile from, Liquid liquid){
|
||||
return tile;
|
||||
}
|
||||
|
||||
|
@ -327,19 +327,19 @@ public class Tile implements Position, TargetTrait{
|
||||
}
|
||||
|
||||
// ▲ ▲ ▼ ▼ ◀ ▶ ◀ ▶ B A
|
||||
public Tile front(){
|
||||
public @Nullable Tile front(){
|
||||
return getNearbyLink((rotation + 4) % 4);
|
||||
}
|
||||
|
||||
public Tile right(){
|
||||
public @Nullable Tile right(){
|
||||
return getNearbyLink((rotation + 3) % 4);
|
||||
}
|
||||
|
||||
public Tile back(){
|
||||
public @Nullable Tile back(){
|
||||
return getNearbyLink((rotation + 2) % 4);
|
||||
}
|
||||
|
||||
public Tile left(){
|
||||
public @Nullable Tile left(){
|
||||
return getNearbyLink((rotation + 1) % 4);
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,12 @@ public interface Autotiler{
|
||||
return other != null && blends(tile, rotation, other.x, other.y, other.rotation(), other.block());
|
||||
}
|
||||
|
||||
default boolean blendsArmored(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){
|
||||
return (Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery)
|
||||
|| ((!otherblock.rotate && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null &&
|
||||
Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) || (otherblock.rotate && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y))));
|
||||
}
|
||||
|
||||
default boolean lookingAt(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){
|
||||
return (Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery)
|
||||
|| (!otherblock.rotate || Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y)));
|
||||
|
@ -1,6 +1,5 @@
|
||||
package io.anuke.mindustry.world.blocks.distribution;
|
||||
|
||||
import io.anuke.arc.math.geom.*;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
|
||||
@ -16,9 +15,7 @@ public class ArmoredConveyor extends Conveyor{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean blends(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){
|
||||
return otherblock.outputsItems() && (Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery)
|
||||
|| ((!otherblock.rotate && Edges.getFacingEdge(otherblock, otherx, othery, tile) != null &&
|
||||
Edges.getFacingEdge(otherblock, otherx, othery, tile).relativeTo(tile) == rotation) || (otherblock.rotate && Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y))));
|
||||
public boolean blends(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock) {
|
||||
return otherblock.outputsItems() && blendsArmored(tile, rotation, otherx, othery, otherrot, otherblock);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
package io.anuke.mindustry.world.blocks.liquid;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.graphics.g2d.Draw;
|
||||
import io.anuke.arc.graphics.g2d.TextureRegion;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Edges;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
|
||||
public class ArmoredConduit extends Conduit{
|
||||
protected TextureRegion capRegion;
|
||||
|
||||
public ArmoredConduit(String name){
|
||||
super(name);
|
||||
leakResistance = 10f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
super.load();
|
||||
capRegion = Core.atlas.find(name + "-cap");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Tile tile){
|
||||
super.draw(tile);
|
||||
|
||||
// draw the cap when a conduit would normally leak
|
||||
Tile next = tile.front();
|
||||
if(next != null && next.getTeam() == tile.getTeam() && next.block().hasLiquids) return;
|
||||
|
||||
Draw.rect(capRegion, tile.drawx(), tile.drawy(), tile.rotation() * 90);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||
return super.acceptLiquid(tile, source, liquid, amount) && (source.block() instanceof Conduit) || Edges.getFacingEdge(source, tile).relativeTo(tile) == tile.rotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean blends(Tile tile, int rotation, int otherx, int othery, int otherrot, Block otherblock){
|
||||
return otherblock.outputsLiquid && blendsArmored(tile, rotation, otherx, othery, otherrot, otherblock);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.world.blocks.distribution;
|
||||
package io.anuke.mindustry.world.blocks.liquid;
|
||||
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.collection.*;
|
||||
@ -21,6 +21,8 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
protected TextureRegion[] topRegions = new TextureRegion[7];
|
||||
protected TextureRegion[] botRegions = new TextureRegion[7];
|
||||
|
||||
protected float leakResistance = 1.5f;
|
||||
|
||||
public Conduit(String name){
|
||||
super(name);
|
||||
rotate = true;
|
||||
@ -109,7 +111,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
||||
entity.smoothLiquid = Mathf.lerpDelta(entity.smoothLiquid, entity.liquids.total() / liquidCapacity, 0.05f);
|
||||
|
||||
if(tile.entity.liquids.total() > 0.001f && tile.entity.timer.get(timerFlow, 1)){
|
||||
tryMoveLiquid(tile, tile.getNearby(tile.rotation()), true, tile.entity.liquids.current());
|
||||
tryMoveLiquid(tile, tile.getNearby(tile.rotation()), leakResistance, tile.entity.liquids.current());
|
||||
entity.noSleep();
|
||||
}else{
|
||||
entity.sleep();
|
@ -1,9 +1,10 @@
|
||||
package io.anuke.mindustry.world.blocks.distribution;
|
||||
package io.anuke.mindustry.world.blocks.liquid;
|
||||
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
import io.anuke.mindustry.world.blocks.distribution.*;
|
||||
import io.anuke.mindustry.world.meta.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.world;
|
@ -1,9 +1,10 @@
|
||||
package io.anuke.mindustry.world.blocks.distribution;
|
||||
package io.anuke.mindustry.world.blocks.liquid;
|
||||
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
import io.anuke.mindustry.world.blocks.distribution.*;
|
||||
import io.anuke.mindustry.world.meta.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.world;
|
@ -1,7 +1,8 @@
|
||||
package io.anuke.mindustry.world.blocks.distribution;
|
||||
package io.anuke.mindustry.world.blocks.liquid;
|
||||
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.graphics.g2d.*;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
import io.anuke.mindustry.world.blocks.*;
|
||||
import io.anuke.mindustry.world.meta.*;
|
||||
@ -35,10 +36,13 @@ public class LiquidJunction extends LiquidBlock{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tile getLiquidDestination(Tile tile, Tile source){
|
||||
public Tile getLiquidDestination(Tile tile, Tile source, Liquid liquid){
|
||||
int dir = source.relativeTo(tile.x, tile.y);
|
||||
dir = (dir + 4) % 4;
|
||||
Tile next = tile.getNearby(dir).link();
|
||||
return next.block().getLiquidDestination(next, tile);
|
||||
if(!next.block().acceptLiquid(next, tile, liquid, 0f) && !(next.block() instanceof LiquidJunction)){
|
||||
return tile;
|
||||
}
|
||||
return next.block().getLiquidDestination(next, tile, liquid);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.world.blocks.distribution;
|
||||
package io.anuke.mindustry.world.blocks.liquid;
|
||||
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
@ -1,4 +1,4 @@
|
||||
package io.anuke.mindustry.world.blocks.distribution;
|
||||
package io.anuke.mindustry.world.blocks.liquid;
|
||||
|
||||
public class LiquidTank extends LiquidRouter{
|
||||
|
@ -27,7 +27,7 @@ public class PowerDiode extends Block{
|
||||
public void update(Tile tile){
|
||||
super.update(tile);
|
||||
|
||||
if(!tile.back().block().hasPower || !tile.front().block().hasPower) return;
|
||||
if(tile.front() == null || tile.back() == null || !tile.back().block().hasPower || !tile.front().block().hasPower) return;
|
||||
|
||||
PowerGraph backGraph = tile.back().entity.power.graph;
|
||||
PowerGraph frontGraph = tile.front().entity.power.graph;
|
||||
|
@ -32,6 +32,13 @@ public class LiquidConverter extends GenericCrafter{
|
||||
stats.add(BlockStat.output, outputLiquid.liquid, outputLiquid.amount * craftTime, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLight(Tile tile){
|
||||
if(hasLiquids && drawLiquidLight && outputLiquid.liquid.lightColor.a > 0.001f){
|
||||
drawLiquidLight(tile, outputLiquid.liquid, tile.entity.liquids.get(outputLiquid.liquid));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Tile tile){
|
||||
GenericCrafterEntity entity = tile.entity();
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.modules;
|
||||
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
|
||||
import java.io.*;
|
||||
@ -11,6 +12,15 @@ public class LiquidModule extends BlockModule{
|
||||
private float[] liquids = new float[content.liquids().size];
|
||||
private float total;
|
||||
private Liquid current = content.liquid(0);
|
||||
private float smoothLiquid;
|
||||
|
||||
public void update(){
|
||||
smoothLiquid = Mathf.lerpDelta(smoothLiquid, currentAmount(), 0.1f);
|
||||
}
|
||||
|
||||
public float smoothAmount(){
|
||||
return smoothLiquid;
|
||||
}
|
||||
|
||||
/** Returns total amount of liquids. */
|
||||
public float total(){
|
||||
@ -54,7 +64,7 @@ public class LiquidModule extends BlockModule{
|
||||
add(liquid, -amount);
|
||||
}
|
||||
|
||||
public void forEach(LiquidConsumer cons){
|
||||
public void each(LiquidConsumer cons){
|
||||
for(int i = 0; i < liquids.length; i++){
|
||||
if(liquids[i] > 0){
|
||||
cons.accept(content.liquid(i), liquids[i]);
|
||||
|