diff --git a/core/src/mindustry/ai/types/MissileAI.java b/core/src/mindustry/ai/types/MissileAI.java index 433d8e3691..9c58922beb 100644 --- a/core/src/mindustry/ai/types/MissileAI.java +++ b/core/src/mindustry/ai/types/MissileAI.java @@ -11,24 +11,22 @@ public class MissileAI extends AIController{ if(target != null){ unit.lookAt(target); - - var build = unit.buildOn(); - - //kill instantly on building contact - //TODO kill on target unit contact too - if(build != null && build == target){ - unit.kill(); - } } //move forward forever unit.moveAt(vec.trns(unit.rotation, unit.speed())); + var build = unit.buildOn(); + + //kill instantly on enemy building contact + if(build != null && build.team != unit.team){ + unit.kill(); + } } @Override public boolean retarget(){ - //more frequent retarget. TODO lag? + //more frequent retarget. TODO won't this lag? return timer.get(timerTarget, 10f); } } diff --git a/core/src/mindustry/async/PhysicsProcess.java b/core/src/mindustry/async/PhysicsProcess.java index 4d7bc59aae..5928b3f2c3 100644 --- a/core/src/mindustry/async/PhysicsProcess.java +++ b/core/src/mindustry/async/PhysicsProcess.java @@ -36,9 +36,9 @@ public class PhysicsProcess implements AsyncProcess{ return false; }); - //find Unit without bodies and assign them + //find Units without bodies and assign them for(Unit entity : group){ - if(entity == null || entity.type == null) continue; + if(entity == null || entity.type == null || !entity.type.physics) continue; if(entity.physref == null){ PhysicsBody body = new PhysicsBody(); diff --git a/core/src/mindustry/content/UnitTypes.java b/core/src/mindustry/content/UnitTypes.java index c149ae222f..9b01e985ef 100644 --- a/core/src/mindustry/content/UnitTypes.java +++ b/core/src/mindustry/content/UnitTypes.java @@ -2479,30 +2479,6 @@ public class UnitTypes{ smokeEffect = Fx.shootBigSmoke; buildingDamageMultiplier = 0.4f; }}; - - //TODO REMOVE - /* - unitSpawned = new MissileUnitType("duo"){{ - trailScl = 1.1f; - speed = 3f; - weapons.add(new Weapon(){{ - shootOnDeath = true; - bullet = new BulletType(){{ - collidesTiles = false; - collides = false; - hitSound = Sounds.explosion; - - lifetime = 10f; - speed = 1f; - splashDamageRadius = 55f; - instantDisappear = true; - splashDamage = 90f; - killShooter = true; - hittable = false; - collidesAir = true; - }}; - }}); - }};*/ }}); }}; diff --git a/core/src/mindustry/type/MissileUnitType.java b/core/src/mindustry/type/MissileUnitType.java index b7ee3ea03c..9052090f57 100644 --- a/core/src/mindustry/type/MissileUnitType.java +++ b/core/src/mindustry/type/MissileUnitType.java @@ -21,6 +21,7 @@ public class MissileUnitType extends UnitType{ constructor = TimedKillUnit::create; envEnabled = Env.any; envDisabled = Env.none; + physics = false; trailLength = 7; hidden = true; rotateSpeed = 2f; diff --git a/core/src/mindustry/type/UnitType.java b/core/src/mindustry/type/UnitType.java index 9d66494a60..f617a7e5df 100644 --- a/core/src/mindustry/type/UnitType.java +++ b/core/src/mindustry/type/UnitType.java @@ -131,6 +131,8 @@ public class UnitType extends UnlockableContent{ public Color engineColorInner = Color.white; public Seq engines = new Seq<>(); public float strafePenalty = 0.5f; + /** If false, this unit does not physically collide with others. */ + public boolean physics = true; public float hitSize = 6f; public float itemOffsetY = 3f; public float lightRadius = -1f, lightOpacity = 0.6f;