From 4c241f9867aa578d142043c8e86c695788ffda4d Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 17 Sep 2020 23:53:35 -0400 Subject: [PATCH] Bugfixes --- core/src/mindustry/ai/types/GroundAI.java | 4 ++-- core/src/mindustry/content/UnitTypes.java | 2 ++ core/src/mindustry/entities/bullet/BulletType.java | 2 +- core/src/mindustry/world/blocks/defense/Wall.java | 2 +- .../world/blocks/payloads/UnitPayload.java | 14 ++++++++++++++ 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/ai/types/GroundAI.java b/core/src/mindustry/ai/types/GroundAI.java index ebf36d1ff4..74e8893ed5 100644 --- a/core/src/mindustry/ai/types/GroundAI.java +++ b/core/src/mindustry/ai/types/GroundAI.java @@ -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()); diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 109e95dd88..b869dcc3a0 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -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; diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index cbe8989e56..d1a83dbe52 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -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 diff --git a/core/src/mindustry/world/blocks/defense/Wall.java b/core/src/mindustry/world/blocks/defense/Wall.java index 99c0d5dd40..c99100166a 100644 --- a/core/src/mindustry/world/blocks/defense/Wall.java +++ b/core/src/mindustry/world/blocks/defense/Wall.java @@ -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; diff --git a/core/src/mindustry/world/blocks/payloads/UnitPayload.java b/core/src/mindustry/world/blocks/payloads/UnitPayload.java index 4c835cacce..ac7b0edd24 100644 --- a/core/src/mindustry/world/blocks/payloads/UnitPayload.java +++ b/core/src/mindustry/world/blocks/payloads/UnitPayload.java @@ -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;