Horizontal shifting of pistons (also adds proper icons for pistons) (#8345)
* Horizontal offset for pistons * might as well fix icons in the meantime * Make a positive offset shift to the right
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 784 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 464 B |
@@ -9,14 +9,14 @@ import mindustry.gen.*;
|
|||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
|
||||||
public class DrawPistons extends DrawBlock{
|
public class DrawPistons extends DrawBlock{
|
||||||
public float sinMag = 4f, sinScl = 6f, sinOffset = 50f, sideOffset = 0f, lenOffset = -1f, angleOffset = 0f;
|
public float sinMag = 4f, sinScl = 6f, sinOffset = 50f, sideOffset = 0f, lenOffset = -1f, horiOffset = 0f, angleOffset = 0f;
|
||||||
public int sides = 4;
|
public int sides = 4;
|
||||||
public String suffix = "-piston";
|
public String suffix = "-piston";
|
||||||
public TextureRegion region1, region2, regiont;
|
public TextureRegion region1, region2, regiont, iconRegion;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
|
public void drawPlan(Block block, BuildPlan plan, Eachable<BuildPlan> list){
|
||||||
|
Draw.rect(iconRegion, plan.drawx(), plan.drawy());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -32,7 +32,8 @@ public class DrawPistons extends DrawBlock{
|
|||||||
Draw.yscl = -1f;
|
Draw.yscl = -1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.rect(reg, build.x + Angles.trnsx(angle, len), build.y + Angles.trnsy(angle, len), angle);
|
Tmp.v1.trns(angle, len, -horiOffset);
|
||||||
|
Draw.rect(reg, build.x + Tmp.v1.x, build.y + Tmp.v1.y, angle);
|
||||||
|
|
||||||
Draw.yscl = 1f;
|
Draw.yscl = 1f;
|
||||||
}
|
}
|
||||||
@@ -45,5 +46,11 @@ public class DrawPistons extends DrawBlock{
|
|||||||
region1 = Core.atlas.find(block.name + suffix + "0", block.name + suffix);
|
region1 = Core.atlas.find(block.name + suffix + "0", block.name + suffix);
|
||||||
region2 = Core.atlas.find(block.name + suffix + "1", block.name + suffix);
|
region2 = Core.atlas.find(block.name + suffix + "1", block.name + suffix);
|
||||||
regiont = Core.atlas.find(block.name + suffix + "-t");
|
regiont = Core.atlas.find(block.name + suffix + "-t");
|
||||||
|
iconRegion = Core.atlas.find(block.name + suffix + "-icon");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureRegion[] icons(Block block){
|
||||||
|
return new TextureRegion[]{iconRegion};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user