From 3fa3456c2bdf2bc1f7b4cd6546a7d49df104fb75 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 14 Aug 2017 15:32:20 -0400 Subject: [PATCH] Added additional info to block descriptions --- android/AndroidManifest.xml | 4 ++-- core/src/io/anuke/mindustry/Vars.java | 14 +++++++++---- .../mindustry/entities/enemies/Enemy.java | 20 +++++++++++++++++++ core/src/io/anuke/mindustry/io/SaveIO.java | 1 + .../mindustry/world/blocks/RepairTurret.java | 2 +- .../anuke/mindustry/world/blocks/Turret.java | 2 +- 6 files changed, 35 insertions(+), 8 deletions(-) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 0cd1646586..58f44d86e6 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="6" + android:versionName="1.1.2" > diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index ea42a84d33..6c870c6370 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -6,20 +6,26 @@ import com.badlogic.gdx.Gdx; import io.anuke.mindustry.entities.Player; import io.anuke.ucore.scene.ui.layout.Unit; -/**ick, global state*/ public class Vars{ + //shorthand for whether or not this is running on android public static final boolean android = (Gdx.app.getType() == ApplicationType.Android); - + //how far away from the player blocks can be placed public static final float placerange = 66; + //respawn time in frames public static final float respawnduration = 60*4; + //time between waves in frames public static final float wavespace = 20*60*(android ? 2 : 1); + //how far away from spawn points the player can't place blocks public static final float enemyspawnspace = 65; + //scale of the font public static final float fontscale = Unit.dp.inPixels(1f)/2f; + //camera zoom displayed on startup public static final int baseCameraScale = Math.round(Unit.dp.inPixels(4)); + //how much the zoom changes every zoom button press public static final int zoomScale = Math.round(Unit.dp.inPixels(1)); - + //if true, player speed will be increased, massive amounts of resources will be given on start, and other debug options will be available public static boolean debug = false; - + //number of save slots-- increasing may lead to layout issues public static final int saveSlots = 4; //turret and enemy shoot speed inverse multiplier diff --git a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java index 06620d9782..4296543f76 100644 --- a/core/src/io/anuke/mindustry/entities/enemies/Enemy.java +++ b/core/src/io/anuke/mindustry/entities/enemies/Enemy.java @@ -72,6 +72,26 @@ public class Enemy extends DestructibleEntity{ out.damage = bullet.damage*Vars.multiplier; } + public void findClosestNode(){ + Pathfind.find(this); + + int index = 0; + int cindex = -1; + float dst = Float.MAX_VALUE; + + + for(Tile tile : path){ + if(Vector2.dst(tile.worldx(), tile.worldy(), x, y) < dst){ + dst = Vector2.dst(tile.worldx(), tile.worldy(), x, y); + cindex = index; + } + + index ++; + } + + node = cindex; + } + @Override public boolean collides(SolidEntity other){ return (other instanceof Bullet) && !(((Bullet)other).owner instanceof Enemy); diff --git a/core/src/io/anuke/mindustry/io/SaveIO.java b/core/src/io/anuke/mindustry/io/SaveIO.java index 121528d128..513b80f3e9 100644 --- a/core/src/io/anuke/mindustry/io/SaveIO.java +++ b/core/src/io/anuke/mindustry/io/SaveIO.java @@ -302,6 +302,7 @@ public class SaveIO{ try{ Enemy enemy = (Enemy)ClassReflection.getConstructor(idEnemies.get(type), int.class).newInstance(lane); + enemy.findClosestNode(); enemy.health = health; enemy.x = x; enemy.y = y; diff --git a/core/src/io/anuke/mindustry/world/blocks/RepairTurret.java b/core/src/io/anuke/mindustry/world/blocks/RepairTurret.java index 0572823753..476506f154 100644 --- a/core/src/io/anuke/mindustry/world/blocks/RepairTurret.java +++ b/core/src/io/anuke/mindustry/world/blocks/RepairTurret.java @@ -56,6 +56,6 @@ public class RepairTurret extends Turret{ @Override public String description(){ - return "Heals nearby tiles."; + return "[green]Range: " + (int)range + "\n[orange]Heals nearby tiles."; } } diff --git a/core/src/io/anuke/mindustry/world/blocks/Turret.java b/core/src/io/anuke/mindustry/world/blocks/Turret.java index 21eb5ae77d..675fe20ef2 100644 --- a/core/src/io/anuke/mindustry/world/blocks/Turret.java +++ b/core/src/io/anuke/mindustry/world/blocks/Turret.java @@ -74,7 +74,7 @@ public class Turret extends Block{ @Override public String description(){ - return "[green]Ammo: "+(ammo==null ? "N/A" : ammo.name())+"\n[]Shoots things."; + return "[green]Ammo: "+(ammo==null ? "N/A" : ammo.name())+"\nRange: " + (int)range + "\nDamage: " + bullet.damage; } @Override