Pathfinding stuck improvements
This commit is contained in:
@@ -286,23 +286,21 @@ public class ControlPathfinder{
|
||||
requests.clear();
|
||||
}
|
||||
|
||||
private static boolean raycast(PathCost cost, int x1, int y1, int x2, int y2){
|
||||
private static boolean raycast(PathCost type, int x1, int y1, int x2, int y2){
|
||||
int ww = world.width(), wh = world.height();
|
||||
int x = x1, dx = Math.abs(x2 - x), sx = x < x2 ? 1 : -1;
|
||||
int y = y1, dy = Math.abs(y2 - y), sy = y < y2 ? 1 : -1;
|
||||
int e2, err = dx - dy;
|
||||
|
||||
while(x >= 0 && y >= 0 && x < ww && y < wh){
|
||||
if(avoid(cost, x + y * wwidth)) return true;
|
||||
if(avoid(type, x + y * wwidth)) return true;
|
||||
if(x == x2 && y == y2) return false;
|
||||
|
||||
e2 = 2 * err;
|
||||
if(e2 > -dy){
|
||||
//no diagonals
|
||||
if(2 * err + dy > dx - 2 * err){
|
||||
err -= dy;
|
||||
x += sx;
|
||||
}
|
||||
|
||||
if(e2 < dx){
|
||||
}else{
|
||||
err += dx;
|
||||
y += sy;
|
||||
}
|
||||
|
||||
@@ -3603,7 +3603,7 @@ public class Blocks{
|
||||
requirements(Category.units, with(Items.graphite, 600, Items.beryllium, 600, Items.oxide, 250, Items.tungsten, 400, Items.silicon, 500));
|
||||
size = 5;
|
||||
//TODO remove ducts and crushers, replace with 2-3 high cost special blocks with silicon requirements
|
||||
plans.add(new AssemblerUnitPlan(UnitTypes.vanquish, 60f * 50f, PayloadStack.list(UnitTypes.stell, 4, Blocks.tungstenWallLarge, 12)));
|
||||
plans.add(new AssemblerUnitPlan(UnitTypes.vanquish, 60f * 50f, PayloadStack.list(UnitTypes.stell, 4, Blocks.tungstenWallLarge, 10)));
|
||||
consumePower(3f);
|
||||
areaSize = 13;
|
||||
researchCostMultiplier = 0.4f;
|
||||
|
||||
@@ -15,29 +15,19 @@ public class ItemImage extends Stack{
|
||||
o.add(new Image(region)).size(32f);
|
||||
}));
|
||||
|
||||
add(new Table(t -> {
|
||||
t.left().bottom();
|
||||
t.add(amount >= 1000 ? UI.formatAmount(amount) : amount + "").style(Styles.outlineLabel);
|
||||
t.pack();
|
||||
}));
|
||||
}
|
||||
|
||||
public ItemImage(ItemStack stack){
|
||||
|
||||
add(new Table(o -> {
|
||||
o.left();
|
||||
o.add(new Image(stack.item.uiIcon)).size(32f);
|
||||
}));
|
||||
|
||||
if(stack.amount != 0){
|
||||
if(amount != 0){
|
||||
add(new Table(t -> {
|
||||
t.left().bottom();
|
||||
t.add(stack.amount >= 1000 ? UI.formatAmount(stack.amount) : stack.amount + "").style(Styles.outlineLabel);
|
||||
t.add(amount >= 1000 ? UI.formatAmount(amount) : amount + "").style(Styles.outlineLabel);
|
||||
t.pack();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
public ItemImage(ItemStack stack){
|
||||
this(stack.item.uiIcon, stack.amount);
|
||||
}
|
||||
|
||||
public ItemImage(PayloadStack stack){
|
||||
this(stack.item.uiIcon, stack.amount);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ public class ConsumePayloads extends Consume{
|
||||
|
||||
@Override
|
||||
public void display(Stats stats){
|
||||
//TODO
|
||||
|
||||
for(var stack : payloads){
|
||||
stats.add(Stat.input, t -> {
|
||||
|
||||
Reference in New Issue
Block a user