Various unit logic additions

This commit is contained in:
Anuken
2020-10-06 11:26:25 -04:00
parent 06925e70c8
commit 9182b48b85
15 changed files with 232 additions and 23 deletions

View File

@@ -62,7 +62,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc, Unitc{
Fx.pulverizeSmall.at(mineTile.worldx() + Mathf.range(tilesize / 2f), mineTile.worldy() + Mathf.range(tilesize / 2f), 0f, item.color);
}
if(mineTimer >= 50f + item.hardness*10f){
if(mineTimer >= 50f + item.hardness*15f){
mineTimer = 0;
if(within(core, mineTransferRange) && core.acceptStack(item, 1, this) == 1 && offloadImmediately()){

View File

@@ -52,7 +52,7 @@ abstract class PosComp implements Position{
boolean onSolid(){
Tile tile = tileOn();
return tile != null && tile.solid();
return tile == null || tile.solid();
}
@Nullable

View File

@@ -66,6 +66,11 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
return type.hasWeapons();
}
/** @return speed with boost multipliers factored in. */
public float realSpeed(){
return Mathf.lerp(1f, type.canBoost ? type.boostMultiplier : 1f, elevation) * type.speed;
}
@Override
public float range(){
return type.range;

View File

@@ -187,7 +187,7 @@ public class AIController implements UnitController{
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / smooth, -1f, 1f);
vec.setLength(unit.type().speed * length);
vec.setLength(unit.realSpeed() * length);
if(length < -0.5f){
vec.rotate(180f);
}else if(length < 0){