Map objective curve & unnecessary rebuild fix
This commit is contained in:
@@ -255,7 +255,12 @@ public class MapObjectivesCanvas extends WidgetGroup{
|
|||||||
float dist = Math.abs(x1 - x2) / 2f;
|
float dist = Math.abs(x1 - x2) / 2f;
|
||||||
float cx1 = x1 + dist;
|
float cx1 = x1 + dist;
|
||||||
float cx2 = x2 - dist;
|
float cx2 = x2 - dist;
|
||||||
Lines.curve(x1, y1, cx1, y1, cx2, y2, x2, y2, Math.max(4, (int) (Mathf.dst(x1, y1, x2, y2) / 4f)));
|
|
||||||
|
if(Mathf.equal(y1, y2, 0.1f)){
|
||||||
|
Lines.line(x1, y1, x2, y2);
|
||||||
|
}else{
|
||||||
|
Lines.curve(x1, y1, cx1, y1, cx2, y2, x2, y2, Math.max(4, (int) (Mathf.dst(x1, y1, x2, y2) / 4f)));
|
||||||
|
}
|
||||||
|
|
||||||
float progress = (Time.time % (60 * 4)) / (60 * 4);
|
float progress = (Time.time % (60 * 4)) / (60 * 4);
|
||||||
|
|
||||||
@@ -292,7 +297,11 @@ public class MapObjectivesCanvas extends WidgetGroup{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean createTile(int x, int y, MapObjective obj){
|
public boolean createTile(int x, int y, MapObjective obj){
|
||||||
if(!validPlace(x, y, null)) return false;
|
return createTile(x, y, obj, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean createTile(int x, int y, MapObjective obj, boolean force){
|
||||||
|
if(!force && !validPlace(x, y, null)) return false;
|
||||||
|
|
||||||
ObjectiveTile tile = new ObjectiveTile(obj, x, y);
|
ObjectiveTile tile = new ObjectiveTile(obj, x, y);
|
||||||
tile.pack();
|
tile.pack();
|
||||||
|
|||||||
@@ -545,10 +545,7 @@ public class MapObjectivesDialog extends BaseDialog{
|
|||||||
if(
|
if(
|
||||||
objectives.any() && (
|
objectives.any() && (
|
||||||
// If the objectives were previously programmatically made...
|
// If the objectives were previously programmatically made...
|
||||||
objectives.contains(obj -> obj.editorX == -1 || obj.editorY == -1) ||
|
objectives.contains(obj -> obj.editorX == -999 || obj.editorY == -999))){
|
||||||
// ... or some idiot somehow made it not work...
|
|
||||||
objectives.contains(obj -> !canvas.tilemap.createTile(obj))
|
|
||||||
)){
|
|
||||||
// ... then rebuild the structure.
|
// ... then rebuild the structure.
|
||||||
canvas.clearObjectives();
|
canvas.clearObjectives();
|
||||||
|
|
||||||
@@ -573,6 +570,8 @@ public class MapObjectivesDialog extends BaseDialog{
|
|||||||
if(i >= objectives.size) break loop;
|
if(i >= objectives.size) break loop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
objectives.each(o -> canvas.tilemap.createTile(o.editorX, o.editorY, o, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas.objectives.set(objectives);
|
canvas.objectives.set(objectives);
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
|||||||
private transient final Seq<MapObjective> children = new Seq<>(2);
|
private transient final Seq<MapObjective> children = new Seq<>(2);
|
||||||
|
|
||||||
/** For the objectives UI dialog. Do not modify directly! */
|
/** For the objectives UI dialog. Do not modify directly! */
|
||||||
public transient int editorX = -1, editorY = -1;
|
public transient int editorX = -999, editorY = -999;
|
||||||
|
|
||||||
/** Whether this objective has been done yet. This is internally set. */
|
/** Whether this objective has been done yet. This is internally set. */
|
||||||
private boolean completed;
|
private boolean completed;
|
||||||
|
|||||||
Reference in New Issue
Block a user