diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 9d34efaf8a..8df6360324 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="14" + android:versionName="2.3.1" > diff --git a/build.gradle b/build.gradle index 9c9d09d411..cdecd63644 100644 --- a/build.gradle +++ b/build.gradle @@ -50,7 +50,7 @@ project(":html") { dependencies { compile project(":core") - compile fileTree(dir: '../core/lib', include: '*.jar') + //compile fileTree(dir: '../core/lib', include: '*.jar') compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion" compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources" compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources" @@ -79,7 +79,7 @@ project(":core") { apply plugin: "java" dependencies { - compile 'com.github.anuken:ucore:09cc372d6b' + compile 'com.github.anuken:ucore:989f9713fa' compile "com.badlogicgames.gdx:gdx:$gdxVersion" compile "com.badlogicgames.gdx:gdx-ai:1.8.1" } diff --git a/core/assets/maps/tutorial.png b/core/assets/maps/tutorial.png index 0eae472bfa..8b03ea4112 100644 Binary files a/core/assets/maps/tutorial.png and b/core/assets/maps/tutorial.png differ diff --git a/core/src/io/anuke/mindustry/Control.java b/core/src/io/anuke/mindustry/Control.java index e043fee807..b4871710fc 100644 --- a/core/src/io/anuke/mindustry/Control.java +++ b/core/src/io/anuke/mindustry/Control.java @@ -37,7 +37,6 @@ import io.anuke.ucore.util.Mathf; public class Control extends Module{ int targetscale = baseCameraScale; - boolean showedTutorial; Tutorial tutorial = new Tutorial(); boolean hiscore = false; @@ -53,6 +52,7 @@ public class Control extends Module{ float respawntime; public Control(){ + if(Mindustry.args.contains("-debug", false)){ Vars.debug = true; } @@ -173,13 +173,7 @@ public class Control extends Module{ //multiplying by 2 so you start with more time in the beginning wavetime = waveSpacing()*2; - if(showedTutorial || !Settings.getBool("tutorial")){ - GameState.set(State.playing); - }else{ - GameState.set(State.paused); - ui.showTutorial(); - showedTutorial = true; - } + GameState.set(State.playing); } public void playMap(Map map){ diff --git a/core/src/io/anuke/mindustry/Mindustry.java b/core/src/io/anuke/mindustry/Mindustry.java index 41b6ead324..eed1a099c2 100644 --- a/core/src/io/anuke/mindustry/Mindustry.java +++ b/core/src/io/anuke/mindustry/Mindustry.java @@ -6,6 +6,9 @@ import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.GameState.State; import io.anuke.mindustry.io.Formatter; +import io.anuke.mindustry.world.blocks.Blocks; +import io.anuke.mindustry.world.blocks.ProductionBlocks; +import io.anuke.mindustry.world.blocks.WeaponBlocks; import io.anuke.ucore.core.Inputs; import io.anuke.ucore.core.Timers; import io.anuke.ucore.modules.ModuleCore; @@ -28,6 +31,12 @@ public class Mindustry extends ModuleCore { @Override public void init(){ + //always initialize blocks in this order, otherwise there are ID errors + Blocks.dirt.getClass(); + ProductionBlocks.coaldrill.getClass(); + WeaponBlocks.turret.getClass(); + + module(Vars.control = new Control()); module(Vars.renderer = new Renderer()); module(Vars.ui = new UI()); @@ -44,7 +53,7 @@ public class Mindustry extends ModuleCore { try{ super.render(); }catch (RuntimeException e){ - //TODO + //TODO display error log //Gdx.app.getClipboard().setContents(e.getMessage()); throw e; } diff --git a/core/src/io/anuke/mindustry/Renderer.java b/core/src/io/anuke/mindustry/Renderer.java index eced5b3c6e..fde5c5616c 100644 --- a/core/src/io/anuke/mindustry/Renderer.java +++ b/core/src/io/anuke/mindustry/Renderer.java @@ -41,7 +41,6 @@ public class Renderer extends RendererModule{ pixelate(); Graphics.addSurface("shadow", Core.cameraScale); - Shaders.create(); } @Override diff --git a/core/src/io/anuke/mindustry/Shaders.java b/core/src/io/anuke/mindustry/Shaders.java index 080dd4b6a5..58f7aee67b 100644 --- a/core/src/io/anuke/mindustry/Shaders.java +++ b/core/src/io/anuke/mindustry/Shaders.java @@ -6,10 +6,7 @@ import io.anuke.ucore.graphics.Shader; import io.anuke.ucore.util.Tmp; public class Shaders{ - - public static void create(){ - new Outline(); - } + public static final Outline outline = new Outline(); public static class Outline extends Shader{ public Color color = new Color(); diff --git a/core/src/io/anuke/mindustry/Tutorial.java b/core/src/io/anuke/mindustry/Tutorial.java index abde6d8b94..9e53b90a2e 100644 --- a/core/src/io/anuke/mindustry/Tutorial.java +++ b/core/src/io/anuke/mindustry/Tutorial.java @@ -349,7 +349,7 @@ public class Tutorial{ turretExplanation{ { canBack = false; - text = "Turrets will automatically shoot at the nearest enemy in range, as long as they have enough ammo."; + text = "Turrets will automatically shoot at the nearest enemy in range, as long as they have enough ammo."; } }, waves{ @@ -373,7 +373,7 @@ public class Tutorial{ { androidOnly = true; text = "If you ever feel overwhelmed by enemies, you can press the [orange]pause button[] in the top right" - + "to pause the game. You can still place select and place blocks while paused."; + + " to pause the game. You can still place select and place blocks while paused."; } }, purchaseWeapons{ diff --git a/core/src/io/anuke/mindustry/UI.java b/core/src/io/anuke/mindustry/UI.java index cc38ee6f8b..c91cbe37be 100644 --- a/core/src/io/anuke/mindustry/UI.java +++ b/core/src/io/anuke/mindustry/UI.java @@ -33,7 +33,7 @@ public class UI extends SceneModule{ Table itemtable, weapontable, tools, loadingtable, desctable, respawntable; SettingsDialog prefs; KeybindDialog keys; - Dialog about, menu, restart, tutorial, levels, upgrades, load, settingserror; + Dialog about, menu, restart, levels, upgrades, load, settingserror; Tooltip tooltip; VisibilityProvider play = () -> !GameState.is(State.menu); @@ -163,8 +163,6 @@ public class UI extends SceneModule{ for(Cell cell : about.content().getCells()) cell.left(); - tutorial = new TutorialDialog(); - restart = new Dialog("The core was destroyed.", "dialog"); restart.shown(()->{ @@ -383,7 +381,7 @@ public class UI extends SceneModule{ new table(){{ new table("pane"){{ - defaults().size(220, 50).pad(3); + defaults().size(220, 48).pad(3); new button("Play", () -> { levels.show(); @@ -432,7 +430,7 @@ public class UI extends SceneModule{ }); } - get().pad(Unit.dp.inPixels(20)); + get().pad(Unit.dp.inPixels(16)); }}; get().setVisible(nplay); @@ -701,10 +699,6 @@ public class UI extends SceneModule{ } } - public void showTutorial(){ - tutorial.show(); - } - public void showRestart(){ restart.show(); } diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index 60557b5db9..facc2b0f80 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -14,7 +14,7 @@ public class Vars{ //respawn time in frames public static final float respawnduration = 60*4; //time between waves in frames - public static final float wavespace = 30*60*(android ? 1 : 1); + public static final float wavespace = 35*60*(android ? 1 : 1); //waves can last no longer than 6 minutes, otherwise the next one spawns public static final float maxwavespace = 60*60*6; //how far away from spawn points the player can't place blocks @@ -50,38 +50,4 @@ public class Vars{ "- [RED]freemusicarchive.org[] for music", "- Music made by [GREEN]RoccoW[]", }; - - public static String[] tutorialText = { - "[GREEN]Default Controls:", - "[WHITE][YELLOW][[WASD][] to move, [YELLOW][[R][] to rotate blocks.", - "Hold [YELLOW][[R-MOUSE][] to destroy blocks, click [YELLOW][[L-MOUSE][] to place them.", - "[YELLOW][[L-MOUSE][] to shoot.", - "[yellow][[scrollwheel] to switch weapons.", - "", - "[GOLD]Every "+wavespace/60+" seconds, a new wave will appear.", - "Build turrets to defend the core.", - "If the core is destroyed, you lose the game.", - "", - "[LIME]To collect building resources, move them into the core with conveyors.", - "[LIME]Place [ORANGE]drills[] on the right material,they will automatically mine material", - "and dump it to nearby conveyors or turrets.", - "", - "[SCARLET]To produce steel, feed coal and iron into a smelter." - }; - - public static String[] androidTutorialText = { - "[GREEN]Default Controls:", - "[WHITE]Use [YELLOW]one finger[] to pan the camera, or two while placing blocks.", - "[YELLOW]Hold and tap[] to destroy blocks.", - "", - "[GOLD]Every "+wavespace/60+" seconds, a new wave will appear.", - "Build turrets to defend the core.", - "If the core is destroyed, you lose the game.", - "", - "[LIME]To collect building resources, move them into the core with conveyors.", - "[LIME]Place [ORANGE]drills[] on the right material,they will automatically mine material", - "and dump it to nearby conveyors or turrets.", - "", - "[SCARLET]To produce steel, feed coal and iron into a smelter." - }; } diff --git a/core/src/io/anuke/mindustry/entities/enemies/BlastEnemy.java b/core/src/io/anuke/mindustry/entities/enemies/BlastEnemy.java index 2142dbbf23..5b0bcdcf19 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/BlastEnemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/BlastEnemy.java @@ -19,7 +19,7 @@ public class BlastEnemy extends Enemy{ super.move(); if(target != null && target.distanceTo(this) < 10f){ Bullet b = new Bullet(BulletType.blast, this, x, y, 0).add(); - b.damage = BulletType.blast.damage + (tier-1) * 50; + b.damage = BulletType.blast.damage + (tier-1) * 40; damage(999); } } diff --git a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java index e29b905dea..e76d99fe96 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java @@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.reflect.ClassReflection; -import io.anuke.mindustry.Shaders.Outline; +import io.anuke.mindustry.Shaders; import io.anuke.mindustry.Vars; import io.anuke.mindustry.ai.Pathfind; import io.anuke.mindustry.entities.Bullet; @@ -171,10 +171,10 @@ public class Enemy extends DestructibleEntity{ String region = ClassReflection.getSimpleName(getClass()).toLowerCase() + "-t" + Mathf.clamp(tier, 1, 3); //TODO is this really necessary? - Graphics.getShader(Outline.class).color.set(tierColors[tier-1]); - Graphics.getShader(Outline.class).region = Draw.region(region); + Shaders.outline.color.set(tierColors[tier-1]); + Shaders.outline.region = Draw.region(region); - Graphics.shader(Outline.class); + Graphics.shader(Shaders.outline); Draw.color(); Draw.rect(region, x, y, direction.angle()-90); Graphics.shader(); diff --git a/core/src/io/anuke/mindustry/ui/LevelDialog.java b/core/src/io/anuke/mindustry/ui/LevelDialog.java index b8ba390f8b..baa62edcd3 100644 --- a/core/src/io/anuke/mindustry/ui/LevelDialog.java +++ b/core/src/io/anuke/mindustry/ui/LevelDialog.java @@ -6,6 +6,7 @@ import io.anuke.mindustry.Vars; import io.anuke.mindustry.world.Map; import io.anuke.mindustry.world.World; import io.anuke.ucore.core.Settings; +import io.anuke.ucore.function.StringSupplier; import io.anuke.ucore.scene.ui.ButtonGroup; import io.anuke.ucore.scene.ui.Dialog; import io.anuke.ucore.scene.ui.ImageButton; @@ -53,7 +54,7 @@ public class LevelDialog extends Dialog{ for(Map map : Map.values()){ if(!map.visible) continue; - content().add(()->"High Score: [lime]" + Settings.getInt("hiscore" + map.name())); + content().add((StringSupplier)(()->"High Score: [lime]" + Settings.getInt("hiscore" + map.name()))); } } } diff --git a/core/src/io/anuke/mindustry/ui/LoadDialog.java b/core/src/io/anuke/mindustry/ui/LoadDialog.java index 5a464c9758..3a5aeff2e0 100644 --- a/core/src/io/anuke/mindustry/ui/LoadDialog.java +++ b/core/src/io/anuke/mindustry/ui/LoadDialog.java @@ -63,6 +63,7 @@ public class LoadDialog extends Dialog{ try{ SaveIO.loadFromSlot(slot); }catch(Exception e){ + e.printStackTrace(); Vars.ui.showError("[orange]Save file corrupted or invalid!"); return; } diff --git a/core/src/io/anuke/mindustry/ui/TutorialDialog.java b/core/src/io/anuke/mindustry/ui/TutorialDialog.java deleted file mode 100644 index 9892bfbb75..0000000000 --- a/core/src/io/anuke/mindustry/ui/TutorialDialog.java +++ /dev/null @@ -1,37 +0,0 @@ -package io.anuke.mindustry.ui; - -import static io.anuke.mindustry.Vars.*; - -import io.anuke.mindustry.GameState; -import io.anuke.mindustry.GameState.State; -import io.anuke.ucore.core.Settings; -import io.anuke.ucore.scene.ui.TextDialog; -import io.anuke.ucore.scene.ui.layout.Unit; - -public class TutorialDialog extends TextDialog{ - - public TutorialDialog(){ - super("Tutorial", android ? androidTutorialText : tutorialText); - setup(); - } - - void setup(){ - setDialog(); - - hidden(()->{ - GameState.set(State.playing); - }); - - getButtonTable().addButton("OK", ()->{ - hide(); - }).pad(2).size(180, 44).units(Unit.dp); - - content().pad(8); - - content().row(); - content().addCheck("Don't show again", b->{ - Settings.putBool("tutorial", !b); - Settings.save(); - }).padTop(4); - } -} diff --git a/core/src/io/anuke/mindustry/world/Generator.java b/core/src/io/anuke/mindustry/world/Generator.java index 7e52b3fa16..8acb119d7a 100644 --- a/core/src/io/anuke/mindustry/world/Generator.java +++ b/core/src/io/anuke/mindustry/world/Generator.java @@ -60,7 +60,7 @@ public class Generator{ floor = Blocks.iron; } - if(Noise.nnoise(x, y, 6, 1) > 0.238){ + if(Noise.nnoise(x, y, 6, 1) > 0.237){ floor = Blocks.coal; } diff --git a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java index 4707f4b980..7bc829f0cb 100644 --- a/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java +++ b/core/src/io/anuke/mindustry/world/blocks/ProductionBlocks.java @@ -121,10 +121,10 @@ public class ProductionBlocks{ input = Item.stone; inputAmount = 5; inputLiquid = Liquid.water; - liquidAmount = 19.99f; + liquidAmount = 18.99f; output = Item.coal; health = 50; - purifyTime = 70; + purifyTime = 60; } @Override diff --git a/core/src/io/anuke/mindustry/world/blocks/types/Conduit.java b/core/src/io/anuke/mindustry/world/blocks/types/Conduit.java index b8aa32822b..ee041d71df 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/Conduit.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/Conduit.java @@ -13,7 +13,7 @@ import io.anuke.ucore.core.Timers; public class Conduit extends Block{ protected float liquidCapacity = 10f; - protected float flowfactor = 4f; + protected float flowfactor = 4.9f; public Conduit(String name) { super(name);