1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-22 22:07:31 +03:00

Added underflow gates

This commit is contained in:
Anuken 2020-01-20 18:54:25 -05:00
parent a4ac318c9e
commit 26676d60e1
10 changed files with 1240 additions and 1173 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

View File

@ -944,6 +944,7 @@ block.message.name = Message
block.illuminator.name = Illuminator
block.illuminator.description = A small, compact, configurable light source. Requires power to function.
block.overflow-gate.name = Overflow Gate
block.underflow-gate.name = Underflow Gate
block.silicon-smelter.name = Silicon Smelter
block.phase-weaver.name = Phase Weaver
block.pulverizer.name = Pulverizer
@ -1174,6 +1175,7 @@ block.inverted-sorter.description = Processes items like a standard sorter, but
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 = Only outputs to the left and right if the front path is blocked.
block.underflow-gate.description = The opposite of an overflow gate. Outputs to the front if the left and right paths are blocked.
block.mass-driver.description = The ultimate item transport block. Collects several items and then shoots them to another mass driver over a long range. Requires power to operate.
block.mechanical-pump.description = A cheap pump with slow output, but no power consumption.
block.rotary-pump.description = An advanced pump. Pumps more liquid, but requires power.

View File

@ -217,3 +217,4 @@
63527=slag|liquid-slag-icon
63526=oil|liquid-oil-icon
63525=cryofluid|liquid-cryofluid-icon
63524=underflow-gate|block-underflow-gate-medium

Binary file not shown.

Before

Width:  |  Height:  |  Size: 748 B

After

Width:  |  Height:  |  Size: 758 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 722 KiB

After

Width:  |  Height:  |  Size: 723 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 KiB

After

Width:  |  Height:  |  Size: 262 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 896 KiB

After

Width:  |  Height:  |  Size: 900 KiB

View File

@ -57,7 +57,7 @@ public class Blocks implements ContentList{
scrapWall, scrapWallLarge, scrapWallHuge, scrapWallGigantic, thruster, //ok, these names are getting ridiculous, but at least I don't have humongous walls yet
//transport
conveyor, titaniumConveyor, armoredConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, invertedSorter, router, overflowGate, massDriver,
conveyor, titaniumConveyor, armoredConveyor, distributor, junction, itemBridge, phaseConveyor, sorter, invertedSorter, router, overflowGate, underflowGate, massDriver,
//liquids
mechanicalPump, rotaryPump, thermalPump, conduit, pulseConduit, platedConduit, liquidRouter, liquidTank, liquidJunction, bridgeConduit, phaseConduit,
@ -945,6 +945,12 @@ public class Blocks implements ContentList{
buildCostMultiplier = 3f;
}};
underflowGate = new OverflowGate("underflow-gate"){{
requirements(Category.distribution, ItemStack.with(Items.lead, 2, Items.copper, 4));
buildCostMultiplier = 3f;
invert = true;
}};
massDriver = new MassDriver("mass-driver"){{
requirements(Category.distribution, ItemStack.with(Items.titanium, 125, Items.silicon, 75, Items.lead, 125, Items.thorium, 50));
size = 3;

View File

@ -11,6 +11,7 @@ import java.io.*;
public class OverflowGate extends Block{
public float speed = 1f;
public boolean invert = false;
public OverflowGate(String name){
super(name);
@ -76,21 +77,22 @@ public class OverflowGate extends Block{
update(tile);
}
Tile getTileTarget(Tile tile, Item item, Tile src, boolean flip){
public Tile getTileTarget(Tile tile, Item item, Tile src, boolean flip){
int from = tile.relativeTo(src.x, src.y);
if(from == -1) return null;
Tile to = tile.getNearby((from + 2) % 4);
if(to == null) return null;
Tile edge = Edges.getFacingEdge(tile, to);
boolean canForward = to.block().acceptItem(item, to, edge) && to.getTeam() == tile.getTeam() && !(to.block() instanceof OverflowGate);
if(!to.block().acceptItem(item, to, edge) || to.getTeam() != tile.getTeam() || (to.block() instanceof OverflowGate)){
if(!canForward || invert){
Tile a = tile.getNearby(Mathf.mod(from - 1, 4));
Tile b = tile.getNearby(Mathf.mod(from + 1, 4));
boolean ac = a != null && a.block().acceptItem(item, a, edge) && !(a.block() instanceof OverflowGate) && a.getTeam() == tile.getTeam();
boolean bc = b != null && b.block().acceptItem(item, b, edge) && !(b.block() instanceof OverflowGate) && b.getTeam() == tile.getTeam();
if(!ac && !bc){
return null;
return invert && canForward ? to : null;
}
if(ac && !bc){