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
+2 -2
View File
@@ -49,10 +49,10 @@ public class GroundAI extends AIController{
unit.elevation = Mathf.approachDelta(unit.elevation, 0f, 0.08f); 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()){ if(unit.type().hasWeapons()){
//TODO certain units should not look at the target, e.g. ships //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()){ }else if(unit.moving()){
unit.lookAt(unit.vel().angle()); unit.lookAt(unit.vel().angle());
@@ -1126,6 +1126,7 @@ public class UnitTypes implements ContentList{
accel = 0.3f; accel = 0.3f;
rotateSpeed = 2.6f; rotateSpeed = 2.6f;
immunities = ObjectSet.with(StatusEffects.wet); immunities = ObjectSet.with(StatusEffects.wet);
rotateShooting = false;
trailLength = 20; trailLength = 20;
trailX = 5.5f; trailX = 5.5f;
@@ -1262,6 +1263,7 @@ public class UnitTypes implements ContentList{
accel = 0.19f; accel = 0.19f;
rotateSpeed = 0.9f; rotateSpeed = 0.9f;
immunities = ObjectSet.with(StatusEffects.wet); immunities = ObjectSet.with(StatusEffects.wet);
rotateShooting = false;
float spawnTime = 0.75f * Time.toMinutes; float spawnTime = 0.75f * Time.toMinutes;
@@ -70,7 +70,7 @@ public abstract class BulletType extends Content{
/** Whether this bullet can be hit by point defense. */ /** Whether this bullet can be hit by point defense. */
public boolean hittable = true; public boolean hittable = true;
/** Whether this bullet can be reflected. */ /** Whether this bullet can be reflected. */
public boolean reflectable = false; public boolean reflectable = true;
//additional effects //additional effects
@@ -100,7 +100,7 @@ public class Wall extends Block{
//deflect bullets if necessary //deflect bullets if necessary
if(deflect){ if(deflect){
//slow bullets are not deflected //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 //bullet reflection chance depends on bullet damage
if(!Mathf.chance(chanceDeflect / bullet.damage())) return true; if(!Mathf.chance(chanceDeflect / bullet.damage())) return true;
@@ -2,8 +2,10 @@ package mindustry.world.blocks.payloads;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
import arc.math.geom.*;
import arc.util.io.*; import arc.util.io.*;
import mindustry.*; import mindustry.*;
import mindustry.entities.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.graphics.*; import mindustry.graphics.*;
import mindustry.ui.*; import mindustry.ui.*;
@@ -35,6 +37,18 @@ public class UnitPayload implements Payload{
@Override @Override
public boolean dump(){ 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 //no client dumping
if(Vars.net.client()) return true; if(Vars.net.client()) return true;