Removed every single bullet type, breaking everything
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Sun Apr 01 10:41:23 EDT 2018
|
#Sun Apr 01 11:42:10 EDT 2018
|
||||||
version=release
|
version=release
|
||||||
androidBuildCode=807
|
androidBuildCode=809
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.4
|
code=3.4
|
||||||
build=custom build
|
build=custom build
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package io.anuke.mindustry.content;
|
package io.anuke.mindustry.content;
|
||||||
|
|
||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
import io.anuke.mindustry.graphics.fx.BulletFx;
|
import io.anuke.mindustry.graphics.fx.BulletFx;
|
||||||
import io.anuke.mindustry.resource.Weapon;
|
import io.anuke.mindustry.resource.Weapon;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package io.anuke.mindustry.content.blocks;
|
|||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import io.anuke.mindustry.content.Items;
|
import io.anuke.mindustry.content.Items;
|
||||||
import io.anuke.mindustry.content.Liquids;
|
import io.anuke.mindustry.content.Liquids;
|
||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
import io.anuke.mindustry.entities.effect.TeslaOrb;
|
import io.anuke.mindustry.entities.effect.TeslaOrb;
|
||||||
import io.anuke.mindustry.graphics.fx.BulletFx;
|
import io.anuke.mindustry.graphics.fx.BulletFx;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.utils.IntMap;
|
import com.badlogic.gdx.utils.IntMap;
|
||||||
import com.badlogic.gdx.utils.IntSet;
|
import com.badlogic.gdx.utils.IntSet;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.SyncEntity;
|
import io.anuke.mindustry.entities.SyncEntity;
|
||||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import io.anuke.mindustry.content.Mechs;
|
|||||||
import io.anuke.mindustry.content.Recipes;
|
import io.anuke.mindustry.content.Recipes;
|
||||||
import io.anuke.mindustry.content.UpgradeRecipes;
|
import io.anuke.mindustry.content.UpgradeRecipes;
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
import io.anuke.mindustry.entities.Player;
|
import io.anuke.mindustry.entities.Player;
|
||||||
import io.anuke.mindustry.entities.SyncEntity;
|
import io.anuke.mindustry.entities.SyncEntity;
|
||||||
import io.anuke.mindustry.game.EventType.GameOverEvent;
|
import io.anuke.mindustry.game.EventType.GameOverEvent;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.anuke.mindustry.entities;
|
package io.anuke.mindustry.entities;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.ucore.entities.BulletEntity;
|
import io.anuke.ucore.entities.BulletEntity;
|
||||||
@@ -12,14 +13,14 @@ public class Bullet extends BulletEntity{
|
|||||||
public Timer timer = new Timer(3);
|
public Timer timer = new Timer(3);
|
||||||
public Team team;
|
public Team team;
|
||||||
|
|
||||||
public Bullet(BulletType type, Unit owner, float x, float y, float angle){
|
public Bullet(io.anuke.mindustry.entities.bullets.BulletType type, Unit owner, float x, float y, float angle){
|
||||||
super(type, owner, angle);
|
super(type, owner, angle);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.team = owner.team;
|
this.team = owner.team;
|
||||||
set(x, y);
|
set(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bullet(BulletType type, Entity owner, Team team, float x, float y, float angle){
|
public Bullet(io.anuke.mindustry.entities.bullets.BulletType type, Entity owner, Team team, float x, float y, float angle){
|
||||||
super(type, owner, angle);
|
super(type, owner, angle);
|
||||||
this.team = team;
|
this.team = team;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|||||||
@@ -1,486 +0,0 @@
|
|||||||
package io.anuke.mindustry.entities;
|
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
|
||||||
import io.anuke.mindustry.entities.effect.DamageArea;
|
|
||||||
import io.anuke.mindustry.entities.effect.EMP;
|
|
||||||
import io.anuke.mindustry.graphics.fx.BlockFx;
|
|
||||||
import io.anuke.mindustry.graphics.fx.BulletFx;
|
|
||||||
import io.anuke.mindustry.graphics.fx.Fx;
|
|
||||||
import io.anuke.ucore.core.Effects;
|
|
||||||
import io.anuke.ucore.core.Timers;
|
|
||||||
import io.anuke.ucore.entities.BaseBulletType;
|
|
||||||
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 static io.anuke.mindustry.graphics.fx.Fx.*;
|
|
||||||
|
|
||||||
public abstract class BulletType extends BaseBulletType<Bullet>{
|
|
||||||
|
|
||||||
public static final BulletType
|
|
||||||
|
|
||||||
none = new BulletType(0f, 0){
|
|
||||||
public void draw(Bullet b){}
|
|
||||||
},
|
|
||||||
stone = new BulletType(1.5f, 2){
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.colorl(0.64f);
|
|
||||||
Draw.rect("blank", b.x, b.y, 2f, 2f);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
iron = new BulletType(1.7f, 2){
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(Color.GRAY);
|
|
||||||
Draw.rect("bullet", b.x, b.y, b.angle());
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
chain = new BulletType(2f, 8){
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(whiteOrange);
|
|
||||||
Draw.rect("chainbullet", b.x, b.y, b.angle());
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sniper = new BulletType(3f, 25){
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(Color.LIGHT_GRAY);
|
|
||||||
Lines.stroke(1f);
|
|
||||||
Lines.lineAngleCenter(b.x, b.y, b.angle(), 3f);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update(Bullet b){
|
|
||||||
if(b.timer.get(0, 4)){
|
|
||||||
Effects.effect(BulletFx.railsmoke, b.x, b.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
emp = new BulletType(1.6f, 8){
|
|
||||||
{
|
|
||||||
lifetime = 50f;
|
|
||||||
hitsize = 6f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b){
|
|
||||||
float rad = 6f + Mathf.sin(Timers.time(), 5f, 2f);
|
|
||||||
|
|
||||||
Draw.color(Color.SKY);
|
|
||||||
Lines.circle(b.x, b.y, 4f);
|
|
||||||
Draw.rect("circle", b.x, b.y, rad, rad);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update(Bullet b){
|
|
||||||
if(b.timer.get(0, 2)){
|
|
||||||
Effects.effect(BulletFx.empspark, b.x + Mathf.range(2), b.y + Mathf.range(2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void despawned(Bullet b){
|
|
||||||
hit(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hit(Bullet b, float hitx, float hity){
|
|
||||||
Timers.run(5f, ()-> new EMP(b.x, b.y, b.getDamage()).add());
|
|
||||||
Effects.effect(BulletFx.empshockwave, b);
|
|
||||||
Effects.shake(3f, 3f, b);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//TODO better visuals for shell
|
|
||||||
shell = new BulletType(1.1f, 60){
|
|
||||||
{
|
|
||||||
lifetime = 110f;
|
|
||||||
hitsize = 11f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b){
|
|
||||||
float rad = 8f;
|
|
||||||
Draw.color(Color.ORANGE);
|
|
||||||
Draw.color(Color.GRAY);
|
|
||||||
Draw.rect("circle", b.x, b.y, rad, rad);
|
|
||||||
rad += Mathf.sin(Timers.time(), 3f, 1f);
|
|
||||||
Draw.color(Color.ORANGE);
|
|
||||||
Draw.rect("circle", b.x, b.y, rad/1.7f, rad/1.7f);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update(Bullet b){
|
|
||||||
if(b.timer.get(0, 7)){
|
|
||||||
Effects.effect(Fx.smoke, b.x + Mathf.range(2), b.y + Mathf.range(2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void despawned(Bullet b){
|
|
||||||
hit(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hit(Bullet b, float hitx, float hity){
|
|
||||||
Effects.shake(3f, 3f, b);
|
|
||||||
|
|
||||||
Effects.effect(BulletFx.shellsmoke, b);
|
|
||||||
Effects.effect(BulletFx.shellexplosion, b);
|
|
||||||
|
|
||||||
DamageArea.damage(b.team, b.x, b.y, 25f, (int)(damage * 2f/3f));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
flak = new BulletType(2.9f, 8) {
|
|
||||||
|
|
||||||
public void init(Bullet b) {
|
|
||||||
b.velocity.scl(Mathf.random(0.6f, 1f));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update(Bullet b){
|
|
||||||
if(b.timer.get(0, 7)){
|
|
||||||
Effects.effect(Fx.smoke, b.x + Mathf.range(2), b.y + Mathf.range(2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b) {
|
|
||||||
Draw.color(Color.GRAY);
|
|
||||||
Lines.stroke(3f);
|
|
||||||
Lines.lineAngleCenter(b.x, b.y, b.angle(), 2f);
|
|
||||||
Lines.stroke(1.5f);
|
|
||||||
Lines.lineAngleCenter(b.x, b.y, b.angle(), 5f);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hit(Bullet b, float hitx, float hity) {
|
|
||||||
Effects.effect(BulletFx.shellsmoke, b);
|
|
||||||
for(int i = 0; i < 3; i ++){
|
|
||||||
Bullet bullet = new Bullet(flakspark, b, hitx, hity, b.angle() + Mathf.range(120f));
|
|
||||||
bullet.add();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void despawned(Bullet b) {
|
|
||||||
hit(b, b.x, b.y);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
flakspark = new BulletType(2f, 2) {
|
|
||||||
{
|
|
||||||
drag = 0.05f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init(Bullet b) {
|
|
||||||
b.velocity.scl(Mathf.random(0.6f, 1f));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b) {
|
|
||||||
Draw.color(Color.LIGHT_GRAY, Color.GRAY, b.ifract());
|
|
||||||
Lines.stroke(2f - b.ifract());
|
|
||||||
Lines.lineAngleCenter(b.x, b.y, b.angle(), 2f);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
titanshell = new BulletType(1.8f, 38){
|
|
||||||
{
|
|
||||||
lifetime = 70f;
|
|
||||||
hitsize = 15f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(whiteOrange);
|
|
||||||
Draw.rect("titanshell", b.x, b.y, b.angle());
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update(Bullet b){
|
|
||||||
if(b.timer.get(0, 4)){
|
|
||||||
Effects.effect(Fx.smoke, b.x + Mathf.range(2), b.y + Mathf.range(2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void despawned(Bullet b){
|
|
||||||
hit(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hit(Bullet b, float hitx, float hity){
|
|
||||||
Effects.shake(3f, 3f, b);
|
|
||||||
|
|
||||||
Effects.effect(BulletFx.shellsmoke, b);
|
|
||||||
Effects.effect(BulletFx.shockwaveSmall, b);
|
|
||||||
|
|
||||||
DamageArea.damage(b.team, b.x, b.y, 50f, (int)(damage * 2f/3f));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
yellowshell = new BulletType(1.2f, 20){
|
|
||||||
{
|
|
||||||
lifetime = 60f;
|
|
||||||
hitsize = 11f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(whiteYellow);
|
|
||||||
Draw.rect("titanshell", b.x, b.y, b.angle());
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update(Bullet b){
|
|
||||||
if(b.timer.get(0, 4)){
|
|
||||||
Effects.effect(Fx.smoke, b.x + Mathf.range(2), b.y + Mathf.range(2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void despawned(Bullet b){
|
|
||||||
hit(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hit(Bullet b, float hitx, float hity){
|
|
||||||
Effects.shake(3f, 3f, b);
|
|
||||||
|
|
||||||
Effects.effect(BulletFx.shellsmoke, b);
|
|
||||||
Effects.effect(BulletFx.shockwaveSmall, b);
|
|
||||||
|
|
||||||
DamageArea.damage(b.team, b.x, b.y, 25f, (int)(damage * 2f/3f));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
blast = new BulletType(1.1f, 90){
|
|
||||||
{
|
|
||||||
lifetime = 0f;
|
|
||||||
hitsize = 8f;
|
|
||||||
speed = 0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void despawned(Bullet b){
|
|
||||||
hit(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hit(Bullet b, float hitx, float hity){
|
|
||||||
Effects.shake(3f, 3f, b);
|
|
||||||
|
|
||||||
Effects.effect(BlockFx.blastsmoke, b);
|
|
||||||
Effects.effect(BulletFx.blastexplosion, b);
|
|
||||||
|
|
||||||
//TODO remove translation() usage
|
|
||||||
Angles.circleVectors(30, 6f, (nx, ny) -> {
|
|
||||||
float ang = Mathf.atan2(nx, ny);
|
|
||||||
Bullet o = new Bullet(blastshot, b, b.x + nx, b.y + ny, ang).add();
|
|
||||||
o.damage = b.damage/9;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b){}
|
|
||||||
},
|
|
||||||
blastshot = new BulletType(1.6f, 6){
|
|
||||||
{
|
|
||||||
lifetime = 7f;
|
|
||||||
}
|
|
||||||
public void draw(Bullet b){}
|
|
||||||
},
|
|
||||||
small = new BulletType(1.5f, 2){
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(glowy);
|
|
||||||
Draw.rect("shot", b.x, b.y, b.angle() - 45);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
smallSlow = new BulletType(1.2f, 2){
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(Color.ORANGE);
|
|
||||||
Draw.rect("shot", b.x, b.y, b.angle() - 45);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
purple = new BulletType(1.6f, 2){
|
|
||||||
Color color = new Color(0x8b5ec9ff);
|
|
||||||
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(color);
|
|
||||||
Draw.rect("bullet", b.x, b.y, b.angle());
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
flame = new BulletType(0.7f, 5){ //for turrets
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(Color.YELLOW, Color.SCARLET, b.time/lifetime);
|
|
||||||
float size = 6f-b.time/lifetime*5f;
|
|
||||||
Draw.rect("circle", b.x, b.y, size, size);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plasmaflame = new BulletType(0.8f, 17){
|
|
||||||
{
|
|
||||||
lifetime = 65f;
|
|
||||||
}
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(Color.valueOf("efa66c"), Color.valueOf("72deaf"), b.time/lifetime);
|
|
||||||
float size = 7f-b.time/lifetime*6f;
|
|
||||||
Draw.rect("circle", b.x, b.y, size, size);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
flameshot = new BulletType(0.5f, 3){ //for enemies
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(Color.ORANGE, Color.SCARLET, b.time/lifetime);
|
|
||||||
float size = 6f-b.time/lifetime*5f;
|
|
||||||
Draw.rect("circle", b.x, b.y, size, size);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
shot = new BulletType(2.7f, 5){
|
|
||||||
{
|
|
||||||
lifetime = 40;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(Color.WHITE, lightOrange, b.fract()/2f + 0.25f);
|
|
||||||
Lines.stroke(1.5f);
|
|
||||||
Lines.lineAngle(b.x, b.y, b.angle(), 3f);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
spread = new BulletType(2.4f, 9) {
|
|
||||||
{
|
|
||||||
lifetime = 70;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b) {
|
|
||||||
float size = 3f - b.ifract()*1f;
|
|
||||||
|
|
||||||
Draw.color(Color.PURPLE, Color.WHITE, 0.8f);
|
|
||||||
Lines.stroke(1f);
|
|
||||||
Lines.circle(b.x, b.y, size);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cluster = new BulletType(4.5f, 12){
|
|
||||||
{
|
|
||||||
lifetime = 60;
|
|
||||||
drag = 0.05f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Lines.stroke(2f);
|
|
||||||
Draw.color(lightOrange, Color.WHITE, 0.4f);
|
|
||||||
Lines.poly(b.x, b.y, 3, 1.6f, b.angle());
|
|
||||||
Lines.stroke(1f);
|
|
||||||
Draw.color(Color.WHITE, lightOrange, b.ifract()/2f);
|
|
||||||
Draw.alpha(b.ifract());
|
|
||||||
Lines.spikes(b.x, b.y, 1.5f, 2f, 6);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void despawned(Bullet b){
|
|
||||||
hit(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hit(Bullet b, float hitx, float hity){
|
|
||||||
Effects.shake(1.5f, 1.5f, b);
|
|
||||||
|
|
||||||
Effects.effect(BulletFx.clusterbomb, b);
|
|
||||||
|
|
||||||
DamageArea.damage(b.team, b.x, b.y, 35f, damage);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
vulcan = new BulletType(4.5f, 12) {
|
|
||||||
{
|
|
||||||
lifetime = 50;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init(Bullet b) {
|
|
||||||
Timers.reset(b, "smoke", Mathf.random(4f));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b){
|
|
||||||
Draw.color(lightGray);
|
|
||||||
Lines.stroke(1f);
|
|
||||||
Lines.lineAngleCenter(b.x, b.y, b.angle(), 2f);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update(Bullet b){
|
|
||||||
if(b.timer.get(0, 4)){
|
|
||||||
Effects.effect(BulletFx.chainsmoke, b.x, b.y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
shockshell = new BulletType(5.5f, 11) {
|
|
||||||
|
|
||||||
{
|
|
||||||
drag = 0.03f;
|
|
||||||
lifetime = 30f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init(Bullet b) {
|
|
||||||
b.velocity.scl(Mathf.random(0.5f, 1f));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b) {
|
|
||||||
Draw.color(Color.WHITE, Color.ORANGE, b.ifract());
|
|
||||||
Lines.stroke(2f);
|
|
||||||
Lines.lineAngleCenter(b.x, b.y, b.angle(), b.fract()*5f);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void despawned(Bullet b) {
|
|
||||||
hit(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void hit(Bullet b, float hitx, float hity) {
|
|
||||||
for(int i = 0; i < 4; i ++){
|
|
||||||
Bullet bullet = new Bullet(scrap, b, b.x, b.y, b.angle() + Mathf.range(80f));
|
|
||||||
bullet.add();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scrap = new BulletType(2f, 3) {
|
|
||||||
{
|
|
||||||
drag = 0.06f;
|
|
||||||
lifetime = 30f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init(Bullet b) {
|
|
||||||
b.velocity.scl(Mathf.random(0.5f, 1f));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b) {
|
|
||||||
Draw.color(Color.WHITE, Color.ORANGE, b.ifract());
|
|
||||||
Lines.stroke(1f);
|
|
||||||
Lines.lineAngleCenter(b.x, b.y, b.angle(), b.fract()*4f);
|
|
||||||
Draw.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
beamlaser = new BulletType(0.001f, 38) {
|
|
||||||
float length = 230f;
|
|
||||||
{
|
|
||||||
drawSize = length*2f+20f;
|
|
||||||
lifetime = 15f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init(Bullet b) {
|
|
||||||
DamageArea.damageLine(b.team, BulletFx.beamhit, b.x, b.y, b.angle(), length, damage);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Bullet b) {
|
|
||||||
float f = b.fract()*1.5f;
|
|
||||||
|
|
||||||
Draw.color(beam);
|
|
||||||
Draw.rect("circle", b.x, b.y, 6f*f, 6f*f);
|
|
||||||
Lines.stroke(3f * f);
|
|
||||||
Lines.lineAngle(b.x, b.y, b.angle(), length);
|
|
||||||
|
|
||||||
Lines.stroke(2f * f);
|
|
||||||
Lines.lineAngle(b.x, b.y, b.angle(), length + 6f);
|
|
||||||
Lines.stroke(1f * f);
|
|
||||||
Lines.lineAngle(b.x, b.y, b.angle(), length + 12f);
|
|
||||||
|
|
||||||
Draw.color(beamLight);
|
|
||||||
Lines.stroke(1.5f * f);
|
|
||||||
Draw.rect("circle", b.x, b.y, 3f*f, 3f*f);
|
|
||||||
Lines.lineAngle(b.x, b.y, b.angle(), length);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private BulletType(float speed, int damage){
|
|
||||||
this.speed = speed;
|
|
||||||
this.damage = damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void hit(Bullet b, float hitx, float hity){
|
|
||||||
Effects.effect(Fx.hit, hitx, hity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.math.Vector2;
|
|||||||
import io.anuke.mindustry.content.Mechs;
|
import io.anuke.mindustry.content.Mechs;
|
||||||
import io.anuke.mindustry.content.Weapons;
|
import io.anuke.mindustry.content.Weapons;
|
||||||
import io.anuke.mindustry.content.blocks.Blocks;
|
import io.anuke.mindustry.content.blocks.Blocks;
|
||||||
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.mindustry.graphics.fx.ExplosionFx;
|
import io.anuke.mindustry.graphics.fx.ExplosionFx;
|
||||||
import io.anuke.mindustry.graphics.fx.Fx;
|
import io.anuke.mindustry.graphics.fx.Fx;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx;
|
|||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.math.Vector3;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
import com.badlogic.gdx.utils.TimeUtils;
|
import com.badlogic.gdx.utils.TimeUtils;
|
||||||
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.entities.DestructibleEntity;
|
import io.anuke.ucore.entities.DestructibleEntity;
|
||||||
import io.anuke.ucore.util.Mathf;
|
import io.anuke.ucore.util.Mathf;
|
||||||
|
|||||||
19
core/src/io/anuke/mindustry/entities/bullets/BulletType.java
Normal file
19
core/src/io/anuke/mindustry/entities/bullets/BulletType.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package io.anuke.mindustry.entities.bullets;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.entities.Bullet;
|
||||||
|
import io.anuke.mindustry.graphics.fx.Fx;
|
||||||
|
import io.anuke.ucore.core.Effects;
|
||||||
|
import io.anuke.ucore.entities.BaseBulletType;
|
||||||
|
|
||||||
|
public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||||
|
|
||||||
|
private BulletType(float speed, int damage){
|
||||||
|
this.speed = speed;
|
||||||
|
this.damage = damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hit(Bullet b, float hitx, float hity){
|
||||||
|
Effects.effect(Fx.hit, hitx, hity);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package io.anuke.mindustry.entities.bullets;
|
||||||
|
|
||||||
|
public class TurretBullets {
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package io.anuke.mindustry.entities.bullets;
|
||||||
|
|
||||||
|
public class UnitBullets {
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package io.anuke.mindustry.entities.bullets;
|
||||||
|
|
||||||
|
public class WeaponBullets {
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package io.anuke.mindustry.entities.units;
|
package io.anuke.mindustry.entities.units;
|
||||||
|
|
||||||
import io.anuke.mindustry.entities.Bullet;
|
import io.anuke.mindustry.entities.Bullet;
|
||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
import io.anuke.mindustry.entities.Unit;
|
import io.anuke.mindustry.entities.Unit;
|
||||||
import io.anuke.mindustry.game.Team;
|
import io.anuke.mindustry.game.Team;
|
||||||
import io.anuke.ucore.entities.Entity;
|
import io.anuke.ucore.entities.Entity;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.entities.units;
|
|||||||
|
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.utils.ObjectSet;
|
import com.badlogic.gdx.utils.ObjectSet;
|
||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
import io.anuke.mindustry.entities.Unit;
|
import io.anuke.mindustry.entities.Unit;
|
||||||
import io.anuke.mindustry.game.TeamInfo.TeamData;
|
import io.anuke.mindustry.game.TeamInfo.TeamData;
|
||||||
import io.anuke.mindustry.graphics.fx.Fx;
|
import io.anuke.mindustry.graphics.fx.Fx;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.entities.units;
|
|||||||
|
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.utils.ObjectSet;
|
import com.badlogic.gdx.utils.ObjectSet;
|
||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
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.game.TeamInfo.TeamData;
|
import io.anuke.mindustry.game.TeamInfo.TeamData;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.entities.units;
|
|||||||
|
|
||||||
import com.badlogic.gdx.utils.Array;
|
import com.badlogic.gdx.utils.Array;
|
||||||
import io.anuke.mindustry.entities.Bullet;
|
import io.anuke.mindustry.entities.Bullet;
|
||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
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.graphics.fx.ExplosionFx;
|
import io.anuke.mindustry.graphics.fx.ExplosionFx;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package io.anuke.mindustry.game;
|
package io.anuke.mindustry.game;
|
||||||
|
|
||||||
import io.anuke.mindustry.core.GameState.State;
|
import io.anuke.mindustry.core.GameState.State;
|
||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
import io.anuke.mindustry.entities.TileEntity;
|
import io.anuke.mindustry.entities.TileEntity;
|
||||||
import io.anuke.mindustry.entities.units.BaseUnit;
|
import io.anuke.mindustry.entities.units.BaseUnit;
|
||||||
import io.anuke.mindustry.resource.Weapon;
|
import io.anuke.mindustry.resource.Weapon;
|
||||||
|
|||||||
8
core/src/io/anuke/mindustry/resource/AmmoType.java
Normal file
8
core/src/io/anuke/mindustry/resource/AmmoType.java
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package io.anuke.mindustry.resource;
|
||||||
|
|
||||||
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
|
|
||||||
|
public abstract class AmmoType {
|
||||||
|
|
||||||
|
public abstract BulletType getBullet(Item item);
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ package io.anuke.mindustry.resource;
|
|||||||
|
|
||||||
import io.anuke.mindustry.Vars;
|
import io.anuke.mindustry.Vars;
|
||||||
import io.anuke.mindustry.entities.Bullet;
|
import io.anuke.mindustry.entities.Bullet;
|
||||||
import io.anuke.mindustry.entities.BulletType;
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
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.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.types.defense;
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color;
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import io.anuke.mindustry.entities.*;
|
import io.anuke.mindustry.entities.*;
|
||||||
|
import io.anuke.mindustry.entities.bullets.BulletType;
|
||||||
import io.anuke.mindustry.graphics.fx.Fx;
|
import io.anuke.mindustry.graphics.fx.Fx;
|
||||||
import io.anuke.mindustry.graphics.Layer;
|
import io.anuke.mindustry.graphics.Layer;
|
||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
@@ -37,7 +38,7 @@ public class Turret extends Block{
|
|||||||
protected float shotTransation = 2;
|
protected float shotTransation = 2;
|
||||||
protected float shotDelayScale = 0;
|
protected float shotDelayScale = 0;
|
||||||
protected String shootsound = "shoot";
|
protected String shootsound = "shoot";
|
||||||
protected BulletType bullet = BulletType.iron;
|
protected io.anuke.mindustry.entities.bullets.BulletType bullet = BulletType.iron;
|
||||||
protected Item ammo;
|
protected Item ammo;
|
||||||
protected int ammoMultiplier = 20;
|
protected int ammoMultiplier = 20;
|
||||||
protected int maxammo = 400;
|
protected int maxammo = 400;
|
||||||
@@ -48,6 +49,7 @@ public class Turret extends Block{
|
|||||||
protected int soundReload = 0;
|
protected int soundReload = 0;
|
||||||
protected Translator tr = new Translator();
|
protected Translator tr = 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 ShootStyle style = ShootStyle.normal;
|
||||||
|
|
||||||
public Turret(String name) {
|
public Turret(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
@@ -149,11 +151,8 @@ public class Turret extends Block{
|
|||||||
entity.rotation = Mathf.slerpDelta(entity.rotation, targetRot,
|
entity.rotation = Mathf.slerpDelta(entity.rotation, targetRot,
|
||||||
rotatespeed);
|
rotatespeed);
|
||||||
|
|
||||||
if(Angles.angleDist(entity.rotation, targetRot) < shootCone && entity.timer.get(timerReload, reload)){
|
if(Angles.angleDist(entity.rotation, targetRot) < shootCone/* && entity.timer.get(timerReload, reload)*/){
|
||||||
if(shootsound != null && entity.timer.get(timerSound, soundReload)) Effects.sound(shootsound, entity);
|
style.shoot(this, entity);
|
||||||
shoot(tile);
|
|
||||||
consumeAmmo(tile);
|
|
||||||
entity.ammo --;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,7 +215,6 @@ public class Turret extends Block{
|
|||||||
bullet(tile, entity.rotation + Mathf.range(inaccuracy));
|
bullet(tile, entity.rotation + Mathf.range(inaccuracy));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Effects.effect(shootEffect, tile.drawx() + tr.x,
|
Effects.effect(shootEffect, tile.drawx() + tr.x,
|
||||||
@@ -235,6 +233,32 @@ public class Turret extends Block{
|
|||||||
public TileEntity getEntity(){
|
public TileEntity getEntity(){
|
||||||
return new TurretEntity();
|
return new TurretEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ShootStyle{
|
||||||
|
normal{
|
||||||
|
void shoot(Turret turret, TurretEntity entity){
|
||||||
|
if(entity.timer.get(turret.timerReload, turret.reload)){
|
||||||
|
if(turret.shootsound != null && entity.timer.get(turret.timerSound, turret.soundReload))
|
||||||
|
Effects.sound(turret.shootsound, entity);
|
||||||
|
turret.consumeAmmo(entity.tile);
|
||||||
|
entity.ammo --;
|
||||||
|
|
||||||
|
turret.tr.trns(entity.rotation, turret.size * tilesize/2);
|
||||||
|
|
||||||
|
turret.bullet(entity.tile, entity.rotation + Mathf.range(turret.inaccuracy));
|
||||||
|
|
||||||
|
Effects.effect(turret.shootEffect, entity.tile.drawx() + turret.tr.x,
|
||||||
|
entity.tile.drawy() + turret.tr.y, entity.rotation);
|
||||||
|
|
||||||
|
if(turret.shootShake > 0){
|
||||||
|
Effects.shake(turret.shootShake, turret.shootShake, entity.tile.entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
abstract void shoot(Turret turret, TurretEntity entity);
|
||||||
|
}
|
||||||
|
|
||||||
public static class TurretEntity extends TileEntity{
|
public static class TurretEntity extends TileEntity{
|
||||||
public TileEntity blockTarget;
|
public TileEntity blockTarget;
|
||||||
|
|||||||
Reference in New Issue
Block a user