Added inverted sorter

This commit is contained in:
Anuken 2019-10-13 12:58:58 -04:00
parent 92dacf18cd
commit 3d624f7eaf
11 changed files with 10356 additions and 10304 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -845,6 +845,7 @@ block.junction.name = Junction
block.router.name = Router
block.distributor.name = Distributor
block.sorter.name = Sorter
block.inverted-sorter.name = Inverted Sorter
block.message.name = Message
block.overflow-gate.name = Overflow Gate
block.silicon-smelter.name = Silicon Smelter
@ -1066,6 +1067,7 @@ block.junction.description = Acts as a bridge for two crossing conveyor belts. U
block.bridge-conveyor.description = Advanced item transport block. Allows transporting items over up to 3 tiles of any terrain or building.
block.phase-conveyor.description = Advanced item transport block. Uses power to teleport items to a connected phase conveyor over several tiles.
block.sorter.description = Sorts items. If an item matches the selection, it is allowed to pass. Otherwise, the item is outputted to the left and right.
block.inverted-sorter.descriptions = Processes items like a standard sorter, but outputs selected items to the sides instead.
block.router.description = Accepts items, then outputs them to up to 3 other directions equally. Useful for splitting the materials from one source to multiple targets.\n\n[scarlet]Never use next to production inputs, as they will get clogged by output.[]
block.distributor.description = An advanced router. Splits items to up to 7 other directions equally.
block.overflow-gate.description = A combination splitter and router. Only outputs to the left and right if the front path is blocked.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

After

Width:  |  Height:  |  Size: 727 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 KiB

After

Width:  |  Height:  |  Size: 712 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 KiB

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

After

Width:  |  Height:  |  Size: 893 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 KiB

After

Width:  |  Height:  |  Size: 134 KiB

View File

@ -58,7 +58,7 @@ public class Blocks implements ContentList{
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mender, mendProjector, overdriveProjector, forceProjector, shockMine,
//transport
conveyor, titaniumConveyor, armoredConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, router, overflowGate, massDriver,
conveyor, titaniumConveyor, armoredConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, invertedSorter, router, overflowGate, massDriver,
//liquids
mechanicalPump, rotaryPump, thermalPump, conduit, pulseConduit, liquidRouter, liquidTank, liquidJunction, bridgeConduit, phaseConduit,
@ -935,7 +935,11 @@ public class Blocks implements ContentList{
sorter = new Sorter("sorter"){{
requirements(Category.distribution, ItemStack.with(Items.lead, 2, Items.copper, 2));
}};
invertedSorter = new Sorter("inverted-sorter"){{
requirements(Category.distribution, ItemStack.with(Items.lead, 2, Items.copper, 2));
invert = true;
}};
router = new Router("router"){{

View File

@ -31,6 +31,7 @@ public class TechTree implements ContentList{
node(distributor);
node(sorter, () -> {
node(invertedSorter);
node(message);
node(overflowGate);
});

View File

@ -17,6 +17,7 @@ import static io.anuke.mindustry.Vars.content;
public class Sorter extends Block{
private static Item lastItem;
protected boolean invert;
public Sorter(String name){
super(name);
@ -40,16 +41,6 @@ public class Sorter extends Block{
}
}
/*
@Remote(targets = Loc.both, called = Loc.both, forward = true)
public static void setSorterItem(Player player, Tile tile, Item item){
if(!Units.canInteract(player, tile)) return;
SorterEntity entity = tile.entity();
if(entity != null){
entity.sortItem = item;
}
}*/
@Override
public void configured(Tile tile, Player player, int value){
tile.<SorterEntity>entity().sortItem = content.item(value);
@ -92,7 +83,7 @@ public class Sorter extends Block{
if(dir == -1) return null;
Tile to;
if(item == entity.sortItem){
if((item == entity.sortItem) != invert){
//prevent 3-chains
if(isSame(dest, source) && isSame(dest, dest.getNearby(dir))){
return null;
@ -115,12 +106,10 @@ public class Sorter extends Block{
}else{
if(dest.rotation() == 0){
to = a;
if(flip)
dest.rotation((byte)1);
if(flip) dest.rotation((byte)1);
}else{
to = b;
if(flip)
dest.rotation((byte)0);
if(flip) dest.rotation((byte)0);
}
}
}