mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-04 15:27:19 +07:00
Fixed #10915
This commit is contained in:
@ -21,8 +21,6 @@ public class BuildPlan implements Position, QuadTreeObject{
|
||||
public boolean breaking;
|
||||
/** Config int. Not used unless hasConfig is true.*/
|
||||
public Object config;
|
||||
/** Original position, only used in schematics.*/
|
||||
public int originalX, originalY, originalWidth, originalHeight;
|
||||
|
||||
/** Last progress.*/
|
||||
public float progress;
|
||||
@ -65,6 +63,7 @@ public class BuildPlan implements Position, QuadTreeObject{
|
||||
public BuildPlan(){
|
||||
|
||||
}
|
||||
|
||||
public boolean placeable(Team team){
|
||||
return Build.validPlace(block, team, x, y, rotation);
|
||||
}
|
||||
@ -111,22 +110,12 @@ public class BuildPlan implements Position, QuadTreeObject{
|
||||
copy.block = block;
|
||||
copy.breaking = breaking;
|
||||
copy.config = config;
|
||||
copy.originalX = originalX;
|
||||
copy.originalY = originalY;
|
||||
copy.progress = progress;
|
||||
copy.initialized = initialized;
|
||||
copy.animScale = animScale;
|
||||
return copy;
|
||||
}
|
||||
|
||||
public BuildPlan original(int x, int y, int originalWidth, int originalHeight){
|
||||
originalX = x;
|
||||
originalY = y;
|
||||
this.originalWidth = originalWidth;
|
||||
this.originalHeight = originalHeight;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Rect bounds(Rect rect){
|
||||
if(breaking){
|
||||
return rect.set(-100f, -100f, 0f, 0f);
|
||||
|
@ -275,7 +275,7 @@ public class Schematics implements Loadable{
|
||||
|
||||
/** Creates an array of build plans from a schematic's data, centered on the provided x+y coordinates. */
|
||||
public Seq<BuildPlan> toPlans(Schematic schem, int x, int y){
|
||||
return schem.tiles.map(t -> new BuildPlan(t.x + x - schem.width/2, t.y + y - schem.height/2, t.rotation, t.block, t.config).original(t.x, t.y, schem.width, schem.height))
|
||||
return schem.tiles.map(t -> new BuildPlan(t.x + x - schem.width/2, t.y + y - schem.height/2, t.rotation, t.block, t.config))
|
||||
.removeAll(s -> (!s.block.isVisible() && !(s.block instanceof CoreBlock)) || !s.block.unlockedNow()).sort(Structs.comparingInt(s -> -s.block.schematicPriority));
|
||||
}
|
||||
|
||||
|
@ -1331,9 +1331,11 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
plans.each(plan -> {
|
||||
if(plan.breaking) return;
|
||||
|
||||
float off = plan.block.size % 2 == 0 ? -0.5f : 0f;
|
||||
|
||||
plan.pointConfig(p -> {
|
||||
int cx = p.x, cy = p.y;
|
||||
int lx = cx;
|
||||
float cx = p.x + off, cy = p.y + off;
|
||||
float lx = cx;
|
||||
|
||||
if(direction >= 0){
|
||||
cx = -cy;
|
||||
@ -1342,7 +1344,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
cx = cy;
|
||||
cy = -lx;
|
||||
}
|
||||
p.set(cx, cy);
|
||||
p.set(Mathf.floor(cx - off), Mathf.floor(cy - off));
|
||||
});
|
||||
|
||||
//rotate actual plan, centered on its multiblock position
|
||||
@ -1376,14 +1378,12 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
plan.pointConfig(p -> {
|
||||
int corigin = x ? plan.originalWidth/2 : plan.originalHeight/2;
|
||||
int nvalue = -(x ? p.x : p.y);
|
||||
if(x){
|
||||
plan.originalX = -(plan.originalX - corigin) + corigin;
|
||||
p.x = nvalue;
|
||||
if(plan.block.size % 2 == 0) p.x --;
|
||||
p.x = -p.x;
|
||||
}else{
|
||||
plan.originalY = -(plan.originalY - corigin) + corigin;
|
||||
p.y = nvalue;
|
||||
if(plan.block.size % 2 == 0) p.y --;
|
||||
p.y = -p.y;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -328,6 +328,11 @@ public class PowerNode extends PowerBlock{
|
||||
}
|
||||
});
|
||||
|
||||
//uncomment for debugging connection translation issues in schematics
|
||||
//Draw.color(Color.red);
|
||||
//Lines.line(plan.drawx(), plan.drawy(), px * tilesize, py * tilesize);
|
||||
//Draw.color();
|
||||
|
||||
if(otherReq == null || otherReq.block == null) continue;
|
||||
|
||||
drawLaser(plan.drawx(), plan.drawy(), otherReq.drawx(), otherReq.drawy(), size, otherReq.block.size);
|
||||
|
@ -78,7 +78,7 @@ public class Generators{
|
||||
mainExecutor.submit(() -> {
|
||||
try{
|
||||
ImageTileGenerator.generate(basePath, floor.name, new Fi("../../../assets-raw/sprites_out/blocks/environment/" + floor.name));
|
||||
}catch(Exception e){
|
||||
}catch(Throwable e){
|
||||
Log.err("Failed to autotile: " + floor.name, e);
|
||||
}finally{
|
||||
//the raw autotile source image must never be included, it isn't useful
|
||||
|
Reference in New Issue
Block a user