Fixed lancer turning incorrectly / Buffed lancer
This commit is contained in:
@@ -123,11 +123,11 @@ public class TurretBullets extends BulletList implements ContentList{
|
||||
}
|
||||
};
|
||||
|
||||
lancerLaser = new BulletType(0.001f, 110){
|
||||
lancerLaser = new BulletType(0.001f, 140){
|
||||
Color[] colors = {Palette.lancerLaser.cpy().mul(1f, 1f, 1f, 0.4f), Palette.lancerLaser, Color.WHITE};
|
||||
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
|
||||
float[] lenscales = {1f, 1.1f, 1.13f, 1.14f};
|
||||
float length = 90f;
|
||||
float length = 100f;
|
||||
|
||||
{
|
||||
hiteffect = BulletFx.hitLancer;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class Damage{
|
||||
tr.trns(angle, length);
|
||||
world.raycastEachWorld(x, y, x + tr.x, y + tr.y, (cx, cy) -> {
|
||||
Tile tile = world.tile(cx, cy);
|
||||
if(tile != null && tile.entity != null && tile.entity.collide(hitter)){
|
||||
if(tile != null && tile.entity != null && tile.target().getTeamID() != team.ordinal() && tile.entity.collide(hitter)){
|
||||
tile.entity.collision(hitter);
|
||||
Effects.effect(effect, tile.worldx(), tile.worldy());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.anuke.mindustry.world.blocks.defense.turrets;
|
||||
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.TileEntity;
|
||||
import io.anuke.mindustry.type.AmmoType;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
@@ -24,7 +25,7 @@ public class LaserTurret extends PowerTurret{
|
||||
|
||||
@Override
|
||||
public void shoot(Tile tile, AmmoType ammo){
|
||||
TurretEntity entity = tile.entity();
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
|
||||
useAmmo(tile);
|
||||
|
||||
@@ -39,6 +40,8 @@ public class LaserTurret extends PowerTurret{
|
||||
});
|
||||
}
|
||||
|
||||
entity.shooting = true;
|
||||
|
||||
Timers.run(chargeTime, () -> {
|
||||
if(!isTurret(tile)) return;
|
||||
tr.trns(entity.rotation, size * tilesize / 2);
|
||||
@@ -46,6 +49,22 @@ public class LaserTurret extends PowerTurret{
|
||||
entity.heat = 1f;
|
||||
bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy));
|
||||
effects(tile);
|
||||
entity.shooting = false;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldTurn(Tile tile){
|
||||
LaserTurretEntity entity = tile.entity();
|
||||
return !entity.shooting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getEntity(){
|
||||
return new LaserTurretEntity();
|
||||
}
|
||||
|
||||
public class LaserTurretEntity extends TurretEntity{
|
||||
public boolean shooting;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,6 +193,7 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
|
||||
if(!Units.invalidateTarget(entity.target, tile.getTeam(), tile.drawx(), tile.drawy())){
|
||||
|
||||
AmmoType type = peekAmmo(tile);
|
||||
float speed = type.bullet.speed;
|
||||
if(speed < 0.1f) speed = 9999999f;
|
||||
@@ -208,7 +209,9 @@ public abstract class Turret extends Block{
|
||||
entity.rotation = 0;
|
||||
}
|
||||
|
||||
entity.rotation = Angles.moveToward(entity.rotation, targetRot, rotatespeed * Timers.delta());
|
||||
if(shouldTurn(tile)){
|
||||
entity.rotation = Angles.moveToward(entity.rotation, targetRot, rotatespeed * Timers.delta());
|
||||
}
|
||||
|
||||
if(Angles.angleDist(entity.rotation, targetRot) < shootCone){
|
||||
updateShooting(tile);
|
||||
@@ -217,6 +220,10 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldTurn(Tile tile){
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Consume ammo and return a type.
|
||||
*/
|
||||
@@ -314,7 +321,6 @@ public abstract class Turret extends Block{
|
||||
}
|
||||
|
||||
public static class TurretEntity extends TileEntity{
|
||||
public TileEntity blockTarget;
|
||||
public Array<AmmoEntry> ammo = new ThreadArray<>();
|
||||
public int totalAmmo;
|
||||
public float reload;
|
||||
|
||||
Reference in New Issue
Block a user