This commit is contained in:
Anuken
2020-09-17 23:53:35 -04:00
parent f242a2b2cd
commit 4c241f9867
5 changed files with 20 additions and 4 deletions

View File

@@ -49,10 +49,10 @@ public class GroundAI extends AIController{
unit.elevation = Mathf.approachDelta(unit.elevation, 0f, 0.08f);
}
if(!Units.invalidateTarget(target, unit, unit.range())){
if(!Units.invalidateTarget(target, unit, unit.range()) && unit.type().rotateShooting){
if(unit.type().hasWeapons()){
//TODO certain units should not look at the target, e.g. ships
unit.aimLook(Predict.intercept(unit, target, unit.type().weapons.first().bullet.speed));
unit.lookAt(Predict.intercept(unit, target, unit.type().weapons.first().bullet.speed));
}
}else if(unit.moving()){
unit.lookAt(unit.vel().angle());

View File

@@ -1126,6 +1126,7 @@ public class UnitTypes implements ContentList{
accel = 0.3f;
rotateSpeed = 2.6f;
immunities = ObjectSet.with(StatusEffects.wet);
rotateShooting = false;
trailLength = 20;
trailX = 5.5f;
@@ -1262,6 +1263,7 @@ public class UnitTypes implements ContentList{
accel = 0.19f;
rotateSpeed = 0.9f;
immunities = ObjectSet.with(StatusEffects.wet);
rotateShooting = false;
float spawnTime = 0.75f * Time.toMinutes;

View File

@@ -70,7 +70,7 @@ public abstract class BulletType extends Content{
/** Whether this bullet can be hit by point defense. */
public boolean hittable = true;
/** Whether this bullet can be reflected. */
public boolean reflectable = false;
public boolean reflectable = true;
//additional effects

View File

@@ -100,7 +100,7 @@ public class Wall extends Block{
//deflect bullets if necessary
if(deflect){
//slow bullets are not deflected
if(bullet.vel().len() <= 0.2f || !bullet.type.reflectable) return true;
if(bullet.vel().len() <= 0.1f || !bullet.type.reflectable) return true;
//bullet reflection chance depends on bullet damage
if(!Mathf.chance(chanceDeflect / bullet.damage())) return true;

View File

@@ -2,8 +2,10 @@ package mindustry.world.blocks.payloads;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.math.geom.*;
import arc.util.io.*;
import mindustry.*;
import mindustry.entities.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.ui.*;
@@ -35,6 +37,18 @@ public class UnitPayload implements Payload{
@Override
public boolean dump(){
//naval units need water.
if(unit instanceof WaterMovec){
int tx = unit.tileX(), ty = unit.tileY();
boolean nearEmpty = !EntityCollisions.waterSolid(tx, ty);
for(Point2 p : Geometry.d4){
nearEmpty |= !EntityCollisions.waterSolid(tx + p.x, ty + p.y);
}
//cannot dump on dry land
if(!nearEmpty) return false;
}
//no client dumping
if(Vars.net.client()) return true;