Added liquid bridge conduits
|
After Width: | Height: | Size: 160 B |
|
After Width: | Height: | Size: 181 B |
|
After Width: | Height: | Size: 185 B |
|
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 168 B |
|
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 104 KiB |
@@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Wed Apr 11 21:11:23 EDT 2018
|
#Wed Apr 11 21:39:29 EDT 2018
|
||||||
version=release
|
version=release
|
||||||
androidBuildCode=908
|
androidBuildCode=913
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.5
|
code=3.5
|
||||||
build=custom build
|
build=custom build
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ public class Recipes {
|
|||||||
new Recipe(liquid, LiquidBlocks.liquidtank, stack(Items.steel, 2)),
|
new Recipe(liquid, LiquidBlocks.liquidtank, stack(Items.steel, 2)),
|
||||||
new Recipe(liquid, LiquidBlocks.liquidjunction, stack(Items.steel, 2)),
|
new Recipe(liquid, LiquidBlocks.liquidjunction, stack(Items.steel, 2)),
|
||||||
new Recipe(liquid, LiquidBlocks.bridgeconduit, stack(Items.titanium, 2), stack(Items.steel, 2)),
|
new Recipe(liquid, LiquidBlocks.bridgeconduit, stack(Items.titanium, 2), stack(Items.steel, 2)),
|
||||||
|
new Recipe(liquid, LiquidBlocks.laserconduit, stack(Items.titanium, 2), stack(Items.steel, 2)),
|
||||||
|
|
||||||
new Recipe(liquid, LiquidBlocks.pump, stack(Items.steel, 10)),
|
new Recipe(liquid, LiquidBlocks.pump, stack(Items.steel, 10)),
|
||||||
new Recipe(liquid, LiquidBlocks.fluxpump, stack(Items.steel, 10), stack(Items.densealloy, 5)),
|
new Recipe(liquid, LiquidBlocks.fluxpump, stack(Items.steel, 10), stack(Items.densealloy, 5)),
|
||||||
|
|||||||
@@ -36,8 +36,9 @@ public class LiquidBlocks {
|
|||||||
|
|
||||||
liquidjunction = new LiquidJunction("liquidjunction"),
|
liquidjunction = new LiquidJunction("liquidjunction"),
|
||||||
|
|
||||||
bridgeconduit = new LiquidBridge("bridgeconduit"){{
|
bridgeconduit = new LiquidExtendingBridge("bridgeconduit"){{
|
||||||
range = 3;
|
range = 3;
|
||||||
|
hasPower = false;
|
||||||
}},
|
}},
|
||||||
|
|
||||||
laserconduit = new LiquidBridge("laserconduit"){{
|
laserconduit = new LiquidBridge("laserconduit"){{
|
||||||
|
|||||||
@@ -4,20 +4,13 @@ import io.anuke.mindustry.entities.TileEntity;
|
|||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.mindustry.world.ItemBuffer;
|
import io.anuke.mindustry.world.ItemBuffer;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.graphics.CapStyle;
|
|
||||||
import io.anuke.ucore.graphics.Draw;
|
|
||||||
import io.anuke.ucore.graphics.Lines;
|
|
||||||
import io.anuke.ucore.util.Geometry;
|
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.tilesize;
|
public class BufferedItemBridge extends ExtendingItemBridge {
|
||||||
import static io.anuke.mindustry.Vars.world;
|
|
||||||
|
|
||||||
public class BufferedItemBridge extends ItemBridge {
|
|
||||||
protected int timerAccept = timers ++;
|
protected int timerAccept = timers ++;
|
||||||
|
|
||||||
protected float speed = 40f;
|
protected float speed = 40f;
|
||||||
@@ -46,47 +39,6 @@ public class BufferedItemBridge extends ItemBridge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawLayer(Tile tile) {
|
|
||||||
BufferedItemBridgeEntity entity = tile.entity();
|
|
||||||
|
|
||||||
Tile other = world.tile(entity.link);
|
|
||||||
if(!linkValid(tile, other)) return;
|
|
||||||
|
|
||||||
int i = tile.absoluteRelativeTo(other.x, other.y);
|
|
||||||
|
|
||||||
float ex = other.worldx() - tile.worldx(),
|
|
||||||
ey = other.worldy() - tile.worldy();
|
|
||||||
|
|
||||||
ex *= entity.uptime;
|
|
||||||
ey *= entity.uptime;
|
|
||||||
|
|
||||||
Lines.stroke(8f);
|
|
||||||
Lines.line(Draw.region(name + "-bridge"),
|
|
||||||
tile.worldx(),
|
|
||||||
tile.worldy(),
|
|
||||||
tile.worldx() + ex,
|
|
||||||
tile.worldy() + ey, CapStyle.none, -tilesize/2f);
|
|
||||||
|
|
||||||
Draw.rect(name + "-end", tile.drawx(), tile.drawy(), i*90 + 90);
|
|
||||||
Draw.rect(name + "-end", tile.worldx() + ex, tile.worldy() + ey, i*90 + 270);
|
|
||||||
|
|
||||||
int dist = Math.max(Math.abs(other.x - tile.x), Math.abs(other.y - tile.y));
|
|
||||||
|
|
||||||
int arrows = (dist)*tilesize/6-1;
|
|
||||||
|
|
||||||
Draw.color();
|
|
||||||
|
|
||||||
for(int a = 0; a < arrows; a ++){
|
|
||||||
Draw.alpha(Mathf.absin(a/(float)arrows - entity.time/100f, 0.1f, 1f) * entity.uptime);
|
|
||||||
Draw.rect(name + "-arrow",
|
|
||||||
tile.worldx() + Geometry.d4[i].x*(tilesize/2f + a*6f + 2) * entity.uptime,
|
|
||||||
tile.worldy() + Geometry.d4[i].y*(tilesize/2f + a*6f + 2) * entity.uptime,
|
|
||||||
i*90f);
|
|
||||||
}
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity getEntity() {
|
public TileEntity getEntity() {
|
||||||
return new BufferedItemBridgeEntity();
|
return new BufferedItemBridgeEntity();
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package io.anuke.mindustry.world.blocks.types.distribution;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.ucore.graphics.CapStyle;
|
||||||
|
import io.anuke.ucore.graphics.Draw;
|
||||||
|
import io.anuke.ucore.graphics.Lines;
|
||||||
|
import io.anuke.ucore.util.Geometry;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.tilesize;
|
||||||
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
|
public class ExtendingItemBridge extends ItemBridge {
|
||||||
|
|
||||||
|
public ExtendingItemBridge(String name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawLayer(Tile tile) {
|
||||||
|
ItemBridgeEntity entity = tile.entity();
|
||||||
|
|
||||||
|
Tile other = world.tile(entity.link);
|
||||||
|
if(!linkValid(tile, other)) return;
|
||||||
|
|
||||||
|
int i = tile.absoluteRelativeTo(other.x, other.y);
|
||||||
|
|
||||||
|
float ex = other.worldx() - tile.worldx() - Geometry.d4[i].x*tilesize/2f,
|
||||||
|
ey = other.worldy() - tile.worldy() - Geometry.d4[i].y*tilesize/2f;
|
||||||
|
|
||||||
|
ex *= entity.uptime;
|
||||||
|
ey *= entity.uptime;
|
||||||
|
|
||||||
|
Lines.stroke(8f);
|
||||||
|
Lines.line(Draw.region(name + "-bridge"),
|
||||||
|
tile.worldx() + Geometry.d4[i].x*tilesize/2f,
|
||||||
|
tile.worldy() + Geometry.d4[i].y*tilesize/2f,
|
||||||
|
tile.worldx() + ex,
|
||||||
|
tile.worldy() + ey, CapStyle.none, 0f);
|
||||||
|
|
||||||
|
Draw.rect(name + "-end", tile.drawx(), tile.drawy(), i*90 + 90);
|
||||||
|
Draw.rect(name + "-end",
|
||||||
|
tile.worldx() + ex + Geometry.d4[i].x*tilesize/2f,
|
||||||
|
tile.worldy() + ey + Geometry.d4[i].y*tilesize/2f, i*90 + 270);
|
||||||
|
|
||||||
|
int dist = Math.max(Math.abs(other.x - tile.x), Math.abs(other.y - tile.y));
|
||||||
|
|
||||||
|
int arrows = (dist)*tilesize/6-1;
|
||||||
|
|
||||||
|
Draw.color();
|
||||||
|
|
||||||
|
for(int a = 0; a < arrows; a ++){
|
||||||
|
Draw.alpha(Mathf.absin(a/(float)arrows - entity.time/100f, 0.1f, 1f) * entity.uptime);
|
||||||
|
Draw.rect(name + "-arrow",
|
||||||
|
tile.worldx() + Geometry.d4[i].x*(tilesize/2f + a*6f + 2) * entity.uptime,
|
||||||
|
tile.worldy() + Geometry.d4[i].y*(tilesize/2f + a*6f + 2) * entity.uptime,
|
||||||
|
i*90f);
|
||||||
|
}
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,6 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
import static io.anuke.mindustry.Vars.world;
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
public class LiquidBridge extends ItemBridge {
|
public class LiquidBridge extends ItemBridge {
|
||||||
protected float transportSpeed = 0.5f;
|
|
||||||
|
|
||||||
public LiquidBridge(String name) {
|
public LiquidBridge(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package io.anuke.mindustry.world.blocks.types.distribution;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.resource.Item;
|
||||||
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
import io.anuke.ucore.core.Timers;
|
||||||
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
|
public class LiquidExtendingBridge extends ExtendingItemBridge {
|
||||||
|
|
||||||
|
public LiquidExtendingBridge(String name) {
|
||||||
|
super(name);
|
||||||
|
hasInventory = false;
|
||||||
|
hasLiquids = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(Tile tile) {
|
||||||
|
ItemBridgeEntity entity = tile.entity();
|
||||||
|
|
||||||
|
entity.time += entity.cycleSpeed* Timers.delta();
|
||||||
|
entity.time2 += (entity.cycleSpeed-1f)*Timers.delta();
|
||||||
|
|
||||||
|
Tile other = world.tile(entity.link);
|
||||||
|
if(!linkValid(tile, other)){
|
||||||
|
tryDumpLiquid(tile);
|
||||||
|
}else{
|
||||||
|
float use = Math.min(powerCapacity, powerUse * Timers.delta());
|
||||||
|
|
||||||
|
if(!hasPower || entity.power.amount >= use){
|
||||||
|
entity.uptime = Mathf.lerpDelta(entity.uptime, 1f, 0.04f);
|
||||||
|
if(hasPower) entity.power.amount -= use;
|
||||||
|
}else{
|
||||||
|
entity.uptime = Mathf.lerpDelta(entity.uptime, 0f, 0.02f);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(entity.uptime >= 0.5f){
|
||||||
|
|
||||||
|
if(tryMoveLiquid(tile, other) > 0.1f){
|
||||||
|
entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 4f, 0.05f);
|
||||||
|
}else{
|
||||||
|
entity.cycleSpeed = Mathf.lerpDelta(entity.cycleSpeed, 1f, 0.01f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean acceptItem(Item item, Tile tile, Tile source) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||