Payload fixes
After Width: | Height: | Size: 926 B |
Before Width: | Height: | Size: 707 B After Width: | Height: | Size: 707 B |
Before Width: | Height: | Size: 728 KiB After Width: | Height: | Size: 737 KiB |
Before Width: | Height: | Size: 129 KiB After Width: | Height: | Size: 128 KiB |
Before Width: | Height: | Size: 221 KiB After Width: | Height: | Size: 221 KiB |
Before Width: | Height: | Size: 817 KiB After Width: | Height: | Size: 819 KiB |
@ -4,17 +4,31 @@ import arc.*;
|
|||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
|
import arc.math.geom.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
|
import mindustry.world.*;
|
||||||
|
|
||||||
import static mindustry.Vars.renderer;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class Drawf{
|
public class Drawf{
|
||||||
|
|
||||||
|
public static void selected(int x, int y, Block block, Color color){
|
||||||
|
Draw.color(color);
|
||||||
|
for(int i = 0; i < 4; i++){
|
||||||
|
Point2 p = Geometry.d8edge[i];
|
||||||
|
float offset = -Math.max(block.size - 1, 0) / 2f * tilesize;
|
||||||
|
Draw.rect("block-select",
|
||||||
|
x*tilesize + block.offset() + offset * p.x,
|
||||||
|
y*tilesize + block.offset() + offset * p.y, i * 90);
|
||||||
|
}
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
|
||||||
public static void shadow(float x, float y, float rad){
|
public static void shadow(float x, float y, float rad){
|
||||||
Draw.color(0, 0, 0, 0.4f);
|
Draw.color(0, 0, 0, 0.4f);
|
||||||
Draw.rect("circle-shadow", x, y, rad, rad);
|
Draw.rect("circle-shadow", x, y, rad, rad);
|
||||||
|
@ -229,15 +229,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawSelected(int x, int y, Block block, Color color){
|
public void drawSelected(int x, int y, Block block, Color color){
|
||||||
Draw.color(color);
|
Drawf.selected(x, y, block, color);
|
||||||
for(int i = 0; i < 4; i++){
|
|
||||||
Point2 p = Geometry.d8edge[i];
|
|
||||||
float offset = -Math.max(block.size - 1, 0) / 2f * tilesize;
|
|
||||||
Draw.rect("block-select",
|
|
||||||
x*tilesize + block.offset() + offset * p.x,
|
|
||||||
y*tilesize + block.offset() + offset * p.y, i * 90);
|
|
||||||
}
|
|
||||||
Draw.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawBreaking(BuildRequest request){
|
public void drawBreaking(BuildRequest request){
|
||||||
|
@ -40,6 +40,23 @@ public class MassConveyor extends Block{
|
|||||||
edgeRegion = Core.atlas.find(name + "-edge");
|
edgeRegion = Core.atlas.find(name + "-edge");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TextureRegion[] generateIcons(){
|
||||||
|
return new TextureRegion[]{Core.atlas.find(name + "-icon")};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawPlace(int x, int y, int rotation, boolean valid){
|
||||||
|
super.drawPlace(x, y, rotation, valid);
|
||||||
|
|
||||||
|
for(int i = 0; i < 4; i++){
|
||||||
|
Tilec other = world.ent(x + Geometry.d4x[i] * size, y + Geometry.d4y[i] * size);
|
||||||
|
if(other != null && other.block().outputsPayload && other.block().size == size){
|
||||||
|
Drawf.selected(other.tileX(), other.tileY(), other.block(), Pal.accent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class MassConveyorEntity extends TileEntity{
|
public class MassConveyorEntity extends TileEntity{
|
||||||
public @Nullable Payload item;
|
public @Nullable Payload item;
|
||||||
public float progress, itemRotation, animation;
|
public float progress, itemRotation, animation;
|
||||||
@ -53,7 +70,7 @@ public class MassConveyor extends Block{
|
|||||||
|
|
||||||
Tilec accept = nearby(Geometry.d4[rotation()].x * size, Geometry.d4[rotation()].y * size);
|
Tilec accept = nearby(Geometry.d4[rotation()].x * size, Geometry.d4[rotation()].y * size);
|
||||||
//next block must be aligned and of the same size
|
//next block must be aligned and of the same size
|
||||||
if(accept.block().size == size &&
|
if(accept != null && accept.block().size == size &&
|
||||||
tileX() + Geometry.d4[rotation()].x * size == accept.tileX() && tileY() + Geometry.d4[rotation()].y * size == accept.tileY()){
|
tileX() + Geometry.d4[rotation()].x * size == accept.tileX() && tileY() + Geometry.d4[rotation()].y * size == accept.tileY()){
|
||||||
next = accept;
|
next = accept;
|
||||||
}
|
}
|
||||||
@ -191,7 +208,7 @@ public class MassConveyor extends Block{
|
|||||||
return !blocked || next != null;
|
return !blocked || next != null;
|
||||||
}else{
|
}else{
|
||||||
Tilec accept = nearby(Geometry.d4[direction].x * size, Geometry.d4[direction].y * size);
|
Tilec accept = nearby(Geometry.d4[direction].x * size, Geometry.d4[direction].y * size);
|
||||||
return accept.block().size == size && accept.block().outputsPayload &&
|
return accept != null && accept.block().size == size && accept.block().outputsPayload &&
|
||||||
//block must either be facing this one, or not be rotating
|
//block must either be facing this one, or not be rotating
|
||||||
((accept.tileX() + Geometry.d4[accept.rotation()].x * size == tileX() && accept.tileY() + Geometry.d4[accept.rotation()].y * size == tileY()) || !accept.block().rotate);
|
((accept.tileX() + Geometry.d4[accept.rotation()].x * size == tileX() && accept.tileY() + Geometry.d4[accept.rotation()].y * size == tileY()) || !accept.block().rotate);
|
||||||
}
|
}
|
||||||
|