Merge branch 'master' into cleanup-2

This commit is contained in:
Skat
2020-11-09 20:21:01 +04:00
committed by GitHub
106 changed files with 328 additions and 249 deletions

View File

@@ -64,9 +64,7 @@ public class AIController implements UnitController{
if(unit.isFlying()){
unit.wobble();
if(unit.moving()){
unit.lookAt(unit.vel.angle());
}
unit.lookAt(unit.prefRotation());
}
}
@@ -94,7 +92,7 @@ public class AIController implements UnitController{
if(tile == targetTile || (costType == Pathfinder.costWater && !targetTile.floor().isLiquid)) return;
unit.moveAt(vec.trns(unit.angleTo(targetTile), unit.type.speed));
unit.moveAt(vec.trns(unit.angleTo(targetTile), unit.speed()));
}
protected void updateWeapons(){
@@ -175,7 +173,7 @@ public class AIController implements UnitController{
}
protected void circle(Position target, float circleLength){
circle(target, circleLength, unit.type.speed);
circle(target, circleLength, unit.speed());
}
protected void circle(Position target, float circleLength, float speed){

View File

@@ -9,7 +9,7 @@ import mindustry.world.*;
import static mindustry.Vars.*;
/** Class for storing build requests. Can be either a place or remove request. */
public class BuildPlan{
public class BuildPlan implements Position{
/** Position and rotation of this request. */
public int x, y, rotation;
/** Block being placed. If null, this is a breaking request.*/
@@ -127,11 +127,11 @@ public class BuildPlan{
}
public float drawx(){
return x*tilesize + block.offset;
return x*tilesize + (block == null ? 0 : block.offset);
}
public float drawy(){
return y*tilesize + block.offset;
return y*tilesize + (block == null ? 0 : block.offset);
}
public @Nullable Tile tile(){
@@ -142,6 +142,16 @@ public class BuildPlan{
return world.build(x, y);
}
@Override
public float getX(){
return drawx();
}
@Override
public float getY(){
return drawy();
}
@Override
public String toString(){
return "BuildRequest{" +

View File

@@ -1,6 +1,7 @@
package mindustry.entities.units;
import arc.util.*;
import mindustry.audio.*;
import mindustry.gen.*;
import mindustry.type.*;
@@ -25,6 +26,8 @@ public class WeaponMount{
public boolean side;
/** current bullet for continuous weapons */
public @Nullable Bullet bullet;
/** sound loop for continuous weapons */
public @Nullable SoundLoop sound;
public WeaponMount(Weapon weapon){
this.weapon = weapon;