diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index d1b21c1851..96c1aa9a89 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -203,6 +203,12 @@ waves.waves = wave(s) waves.perspawn = per spawn waves.to = to waves.boss = Boss +waves.preview = Preview +waves.edit = Edit... +waves.copy = Copy to Clipboard +waves.load = Load from Clipboard +waves.invalid = Invalid waves in clipboard. +waves.copied = Waves copied. editor.default = [LIGHT_GRAY] edit = Edit... editor.name = Name: @@ -256,6 +262,7 @@ filter.option.threshold = Threshold filter.option.circle-scale = Circle Scale filter.option.octaves = Octaves filter.option.falloff = Falloff +filter.option.block = Block filter.option.floor = Floor filter.option.wall = Wall filter.option.ore = Ore diff --git a/core/assets/maps/groundZero.mmap b/core/assets/maps/groundZero.mmap index 2616fe35c5..f4638b98f5 100644 Binary files a/core/assets/maps/groundZero.mmap and b/core/assets/maps/groundZero.mmap differ diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index b1a6bb483b..fdcef283b8 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -1069,7 +1069,7 @@ public class Blocks implements ContentList{ range = 95f; shootCone = 15f; ammoUseEffect = Fx.shellEjectSmall; - health = 210; + health = 250; inaccuracy = 2f; rotatespeed = 10f; }}; @@ -1092,7 +1092,7 @@ public class Blocks implements ContentList{ inaccuracy = 17f; shootCone = 35f; - health = 220*size*size; + health = 260*size*size; }}; hail = new ArtilleryTurret("hail"){{ @@ -1107,7 +1107,7 @@ public class Blocks implements ContentList{ range = 230f; inaccuracy = 1f; shootCone = 10f; - health = 120; + health = 260; }}; wave = new LiquidTurret("wave"){{ @@ -1125,7 +1125,7 @@ public class Blocks implements ContentList{ shootCone = 50f; shootEffect = Fx.shootLiquid; range = 100f; - health = 360; + health = 250*size*size; drawer = (tile, entity) -> { Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90); @@ -1156,7 +1156,7 @@ public class Blocks implements ContentList{ chargeBeginEffect = Fx.lancerLaserChargeBegin; heatColor = Color.RED; size = 2; - health = 320; + health = 280*size*size; targetAir = false; }}; @@ -1174,6 +1174,7 @@ public class Blocks implements ContentList{ heatColor = Color.RED; recoil = 1f; size = 1; + health = 260; }}; swarmer = new BurstTurret("swarmer"){{ @@ -1190,7 +1191,7 @@ public class Blocks implements ContentList{ range = 140f; xRand = 6f; size = 2; - health = 380; + health = 300*size*size; }}; salvo = new BurstTurret("salvo"){{ diff --git a/core/src/io/anuke/mindustry/content/Mechs.java b/core/src/io/anuke/mindustry/content/Mechs.java index 4ba2506664..cc96e1ece2 100644 --- a/core/src/io/anuke/mindustry/content/Mechs.java +++ b/core/src/io/anuke/mindustry/content/Mechs.java @@ -36,7 +36,7 @@ public class Mechs implements ContentList{ speed = 0.5f; boostSpeed = 0.85f; engineColor = Color.valueOf("ffd37f"); - health = 250f; + health = 300f; weapon = new Weapon("blaster"){{ length = 1.5f; @@ -62,7 +62,7 @@ public class Mechs implements ContentList{ boostSpeed = 0.95f; itemCapacity = 15; mass = 0.9f; - health = 220f; + health = 250f; weaponOffsetX = -1; weaponOffsetY = -1; engineColor = Color.valueOf("d3ddff"); diff --git a/core/src/io/anuke/mindustry/content/Zones.java b/core/src/io/anuke/mindustry/content/Zones.java index 9d94ce230e..881fbb5fdd 100644 --- a/core/src/io/anuke/mindustry/content/Zones.java +++ b/core/src/io/anuke/mindustry/content/Zones.java @@ -22,7 +22,7 @@ public class Zones implements ContentList{ alwaysUnlocked = true; conditionWave = 5; launchPeriod = 5; - resources = new Item[]{Items.copper, Items.scrap}; + resources = new Item[]{Items.copper, Items.scrap, Items.lead}; rules = () -> new Rules(){{ waves = true; waveTimer = true; diff --git a/core/src/io/anuke/mindustry/editor/WaveInfoDialog.java b/core/src/io/anuke/mindustry/editor/WaveInfoDialog.java index 33642245d0..45eef72a81 100644 --- a/core/src/io/anuke/mindustry/editor/WaveInfoDialog.java +++ b/core/src/io/anuke/mindustry/editor/WaveInfoDialog.java @@ -3,6 +3,7 @@ package io.anuke.mindustry.editor; import io.anuke.arc.Core; import io.anuke.arc.collection.Array; import io.anuke.arc.graphics.Color; +import io.anuke.arc.input.KeyCode; import io.anuke.arc.math.Mathf; import io.anuke.arc.scene.ui.TextField.TextFieldFilter; import io.anuke.arc.scene.ui.layout.Table; @@ -45,11 +46,41 @@ public class WaveInfoDialog extends FloatingDialog{ } }); + keyDown(key -> { + if(key == KeyCode.ESCAPE || key == KeyCode.BACK) { + Core.app.post(this::hide); + } + }); + addCloseButton(); - buttons.addButton("$settings.reset", () -> ui.showConfirm("$confirm", "$settings.clear.confirm", () ->{ - groups = null; - buildGroups(); - })).size(270f, 64f); + buttons.addButton("$waves.edit", () -> { + FloatingDialog dialog = new FloatingDialog("$waves.edit"); + dialog.addCloseButton(); + dialog.setFillParent(false); + dialog.cont.defaults().size(210f, 64f); + dialog.cont.addButton("$waves.copy", () -> { + ui.showInfoFade("$waves.copied"); + Core.app.getClipboard().setContents(world.maps.writeWaves(groups)); + dialog.hide(); + }).disabled(b -> groups == null); + dialog.cont.row(); + dialog.cont.addButton("$waves.load", () -> { + try{ + groups = world.maps.readWaves(Core.app.getClipboard().getContents()); + buildGroups(); + }catch(Exception e){ + ui.showError("$waves.invalid"); + } + dialog.hide(); + }).disabled(b -> Core.app.getClipboard().getContents() == null || Core.app.getClipboard().getContents().isEmpty()); + dialog.cont.row(); + dialog.cont.addButton("$settings.reset", () -> ui.showConfirm("$confirm", "$settings.clear.confirm", () ->{ + groups = null; + buildGroups(); + dialog.hide(); + })); + dialog.show(); + }).size(270f, 64f); } void setup(){ @@ -67,7 +98,7 @@ public class WaveInfoDialog extends FloatingDialog{ }).growX().height(70f); }).width(390f).growY(); cont.table("clear", m -> { - m.add("Preview").color(Color.LIGHT_GRAY).growX().center().get().setAlignment(Align.center, Align.center); + m.add("$waves.preview").color(Color.LIGHT_GRAY).growX().center().get().setAlignment(Align.center, Align.center); m.row(); m.addButton("-", () -> {}).update(t -> { if(t.getClickListener().isPressed()){ @@ -114,16 +145,16 @@ public class WaveInfoDialog extends FloatingDialog{ t.row(); t.table(spawns -> { - spawns.addField("" + group.begin, TextFieldFilter.digitsOnly, text -> { + spawns.addField("" + (group.begin + 1), TextFieldFilter.digitsOnly, text -> { if(Strings.canParsePostiveInt(text)){ - group.begin = Strings.parseInt(text); + group.begin = Strings.parseInt(text) - 1; updateWaves(); } }).width(100f); spawns.add("$waves.to").padLeft(4).padRight(4); - spawns.addField(group.end == never ? "" : group.end + "", TextFieldFilter.digitsOnly, text -> { + spawns.addField(group.end == never ? "" : (group.end + 1) + "", TextFieldFilter.digitsOnly, text -> { if(Strings.canParsePostiveInt(text)){ - group.end = Strings.parseInt(text); + group.end = Strings.parseInt(text) - 1; updateWaves(); }else if(text.isEmpty()){ group.end = never; @@ -211,7 +242,7 @@ public class WaveInfoDialog extends FloatingDialog{ for(int i = start; i < displayed + start; i ++){ int wave = i; preview.table("underline", table -> { - table.add(wave + "").color(Pal.accent).center().colspan(2).get().setAlignment(Align.center, Align.center); + table.add((wave+1) + "").color(Pal.accent).center().colspan(2).get().setAlignment(Align.center, Align.center); table.row(); int[] spawned = new int[Vars.content.getBy(ContentType.unit).size]; diff --git a/core/src/io/anuke/mindustry/game/Stats.java b/core/src/io/anuke/mindustry/game/Stats.java index d99edd78ce..05917231c5 100644 --- a/core/src/io/anuke/mindustry/game/Stats.java +++ b/core/src/io/anuke/mindustry/game/Stats.java @@ -30,7 +30,7 @@ public class Stats{ //each new launch period adds onto the rank 'points' if(wavesLasted >= zone.conditionWave){ - score += (float)((wavesLasted - zone.conditionWave) / zone.launchPeriod + 1) * 1.3f; + score += (float)((wavesLasted - zone.conditionWave) / zone.launchPeriod + 1) * 1.2f; } int capacity = zone.loadout.core().itemCapacity; @@ -42,7 +42,7 @@ public class Stats{ frac += Mathf.clamp((float)itemsDelivered.get(item, 0) / capacity) / (float)obtainable.size; } - score += frac*2.0f; + score += frac*1.6f; if(!launched){ score *= 0.5f; diff --git a/core/src/io/anuke/mindustry/input/InputHandler.java b/core/src/io/anuke/mindustry/input/InputHandler.java index f9e0432e48..46e442a818 100644 --- a/core/src/io/anuke/mindustry/input/InputHandler.java +++ b/core/src/io/anuke/mindustry/input/InputHandler.java @@ -15,6 +15,7 @@ import io.anuke.arc.math.geom.Point2; import io.anuke.arc.math.geom.Vector2; import io.anuke.arc.scene.ui.layout.Table; import io.anuke.arc.util.Time; +import io.anuke.arc.util.Tmp; import io.anuke.mindustry.content.Blocks; import io.anuke.mindustry.content.Fx; import io.anuke.mindustry.entities.Effects; @@ -378,14 +379,23 @@ public abstract class InputHandler implements InputProcessor{ float angle = Angles.angle(startX, startY, endX, endY); int baseRotation = (startX == endX && startY == endY) ? rotation : ((int)((angle + 45) / 90f)) % 4; + Tmp.r3.set(-1, -1, 0, 0); + for(int i = 0; i < points.size; i++){ Point2 point = points.get(i); + + if(block != null && Tmp.r2.setSize(block.size * tilesize).setCenter(point.x*tilesize + block.offset(), point.y*tilesize + block.offset()).overlaps(Tmp.r3)){ + continue; + } + Point2 next = i == points.size - 1 ? null : points.get(i + 1); line.x = point.x; line.y = point.y; line.rotation = next != null ? Tile.relativeTo(point.x, point.y, next.x, next.y) : baseRotation; line.last = next == null; cons.accept(line); + + Tmp.r3.setSize(block.size * tilesize).setCenter(point.x*tilesize + block.offset(), point.y*tilesize + block.offset()); } } diff --git a/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java b/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java index 8be38a1feb..028218e723 100644 --- a/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java +++ b/desktop/src/io/anuke/mindustry/desktop/DesktopLauncher.java @@ -3,11 +3,11 @@ package io.anuke.mindustry.desktop; import io.anuke.arc.ApplicationListener; import io.anuke.arc.backends.lwjgl3.Lwjgl3Application; import io.anuke.arc.backends.lwjgl3.Lwjgl3ApplicationConfiguration; -import io.anuke.net.KryoClient; -import io.anuke.net.KryoServer; import io.anuke.mindustry.Mindustry; import io.anuke.mindustry.core.Platform; import io.anuke.mindustry.net.Net; +import io.anuke.net.KryoClient; +import io.anuke.net.KryoServer; public class DesktopLauncher extends Lwjgl3Application{