This commit is contained in:
Anuken
2020-09-05 13:35:36 -04:00
parent 9fb570f965
commit 09e34da880
4 changed files with 10 additions and 5 deletions

View File

@@ -72,8 +72,13 @@ public class PointDefenseTurret extends Block{
target = Groups.bullet.intersect(x - range, y - range, range*2, range*2).min(b -> b.team == team || !b.type().hittable ? Float.MAX_VALUE : b.dst2(this));
}
//pooled bullets
if(target != null && !target.isAdded()){
target = null;
}
//look at target
if(target != null && target.within(this, range) && target.team != team && target.type().hittable){
if(target != null && target.within(this, range) && target.team != team && target.type() != null && target.type().hittable){
float dest = angleTo(target);
rotation = Angles.moveToward(rotation, dest, rotateSpeed * edelta());
reload -= edelta();