Cleanup + Generic cross rendering
This commit is contained in:
@@ -426,9 +426,7 @@ public class Block extends UnlockableContent{
|
||||
TextureRegion reg = getRequestRegion(req, list);
|
||||
Draw.rect(reg, req.drawx(), req.drawy(), !rotate ? 0 : req.rotation * 90);
|
||||
|
||||
if(req.config != null){
|
||||
drawRequestConfig(req, list);
|
||||
}
|
||||
drawRequestConfig(req, list);
|
||||
}
|
||||
|
||||
public TextureRegion getRequestRegion(BuildPlan req, Eachable<BuildPlan> list){
|
||||
@@ -439,8 +437,14 @@ public class Block extends UnlockableContent{
|
||||
|
||||
}
|
||||
|
||||
public void drawRequestConfigCenter(BuildPlan req, Object content, String region){
|
||||
Color color = content instanceof Item ? ((Item)content).color : content instanceof Liquid ? ((Liquid)content).color : null;
|
||||
public void drawRequestConfigCenter(BuildPlan req, Object content, String region, boolean cross){
|
||||
if(content == null){
|
||||
if(cross){
|
||||
Draw.rect("cross", req.drawx(), req.drawy());
|
||||
}
|
||||
return;
|
||||
}
|
||||
Color color = content instanceof Item i ? i.color : content instanceof Liquid l ? l.color : null;
|
||||
if(color == null) return;
|
||||
|
||||
Draw.color(color);
|
||||
@@ -448,6 +452,10 @@ public class Block extends UnlockableContent{
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public void drawRequestConfigCenter(BuildPlan req, Object content, String region){
|
||||
drawRequestConfigCenter(req, content, region, false);
|
||||
}
|
||||
|
||||
public void drawRequestConfigTop(BuildPlan req, Eachable<BuildPlan> list){
|
||||
|
||||
}
|
||||
|
||||
@@ -176,8 +176,6 @@ public class ItemBridge extends Block{
|
||||
public void playerPlaced(Object config){
|
||||
super.playerPlaced(config);
|
||||
|
||||
if(config != null) return;
|
||||
|
||||
Tile link = findLink(tile.x, tile.y);
|
||||
if(linkValid(tile, link) && !proximity.contains(link.build)){
|
||||
link.build.configure(tile.pos());
|
||||
|
||||
@@ -33,11 +33,7 @@ public class Sorter extends Block{
|
||||
|
||||
@Override
|
||||
public void drawRequestConfig(BuildPlan req, Eachable<BuildPlan> list){
|
||||
if(req.config == null){
|
||||
Draw.rect("cross", req.drawx(), req.drawy());
|
||||
}else{
|
||||
drawRequestConfigCenter(req, req.config, "center");
|
||||
}
|
||||
drawRequestConfigCenter(req, req.config, "center", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ItemSource extends Block{
|
||||
|
||||
@Override
|
||||
public void drawRequestConfig(BuildPlan req, Eachable<BuildPlan> list){
|
||||
drawRequestConfigCenter(req, req.config, "center");
|
||||
drawRequestConfigCenter(req, req.config, "center", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,7 +41,7 @@ public class LiquidSource extends Block{
|
||||
|
||||
@Override
|
||||
public void drawRequestConfig(BuildPlan req, Eachable<BuildPlan> list){
|
||||
drawRequestConfigCenter(req, req.config, "center");
|
||||
drawRequestConfigCenter(req, req.config, "center", true);
|
||||
}
|
||||
|
||||
public class LiquidSourceBuild extends Building{
|
||||
|
||||
Reference in New Issue
Block a user