Miner unit fixes
This commit is contained in:
@@ -115,7 +115,7 @@ public class UnitTypes implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
oculon = new UnitType("oculon"){{
|
oculon = new UnitType("oculon"){{
|
||||||
drillTier = 1;
|
mineTier = 1;
|
||||||
hitsize = 9f;
|
hitsize = 9f;
|
||||||
boostMultiplier = 2f;
|
boostMultiplier = 2f;
|
||||||
itemCapacity = 20;
|
itemCapacity = 20;
|
||||||
@@ -413,7 +413,7 @@ public class UnitTypes implements ContentList{
|
|||||||
mineSpeed = 0.9f;
|
mineSpeed = 0.9f;
|
||||||
engineSize = 1.8f;
|
engineSize = 1.8f;
|
||||||
engineOffset = 5.7f;
|
engineOffset = 5.7f;
|
||||||
drillTier = 1;
|
mineTier = 1;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
spirit = new UnitType("spirit"){{
|
spirit = new UnitType("spirit"){{
|
||||||
@@ -443,6 +443,7 @@ public class UnitTypes implements ContentList{
|
|||||||
|
|
||||||
flying = true;
|
flying = true;
|
||||||
mineSpeed = 2f;
|
mineSpeed = 2f;
|
||||||
|
mineTier = 1;
|
||||||
buildSpeed = 0.5f;
|
buildSpeed = 0.5f;
|
||||||
drag = 0.05f;
|
drag = 0.05f;
|
||||||
speed = 2.4f;
|
speed = 2.4f;
|
||||||
|
|||||||
@@ -17,17 +17,20 @@ import mindustry.world.*;
|
|||||||
import static mindustry.Vars.*;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
@Component
|
@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 float x, y, rotation;
|
||||||
|
@Import UnitType type;
|
||||||
|
|
||||||
transient float mineTimer;
|
transient float mineTimer;
|
||||||
@Nullable Tile mineTile;
|
@Nullable Tile mineTile;
|
||||||
|
|
||||||
abstract boolean canMine(Item item);
|
public boolean canMine(Item item){
|
||||||
|
return type.mineTier >= item.hardness;
|
||||||
|
}
|
||||||
|
|
||||||
abstract float miningSpeed();
|
public boolean offloadImmediately(){
|
||||||
|
return isPlayer();
|
||||||
abstract boolean offloadImmediately();
|
}
|
||||||
|
|
||||||
boolean mining(){
|
boolean mining(){
|
||||||
return mineTile != null;
|
return mineTile != null;
|
||||||
@@ -55,7 +58,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
|
|||||||
}else{
|
}else{
|
||||||
Item item = mineTile.drop();
|
Item item = mineTile.drop();
|
||||||
rotation(Mathf.slerpDelta(rotation(), angleTo(mineTile.worldx(), mineTile.worldy()), 0.4f));
|
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){
|
if(mineTimer >= 50f + item.hardness*10f){
|
||||||
mineTimer = 0;
|
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 ex = mineTile.worldx() + Mathf.sin(Time.time() + 48, swingScl, swingMag);
|
||||||
float ey = mineTile.worldy() + Mathf.sin(Time.time() + 48, swingScl + 2f, 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));
|
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);
|
Drawf.laser(team(), Core.atlas.find("minelaser"), Core.atlas.find("minelaser-end"), px, py, ex, ey, 0.75f);
|
||||||
|
|||||||
@@ -264,19 +264,4 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
//deaths are synced; this calls killed()
|
//deaths are synced; this calls killed()
|
||||||
Call.onUnitDeath(base());
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class UnitType extends UnlockableContent{
|
|||||||
|
|
||||||
public int itemCapacity = 30;
|
public int itemCapacity = 30;
|
||||||
public int ammoCapacity = 220;
|
public int ammoCapacity = 220;
|
||||||
public int drillTier = -1;
|
public int mineTier = -1;
|
||||||
public float buildSpeed = 1f, mineSpeed = 1f;
|
public float buildSpeed = 1f, mineSpeed = 1f;
|
||||||
|
|
||||||
public float engineOffset = 5f, engineSize = 2.5f;
|
public float engineOffset = 5f, engineSize = 2.5f;
|
||||||
|
|||||||
Reference in New Issue
Block a user