Bridge code cleanup
This commit is contained in:
@@ -964,15 +964,20 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
itemBridge = new BufferedItemBridge("bridge-conveyor"){{
|
itemBridge = new BufferedItemBridge("bridge-conveyor"){{
|
||||||
requirements(Category.distribution, with(Items.lead, 6, Items.copper, 6));
|
requirements(Category.distribution, with(Items.lead, 6, Items.copper, 6));
|
||||||
|
fadeIn = moveArrows = false;
|
||||||
range = 4;
|
range = 4;
|
||||||
speed = 74f;
|
speed = 74f;
|
||||||
|
arrowSpacing = 6f;
|
||||||
bufferCapacity = 14;
|
bufferCapacity = 14;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
phaseConveyor = new ItemBridge("phase-conveyor"){{
|
phaseConveyor = new ItemBridge("phase-conveyor"){{
|
||||||
requirements(Category.distribution, with(Items.phaseFabric, 5, Items.silicon, 7, Items.lead, 10, Items.graphite, 10));
|
requirements(Category.distribution, with(Items.phaseFabric, 5, Items.silicon, 7, Items.lead, 10, Items.graphite, 10));
|
||||||
range = 12;
|
range = 12;
|
||||||
|
arrowPeriod = 0.9f;
|
||||||
|
arrowTimeScl = 2.75f;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
|
pulse = true;
|
||||||
consumes.power(0.30f);
|
consumes.power(0.30f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@@ -1095,8 +1100,10 @@ public class Blocks implements ContentList{
|
|||||||
requirements(Category.liquid, with(Items.graphite, 2, Items.metaglass, 2));
|
requirements(Category.liquid, with(Items.graphite, 2, Items.metaglass, 2));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
bridgeConduit = new LiquidExtendingBridge("bridge-conduit"){{
|
bridgeConduit = new LiquidBridge("bridge-conduit"){{
|
||||||
requirements(Category.liquid, with(Items.graphite, 4, Items.metaglass, 8));
|
requirements(Category.liquid, with(Items.graphite, 4, Items.metaglass, 8));
|
||||||
|
fadeIn = moveArrows = false;
|
||||||
|
arrowSpacing = 6f;
|
||||||
range = 4;
|
range = 4;
|
||||||
hasPower = false;
|
hasPower = false;
|
||||||
}};
|
}};
|
||||||
@@ -1104,8 +1111,11 @@ public class Blocks implements ContentList{
|
|||||||
phaseConduit = new LiquidBridge("phase-conduit"){{
|
phaseConduit = new LiquidBridge("phase-conduit"){{
|
||||||
requirements(Category.liquid, with(Items.phaseFabric, 5, Items.silicon, 7, Items.metaglass, 20, Items.titanium, 10));
|
requirements(Category.liquid, with(Items.phaseFabric, 5, Items.silicon, 7, Items.metaglass, 20, Items.titanium, 10));
|
||||||
range = 12;
|
range = 12;
|
||||||
|
arrowPeriod = 0.9f;
|
||||||
|
arrowTimeScl = 2.75f;
|
||||||
hasPower = true;
|
hasPower = true;
|
||||||
canOverdrive = false;
|
canOverdrive = false;
|
||||||
|
pulse = true;
|
||||||
consumes.power(0.30f);
|
consumes.power(0.30f);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -626,7 +626,7 @@ public class Mods implements Loadable{
|
|||||||
try{
|
try{
|
||||||
//this binds the content but does not load it entirely
|
//this binds the content but does not load it entirely
|
||||||
Content loaded = parser.parse(l.mod, l.file.nameWithoutExtension(), l.file.readString("UTF-8"), l.file, l.type);
|
Content loaded = parser.parse(l.mod, l.file.nameWithoutExtension(), l.file.readString("UTF-8"), l.file, l.type);
|
||||||
Log.debug("[@] Loaded '@'.", l.mod.meta.name, (loaded instanceof UnlockableContent ? ((UnlockableContent)loaded).localizedName : loaded));
|
Log.debug("[@] Loaded '@'.", l.mod.meta.name, (loaded instanceof UnlockableContent u ? u.localizedName : loaded));
|
||||||
}catch(Throwable e){
|
}catch(Throwable e){
|
||||||
if(current != content.getLastAdded() && content.getLastAdded() != null){
|
if(current != content.getLastAdded() && content.getLastAdded() != null){
|
||||||
parser.markError(content.getLastAdded(), l.mod, l.file, e);
|
parser.markError(content.getLastAdded(), l.mod, l.file, e);
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
package mindustry.world.blocks.distribution;
|
package mindustry.world.blocks.distribution;
|
||||||
|
|
||||||
import arc.math.*;
|
|
||||||
import arc.util.io.*;
|
import arc.util.io.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
|
||||||
public class BufferedItemBridge extends ExtendingItemBridge{
|
public class BufferedItemBridge extends ItemBridge{
|
||||||
public final int timerAccept = timers++;
|
public final int timerAccept = timers++;
|
||||||
|
|
||||||
public float speed = 40f;
|
public float speed = 40f;
|
||||||
@@ -19,7 +18,7 @@ public class BufferedItemBridge extends ExtendingItemBridge{
|
|||||||
canOverdrive = true;
|
canOverdrive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BufferedItemBridgeBuild extends ExtendingItemBridgeBuild{
|
public class BufferedItemBridgeBuild extends ItemBridgeBuild{
|
||||||
ItemBuffer buffer = new ItemBuffer(bufferCapacity);
|
ItemBuffer buffer = new ItemBuffer(bufferCapacity);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -30,11 +29,9 @@ public class BufferedItemBridge extends ExtendingItemBridge{
|
|||||||
|
|
||||||
Item item = buffer.poll(speed / timeScale);
|
Item item = buffer.poll(speed / timeScale);
|
||||||
if(timer(timerAccept, 4 / timeScale) && item != null && other.acceptItem(this, item)){
|
if(timer(timerAccept, 4 / timeScale) && item != null && other.acceptItem(this, item)){
|
||||||
cycleSpeed = Mathf.lerpDelta(cycleSpeed, 4f, 0.05f);
|
moved = true;
|
||||||
other.handleItem(this, item);
|
other.handleItem(this, item);
|
||||||
buffer.remove();
|
buffer.remove();
|
||||||
}else{
|
|
||||||
cycleSpeed = Mathf.lerpDelta(cycleSpeed, 0f, 0.008f);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,70 +1,15 @@
|
|||||||
package mindustry.world.blocks.distribution;
|
package mindustry.world.blocks.distribution;
|
||||||
|
|
||||||
import arc.graphics.g2d.*;
|
/** @deprecated use ItemBridge instead. */
|
||||||
import arc.math.*;
|
@Deprecated
|
||||||
import arc.math.geom.*;
|
|
||||||
import mindustry.core.*;
|
|
||||||
import mindustry.graphics.*;
|
|
||||||
import mindustry.world.*;
|
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
|
||||||
|
|
||||||
public class ExtendingItemBridge extends ItemBridge{
|
public class ExtendingItemBridge extends ItemBridge{
|
||||||
|
|
||||||
public ExtendingItemBridge(String name){
|
public ExtendingItemBridge(String name){
|
||||||
super(name);
|
super(name);
|
||||||
hasItems = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class ExtendingItemBridgeBuild extends ItemBridgeBuild{
|
public class ExtendingItemBridgeBuild extends ItemBridgeBuild{
|
||||||
@Override
|
|
||||||
public void draw(){
|
|
||||||
Draw.rect(region, x, y);
|
|
||||||
|
|
||||||
Draw.z(Layer.power);
|
|
||||||
|
|
||||||
Tile other = world.tile(link);
|
|
||||||
if(!linkValid(tile, other)) return;
|
|
||||||
|
|
||||||
int i = tile.absoluteRelativeTo(other.x, other.y);
|
|
||||||
|
|
||||||
float ex = other.worldx() - x - Geometry.d4(i).x * tilesize / 2f,
|
|
||||||
ey = other.worldy() - y - Geometry.d4(i).y * tilesize / 2f;
|
|
||||||
|
|
||||||
float uptime = state.isEditor() ? 1f : this.uptime;
|
|
||||||
|
|
||||||
ex *= uptime;
|
|
||||||
ey *= uptime;
|
|
||||||
|
|
||||||
if(Mathf.zero(Renderer.bridgeOpacity)) return;
|
|
||||||
Draw.alpha(Renderer.bridgeOpacity);
|
|
||||||
|
|
||||||
Lines.stroke(8f);
|
|
||||||
Lines.line(bridgeRegion,
|
|
||||||
x + Geometry.d4(i).x * tilesize / 2f,
|
|
||||||
y + Geometry.d4(i).y * tilesize / 2f,
|
|
||||||
x + ex,
|
|
||||||
y + ey, false);
|
|
||||||
|
|
||||||
Draw.rect(endRegion, x, y, i * 90 + 90);
|
|
||||||
Draw.rect(endRegion,
|
|
||||||
x + ex + Geometry.d4(i).x * tilesize / 2f,
|
|
||||||
y + 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 - time / 100f, 0.1f, 1f) * uptime * Renderer.bridgeOpacity);
|
|
||||||
Draw.rect(arrowRegion,
|
|
||||||
x + Geometry.d4(i).x * (tilesize / 2f + a * 6f + 2) * uptime,
|
|
||||||
y + Geometry.d4(i).y * (tilesize / 2f + a * 6f + 2) * uptime,
|
|
||||||
i * 90f);
|
|
||||||
}
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,20 @@ import static mindustry.Vars.*;
|
|||||||
public class ItemBridge extends Block{
|
public class ItemBridge extends Block{
|
||||||
private static BuildPlan otherReq;
|
private static BuildPlan otherReq;
|
||||||
|
|
||||||
|
public final int timerCheckMoved = timers ++;
|
||||||
|
|
||||||
public int range;
|
public int range;
|
||||||
public float transportTime = 2f;
|
public float transportTime = 2f;
|
||||||
public @Load("@-end") TextureRegion endRegion;
|
public @Load("@-end") TextureRegion endRegion;
|
||||||
public @Load("@-bridge") TextureRegion bridgeRegion;
|
public @Load("@-bridge") TextureRegion bridgeRegion;
|
||||||
public @Load("@-arrow") TextureRegion arrowRegion;
|
public @Load("@-arrow") TextureRegion arrowRegion;
|
||||||
|
|
||||||
|
public boolean fadeIn = true;
|
||||||
|
public boolean moveArrows = true;
|
||||||
|
public boolean pulse = false;
|
||||||
|
public float arrowSpacing = 4f, arrowOffset = 2f, arrowPeriod = 0.4f;
|
||||||
|
public float arrowTimeScl = 6.2f;
|
||||||
|
|
||||||
//for autolink
|
//for autolink
|
||||||
public @Nullable ItemBridgeBuild lastBuild;
|
public @Nullable ItemBridgeBuild lastBuild;
|
||||||
|
|
||||||
@@ -171,10 +179,9 @@ public class ItemBridge extends Block{
|
|||||||
public int link = -1;
|
public int link = -1;
|
||||||
//TODO awful
|
//TODO awful
|
||||||
public IntSet incoming = new IntSet();
|
public IntSet incoming = new IntSet();
|
||||||
public float uptime;
|
public float warmup;
|
||||||
public float time;
|
public float time;
|
||||||
public float time2;
|
public boolean wasMoved, moved;
|
||||||
public float cycleSpeed = 1f;
|
|
||||||
public float transportCounter;
|
public float transportCounter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -283,24 +290,23 @@ public class ItemBridge extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTile(){
|
public void updateTile(){
|
||||||
time += cycleSpeed * delta();
|
if(timer(timerCheckMoved, 30f)){
|
||||||
time2 += (cycleSpeed - 1f) * delta();
|
wasMoved = moved;
|
||||||
|
moved = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
time += wasMoved ? delta() : 0f;
|
||||||
|
|
||||||
checkIncoming();
|
checkIncoming();
|
||||||
|
|
||||||
Tile other = world.tile(link);
|
Tile other = world.tile(link);
|
||||||
if(!linkValid(tile, other)){
|
if(!linkValid(tile, other)){
|
||||||
doDump();
|
doDump();
|
||||||
uptime = 0f;
|
warmup = 0f;
|
||||||
}else{
|
}else{
|
||||||
((ItemBridgeBuild)other.build).incoming.add(tile.pos());
|
((ItemBridgeBuild)other.build).incoming.add(tile.pos());
|
||||||
|
|
||||||
if(consValid() && Mathf.zero(1f - efficiency())){
|
warmup = Mathf.approachDelta(warmup, efficiency(), 1f / 30f);
|
||||||
uptime = Mathf.lerpDelta(uptime, 1f, 0.04f);
|
|
||||||
}else{
|
|
||||||
uptime = Mathf.lerpDelta(uptime, 0f, 0.02f);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateTransport(other.build);
|
updateTransport(other.build);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,21 +317,18 @@ public class ItemBridge extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateTransport(Building other){
|
public void updateTransport(Building other){
|
||||||
boolean any = false;
|
|
||||||
transportCounter += edelta();
|
transportCounter += edelta();
|
||||||
while(transportCounter >= transportTime){
|
while(transportCounter >= transportTime){
|
||||||
Item item = items.take();
|
Item item = items.take();
|
||||||
if(item != null && other.acceptItem(this, item)){
|
if(item != null && other.acceptItem(this, item)){
|
||||||
other.handleItem(this, item);
|
other.handleItem(this, item);
|
||||||
any = true;
|
moved = true;
|
||||||
}else if(item != null){
|
}else if(item != null){
|
||||||
items.add(item, 1);
|
items.add(item, 1);
|
||||||
items.undoFlow(item);
|
items.undoFlow(item);
|
||||||
}
|
}
|
||||||
transportCounter -= transportTime;
|
transportCounter -= transportTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
cycleSpeed = Mathf.lerpDelta(cycleSpeed, any ? 4f : 1f, any ? 0.05f : 0.01f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -341,8 +344,11 @@ public class ItemBridge extends Block{
|
|||||||
|
|
||||||
int i = relativeTo(other.x, other.y);
|
int i = relativeTo(other.x, other.y);
|
||||||
|
|
||||||
Draw.color(Color.white, Color.black, Mathf.absin(Time.time, 6f, 0.07f));
|
if(pulse){
|
||||||
Draw.alpha(Math.max(uptime, 0.25f) * Renderer.bridgeOpacity);
|
Draw.color(Color.white, Color.black, Mathf.absin(Time.time, 6f, 0.07f));
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw.alpha((fadeIn ? Math.max(warmup, 0.25f) : 1f) * Renderer.bridgeOpacity);
|
||||||
|
|
||||||
Draw.rect(endRegion, x, y, i * 90 + 90);
|
Draw.rect(endRegion, x, y, i * 90 + 90);
|
||||||
Draw.rect(endRegion, other.drawx(), other.drawy(), i * 90 + 270);
|
Draw.rect(endRegion, other.drawx(), other.drawy(), i * 90 + 270);
|
||||||
@@ -357,19 +363,20 @@ public class ItemBridge extends Block{
|
|||||||
other.worldx() - Tmp.v1.x,
|
other.worldx() - Tmp.v1.x,
|
||||||
other.worldy() - Tmp.v1.y, false);
|
other.worldy() - Tmp.v1.y, false);
|
||||||
|
|
||||||
int dist = Math.max(Math.abs(other.x - tile.x), Math.abs(other.y - tile.y));
|
int dist = Math.max(Math.abs(other.x - tile.x), Math.abs(other.y - tile.y)) - 1;
|
||||||
|
|
||||||
float time = time2 / 1.7f;
|
|
||||||
int arrows = (dist) * tilesize / 4 - 2;
|
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|
||||||
|
int arrows = (int)(dist * tilesize / arrowSpacing), dx = Geometry.d4x(i), dy = Geometry.d4y(i);
|
||||||
|
|
||||||
for(int a = 0; a < arrows; a++){
|
for(int a = 0; a < arrows; a++){
|
||||||
Draw.alpha(Mathf.absin(a / (float)arrows - time / 100f, 0.1f, 1f) * uptime * Renderer.bridgeOpacity);
|
Draw.alpha(Mathf.absin(a - time / arrowTimeScl, arrowPeriod, 1f) * warmup * Renderer.bridgeOpacity);
|
||||||
Draw.rect(arrowRegion,
|
Draw.rect(arrowRegion,
|
||||||
x + Geometry.d4(i).x * (tilesize / 2f + a * 4f + time % 4f),
|
x + dx * (tilesize / 2f + a * arrowSpacing + arrowOffset),
|
||||||
y + Geometry.d4(i).y * (tilesize / 2f + a * 4f + time % 4f), i * 90f);
|
y + dy * (tilesize / 2f + a * arrowSpacing + arrowOffset),
|
||||||
|
i * 90f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,11 +467,16 @@ public class ItemBridge extends Block{
|
|||||||
return Point2.unpack(link).sub(tile.x, tile.y);
|
return Point2.unpack(link).sub(tile.x, tile.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte version(){
|
||||||
|
return 1; //TODO write cycleSpeed, 1
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(Writes write){
|
public void write(Writes write){
|
||||||
super.write(write);
|
super.write(write);
|
||||||
write.i(link);
|
write.i(link);
|
||||||
write.f(uptime);
|
write.f(warmup);
|
||||||
write.b(incoming.size);
|
write.b(incoming.size);
|
||||||
|
|
||||||
IntSetIterator it = incoming.iterator();
|
IntSetIterator it = incoming.iterator();
|
||||||
@@ -472,17 +484,23 @@ public class ItemBridge extends Block{
|
|||||||
while(it.hasNext){
|
while(it.hasNext){
|
||||||
write.i(it.next());
|
write.i(it.next());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
write.bool(wasMoved || moved);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void read(Reads read, byte revision){
|
public void read(Reads read, byte revision){
|
||||||
super.read(read, revision);
|
super.read(read, revision);
|
||||||
link = read.i();
|
link = read.i();
|
||||||
uptime = read.f();
|
warmup = read.f();
|
||||||
byte links = read.b();
|
byte links = read.b();
|
||||||
for(int i = 0; i < links; i++){
|
for(int i = 0; i < links; i++){
|
||||||
incoming.add(read.i());
|
incoming.add(read.i());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(revision >= 1){
|
||||||
|
wasMoved = moved = read.bool();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package mindustry.world.blocks.liquid;
|
package mindustry.world.blocks.liquid;
|
||||||
|
|
||||||
import arc.math.*;
|
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.blocks.distribution.*;
|
import mindustry.world.blocks.distribution.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
|
||||||
|
|
||||||
public class LiquidBridge extends ItemBridge{
|
public class LiquidBridge extends ItemBridge{
|
||||||
|
|
||||||
public LiquidBridge(String name){
|
public LiquidBridge(String name){
|
||||||
@@ -20,40 +17,19 @@ public class LiquidBridge extends ItemBridge{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class LiquidBridgeBuild extends ItemBridgeBuild{
|
public class LiquidBridgeBuild extends ItemBridgeBuild{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTile(){
|
public void updateTransport(Building other){
|
||||||
time += cycleSpeed * delta();
|
if(warmup >= 0.5f){
|
||||||
time2 += (cycleSpeed - 1f) * delta();
|
moved |= moveLiquid(other, liquids.current()) > 0.05f;
|
||||||
|
|
||||||
checkIncoming();
|
|
||||||
|
|
||||||
Building other = world.build(link);
|
|
||||||
if(other == null || !linkValid(tile, other.tile())){
|
|
||||||
dumpLiquid(liquids.current(), 1f);
|
|
||||||
}else{
|
|
||||||
((ItemBridgeBuild)other).incoming.add(tile.pos());
|
|
||||||
|
|
||||||
if(consValid()){
|
|
||||||
float alpha = 0.04f;
|
|
||||||
if(hasPower){
|
|
||||||
alpha *= efficiency(); // Exceed boot time unless power is at max.
|
|
||||||
}
|
|
||||||
uptime = Mathf.lerpDelta(uptime, 1f, alpha);
|
|
||||||
}else{
|
|
||||||
uptime = Mathf.lerpDelta(uptime, 0f, 0.02f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(uptime >= 0.5f){
|
|
||||||
|
|
||||||
if(moveLiquid(other, liquids.current()) > 0.1f){
|
|
||||||
cycleSpeed = Mathf.lerpDelta(cycleSpeed, 4f, 0.05f);
|
|
||||||
}else{
|
|
||||||
cycleSpeed = Mathf.lerpDelta(cycleSpeed, 1f, 0.01f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doDump(){
|
||||||
|
dumpLiquid(liquids.current(), 1f);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptItem(Building source, Item item){
|
public boolean acceptItem(Building source, Item item){
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,56 +1,14 @@
|
|||||||
package mindustry.world.blocks.liquid;
|
package mindustry.world.blocks.liquid;
|
||||||
|
|
||||||
import arc.math.*;
|
/** @deprecated use LiquidBridge instead. */
|
||||||
import mindustry.gen.*;
|
@Deprecated
|
||||||
import mindustry.type.*;
|
public class LiquidExtendingBridge extends LiquidBridge{
|
||||||
import mindustry.world.blocks.distribution.*;
|
|
||||||
import mindustry.world.meta.*;
|
|
||||||
|
|
||||||
import static mindustry.Vars.*;
|
|
||||||
|
|
||||||
public class LiquidExtendingBridge extends ExtendingItemBridge{
|
|
||||||
|
|
||||||
public LiquidExtendingBridge(String name){
|
public LiquidExtendingBridge(String name){
|
||||||
super(name);
|
super(name);
|
||||||
hasItems = false;
|
|
||||||
hasLiquids = true;
|
|
||||||
outputsLiquid = true;
|
|
||||||
group = BlockGroup.liquids;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LiquidExtendingBridgeBuild extends ExtendingItemBridgeBuild{
|
@Deprecated
|
||||||
@Override
|
public class LiquidExtendingBridgeBuild extends LiquidBridgeBuild{
|
||||||
public void updateTile(){
|
|
||||||
time += cycleSpeed * delta();
|
|
||||||
time2 += (cycleSpeed - 1f) * delta();
|
|
||||||
|
|
||||||
checkIncoming();
|
|
||||||
|
|
||||||
Building other = world.build(link);
|
|
||||||
if(other == null || !linkValid(tile, other.tile())){
|
|
||||||
dumpLiquid(liquids.current(), 1f);
|
|
||||||
}else{
|
|
||||||
((ItemBridgeBuild)other).incoming.add(tile.pos());
|
|
||||||
|
|
||||||
if(consValid()){
|
|
||||||
uptime = Mathf.lerpDelta(uptime, 1f, 0.04f);
|
|
||||||
}else{
|
|
||||||
uptime = Mathf.lerpDelta(uptime, 0f, 0.02f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(uptime >= 0.5f){
|
|
||||||
if(moveLiquid(other, liquids.current()) > 0.1f){
|
|
||||||
cycleSpeed = Mathf.lerpDelta(cycleSpeed, 4f, 0.05f);
|
|
||||||
}else{
|
|
||||||
cycleSpeed = Mathf.lerpDelta(cycleSpeed, 0f, 0.01f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean acceptItem(Building source, Item item){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user