Removed UnitCommand / Disabled mechs flying over env. blocks
This commit is contained in:
@@ -115,6 +115,25 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
achievedFlight = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move(float x, float y){
|
||||
if(!mech.flying){
|
||||
EntityQuery.collisions().move(this, x, y);
|
||||
}else{
|
||||
moveBy(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collidesGrid(int x, int y){
|
||||
Tile tile = world.tile(x, y);
|
||||
if(!isFlying()) return true;
|
||||
if(!mech.flying && tile != null && !tile.block().synthetic() && tile.block().solid){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float drag(){
|
||||
return mech.drag;
|
||||
|
||||
@@ -74,6 +74,11 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
return carrier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collidesGrid(int x, int y){
|
||||
return !isFlying();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCarrier(CarryTrait carrier){
|
||||
this.carrier = carrier;
|
||||
@@ -244,8 +249,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
velocity.limit(maxVelocity()).scl(1f + (status.getSpeedMultiplier()-1f) * Time.delta());
|
||||
|
||||
if(isFlying()){
|
||||
x += velocity.x * Time.delta();
|
||||
y += velocity.y * Time.delta();
|
||||
move(velocity.x * Time.delta(), velocity.y * Time.delta());
|
||||
}else{
|
||||
boolean onLiquid = floor.isLiquid;
|
||||
|
||||
|
||||
@@ -88,9 +88,6 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
return type.drag;
|
||||
}
|
||||
|
||||
/**Called when a command is recieved from the command center.*/
|
||||
public abstract void onCommand(UnitCommand command);
|
||||
|
||||
/**Initialize the type and team of this unit. Only call once!*/
|
||||
public void init(UnitType type, Team team){
|
||||
if(this.type != null) throw new RuntimeException("This unit is already initialized!");
|
||||
|
||||
@@ -120,11 +120,8 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCommand(UnitCommand command){
|
||||
state.set(command == UnitCommand.retreat ? retreat :
|
||||
command == UnitCommand.attack ? attack :
|
||||
command == UnitCommand.patrol ? patrol :
|
||||
null);
|
||||
public void move(float x, float y){
|
||||
moveBy(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -78,14 +78,6 @@ public abstract class GroundUnit extends BaseUnit{
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCommand(UnitCommand command){
|
||||
state.set(command == UnitCommand.retreat ? retreat :
|
||||
command == UnitCommand.attack ? attack :
|
||||
command == UnitCommand.patrol ? patrol :
|
||||
null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(UnitType type, Team team){
|
||||
super.init(type, team);
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package io.anuke.mindustry.entities.units;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
|
||||
public enum UnitCommand{
|
||||
attack, retreat, patrol;
|
||||
|
||||
private final String localized;
|
||||
|
||||
UnitCommand(){
|
||||
localized = Core.bundle.get("command." + name());
|
||||
}
|
||||
|
||||
public String localized(){
|
||||
return localized;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@ import io.anuke.mindustry.entities.Units;
|
||||
import io.anuke.mindustry.entities.traits.BuilderTrait;
|
||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||
import io.anuke.mindustry.entities.units.FlyingUnit;
|
||||
import io.anuke.mindustry.entities.units.UnitCommand;
|
||||
import io.anuke.mindustry.entities.units.UnitState;
|
||||
import io.anuke.mindustry.game.EventType.BuildSelectEvent;
|
||||
import io.anuke.mindustry.gen.Call;
|
||||
@@ -262,11 +261,6 @@ public class Drone extends FlyingUnit implements BuilderTrait{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommand(UnitCommand command){
|
||||
//no
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMine(Item item){
|
||||
return type.toMine.contains(item);
|
||||
|
||||
Reference in New Issue
Block a user