Turn MiningRange into a UnitType variable. (#5112)

* Turn MiningRange into a UnitType variable.

Long range mining go brrrrr

* Anuke Approved
This commit is contained in:
MEEP of Faith 2021-04-16 17:57:40 -07:00 committed by GitHub
parent d9b6ada0b3
commit fbddc0abc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 7 deletions

View file

@ -82,8 +82,6 @@ public class Vars implements Loadable{
public static final float itemSize = 5f;
/** units outside of this bound will die instantly */
public static final float finalWorldBounds = 500;
/** mining range for manual miners */
public static final float miningRange = 70f;
/** range for building */
public static final float buildingRange = 220f;
/** range for moving items */

View file

@ -19,7 +19,7 @@ public class MinerAI extends AIController{
if(!(unit.canMine()) || core == null) return;
if(unit.mineTile != null && !unit.mineTile.within(unit, unit.type.range)){
if(unit.mineTile != null && !unit.mineTile.within(unit, unit.type.miningRange)){
unit.mineTile(null);
}
@ -44,9 +44,9 @@ public class MinerAI extends AIController{
}
if(ore != null){
moveTo(ore, unit.type.range / 2f, 20f);
moveTo(ore, unit.type.miningRange / 2f, 20f);
if(unit.within(ore, unit.type.range)){
if(unit.within(ore, unit.type.miningRange)){
unit.mineTile = ore;
}

View file

@ -36,7 +36,7 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
}
public boolean validMine(Tile tile, boolean checkDst){
return !(tile == null || tile.block() != Blocks.air || (!within(tile.worldx(), tile.worldy(), miningRange) && checkDst)
return !(tile == null || tile.block() != Blocks.air || (!within(tile.worldx(), tile.worldy(), type.miningRange) && checkDst)
|| tile.drop() == null || !canMine(tile.drop()));
}

View file

@ -44,7 +44,7 @@ public class UnitType extends UnlockableContent{
public Prov<? extends UnitController> defaultController = () -> !flying ? new GroundAI() : new FlyingAI();
public float speed = 1.1f, boostMultiplier = 1f, rotateSpeed = 5f, baseRotateSpeed = 5f;
public float drag = 0.3f, accel = 0.5f, landShake = 0f, rippleScale = 1f, riseSpeed = 0.08f, fallSpeed = 0.018f;
public float health = 200f, range = -1, armor = 0f, maxRange = -1f;
public float health = 200f, range = -1, miningRange = 70f, armor = 0f, maxRange = -1f;
public float crashDamageMultiplier = 1f;
public boolean targetAir = true, targetGround = true;
public boolean faceTarget = true, rotateShooting = true, isCounted = true, lowAltitude = false, circleTarget = false;