From 42a6b0e36939ac931665a88f5a3e9b666f0f5627 Mon Sep 17 00:00:00 2001 From: Anuken Date: Sun, 7 Jun 2020 14:17:42 -0400 Subject: [PATCH] Unit cleanup --- core/assets-raw/sprites/units/eruptor-foot.png | Bin 0 -> 359 bytes core/assets-raw/sprites/units/eruptor-joint.png | Bin 0 -> 230 bytes .../assets-raw/sprites/units/eruptor-leg-base.png | Bin 0 -> 378 bytes core/src/mindustry/entities/comp/LegsComp.java | 12 ++---------- core/src/mindustry/entities/comp/UnitComp.java | 9 +++++---- core/src/mindustry/type/UnitType.java | 4 ++-- 6 files changed, 9 insertions(+), 16 deletions(-) create mode 100644 core/assets-raw/sprites/units/eruptor-foot.png create mode 100644 core/assets-raw/sprites/units/eruptor-joint.png create mode 100644 core/assets-raw/sprites/units/eruptor-leg-base.png diff --git a/core/assets-raw/sprites/units/eruptor-foot.png b/core/assets-raw/sprites/units/eruptor-foot.png new file mode 100644 index 0000000000000000000000000000000000000000..cb2348f903a601308ab34e8f1b92983c9561a87c GIT binary patch literal 359 zcmeAS@N?(olHy`uVBq!ia0y~yV9)?z4mJh`hMs>rav2yH7>k44ofy`glX=O&z^Lfy z;usRq`gX=$!6pNqhQ-eXCIq1?$A+_65#=9opVk44ofy`glX=O&z_7s6 z#WBRA^X=8MybTIGY!_aMv>cQ;xVVtT-9S#Z@nA>v3r^+wr3t3Te#~tUiaW)~uy2~$ z_J#7tdW$aD^uCD9nAjDtA!VV+$;69CqgW0%u`b=k%i!Qqd6df_JxNg7?~O!(vfZ^~ zT`?yt17Gz0xxl}dC8{^EU9P%mPT!U|nH@`v>-B%FxHYA$%&le0mVBkwz{mH!#8w>) i@(|NHXz*nAO~$q)d+A=wj0X%13=E#GelF{r5}E+UhFF0B literal 0 HcmV?d00001 diff --git a/core/assets-raw/sprites/units/eruptor-leg-base.png b/core/assets-raw/sprites/units/eruptor-leg-base.png new file mode 100644 index 0000000000000000000000000000000000000000..341ca19d085ff6b1a398ca8626bec27a06e8ac2f GIT binary patch literal 378 zcmeAS@N?(olHy`uVBq!ia0y~yU@%}{V36WqV_;zTXnOxT0|NtNage(c!@6@aFBupZ zO*~y3Ln2z=PT$DaWFX?2&zmWkVqPOL|3Std7PIiji#`hfF?ifJ>(Wxa2?9%>ih8Z? zG=Irb`+Z)x)31j8kGgzs?zuT_U(tgN^5NZqPBXg9tG{YI-!5Y&KU>U~;kMMPFH3@R zTt2=uzn|mn#ojCXYR0)DA=i!D@)ejIu9{Zc$xR5Vvw1wHnY%G{ns1xIj~TBvv2HaG zckc4td(Sri8_EIP}?P_T2(+Sx(^YO5Lp l^ 0.001f){ baseRotation = Mathf.slerpDelta(baseRotation, Mathf.angle(deltaX(), deltaY()), 0.1f); } @@ -111,11 +108,6 @@ abstract class LegsComp implements Posc, Rotc, Hitboxc, Flyingc, Unitc{ return rotation + 360f / legs.length * index + (360f / legs.length / 2f); } - @Override - public void add(){ - elevation = 0.4f; - } - /* @Replace public boolean isGrounded(){ diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 2c134f2cc9..bdc4e15ce4 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -21,7 +21,7 @@ import static mindustry.Vars.*; @Component abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, Itemsc, Rotc, Unitc, Weaponsc, Drawc, Boundedc, Syncc, Shieldc{ - @Import float x, y, rotation, elevation, maxHealth; + @Import float x, y, rotation, elevation, maxHealth, drag, armor; private UnitController controller; private UnitType type; @@ -85,13 +85,14 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I public void type(UnitType type){ this.type = type; this.maxHealth = type.health; + this.drag = type.drag; + this.elevation = type.flying ? 1f : type.baseElevation; + this.armor = type.armor; + heal(); - drag(type.drag); hitSize(type.hitsize); controller(type.createController()); setupWeapons(type); - - elevation = type.flying ? 1f : 0f; } @Override diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 03d1b491be..95d4f43d51 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -41,6 +41,7 @@ public class UnitType extends UnlockableContent{ public float sway = 1f; public int payloadCapacity = 1; public int commandLimit = 24; + public float baseElevation = 0f; public int legCount = 4; public float legLength = 24f, legSpeed = 0.1f, legTrns = 1f, legBaseOffset = 0f, legMoveSpace = 1f; @@ -81,7 +82,6 @@ public class UnitType extends UnlockableContent{ public Unitc create(Team team){ Unitc unit = constructor.get(); unit.team(team); - unit.armor(armor); unit.type(this); return unit; } @@ -331,7 +331,7 @@ public class UnitType extends UnlockableContent{ } public void drawLegs(Legsc unit){ - Draw.z(Layer.groundUnit - 0.02f); + //Draw.z(Layer.groundUnit - 0.02f); Leg[] legs = unit.legs();