Fixed #10915
This commit is contained in:
@@ -21,8 +21,6 @@ public class BuildPlan implements Position, QuadTreeObject{
|
|||||||
public boolean breaking;
|
public boolean breaking;
|
||||||
/** Config int. Not used unless hasConfig is true.*/
|
/** Config int. Not used unless hasConfig is true.*/
|
||||||
public Object config;
|
public Object config;
|
||||||
/** Original position, only used in schematics.*/
|
|
||||||
public int originalX, originalY, originalWidth, originalHeight;
|
|
||||||
|
|
||||||
/** Last progress.*/
|
/** Last progress.*/
|
||||||
public float progress;
|
public float progress;
|
||||||
@@ -65,6 +63,7 @@ public class BuildPlan implements Position, QuadTreeObject{
|
|||||||
public BuildPlan(){
|
public BuildPlan(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean placeable(Team team){
|
public boolean placeable(Team team){
|
||||||
return Build.validPlace(block, team, x, y, rotation);
|
return Build.validPlace(block, team, x, y, rotation);
|
||||||
}
|
}
|
||||||
@@ -111,22 +110,12 @@ public class BuildPlan implements Position, QuadTreeObject{
|
|||||||
copy.block = block;
|
copy.block = block;
|
||||||
copy.breaking = breaking;
|
copy.breaking = breaking;
|
||||||
copy.config = config;
|
copy.config = config;
|
||||||
copy.originalX = originalX;
|
|
||||||
copy.originalY = originalY;
|
|
||||||
copy.progress = progress;
|
copy.progress = progress;
|
||||||
copy.initialized = initialized;
|
copy.initialized = initialized;
|
||||||
copy.animScale = animScale;
|
copy.animScale = animScale;
|
||||||
return copy;
|
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){
|
public Rect bounds(Rect rect){
|
||||||
if(breaking){
|
if(breaking){
|
||||||
return rect.set(-100f, -100f, 0f, 0f);
|
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. */
|
/** 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){
|
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));
|
.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 -> {
|
plans.each(plan -> {
|
||||||
if(plan.breaking) return;
|
if(plan.breaking) return;
|
||||||
|
|
||||||
|
float off = plan.block.size % 2 == 0 ? -0.5f : 0f;
|
||||||
|
|
||||||
plan.pointConfig(p -> {
|
plan.pointConfig(p -> {
|
||||||
int cx = p.x, cy = p.y;
|
float cx = p.x + off, cy = p.y + off;
|
||||||
int lx = cx;
|
float lx = cx;
|
||||||
|
|
||||||
if(direction >= 0){
|
if(direction >= 0){
|
||||||
cx = -cy;
|
cx = -cy;
|
||||||
@@ -1342,7 +1344,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
cx = cy;
|
cx = cy;
|
||||||
cy = -lx;
|
cy = -lx;
|
||||||
}
|
}
|
||||||
p.set(cx, cy);
|
p.set(Mathf.floor(cx - off), Mathf.floor(cy - off));
|
||||||
});
|
});
|
||||||
|
|
||||||
//rotate actual plan, centered on its multiblock position
|
//rotate actual plan, centered on its multiblock position
|
||||||
@@ -1376,14 +1378,12 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
plan.pointConfig(p -> {
|
plan.pointConfig(p -> {
|
||||||
int corigin = x ? plan.originalWidth/2 : plan.originalHeight/2;
|
|
||||||
int nvalue = -(x ? p.x : p.y);
|
|
||||||
if(x){
|
if(x){
|
||||||
plan.originalX = -(plan.originalX - corigin) + corigin;
|
if(plan.block.size % 2 == 0) p.x --;
|
||||||
p.x = nvalue;
|
p.x = -p.x;
|
||||||
}else{
|
}else{
|
||||||
plan.originalY = -(plan.originalY - corigin) + corigin;
|
if(plan.block.size % 2 == 0) p.y --;
|
||||||
p.y = nvalue;
|
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;
|
if(otherReq == null || otherReq.block == null) continue;
|
||||||
|
|
||||||
drawLaser(plan.drawx(), plan.drawy(), otherReq.drawx(), otherReq.drawy(), size, otherReq.block.size);
|
drawLaser(plan.drawx(), plan.drawy(), otherReq.drawx(), otherReq.drawy(), size, otherReq.block.size);
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class Generators{
|
|||||||
mainExecutor.submit(() -> {
|
mainExecutor.submit(() -> {
|
||||||
try{
|
try{
|
||||||
ImageTileGenerator.generate(basePath, floor.name, new Fi("../../../assets-raw/sprites_out/blocks/environment/" + floor.name));
|
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);
|
Log.err("Failed to autotile: " + floor.name, e);
|
||||||
}finally{
|
}finally{
|
||||||
//the raw autotile source image must never be included, it isn't useful
|
//the raw autotile source image must never be included, it isn't useful
|
||||||
|
|||||||
Reference in New Issue
Block a user