Various unit logic additions
This commit is contained in:
@@ -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()){
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user