From a297d11023c87f5bd6a944f4609051612033bdef Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 30 Jul 2020 19:00:19 -0400 Subject: [PATCH] Bugfixes --- core/src/mindustry/content/Fx.java | 6 +++--- core/src/mindustry/entities/comp/PlayerComp.java | 2 +- core/src/mindustry/entities/comp/UnitComp.java | 1 - core/src/mindustry/input/DesktopInput.java | 2 +- core/src/mindustry/input/MobileInput.java | 2 +- core/src/mindustry/type/UnitType.java | 5 +++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/src/mindustry/content/Fx.java b/core/src/mindustry/content/Fx.java index 8da8cb7452..6bd88f3b5e 100644 --- a/core/src/mindustry/content/Fx.java +++ b/core/src/mindustry/content/Fx.java @@ -63,15 +63,15 @@ public class Fx{ }), unitDespawn = new Effect(100f, e -> { - if(!(e.data instanceof Unitc)) return; + if(!(e.data instanceof Unit) || e.data().type() == null) return; - Unitc select = (Unitc)e.data; + Unit select = e.data(); float scl = e.fout(Interp.pow2Out); float p = Draw.scl; Draw.scl *= scl; mixcol(Pal.accent, 1f); - rect(select.type().icon(Cicon.full), select.x(), select.y(), select.rotation() - 90f); + rect(select.type().icon(Cicon.full), select.x, select.y, select.rotation - 90f); reset(); Draw.scl = p; diff --git a/core/src/mindustry/entities/comp/PlayerComp.java b/core/src/mindustry/entities/comp/PlayerComp.java index 6ec9c2abe9..a259585805 100644 --- a/core/src/mindustry/entities/comp/PlayerComp.java +++ b/core/src/mindustry/entities/comp/PlayerComp.java @@ -114,7 +114,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra //update some basic state to sync things if(unit.type().canBoost){ Tile tile = unit.tileOn(); - unit.elevation(Mathf.approachDelta(unit.elevation, (tile != null && tile.solid()) || boosting ? 1f : 0f, 0.08f)); + unit.elevation = Mathf.approachDelta(unit.elevation, (tile != null && tile.solid()) || boosting ? 1f : 0f, 0.08f); } }else if(core != null){ //have a small delay before death to prevent the camera from jumping around too quickly diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index e4aac95a3a..47d0972b6c 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -130,7 +130,6 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I this.type = type; this.maxHealth = type.health; this.drag = type.drag; - this.elevation = type.flying ? 1f : 0; this.armor = type.armor; this.hitSize = type.hitsize; this.hovering = type.hovering; diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index 5be37fd2a2..f1804a40ce 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -570,7 +570,7 @@ public class DesktopInput extends InputHandler{ boolean legs = unit.isGrounded(); float strafePenalty = legs ? 1f : Mathf.lerp(1f, unit.type().strafePenalty, Angles.angleDist(unit.vel().angle(), unit.rotation()) / 180f); - float speed = unit.type().speed * Mathf.lerp(1f, unit.type().canBoost ? unit.type().boostMultiplier : 1f, unit.elevation()) * strafePenalty; + float speed = unit.type().speed * Mathf.lerp(1f, unit.type().canBoost ? unit.type().boostMultiplier : 1f, unit.elevation) * strafePenalty; float xa = Core.input.axis(Binding.move_x); float ya = Core.input.axis(Binding.move_y); boolean boosted = (unit instanceof Mechc && unit.isFlying()); diff --git a/core/src/mindustry/input/MobileInput.java b/core/src/mindustry/input/MobileInput.java index 709da87626..e8d22b56e7 100644 --- a/core/src/mindustry/input/MobileInput.java +++ b/core/src/mindustry/input/MobileInput.java @@ -806,7 +806,7 @@ public class MobileInput extends InputHandler implements GestureListener{ targetPos.set(Core.camera.position); float attractDst = 15f; float strafePenalty = legs ? 1f : Mathf.lerp(1f, type.strafePenalty, Angles.angleDist(unit.vel.angle(), unit.rotation) / 180f); - float speed = type.speed * Mathf.lerp(1f, type.canBoost ? type.boostMultiplier : 1f, unit.elevation()) * strafePenalty; + float speed = type.speed * Mathf.lerp(1f, type.canBoost ? type.boostMultiplier : 1f, unit.elevation) * strafePenalty; float range = unit.hasWeapons() ? unit.range() : 0f; float bulletSpeed = unit.hasWeapons() ? type.weapons.first().bullet.speed : 0f; float mouseAngle = unit.angleTo(unit.aimX(), unit.aimY()); diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 68f351118f..af96cbbdd5 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -101,9 +101,10 @@ public class UnitType extends UnlockableContent{ public Unit create(Team team){ Unit unit = constructor.get(); - unit.team(team); + unit.team = team; unit.type(this); - unit.ammo(ammoCapacity); //fill up on ammo upon creation + unit.ammo = ammoCapacity; //fill up on ammo upon creation + unit.elevation = flying ? 1f : 0; unit.heal(); return unit; }