diff --git a/core/src/io/anuke/mindustry/core/NetServer.java b/core/src/io/anuke/mindustry/core/NetServer.java index c0309586f5..ee4a833465 100644 --- a/core/src/io/anuke/mindustry/core/NetServer.java +++ b/core/src/io/anuke/mindustry/core/NetServer.java @@ -43,7 +43,7 @@ public class NetServer extends Module{ public final static boolean showSnapshotSize = false; private final static byte[] reusableSnapArray = new byte[maxSnapshotSize]; - private final static float serverSyncTime = 4, kickDuration = 30 * 1000; + private final static float serverSyncTime = 5, kickDuration = 30 * 1000; private final static Vector2 vector = new Vector2(); /**If a play goes away of their server-side coordinates by this distance, they get teleported back.*/ private final static float correctDist = 16f; diff --git a/core/src/io/anuke/mindustry/maps/generation/WorldGenerator.java b/core/src/io/anuke/mindustry/maps/generation/WorldGenerator.java index 4bd3ee23d6..7ed393f5c2 100644 --- a/core/src/io/anuke/mindustry/maps/generation/WorldGenerator.java +++ b/core/src/io/anuke/mindustry/maps/generation/WorldGenerator.java @@ -217,8 +217,8 @@ public class WorldGenerator{ Block floor = Blocks.stone; Block wall = Blocks.air; - double elevation = sim.octaveNoise2D(detailed ? 7 : 2, 0.5, 1f / 500, x, y) * 4.1 - 1; - double temp = vn.noise(x, y, 1f/200f)/2f + sim3.octaveNoise2D(detailed ? 12 : 6, 0.6, 1f / 620f, x, y); + double elevation = sim.octaveNoise2D(detailed ? 7 : 2, 0.5, 1f / 500, x, y) * 5.1 - 1; + double temp = vn.noise(x, y, 1f/400f)/2f + sim3.octaveNoise2D(detailed ? 12 : 6, 0.6, 1f / 620f, x, y); double r = sim2.octaveNoise2D(1, 0.6, 1f / 70, x, y); double edgeDist = Math.max(sectorSize / 2, sectorSize / 2) - Math.max(Math.abs(x - sectorSize / 2), Math.abs(y - sectorSize / 2)); @@ -257,6 +257,10 @@ public class WorldGenerator{ } } + if(((Floor)floor).liquidDrop != null){ + elevation = 0; + } + if(detailed && wall == Blocks.air && decoration.containsKey(floor) && random.chance(0.03)){ wall = decoration.get(floor); } diff --git a/core/src/io/anuke/mindustry/ui/dialogs/GenViewDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/GenViewDialog.java new file mode 100644 index 0000000000..e5f8f2d1cc --- /dev/null +++ b/core/src/io/anuke/mindustry/ui/dialogs/GenViewDialog.java @@ -0,0 +1,88 @@ +package io.anuke.mindustry.ui.dialogs; + +import com.badlogic.gdx.graphics.Pixmap; +import com.badlogic.gdx.graphics.Pixmap.Format; +import com.badlogic.gdx.graphics.Texture; +import io.anuke.mindustry.game.Team; +import io.anuke.mindustry.maps.generation.WorldGenerator.GenResult; +import io.anuke.mindustry.world.ColorMapper; +import io.anuke.ucore.graphics.Draw; +import io.anuke.ucore.scene.Element; +import io.anuke.ucore.scene.event.InputEvent; +import io.anuke.ucore.scene.event.InputListener; +import io.anuke.ucore.scene.utils.Cursors; +import io.anuke.ucore.util.GridMap; + +import static io.anuke.mindustry.Vars.sectorSize; +import static io.anuke.mindustry.Vars.world; + +public class GenViewDialog extends FloatingDialog{ + + public GenViewDialog(){ + super("generate view"); + + content().add(new GenView()).grow(); + } + + public class GenView extends Element{ + GridMap map = new GridMap<>(); + float panX, panY; + float lastX, lastY; + int viewsize = 2; + + { + addListener(new InputListener(){ + @Override + public boolean touchDown(InputEvent event, float x, float y, int pointer, int button){ + Cursors.setHand(); + lastX = x; + lastY = y; + return true; + } + + @Override + public void touchDragged(InputEvent event, float x, float y, int pointer){ + panX -= x - lastX; + panY -= y - lastY; + + lastX = x; + lastY = y; + } + + @Override + public void touchUp(InputEvent event, float x, float y, int pointer, int button){ + Cursors.restoreCursor(); + } + }); + } + + public void draw(){ + int tx = (int)(panX / sectorSize); + int ty = (int)(panY / sectorSize); + float padSectorSize = 200f; + + Draw.color(); + + for(int x = -viewsize; x <= viewsize; x++){ + for(int y = -viewsize; y <= viewsize; y++){ + int wx = tx + x, wy = ty + y; + if(map.get(wx, wy) == null){ + Pixmap pixmap = new Pixmap(sectorSize, sectorSize, Format.RGBA8888); + for(int i = 0; i < sectorSize; i++){ + for(int j = 0; j < sectorSize; j++){ + GenResult result = world.generator().generateTile(wx, wy, i, j); + pixmap.drawPixel(i, sectorSize - 1 - j, ColorMapper.colorFor(result.floor, result.wall, Team.none, result.elevation)); + } + } + map.put(wx, wy, new Texture(pixmap)); + } + + float drawX = x + width/2f+ wx * padSectorSize - tx * padSectorSize - panX % padSectorSize; + float drawY = y + height/2f + wy * padSectorSize - ty * padSectorSize - panY % padSectorSize; + + Draw.rect(map.get(wx, wy), drawX, drawY, padSectorSize, padSectorSize); + } + } + } + } +} diff --git a/core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java b/core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java index 9a2b9eb133..c9860c6fb0 100644 --- a/core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java +++ b/core/src/io/anuke/mindustry/ui/fragments/DebugFragment.java @@ -11,6 +11,7 @@ import io.anuke.mindustry.game.Team; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.ui.dialogs.FloatingDialog; +import io.anuke.mindustry.ui.dialogs.GenViewDialog; import io.anuke.ucore.core.Timers; import io.anuke.ucore.entities.EntityGroup; import io.anuke.ucore.scene.Group; @@ -123,6 +124,8 @@ public class DebugFragment extends Fragment{ t.add("Debug"); t.row(); + t.addButton("map", () -> new GenViewDialog().show()); + t.row(); t.addButton("noclip", "toggle", () -> noclip = !noclip); t.row(); t.addButton("items", () -> { diff --git a/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java b/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java index 6511f3fe08..31812f0783 100644 --- a/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java +++ b/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java @@ -17,6 +17,7 @@ import io.anuke.ucore.function.Consumer; import io.anuke.ucore.util.OS; import io.anuke.ucore.util.Strings; +import java.io.File; import java.net.NetworkInterface; import java.text.DateFormat; import java.text.NumberFormat; @@ -106,7 +107,9 @@ public class DesktopPlatform extends Platform{ @Override public boolean isDebug(){ - return args.length > 0 && args[0].equalsIgnoreCase("-debug_" + getUUID().hashCode()); + //honestly I'm just putting this ridiculous """anti-debug""" mess here to see if anyone bothers solving it without editing source + return args.length > 0 && args[0].equals("-debug_" + getUUID().hashCode() + "_" + + " " + System.getProperty("os.arch") + "nice" + (int)(Math.sin(System.getProperty("user.dir").hashCode()) * 100) + Thread.currentThread().getStackTrace()[1].toString()) && new File("../../desktop/build/").exists(); } @Override