diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 8cedc29a5b..079794ed06 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -115,7 +115,7 @@ public class UnitTypes implements ContentList{ }}; oculon = new UnitType("oculon"){{ - drillTier = 1; + mineTier = 1; hitsize = 9f; boostMultiplier = 2f; itemCapacity = 20; @@ -413,7 +413,7 @@ public class UnitTypes implements ContentList{ mineSpeed = 0.9f; engineSize = 1.8f; engineOffset = 5.7f; - drillTier = 1; + mineTier = 1; }}; spirit = new UnitType("spirit"){{ @@ -443,6 +443,7 @@ public class UnitTypes implements ContentList{ flying = true; mineSpeed = 2f; + mineTier = 1; buildSpeed = 0.5f; drag = 0.05f; speed = 2.4f; diff --git a/core/src/mindustry/entities/comp/MinerComp.java b/core/src/mindustry/entities/comp/MinerComp.java index 4c3b1ba175..ad614fa6a2 100644 --- a/core/src/mindustry/entities/comp/MinerComp.java +++ b/core/src/mindustry/entities/comp/MinerComp.java @@ -17,17 +17,20 @@ import mindustry.world.*; import static mindustry.Vars.*; @Component -abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{ +abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc, Unitc{ @Import float x, y, rotation; + @Import UnitType type; transient float mineTimer; @Nullable Tile mineTile; - abstract boolean canMine(Item item); + public boolean canMine(Item item){ + return type.mineTier >= item.hardness; + } - abstract float miningSpeed(); - - abstract boolean offloadImmediately(); + public boolean offloadImmediately(){ + return isPlayer(); + } boolean mining(){ return mineTile != null; @@ -55,7 +58,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{ }else{ Item item = mineTile.drop(); rotation(Mathf.slerpDelta(rotation(), angleTo(mineTile.worldx(), mineTile.worldy()), 0.4f)); - mineTimer += Time.delta()*miningSpeed(); + mineTimer += Time.delta()*type.mineSpeed; if(mineTimer >= 50f + item.hardness*10f){ mineTimer = 0; @@ -92,6 +95,8 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{ float ex = mineTile.worldx() + Mathf.sin(Time.time() + 48, swingScl, swingMag); float ey = mineTile.worldy() + Mathf.sin(Time.time() + 48, swingScl + 2f, swingMag); + Draw.z(Layer.power); + Draw.color(Color.lightGray, Color.white, 1f - flashScl + Mathf.absin(Time.time(), 0.5f, flashScl)); Drawf.laser(team(), Core.atlas.find("minelaser"), Core.atlas.find("minelaser-end"), px, py, ex, ey, 0.75f); diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 9b17b9dd68..1702d0bd96 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -264,19 +264,4 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I //deaths are synced; this calls killed() Call.onUnitDeath(base()); } - - @Override - public boolean canMine(Item item){ - return type.drillTier >= item.hardness; - } - - @Override - public float miningSpeed(){ - return type.mineSpeed; - } - - @Override - public boolean offloadImmediately(){ - return false; - } } diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 5507db7a42..f160832acb 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -53,7 +53,7 @@ public class UnitType extends UnlockableContent{ public int itemCapacity = 30; public int ammoCapacity = 220; - public int drillTier = -1; + public int mineTier = -1; public float buildSpeed = 1f, mineSpeed = 1f; public float engineOffset = 5f, engineSize = 2.5f;