Added armored conveyors

This commit is contained in:
Anuken 2019-09-22 15:12:15 -04:00
parent a2750c8aff
commit b6e97c4261
14 changed files with 1726 additions and 1513 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -801,6 +801,8 @@ block.hail.name = Hail
block.lancer.name = Lancer
block.conveyor.name = Conveyor
block.titanium-conveyor.name = Titanium Conveyor
block.armored-conveyor.name = Armored Conveyor
block.armored-conveyor.description = Moves items at the same speed as titanium conveyors, but possesses more armor. Does not accept inputs from the sides from anything but other conveyors.
block.junction.name = Junction
block.router.name = Router
block.distributor.name = Distributor

Binary file not shown.

Before

Width:  |  Height:  |  Size: 722 B

After

Width:  |  Height:  |  Size: 725 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 677 KiB

After

Width:  |  Height:  |  Size: 684 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 KiB

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 583 KiB

After

Width:  |  Height:  |  Size: 578 KiB

View File

@ -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;

View File

@ -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;

View File

@ -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)));
}
}

View File

@ -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();