More effect tweaks / Unfinished implementation of lancer turret
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 171 B |
+217
-210
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 103 KiB |
@@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Wed Apr 04 21:11:59 EDT 2018
|
#Wed Apr 04 23:49:24 EDT 2018
|
||||||
version=release
|
version=release
|
||||||
androidBuildCode=844
|
androidBuildCode=845
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.4
|
code=3.4
|
||||||
build=custom build
|
build=custom build
|
||||||
|
|||||||
@@ -12,5 +12,7 @@ public class AmmoTypes {
|
|||||||
|
|
||||||
basicFlame = new AmmoType(Liquids.oil, TurretBullets.basicFlame, 0.3f, 0.9f),
|
basicFlame = new AmmoType(Liquids.oil, TurretBullets.basicFlame, 0.3f, 0.9f),
|
||||||
|
|
||||||
basicLeadFrag = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1, 0.8f);
|
basicLeadFrag = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1, 0.8f),
|
||||||
|
|
||||||
|
lancerLaser = new AmmoType(TurretBullets.lancerLaser);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import io.anuke.mindustry.content.AmmoTypes;
|
|||||||
import io.anuke.mindustry.content.fx.BulletFx;
|
import io.anuke.mindustry.content.fx.BulletFx;
|
||||||
import io.anuke.mindustry.resource.AmmoType;
|
import io.anuke.mindustry.resource.AmmoType;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.blocks.types.defense.LaserTurret;
|
|
||||||
import io.anuke.mindustry.world.blocks.types.defense.Turret;
|
import io.anuke.mindustry.world.blocks.types.defense.Turret;
|
||||||
import io.anuke.mindustry.world.blocks.types.defense.turrets.*;
|
import io.anuke.mindustry.world.blocks.types.defense.turrets.*;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
@@ -91,9 +90,14 @@ public class WeaponBlocks{
|
|||||||
};
|
};
|
||||||
}},
|
}},
|
||||||
|
|
||||||
laserturret = new LaserTurret("laserturret"){
|
laserturret = new PowerTurret("laserturret"){{
|
||||||
|
range = 70f;
|
||||||
},
|
shootType = AmmoTypes.lancerLaser;
|
||||||
|
recoil = 2f;
|
||||||
|
reload = 80f;
|
||||||
|
shootEffect = BulletFx.lancerLaserShoot;
|
||||||
|
smokeEffect = BulletFx.lancerLaserShootSmoke;
|
||||||
|
}},
|
||||||
|
|
||||||
teslaturret = new PowerTurret("teslaturret"){
|
teslaturret = new PowerTurret("teslaturret"){
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import io.anuke.mindustry.content.fx.BulletFx;
|
|||||||
import io.anuke.mindustry.content.fx.Fx;
|
import io.anuke.mindustry.content.fx.Fx;
|
||||||
import io.anuke.mindustry.entities.Bullet;
|
import io.anuke.mindustry.entities.Bullet;
|
||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.BulletType;
|
||||||
|
import io.anuke.mindustry.entities.effect.DamageArea;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.ucore.graphics.Draw;
|
import io.anuke.ucore.graphics.Draw;
|
||||||
|
import io.anuke.ucore.graphics.Lines;
|
||||||
import io.anuke.ucore.util.Angles;
|
import io.anuke.ucore.util.Angles;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|
||||||
@@ -74,16 +76,17 @@ public class TurretBullets {
|
|||||||
hiteffect = Fx.none;
|
hiteffect = Fx.none;
|
||||||
despawneffect = Fx.none;
|
despawneffect = Fx.none;
|
||||||
hitsize = 4;
|
hitsize = 4;
|
||||||
|
lifetime = 20f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Bullet b) {
|
public void draw(Bullet b) {
|
||||||
drawBullet(Palette.bulletYellow, Palette.bulletYellowBack,
|
drawBullet(Palette.bulletYellow, Palette.bulletYellowBack,
|
||||||
"bullet", b.x, b.y, 10f, 1f + b.fract()*11f, b.angle() - 90);
|
"bullet", b.x, b.y, 7f + b.fract()*3f, 1f + b.fract()*11f, b.angle() - 90);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
basicFlame = new BulletType(2f, 4) {
|
basicFlame = new BulletType(2f, 0) {
|
||||||
{
|
{
|
||||||
hitsize = 7f;
|
hitsize = 7f;
|
||||||
lifetime = 30f;
|
lifetime = 30f;
|
||||||
@@ -95,6 +98,39 @@ public class TurretBullets {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Bullet b) {}
|
public void draw(Bullet b) {}
|
||||||
|
},
|
||||||
|
|
||||||
|
lancerLaser = new BulletType(0.001f, 1) {
|
||||||
|
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 = 70f;
|
||||||
|
|
||||||
|
{
|
||||||
|
hiteffect = BulletFx.hitLancer;
|
||||||
|
despawneffect = Fx.none;
|
||||||
|
hitsize = 4;
|
||||||
|
lifetime = 12f;
|
||||||
|
pierce = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Bullet b) {
|
||||||
|
DamageArea.collideLine(b, b.team, hiteffect, b.x, b.y, b.angle(), length);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Bullet b) {
|
||||||
|
Lines.lineAngle(b.x, b.y, b.angle(), length);
|
||||||
|
for(int s = 0; s < 3; s ++) {
|
||||||
|
Draw.color(colors[s]);
|
||||||
|
for (int i = 0; i < tscales.length; i++) {
|
||||||
|
Lines.stroke(7f * b.fract() * (s == 0 ? 1.5f : s == 1 ? 1f : 0.3f) * tscales[i]);
|
||||||
|
Lines.lineAngle(b.x, b.y, b.angle(), length * lenscales[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static void drawBullet(Color first, Color second, String name, float x, float y, float w, float h, float rot){
|
private static void drawBullet(Color first, Color second, String name, float x, float y, float w, float h, float rot){
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class BulletFx {
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
shellEjectSmall = new StaticEffect(30f, 300f, e -> {
|
shellEjectSmall = new StaticEffect(30f, 400f, e -> {
|
||||||
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract());
|
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract());
|
||||||
float rot = e.rotation + 90f;
|
float rot = e.rotation + 90f;
|
||||||
for(int i : Mathf.signs){
|
for(int i : Mathf.signs){
|
||||||
@@ -95,7 +95,7 @@ public class BulletFx {
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
shellEjectMedium = new StaticEffect(34f, 300f, e -> {
|
shellEjectMedium = new StaticEffect(34f, 400f, e -> {
|
||||||
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract());
|
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract());
|
||||||
float rot = e.rotation + 90f;
|
float rot = e.rotation + 90f;
|
||||||
for(int i : Mathf.signs){
|
for(int i : Mathf.signs){
|
||||||
@@ -118,7 +118,7 @@ public class BulletFx {
|
|||||||
Draw.color();
|
Draw.color();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
shellEjectBig = new StaticEffect(22f, 300f, e -> {
|
shellEjectBig = new StaticEffect(22f, 400f, e -> {
|
||||||
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract());
|
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.ifract());
|
||||||
float rot = e.rotation + 90f;
|
float rot = e.rotation + 90f;
|
||||||
for(int i : Mathf.signs){
|
for(int i : Mathf.signs){
|
||||||
@@ -178,6 +178,18 @@ public class BulletFx {
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
hitLancer = new Effect(12, e -> {
|
||||||
|
Draw.color(Color.WHITE);
|
||||||
|
Lines.stroke(e.fract()*1.5f);
|
||||||
|
|
||||||
|
Angles.randLenVectors(e.id, 8, e.powfract()*17f, e.rotation, 360f, (x, y) -> {
|
||||||
|
float ang = Mathf.atan2(x, y);
|
||||||
|
Lines.lineAngle(e.x + x, e.y + y, ang, e.fract()*4 + 1f);
|
||||||
|
});
|
||||||
|
|
||||||
|
Draw.reset();
|
||||||
|
}),
|
||||||
|
|
||||||
despawn = new Effect(12, e -> {
|
despawn = new Effect(12, e -> {
|
||||||
Draw.color(Palette.lighterOrange, Color.GRAY, e.ifract());
|
Draw.color(Palette.lighterOrange, Color.GRAY, e.ifract());
|
||||||
Lines.stroke(e.fract());
|
Lines.stroke(e.fract());
|
||||||
@@ -211,6 +223,26 @@ public class BulletFx {
|
|||||||
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fract()*3f);
|
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), 1f + e.fract()*3f);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Draw.reset();
|
||||||
|
}),
|
||||||
|
|
||||||
|
lancerLaserShoot = new Effect(12f, e -> {
|
||||||
|
Draw.color(Palette.lancerLaser);
|
||||||
|
|
||||||
|
for(int i : Mathf.signs){
|
||||||
|
Shapes.tri(e.x, e.y, 4f * e.fract(), 29f, e.rotation + 90f*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw.reset();
|
||||||
|
}),
|
||||||
|
|
||||||
|
lancerLaserShootSmoke = new Effect(20f, e -> {
|
||||||
|
Draw.color(Palette.lancerLaser);
|
||||||
|
|
||||||
|
Angles.randLenVectors(e.id, 7, 80f, e.rotation, 0f, (x, y) -> {
|
||||||
|
Lines.lineAngle(e.x + x, e.y + y, Mathf.atan2(x, y), e.fract()*9f);
|
||||||
|
});
|
||||||
|
|
||||||
Draw.reset();
|
Draw.reset();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import io.anuke.mindustry.game.Team;
|
|||||||
|
|
||||||
public abstract class Unit extends SyncEntity {
|
public abstract class Unit extends SyncEntity {
|
||||||
//total duration of hit effect
|
//total duration of hit effect
|
||||||
public static final float hitDuration = 5f;
|
public static final float hitDuration = 9f;
|
||||||
|
|
||||||
public Team team = Team.blue;
|
public Team team = Team.blue;
|
||||||
public Vector2 velocity = new Vector2();
|
public Vector2 velocity = new Vector2();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import io.anuke.mindustry.game.Team;
|
|||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.core.Effects;
|
import io.anuke.ucore.core.Effects;
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
import io.anuke.ucore.core.Effects.Effect;
|
||||||
|
import io.anuke.ucore.entities.SolidEntity;
|
||||||
import io.anuke.ucore.function.Consumer;
|
import io.anuke.ucore.function.Consumer;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
import io.anuke.ucore.util.Physics;
|
import io.anuke.ucore.util.Physics;
|
||||||
@@ -23,7 +24,7 @@ public class DamageArea{
|
|||||||
|
|
||||||
/**Damages entities in a line.
|
/**Damages entities in a line.
|
||||||
* Only enemies of the specified team are damaged.*/
|
* Only enemies of the specified team are damaged.*/
|
||||||
public static void damageLine(Team team, Effect effect, float x, float y, float angle, float length, int damage){
|
public static void collideLine(SolidEntity hitter, Team team, Effect effect, float x, float y, float angle, float length){
|
||||||
tr.trns(angle, length);
|
tr.trns(angle, length);
|
||||||
rect.setPosition(x, y).setSize(tr.x, tr.y);
|
rect.setPosition(x, y).setSize(tr.x, tr.y);
|
||||||
float x2 = tr.x + x, y2 = tr.y + y;
|
float x2 = tr.x + x, y2 = tr.y + y;
|
||||||
@@ -56,7 +57,8 @@ public class DamageArea{
|
|||||||
|
|
||||||
if (vec != null) {
|
if (vec != null) {
|
||||||
Effects.effect(effect, vec.x, vec.y);
|
Effects.effect(effect, vec.x, vec.y);
|
||||||
e.damage(damage);
|
e.collision(hitter, vec.x, vec.y);
|
||||||
|
hitter.collision(e, vec.x, vec.y);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public class StaticEffectEntity extends EffectEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawOver(){
|
public void drawOver(){
|
||||||
if(once) Effects.renderEffect(id, renderer, color, once ? lifetime : time, rotation, x, y);
|
if(once) Effects.renderEffect(id, renderer, color, lifetime, rotation, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class StaticEffect extends Effect{
|
public static class StaticEffect extends Effect{
|
||||||
|
|||||||
@@ -15,4 +15,6 @@ public class Palette {
|
|||||||
public static final Color lighterOrange = Color.valueOf("f6e096");
|
public static final Color lighterOrange = Color.valueOf("f6e096");
|
||||||
|
|
||||||
public static final Color lightishGray = Color.valueOf("a2a2a2");
|
public static final Color lightishGray = Color.valueOf("a2a2a2");
|
||||||
|
|
||||||
|
public static final Color lancerLaser = Color.valueOf("a9d8ff");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ public class AmmoType {
|
|||||||
allTypes.add(this);
|
allTypes.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AmmoType(BulletType result){
|
||||||
|
this.item = null;
|
||||||
|
this.liquid = null;
|
||||||
|
this.bullet = result;
|
||||||
|
this.quantityMultiplier = 1f;
|
||||||
|
this.speedMultiplier = 1f;
|
||||||
|
}
|
||||||
|
|
||||||
public AmmoType(Item item, BulletType result, float multiplier, float speedMultiplier){
|
public AmmoType(Item item, BulletType result, float multiplier, float speedMultiplier){
|
||||||
this.item = item;
|
this.item = item;
|
||||||
this.liquid = null;
|
this.liquid = null;
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
package io.anuke.mindustry.world.blocks.types.defense;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
|
||||||
import com.badlogic.gdx.math.MathUtils;
|
|
||||||
import io.anuke.mindustry.entities.Unit;
|
|
||||||
import io.anuke.mindustry.graphics.Layer;
|
|
||||||
import io.anuke.mindustry.content.fx.Fx;
|
|
||||||
import io.anuke.mindustry.world.Tile;
|
|
||||||
import io.anuke.mindustry.world.blocks.types.defense.turrets.PowerTurret;
|
|
||||||
import io.anuke.ucore.core.Effects;
|
|
||||||
import io.anuke.ucore.core.Effects.Effect;
|
|
||||||
import io.anuke.ucore.core.Timers;
|
|
||||||
import io.anuke.ucore.graphics.Draw;
|
|
||||||
import io.anuke.ucore.graphics.Lines;
|
|
||||||
import io.anuke.ucore.util.Angles;
|
|
||||||
import io.anuke.ucore.util.Mathf;
|
|
||||||
import io.anuke.ucore.util.Tmp;
|
|
||||||
|
|
||||||
public class LaserTurret extends PowerTurret {
|
|
||||||
protected Color beamColor = Color.WHITE.cpy();
|
|
||||||
protected Effect hiteffect = Fx.none;
|
|
||||||
protected int damage = 4;
|
|
||||||
protected float cone = 15f;
|
|
||||||
|
|
||||||
public LaserTurret(String name) {
|
|
||||||
super(name);
|
|
||||||
shootsound = null;
|
|
||||||
layer2 = Layer.laser;
|
|
||||||
//soundReload = 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateShooting(Tile tile){
|
|
||||||
TurretEntity entity = tile.entity();
|
|
||||||
Unit enemy = entity.target;
|
|
||||||
|
|
||||||
if(Angles.angleDist(entity.rotation, Angles.angle(tile.drawx(), tile.drawy(), enemy.x, enemy.y)) < cone){
|
|
||||||
enemy.damage(damage);
|
|
||||||
Effects.effect(hiteffect, enemy.x + Mathf.range(3), enemy.y + Mathf.range(3));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawLayer2(Tile tile){
|
|
||||||
TurretEntity entity = tile.entity();
|
|
||||||
Unit enemy = entity.target;
|
|
||||||
|
|
||||||
if(enemy != null &&
|
|
||||||
Angles.angleDist(entity.rotation, Angles.angle(tile.drawx(), tile.drawy(), enemy.x, enemy.y)) <= cone){
|
|
||||||
float len = 4f;
|
|
||||||
|
|
||||||
float x = tile.drawx() + Angles.trnsx(entity.rotation, len), y = tile.drawy() + Angles.trnsy(entity.rotation, len);
|
|
||||||
float x2 = enemy.x, y2 = enemy.y;
|
|
||||||
|
|
||||||
float lighten = (MathUtils.sin(Timers.time()/1.2f) + 1f) / 10f;
|
|
||||||
|
|
||||||
Draw.color(Tmp.c1.set(beamColor).mul(1f + lighten, 1f + lighten, 1f + lighten, 1f));
|
|
||||||
Draw.alpha(0.3f);
|
|
||||||
Lines.stroke(4f);
|
|
||||||
Lines.line(x, y, x2, y2);
|
|
||||||
Lines.stroke(2f);
|
|
||||||
Draw.rect("circle", x2, y2, 7f, 7f);
|
|
||||||
Draw.alpha(1f);
|
|
||||||
Lines.stroke(2f);
|
|
||||||
Lines.line(x, y, x2, y2);
|
|
||||||
Lines.stroke(1f);
|
|
||||||
Draw.rect("circle", x2, y2, 5f, 5f);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -49,6 +49,14 @@ public abstract class Turret extends Block{
|
|||||||
protected Translator tr2 = new Translator();
|
protected Translator tr2 = new Translator();
|
||||||
protected String base = null; //name of the region to draw under turret, usually null
|
protected String base = null; //name of the region to draw under turret, usually null
|
||||||
protected BiConsumer<Tile, TurretEntity> drawer = (tile, entity) -> Draw.rect(name, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
protected BiConsumer<Tile, TurretEntity> drawer = (tile, entity) -> Draw.rect(name, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||||
|
protected BiConsumer<Tile, TurretEntity> heatDrawer = (tile, entity) ->{
|
||||||
|
Graphics.setAdditiveBlending();
|
||||||
|
Draw.color(Palette.turretHeat);
|
||||||
|
Draw.alpha(entity.heat);
|
||||||
|
Draw.rect(name + "-heat", tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
||||||
|
Graphics.setNormalBlending();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
protected Effect shootEffect = Fx.none;
|
protected Effect shootEffect = Fx.none;
|
||||||
protected Effect smokeEffect = Fx.none;
|
protected Effect smokeEffect = Fx.none;
|
||||||
@@ -101,11 +109,7 @@ public abstract class Turret extends Block{
|
|||||||
drawer.accept(tile, entity);
|
drawer.accept(tile, entity);
|
||||||
|
|
||||||
if(Draw.hasRegion(name + "-heat")){
|
if(Draw.hasRegion(name + "-heat")){
|
||||||
Graphics.setAdditiveBlending();
|
heatDrawer.accept(tile, entity);
|
||||||
Draw.color(Palette.turretHeat);
|
|
||||||
Draw.alpha(entity.heat);
|
|
||||||
Draw.rect(name + "-heat", tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
|
|
||||||
Graphics.setNormalBlending();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw.color();
|
Draw.color();
|
||||||
@@ -144,9 +148,11 @@ public abstract class Turret extends Block{
|
|||||||
|
|
||||||
if(entity.target != null){
|
if(entity.target != null){
|
||||||
AmmoType type = peekAmmo(tile);
|
AmmoType type = peekAmmo(tile);
|
||||||
|
float speed = type.bullet.speed;
|
||||||
|
if(speed < 0.1f) speed = 9999999f;
|
||||||
|
|
||||||
float targetRot = Angles.predictAngle(tile.worldx(), tile.worldy(),
|
float targetRot = Angles.predictAngle(tile.worldx(), tile.worldy(),
|
||||||
entity.target.x, entity.target.y, entity.target.velocity.x, entity.target.velocity.y, type.bullet.speed);
|
entity.target.x, entity.target.y, entity.target.velocity.x, entity.target.velocity.y, speed);
|
||||||
|
|
||||||
if(Float.isNaN(entity.rotation)){
|
if(Float.isNaN(entity.rotation)){
|
||||||
entity.rotation = 0;
|
entity.rotation = 0;
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import io.anuke.mindustry.world.blocks.types.defense.Turret;
|
|||||||
import io.anuke.ucore.util.Strings;
|
import io.anuke.ucore.util.Strings;
|
||||||
|
|
||||||
public abstract class PowerTurret extends Turret {
|
public abstract class PowerTurret extends Turret {
|
||||||
public float powerUsed = 0.5f;
|
protected float powerUsed = 0.5f;
|
||||||
|
protected AmmoType shootType;
|
||||||
|
|
||||||
public PowerTurret(String name) {
|
public PowerTurret(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
@@ -21,12 +22,17 @@ public abstract class PowerTurret extends Turret {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasAmmo(Tile tile){
|
public boolean hasAmmo(Tile tile){
|
||||||
return tile.entity.power.amount >= powerUsed && super.hasAmmo(tile);
|
return tile.entity.power.amount >= powerUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AmmoType useAmmo(Tile tile){
|
public AmmoType useAmmo(Tile tile){
|
||||||
tile.entity.power.amount -= powerUsed;
|
tile.entity.power.amount -= powerUsed;
|
||||||
return super.useAmmo(tile);
|
return shootType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AmmoType peekAmmo(Tile tile) {
|
||||||
|
return shootType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user