MoveLightning ability bullet support
This commit is contained in:
@@ -1312,7 +1312,7 @@ public class Blocks implements ContentList{
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
waterExtractor = new SolidPump("water-extractor"){{
|
waterExtractor = new SolidPump("water-extractor"){{
|
||||||
requirements(Category.production, with(Items.copper, 25, Items.graphite, 25, Items.lead, 20));
|
requirements(Category.production, with(Items.copper, 30, Items.graphite, 30, Items.lead, 30));
|
||||||
result = Liquids.water;
|
result = Liquids.water;
|
||||||
pumpAmount = 0.11f;
|
pumpAmount = 0.11f;
|
||||||
size = 2;
|
size = 2;
|
||||||
|
|||||||
@@ -1,31 +1,35 @@
|
|||||||
package mindustry.entities.abilities;
|
package mindustry.entities.abilities;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
|
import arc.audio.*;
|
||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.audio.*;
|
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
|
import mindustry.entities.bullet.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.graphics.*;
|
|
||||||
|
|
||||||
public class MoveLightningAbility extends Ability{
|
public class MoveLightningAbility extends Ability{
|
||||||
//Lightning damage
|
/** Lightning damage */
|
||||||
public float damage = 35f;
|
public float damage = 35f;
|
||||||
//Chance of firing every tick. Set >= 1 to always fire lightning every tick at max speed.
|
/** Chance of firing every tick. Set >= 1 to always fire lightning every tick at max speed. */
|
||||||
public float chance = 0.15f;
|
public float chance = 0.15f;
|
||||||
//Length of the lightning
|
/** Length of the lightning. <= 0 to disable */
|
||||||
public int length = 12;
|
public int length = 12;
|
||||||
//Speeds for when to start lightninging and when to stop getting faster
|
/** Speeds for when to start lightninging and when to stop getting faster */
|
||||||
public float minSpeed = 0.8f, maxSpeed = 1.2f;
|
public float minSpeed = 0.8f, maxSpeed = 1.2f;
|
||||||
//Lightning color
|
/** Lightning color */
|
||||||
public Color color = Color.valueOf("a9d8ff");
|
public Color color = Color.valueOf("a9d8ff");
|
||||||
//Shifts where the lightning spawns along the Y axis
|
/** Shifts where the lightning spawns along the Y axis */
|
||||||
public float offset = 0f;
|
public float offset = 0f;
|
||||||
//Jittering heat sprite like the shield on v5 Javelin
|
/** Jittering heat sprite like the shield on v5 Javelin */
|
||||||
public String heatRegion = "error";
|
public String heatRegion = "error";
|
||||||
|
/** Bullet type that is fired. Can be null */
|
||||||
|
public @Nullable BulletType bullet;
|
||||||
|
/** Bullet angle parameters */
|
||||||
|
public float bulletAngle = 0f, bulletSpread = 0f;
|
||||||
|
|
||||||
public Effect shootEffect = Fx.sparkShoot;
|
public Effect shootEffect = Fx.sparkShoot;
|
||||||
public Sound shootSound = Sounds.spark;
|
public Sound shootSound = Sounds.spark;
|
||||||
@@ -58,9 +62,17 @@ public class MoveLightningAbility extends Ability{
|
|||||||
float scl = Mathf.clamp((unit.vel().len() - minSpeed) / (maxSpeed - minSpeed));
|
float scl = Mathf.clamp((unit.vel().len() - minSpeed) / (maxSpeed - minSpeed));
|
||||||
if(Mathf.chance(Time.delta * chance * scl)){
|
if(Mathf.chance(Time.delta * chance * scl)){
|
||||||
float x = unit.x + Angles.trnsx(unit.rotation, offset, 0), y = unit.y + Angles.trnsy(unit.rotation, offset, 0);
|
float x = unit.x + Angles.trnsx(unit.rotation, offset, 0), y = unit.y + Angles.trnsy(unit.rotation, offset, 0);
|
||||||
|
|
||||||
shootEffect.at(x, y, unit.rotation, color);
|
shootEffect.at(x, y, unit.rotation, color);
|
||||||
Lightning.create(unit.team, color, damage, x + unit.vel.x, y + unit.vel.y, unit.rotation, length);
|
|
||||||
shootSound.at(unit);
|
shootSound.at(unit);
|
||||||
|
|
||||||
|
if(length > 0){
|
||||||
|
Lightning.create(unit.team, color, damage, x + unit.vel.x, y + unit.vel.y, unit.rotation, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bullet != null){
|
||||||
|
bullet.create(unit, unit.team, x, y, unit.rotation + bulletAngle + Mathf.range(bulletSpread));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user