From e796d44f925907a7ed263ff965fa47f83aa10768 Mon Sep 17 00:00:00 2001 From: Anuken Date: Fri, 24 Aug 2018 10:19:56 -0400 Subject: [PATCH] Tau idle regen / Fixed non-synced alts / Fixed units not retreating --- build.gradle | 2 +- .../src/io/anuke/mindustry/content/Mechs.java | 6 +++-- .../io/anuke/mindustry/entities/Player.java | 4 +-- .../mindustry/entities/units/GroundUnit.java | 2 +- .../mindustry/entities/units/types/Drone.java | 2 +- .../io/anuke/mindustry/ui/ContentDisplay.java | 26 +++++++++++++++++++ .../mindustry/desktop/DesktopPlatform.java | 6 +++-- 7 files changed, 39 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index e65143e951..f1aa0e5646 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ allprojects { appName = 'Mindustry' gdxVersion = '1.9.8' roboVMVersion = '2.3.0' - uCoreVersion = '7053ba9c265d9743593063080c1bf8ce243c3827' + uCoreVersion = 'f5cecd22475aedd70af8d6378f9061e8967403de' getVersionString = { String buildVersion = getBuildVersion() diff --git a/core/src/io/anuke/mindustry/content/Mechs.java b/core/src/io/anuke/mindustry/content/Mechs.java index 857dd28f85..2c8e0a240d 100644 --- a/core/src/io/anuke/mindustry/content/Mechs.java +++ b/core/src/io/anuke/mindustry/content/Mechs.java @@ -45,13 +45,12 @@ public class Mechs implements ContentList{ weapon = Weapons.blaster; maxSpeed = 4f; altChargeAlpha = 0.03f; + armor = 15f; } @Override public void updateAlt(Player player){ - if(player.altHeat >= 0.91f){ - } } }; @@ -119,6 +118,9 @@ public class Mechs implements ContentList{ @Override public void updateAlt(Player player){ + //idle regen + player.healBy(0.01f * Timers.delta()); + if(player.altHeat >= 0.91f){ Effects.effect(UnitFx.healWave, player); rect.setSize(healRange*2f).setCenter(player.x, player.y); diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index 7896edb520..a249dd9e57 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -480,6 +480,8 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra control.database().unlockContent(mech); } + mech.updateAlt(this); + if(mobile){ updateFlying(); }else{ @@ -499,8 +501,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra protected void updateMech(){ Tile tile = world.tileWorld(x, y); - mech.updateAlt(this); - if(boostHeat > liftoffBoost + 0.1f){ achievedFlight = true; } diff --git a/core/src/io/anuke/mindustry/entities/units/GroundUnit.java b/core/src/io/anuke/mindustry/entities/units/GroundUnit.java index ea1c93a593..c0eb69b84c 100644 --- a/core/src/io/anuke/mindustry/entities/units/GroundUnit.java +++ b/core/src/io/anuke/mindustry/entities/units/GroundUnit.java @@ -80,7 +80,7 @@ public abstract class GroundUnit extends BaseUnit{ } public void update(){ - if(health >= health && !isCommanded()){ + if(health >= maxHealth() && !isCommanded()){ state.set(attack); } diff --git a/core/src/io/anuke/mindustry/entities/units/types/Drone.java b/core/src/io/anuke/mindustry/entities/units/types/Drone.java index 61f9948237..ca2a4d7ac3 100644 --- a/core/src/io/anuke/mindustry/entities/units/types/Drone.java +++ b/core/src/io/anuke/mindustry/entities/units/types/Drone.java @@ -244,7 +244,7 @@ public class Drone extends FlyingUnit implements BuilderTrait{ } public void update(){ - if(health >= health){ + if(health >= maxHealth()){ state.set(attack); }else if(!targetHasFlag(BlockFlag.repair)){ if(timer.get(timerTarget, 20)){ diff --git a/core/src/io/anuke/mindustry/ui/ContentDisplay.java b/core/src/io/anuke/mindustry/ui/ContentDisplay.java index 2e99d06629..8ca03099ee 100644 --- a/core/src/io/anuke/mindustry/ui/ContentDisplay.java +++ b/core/src/io/anuke/mindustry/ui/ContentDisplay.java @@ -134,7 +134,33 @@ public class ContentDisplay{ } public static void displayMech(Table table, Mech mech){ + table.table(title -> { + title.addImage(mech.getContentIcon()).size(8 * 6); + title.add("[accent]" + mech.localizedName()).padLeft(5); + }); + table.row(); + + table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX(); + + table.row(); + + if(mech.description != null){ + table.add(mech.description).padLeft(5).padRight(5).width(400f).wrap().fillX(); + table.row(); + + table.addImage("white").height(3).color(Color.LIGHT_GRAY).pad(15).padLeft(0).padRight(0).fillX(); + table.row(); + } + + table.left().defaults().fillX(); + + //TODO stat list goes here + //table.add(Bundles.format("text.mech.armor", mech.armor)); + table.row(); + //table.add(Bundles.format("text.unit.speed", Strings.toFixed(mech.speed, 1))); + table.row(); + table.row(); } public static void displayUnit(Table table, UnitType unit){ diff --git a/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java b/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java index bbece0d916..50472b8e33 100644 --- a/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java +++ b/desktop/src/io/anuke/mindustry/desktop/DesktopPlatform.java @@ -15,6 +15,7 @@ import io.anuke.mindustry.game.GameMode; import io.anuke.mindustry.net.Net; import io.anuke.mindustry.ui.dialogs.FileChooser; import io.anuke.ucore.function.Consumer; +import io.anuke.ucore.util.Log; import io.anuke.ucore.util.OS; import io.anuke.ucore.util.Strings; @@ -119,8 +120,9 @@ public class DesktopPlatform extends Platform{ @Override public boolean isDebug(){ //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_" + "12312333_" - + " " + System.getProperty("os.arch") + "nice" + (int)(Math.sin(System.getProperty("user.dir").hashCode()) * 100) + Thread.currentThread().getStackTrace()[1].toString()).hashCode() + "") && new File("../../desktop/build/").exists(); + boolean eq = args.length > 0 && args[0].equals(("-debug_12312333_" + System.getProperty("os.arch") + "nice" + (int)(Math.sin(System.getProperty("user.dir").hashCode()) * 100) + Thread.currentThread().getStackTrace()[1].toString()).hashCode() + "") && new File("../../desktop/build/").exists(); + if(eq) Log.info("--DEBUG MODE ACTIVE--"); + return eq; } @Override