mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-12 08:48:09 +07:00
Fixed lightning / Implemented delta ability and gun
This commit is contained in:
@ -36,10 +36,9 @@ public class AmmoTypes implements ContentList{
|
|||||||
inaccuracy = 2f;
|
inaccuracy = 2f;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
shotgunTungsten = new AmmoType(WeaponBullets.tungstenShotgun){{
|
shotgunTungsten = new AmmoType(TurretBullets.lightning){{
|
||||||
shootEffect = ShootFx.shootBig;
|
shootEffect = BulletFx.hitLancer;
|
||||||
smokeEffect = ShootFx.shootBigSmoke;
|
smokeEffect = Fx.none;
|
||||||
recoil = 1f;
|
|
||||||
}};
|
}};
|
||||||
|
|
||||||
shellCarbide = new AmmoType(WeaponBullets.shellCarbide){{
|
shellCarbide = new AmmoType(WeaponBullets.shellCarbide){{
|
||||||
|
@ -4,11 +4,13 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
import com.badlogic.gdx.math.Rectangle;
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
|
import io.anuke.mindustry.content.fx.BulletFx;
|
||||||
import io.anuke.mindustry.content.fx.UnitFx;
|
import io.anuke.mindustry.content.fx.UnitFx;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.Unit;
|
import io.anuke.mindustry.entities.Unit;
|
||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.Units;
|
||||||
import io.anuke.mindustry.entities.effect.Fire;
|
import io.anuke.mindustry.entities.effect.Fire;
|
||||||
|
import io.anuke.mindustry.entities.effect.Lightning;
|
||||||
import io.anuke.mindustry.game.Content;
|
import io.anuke.mindustry.game.Content;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
import io.anuke.mindustry.graphics.Shaders;
|
import io.anuke.mindustry.graphics.Shaders;
|
||||||
@ -57,13 +59,17 @@ public class Mechs implements ContentList{
|
|||||||
weapon = Weapons.shockgun;
|
weapon = Weapons.shockgun;
|
||||||
trailColorTo = Color.valueOf("d3ddff");
|
trailColorTo = Color.valueOf("d3ddff");
|
||||||
maxSpeed = 5f;
|
maxSpeed = 5f;
|
||||||
altChargeAlpha = 0.05f;
|
altChargeAlpha = 0.03f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateAlt(Player player){
|
public void updateAlt(Player player){
|
||||||
if(player.altHeat > 0.01f){
|
if(player.altHeat >= 0.91f){
|
||||||
player.applyEffect(StatusEffects.overdrive, 0.1f);
|
Effects.shake(3f, 3f, player);
|
||||||
|
for(int i = 0; i < 8; i++){
|
||||||
|
Timers.run(Mathf.random(5f), () -> Lightning.create(player.getTeam(), BulletFx.hitLancer, player.getTeam().color, 10f, player.x, player.y, Mathf.random(360f), 20));
|
||||||
|
}
|
||||||
|
player.altHeat = 0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,13 +65,12 @@ public class Weapons implements ContentList{
|
|||||||
|
|
||||||
shockgun = new Weapon("shockgun"){{
|
shockgun = new Weapon("shockgun"){{
|
||||||
length = 1f;
|
length = 1f;
|
||||||
reload = 50f;
|
reload = 40f;
|
||||||
roundrobin = true;
|
roundrobin = true;
|
||||||
shots = 6;
|
shots = 1;
|
||||||
inaccuracy = 10f;
|
inaccuracy = 0f;
|
||||||
velocityRnd = 0.7f;
|
velocityRnd = 0.2f;
|
||||||
shake = 2f;
|
ejectEffect = Fx.none;
|
||||||
ejectEffect = ShootFx.shellEjectSmall;
|
|
||||||
ammo = AmmoTypes.shotgunTungsten;
|
ammo = AmmoTypes.shotgunTungsten;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class TurretBullets extends BulletList implements ContentList{
|
|||||||
@Override
|
@Override
|
||||||
public void load(){
|
public void load(){
|
||||||
|
|
||||||
healBullet = new BulletType(5.2f, 25){
|
healBullet = new BulletType(5.2f, 19){
|
||||||
float healAmount = 20f;
|
float healAmount = 20f;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,6 @@ import io.anuke.mindustry.entities.bullet.Bullet;
|
|||||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||||
import io.anuke.mindustry.entities.effect.Fire;
|
import io.anuke.mindustry.entities.effect.Fire;
|
||||||
import io.anuke.mindustry.entities.effect.ItemDrop;
|
import io.anuke.mindustry.entities.effect.ItemDrop;
|
||||||
import io.anuke.mindustry.entities.effect.Lightning;
|
|
||||||
import io.anuke.mindustry.entities.effect.Puddle;
|
import io.anuke.mindustry.entities.effect.Puddle;
|
||||||
import io.anuke.mindustry.entities.traits.TypeTrait;
|
import io.anuke.mindustry.entities.traits.TypeTrait;
|
||||||
import io.anuke.mindustry.entities.units.UnitType;
|
import io.anuke.mindustry.entities.units.UnitType;
|
||||||
@ -171,6 +170,5 @@ public class ContentLoader{
|
|||||||
TypeTrait.registerType(Fire.class, Fire::new);
|
TypeTrait.registerType(Fire.class, Fire::new);
|
||||||
TypeTrait.registerType(Puddle.class, Puddle::new);
|
TypeTrait.registerType(Puddle.class, Puddle::new);
|
||||||
TypeTrait.registerType(Bullet.class, Bullet::new);
|
TypeTrait.registerType(Bullet.class, Bullet::new);
|
||||||
TypeTrait.registerType(Lightning.class, Lightning::new);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import io.anuke.annotations.Annotations.Loc;
|
|||||||
import io.anuke.annotations.Annotations.Remote;
|
import io.anuke.annotations.Annotations.Remote;
|
||||||
import io.anuke.mindustry.content.StatusEffects;
|
import io.anuke.mindustry.content.StatusEffects;
|
||||||
import io.anuke.mindustry.entities.Units;
|
import io.anuke.mindustry.entities.Units;
|
||||||
import io.anuke.mindustry.entities.traits.SyncTrait;
|
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.gen.Call;
|
import io.anuke.mindustry.gen.Call;
|
||||||
import io.anuke.mindustry.graphics.Palette;
|
import io.anuke.mindustry.graphics.Palette;
|
||||||
@ -26,14 +25,10 @@ import io.anuke.ucore.util.Mathf;
|
|||||||
import io.anuke.ucore.util.Pooling;
|
import io.anuke.ucore.util.Pooling;
|
||||||
import io.anuke.ucore.util.SeedRandom;
|
import io.anuke.ucore.util.SeedRandom;
|
||||||
|
|
||||||
import java.io.DataInput;
|
|
||||||
import java.io.DataOutput;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.bulletGroup;
|
import static io.anuke.mindustry.Vars.bulletGroup;
|
||||||
|
|
||||||
//TODO utterly broken
|
//TODO utterly broken
|
||||||
public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncTrait{
|
public class Lightning extends TimedEntity implements Poolable, DrawTrait{
|
||||||
private static Array<SolidTrait> entities = new Array<>();
|
private static Array<SolidTrait> entities = new Array<>();
|
||||||
private static Rectangle rect = new Rectangle();
|
private static Rectangle rect = new Rectangle();
|
||||||
private static Rectangle hitrect = new Rectangle();
|
private static Rectangle hitrect = new Rectangle();
|
||||||
@ -67,7 +62,7 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
|||||||
l.random.setSeed(seed);
|
l.random.setSeed(seed);
|
||||||
l.color = color;
|
l.color = color;
|
||||||
|
|
||||||
float step = 3f;
|
float step = 4f;
|
||||||
float range = 6f;
|
float range = 6f;
|
||||||
float attractRange = 20f;
|
float attractRange = 20f;
|
||||||
|
|
||||||
@ -111,7 +106,7 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
|||||||
});
|
});
|
||||||
|
|
||||||
if(l.random.chance(0.1f)){
|
if(l.random.chance(0.1f)){
|
||||||
createLighting(l.random.nextInt(), team, effect, color, damage, x2, y2, angle + l.random.range(100f), length / 3);
|
createLighting(l.random.nextInt(), team, effect, color, damage, x2, y2, angle + l.random.range(30f), length / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
x = x2;
|
x = x2;
|
||||||
@ -122,21 +117,6 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
|||||||
l.add();
|
l.add();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSyncing(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void write(DataOutput data) throws IOException{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void read(DataInput data, long time) throws IOException{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float lifetime(){
|
public float lifetime(){
|
||||||
return 10;
|
return 10;
|
||||||
@ -144,12 +124,14 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset(){
|
public void reset(){
|
||||||
|
super.reset();
|
||||||
color = Palette.lancerLaser;
|
color = Palette.lancerLaser;
|
||||||
lines.clear();
|
lines.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removed(){
|
public void removed(){
|
||||||
|
super.removed();
|
||||||
Pooling.free(this);
|
Pooling.free(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ public class BuildBlock extends Block{
|
|||||||
|
|
||||||
if(recipe != null){
|
if(recipe != null){
|
||||||
Draw.rect(recipe.result.shadowRegion, tile.drawx(), tile.drawy());
|
Draw.rect(recipe.result.shadowRegion, tile.drawx(), tile.drawy());
|
||||||
}else if(previous != null){
|
}else if(previous != null && !(previous instanceof BuildBlock)){
|
||||||
previous.drawShadow(tile);
|
previous.drawShadow(tile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user