mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-16 10:47:40 +07:00
Definition of all bullet types listed on trello
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
package io.anuke.mindustry.content;
|
||||
|
||||
import io.anuke.mindustry.content.bullets.ShellBullets;
|
||||
import io.anuke.mindustry.content.bullets.StandardBullets;
|
||||
import io.anuke.mindustry.content.bullets.TurretBullets;
|
||||
import io.anuke.mindustry.content.fx.ShootFx;
|
||||
import io.anuke.mindustry.type.AmmoType;
|
||||
@ -8,91 +10,91 @@ public class AmmoTypes {
|
||||
//TODO add definitions for all ammo types
|
||||
public static final AmmoType
|
||||
|
||||
basicIron = new AmmoType(Items.iron, TurretBullets.basicIron, 5){{
|
||||
basicIron = new AmmoType(Items.iron, StandardBullets.basicIron, 5){{
|
||||
shootEffect = ShootFx.shootSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
}},
|
||||
|
||||
basicLead = new AmmoType(Items.lead, TurretBullets.basicIron, 5){{
|
||||
basicLead = new AmmoType(Items.lead, StandardBullets.basicLead, 5){{
|
||||
shootEffect = ShootFx.shootSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
}},
|
||||
|
||||
basicLeadFlak = new AmmoType(Items.lead, TurretBullets.basicIron, 5){{
|
||||
standardLead = new AmmoType(AmmoItems.leadBullet, StandardBullets.standardLead, 5){{
|
||||
shootEffect = ShootFx.shootSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
}},
|
||||
|
||||
standardLead = new AmmoType(AmmoItems.leadBullet, TurretBullets.basicIron, 5){{
|
||||
shootEffect = ShootFx.shootSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
}},
|
||||
|
||||
standardLeadFlak = new AmmoType(AmmoItems.leadBullet, TurretBullets.basicIron, 5){{
|
||||
shootEffect = ShootFx.shootSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
}},
|
||||
|
||||
compositeFlak = new AmmoType(AmmoItems.compositeFlak, TurretBullets.basicIron, 5){{
|
||||
shootEffect = ShootFx.shootSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
}},
|
||||
|
||||
standardArmorPiercing = new AmmoType(AmmoItems.armorPiercingBullet, TurretBullets.basicSteel, 5){{
|
||||
standardArmorPiercing = new AmmoType(AmmoItems.armorPiercingBullet, StandardBullets.standardArmorPiercing, 5){{
|
||||
shootEffect = ShootFx.shootBig;
|
||||
smokeEffect = ShootFx.shootBigSmoke;
|
||||
}},
|
||||
|
||||
homing = new AmmoType(AmmoItems.homingBullet, TurretBullets.basicSteel, 5){{
|
||||
standardHoming = new AmmoType(AmmoItems.homingBullet, StandardBullets.standardHoming, 5){{
|
||||
shootEffect = ShootFx.shootBig;
|
||||
smokeEffect = ShootFx.shootBigSmoke;
|
||||
}},
|
||||
|
||||
tracer = new AmmoType(AmmoItems.tracerBullet, TurretBullets.basicSteel, 5){{
|
||||
standardTracer = new AmmoType(AmmoItems.tracerBullet, StandardBullets.standardTracer, 5){{
|
||||
shootEffect = ShootFx.shootBig;
|
||||
smokeEffect = ShootFx.shootBigSmoke;
|
||||
}},
|
||||
|
||||
basicLeadFlak = new AmmoType(Items.lead, StandardBullets.basicLeadFlak, 5){{
|
||||
shootEffect = ShootFx.shootSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
}},
|
||||
|
||||
standardLeadFlak = new AmmoType(AmmoItems.leadBullet, StandardBullets.standardLeadFlak, 5){{
|
||||
shootEffect = ShootFx.shootSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
}},
|
||||
|
||||
compositeFlak = new AmmoType(AmmoItems.compositeFlak, StandardBullets.compositeFlak, 5){{
|
||||
shootEffect = ShootFx.shootSmall;
|
||||
smokeEffect = ShootFx.shootSmallSmoke;
|
||||
}},
|
||||
|
||||
basicFlame = new AmmoType(Liquids.oil, TurretBullets.basicFlame, 0.3f){{
|
||||
shootEffect = ShootFx.shootSmallFlame;
|
||||
}},
|
||||
|
||||
basicLeadShell = new AmmoType(Items.lead, TurretBullets.basicLeadFragShell, 1){{
|
||||
basicLeadShell = new AmmoType(Items.lead, ShellBullets.basicLeadShell, 1){{
|
||||
shootEffect = ShootFx.shootBig2;
|
||||
smokeEffect = ShootFx.shootBigSmoke2;
|
||||
}},
|
||||
|
||||
explosiveFragShell = new AmmoType(AmmoItems.explosiveShell, TurretBullets.basicLeadFragShell, 1){{
|
||||
explosiveFragShell = new AmmoType(AmmoItems.explosiveShell, ShellBullets.explosiveShell, 1){{
|
||||
shootEffect = ShootFx.shootBig2;
|
||||
smokeEffect = ShootFx.shootBigSmoke2;
|
||||
}},
|
||||
|
||||
fragShell = new AmmoType(AmmoItems.fragShell, TurretBullets.basicLeadFragShell, 1){{
|
||||
fragShell = new AmmoType(AmmoItems.fragShell, ShellBullets.fragShell, 1){{
|
||||
shootEffect = ShootFx.shootBig2;
|
||||
smokeEffect = ShootFx.shootBigSmoke2;
|
||||
}},
|
||||
|
||||
standardThoriumShell = new AmmoType(AmmoItems.thoriumShell, TurretBullets.basicLeadFragShell, 1){{
|
||||
standardThoriumShell = new AmmoType(AmmoItems.thoriumShell, ShellBullets.thoriumShell, 1){{
|
||||
shootEffect = ShootFx.shootBig2;
|
||||
smokeEffect = ShootFx.shootBigSmoke2;
|
||||
}},
|
||||
|
||||
swarmMissile = new AmmoType(AmmoItems.swarmMissile, TurretBullets.basicLeadFragShell, 1){{
|
||||
swarmMissile = new AmmoType(AmmoItems.swarmMissile, ShellBullets.swarmMissile, 1){{
|
||||
shootEffect = ShootFx.shootBig2;
|
||||
smokeEffect = ShootFx.shootBigSmoke2;
|
||||
}},
|
||||
|
||||
scytheMissile = new AmmoType(AmmoItems.scytheMissile, TurretBullets.basicLeadFragShell, 1){{
|
||||
scytheMissile = new AmmoType(AmmoItems.scytheMissile, ShellBullets.scytheMissile, 1){{
|
||||
shootEffect = ShootFx.shootBig2;
|
||||
smokeEffect = ShootFx.shootBigSmoke2;
|
||||
}},
|
||||
|
||||
incendiaryMortar = new AmmoType(AmmoItems.incendiaryMortarShell, TurretBullets.basicLeadFragShell, 1){{
|
||||
incendiaryMortar = new AmmoType(AmmoItems.incendiaryMortarShell, ShellBullets.incendiaryMortar, 1){{
|
||||
shootEffect = ShootFx.shootBig2;
|
||||
smokeEffect = ShootFx.shootBigSmoke2;
|
||||
}},
|
||||
|
||||
surgeMortar = new AmmoType(AmmoItems.surgeMortarShell, TurretBullets.basicLeadFragShell, 1){{
|
||||
surgeMortar = new AmmoType(AmmoItems.surgeMortarShell, ShellBullets.surgeMortar, 1){{
|
||||
shootEffect = ShootFx.shootBig2;
|
||||
smokeEffect = ShootFx.shootBigSmoke2;
|
||||
}},
|
||||
|
@ -15,7 +15,7 @@ public class WeaponBlocks{
|
||||
public static Block
|
||||
|
||||
duo = new DoubleTurret("duo"){{
|
||||
ammoTypes = new AmmoType[]{AmmoTypes.basicIron, AmmoTypes.basicLead, AmmoTypes.standardLead, AmmoTypes.tracer};
|
||||
ammoTypes = new AmmoType[]{AmmoTypes.basicIron, AmmoTypes.basicLead, AmmoTypes.standardLead, AmmoTypes.standardTracer};
|
||||
reload = 25f;
|
||||
restitution = 0.03f;
|
||||
ammoUseEffect = ShootFx.shellEjectSmall;
|
||||
|
166
core/src/io/anuke/mindustry/content/bullets/ShellBullets.java
Normal file
166
core/src/io/anuke/mindustry/content/bullets/ShellBullets.java
Normal file
@ -0,0 +1,166 @@
|
||||
package io.anuke.mindustry.content.bullets;
|
||||
|
||||
import io.anuke.mindustry.content.fx.BulletFx;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.bullet.BasicBulletType;
|
||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||
|
||||
public class ShellBullets {
|
||||
public static final BulletType
|
||||
|
||||
basicLeadShell = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
hiteffect = BulletFx.flakExplosion;
|
||||
knockback = 0.8f;
|
||||
lifetime = 90f;
|
||||
drag = 0.01f;
|
||||
bulletWidth = bulletHeight = 9f;
|
||||
fragBullet = basicLeadShard;
|
||||
bulletSprite = "frag";
|
||||
bulletShrink = 0.1f;
|
||||
}
|
||||
},
|
||||
|
||||
basicLeadShard = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
drag = 0.1f;
|
||||
hiteffect = Fx.none;
|
||||
despawneffect = Fx.none;
|
||||
hitsize = 4;
|
||||
lifetime = 20f;
|
||||
bulletWidth = 9f;
|
||||
bulletHeight = 11f;
|
||||
bulletShrink = 1f;
|
||||
}
|
||||
},
|
||||
|
||||
explosiveShell = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
hiteffect = BulletFx.flakExplosion;
|
||||
knockback = 0.8f;
|
||||
lifetime = 90f;
|
||||
drag = 0.01f;
|
||||
bulletWidth = bulletHeight = 9f;
|
||||
fragBullet = basicLeadShard;
|
||||
bulletSprite = "frag";
|
||||
bulletShrink = 0.1f;
|
||||
}
|
||||
},
|
||||
|
||||
explosiveShard = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
drag = 0.1f;
|
||||
hiteffect = Fx.none;
|
||||
despawneffect = Fx.none;
|
||||
hitsize = 4;
|
||||
lifetime = 20f;
|
||||
bulletWidth = 9f;
|
||||
bulletHeight = 11f;
|
||||
bulletShrink = 1f;
|
||||
}
|
||||
},
|
||||
|
||||
fragShell = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
hiteffect = BulletFx.flakExplosion;
|
||||
knockback = 0.8f;
|
||||
lifetime = 90f;
|
||||
drag = 0.01f;
|
||||
bulletWidth = bulletHeight = 9f;
|
||||
fragBullet = basicLeadShard;
|
||||
bulletSprite = "frag";
|
||||
bulletShrink = 0.1f;
|
||||
}
|
||||
},
|
||||
|
||||
fragShard = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
drag = 0.1f;
|
||||
hiteffect = Fx.none;
|
||||
despawneffect = Fx.none;
|
||||
hitsize = 4;
|
||||
lifetime = 20f;
|
||||
bulletWidth = 9f;
|
||||
bulletHeight = 11f;
|
||||
bulletShrink = 1f;
|
||||
}
|
||||
},
|
||||
|
||||
thoriumShell = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
hiteffect = BulletFx.flakExplosion;
|
||||
knockback = 0.8f;
|
||||
lifetime = 90f;
|
||||
drag = 0.01f;
|
||||
bulletWidth = bulletHeight = 9f;
|
||||
fragBullet = basicLeadShard;
|
||||
bulletSprite = "frag";
|
||||
bulletShrink = 0.1f;
|
||||
}
|
||||
},
|
||||
|
||||
thoriumShard = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
drag = 0.1f;
|
||||
hiteffect = Fx.none;
|
||||
despawneffect = Fx.none;
|
||||
hitsize = 4;
|
||||
lifetime = 20f;
|
||||
bulletWidth = 9f;
|
||||
bulletHeight = 11f;
|
||||
bulletShrink = 1f;
|
||||
}
|
||||
},
|
||||
|
||||
swarmMissile = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
hiteffect = BulletFx.flakExplosion;
|
||||
knockback = 0.8f;
|
||||
lifetime = 90f;
|
||||
drag = 0.01f;
|
||||
bulletWidth = bulletHeight = 9f;
|
||||
fragBullet = basicLeadShard;
|
||||
bulletSprite = "frag";
|
||||
bulletShrink = 0.1f;
|
||||
}
|
||||
},
|
||||
|
||||
scytheMissile = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
hiteffect = BulletFx.flakExplosion;
|
||||
knockback = 0.8f;
|
||||
lifetime = 90f;
|
||||
drag = 0.01f;
|
||||
bulletWidth = bulletHeight = 9f;
|
||||
fragBullet = basicLeadShard;
|
||||
bulletSprite = "frag";
|
||||
bulletShrink = 0.1f;
|
||||
}
|
||||
},
|
||||
|
||||
incendiaryMortar = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
hiteffect = BulletFx.flakExplosion;
|
||||
knockback = 0.8f;
|
||||
lifetime = 90f;
|
||||
drag = 0.01f;
|
||||
bulletWidth = bulletHeight = 9f;
|
||||
fragBullet = basicLeadShard;
|
||||
bulletSprite = "frag";
|
||||
bulletShrink = 0.1f;
|
||||
}
|
||||
},
|
||||
|
||||
surgeMortar = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
hiteffect = BulletFx.flakExplosion;
|
||||
knockback = 0.8f;
|
||||
lifetime = 90f;
|
||||
drag = 0.01f;
|
||||
bulletWidth = bulletHeight = 9f;
|
||||
fragBullet = basicLeadShard;
|
||||
bulletSprite = "frag";
|
||||
bulletShrink = 0.1f;
|
||||
}
|
||||
};
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package io.anuke.mindustry.content.bullets;
|
||||
|
||||
import io.anuke.mindustry.entities.bullet.BasicBulletType;
|
||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||
|
||||
public class StandardBullets {
|
||||
public static final BulletType
|
||||
|
||||
basicIron = new BasicBulletType(3f, 5) {
|
||||
{
|
||||
bulletWidth = 7f;
|
||||
bulletHeight = 9f;
|
||||
}
|
||||
},
|
||||
|
||||
basicLead = new BasicBulletType(3f, 5) {
|
||||
{
|
||||
bulletWidth = 7f;
|
||||
bulletHeight = 9f;
|
||||
}
|
||||
},
|
||||
|
||||
standardLead = new BasicBulletType(3f, 5) {
|
||||
{
|
||||
bulletWidth = 7f;
|
||||
bulletHeight = 9f;
|
||||
}
|
||||
},
|
||||
|
||||
standardArmorPiercing = new BasicBulletType(3f, 5) {
|
||||
{
|
||||
bulletWidth = 7f;
|
||||
bulletHeight = 9f;
|
||||
}
|
||||
},
|
||||
|
||||
standardHoming = new BasicBulletType(3f, 5) {
|
||||
{
|
||||
bulletWidth = 7f;
|
||||
bulletHeight = 9f;
|
||||
}
|
||||
},
|
||||
|
||||
standardTracer = new BasicBulletType(3f, 5) {
|
||||
{
|
||||
bulletWidth = 7f;
|
||||
bulletHeight = 9f;
|
||||
}
|
||||
},
|
||||
|
||||
basicLeadFlak = new BasicBulletType(3f, 5) {
|
||||
{
|
||||
bulletWidth = 7f;
|
||||
bulletHeight = 9f;
|
||||
}
|
||||
},
|
||||
|
||||
standardLeadFlak = new BasicBulletType(3f, 5) {
|
||||
{
|
||||
bulletWidth = 7f;
|
||||
bulletHeight = 9f;
|
||||
}
|
||||
},
|
||||
|
||||
compositeFlak = new BasicBulletType(3f, 5) {
|
||||
{
|
||||
bulletWidth = 7f;
|
||||
bulletHeight = 9f;
|
||||
}
|
||||
};
|
||||
}
|
@ -1,31 +1,26 @@
|
||||
package io.anuke.mindustry.content.bullets;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import io.anuke.mindustry.content.Liquids;
|
||||
import io.anuke.mindustry.content.StatusEffects;
|
||||
import io.anuke.mindustry.content.fx.BulletFx;
|
||||
import io.anuke.mindustry.content.fx.EnvironmentFx;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.bullet.BasicBulletType;
|
||||
import io.anuke.mindustry.entities.bullet.Bullet;
|
||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||
import io.anuke.mindustry.entities.bullet.LiquidBulletType;
|
||||
import io.anuke.mindustry.entities.effect.DamageArea;
|
||||
import io.anuke.mindustry.entities.effect.Fire;
|
||||
import io.anuke.mindustry.entities.effect.Lightning;
|
||||
import io.anuke.mindustry.entities.effect.Puddle;
|
||||
import io.anuke.mindustry.graphics.Palette;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.graphics.Lines;
|
||||
import io.anuke.ucore.util.Geometry;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class TurretBullets {
|
||||
@ -71,49 +66,6 @@ public class TurretBullets {
|
||||
}
|
||||
},
|
||||
|
||||
basicIron = new BasicBulletType(3f, 5) {
|
||||
{
|
||||
bulletWidth = 7f;
|
||||
bulletHeight = 9f;
|
||||
}
|
||||
},
|
||||
|
||||
basicSteel = new BasicBulletType(6f, 0) {
|
||||
{
|
||||
hiteffect = BulletFx.hitBulletBig;
|
||||
knockback = 0.5f;
|
||||
bulletWidth = 9f;
|
||||
bulletHeight = 11f;
|
||||
}
|
||||
},
|
||||
|
||||
basicLeadFragShell = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
hiteffect = BulletFx.flakExplosion;
|
||||
knockback = 0.8f;
|
||||
lifetime = 90f;
|
||||
drag = 0.01f;
|
||||
bulletWidth = bulletHeight = 9f;
|
||||
fragBullet = basicLeadFrag;
|
||||
bulletSprite = "frag";
|
||||
bulletShrink = 0.1f;
|
||||
}
|
||||
},
|
||||
|
||||
basicLeadFrag = new BasicBulletType(3f, 0) {
|
||||
{
|
||||
drag = 0.1f;
|
||||
hiteffect = Fx.none;
|
||||
despawneffect = Fx.none;
|
||||
hitsize = 4;
|
||||
lifetime = 20f;
|
||||
bulletWidth = 9f;
|
||||
bulletHeight = 11f;
|
||||
bulletShrink = 1f;
|
||||
//todo scaling
|
||||
}
|
||||
},
|
||||
|
||||
basicFlame = new BulletType(2f, 0) {
|
||||
{
|
||||
hitsize = 7f;
|
||||
@ -165,20 +117,20 @@ public class TurretBullets {
|
||||
}
|
||||
},
|
||||
|
||||
waterShot = new LiquidShot(Liquids.water) {
|
||||
waterShot = new LiquidBulletType(Liquids.water) {
|
||||
{
|
||||
status = StatusEffects.wet;
|
||||
statusIntensity = 0.5f;
|
||||
knockback = 0.65f;
|
||||
}
|
||||
},
|
||||
cryoShot = new LiquidShot(Liquids.cryofluid) {
|
||||
cryoShot = new LiquidBulletType(Liquids.cryofluid) {
|
||||
{
|
||||
status = StatusEffects.freezing;
|
||||
statusIntensity = 0.5f;
|
||||
}
|
||||
},
|
||||
lavaShot = new LiquidShot(Liquids.lava) {
|
||||
lavaShot = new LiquidBulletType(Liquids.lava) {
|
||||
{
|
||||
damage = 4;
|
||||
speed = 1.9f;
|
||||
@ -187,7 +139,7 @@ public class TurretBullets {
|
||||
statusIntensity = 0.5f;
|
||||
}
|
||||
},
|
||||
oilShot = new LiquidShot(Liquids.oil) {
|
||||
oilShot = new LiquidBulletType(Liquids.oil) {
|
||||
{
|
||||
speed = 2f;
|
||||
drag = 0.03f;
|
||||
@ -203,49 +155,11 @@ public class TurretBullets {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Bullet b) {
|
||||
|
||||
}
|
||||
public void draw(Bullet b) {}
|
||||
|
||||
@Override
|
||||
public void init(Bullet b) {
|
||||
Lightning.create(b.team, hiteffect, Palette.lancerLaser, damage, b.x, b.y, b.angle(), 30);
|
||||
}
|
||||
};
|
||||
|
||||
private abstract static class LiquidShot extends BulletType{
|
||||
Liquid liquid;
|
||||
|
||||
public LiquidShot(Liquid liquid) {
|
||||
super(2.5f, 0);
|
||||
this.liquid = liquid;
|
||||
|
||||
lifetime = 70f;
|
||||
despawneffect = Fx.none;
|
||||
hiteffect = BulletFx.hitLiquid;
|
||||
drag = 0.01f;
|
||||
knockback = 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Bullet b) {
|
||||
Draw.color(liquid.color, Color.WHITE, b.fout() / 100f + Mathf.randomSeedRange(b.id, 0.1f));
|
||||
|
||||
Fill.circle(b.x, b.y, 0.5f + b.fout()*2.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hit(Bullet b, float hitx, float hity) {
|
||||
Effects.effect(hiteffect, liquid.color, hitx, hity);
|
||||
Puddle.deposit(world.tileWorld(hitx, hity), liquid, 5f);
|
||||
|
||||
if(liquid.temperature <= 0.5f && liquid.flammability < 0.3f){
|
||||
float intensity = 400f;
|
||||
Fire.extinguish(world.tileWorld(hitx, hity), intensity);
|
||||
for(GridPoint2 p : Geometry.d4){
|
||||
Fire.extinguish(world.tileWorld(hitx + p.x*tilesize, hity + p.y*tilesize), intensity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +0,0 @@
|
||||
package io.anuke.mindustry.content.bullets;
|
||||
|
||||
public class UnitBullets {
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package io.anuke.mindustry.content.bullets;
|
||||
|
||||
import io.anuke.mindustry.entities.bullet.Bullet;
|
||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
||||
|
||||
public class WeaponBullets {
|
||||
public static final BulletType
|
||||
|
||||
none = new BulletType(0f, 0) {
|
||||
@Override
|
||||
public void draw(Bullet b) {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
@ -70,6 +70,11 @@ public class Player extends Unit implements BlockBuilder {
|
||||
heal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getArmor() {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteShoot(BulletType type, float x, float y, float rotation, short data) {
|
||||
Weapon weapon = Upgrade.getByID(Bits.getLeftByte(data));
|
||||
|
@ -178,6 +178,7 @@ public abstract class Unit extends SyncEntity implements SerializableEntity {
|
||||
public void drawUnder(){}
|
||||
public void drawOver(){}
|
||||
|
||||
public abstract float getArmor();
|
||||
public abstract boolean acceptsAmmo(Item item);
|
||||
public abstract void addAmmo(Item item);
|
||||
public abstract float getMass();
|
||||
|
@ -7,10 +7,16 @@ import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.entities.BaseBulletType;
|
||||
|
||||
public abstract class BulletType extends BaseBulletType<Bullet>{
|
||||
/**Knockback in velocity.*/
|
||||
public float knockback;
|
||||
/**Whether this bullet hits tiles.*/
|
||||
public boolean hitTiles = true;
|
||||
/**Status effect applied on hit.*/
|
||||
public StatusEffect status = StatusEffects.none;
|
||||
/**Intensity of applied status effect in terms of duration.*/
|
||||
public float statusIntensity = 0.5f;
|
||||
/**What fraction of armor is pierced, 0-1*/
|
||||
public float armorPierce = 0f;
|
||||
|
||||
public BulletType(float speed, float damage){
|
||||
this.speed = speed;
|
||||
|
@ -0,0 +1,53 @@
|
||||
package io.anuke.mindustry.entities.bullet;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.GridPoint2;
|
||||
import io.anuke.mindustry.content.fx.BulletFx;
|
||||
import io.anuke.mindustry.content.fx.Fx;
|
||||
import io.anuke.mindustry.entities.effect.Fire;
|
||||
import io.anuke.mindustry.entities.effect.Puddle;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.ucore.core.Effects;
|
||||
import io.anuke.ucore.graphics.Draw;
|
||||
import io.anuke.ucore.graphics.Fill;
|
||||
import io.anuke.ucore.util.Geometry;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
|
||||
import static io.anuke.mindustry.Vars.tilesize;
|
||||
import static io.anuke.mindustry.Vars.world;
|
||||
|
||||
public class LiquidBulletType extends BulletType {
|
||||
Liquid liquid;
|
||||
|
||||
public LiquidBulletType(Liquid liquid) {
|
||||
super(2.5f, 0);
|
||||
this.liquid = liquid;
|
||||
|
||||
lifetime = 70f;
|
||||
despawneffect = Fx.none;
|
||||
hiteffect = BulletFx.hitLiquid;
|
||||
drag = 0.01f;
|
||||
knockback = 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Bullet b) {
|
||||
Draw.color(liquid.color, Color.WHITE, b.fout() / 100f + Mathf.randomSeedRange(b.id, 0.1f));
|
||||
|
||||
Fill.circle(b.x, b.y, 0.5f + b.fout()*2.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hit(Bullet b, float hitx, float hity) {
|
||||
Effects.effect(hiteffect, liquid.color, hitx, hity);
|
||||
Puddle.deposit(world.tileWorld(hitx, hity), liquid, 5f);
|
||||
|
||||
if(liquid.temperature <= 0.5f && liquid.flammability < 0.3f){
|
||||
float intensity = 400f;
|
||||
Fire.extinguish(world.tileWorld(hitx, hity), intensity);
|
||||
for(GridPoint2 p : Geometry.d4){
|
||||
Fire.extinguish(world.tileWorld(hitx + p.x*tilesize, hity + p.y*tilesize), intensity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -55,6 +55,11 @@ public class BaseUnit extends Unit{
|
||||
this.state.set(this, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getArmor() {
|
||||
return type.armor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsAmmo(Item item) {
|
||||
return type.ammo.containsKey(item) && inventory.canAcceptAmmo(type.ammo.get(item));
|
||||
|
@ -44,6 +44,7 @@ public abstract class UnitType {
|
||||
protected float maxVelocity = 5f;
|
||||
protected float reload = 40f;
|
||||
protected float retreatPercent = 0.2f;
|
||||
protected float armor = 0f;
|
||||
protected ObjectMap<Item, AmmoType> ammo = new ObjectMap<>();
|
||||
|
||||
public UnitType(String name){
|
||||
|
Reference in New Issue
Block a user