From ed1557b5ac1490be6f780dba23a7b9e7cc001724 Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 27 Sep 2021 09:18:46 -0400 Subject: [PATCH] Implemented Anuken/Mindustry-Suggestions/issues/3026 --- core/src/mindustry/content/UnitTypes.java | 23 +++++++++++++------ .../mindustry/entities/bullet/BulletType.java | 2 ++ .../mindustry/entities/comp/BulletComp.java | 13 +++++++++++ gradle.properties | 2 +- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index 89aad70b9e..02642ecbf8 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -1784,7 +1784,6 @@ public class UnitTypes implements ContentList{ //endregion //region naval support retusa = new UnitType("retusa"){{ - defaultController = HugAI::new; speed = 0.9f; targetAir = false; drag = 0.14f; @@ -1818,7 +1817,8 @@ public class UnitTypes implements ContentList{ weapons.add(new Weapon(){{ mirror = false; - reload = 80f; + rotate = true; + reload = 90f; shots = 3; shotDelay = 7f; x = y = shootX = shootY = 0f; @@ -1826,7 +1826,7 @@ public class UnitTypes implements ContentList{ bullet = new BasicBulletType(){{ sprite = "mine-bullet"; - width = height = 11f; + width = height = 8f; layer = Layer.scorch; shootEffect = smokeEffect = Fx.none; @@ -1846,17 +1846,26 @@ public class UnitTypes implements ContentList{ collidesAir = false; - lifetime = 500f; + lifetime = 87f; hitEffect = new MultiEffect(Fx.blastExplosion, Fx.greenCloud); keepVelocity = false; shrinkX = shrinkY = 0f; - speed = 0f; + inaccuracy = 2f; + weaveMag = 5f; + weaveScale = 4f; + speed = 0.7f; + drag = -0.017f; + homingPower = 0.05f; + collideFloor = true; + trailColor = Pal.heal; + trailWidth = 3f; + trailLength = 8; - splashDamage = 55f; - splashDamageRadius = 45f; + splashDamage = 42f; + splashDamageRadius = 40f; }}; }}); }}; diff --git a/core/src/mindustry/entities/bullet/BulletType.java b/core/src/mindustry/entities/bullet/BulletType.java index a5eeca2d68..df4c835abd 100644 --- a/core/src/mindustry/entities/bullet/BulletType.java +++ b/core/src/mindustry/entities/bullet/BulletType.java @@ -91,6 +91,8 @@ public class BulletType extends Content implements Cloneable{ public boolean collidesAir = true, collidesGround = true; /** Whether this bullet types collides with anything at all. */ public boolean collides = true; + /** If true, this projectile collides with non-surface floors. */ + public boolean collideFloor = false; /** Whether velocity is inherited from the shooter. */ public boolean keepVelocity = true; /** Whether to scale lifetime (not actually velocity!) to disappear at the target position. Used for artillery. */ diff --git a/core/src/mindustry/entities/comp/BulletComp.java b/core/src/mindustry/entities/comp/BulletComp.java index d36a399150..5054694531 100644 --- a/core/src/mindustry/entities/comp/BulletComp.java +++ b/core/src/mindustry/entities/comp/BulletComp.java @@ -6,12 +6,14 @@ import arc.math.geom.*; import arc.struct.*; import arc.util.*; import mindustry.annotations.Annotations.*; +import mindustry.content.*; import mindustry.core.*; import mindustry.entities.bullet.*; import mindustry.game.*; import mindustry.game.Teams.*; import mindustry.gen.*; import mindustry.graphics.*; +import mindustry.world.*; import static mindustry.Vars.*; @@ -137,6 +139,17 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw while(x >= 0 && y >= 0 && x < ww && y < wh){ Building build = world.build(x, y); + + if(type.collideFloor){ + Tile tile = world.tile(x, y); + if(tile == null || tile.floor().hasSurface() || tile.block() != Blocks.air){ + type.despawned(self()); + remove(); + hit = true; + return; + } + } + if(build != null && isAdded() && build.collide(self()) && type.testCollision(self(), build) && !build.dead() && (type.collidesTeam || build.team != team) && !(type.pierceBuilding && hasCollided(build.id))){ diff --git a/gradle.properties b/gradle.properties index 9f87c549db..00daf31a6e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,4 +24,4 @@ android.useAndroidX=true #used for slow jitpack builds; TODO see if this actually works org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 -archash=e4ec2880dfdd5739ec75b5904d97ed3309c225d8 +archash=b631e4ed8d93513a52ebee6f7e612f7d603062c8