mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-13 12:16:53 +07:00
Fixed some invalid sectors
This commit is contained in:
parent
51b03725a2
commit
e7ffb0214f
@ -319,7 +319,7 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
Tile end = tiles.getn(endX, endY);
|
||||
GridBits closed = new GridBits(width, height);
|
||||
IntFloatMap costs = new IntFloatMap();
|
||||
PriorityQueue<Tile> queue = new PriorityQueue<>(tiles.width * tiles.height /4, (a, b) -> Float.compare(costs.get(a.pos(), 0f) + dh.cost(a.x, a.y, end.x, end.y), costs.get(b.pos(), 0f) + dh.cost(b.x, b.y, end.x, end.y)));
|
||||
PriorityQueue<Tile> queue = new PriorityQueue<>(tiles.width * tiles.height / 4, Structs.comparingFloat(a -> costs.get(a.pos(), 0f) + dh.cost(a.x, a.y, end.x, end.y)));
|
||||
queue.add(start);
|
||||
boolean found = false;
|
||||
while(!queue.isEmpty()){
|
||||
@ -332,12 +332,13 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
closed.set(next.x, next.y);
|
||||
for(Point2 point : Geometry.d4){
|
||||
int newx = next.x + point.x, newy = next.y + point.y;
|
||||
if(Structs.inBounds(newx, newy, width, height) && world.getDarkness(newx, newy) == 0){
|
||||
if(Structs.inBounds(newx, newy, width, height) && world.getDarkness(newx, newy) <= 1f){
|
||||
Tile child = tiles.getn(newx, newy);
|
||||
float newCost = th.cost(child) + baseCost;
|
||||
if(!closed.get(child.x, child.y)){
|
||||
closed.set(child.x, child.y);
|
||||
child.rotation(child.relativeTo(next.x, next.y));
|
||||
costs.put(child.pos(), th.cost(child) + baseCost);
|
||||
costs.put(child.pos(), newCost);
|
||||
queue.add(child);
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class TODOPlanetGenerator extends PlanetGenerator{
|
||||
connected.add(to);
|
||||
float nscl = rand.random(20f, 60f);
|
||||
int stroke = rand.random(4, 12);
|
||||
brush(pathfind(x, y, to.x, to.y, tile -> (tile.solid() ? 5f : 0f) + noise(tile.x, tile.y, 1, 1, 1f / nscl) * 50, manhattan), stroke);
|
||||
brush(pathfind(x, y, to.x, to.y, tile -> (tile.solid() ? 5f : 0f) + noise(tile.x, tile.y, 1, 1, 1f / nscl) * 60, manhattan), stroke);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class Sector{
|
||||
|
||||
public void generate(){
|
||||
//TODO use simplex and a seed
|
||||
hostility = Noise.snoise3(tile.v.x, tile.v.y, tile.v.z, 4f, 1f);
|
||||
hostility = Math.max(Noise.snoise3(tile.v.x, tile.v.y, tile.v.z, 1f, 0.5f), 0);
|
||||
}
|
||||
|
||||
public boolean locked(){
|
||||
|
@ -216,6 +216,10 @@ public class PlanetDialog extends FloatingDialog{
|
||||
if(sec.locked()){
|
||||
draw(sec, shadowColor, -0.001f);
|
||||
}
|
||||
|
||||
if(sec.hostility >= 0f){
|
||||
//drawSelection(sec, Color.scarlet, 0.1f * sec.hostility);
|
||||
}
|
||||
}
|
||||
|
||||
if(hovered != null){
|
||||
@ -234,7 +238,6 @@ public class PlanetDialog extends FloatingDialog{
|
||||
Mesh mesh = outline(planet.grid.size);
|
||||
Shader shader = Shaders.planetGrid;
|
||||
Vec3 tile = planet.intersect(cam.getMouseRay(), outlineRad);
|
||||
//Log.info(tile);
|
||||
Shaders.planetGrid.mouse.lerp(tile == null ? Vec3.Zero : tile.sub(planet.position).rotate(Vec3.Y, planet.getRotation()), 0.2f);
|
||||
|
||||
shader.bind();
|
||||
@ -338,7 +341,10 @@ public class PlanetDialog extends FloatingDialog{
|
||||
}
|
||||
|
||||
private void drawSelection(Sector sector){
|
||||
float length = 0.1f;
|
||||
drawSelection(sector, Pal.accent, 0.04f);
|
||||
}
|
||||
|
||||
private void drawSelection(Sector sector, Color color, float length){
|
||||
float arad = outlineRad + 0.0001f;
|
||||
|
||||
for(int i = 0; i < sector.tile.corners.length; i++){
|
||||
@ -349,11 +355,11 @@ public class PlanetDialog extends FloatingDialog{
|
||||
curr.v.scl(arad);
|
||||
sector.tile.v.scl(arad);
|
||||
|
||||
Tmp.v31.set(curr.v).sub(sector.tile.v).setLength(length).add(sector.tile.v);
|
||||
Tmp.v32.set(next.v).sub(sector.tile.v).setLength(length).add(sector.tile.v);
|
||||
Tmp.v31.set(curr.v).sub(sector.tile.v).setLength(curr.v.dst(sector.tile.v) - length).add(sector.tile.v);
|
||||
Tmp.v32.set(next.v).sub(sector.tile.v).setLength(next.v.dst(sector.tile.v) - length).add(sector.tile.v);
|
||||
|
||||
batch.tri(curr.v, next.v, Tmp.v31, Pal.accent);
|
||||
batch.tri(Tmp.v31, next.v, Tmp.v32, Pal.accent);
|
||||
batch.tri(curr.v, next.v, Tmp.v31, color);
|
||||
batch.tri(Tmp.v31, next.v, Tmp.v32, color);
|
||||
|
||||
sector.tile.v.scl(1f / arad);
|
||||
next.v.scl(1f / arad);
|
||||
|
@ -1,3 +1,3 @@
|
||||
org.gradle.daemon=true
|
||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||
archash=2b1be987f1bad28c7f4456cbfa651f5139204e65
|
||||
archash=dd0f2c60c53919ce97c987e502acf94af3a9a2b4
|
||||
|
Loading…
Reference in New Issue
Block a user