Fixed #2040 / Fixed #2039 / Fixed #2038 / Fixed #2037 / Fixed #2035

This commit is contained in:
Anuken
2020-05-12 09:34:26 -04:00
parent 7f3f1d7d76
commit f6d8658ee2
16 changed files with 111 additions and 113 deletions

View File

@ -34,14 +34,14 @@ mend-projector-top
index: -1
mender
rotate: false
xy: 1071, 467
xy: 969, 331
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
mender-top
rotate: false
xy: 969, 331
xy: 1003, 365
size: 32, 32
orig: 32, 32
offset: 0, 0
@ -384,42 +384,42 @@ conveyor-4-3
index: -1
plastanium-conveyor
rotate: false
xy: 1003, 297
xy: 1037, 331
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plastanium-conveyor-0
rotate: false
xy: 1037, 331
xy: 1071, 365
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plastanium-conveyor-1
rotate: false
xy: 1071, 365
xy: 1105, 399
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plastanium-conveyor-2
rotate: false
xy: 1105, 399
xy: 1139, 433
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plastanium-conveyor-edge
rotate: false
xy: 1139, 433
xy: 1173, 467
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plastanium-conveyor-stack
rotate: false
xy: 1173, 467
xy: 969, 229
size: 32, 32
orig: 32, 32
offset: 0, 0
@ -615,35 +615,35 @@ mass-driver-base
index: -1
overflow-gate
rotate: false
xy: 1037, 399
xy: 1071, 433
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
phase-conveyor
rotate: false
xy: 1037, 365
xy: 1071, 399
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
phase-conveyor-arrow
rotate: false
xy: 1071, 399
xy: 1105, 433
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
phase-conveyor-bridge
rotate: false
xy: 1105, 433
xy: 1139, 467
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
phase-conveyor-end
rotate: false
xy: 1139, 467
xy: 969, 263
size: 32, 32
orig: 32, 32
offset: 0, 0
@ -867,7 +867,7 @@ conduit-liquid
index: -1
message
rotate: false
xy: 1003, 365
xy: 1037, 399
size: 32, 32
orig: 32, 32
offset: 0, 0
@ -1096,135 +1096,149 @@ mechanical-pump
orig: 32, 32
offset: 0, 0
index: -1
phase-conduit
mechanical-pump-liquid
rotate: false
xy: 1071, 433
xy: 1037, 433
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
phase-conduit-arrow
rotary-pump-liquid
rotate: false
xy: 1037, 433
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
thermal-pump-liquid
rotate: false
xy: 1037, 433
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
phase-conduit
rotate: false
xy: 1105, 467
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
phase-conduit-bridge
phase-conduit-arrow
rotate: false
xy: 969, 297
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
phase-conduit-end
phase-conduit-bridge
rotate: false
xy: 1003, 331
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plated-conduit-cap
phase-conduit-end
rotate: false
xy: 1003, 263
xy: 1037, 365
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plated-conduit-top-0
plated-conduit-cap
rotate: false
xy: 1037, 297
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plated-conduit-top-1
plated-conduit-top-0
rotate: false
xy: 1071, 331
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plated-conduit-top-2
plated-conduit-top-1
rotate: false
xy: 1105, 365
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plated-conduit-top-3
plated-conduit-top-2
rotate: false
xy: 1139, 399
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plated-conduit-top-4
plated-conduit-top-3
rotate: false
xy: 1173, 433
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plated-conduit-top-5
plated-conduit-top-4
rotate: false
xy: 1207, 467
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
plated-conduit-top-6
plated-conduit-top-5
rotate: false
xy: 969, 195
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
pulse-conduit-top-0
plated-conduit-top-6
rotate: false
xy: 1105, 331
xy: 1003, 229
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
pulse-conduit-top-1
pulse-conduit-top-0
rotate: false
xy: 1139, 365
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
pulse-conduit-top-2
pulse-conduit-top-1
rotate: false
xy: 1173, 399
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
pulse-conduit-top-4
pulse-conduit-top-2
rotate: false
xy: 1207, 433
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
pulse-conduit-top-5
pulse-conduit-top-4
rotate: false
xy: 1241, 467
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
pulse-conduit-top-6
pulse-conduit-top-5
rotate: false
xy: 1003, 195
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
pump-liquid
pulse-conduit-top-6
rotate: false
xy: 1105, 297
xy: 1037, 229
size: 32, 32
orig: 32, 32
offset: 0, 0
@ -1441,7 +1455,7 @@ impact-reactor-plasma-3
index: -1
power-node
rotate: false
xy: 1003, 229
xy: 1037, 263
size: 32, 32
orig: 32, 32
offset: 0, 0
@ -1455,14 +1469,14 @@ power-node-large
index: -1
power-source
rotate: false
xy: 1037, 263
xy: 1071, 297
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
power-void
rotate: false
xy: 1071, 297
xy: 1105, 331
size: 32, 32
orig: 32, 32
offset: 0, 0
@ -1693,7 +1707,7 @@ liquid-void
index: -1
melter
rotate: false
xy: 1037, 433
xy: 1071, 467
size: 32, 32
orig: 32, 32
offset: 0, 0
@ -1742,14 +1756,14 @@ plastanium-compressor-top
index: -1
pulverizer
rotate: false
xy: 1037, 229
xy: 1071, 263
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1
pulverizer-rotator
rotate: false
xy: 1071, 263
xy: 1105, 297
size: 32, 32
orig: 32, 32
offset: 0, 0
@ -2330,7 +2344,7 @@ door-open
index: -1
phase-wall
rotate: false
xy: 969, 263
xy: 1003, 297
size: 32, 32
orig: 32, 32
offset: 0, 0
@ -2344,7 +2358,7 @@ phase-wall-large
index: -1
plastanium-wall
rotate: false
xy: 969, 229
xy: 1003, 263
size: 32, 32
orig: 32, 32
offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 KiB

