From 9c0b31e19a76cdb5334a2b28167c19797c459a3f Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 2 Jul 2017 22:57:41 -0400 Subject: [PATCH] Halved turret fire rate on Android to prevent lag --- core/src/io/anuke/mindustry/Control.java | 2 -- core/src/io/anuke/mindustry/UI.java | 2 +- core/src/io/anuke/mindustry/world/blocks/Turret.java | 7 ++++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/io/anuke/mindustry/Control.java b/core/src/io/anuke/mindustry/Control.java index 0a6f27a487..afff174c8b 100644 --- a/core/src/io/anuke/mindustry/Control.java +++ b/core/src/io/anuke/mindustry/Control.java @@ -13,7 +13,6 @@ import io.anuke.mindustry.input.GestureHandler; import io.anuke.mindustry.input.Input; import io.anuke.mindustry.world.Generator; import io.anuke.mindustry.world.blocks.ProductionBlocks; -import io.anuke.ucore.UCore; import io.anuke.ucore.core.*; import io.anuke.ucore.entities.Entities; import io.anuke.ucore.graphics.Atlas; @@ -152,7 +151,6 @@ public class Control extends RendererModule{ clampCamera(-tilesize / 2f, -tilesize / 2f, pixsize - tilesize / 2f, pixsize - tilesize / 2f); if(android){ - UCore.log(camera.position.x-prevx, camera.position.y-prevy); player.x += camera.position.x-prevx; player.y += camera.position.y-prevy; } diff --git a/core/src/io/anuke/mindustry/UI.java b/core/src/io/anuke/mindustry/UI.java index d4dc14d166..49dfcc4d79 100644 --- a/core/src/io/anuke/mindustry/UI.java +++ b/core/src/io/anuke/mindustry/UI.java @@ -444,7 +444,7 @@ public class UI extends SceneModule{ Gdx.app.exit(); }).width(w); - get().pad(20); + get().pad(Unit.dp.inPixels(20)); }}; get().setVisible(nplay); diff --git a/core/src/io/anuke/mindustry/world/blocks/Turret.java b/core/src/io/anuke/mindustry/world/blocks/Turret.java index 1a1bdd8807..52881fff1d 100644 --- a/core/src/io/anuke/mindustry/world/blocks/Turret.java +++ b/core/src/io/anuke/mindustry/world/blocks/Turret.java @@ -90,6 +90,7 @@ public class Turret extends Block{ if(enemy != null){ entity.rotation = MathUtils.lerpAngleDeg(entity.rotation, Angles.predictAngle(tile.worldx(), tile.worldy(), enemy.x, enemy.y, enemy.xvelocity, enemy.yvelocity, bullet.speed - 0.1f), 0.2f); + float reload = Vars.android ? this.reload*2 : this.reload; if(Timers.get(tile, reload)){ Effects.sound(shootsound, entity); shoot(tile); @@ -112,7 +113,11 @@ public class Turret extends Block{ } protected void bullet(Tile tile, float angle){ - new Bullet(bullet, tile.entity, tile.worldx()+vector.x, tile.worldy()+vector.y, angle).add(); + Bullet out = new Bullet(bullet, tile.entity, tile.worldx()+vector.x, tile.worldy()+vector.y, angle).add(); + + if(Vars.android){ + out.damage *= 2; + } } static class TurretEntity extends TileEntity{