Implemented Anuken/Mindustry-Suggestions/issues/3026

This commit is contained in:
Anuken
2021-09-27 09:18:46 -04:00
parent dac17aa2b7
commit ed1557b5ac
4 changed files with 32 additions and 8 deletions

View File

@@ -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;
}};
}});
}};

View File

@@ -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. */

View File

@@ -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))){