After

Width:  |  Height:  |  Size: 716 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 127 KiB

View File

@ -184,39 +184,8 @@ abstract class TileComp implements Posc, Teamc, Healthc, Tilec, Timerc, QuadTree
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){
int x = tile.x, y = tile.y;
if(x == cx && y == cy - 1) return 1;
if(x == cx && y == cy + 1) return 3;
if(x == cx - 1 && y == cy) return 0;
if(x == cx + 1 && y == cy) return 2;
return -1;
}
public byte absoluteRelativeTo(int cx, int cy){
int x = tile.x, y = tile.y;
//very straightforward for odd sizes
if(block.size % 2 == 1){
if(Math.abs(x - cx) > Math.abs(y - cy)){
if(x <= cx - 1) return 0;
if(x >= cx + 1) return 2;
}else{
if(y <= cy - 1) return 1;
if(y >= cy + 1) return 3;
}
}else{ //need offsets here
if(Math.abs(x - cx + 0.5f) > Math.abs(y - cy + 0.5f)){
if(x+0.5f <= cx - 1) return 0;
if(x+0.5f >= cx + 1) return 2;
}else{
if(y+0.5f <= cy - 1) return 1;
if(y+0.5f >= cy + 1) return 3;
}
}
return -1;
return tile.absoluteRelativeTo(cx, cy);
}
public @Nullable Tilec front(){

View File

@ -153,8 +153,8 @@ public class DesktopInput extends InputHandler{
if(block.saveConfig && block.lastConfig != null){
brequest.set(cursorX, cursorY, rotation, block);
brequest.config = block.lastConfig;
block.drawRequestConfig(brequest, allRequests());
brequest.config = null;
}
}

View File

@ -508,7 +508,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
protected void drawRequest(BuildRequest request){
request.block.drawRequest(request, allRequests(), validPlace(request.x, request.y, request.block, request.rotation));
if(request.block.saveConfig && request.block.lastConfig != null){
if(request.block.saveConfig && request.block.lastConfig != null && !request.hasConfig){
Object conf = request.config;
request.config = request.block.lastConfig;
request.block.drawRequestConfig(request, allRequests());

View File

@ -11,6 +11,7 @@ import arc.scene.actions.*;
import arc.scene.event.*;
import arc.scene.ui.*;
import arc.scene.ui.layout.*;
import arc.scene.ui.layout.Stack;
import arc.struct.*;
import arc.util.*;
import mindustry.annotations.Annotations.*;
@ -22,6 +23,8 @@ import mindustry.net.*;
import mindustry.type.*;
import mindustry.ui.*;
import java.util.*;
import static mindustry.Vars.*;
public class BlockInventoryFragment extends Fragment{
@ -94,6 +97,9 @@ public class BlockInventoryFragment extends Fragment{
private void rebuild(boolean actions){
IntSet container = new IntSet();
Arrays.fill(shrinkHoldTimes, 0);
holdTime = emptyTime = 0f;
table.clearChildren();
table.clearActions();
table.background(Tex.inventory);

View File

@ -80,18 +80,26 @@ public class Tile implements Position, QuadTreeObject{
}
public byte absoluteRelativeTo(int cx, int cy){
if(x == cx && y <= cy - 1) return 1;
if(x == cx && y >= cy + 1) return 3;
if(x <= cx - 1 && y == cy) return 0;
if(x >= cx + 1 && y == cy) return 2;
return -1;
}
public static byte absoluteRelativeTo(int x, int y, int cx, int cy){
if(x == cx && y <= cy - 1) return 1;
if(x == cx && y >= cy + 1) return 3;
if(x <= cx - 1 && y == cy) return 0;
if(x >= cx + 1 && y == cy) return 2;
//very straightforward for odd sizes
if(block.size % 2 == 1){
if(Math.abs(x - cx) > Math.abs(y - cy)){
if(x <= cx - 1) return 0;
if(x >= cx + 1) return 2;
}else{
if(y <= cy - 1) return 1;
if(y >= cy + 1) return 3;
}
}else{ //need offsets here
if(Math.abs(x - cx + 0.5f) > Math.abs(y - cy + 0.5f)){
if(x+0.5f <= cx - 1) return 0;
if(x+0.5f >= cx + 1) return 2;
}else{
if(y+0.5f <= cy - 1) return 1;
if(y+0.5f >= cy + 1) return 3;
}
}
return -1;
}

View File

@ -237,7 +237,7 @@ public class ItemBridge extends Block{
float opacity = Core.settings.getInt("bridgeopacity") / 100f;
if(Mathf.zero(opacity)) return;
int i = tile.absoluteRelativeTo(other.x, other.y);
int i = relativeTo(other.x, other.y);
Draw.color(Color.white, Color.black, Mathf.absin(Time.time(), 6f, 0.07f));
Draw.alpha(Math.max(uptime, 0.25f) * opacity);
@ -275,8 +275,8 @@ public class ItemBridge extends Block{
Tile other = world.tile(link);
if(linkValid(tile, other)){
int rel = tile.absoluteRelativeTo(other.x, other.y);
int rel2 = tile.relativeTo(source.tileX(), source.tileY());
int rel = relativeTo(other.x, other.y);
int rel2 = relativeTo(source.tileX(), source.tileY());
if(rel == rel2) return false;
}else{
@ -292,21 +292,21 @@ public class ItemBridge extends Block{
Tile other = world.tile(link);
if(!linkValid(tile, other)){
Tile edge = Edges.getFacingEdge(to.tile(), tile);
int i = tile.absoluteRelativeTo(edge.x, edge.y);
int i = relativeTo(edge.x, edge.y);
IntSetIterator it = incoming.iterator();
while(it.hasNext){
int v = it.next();
if(tile.absoluteRelativeTo(Point2.x(v), Point2.y(v)) == i){
if(relativeTo(Point2.x(v), Point2.y(v)) == i){
return false;
}
}
return true;
}
int rel = tile.absoluteRelativeTo(other.x, other.y);
int rel2 = tile.relativeTo(to.tileX(), to.tileY());
int rel = relativeTo(other.x, other.y);
int rel2 = relativeTo(to.tileX(), to.tileY());
return rel != rel2;
}
@ -318,8 +318,8 @@ public class ItemBridge extends Block{
Tile other = world.tile(link);
if(linkValid(tile, other)){
int rel = tile.absoluteRelativeTo(other.x, other.y);
int rel2 = tile.relativeTo(source.tileX(), source.tileY());
int rel = relativeTo(other.x, other.y);
int rel2 = relativeTo(source.tileX(), source.tileY());
if(rel == rel2) return false;
}else if(!(source.block() instanceof ItemBridge && ((ItemBridgeEntity)source).link == tile.pos())){
@ -334,21 +334,21 @@ public class ItemBridge extends Block{
Tile other = world.tile(link);
if(!linkValid(tile, other)){
Tile edge = Edges.getFacingEdge(to.tile(), tile);
int i = tile.absoluteRelativeTo(edge.x, edge.y);
int i = relativeTo(edge.x, edge.y);
IntSetIterator it = incoming.iterator();
while(it.hasNext){
int v = it.next();
if(tile.absoluteRelativeTo(Point2.x(v), Point2.y(v)) == i){
if(relativeTo(Point2.x(v), Point2.y(v)) == i){
return false;
}
}
return true;
}
int rel = tile.absoluteRelativeTo(other.x, other.y);
int rel2 = tile.relativeTo(to.tileX(), to.tileY());
int rel = relativeTo(other.x, other.y);
int rel2 = relativeTo(to.tileX(), to.tileY());
return rel != rel2;
}

View File

@ -63,13 +63,13 @@ public class Junction extends Block{
@Override
public void handleItem(Tilec source, Item item){
int relative = source.relativeTo(tile.x, tile.y);
int relative = source.relativeTo(tile);
buffer.accept(relative, item);
}
@Override
public boolean acceptItem(Tilec source, Item item){
int relative = source.relativeTo(tile.x, tile.y);
int relative = source.relativeTo(tile);
if(relative == -1 || !buffer.accepts(relative)) return false;
Tilec to = nearby(relative);

View File

@ -92,7 +92,7 @@ public class Sorter extends Block{
}
Tilec getTileTarget(Item item, Tilec source, boolean flip){
int dir = source.absoluteRelativeTo(tile.x, tile.y);
int dir = source.relativeTo(tile.x, tile.y);
if(dir == -1) return null;
Tilec to;

View File

@ -106,7 +106,7 @@ public class Conduit extends LiquidBlock implements Autotiler{
public boolean acceptLiquid(Tilec source, Liquid liquid, float amount){
noSleep();
return liquids.get(liquid) + amount < liquidCapacity && (liquids.current() == liquid || liquids.currentAmount() < 0.2f)
&& ((source.absoluteRelativeTo(tile.x, tile.y) + 2) % 4 != tile.rotation());
&& ((source.relativeTo(tile.x, tile.y) + 2) % 4 != tile.rotation());
}
@Override

View File

@ -37,7 +37,7 @@ public class LiquidJunction extends LiquidBlock{
@Override
public Tilec getLiquidDestination(Tilec source, Liquid liquid){
int dir = source.absoluteRelativeTo(tile.x, tile.y);
int dir = source.relativeTo(tile.x, tile.y);
dir = (dir + 4) % 4;
Tilec next = nearby(dir);
if(next == null || (!next.acceptLiquid(this, liquid, 0f) && !(next.block() instanceof LiquidJunction))){

View File

@ -3,7 +3,6 @@ package mindustry.world.blocks.production;
import arc.*;
import arc.graphics.*;
import arc.graphics.g2d.*;
import mindustry.annotations.Annotations.*;
import mindustry.type.*;
import mindustry.ui.*;
import mindustry.world.*;
@ -13,7 +12,6 @@ import mindustry.world.meta.*;
import static mindustry.Vars.*;
public class Pump extends LiquidBlock{
public @Load("pump-liquid") TextureRegion liquidRegion;
public final int timerContentCheck = timers++;
/** Pump amount, total. */

View File

@ -5,6 +5,7 @@ import arc.graphics.g2d.*;
import arc.math.*;
import arc.util.ArcAnnotate.*;
import arc.util.*;
import mindustry.annotations.Annotations.*;
import mindustry.content.*;
import mindustry.entities.*;
import mindustry.graphics.*;
@ -24,6 +25,8 @@ public class SolidPump extends Pump{
/** Attribute that is checked when calculating output. */
public @Nullable Attribute attribute;
public @Load("@-rotator") TextureRegion rotatorRegion;
public SolidPump(String name){
super(name);
hasPower = true;
@ -94,8 +97,8 @@ public class SolidPump extends Pump{
Draw.alpha(liquids.total() / liquidCapacity);
Draw.rect(liquidRegion, x, y);
Draw.color();
Draw.rect(name + "-rotator", x, y, pumpTime * rotateSpeed);
Draw.rect(name + "-top", x, y);
Draw.rect(rotatorRegion, x, y, pumpTime * rotateSpeed);
Draw.rect(topRegion, x, y);
}
@Override

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=cb632c0f88ced85999a3b78e6b79e3056e1d15e1
archash=67e3b0ca53bfe86fd5d195cbc9ffd392f8e13e98