Added armored conveyors
This commit is contained in:
@@ -58,7 +58,7 @@ public class Blocks implements ContentList{
|
||||
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mender, mendProjector, overdriveProjector, forceProjector, shockMine,
|
||||
|
||||
//transport
|
||||
conveyor, titaniumConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, router, overflowGate, massDriver,
|
||||
conveyor, titaniumConveyor, armoredConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, router, overflowGate, massDriver,
|
||||
|
||||
//liquids
|
||||
mechanicalPump, rotaryPump, thermalPump, conduit, pulseConduit, liquidRouter, liquidTank, liquidJunction, bridgeConduit, phaseConduit,
|
||||
@@ -906,6 +906,12 @@ public class Blocks implements ContentList{
|
||||
speed = 0.08f;
|
||||
}};
|
||||
|
||||
armoredConveyor = new ArmoredConveyor("armored-conveyor"){{
|
||||
requirements(Category.distribution, ItemStack.with(Items.metaglass, 1, Items.thorium, 1));
|
||||
health = 180;
|
||||
speed = 0.08f;
|
||||
}};
|
||||
|
||||
junction = new Junction("junction"){{
|
||||
requirements(Category.distribution, ItemStack.with(Items.copper, 1), true);
|
||||
speed = 26;
|
||||
|
||||
@@ -50,6 +50,10 @@ public class Tile implements Position, TargetTrait{
|
||||
return Pos.get(x, y);
|
||||
}
|
||||
|
||||
public byte relativeTo(Tile tile){
|
||||
return relativeTo(tile.x, tile.y);
|
||||
}
|
||||
|
||||
/** Return relative rotation to a coordinate. Returns -1 if the coordinate is not near this tile. */
|
||||
public byte relativeTo(int cx, int cy){
|
||||
if(x == cx && y == cy - 1) return 1;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package io.anuke.mindustry.world.blocks.distribution;
|
||||
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.mindustry.type.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
|
||||
public class ArmoredConveyor extends Conveyor{
|
||||
|
||||
public ArmoredConveyor(String name){
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||
return super.acceptItem(item, tile, source) && (source.block() instanceof Conveyor || Edges.getFacingEdge(source, tile).relativeTo(tile) == tile.rotation());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean blends(Tile tile, int direction){
|
||||
Tile other = tile.getNearby(Mathf.mod(tile.rotation() - direction, 4));
|
||||
if(other != null) other = other.link();
|
||||
|
||||
return other != null && other.block().outputsItems()
|
||||
&& ((tile.getNearby(tile.rotation()) == other) || ((!other.block().rotate && Edges.getFacingEdge(other, tile).relativeTo(tile) == tile.rotation()) || (other.block().rotate && other.getNearby(other.rotation()) == tile)));
|
||||
}
|
||||
}
|
||||
@@ -127,12 +127,12 @@ public class Conveyor extends Block{
|
||||
draw.region = regions[blendbits][0];
|
||||
}
|
||||
|
||||
private boolean blends(int rotation, int offset, int prevX, int prevY, int prevRotation){
|
||||
protected boolean blends(int rotation, int offset, int prevX, int prevY, int prevRotation){
|
||||
Point2 left = Geometry.d4(rotation - offset);
|
||||
return left.equals(prevX, prevY) && prevRotation == Mathf.mod(rotation + offset, 4);
|
||||
}
|
||||
|
||||
private boolean blends(Tile tile, int direction){
|
||||
protected boolean blends(Tile tile, int direction){
|
||||
Tile other = tile.getNearby(Mathf.mod(tile.rotation() - direction, 4));
|
||||
if(other != null) other = other.link();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user