Bullet/weapon cleanup
This commit is contained in:
@@ -2,6 +2,7 @@ package mindustry.world.blocks.defense.turrets;
|
||||
|
||||
import arc.math.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.bullet.*;
|
||||
import mindustry.gen.*;
|
||||
@@ -31,7 +32,7 @@ public class ContinuousTurret extends Turret{
|
||||
}
|
||||
|
||||
public class ContinuousTurretBuild extends TurretBuild{
|
||||
public Bullet bullet;
|
||||
public @Nullable Bullet bullet;
|
||||
|
||||
@Override
|
||||
protected void updateCooling(){
|
||||
|
||||
@@ -29,7 +29,7 @@ public class LaserTurret extends PowerTurret{
|
||||
}
|
||||
|
||||
public class LaserTurretBuild extends PowerTurretBuild{
|
||||
public Bullet bullet;
|
||||
public @Nullable Bullet bullet;
|
||||
public float bulletLife;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -512,7 +512,6 @@ public class Turret extends ReloadTurret{
|
||||
recoil = recoilAmount;
|
||||
heat = 1f;
|
||||
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy));
|
||||
effects();
|
||||
charging = false;
|
||||
});
|
||||
|
||||
@@ -525,7 +524,6 @@ public class Turret extends ReloadTurret{
|
||||
|
||||
bulletOffset.trns(rotation, shootLength, Mathf.range(xRand));
|
||||
bullet(peekAmmo(), rotation + Mathf.range(inaccuracy + peekAmmo().inaccuracy) + (ii - (int)(shots / 2f)) * spread);
|
||||
effects();
|
||||
useAmmo();
|
||||
recoil = recoilAmount;
|
||||
heat = 1f;
|
||||
@@ -544,7 +542,6 @@ public class Turret extends ReloadTurret{
|
||||
bulletOffset.trns(rotation - 90, (spread) * i + Mathf.range(xRand), shootLength);
|
||||
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy));
|
||||
shotCounter ++;
|
||||
effects();
|
||||
}
|
||||
}else{
|
||||
bulletOffset.trns(rotation, shootLength, Mathf.range(xRand));
|
||||
@@ -553,7 +550,6 @@ public class Turret extends ReloadTurret{
|
||||
bullet(type, rotation + Mathf.range(inaccuracy + type.inaccuracy) + (i - (int)(shots / 2f)) * spread);
|
||||
shotCounter ++;
|
||||
}
|
||||
effects();
|
||||
}
|
||||
|
||||
recoil = recoilAmount;
|
||||
@@ -563,9 +559,10 @@ public class Turret extends ReloadTurret{
|
||||
}
|
||||
|
||||
protected void bullet(BulletType type, float angle){
|
||||
float lifeScl = type.scaleVelocity ? Mathf.clamp(Mathf.dst(x + bulletOffset.x, y + bulletOffset.y, targetPos.x, targetPos.y) / type.range(), minRange / type.range(), range() / type.range()) : 1f;
|
||||
float lifeScl = type.scaleVelocity ? Mathf.clamp(Mathf.dst(x + bulletOffset.x, y + bulletOffset.y, targetPos.x, targetPos.y) / type.range, minRange / type.range, range() / type.range) : 1f;
|
||||
|
||||
type.create(this, team, x + bulletOffset.x, y + bulletOffset.y, angle, 1f + Mathf.range(velocityInaccuracy), lifeScl);
|
||||
effects();
|
||||
}
|
||||
|
||||
protected void effects(){
|
||||
|
||||
Reference in New Issue
Block a user