Disabled missile unit collisions

This commit is contained in:
Anuken 2021-12-07 18:08:49 -05:00
parent 0b7d8f371e
commit b3d2e7b0ca
5 changed files with 12 additions and 35 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -131,6 +131,8 @@ public class UnitType extends UnlockableContent{
public Color engineColorInner = Color.white;
public Seq<UnitEngine> 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;