mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-21 20:18:06 +07:00
Miner unit fixes
This commit is contained in:
parent
fb7633cb07
commit
3772b04c6b
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user