mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-26 14:32:06 -08:00
Block Forge improvements (#4112)
* minBlockSize, maxBlockSize, icon * removed fixed size * same line * revert to 3 * I almost forgot
This commit is contained in:
parent
92e7cec198
commit
beed2e0b8f
2 changed files with 20 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package mindustry.world.blocks.experimental;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.scene.ui.layout.*;
|
||||
|
|
@ -18,8 +19,11 @@ import mindustry.world.blocks.payloads.*;
|
|||
import mindustry.world.blocks.production.*;
|
||||
import mindustry.world.consumers.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class BlockForge extends PayloadAcceptor{
|
||||
public float buildSpeed = 0.4f;
|
||||
public int minBlockSize = 1, maxBlockSize = 2;
|
||||
|
||||
public BlockForge(String name){
|
||||
super(name);
|
||||
|
|
@ -54,7 +58,7 @@ public class BlockForge extends PayloadAcceptor{
|
|||
Draw.rect(region, req.drawx(), req.drawy());
|
||||
Draw.rect(outRegion, req.drawx(), req.drawy(), req.rotation * 90);
|
||||
}
|
||||
|
||||
|
||||
public class BlockForgeBuild extends PayloadAcceptorBuild<BuildPayload>{
|
||||
public @Nullable Block recipe;
|
||||
public float progress, time, heat;
|
||||
|
|
@ -103,7 +107,7 @@ public class BlockForge extends PayloadAcceptor{
|
|||
|
||||
@Override
|
||||
public void buildConfiguration(Table table){
|
||||
Seq<Block> blocks = Vars.content.blocks().select(b -> b.isVisible() && b.size <= 2);
|
||||
Seq<Block> blocks = Vars.content.blocks().select(b -> b.isVisible() && b.size >= minBlockSize && b.size <= maxBlockSize);
|
||||
|
||||
ItemSelection.buildTable(table, blocks, () -> recipe, this::configure);
|
||||
}
|
||||
|
|
@ -124,6 +128,19 @@ public class BlockForge extends PayloadAcceptor{
|
|||
|
||||
drawPayload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSelect(){
|
||||
if(recipe != null){
|
||||
float dx = x - size * tilesize/2f, dy = y + size * tilesize/2f;
|
||||
TextureRegion icon = recipe.icon(Cicon.medium);
|
||||
Draw.mixcol(Color.darkGray, 1f);
|
||||
//Fixes size because modded content icons are not scaled
|
||||
Draw.rect(icon, dx - 0.7f, dy - 1f, Draw.scl * Draw.xscl * 24f, Draw.scl * Draw.yscl * 24f);
|
||||
Draw.reset();
|
||||
Draw.rect(icon, dx, dy, Draw.scl * Draw.xscl * 24f, Draw.scl * Draw.yscl * 24f);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Writes write){
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class BlockLoader extends PayloadAcceptor{
|
|||
|
||||
public BlockLoader(String name){
|
||||
super(name);
|
||||
|
||||
|
||||
hasItems = true;
|
||||
itemCapacity = 25;
|
||||
//liquidCapacity = 25;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue