a rather large merge

This commit is contained in:
Anuken
2019-01-07 21:10:57 -05:00
169 changed files with 4143 additions and 4928 deletions

View File

@@ -5,7 +5,7 @@ import io.anuke.arc.collection.*;
import io.anuke.arc.function.Predicate;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Geometry;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.game.EventType.TileChangeEvent;
import io.anuke.mindustry.game.EventType.WorldLoadEvent;

View File

@@ -5,7 +5,7 @@ import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.GridBits;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Structs;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.entities.units.BaseUnit;
import io.anuke.mindustry.entities.units.Squad;
import io.anuke.mindustry.game.EventType.WorldLoadEvent;

View File

@@ -1,254 +0,0 @@
package io.anuke.mindustry.content;
import io.anuke.mindustry.content.bullets.*;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.content.fx.ShootFx;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.AmmoType;
import io.anuke.mindustry.type.ContentType;
public class AmmoTypes implements ContentList{
public static AmmoType
bulletCopper, bulletDense, bulletThorium, bulletSilicon, bulletPyratite,
bulletDenseBig, bulletPyratiteBig, bulletThoriumBig,
shock, bombExplosive, bombIncendiary, bombOil, shellCarbide, flamerThermite, weaponMissile, weaponMissileSwarm, bulletMech,
healBlaster, bulletGlaive,
flakExplosive, flakPlastic, flakSurge,
missileExplosive, missileIncindiary, missileSurge,
artilleryDense, artilleryPlastic, artilleryHoming, artilleryIncindiary, artilleryExplosive, unitArtillery,
basicFlame, lancerLaser, lightning, meltdownLaser, burstLaser,
fuseShotgun, oil, water, lava, cryofluid, arc;
@Override
public void load(){
//weapon specific
bulletMech = new AmmoType(StandardBullets.mechSmall){{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
reloadMultiplier = 1f;
inaccuracy = 5f;
}};
bulletGlaive = new AmmoType(Items.pyratite, StandardBullets.glaive, 3){{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
inaccuracy = 3f;
}};
healBlaster = new AmmoType(TurretBullets.healBullet){{
shootEffect = ShootFx.shootHeal;
smokeEffect = BulletFx.hitLaser;
reloadMultiplier = 1f;
inaccuracy = 2f;
}};
shock = new AmmoType(TurretBullets.lightning){{
shootEffect = BulletFx.hitLancer;
smokeEffect = Fx.none;
}};
shellCarbide = new AmmoType(WeaponBullets.shellCarbide){{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
}};
bombExplosive = new AmmoType(WeaponBullets.bombExplosive){{
shootEffect = Fx.none;
smokeEffect = Fx.none;
}};
bombIncendiary = new AmmoType(WeaponBullets.bombIncendiary){{
shootEffect = Fx.none;
smokeEffect = Fx.none;
}};
bombOil = new AmmoType(WeaponBullets.bombOil){{
shootEffect = Fx.none;
smokeEffect = Fx.none;
}};
flamerThermite = new AmmoType(TurretBullets.basicFlame){{
shootEffect = ShootFx.shootSmallFlame;
}};
weaponMissile = new AmmoType(MissileBullets.javelin){{
shootEffect = BulletFx.hitBulletSmall;
smokeEffect = Fx.none;
reloadMultiplier = 1.2f;
}};
weaponMissileSwarm = new AmmoType(MissileBullets.swarm){{
shootEffect = BulletFx.hitBulletSmall;
smokeEffect = ShootFx.shootSmallSmoke;
reloadMultiplier = 1.2f;
}};
//bullets
bulletCopper = new AmmoType(Items.copper, StandardBullets.copper, 5){{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
reloadMultiplier = 1f;
inaccuracy = 5f;
}};
bulletDense = new AmmoType(Items.densealloy, StandardBullets.dense, 2){{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
reloadMultiplier = 0.6f;
}};
bulletThorium = new AmmoType(Items.thorium, StandardBullets.thorium, 2){{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
}};
bulletSilicon = new AmmoType(Items.silicon, StandardBullets.homing, 5){{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
reloadMultiplier = 1.4f;
}};
bulletPyratite = new AmmoType(Items.pyratite, StandardBullets.tracer, 3){{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
inaccuracy = 3f;
}};
bulletDenseBig = new AmmoType(Items.densealloy, StandardBullets.denseBig, 1){{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
}};
bulletThoriumBig = new AmmoType(Items.thorium, StandardBullets.thoriumBig, 1){{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
}};
bulletPyratiteBig = new AmmoType(Items.pyratite, StandardBullets.tracerBig, 2){{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
inaccuracy = 3f;
}};
//flak
flakExplosive = new AmmoType(Items.blastCompound, FlakBullets.explosive, 5){{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
}};
flakPlastic = new AmmoType(Items.plastanium, FlakBullets.plastic, 5){{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
}};
flakSurge = new AmmoType(Items.surgealloy, FlakBullets.surge, 5){{
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
reloadMultiplier = 1/2f;
}};
//missiles
missileExplosive = new AmmoType(Items.blastCompound, MissileBullets.explosive, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
reloadMultiplier = 1.2f;
}};
missileIncindiary = new AmmoType(Items.pyratite, MissileBullets.incindiary, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
reloadMultiplier = 1.0f;
}};
missileSurge = new AmmoType(Items.surgealloy, MissileBullets.surge, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
reloadMultiplier = 1.1f;
}};
//artillery
artilleryDense = new AmmoType(Items.densealloy, ArtilleryBullets.dense, 2){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}};
artilleryPlastic = new AmmoType(Items.plastanium, ArtilleryBullets.plastic, 2){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
reloadMultiplier = 1.4f;
}};
artilleryHoming = new AmmoType(Items.silicon, ArtilleryBullets.homing, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
reloadMultiplier = 0.9f;
}};
artilleryIncindiary = new AmmoType(Items.pyratite, ArtilleryBullets.incindiary, 2){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
reloadMultiplier = 1.2f;
}};
artilleryExplosive = new AmmoType(Items.blastCompound, ArtilleryBullets.explosive, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
reloadMultiplier = 1.6f;
}};
unitArtillery = new AmmoType(Items.blastCompound, ArtilleryBullets.unit, 1){{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
reloadMultiplier = 1.6f;
}};
//flame
basicFlame = new AmmoType(Liquids.oil, TurretBullets.basicFlame, 0.3f){{
shootEffect = ShootFx.shootSmallFlame;
}};
//power
lancerLaser = new AmmoType(TurretBullets.lancerLaser);
burstLaser = new AmmoType(TurretBullets.burstLaser){{
range = 60f;
}};
lightning = new AmmoType(TurretBullets.lightning);
arc = new AmmoType(TurretBullets.arc);
meltdownLaser = new AmmoType(TurretBullets.meltdownLaser);
fuseShotgun = new AmmoType(Items.densealloy, TurretBullets.fuseShot, 1f){{
shootEffect = Fx.none;
smokeEffect = ShootFx.shootBigSmoke2;
}};
//liquid
oil = new AmmoType(Liquids.oil, TurretBullets.oilShot, 0.3f);
water = new AmmoType(Liquids.water, TurretBullets.waterShot, 0.3f);
lava = new AmmoType(Liquids.lava, TurretBullets.lavaShot, 0.3f);
cryofluid = new AmmoType(Liquids.cryofluid, TurretBullets.cryoShot, 0.3f);
}
@Override
public ContentType type(){
return ContentType.ammo;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,646 @@
package io.anuke.mindustry.content;
import io.anuke.arc.entities.Effects;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.CapStyle;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Fill;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Time;
import io.anuke.arc.util.Tmp;
import io.anuke.mindustry.entities.Damage;
import io.anuke.mindustry.entities.bullet.*;
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.game.ContentList;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Shapes;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.BuildBlock;
import static io.anuke.mindustry.Vars.world;
public class Bullets implements ContentList{
public static BulletType
//artillery
artilleryDense, arilleryPlastic, artilleryPlasticFrag, artilleryHoming, artlleryIncendiary, artilleryExplosive, artilleryUnit,
//flak
flakPlastic, flakExplosive, flakSurge,
//missiles
missileExplosive, missileIncendiary, missileSurge, missileJavelin, missileSwarm,
//standard
standardCopper, standardDense, standardThorium, standardHoming, standardIncendiary, standardMechSmall,
standardGlaive, standardDenseBig, standardThoriumBig, standardIncendiaryBig,
//electric
lancerLaser, meltdownLaser, lightning, arc, damageLightning,
//liquid
waterShot, cryoShot, slagShot, oilShot,
//environment, misc.
fireball, basicFlame, fuseShot, driverBolt, healBullet, frag,
//bombs
bombExplosive, bombIncendiary, bombOil;
@Override
public void load(){
artilleryDense = new ArtilleryBulletType(3f, 0, "shell"){{
hitEffect = Fx.flakExplosion;
knockback = 0.8f;
lifetime = 50f;
bulletWidth = bulletHeight = 11f;
collidesTiles = false;
splashDamageRadius = 25f;
splashDamage = 33f;
}};
artilleryPlasticFrag = new BasicBulletType(2.5f, 6, "bullet"){{
bulletWidth = 10f;
bulletHeight = 12f;
bulletShrink = 1f;
lifetime = 15f;
backColor = Palette.plastaniumBack;
frontColor = Palette.plastaniumFront;
despawnEffect = Fx.none;
}};
arilleryPlastic = new ArtilleryBulletType(3.3f, 0, "shell"){{
hitEffect = Fx.plasticExplosion;
knockback = 1f;
lifetime = 55f;
bulletWidth = bulletHeight = 13f;
collidesTiles = false;
splashDamageRadius = 35f;
splashDamage = 35f;
fragBullet = artilleryPlasticFrag;
fragBullets = 9;
backColor = Palette.plastaniumBack;
frontColor = Palette.plastaniumFront;
}};
artilleryHoming = new ArtilleryBulletType(3f, 0, "shell"){{
hitEffect = Fx.flakExplosion;
knockback = 0.8f;
lifetime = 45f;
bulletWidth = bulletHeight = 11f;
collidesTiles = false;
splashDamageRadius = 25f;
splashDamage = 33f;
homingPower = 2f;
homingRange = 50f;
}};
artlleryIncendiary = new ArtilleryBulletType(3f, 0, "shell"){{
hitEffect = Fx.blastExplosion;
knockback = 0.8f;
lifetime = 60f;
bulletWidth = bulletHeight = 13f;
collidesTiles = false;
splashDamageRadius = 25f;
splashDamage = 30f;
incendAmount = 4;
incendSpread = 11f;
frontColor = Palette.lightishOrange;
backColor = Palette.lightOrange;
trailEffect = Fx.incendTrail;
}};
artilleryExplosive = new ArtilleryBulletType(2f, 0, "shell"){{
hitEffect = Fx.blastExplosion;
knockback = 0.8f;
lifetime = 70f;
bulletWidth = bulletHeight = 14f;
collidesTiles = false;
splashDamageRadius = 45f;
splashDamage = 50f;
backColor = Palette.missileYellowBack;
frontColor = Palette.missileYellow;
}};
artilleryUnit = new ArtilleryBulletType(2f, 0, "shell"){{
hitEffect = Fx.blastExplosion;
knockback = 0.8f;
lifetime = 90f;
bulletWidth = bulletHeight = 14f;
collides = true;
collidesTiles = true;
splashDamageRadius = 45f;
splashDamage = 50f;
backColor = Palette.bulletYellowBack;
frontColor = Palette.bulletYellow;
}};
flakPlastic = new FlakBulletType(4f, 5){{
splashDamageRadius = 40f;
fragBullet = artilleryPlasticFrag;
fragBullets = 4;
hitEffect = Fx.plasticExplosion;
frontColor = Palette.plastaniumFront;
backColor = Palette.plastaniumBack;
}};
flakExplosive = new FlakBulletType(4f, 5){{
//default bullet type, no changes
}};
flakSurge = new FlakBulletType(4f, 7){{
splashDamage = 33f;
lightining = 2;
lightningLength = 12;
}};
missileExplosive = new MissileBulletType(1.8f, 10, "missile"){{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.01f;
splashDamageRadius = 30f;
splashDamage = 30f;
lifetime = 150f;
hitEffect = Fx.blastExplosion;
despawnEffect = Fx.blastExplosion;
}};
missileIncendiary = new MissileBulletType(2f, 12, "missile"){{
frontColor = Palette.lightishOrange;
backColor = Palette.lightOrange;
bulletWidth = 7f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.01f;
homingPower = 7f;
splashDamageRadius = 10f;
splashDamage = 10f;
lifetime = 160f;
hitEffect = Fx.blastExplosion;
incendSpread = 10f;
incendAmount = 3;
}};
missileSurge = new MissileBulletType(3.5f, 15, "bullet"){{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.01f;
splashDamageRadius = 30f;
splashDamage = 22f;
lifetime = 150f;
hitEffect = Fx.blastExplosion;
despawnEffect = Fx.blastExplosion;
lightining = 2;
lightningLength = 14;
}};
missileJavelin = new MissileBulletType(5f, 10.5f, "missile"){{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.003f;
keepVelocity = false;
splashDamageRadius = 20f;
splashDamage = 1f;
lifetime = 90f;
trailColor = Color.valueOf("b6c6fd");
hitEffect = Fx.blastExplosion;
despawnEffect = Fx.blastExplosion;
backColor = Palette.bulletYellowBack;
frontColor = Palette.bulletYellow;
weaveScale = 8f;
weaveMag = 2f;
}};
missileSwarm = new MissileBulletType(2.7f, 12, "missile"){{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.003f;
homingRange = 60f;
keepVelocity = false;
splashDamageRadius = 25f;
splashDamage = 10f;
lifetime = 120f;
trailColor = Color.GRAY;
backColor = Palette.bulletYellowBack;
frontColor = Palette.bulletYellow;
hitEffect = Fx.blastExplosion;
despawnEffect = Fx.blastExplosion;
weaveScale = 8f;
weaveMag = 2f;
}};
standardCopper = new BasicBulletType(2.5f, 7, "bullet"){{
bulletWidth = 7f;
bulletHeight = 9f;
shootEffect = Fx.shootSmall;
smokeEffect = Fx.shootSmallSmoke;
ammoMultiplier = 5;
}};
standardDense = new BasicBulletType(3.5f, 18, "bullet"){{
bulletWidth = 9f;
bulletHeight = 12f;
armorPierce = 0.2f;
reloadMultiplier = 0.6f;
ammoMultiplier = 2;
}};
standardThorium = new BasicBulletType(4f, 29, "bullet"){{
bulletWidth = 10f;
bulletHeight = 13f;
armorPierce = 0.5f;
shootEffect = Fx.shootBig;
smokeEffect = Fx.shootBigSmoke;
ammoMultiplier = 2;
}};
standardHoming = new BasicBulletType(3f, 9, "bullet"){{
bulletWidth = 7f;
bulletHeight = 9f;
homingPower = 5f;
reloadMultiplier = 1.4f;
ammoMultiplier = 5;
}};
standardIncendiary = new BasicBulletType(3.2f, 11, "bullet"){{
bulletWidth = 10f;
bulletHeight = 12f;
frontColor = Palette.lightishOrange;
backColor = Palette.lightOrange;
incendSpread = 3f;
incendAmount = 1;
incendChance = 0.3f;
inaccuracy = 3f;
}};
standardGlaive = new BasicBulletType(4f, 7.5f, "bullet"){{
bulletWidth = 10f;
bulletHeight = 12f;
frontColor = Color.valueOf("feb380");
backColor = Color.valueOf("ea8878");
incendSpread = 3f;
incendAmount = 1;
incendChance = 0.3f;
}};
standardMechSmall = new BasicBulletType(4f, 9, "bullet"){{
bulletWidth = 11f;
bulletHeight = 14f;
lifetime = 40f;
inaccuracy = 5f;
despawnEffect = Fx.hitBulletSmall;
}};
standardDenseBig = new BasicBulletType(7f, 42, "bullet"){{
bulletWidth = 15f;
bulletHeight = 21f;
armorPierce = 0.2f;
}};
standardThoriumBig = new BasicBulletType(8f, 65, "bullet"){{
bulletWidth = 16f;
bulletHeight = 23f;
armorPierce = 0.5f;
}};
standardIncendiaryBig = new BasicBulletType(7f, 38, "bullet"){{
bulletWidth = 16f;
bulletHeight = 21f;
frontColor = Palette.lightishOrange;
backColor = Palette.lightOrange;
incendSpread = 3f;
incendAmount = 2;
incendChance = 0.3f;
}};
damageLightning = new BulletType(0.0001f, 0f){
{
lifetime = Lightning.lifetime;
hitEffect = Fx.hitLancer;
despawnEffect = Fx.none;
status = StatusEffects.shocked;
statusIntensity = 1f;
}
};
healBullet = new BulletType(5.2f, 13){
float healPercent = 3f;
{
hitEffect = Fx.hitLaser;
despawnEffect = Fx.hitLaser;
collidesTeam = true;
}
@Override
public boolean collides(Bullet b, Tile tile){
return tile.getTeam() != b.getTeam() || tile.entity.healthf() < 1f;
}
@Override
public void draw(Bullet b){
Draw.color(Palette.heal);
Lines.stroke(2f);
Lines.lineAngleCenter(b.x, b.y, b.rot(), 7f);
Draw.color(Color.WHITE);
Lines.lineAngleCenter(b.x, b.y, b.rot(), 3f);
Draw.reset();
}
@Override
public void hitTile(Bullet b, Tile tile){
super.hit(b);
tile = tile.target();
if(tile != null && tile.getTeam() == b.getTeam() && !(tile.block() instanceof BuildBlock)){
Effects.effect(Fx.healBlockFull, Palette.heal, tile.drawx(), tile.drawy(), tile.block().size);
tile.entity.healBy(healPercent / 100f * tile.entity.maxHealth());
}
}
};
fireball = new BulletType(1f, 4){
{
pierce = true;
hitTiles = false;
collides = false;
collidesTiles = false;
drag = 0.03f;
hitEffect = despawnEffect = Fx.none;
}
@Override
public void init(Bullet b){
b.velocity().setLength(0.6f + Mathf.random(2f));
}
@Override
public void draw(Bullet b){
//TODO add color to the bullet depending on the color of the flame it came from
Draw.color(Palette.lightFlame, Palette.darkFlame, Color.GRAY, b.fin());
Fill.circle(b.x, b.y, 3f * b.fout());
Draw.reset();
}
@Override
public void update(Bullet b){
if(Mathf.chance(0.04 * Time.delta())){
Tile tile = world.tileWorld(b.x, b.y);
if(tile != null){
Fire.create(tile);
}
}
if(Mathf.chance(0.1 * Time.delta())){
Effects.effect(Fx.fireballsmoke, b.x, b.y);
}
if(Mathf.chance(0.1 * Time.delta())){
Effects.effect(Fx.ballfire, b.x, b.y);
}
}
};
basicFlame = new BulletType(2.3f, 5){
{
hitSize = 7f;
lifetime = 35f;
pierce = true;
drag = 0.05f;
hitEffect = Fx.hitFlameSmall;
despawnEffect = Fx.none;
status = StatusEffects.burning;
}
@Override
public void draw(Bullet b){
}
};
lancerLaser = new BulletType(0.001f, 140){
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 = 100f;
{
hitEffect = Fx.hitLancer;
despawnEffect = Fx.none;
hitSize = 4;
lifetime = 16f;
pierce = true;
}
@Override
public void init(Bullet b){
Damage.collideLine(b, b.getTeam(), hitEffect, b.x, b.y, b.rot(), length);
}
@Override
public void draw(Bullet b){
float f = Mathf.curve(b.fin(), 0f, 0.2f);
float baseLen = length * f;
Lines.lineAngle(b.x, b.y, b.rot(), baseLen);
for(int s = 0; s < 3; s++){
Draw.color(colors[s]);
for(int i = 0; i < tscales.length; i++){
Lines.stroke(7f * b.fout() * (s == 0 ? 1.5f : s == 1 ? 1f : 0.3f) * tscales[i]);
Lines.lineAngle(b.x, b.y, b.rot(), baseLen * lenscales[i]);
}
}
Draw.reset();
}
};
meltdownLaser = new BulletType(0.001f, 26){
Color tmpColor = new Color();
Color[] colors = {Color.valueOf("ec745855"), Color.valueOf("ec7458aa"), Color.valueOf("ff9c5a"), Color.WHITE};
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
float[] strokes = {2f, 1.5f, 1f, 0.3f};
float[] lenscales = {1f, 1.12f, 1.15f, 1.17f};
float length = 200f;
{
hitEffect = Fx.hitMeltdown;
despawnEffect = Fx.none;
hitSize = 4;
drawSize = 420f;
lifetime = 16f;
pierce = true;
}
@Override
public void update(Bullet b){
if(b.timer.get(1, 5f)){
Damage.collideLine(b, b.getTeam(), hitEffect, b.x, b.y, b.rot(), length);
}
Effects.shake(1f, 1f, b.x, b.y);
}
@Override
public void hit(Bullet b, float hitx, float hity){
Effects.effect(hitEffect, colors[2], hitx, hity);
if(Mathf.chance(0.4)){
Fire.create(world.tileWorld(hitx+Mathf.range(5f), hity+Mathf.range(5f)));
}
}
@Override
public void draw(Bullet b){
float baseLen = (length) * b.fout();
Lines.lineAngle(b.x, b.y, b.rot(), baseLen);
for(int s = 0; s < colors.length; s++){
Draw.color(tmpColor.set(colors[s]).mul(1f + Mathf.absin(Time.time(), 1f, 0.1f)));
for(int i = 0; i < tscales.length; i++){
Tmp.v1.trns(b.rot() + 180f, (lenscales[i] - 1f) * 35f);
Lines.stroke((9f + Mathf.absin(Time.time(), 0.8f, 1.5f)) * b.fout() * strokes[s] * tscales[i]);
Lines.lineAngle(b.x + Tmp.v1.x, b.y + Tmp.v1.y, b.rot(), baseLen * lenscales[i], CapStyle.none);
}
}
Draw.reset();
}
};
fuseShot = new BulletType(0.01f, 70){
int rays = 3;
float raySpace = 2f;
float rayLength = 80f;
{
hitEffect = Fx.hitFuse;
lifetime = 13f;
despawnEffect = Fx.none;
pierce = true;
}
@Override
public void init(Bullet b) {
for (int i = 0; i < rays; i++) {
Damage.collideLine(b, b.getTeam(), hitEffect, b.x, b.y, b.rot(), rayLength - Math.abs(i - (rays/2))*20f);
}
}
@Override
public void draw(Bullet b) {
super.draw(b);
Draw.color(Color.WHITE, Palette.surge, b.fin());
for(int i = 0; i < 7; i++){
Tmp.v1.trns(b.rot(), i * 8f);
float sl = Mathf.clamp(b.fout()-0.5f) * (80f - i *10);
Shapes.tri(b.x + Tmp.v1.x, b.y + Tmp.v1.y, 4f, sl, b.rot() + 90);
Shapes.tri(b.x + Tmp.v1.x, b.y + Tmp.v1.y, 4f, sl, b.rot() - 90);
}
Shapes.tri(b.x, b.y, 13f, (rayLength+50) * b.fout(), b.rot());
Shapes.tri(b.x, b.y, 13f, 10f * b.fout(), b.rot() + 180f);
Draw.reset();
}
};
waterShot = new LiquidBulletType(Liquids.water){{
knockback = 0.65f;
}};
cryoShot = new LiquidBulletType(Liquids.cryofluid){{
}};
slagShot = new LiquidBulletType(Liquids.slag){{
damage = 4;
speed = 1.9f;
drag = 0.03f;
}};
oilShot = new LiquidBulletType(Liquids.oil){{
speed = 2f;
drag = 0.03f;
}};
lightning = new BulletType(0.001f, 12f){
{
lifetime = 1f;
despawnEffect = Fx.none;
hitEffect = Fx.hitLancer;
keepVelocity = false;
}
@Override
public void draw(Bullet b){
}
@Override
public void init(Bullet b){
Lightning.create(b.getTeam(), Palette.lancerLaser, damage, b.x, b.y, b.rot(), 30);
}
};
arc = new BulletType(0.001f, 26){{
lifetime = 1;
despawnEffect = Fx.none;
hitEffect = Fx.hitLancer;
}
@Override
public void draw(Bullet b){}
@Override
public void init(Bullet b){
Lightning.create(b.getTeam(), Palette.lancerLaser, damage, b.x, b.y, b.rot(), 36);
}
};
driverBolt = new MassDriverBolt();
frag = new BasicBulletType(5f, 8, "bullet"){{
bulletWidth = 8f;
bulletHeight = 9f;
bulletShrink = 0.5f;
lifetime = 50f;
drag = 0.04f;
}};
bombExplosive = new BombBulletType(10f, 20f, "shell"){{
bulletWidth = 9f;
bulletHeight = 13f;
hitEffect = Fx.flakExplosion;
}};
bombIncendiary = new BombBulletType(7f, 10f, "shell"){{
bulletWidth = 8f;
bulletHeight = 12f;
hitEffect = Fx.flakExplosion;
backColor = Palette.lightOrange;
frontColor = Palette.lightishOrange;
incendChance = 1f;
incendAmount = 3;
incendSpread = 10f;
}};
bombOil = new BombBulletType(2f, 3f, "shell"){{
bulletWidth = 8f;
bulletHeight = 12f;
hitEffect = Fx.pulverize;
backColor = new Color(0x4f4f4fff);
frontColor = Color.GRAY;
}
@Override
public void hit(Bullet b, float x, float y){
super.hit(b, x, y);
for(int i = 0; i < 3; i++){
Tile tile = world.tileWorld(x + Mathf.range(8f), y + Mathf.range(8f));
Puddle.deposit(tile, Liquids.oil, 5f);
}
}
};
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,6 @@ package io.anuke.mindustry.content;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.ItemType;
@@ -101,9 +100,4 @@ public class Items implements ContentList{
explosiveness = 0.2f;
}};
}
@Override
public ContentType type(){
return ContentType.item;
}
}

View File

@@ -2,7 +2,6 @@ package io.anuke.mindustry.content;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Liquid;
public class Liquids implements ContentList{
@@ -47,9 +46,4 @@ public class Liquids implements ContentList{
effect = StatusEffects.freezing;
}};
}
@Override
public ContentType type(){
return ContentType.liquid;
}
}

View File

@@ -9,15 +9,12 @@ import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Rectangle;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.content.fx.UnitFx;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.effect.Lightning;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Mech;
public class Mechs implements ContentList{
@@ -68,7 +65,7 @@ public class Mechs implements ContentList{
public void onLand(Player player){
if(player.timer.get(Player.timerAbility, cooldown)){
Effects.shake(1f, 1f, player);
Effects.effect(UnitFx.landShock, player);
Effects.effect(Fx.landShock, player);
for(int i = 0; i < 8; i++){
Time.run(Mathf.random(8f), () -> Lightning.create(player.getTeam(), Palette.lancerLaser, 17f, player.x, player.y, Mathf.random(360f), 14));
}
@@ -109,7 +106,7 @@ public class Mechs implements ContentList{
Units.getNearby(player.getTeam(), rect, unit -> {
if(unit.dst(player) <= healRange){
if(unit.health < unit.maxHealth()){
Effects.effect(UnitFx.heal, unit);
Effects.effect(Fx.heal, unit);
wasHealed = true;
}
unit.healBy(healAmount);
@@ -117,7 +114,7 @@ public class Mechs implements ContentList{
});
if(wasHealed){
Effects.effect(UnitFx.healWave, player);
Effects.effect(Fx.healWave, player);
}
}
}
@@ -160,7 +157,7 @@ public class Mechs implements ContentList{
@Override
public void updateAlt(Player player){
float scl = 1f - player.shootHeat/2f;
player.getVelocity().scl(scl);
player.velocity().scl(scl);
}
@Override
@@ -228,9 +225,9 @@ public class Mechs implements ContentList{
public void updateAlt(Player player){
float scl = scld(player);
if(Mathf.chance(Time.delta() * (0.15*scl))){
Effects.effect(BulletFx.hitLancer, Palette.lancerLaser, player.x, player.y);
Effects.effect(Fx.hitLancer, Palette.lancerLaser, player.x, player.y);
Lightning.create(player.getTeam(), Palette.lancerLaser, 10f,
player.x + player.getVelocity().x, player.y + player.getVelocity().y, player.rotation, 14);
player.x + player.velocity().x, player.y + player.velocity().y, player.rotation, 14);
}
}
@@ -251,7 +248,7 @@ public class Mechs implements ContentList{
}
float scld(Player player){
return Mathf.clamp((player.getVelocity().len() - minV) / (maxV - minV));
return Mathf.clamp((player.velocity().len() - minV) / (maxV - minV));
}
};
@@ -271,7 +268,7 @@ public class Mechs implements ContentList{
@Override
public boolean canShoot(Player player){
return player.getVelocity().len() > 1.2f;
return player.velocity().len() > 1.2f;
}
};
@@ -293,9 +290,4 @@ public class Mechs implements ContentList{
starterDesktop = alpha;
starterMobile = dart;
}
@Override
public ContentType type(){
return ContentType.mech;
}
}

View File

@@ -1,9 +1,7 @@
package io.anuke.mindustry.content;
import io.anuke.mindustry.content.blocks.*;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.type.Recipe;
import io.anuke.mindustry.type.Recipe.RecipeVisibility;
@@ -15,179 +13,174 @@ public class Recipes implements ContentList{
@Override
public void load(){
//DEBUG
new Recipe(distribution, DebugBlocks.itemSource).setMode(GameMode.sandbox).setHidden(true).setAlwaysUnlocked(true);
new Recipe(distribution, DebugBlocks.itemVoid).setMode(GameMode.sandbox).setHidden(true).setAlwaysUnlocked(true);
new Recipe(liquid, DebugBlocks.liquidSource).setMode(GameMode.sandbox).setHidden(true).setAlwaysUnlocked(true);
new Recipe(power, DebugBlocks.powerVoid).setMode(GameMode.sandbox).setHidden(true).setAlwaysUnlocked(true);
new Recipe(power, DebugBlocks.powerInfinite).setMode(GameMode.sandbox).setHidden(true).setAlwaysUnlocked(true);
new Recipe(distribution, Blocks.itemSource).setMode(GameMode.sandbox).setHidden(true).setAlwaysUnlocked(true);
new Recipe(distribution, Blocks.itemVoid).setMode(GameMode.sandbox).setHidden(true).setAlwaysUnlocked(true);
new Recipe(liquid, Blocks.liquidSource).setMode(GameMode.sandbox).setHidden(true).setAlwaysUnlocked(true);
new Recipe(power, Blocks.powerVoid).setMode(GameMode.sandbox).setHidden(true).setAlwaysUnlocked(true);
new Recipe(power, Blocks.powerSource).setMode(GameMode.sandbox).setHidden(true).setAlwaysUnlocked(true);
//DEFENSE
//walls
new Recipe(defense, DefenseBlocks.copperWall, new ItemStack(Items.copper, 12)).setAlwaysUnlocked(true);
new Recipe(defense, DefenseBlocks.copperWallLarge, new ItemStack(Items.copper, 12 * 4)).setAlwaysUnlocked(true);
new Recipe(defense, Blocks.copperWall, new ItemStack(Items.copper, 12)).setAlwaysUnlocked(true);
new Recipe(defense, Blocks.copperWallLarge, new ItemStack(Items.copper, 12 * 4)).setAlwaysUnlocked(true);
new Recipe(defense, DefenseBlocks.denseAlloyWall, new ItemStack(Items.titanium, 12));
new Recipe(defense, DefenseBlocks.denseAlloyWallLarge, new ItemStack(Items.titanium, 12 * 4));
new Recipe(defense, Blocks.denseAlloyWall, new ItemStack(Items.titanium, 12));
new Recipe(defense, Blocks.denseAlloyWallLarge, new ItemStack(Items.titanium, 12 * 4));
new Recipe(defense, DefenseBlocks.door, new ItemStack(Items.titanium, 12), new ItemStack(Items.silicon, 8));
new Recipe(defense, DefenseBlocks.doorLarge, new ItemStack(Items.titanium, 12 * 4), new ItemStack(Items.silicon, 8 * 4));
new Recipe(defense, Blocks.door, new ItemStack(Items.titanium, 12), new ItemStack(Items.silicon, 8));
new Recipe(defense, Blocks.doorLarge, new ItemStack(Items.titanium, 12 * 4), new ItemStack(Items.silicon, 8 * 4));
new Recipe(defense, DefenseBlocks.thoriumWall, new ItemStack(Items.thorium, 12));
new Recipe(defense, DefenseBlocks.thoriumWallLarge, new ItemStack(Items.thorium, 12 * 4));
new Recipe(defense, Blocks.thoriumWall, new ItemStack(Items.thorium, 12));
new Recipe(defense, Blocks.thoriumWallLarge, new ItemStack(Items.thorium, 12 * 4));
new Recipe(defense, DefenseBlocks.phaseWall, new ItemStack(Items.phasefabric, 12));
new Recipe(defense, DefenseBlocks.phaseWallLarge, new ItemStack(Items.phasefabric, 12 * 4));
new Recipe(defense, Blocks.phaseWall, new ItemStack(Items.phasefabric, 12));
new Recipe(defense, Blocks.phaseWallLarge, new ItemStack(Items.phasefabric, 12 * 4));
new Recipe(defense, DefenseBlocks.surgeWall, new ItemStack(Items.surgealloy, 12));
new Recipe(defense, DefenseBlocks.surgeWallLarge, new ItemStack(Items.surgealloy, 12 * 4));
new Recipe(defense, Blocks.surgeWall, new ItemStack(Items.surgealloy, 12));
new Recipe(defense, Blocks.surgeWallLarge, new ItemStack(Items.surgealloy, 12 * 4));
new Recipe(effect, StorageBlocks.container, new ItemStack(Items.titanium, 200));
new Recipe(effect, StorageBlocks.vault, new ItemStack(Items.titanium, 500), new ItemStack(Items.thorium, 250));
new Recipe(effect, Blocks.container, new ItemStack(Items.titanium, 200));
new Recipe(effect, Blocks.vault, new ItemStack(Items.titanium, 500), new ItemStack(Items.thorium, 250));
new Recipe(effect, StorageBlocks.core,
new Recipe(effect, Blocks.core,
new ItemStack(Items.copper, 2000), new ItemStack(Items.titanium, 2000),
new ItemStack(Items.silicon, 1750), new ItemStack(Items.thorium, 1000),
new ItemStack(Items.surgealloy, 500), new ItemStack(Items.phasefabric, 750)
);
//projectors
new Recipe(effect, DefenseBlocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.titanium, 150), new ItemStack(Items.titanium, 50), new ItemStack(Items.silicon, 180));
new Recipe(effect, DefenseBlocks.overdriveProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.titanium, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
new Recipe(effect, DefenseBlocks.forceProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.titanium, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
new Recipe(effect, Blocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.titanium, 150), new ItemStack(Items.titanium, 50), new ItemStack(Items.silicon, 180));
new Recipe(effect, Blocks.overdriveProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.titanium, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
new Recipe(effect, Blocks.forceProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.titanium, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
new Recipe(effect, DefenseBlocks.shockMine, new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 25));
new Recipe(effect, Blocks.shockMine, new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 25));
//TURRETS
new Recipe(turret, TurretBlocks.duo, new ItemStack(Items.copper, 40)).setAlwaysUnlocked(true);
new Recipe(turret, TurretBlocks.arc, new ItemStack(Items.copper, 50), new ItemStack(Items.lead, 30), new ItemStack(Items.silicon, 20));
new Recipe(turret, TurretBlocks.hail, new ItemStack(Items.copper, 60), new ItemStack(Items.graphite, 35));
new Recipe(turret, TurretBlocks.lancer, new ItemStack(Items.copper, 50), new ItemStack(Items.lead, 100), new ItemStack(Items.silicon, 90));
new Recipe(turret, TurretBlocks.wave, new ItemStack(Items.titanium, 70), new ItemStack(Items.lead, 150));
new Recipe(turret, TurretBlocks.salvo, new ItemStack(Items.copper, 210), new ItemStack(Items.graphite, 190), new ItemStack(Items.thorium, 130));
new Recipe(turret, TurretBlocks.swarmer, new ItemStack(Items.graphite, 70), new ItemStack(Items.titanium, 70), new ItemStack(Items.plastanium, 90), new ItemStack(Items.silicon, 60));
new Recipe(turret, TurretBlocks.ripple, new ItemStack(Items.copper, 300), new ItemStack(Items.graphite, 220), new ItemStack(Items.thorium, 120));
new Recipe(turret, TurretBlocks.cyclone, new ItemStack(Items.copper, 400), new ItemStack(Items.surgealloy, 200), new ItemStack(Items.plastanium, 150));
new Recipe(turret, TurretBlocks.fuse, new ItemStack(Items.copper, 450), new ItemStack(Items.graphite, 450), new ItemStack(Items.surgealloy, 250));
new Recipe(turret, TurretBlocks.spectre, new ItemStack(Items.copper, 700), new ItemStack(Items.graphite, 600), new ItemStack(Items.surgealloy, 500), new ItemStack(Items.plastanium, 350), new ItemStack(Items.thorium, 500));
new Recipe(turret, TurretBlocks.meltdown, new ItemStack(Items.copper, 500), new ItemStack(Items.lead, 700), new ItemStack(Items.graphite, 600), new ItemStack(Items.surgealloy, 650), new ItemStack(Items.silicon, 650));
new Recipe(turret, Blocks.duo, new ItemStack(Items.copper, 40)).setAlwaysUnlocked(true);
new Recipe(turret, Blocks.arc, new ItemStack(Items.copper, 50), new ItemStack(Items.lead, 30), new ItemStack(Items.silicon, 20));
new Recipe(turret, Blocks.hail, new ItemStack(Items.copper, 60), new ItemStack(Items.graphite, 35));
new Recipe(turret, Blocks.lancer, new ItemStack(Items.copper, 50), new ItemStack(Items.lead, 100), new ItemStack(Items.silicon, 90));
new Recipe(turret, Blocks.wave, new ItemStack(Items.titanium, 70), new ItemStack(Items.lead, 150));
new Recipe(turret, Blocks.salvo, new ItemStack(Items.copper, 210), new ItemStack(Items.graphite, 190), new ItemStack(Items.thorium, 130));
new Recipe(turret, Blocks.swarmer, new ItemStack(Items.graphite, 70), new ItemStack(Items.titanium, 70), new ItemStack(Items.plastanium, 90), new ItemStack(Items.silicon, 60));
new Recipe(turret, Blocks.ripple, new ItemStack(Items.copper, 300), new ItemStack(Items.graphite, 220), new ItemStack(Items.thorium, 120));
new Recipe(turret, Blocks.cyclone, new ItemStack(Items.copper, 400), new ItemStack(Items.surgealloy, 200), new ItemStack(Items.plastanium, 150));
new Recipe(turret, Blocks.fuse, new ItemStack(Items.copper, 450), new ItemStack(Items.graphite, 450), new ItemStack(Items.surgealloy, 250));
new Recipe(turret, Blocks.spectre, new ItemStack(Items.copper, 700), new ItemStack(Items.graphite, 600), new ItemStack(Items.surgealloy, 500), new ItemStack(Items.plastanium, 350), new ItemStack(Items.thorium, 500));
new Recipe(turret, Blocks.meltdown, new ItemStack(Items.copper, 500), new ItemStack(Items.lead, 700), new ItemStack(Items.graphite, 600), new ItemStack(Items.surgealloy, 650), new ItemStack(Items.silicon, 650));
//DISTRIBUTION
new Recipe(distribution, DistributionBlocks.conveyor, new ItemStack(Items.copper, 1)).setAlwaysUnlocked(true);
new Recipe(distribution, DistributionBlocks.titaniumconveyor, new ItemStack(Items.copper, 2), new ItemStack(Items.titanium, 1));
new Recipe(distribution, DistributionBlocks.phaseConveyor, new ItemStack(Items.phasefabric, 10), new ItemStack(Items.silicon, 15), new ItemStack(Items.lead, 20), new ItemStack(Items.densealloy, 20));
new Recipe(distribution, Blocks.conveyor, new ItemStack(Items.copper, 1)).setAlwaysUnlocked(true);
new Recipe(distribution, Blocks.titaniumconveyor, new ItemStack(Items.copper, 2), new ItemStack(Items.titanium, 1));
new Recipe(distribution, Blocks.phaseConveyor, new ItemStack(Items.phasefabric, 10), new ItemStack(Items.silicon, 15), new ItemStack(Items.lead, 20), new ItemStack(Items.graphite, 20));
//starter transport
new Recipe(distribution, DistributionBlocks.junction, new ItemStack(Items.copper, 2)).setAlwaysUnlocked(true);
new Recipe(distribution, DistributionBlocks.router, new ItemStack(Items.copper, 6)).setAlwaysUnlocked(true);
new Recipe(distribution, Blocks.junction, new ItemStack(Items.copper, 2)).setAlwaysUnlocked(true);
new Recipe(distribution, Blocks.router, new ItemStack(Items.copper, 6)).setAlwaysUnlocked(true);
//more advanced transport
new Recipe(distribution, DistributionBlocks.distributor, new ItemStack(Items.titanium, 8), new ItemStack(Items.copper, 8));
new Recipe(distribution, DistributionBlocks.sorter, new ItemStack(Items.titanium, 4), new ItemStack(Items.copper, 4));
new Recipe(distribution, DistributionBlocks.overflowGate, new ItemStack(Items.titanium, 4), new ItemStack(Items.copper, 8));
new Recipe(distribution, DistributionBlocks.itemBridge, new ItemStack(Items.titanium, 8), new ItemStack(Items.copper, 8));
new Recipe(distribution, StorageBlocks.unloader, new ItemStack(Items.titanium, 50), new ItemStack(Items.silicon, 60));
new Recipe(distribution, DistributionBlocks.massDriver, new ItemStack(Items.titanium, 250), new ItemStack(Items.silicon, 150), new ItemStack(Items.lead, 250), new ItemStack(Items.thorium, 100));
new Recipe(distribution, Blocks.distributor, new ItemStack(Items.titanium, 8), new ItemStack(Items.copper, 8));
new Recipe(distribution, Blocks.sorter, new ItemStack(Items.titanium, 4), new ItemStack(Items.copper, 4));
new Recipe(distribution, Blocks.overflowGate, new ItemStack(Items.titanium, 4), new ItemStack(Items.copper, 8));
new Recipe(distribution, Blocks.itemBridge, new ItemStack(Items.titanium, 8), new ItemStack(Items.copper, 8));
new Recipe(distribution, Blocks.unloader, new ItemStack(Items.titanium, 50), new ItemStack(Items.silicon, 60));
new Recipe(distribution, Blocks.massDriver, new ItemStack(Items.titanium, 250), new ItemStack(Items.silicon, 150), new ItemStack(Items.lead, 250), new ItemStack(Items.thorium, 100));
//CRAFTING
//smelting
new Recipe(crafting, CraftingBlocks.siliconSmelter, new ItemStack(Items.copper, 60), new ItemStack(Items.lead, 50));
new Recipe(crafting, Blocks.siliconSmelter, new ItemStack(Items.copper, 60), new ItemStack(Items.lead, 50));
//advanced fabrication
new Recipe(crafting, CraftingBlocks.plastaniumCompressor, new ItemStack(Items.silicon, 160), new ItemStack(Items.lead, 230), new ItemStack(Items.graphite, 120), new ItemStack(Items.titanium, 160));
new Recipe(crafting, CraftingBlocks.phaseWeaver, new ItemStack(Items.silicon, 260), new ItemStack(Items.lead, 240), new ItemStack(Items.thorium, 150));
new Recipe(crafting, CraftingBlocks.surgeSmelter, new ItemStack(Items.silicon, 160), new ItemStack(Items.lead, 160), new ItemStack(Items.thorium, 140));
new Recipe(crafting, Blocks.plastaniumCompressor, new ItemStack(Items.silicon, 160), new ItemStack(Items.lead, 230), new ItemStack(Items.graphite, 120), new ItemStack(Items.titanium, 160));
new Recipe(crafting, Blocks.phaseWeaver, new ItemStack(Items.silicon, 260), new ItemStack(Items.lead, 240), new ItemStack(Items.thorium, 150));
new Recipe(crafting, Blocks.surgeSmelter, new ItemStack(Items.silicon, 160), new ItemStack(Items.lead, 160), new ItemStack(Items.thorium, 140));
//misc
new Recipe(crafting, CraftingBlocks.pulverizer, new ItemStack(Items.copper, 60), new ItemStack(Items.lead, 50));
new Recipe(crafting, CraftingBlocks.pyratiteMixer, new ItemStack(Items.copper, 100), new ItemStack(Items.lead, 50));
new Recipe(crafting, CraftingBlocks.blastMixer, new ItemStack(Items.lead, 60), new ItemStack(Items.titanium, 40));
new Recipe(crafting, CraftingBlocks.cryofluidmixer, new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 80), new ItemStack(Items.thorium, 90));
new Recipe(crafting, Blocks.pulverizer, new ItemStack(Items.copper, 60), new ItemStack(Items.lead, 50));
new Recipe(crafting, Blocks.pyratiteMixer, new ItemStack(Items.copper, 100), new ItemStack(Items.lead, 50));
new Recipe(crafting, Blocks.blastMixer, new ItemStack(Items.lead, 60), new ItemStack(Items.titanium, 40));
new Recipe(crafting, Blocks.cryofluidmixer, new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 80), new ItemStack(Items.thorium, 90));
new Recipe(crafting, CraftingBlocks.melter, new ItemStack(Items.copper, 60), new ItemStack(Items.lead, 70), new ItemStack(Items.graphite, 90));
new Recipe(crafting, CraftingBlocks.incinerator, new ItemStack(Items.graphite, 10), new ItemStack(Items.lead, 30));
new Recipe(crafting, Blocks.melter, new ItemStack(Items.copper, 60), new ItemStack(Items.lead, 70), new ItemStack(Items.graphite, 90));
new Recipe(crafting, Blocks.incinerator, new ItemStack(Items.graphite, 10), new ItemStack(Items.lead, 30));
//processing
new Recipe(crafting, CraftingBlocks.biomatterCompressor, new ItemStack(Items.lead, 70), new ItemStack(Items.silicon, 60));
new Recipe(crafting, CraftingBlocks.separator, new ItemStack(Items.copper, 60), new ItemStack(Items.titanium, 50));
new Recipe(crafting, Blocks.biomatterCompressor, new ItemStack(Items.lead, 70), new ItemStack(Items.silicon, 60));
new Recipe(crafting, Blocks.separator, new ItemStack(Items.copper, 60), new ItemStack(Items.titanium, 50));
//POWER
new Recipe(power, PowerBlocks.powerNode, new ItemStack(Items.copper, 2), new ItemStack(Items.lead, 6));
new Recipe(power, PowerBlocks.powerNodeLarge, new ItemStack(Items.titanium, 10), new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 6));
new Recipe(power, PowerBlocks.battery, new ItemStack(Items.copper, 8), new ItemStack(Items.lead, 30), new ItemStack(Items.silicon, 4));
new Recipe(power, PowerBlocks.batteryLarge, new ItemStack(Items.titanium, 40), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 30));
new Recipe(power, Blocks.powerNode, new ItemStack(Items.copper, 2), new ItemStack(Items.lead, 6));
new Recipe(power, Blocks.powerNodeLarge, new ItemStack(Items.titanium, 10), new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 6));
new Recipe(power, Blocks.battery, new ItemStack(Items.copper, 8), new ItemStack(Items.lead, 30), new ItemStack(Items.silicon, 4));
new Recipe(power, Blocks.batteryLarge, new ItemStack(Items.titanium, 40), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 30));
//generators - combustion
new Recipe(power, PowerBlocks.combustionGenerator, new ItemStack(Items.copper, 50), new ItemStack(Items.lead, 30));
new Recipe(power, PowerBlocks.turbineGenerator, new ItemStack(Items.copper, 70), new ItemStack(Items.graphite, 50), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 60));
new Recipe(power, PowerBlocks.thermalGenerator, new ItemStack(Items.copper, 80), new ItemStack(Items.graphite, 70), new ItemStack(Items.lead, 100), new ItemStack(Items.silicon, 70), new ItemStack(Items.thorium, 70));
new Recipe(power, Blocks.combustionGenerator, new ItemStack(Items.copper, 50), new ItemStack(Items.lead, 30));
new Recipe(power, Blocks.turbineGenerator, new ItemStack(Items.copper, 70), new ItemStack(Items.graphite, 50), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 60));
new Recipe(power, Blocks.thermalGenerator, new ItemStack(Items.copper, 80), new ItemStack(Items.graphite, 70), new ItemStack(Items.lead, 100), new ItemStack(Items.silicon, 70), new ItemStack(Items.thorium, 70));
//generators - solar
new Recipe(power, PowerBlocks.solarPanel, new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 30));
new Recipe(power, PowerBlocks.largeSolarPanel, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 290), new ItemStack(Items.phasefabric, 30));
new Recipe(power, Blocks.solarPanel, new ItemStack(Items.lead, 20), new ItemStack(Items.silicon, 30));
new Recipe(power, Blocks.largeSolarPanel, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 290), new ItemStack(Items.phasefabric, 30));
//generators - nuclear
new Recipe(power, PowerBlocks.thoriumReactor, new ItemStack(Items.lead, 600), new ItemStack(Items.silicon, 400), new ItemStack(Items.graphite, 300), new ItemStack(Items.thorium, 300));
new Recipe(power, PowerBlocks.rtgGenerator, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 150), new ItemStack(Items.phasefabric, 50), new ItemStack(Items.plastanium, 150), new ItemStack(Items.thorium, 100));
new Recipe(power, Blocks.thoriumReactor, new ItemStack(Items.lead, 600), new ItemStack(Items.silicon, 400), new ItemStack(Items.graphite, 300), new ItemStack(Items.thorium, 300));
new Recipe(power, Blocks.rtgGenerator, new ItemStack(Items.lead, 200), new ItemStack(Items.silicon, 150), new ItemStack(Items.phasefabric, 50), new ItemStack(Items.plastanium, 150), new ItemStack(Items.thorium, 100));
//DRILLS, PRODUCERS
new Recipe(production, ProductionBlocks.mechanicalDrill, new ItemStack(Items.copper, 45)).setAlwaysUnlocked(true);
new Recipe(production, ProductionBlocks.pneumaticDrill, new ItemStack(Items.copper, 60), new ItemStack(Items.graphite, 50));
new Recipe(production, ProductionBlocks.laserDrill, new ItemStack(Items.copper, 70), new ItemStack(Items.graphite, 90), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 50));
new Recipe(production, ProductionBlocks.blastDrill, new ItemStack(Items.copper, 130), new ItemStack(Items.silicon, 120), new ItemStack(Items.titanium, 100), new ItemStack(Items.thorium, 60));
new Recipe(production, Blocks.mechanicalDrill, new ItemStack(Items.copper, 45)).setAlwaysUnlocked(true);
new Recipe(production, Blocks.pneumaticDrill, new ItemStack(Items.copper, 60), new ItemStack(Items.graphite, 50));
new Recipe(production, Blocks.laserDrill, new ItemStack(Items.copper, 70), new ItemStack(Items.graphite, 90), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 50));
new Recipe(production, Blocks.blastDrill, new ItemStack(Items.copper, 130), new ItemStack(Items.silicon, 120), new ItemStack(Items.titanium, 100), new ItemStack(Items.thorium, 60));
new Recipe(production, ProductionBlocks.waterExtractor, new ItemStack(Items.copper, 50), new ItemStack(Items.graphite, 50), new ItemStack(Items.lead, 40));
new Recipe(production, ProductionBlocks.cultivator, new ItemStack(Items.copper, 20), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 20));
new Recipe(production, ProductionBlocks.oilExtractor, new ItemStack(Items.copper, 300), new ItemStack(Items.graphite, 350), new ItemStack(Items.lead, 230), new ItemStack(Items.thorium, 230), new ItemStack(Items.silicon, 150));
new Recipe(production, Blocks.waterExtractor, new ItemStack(Items.copper, 50), new ItemStack(Items.graphite, 50), new ItemStack(Items.lead, 40));
new Recipe(production, Blocks.cultivator, new ItemStack(Items.copper, 20), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 20));
new Recipe(production, Blocks.oilExtractor, new ItemStack(Items.copper, 300), new ItemStack(Items.graphite, 350), new ItemStack(Items.lead, 230), new ItemStack(Items.thorium, 230), new ItemStack(Items.silicon, 150));
//UNITS
//upgrades
new Recipe(upgrade, UpgradeBlocks.dartPad, new ItemStack(Items.lead, 150), new ItemStack(Items.copper, 150), new ItemStack(Items.silicon, 200), new ItemStack(Items.titanium, 240)).setVisible(RecipeVisibility.desktopOnly);
new Recipe(upgrade, UpgradeBlocks.tridentPad, new ItemStack(Items.lead, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
new Recipe(upgrade, UpgradeBlocks.javelinPad, new ItemStack(Items.lead, 350), new ItemStack(Items.silicon, 450), new ItemStack(Items.titanium, 500), new ItemStack(Items.plastanium, 400), new ItemStack(Items.phasefabric, 200));
new Recipe(upgrade, UpgradeBlocks.glaivePad, new ItemStack(Items.lead, 450), new ItemStack(Items.silicon, 650), new ItemStack(Items.titanium, 700), new ItemStack(Items.plastanium, 600), new ItemStack(Items.surgealloy, 200));
new Recipe(upgrade, Blocks.dartPad, new ItemStack(Items.lead, 150), new ItemStack(Items.copper, 150), new ItemStack(Items.silicon, 200), new ItemStack(Items.titanium, 240)).setVisible(RecipeVisibility.desktopOnly);
new Recipe(upgrade, Blocks.tridentPad, new ItemStack(Items.lead, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250), new ItemStack(Items.titanium, 300), new ItemStack(Items.plastanium, 200));
new Recipe(upgrade, Blocks.javelinPad, new ItemStack(Items.lead, 350), new ItemStack(Items.silicon, 450), new ItemStack(Items.titanium, 500), new ItemStack(Items.plastanium, 400), new ItemStack(Items.phasefabric, 200));
new Recipe(upgrade, Blocks.glaivePad, new ItemStack(Items.lead, 450), new ItemStack(Items.silicon, 650), new ItemStack(Items.titanium, 700), new ItemStack(Items.plastanium, 600), new ItemStack(Items.surgealloy, 200));
new Recipe(upgrade, UpgradeBlocks.alphaPad, new ItemStack(Items.lead, 200), new ItemStack(Items.graphite, 100), new ItemStack(Items.copper, 150)).setVisible(RecipeVisibility.mobileOnly);
new Recipe(upgrade, UpgradeBlocks.tauPad, new ItemStack(Items.lead, 250), new ItemStack(Items.titanium, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250));
new Recipe(upgrade, UpgradeBlocks.deltaPad, new ItemStack(Items.lead, 350), new ItemStack(Items.titanium, 350), new ItemStack(Items.copper, 400), new ItemStack(Items.silicon, 450), new ItemStack(Items.thorium, 300));
new Recipe(upgrade, UpgradeBlocks.omegaPad, new ItemStack(Items.lead, 450), new ItemStack(Items.graphite, 550), new ItemStack(Items.silicon, 650), new ItemStack(Items.thorium, 600), new ItemStack(Items.surgealloy, 240));
new Recipe(upgrade, Blocks.alphaPad, new ItemStack(Items.lead, 200), new ItemStack(Items.graphite, 100), new ItemStack(Items.copper, 150)).setVisible(RecipeVisibility.mobileOnly);
new Recipe(upgrade, Blocks.tauPad, new ItemStack(Items.lead, 250), new ItemStack(Items.titanium, 250), new ItemStack(Items.copper, 250), new ItemStack(Items.silicon, 250));
new Recipe(upgrade, Blocks.deltaPad, new ItemStack(Items.lead, 350), new ItemStack(Items.titanium, 350), new ItemStack(Items.copper, 400), new ItemStack(Items.silicon, 450), new ItemStack(Items.thorium, 300));
new Recipe(upgrade, Blocks.omegaPad, new ItemStack(Items.lead, 450), new ItemStack(Items.graphite, 550), new ItemStack(Items.silicon, 650), new ItemStack(Items.thorium, 600), new ItemStack(Items.surgealloy, 240));
//unit factories
new Recipe(units, UnitBlocks.spiritFactory, new ItemStack(Items.copper, 70), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 130));
new Recipe(units, UnitBlocks.phantomFactory, new ItemStack(Items.titanium, 90), new ItemStack(Items.thorium, 80), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 210));
new Recipe(units, Blocks.spiritFactory, new ItemStack(Items.copper, 70), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 130));
new Recipe(units, Blocks.phantomFactory, new ItemStack(Items.titanium, 90), new ItemStack(Items.thorium, 80), new ItemStack(Items.lead, 110), new ItemStack(Items.silicon, 210));
new Recipe(units, UnitBlocks.daggerFactory, new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 70));
new Recipe(units, UnitBlocks.titanFactory, new ItemStack(Items.thorium, 90), new ItemStack(Items.lead, 140), new ItemStack(Items.silicon, 90));
new Recipe(units, UnitBlocks.fortressFactory, new ItemStack(Items.thorium, 200), new ItemStack(Items.lead, 220), new ItemStack(Items.silicon, 150), new ItemStack(Items.surgealloy, 100), new ItemStack(Items.phasefabric, 50));
new Recipe(units, Blocks.daggerFactory, new ItemStack(Items.lead, 90), new ItemStack(Items.silicon, 70));
new Recipe(units, Blocks.titanFactory, new ItemStack(Items.thorium, 90), new ItemStack(Items.lead, 140), new ItemStack(Items.silicon, 90));
new Recipe(units, Blocks.fortressFactory, new ItemStack(Items.thorium, 200), new ItemStack(Items.lead, 220), new ItemStack(Items.silicon, 150), new ItemStack(Items.surgealloy, 100), new ItemStack(Items.phasefabric, 50));
new Recipe(units, UnitBlocks.wraithFactory, new ItemStack(Items.titanium, 60), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 90));
new Recipe(units, UnitBlocks.ghoulFactory, new ItemStack(Items.plastanium, 80), new ItemStack(Items.titanium, 100), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 220));
new Recipe(units, UnitBlocks.revenantFactory, new ItemStack(Items.plastanium, 300), new ItemStack(Items.titanium, 400), new ItemStack(Items.lead, 300), new ItemStack(Items.silicon, 400), new ItemStack(Items.surgealloy, 100));
new Recipe(units, Blocks.wraithFactory, new ItemStack(Items.titanium, 60), new ItemStack(Items.lead, 80), new ItemStack(Items.silicon, 90));
new Recipe(units, Blocks.ghoulFactory, new ItemStack(Items.plastanium, 80), new ItemStack(Items.titanium, 100), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 220));
new Recipe(units, Blocks.revenantFactory, new ItemStack(Items.plastanium, 300), new ItemStack(Items.titanium, 400), new ItemStack(Items.lead, 300), new ItemStack(Items.silicon, 400), new ItemStack(Items.surgealloy, 100));
new Recipe(units, UnitBlocks.repairPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.copper, 30), new ItemStack(Items.silicon, 30));
new Recipe(units, Blocks.repairPoint, new ItemStack(Items.lead, 30), new ItemStack(Items.copper, 30), new ItemStack(Items.silicon, 30));
//removed for testing MOBA-style unit production
//new Recipe(units, UnitBlocks.commandCenter, new ItemStack(Items.lead, 100), new ItemStack(Items.densealloy, 100), new ItemStack(Items.silicon, 200));
//new Recipe(units, Blocks.commandCenter, new ItemStack(Items.lead, 100), new ItemStack(Items.densealloy, 100), new ItemStack(Items.silicon, 200));
//LIQUIDS
new Recipe(liquid, LiquidBlocks.conduit, new ItemStack(Items.lead, 1));
new Recipe(liquid, LiquidBlocks.pulseConduit, new ItemStack(Items.titanium, 1), new ItemStack(Items.lead, 1));
new Recipe(liquid, LiquidBlocks.phaseConduit, new ItemStack(Items.phasefabric, 10), new ItemStack(Items.silicon, 15), new ItemStack(Items.lead, 20), new ItemStack(Items.titanium, 20));
new Recipe(liquid, Blocks.conduit, new ItemStack(Items.lead, 1));
new Recipe(liquid, Blocks.pulseConduit, new ItemStack(Items.titanium, 1), new ItemStack(Items.lead, 1));
new Recipe(liquid, Blocks.phaseConduit, new ItemStack(Items.phasefabric, 10), new ItemStack(Items.silicon, 15), new ItemStack(Items.lead, 20), new ItemStack(Items.titanium, 20));
new Recipe(liquid, LiquidBlocks.liquidRouter, new ItemStack(Items.titanium, 4), new ItemStack(Items.lead, 4));
new Recipe(liquid, LiquidBlocks.liquidtank, new ItemStack(Items.titanium, 50), new ItemStack(Items.lead, 50));
new Recipe(liquid, LiquidBlocks.liquidJunction, new ItemStack(Items.titanium, 4), new ItemStack(Items.lead, 4));
new Recipe(liquid, LiquidBlocks.bridgeConduit, new ItemStack(Items.titanium, 8), new ItemStack(Items.lead, 8));
new Recipe(liquid, Blocks.liquidRouter, new ItemStack(Items.titanium, 4), new ItemStack(Items.lead, 4));
new Recipe(liquid, Blocks.liquidtank, new ItemStack(Items.titanium, 50), new ItemStack(Items.lead, 50));
new Recipe(liquid, Blocks.liquidJunction, new ItemStack(Items.titanium, 4), new ItemStack(Items.lead, 4));
new Recipe(liquid, Blocks.bridgeConduit, new ItemStack(Items.titanium, 8), new ItemStack(Items.lead, 8));
new Recipe(liquid, LiquidBlocks.mechanicalPump, new ItemStack(Items.copper, 30), new ItemStack(Items.lead, 20));
new Recipe(liquid, LiquidBlocks.rotaryPump, new ItemStack(Items.copper, 140), new ItemStack(Items.lead, 100), new ItemStack(Items.silicon, 40), new ItemStack(Items.titanium, 70));
new Recipe(liquid, LiquidBlocks.thermalPump, new ItemStack(Items.copper, 160), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 80), new ItemStack(Items.thorium, 70));
}
@Override
public ContentType type(){
return ContentType.recipe;
new Recipe(liquid, Blocks.mechanicalPump, new ItemStack(Items.copper, 30), new ItemStack(Items.lead, 20));
new Recipe(liquid, Blocks.rotaryPump, new ItemStack(Items.copper, 140), new ItemStack(Items.lead, 100), new ItemStack(Items.silicon, 40), new ItemStack(Items.titanium, 70));
new Recipe(liquid, Blocks.thermalPump, new ItemStack(Items.copper, 160), new ItemStack(Items.lead, 130), new ItemStack(Items.silicon, 60), new ItemStack(Items.titanium, 80), new ItemStack(Items.thorium, 70));
}
}

View File

@@ -3,11 +3,9 @@ package io.anuke.mindustry.content;
import io.anuke.arc.entities.Effects;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.fx.EnvironmentFx;
import io.anuke.mindustry.entities.StatusController.StatusEntry;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.StatusEffect;
public class StatusEffects implements ContentList{
@@ -27,7 +25,7 @@ public class StatusEffects implements ContentList{
public StatusEntry getTransition(Unit unit, StatusEffect to, float time, float newTime, StatusEntry result){
if(to == tarred){
unit.damage(1f);
Effects.effect(EnvironmentFx.burning, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f));
Effects.effect(Fx.burning, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f));
return result.set(this, Math.min(time + newTime, baseDuration + tarred.baseDuration));
}
@@ -39,7 +37,7 @@ public class StatusEffects implements ContentList{
unit.damagePeriodic(0.04f);
if(Mathf.chance(Time.delta() * 0.2f)){
Effects.effect(EnvironmentFx.burning, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f));
Effects.effect(Fx.burning, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f));
}
}
};
@@ -55,7 +53,7 @@ public class StatusEffects implements ContentList{
public void update(Unit unit, float time){
if(Mathf.chance(Time.delta() * 0.15f)){
Effects.effect(EnvironmentFx.freezing, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f));
Effects.effect(Fx.freezing, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f));
}
}
};
@@ -80,7 +78,7 @@ public class StatusEffects implements ContentList{
@Override
public void update(Unit unit, float time){
if(Mathf.chance(Time.delta() * 0.15f)){
Effects.effect(EnvironmentFx.wet, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f));
Effects.effect(Fx.wet, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f));
}
}
};
@@ -106,7 +104,7 @@ public class StatusEffects implements ContentList{
unit.damagePeriodic(0.3f);
if(Mathf.chance(Time.delta() * 0.2f)){
Effects.effect(EnvironmentFx.melting, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f));
Effects.effect(Fx.melting, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f));
}
}
};
@@ -119,7 +117,7 @@ public class StatusEffects implements ContentList{
@Override
public void update(Unit unit, float time){
if(Mathf.chance(Time.delta() * 0.15f)){
Effects.effect(EnvironmentFx.oily, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f));
Effects.effect(Fx.oily, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f));
}
}
@@ -146,7 +144,7 @@ public class StatusEffects implements ContentList{
unit.health += 0.01f * Time.delta();
if(Mathf.chance(Time.delta() * 0.25f)){
Effects.effect(EnvironmentFx.overdriven, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f), 0f, unit);
Effects.effect(Fx.overdriven, unit.x + Mathf.range(unit.getSize() / 2f), unit.y + Mathf.range(unit.getSize() / 2f), 0f, unit);
}
}
};
@@ -169,9 +167,4 @@ public class StatusEffects implements ContentList{
freezing.setOpposites(burning, melting);
burning.setOpposites(wet, freezing);
}
@Override
public ContentType type(){
return ContentType.status;
}
}

View File

@@ -4,7 +4,6 @@ import io.anuke.arc.collection.ObjectSet;
import io.anuke.mindustry.entities.units.UnitType;
import io.anuke.mindustry.entities.units.types.*;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ContentType;
public class UnitTypes implements ContentList{
public static UnitType
@@ -106,9 +105,4 @@ public class UnitTypes implements ContentList{
toMine = ObjectSet.with(Items.lead, Items.copper, Items.titanium);
}};
}
@Override
public ContentType type(){
return ContentType.unit;
}
}

View File

@@ -1,14 +1,11 @@
package io.anuke.mindustry.content;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.content.fx.ShootFx;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Weapon;
public class Weapons implements ContentList{
public static Weapon blaster, blasterSmall, glaiveBlaster, droneBlaster, healBlaster, healBlasterDrone, chainBlaster, shockgun,
sapper, swarmer, bomber, bomberTrident, flakgun, flamethrower, missiles, artillery, laserBurster, healBlasterDrone2;
swarmer, bomber, bomberTrident, flakgun, flamethrower, missiles, artillery, laserBurster, healBlasterDrone2;
@Override
public void load(){
@@ -17,24 +14,24 @@ public class Weapons implements ContentList{
length = 1.5f;
reload = 14f;
roundrobin = true;
ejectEffect = ShootFx.shellEjectSmall;
ammo = AmmoTypes.bulletMech;
ejectEffect = Fx.shellEjectSmall;
ammo = Bullets.standardMechSmall;
}};
blasterSmall = new Weapon("blaster"){{
length = 1.5f;
reload = 15f;
roundrobin = true;
ejectEffect = ShootFx.shellEjectSmall;
ammo = AmmoTypes.bulletCopper;
ejectEffect = Fx.shellEjectSmall;
ammo = Bullets.standardCopper;
}};
glaiveBlaster = new Weapon("bomber"){{
length = 1.5f;
reload = 10f;
roundrobin = true;
ejectEffect = ShootFx.shellEjectSmall;
ammo = AmmoTypes.bulletGlaive;
ejectEffect = Fx.shellEjectSmall;
ammo = Bullets.standardGlaive;
}};
droneBlaster = new Weapon("blaster"){{
@@ -42,8 +39,8 @@ public class Weapons implements ContentList{
reload = 25f;
width = 1f;
roundrobin = true;
ejectEffect = ShootFx.shellEjectSmall;
ammo = AmmoTypes.bulletCopper;
ejectEffect = Fx.shellEjectSmall;
ammo = Bullets.standardCopper;
}};
healBlaster = new Weapon("heal-blaster"){{
@@ -52,7 +49,7 @@ public class Weapons implements ContentList{
roundrobin = false;
ejectEffect = Fx.none;
recoil = 2f;
ammo = AmmoTypes.healBlaster;
ammo = Bullets.healBullet;
}};
missiles = new Weapon("missiles"){{
@@ -64,7 +61,7 @@ public class Weapons implements ContentList{
ejectEffect = Fx.none;
velocityRnd = 0.2f;
spacing = 1f;
ammo = AmmoTypes.weaponMissile;
ammo = Bullets.missileJavelin;
}};
swarmer = new Weapon("swarmer"){{
@@ -77,15 +74,15 @@ public class Weapons implements ContentList{
roundrobin = true;
ejectEffect = Fx.none;
shake = 3f;
ammo = AmmoTypes.weaponMissileSwarm;
ammo = Bullets.missileSwarm;
}};
chainBlaster = new Weapon("chain-blaster"){{
length = 1.5f;
reload = 28f;
roundrobin = true;
ejectEffect = ShootFx.shellEjectSmall;
ammo = AmmoTypes.bulletCopper;
ejectEffect = Fx.shellEjectSmall;
ammo = Bullets.standardCopper;
}};
shockgun = new Weapon("shockgun"){{
@@ -96,7 +93,7 @@ public class Weapons implements ContentList{
inaccuracy = 0f;
velocityRnd = 0.2f;
ejectEffect = Fx.none;
ammo = AmmoTypes.shock;
ammo = Bullets.lightning;
}};
flakgun = new Weapon("flakgun"){{
@@ -107,8 +104,8 @@ public class Weapons implements ContentList{
inaccuracy = 3f;
recoil = 3f;
velocityRnd = 0.1f;
ejectEffect = ShootFx.shellEjectMedium;
ammo = AmmoTypes.shellCarbide;
ejectEffect = Fx.shellEjectMedium;
ammo = Bullets.artilleryDense;
}};
flamethrower = new Weapon("flamethrower"){{
@@ -117,7 +114,7 @@ public class Weapons implements ContentList{
roundrobin = true;
recoil = 1f;
ejectEffect = Fx.none;
ammo = AmmoTypes.flamerThermite;
ammo = Bullets.basicFlame;
}};
artillery = new Weapon("artillery"){{
@@ -126,16 +123,8 @@ public class Weapons implements ContentList{
roundrobin = true;
recoil = 5f;
shake = 2f;
ejectEffect = ShootFx.shellEjectMedium;
ammo = AmmoTypes.unitArtillery;
}};
sapper = new Weapon("sapper"){{
length = 1.5f;
reload = 12f;
roundrobin = true;
ejectEffect = ShootFx.shellEjectSmall;
ammo = AmmoTypes.bulletDense;
ejectEffect = Fx.shellEjectMedium;
ammo = Bullets.artilleryUnit;
}};
bomber = new Weapon("bomber"){{
@@ -146,7 +135,7 @@ public class Weapons implements ContentList{
ejectEffect = Fx.none;
velocityRnd = 1f;
inaccuracy = 40f;
ammo = AmmoTypes.bombExplosive;
ammo = Bullets.bombExplosive;
}};
bomberTrident = new Weapon("bomber"){{
@@ -158,7 +147,7 @@ public class Weapons implements ContentList{
ejectEffect = Fx.none;
velocityRnd = 1f;
inaccuracy = 40f;
ammo = AmmoTypes.bombExplosive;
ammo = Bullets.bombExplosive;
}};
laserBurster = new Weapon("bomber"){{
@@ -167,7 +156,7 @@ public class Weapons implements ContentList{
width = 0f;
roundrobin = true;
ejectEffect = Fx.none;
ammo = AmmoTypes.lancerLaser;
ammo = Bullets.lancerLaser;
}};
healBlasterDrone = new Weapon("heal-blaster"){{
@@ -177,7 +166,7 @@ public class Weapons implements ContentList{
roundrobin = true;
ejectEffect = Fx.none;
recoil = 2f;
ammo = AmmoTypes.healBlaster;
ammo = Bullets.healBullet;
}};
healBlasterDrone2 = new Weapon("heal-blaster"){{
@@ -187,12 +176,7 @@ public class Weapons implements ContentList{
roundrobin = true;
ejectEffect = Fx.none;
recoil = 2f;
ammo = AmmoTypes.healBlaster;
ammo = Bullets.healBullet;
}};
}
@Override
public ContentType type(){
return ContentType.weapon;
}
}

View File

@@ -1,12 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ContentType;
public abstract class BlockList implements ContentList{
@Override
public ContentType type(){
return ContentType.item;
}
}

View File

@@ -1,161 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.content.StatusEffects;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.graphics.CacheLayer;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.*;
import io.anuke.arc.util.Time;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Mathf;
public class Blocks extends BlockList implements ContentList{
public static Block air, blockpart, spawn, space, metalfloor, deepwater, water, lava, tar, stone,
blackstone, dirt, sand, ice, snow, grass, shrub, rock, icerock, blackrock;
@Override
public void load(){
air = new Floor("air"){
{
blend = false;
alwaysReplace = true;
}
public void draw(Tile tile){}
public void load(){}
public void init(){}
};
blockpart = new BlockPart();
spawn = new Block("spawn"){
public void drawShadow(Tile tile){}
public void draw(Tile tile){
Draw.color(Color.SCARLET);
Lines.circle(tile.worldx(), tile.worldy(), 4f +Mathf.absin(Time.time(), 6f, 6f));
Draw.color();
}
};
//Registers build blocks from size 1-6
//no reference is needed here since they can be looked up by name later
for(int i = 1; i <= 6; i++){
new BuildBlock("build" + i);
}
space = new Floor("space"){{
placeableOn = false;
variants = 0;
cacheLayer = CacheLayer.space;
solid = true;
blend = false;
minimapColor = Color.valueOf("000001");
}};
metalfloor = new Floor("metalfloor"){{
variants = 6;
}};
deepwater = new Floor("deepwater"){{
liquidColor = Color.valueOf("546bb3");
speedMultiplier = 0.2f;
variants = 0;
liquidDrop = Liquids.water;
isLiquid = true;
status = StatusEffects.wet;
statusIntensity = 1f;
drownTime = 140f;
cacheLayer = CacheLayer.water;
minimapColor = Color.valueOf("465a96");
}};
water = new Floor("water"){{
liquidColor = Color.valueOf("546bb3");
speedMultiplier = 0.5f;
variants = 0;
status = StatusEffects.wet;
statusIntensity = 0.9f;
liquidDrop = Liquids.water;
isLiquid = true;
cacheLayer = CacheLayer.water;
minimapColor = Color.valueOf("506eb4");
}};
tar = new Floor("tar"){{
drownTime = 150f;
liquidColor = Color.valueOf("292929");
status = StatusEffects.tarred;
statusIntensity = 1f;
speedMultiplier = 0.19f;
variants = 0;
liquidDrop = Liquids.oil;
isLiquid = true;
cacheLayer = CacheLayer.oil;
minimapColor = Color.valueOf("292929");
}};
stone = new Floor("stone"){{
hasOres = true;
blends = block -> block != this && !(block instanceof OreBlock);
minimapColor = Color.valueOf("323232");
playerUnmineable = true;
}};
blackstone = new Floor("blackstone"){{
minimapColor = Color.valueOf("252525");
playerUnmineable = true;
hasOres = true;
}};
dirt = new Floor("dirt"){{
minimapColor = Color.valueOf("6e501e");
}};
sand = new Floor("sand"){{
drops = new ItemStack(Items.sand, 1);
minimapColor = Color.valueOf("988a67");
hasOres = true;
playerUnmineable = true;
}};
ice = new Floor("ice"){{
dragMultiplier = 0.2f;
speedMultiplier = 0.4f;
minimapColor = Color.valueOf("b8eef8");
hasOres = true;
}};
snow = new Floor("snow"){{
minimapColor = Color.valueOf("c2d1d2");
hasOres = true;
}};
grass = new Floor("grass"){{
hasOres = true;
minimapColor = Color.valueOf("549d5b");
}};
shrub = new Rock("shrub");
rock = new Rock("rock"){{
variants = 2;
}};
icerock = new Rock("icerock"){{
variants = 2;
}};
blackrock = new Rock("blackrock"){{
variants = 1;
}};
}
}

View File

@@ -1,168 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.production.*;
public class CraftingBlocks extends BlockList implements ContentList{
public static Block siliconSmelter, plastaniumCompressor, phaseWeaver, surgeSmelter,
pyratiteMixer, blastMixer,
cryofluidmixer, melter, separator, biomatterCompressor, pulverizer, incinerator;
@Override
public void load(){
siliconSmelter = new PowerSmelter("silicon-smelter"){{
health = 90;
craftEffect = BlockFx.smeltsmoke;
result = Items.silicon;
craftTime = 40f;
size = 2;
hasLiquids = false;
flameColor = Color.valueOf("ffef99");
consumes.items(new ItemStack(Items.sand, 2));
consumes.power(0.05f);
}};
plastaniumCompressor = new PlastaniumCompressor("plastanium-compressor"){{
hasItems = true;
liquidCapacity = 60f;
craftTime = 60f;
output = Items.plastanium;
size = 2;
health = 320;
hasPower = hasLiquids = true;
craftEffect = BlockFx.formsmoke;
updateEffect = BlockFx.plasticburn;
consumes.liquid(Liquids.oil, 0.25f);
consumes.power(0.3f);
consumes.item(Items.titanium, 2);
}};
phaseWeaver = new PhaseWeaver("phase-weaver"){{
craftEffect = BlockFx.smeltsmoke;
result = Items.phasefabric;
craftTime = 120f;
size = 2;
consumes.items(new ItemStack(Items.thorium, 4), new ItemStack(Items.sand, 10));
consumes.power(0.5f);
}};
surgeSmelter = new PowerSmelter("surge-smelter"){{
craftEffect = BlockFx.smeltsmoke;
result = Items.surgealloy;
craftTime = 75f;
size = 3;
useFlux = true;
fluxNeeded = 3;
consumes.power(0.4f);
consumes.items(new ItemStack(Items.titanium, 2), new ItemStack(Items.lead, 4), new ItemStack(Items.silicon, 3), new ItemStack(Items.copper, 3));
}};
cryofluidmixer = new LiquidMixer("cryofluidmixer"){{
outputLiquid = Liquids.cryofluid;
liquidPerItem = 50f;
size = 2;
hasPower = true;
consumes.power(0.1f);
consumes.item(Items.titanium);
consumes.liquid(Liquids.water, 0.3f);
}};
blastMixer = new GenericCrafter("blast-mixer"){{
hasItems = true;
hasPower = true;
hasLiquids = true;
output = Items.blastCompound;
size = 2;
consumes.liquid(Liquids.oil, 0.05f);
consumes.item(Items.pyratite, 1);
consumes.power(0.04f);
}};
pyratiteMixer = new PowerSmelter("pyratite-mixer"){{
flameColor = Color.CLEAR;
hasItems = true;
hasPower = true;
result = Items.pyratite;
size = 2;
consumes.power(0.02f);
consumes.items(new ItemStack(Items.coal, 1), new ItemStack(Items.lead, 1), new ItemStack(Items.sand, 1));
}};
melter = new PowerCrafter("melter"){{
health = 200;
outputLiquid = Liquids.slag;
outputLiquidAmount = 1f;
craftTime = 10f;
size = 2;
hasLiquids = hasPower = true;
consumes.power(0.1f);
consumes.item(Items.scrap, 1);
}};
separator = new Separator("separator"){{
results = new ItemStack[]{
new ItemStack(Items.copper, 5),
new ItemStack(Items.lead, 3),
new ItemStack(Items.titanium, 2),
new ItemStack(Items.thorium, 1)
};
hasPower = true;
filterTime = 15f;
health = 50 * 4;
spinnerLength = 1.5f;
spinnerRadius = 3.5f;
spinnerThickness = 1.5f;
spinnerSpeed = 3f;
size = 2;
consumes.power(0.1f);
consumes.liquid(Liquids.slag, 0.2f);
}};
biomatterCompressor = new Compressor("biomattercompressor"){{
liquidCapacity = 60f;
craftTime = 20f;
outputLiquid = Liquids.oil;
outputLiquidAmount = 2.5f;
size = 2;
health = 320;
hasLiquids = true;
consumes.item(Items.biomatter, 1);
consumes.power(0.06f);
}};
pulverizer = new Pulverizer("pulverizer"){{
output = Items.sand;
craftEffect = BlockFx.pulverize;
craftTime = 40f;
updateEffect = BlockFx.pulverizeSmall;
hasItems = hasPower = true;
consumes.item(Items.scrap, 1);
consumes.power(0.05f);
}};
incinerator = new Incinerator("incinerator"){{
health = 90;
}};
}
}

View File

@@ -1,180 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.arc.collection.Array;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.PowerBlock;
import io.anuke.mindustry.world.blocks.distribution.Sorter;
import io.anuke.mindustry.world.blocks.power.PowerNode;
import io.anuke.mindustry.world.meta.BlockStat;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.scene.ui.ButtonGroup;
import io.anuke.arc.scene.ui.ImageButton;
import io.anuke.arc.scene.ui.layout.Table;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import static io.anuke.mindustry.Vars.*;
public class DebugBlocks extends BlockList implements ContentList{
public static Block powerVoid, powerInfinite, itemSource, liquidSource, itemVoid;
@Remote(targets = Loc.both, called = Loc.both, forward = true)
public static void setLiquidSourceLiquid(Player player, Tile tile, Liquid liquid){
LiquidSourceEntity entity = tile.entity();
entity.source = liquid;
}
@Override
public void load(){
powerVoid = new PowerBlock("powervoid"){
{
consumes.power(Float.MAX_VALUE);
}
@Override
public void init(){
super.init();
stats.remove(BlockStat.powerUse);
}
};
powerInfinite = new PowerNode("powerinfinite"){
{
maxNodes = 100;
outputsPower = true;
consumesPower = false;
}
@Override
public float getPowerProduction(Tile tile){
return 10000f;
}
};
itemSource = new Sorter("itemsource"){
{
hasItems = true;
}
@Override
public boolean outputsItems(){
return true;
}
@Override
public void update(Tile tile){
SorterEntity entity = tile.entity();
if(entity.sortItem == null) return;
entity.items.set(entity.sortItem, 1);
tryDump(tile, entity.sortItem);
entity.items.set(entity.sortItem, 0);
}
@Override
public boolean acceptItem(Item item, Tile tile, Tile source){
return false;
}
};
liquidSource = new Block("liquidsource"){
{
update = true;
solid = true;
hasLiquids = true;
liquidCapacity = 100f;
configurable = true;
outputsLiquid = true;
}
@Override
public void update(Tile tile){
LiquidSourceEntity entity = tile.entity();
tile.entity.liquids.add(entity.source, liquidCapacity);
tryDumpLiquid(tile, entity.source);
}
@Override
public void draw(Tile tile){
super.draw(tile);
LiquidSourceEntity entity = tile.entity();
Draw.color(entity.source.color);
Draw.rect("blank", tile.worldx(), tile.worldy(), 4f, 4f);
Draw.color();
}
@Override
public void buildTable(Tile tile, Table table){
LiquidSourceEntity entity = tile.entity();
Array<Liquid> items = content.liquids();
ButtonGroup<ImageButton> group = new ButtonGroup<>();
Table cont = new Table();
for(int i = 0; i < items.size; i++){
if(!control.unlocks.isUnlocked(items.get(i))) continue;
final int f = i;
ImageButton button = cont.addImageButton("liquid-icon-" + items.get(i).name, "clear-toggle", 24,
() -> Call.setLiquidSourceLiquid(null, tile, items.get(f))).size(38).group(group).get();
button.setChecked(entity.source.id == f);
if(i % 4 == 3){
cont.row();
}
}
table.add(cont);
}
@Override
public TileEntity newEntity(){
return new LiquidSourceEntity();
}
};
itemVoid = new Block("itemvoid"){
{
update = solid = true;
}
@Override
public void handleItem(Item item, Tile tile, Tile source){
}
@Override
public boolean acceptItem(Item item, Tile tile, Tile source){
return true;
}
};
}
class LiquidSourceEntity extends TileEntity{
public Liquid source = Liquids.water;
@Override
public void writeConfig(DataOutput stream) throws IOException{
stream.writeByte(source.id);
}
@Override
public void readConfig(DataInput stream) throws IOException{
source = content.liquid(stream.readByte());
}
}
}

View File

@@ -1,98 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.defense.*;
public class DefenseBlocks extends BlockList implements ContentList{
public static Block copperWall, copperWallLarge, denseAlloyWall, denseAlloyWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge,
phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mendProjector, overdriveProjector, forceProjector, shockMine;
@Override
public void load(){
int wallHealthMultiplier = 3;
copperWall = new Wall("copper-wall"){{
health = 80 * wallHealthMultiplier;
}};
copperWallLarge = new Wall("copper-wall-large"){{
health = 80 * 4 * wallHealthMultiplier;
size = 2;
}};
denseAlloyWall = new Wall("dense-alloy-wall"){{
health = 110 * wallHealthMultiplier;
}};
denseAlloyWallLarge = new Wall("dense-alloy-wall-large"){{
health = 110 * wallHealthMultiplier * 4;
size = 2;
}};
thoriumWall = new Wall("thorium-wall"){{
health = 200 * wallHealthMultiplier;
}};
thoriumWallLarge = new Wall("thorium-wall-large"){{
health = 200 * wallHealthMultiplier * 4;
size = 2;
}};
phaseWall = new DeflectorWall("phase-wall"){{
health = 150 * wallHealthMultiplier;
}};
phaseWallLarge = new DeflectorWall("phase-wall-large"){{
health = 150 * 4 * wallHealthMultiplier;
size = 2;
}};
surgeWall = new SurgeWall("surge-wall"){{
health = 230 * wallHealthMultiplier;
}};
surgeWallLarge = new SurgeWall("surge-wall-large"){{
health = 230 * 4 * wallHealthMultiplier;
size = 2;
}};
door = new Door("door"){{
health = 100 * wallHealthMultiplier;
}};
doorLarge = new Door("door-large"){{
openfx = BlockFx.dooropenlarge;
closefx = BlockFx.doorcloselarge;
health = 100 * 4 * wallHealthMultiplier;
size = 2;
}};
mendProjector = new MendProjector("mend-projector"){{
consumes.power(0.2f, 1.0f);
size = 2;
consumes.item(Items.phasefabric).optional(true);
}};
overdriveProjector = new OverdriveProjector("overdrive-projector"){{
consumes.power(0.35f, 1.0f);
size = 2;
consumes.item(Items.phasefabric).optional(true);
}};
forceProjector = new ForceProjector("force-projector"){{
size = 3;
consumes.item(Items.phasefabric).optional(true);
}};
shockMine = new ShockMine("shock-mine"){{
health = 40;
damage = 11;
tileDamage = 7f;
length = 10;
tendrils = 5;
}};
}
}

View File

@@ -1,57 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.distribution.*;
public class DistributionBlocks extends BlockList implements ContentList{
public static Block conveyor, titaniumconveyor, distributor, junction,
itemBridge, phaseConveyor, sorter, router, overflowGate, massDriver;
@Override
public void load(){
conveyor = new Conveyor("conveyor"){{
health = 45;
speed = 0.03f;
}};
titaniumconveyor = new Conveyor("titanium-conveyor"){{
health = 65;
speed = 0.07f;
}};
junction = new Junction("junction"){{
speed = 26;
capacity = 32;
}};
itemBridge = new BufferedItemBridge("bridge-conveyor"){{
range = 4;
speed = 60f;
bufferCapacity = 15;
}};
phaseConveyor = new ItemBridge("phase-conveyor"){{
range = 12;
hasPower = true;
consumes.power(0.03f, 1.0f);
}};
sorter = new Sorter("sorter");
router = new Router("router");
distributor = new Router("distributor"){{
size = 2;
}};
overflowGate = new OverflowGate("overflow-gate");
massDriver = new MassDriver("mass-driver"){{
size = 3;
itemCapacity = 60;
range = 440f;
}};
}
}

View File

@@ -1,70 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.distribution.*;
import io.anuke.mindustry.world.blocks.production.Pump;
public class LiquidBlocks extends BlockList implements ContentList{
public static Block mechanicalPump, rotaryPump, thermalPump, conduit, pulseConduit, liquidRouter, liquidtank, liquidJunction, bridgeConduit, phaseConduit;
@Override
public void load(){
mechanicalPump = new Pump("mechanical-pump"){{
pumpAmount = 0.1f;
tier = 0;
}};
rotaryPump = new Pump("rotary-pump"){{
pumpAmount = 0.2f;
consumes.power(0.015f);
liquidCapacity = 30f;
hasPower = true;
size = 2;
tier = 1;
}};
thermalPump = new Pump("thermal-pump"){{
pumpAmount = 0.275f;
consumes.power(0.03f);
liquidCapacity = 40f;
hasPower = true;
size = 2;
tier = 2;
}};
conduit = new Conduit("conduit"){{
health = 45;
}};
pulseConduit = new Conduit("pulse-conduit"){{
liquidCapacity = 16f;
liquidFlowFactor = 4.9f;
health = 90;
}};
liquidRouter = new LiquidRouter("liquid-router"){{
liquidCapacity = 20f;
}};
liquidtank = new LiquidTank("liquid-tank"){{
size = 3;
liquidCapacity = 1500f;
health = 500;
}};
liquidJunction = new LiquidJunction("liquid-junction");
bridgeConduit = new LiquidExtendingBridge("bridge-conduit"){{
range = 4;
hasPower = false;
}};
phaseConduit = new LiquidBridge("phase-conduit"){{
range = 12;
hasPower = true;
consumes.power(0.03f, 1.0f);
}};
}
}

View File

@@ -1,36 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.arc.collection.ObjectMap;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.Floor;
import io.anuke.mindustry.world.blocks.OreBlock;
import static io.anuke.mindustry.Vars.content;
public class OreBlocks extends BlockList{
private static final ObjectMap<Item, ObjectMap<Block, Block>> oreBlockMap = new ObjectMap<>();
public static Block get(Block floor, Item item){
if(!oreBlockMap.containsKey(item)) throw new IllegalArgumentException("Item '" + item + "' is not an ore!");
if(!oreBlockMap.get(item).containsKey(floor))
throw new IllegalArgumentException("Block '" + floor.name + "' does not support ores!");
return oreBlockMap.get(item).get(floor);
}
@Override
public void load(){
for(Item item : content.items()){
if(!item.genOre) continue;
ObjectMap<Block, Block> map = new ObjectMap<>();
oreBlockMap.put(item, map);
for(Block block : content.blocks()){
if(block instanceof Floor && ((Floor) block).hasOres){
map.put(block, new OreBlock(item, (Floor) block));
}
}
}
}
}

View File

@@ -1,82 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.power.*;
public class PowerBlocks extends BlockList implements ContentList{
public static Block combustionGenerator, thermalGenerator, turbineGenerator, rtgGenerator, solarPanel, largeSolarPanel,
thoriumReactor, fusionReactor, battery, batteryLarge, powerNode, powerNodeLarge;
@Override
public void load(){
combustionGenerator = new BurnerGenerator("combustion-generator"){{
powerProduction = 0.09f;
itemDuration = 40f;
}};
thermalGenerator = new LiquidHeatGenerator("thermal-generator"){{
maxLiquidGenerate = 2f;
powerProduction = 2f;
generateEffect = BlockFx.redgeneratespark;
size = 2;
}};
turbineGenerator = new TurbineGenerator("turbine-generator"){{
powerProduction = 0.28f;
itemDuration = 30f;
consumes.liquid(Liquids.water, 0.05f);
size = 2;
}};
rtgGenerator = new DecayGenerator("rtg-generator"){{
size = 2;
powerProduction = 0.3f;
itemDuration = 220f;
}};
solarPanel = new SolarGenerator("solar-panel"){{
powerProduction = 0.0045f;
}};
largeSolarPanel = new SolarGenerator("solar-panel-large"){{
size = 3;
powerProduction = 0.055f;
}};
thoriumReactor = new NuclearReactor("thorium-reactor"){{
size = 3;
health = 700;
powerProduction = 1.1f;
}};
fusionReactor = new FusionReactor("fusion-reactor"){{
size = 4;
health = 600;
}};
battery = new Battery("battery"){{
consumes.powerBuffered(320f, 1f);
}};
batteryLarge = new Battery("battery-large"){{
size = 3;
consumes.powerBuffered(2000f, 1f);
}};
powerNode = new PowerNode("power-node"){{
maxNodes = 4;
laserRange = 6;
}};
powerNodeLarge = new PowerNode("power-node-large"){{
size = 2;
maxNodes = 6;
laserRange = 9.5f;
}};
}
}

View File

@@ -1,112 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.production.Cultivator;
import io.anuke.mindustry.world.blocks.production.Drill;
import io.anuke.mindustry.world.blocks.production.Fracker;
import io.anuke.mindustry.world.blocks.production.SolidPump;
public class ProductionBlocks extends BlockList implements ContentList{
public static Block mechanicalDrill, pneumaticDrill, laserDrill, blastDrill, plasmaDrill, waterExtractor, oilExtractor, cultivator;
@Override
public void load(){
mechanicalDrill = new Drill("mechanical-drill"){{
tier = 2;
drillTime = 300;
size = 2;
drawMineItem = true;
}};
pneumaticDrill = new Drill("pneumatic-drill"){{
tier = 3;
drillTime = 240;
size = 2;
drawMineItem = true;
}};
laserDrill = new Drill("laser-drill"){{
drillTime = 140;
size = 2;
hasPower = true;
tier = 4;
updateEffect = BlockFx.pulverizeMedium;
drillEffect = BlockFx.mineBig;
consumes.power(0.11f);
}};
blastDrill = new Drill("blast-drill"){{
drillTime = 60;
size = 3;
drawRim = true;
hasPower = true;
tier = 5;
updateEffect = BlockFx.pulverizeRed;
updateEffectChance = 0.03f;
drillEffect = BlockFx.mineHuge;
rotateSpeed = 6f;
warmupSpeed = 0.01f;
consumes.power(0.3f);
}};
plasmaDrill = new Drill("plasma-drill"){{
heatColor = Color.valueOf("ff461b");
drillTime = 50;
size = 4;
hasLiquids = true;
hasPower = true;
tier = 5;
rotateSpeed = 9f;
drawRim = true;
updateEffect = BlockFx.pulverizeRedder;
updateEffectChance = 0.04f;
drillEffect = BlockFx.mineHuge;
warmupSpeed = 0.005f;
consumes.power(0.7f);
}};
waterExtractor = new SolidPump("water-extractor"){{
result = Liquids.water;
pumpAmount = 0.065f;
size = 2;
liquidCapacity = 30f;
rotateSpeed = 1.4f;
consumes.power(0.09f);
}};
oilExtractor = new Fracker("oil-extractor"){{
result = Liquids.oil;
updateEffect = BlockFx.pulverize;
liquidCapacity = 50f;
updateEffectChance = 0.05f;
pumpAmount = 0.09f;
size = 3;
liquidCapacity = 30f;
consumes.item(Items.sand);
consumes.power(0.3f);
consumes.liquid(Liquids.water, 0.15f);
}};
cultivator = new Cultivator("cultivator"){{
result = Items.biomatter;
drillTime = 200;
size = 2;
hasLiquids = true;
hasPower = true;
consumes.power(0.08f);
consumes.liquid(Liquids.water, 0.15f);
}};
}
}

View File

@@ -1,33 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.storage.CoreBlock;
import io.anuke.mindustry.world.blocks.storage.SortedUnloader;
import io.anuke.mindustry.world.blocks.storage.Vault;
public class StorageBlocks extends BlockList implements ContentList{
public static Block core, vault, container, unloader;
@Override
public void load(){
core = new CoreBlock("core"){{
health = 1100;
itemCapacity = 3000;
}};
vault = new Vault("vault"){{
size = 3;
itemCapacity = 1000;
}};
container = new Vault("container"){{
size = 2;
itemCapacity = 300;
}};
unloader = new SortedUnloader("unloader"){{
speed = 7f;
}};
}
}

View File

@@ -1,262 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.arc.Core;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.mindustry.content.AmmoTypes;
import io.anuke.mindustry.content.fx.ShootFx;
import io.anuke.mindustry.type.AmmoType;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.defense.turrets.*;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
public class TurretBlocks extends BlockList implements ContentList{
public static Block duo, /*scatter,*/
scorch, hail, wave, lancer, arc, swarmer, salvo, fuse, ripple, cyclone, spectre, meltdown;
@Override
public void load(){
duo = new DoubleTurret("duo"){{
ammoTypes = new AmmoType[]{AmmoTypes.bulletCopper, AmmoTypes.bulletDense, AmmoTypes.bulletPyratite, AmmoTypes.bulletSilicon};
reload = 25f;
restitution = 0.03f;
range = 90f;
shootCone = 15f;
ammoUseEffect = ShootFx.shellEjectSmall;
health = 80;
inaccuracy = 2f;
rotatespeed = 10f;
}};
hail = new ArtilleryTurret("hail"){{
ammoTypes = new AmmoType[]{AmmoTypes.artilleryDense, AmmoTypes.artilleryHoming, AmmoTypes.artilleryIncindiary};
reload = 60f;
recoil = 2f;
range = 230f;
inaccuracy = 1f;
shootCone = 10f;
health = 120;
}};
scorch = new LiquidTurret("scorch"){
protected TextureRegion shootRegion;
@Override
public void load(){
super.load();
shootRegion = Core.atlas.find(name + "-shoot");
}
{
ammoTypes = new AmmoType[]{AmmoTypes.basicFlame};
recoil = 0f;
reload = 4f;
shootCone = 50f;
ammoUseEffect = ShootFx.shellEjectSmall;
health = 160;
drawer = (tile, entity) -> Draw.rect(entity.target != null ? shootRegion : region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
}
};
wave = new LiquidTurret("wave"){{
ammoTypes = new AmmoType[]{AmmoTypes.water, AmmoTypes.lava, AmmoTypes.cryofluid, AmmoTypes.oil};
size = 2;
recoil = 0f;
reload = 4f;
inaccuracy = 5f;
shootCone = 50f;
shootEffect = ShootFx.shootLiquid;
range = 90f;
health = 360;
drawer = (tile, entity) -> {
Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
Draw.color(entity.liquids.current().color);
Draw.alpha(entity.liquids.total() / liquidCapacity);
Draw.rect(name + "-liquid", tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
Draw.color();
};
}};
lancer = new ChargeTurret("lancer"){{
range = 170f;
chargeTime = 50f;
chargeMaxDelay = 30f;
chargeEffects = 7;
shootType = AmmoTypes.lancerLaser;
recoil = 2f;
reload = 120f;
cooldown = 0.03f;
powerUsed = 1 / 3f;
consumes.powerBuffered(60f);
shootShake = 2f;
shootEffect = ShootFx.lancerLaserShoot;
smokeEffect = ShootFx.lancerLaserShootSmoke;
chargeEffect = ShootFx.lancerLaserCharge;
chargeBeginEffect = ShootFx.lancerLaserChargeBegin;
heatColor = Color.RED;
size = 2;
health = 320;
targetAir = false;
}};
arc = new PowerTurret("arc"){{
shootType = AmmoTypes.arc;
reload = 20f;
shootShake = 0f;
shootCone = 40f;
rotatespeed = 8f;
powerUsed = 1f / 3f;
consumes.powerBuffered(30f);
range = 50f;
shootEffect = ShootFx.lightningShoot;
heatColor = Color.RED;
recoil = 1f;
size = 1;
}};
swarmer = new BurstTurret("swarmer"){{
ammoTypes = new AmmoType[]{AmmoTypes.missileExplosive, AmmoTypes.missileIncindiary, AmmoTypes.missileSurge};
reload = 50f;
shots = 4;
burstSpacing = 5;
inaccuracy = 10f;
range = 140f;
xRand = 6f;
size = 2;
health = 380;
}};
salvo = new BurstTurret("salvo"){
TextureRegion[] panels = new TextureRegion[2];
@Override
public void load() {
super.load();
panels[0] = Core.atlas.find(name + "-panel-left");
panels[1] = Core.atlas.find(name + "-panel-right");
}
{
size = 2;
range = 120f;
ammoTypes = new AmmoType[]{AmmoTypes.bulletCopper, AmmoTypes.bulletDense, AmmoTypes.bulletPyratite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
reload = 35f;
restitution = 0.03f;
ammoEjectBack = 3f;
cooldown = 0.03f;
recoil = 3f;
shootShake = 2f;
burstSpacing = 4;
shots = 3;
ammoUseEffect = ShootFx.shellEjectBig;
drawer = (tile, entity) -> {
Draw.rect(region, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90);
float offsetx = (int) (abscurve(Mathf.curve(entity.reload / reload, 0.3f, 0.2f)) * 3f);
float offsety = -(int) (abscurve(Mathf.curve(entity.reload / reload, 0.3f, 0.2f)) * 2f);
for(int i : Mathf.signs){
float rot = entity.rotation + 90 * i;
Draw.rect(panels[i == -1 ? 0 : 1],
tile.drawx() + tr2.x + Angles.trnsx(rot, offsetx, offsety),
tile.drawy() + tr2.y + Angles.trnsy(rot, -offsetx, offsety), entity.rotation - 90);
}
};
health = 360;
}
/** Converts a value range from 0-1 to a value range 0-1-0. */
float abscurve(float f){
return 1f - Math.abs(f - 0.5f) * 2f;
}
};
ripple = new ArtilleryTurret("ripple"){{
ammoTypes = new AmmoType[]{AmmoTypes.artilleryDense, AmmoTypes.artilleryHoming, AmmoTypes.artilleryIncindiary, AmmoTypes.artilleryExplosive, AmmoTypes.artilleryPlastic};
size = 3;
shots = 4;
inaccuracy = 12f;
reload = 60f;
ammoEjectBack = 5f;
ammoUseEffect = ShootFx.shellEjectBig;
cooldown = 0.03f;
velocityInaccuracy = 0.2f;
restitution = 0.02f;
recoil = 6f;
shootShake = 2f;
range = 320f;
health = 550;
}};
cyclone = new ItemTurret("cyclone"){{
ammoTypes = new AmmoType[]{AmmoTypes.flakExplosive, AmmoTypes.flakPlastic, AmmoTypes.flakSurge};
xRand = 4f;
reload = 8f;
range = 145f;
size = 3;
recoil = 3f;
rotatespeed = 10f;
inaccuracy = 13f;
shootCone = 30f;
health = 145 * size * size;
}};
fuse = new ItemTurret("fuse"){{
ammoTypes = new AmmoType[]{AmmoTypes.fuseShotgun};
reload = 50f;
shootShake = 4f;
range = 80f;
recoil = 5f;
restitution = 0.1f;
size = 3;
health = 155 * size * size;
}};
spectre = new DoubleTurret("spectre"){{
ammoTypes = new AmmoType[]{AmmoTypes.bulletDenseBig, AmmoTypes.bulletPyratiteBig, AmmoTypes.bulletThoriumBig};
reload = 6f;
coolantMultiplier = 0.5f;
maxCoolantUsed = 1.5f;
restitution = 0.1f;
ammoUseEffect = ShootFx.shellEjectBig;
range = 200f;
inaccuracy = 3f;
recoil = 3f;
xRand = 3f;
shotWidth = 4f;
shootShake = 2f;
shots = 2;
size = 4;
shootCone = 24f;
health = 155 * size * size;
}};
meltdown = new LaserTurret("meltdown"){{
shootType = AmmoTypes.meltdownLaser;
shootEffect = ShootFx.shootBigSmoke2;
shootCone = 40f;
recoil = 4f;
size = 4;
shootShake = 2f;
powerUsed = 0.5f;
consumes.powerBuffered(120f);
range = 160f;
reload = 200f;
firingMoveFract = 0.1f;
shootDuration = 220f;
health = 165 * size * size;
}};
}
}

View File

@@ -1,95 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.UnitTypes;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.units.*;
public class UnitBlocks extends BlockList implements ContentList{
public static Block
spiritFactory, phantomFactory,
wraithFactory, ghoulFactory, revenantFactory,
daggerFactory, titanFactory, fortressFactory,
reconstructor, repairPoint, commandCenter;
@Override
public void load(){
spiritFactory = new UnitFactory("spirit-factory"){{
type = UnitTypes.spirit;
produceTime = 5700;
size = 2;
consumes.power(0.08f);
consumes.items(new ItemStack(Items.silicon, 30), new ItemStack(Items.lead, 30));
}};
phantomFactory = new UnitFactory("phantom-factory"){{
type = UnitTypes.phantom;
produceTime = 7300;
size = 2;
consumes.power(0.2f);
consumes.items(new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80));
}};
wraithFactory = new UnitFactory("wraith-factory"){{
type = UnitTypes.wraith;
produceTime = 1800;
size = 2;
consumes.power(0.1f);
consumes.items(new ItemStack(Items.silicon, 10), new ItemStack(Items.titanium, 10));
}};
ghoulFactory = new UnitFactory("ghoul-factory"){{
type = UnitTypes.ghoul;
produceTime = 3600;
size = 3;
consumes.power(0.2f);
consumes.items(new ItemStack(Items.silicon, 30), new ItemStack(Items.titanium, 30), new ItemStack(Items.plastanium, 20));
}};
revenantFactory = new UnitFactory("revenant-factory"){{
type = UnitTypes.revenant;
produceTime = 8000;
size = 4;
consumes.power(0.3f);
consumes.items(new ItemStack(Items.silicon, 80), new ItemStack(Items.titanium, 80), new ItemStack(Items.plastanium, 50));
}};
daggerFactory = new UnitFactory("dagger-factory"){{
type = UnitTypes.dagger;
produceTime = 1700;
size = 2;
consumes.power(0.05f);
consumes.items(new ItemStack(Items.silicon, 10));
}};
titanFactory = new UnitFactory("titan-factory"){{
type = UnitTypes.titan;
produceTime = 3400;
size = 3;
consumes.power(0.15f);
consumes.items(new ItemStack(Items.silicon, 20), new ItemStack(Items.thorium, 30));
}};
fortressFactory = new UnitFactory("fortress-factory"){{
type = UnitTypes.fortress;
produceTime = 5000;
size = 3;
consumes.power(0.2f);
consumes.items(new ItemStack(Items.silicon, 40), new ItemStack(Items.thorium, 50));
}};
repairPoint = new RepairPoint("repair-point"){{
repairSpeed = 0.1f;
}};
reconstructor = new Reconstructor("reconstructor"){{
size = 2;
}};
commandCenter = new CommandCenter("command-center"){{
size = 2;
}};
}
}

View File

@@ -1,61 +0,0 @@
package io.anuke.mindustry.content.blocks;
import io.anuke.mindustry.content.Mechs;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.units.MechPad;
public class UpgradeBlocks extends BlockList{
public static Block alphaPad, deltaPad, tauPad, omegaPad, dartPad, javelinPad, tridentPad, glaivePad;
@Override
public void load(){
alphaPad = new MechPad("alpha-mech-pad"){{
mech = Mechs.alpha;
size = 2;
consumes.powerBuffered(50f);
}};
deltaPad = new MechPad("delta-mech-pad"){{
mech = Mechs.delta;
size = 2;
consumes.powerBuffered(70f);
}};
tauPad = new MechPad("tau-mech-pad"){{
mech = Mechs.tau;
size = 2;
consumes.powerBuffered(100f);
}};
omegaPad = new MechPad("omega-mech-pad"){{
mech = Mechs.omega;
size = 3;
consumes.powerBuffered(120f);
}};
dartPad = new MechPad("dart-ship-pad"){{
mech = Mechs.dart;
size = 2;
consumes.powerBuffered(50f);
}};
javelinPad = new MechPad("javelin-ship-pad"){{
mech = Mechs.javelin;
size = 2;
consumes.powerBuffered(80f);
}};
tridentPad = new MechPad("trident-ship-pad"){{
mech = Mechs.trident;
size = 2;
consumes.powerBuffered(100f);
}};
glaivePad = new MechPad("glaive-ship-pad"){{
mech = Mechs.glaive;
size = 3;
consumes.powerBuffered(120f);
}};
}
}

View File

@@ -1,123 +0,0 @@
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.ArtilleryBulletType;
import io.anuke.mindustry.entities.bullet.BasicBulletType;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.game.ContentList;
public class ArtilleryBullets extends BulletList implements ContentList{
public static BulletType dense, plastic, plasticFrag, homing, incindiary, explosive, surge, unit;
@Override
public void load(){
dense = new ArtilleryBulletType(3f, 0, "shell"){
{
hiteffect = BulletFx.flakExplosion;
knockback = 0.8f;
lifetime = 50f;
bulletWidth = bulletHeight = 11f;
collidesTiles = false;
splashDamageRadius = 25f;
splashDamage = 33f;
}
};
plasticFrag = new BasicBulletType(2.5f, 6, "bullet"){
{
bulletWidth = 10f;
bulletHeight = 12f;
bulletShrink = 1f;
lifetime = 15f;
backColor = Palette.plastaniumBack;
frontColor = Palette.plastaniumFront;
despawneffect = Fx.none;
}
};
plastic = new ArtilleryBulletType(3.3f, 0, "shell"){
{
hiteffect = BulletFx.plasticExplosion;
knockback = 1f;
lifetime = 55f;
bulletWidth = bulletHeight = 13f;
collidesTiles = false;
splashDamageRadius = 35f;
splashDamage = 35f;
fragBullet = plasticFrag;
fragBullets = 9;
backColor = Palette.plastaniumBack;
frontColor = Palette.plastaniumFront;
}
};
homing = new ArtilleryBulletType(3f, 0, "shell"){
{
hiteffect = BulletFx.flakExplosion;
knockback = 0.8f;
lifetime = 45f;
bulletWidth = bulletHeight = 11f;
collidesTiles = false;
splashDamageRadius = 25f;
splashDamage = 33f;
homingPower = 2f;
homingRange = 50f;
}
};
incindiary = new ArtilleryBulletType(3f, 0, "shell"){
{
hiteffect = BulletFx.blastExplosion;
knockback = 0.8f;
lifetime = 60f;
bulletWidth = bulletHeight = 13f;
collidesTiles = false;
splashDamageRadius = 25f;
splashDamage = 30f;
incendAmount = 4;
incendSpread = 11f;
frontColor = Palette.lightishOrange;
backColor = Palette.lightOrange;
trailEffect = BulletFx.incendTrail;
}
};
explosive = new ArtilleryBulletType(2f, 0, "shell"){
{
hiteffect = BulletFx.blastExplosion;
knockback = 0.8f;
lifetime = 70f;
bulletWidth = bulletHeight = 14f;
collidesTiles = false;
splashDamageRadius = 45f;
splashDamage = 50f;
backColor = Palette.missileYellowBack;
frontColor = Palette.missileYellow;
}
};
unit = new ArtilleryBulletType(2f, 0, "shell"){
{
hiteffect = BulletFx.blastExplosion;
knockback = 0.8f;
lifetime = 90f;
bulletWidth = bulletHeight = 14f;
collides = true;
collidesTiles = true;
splashDamageRadius = 45f;
splashDamage = 50f;
backColor = Palette.bulletYellowBack;
frontColor = Palette.bulletYellow;
}
};
surge = new ArtilleryBulletType(3f, 0, "shell"){
{
//TODO
}
};
}
}

View File

@@ -1,12 +0,0 @@
package io.anuke.mindustry.content.bullets;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ContentType;
public abstract class BulletList implements ContentList{
@Override
public ContentType type(){
return ContentType.bullet;
}
}

View File

@@ -1,51 +0,0 @@
package io.anuke.mindustry.content.bullets;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.bullet.FlakBulletType;
import io.anuke.mindustry.entities.effect.Lightning;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.game.ContentList;
import io.anuke.arc.math.Mathf;
public class FlakBullets extends BulletList implements ContentList{
public static BulletType plastic, explosive, surge;
@Override
public void load(){
plastic = new FlakBulletType(4f, 5){
{
splashDamageRadius = 40f;
fragBullet = ArtilleryBullets.plasticFrag;
fragBullets = 4;
hiteffect = BulletFx.plasticExplosion;
frontColor = Palette.plastaniumFront;
backColor = Palette.plastaniumBack;
}
};
explosive = new FlakBulletType(4f, 5){
{
//default bullet type, no changes
}
};
surge = new FlakBulletType(4f, 7){
{
splashDamage = 33f;
}
@Override
public void despawned(Bullet b) {
super.despawned(b);
for (int i = 0; i < 2; i++) {
Lightning.create(b.getTeam(), Palette.surge, damage, b.x, b.y, Mathf.random(360f), 12);
}
}
};
}
}

View File

@@ -1,124 +0,0 @@
package io.anuke.mindustry.content.bullets;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.bullet.MissileBulletType;
import io.anuke.mindustry.entities.effect.Lightning;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.game.ContentList;
import io.anuke.arc.util.Time;
import io.anuke.arc.math.Mathf;
public class MissileBullets extends BulletList implements ContentList{
public static BulletType explosive, incindiary, surge, javelin, swarm;
@Override
public void load(){
explosive = new MissileBulletType(1.8f, 10, "missile"){
{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.01f;
splashDamageRadius = 30f;
splashDamage = 30f;
lifetime = 150f;
hiteffect = BulletFx.blastExplosion;
despawneffect = BulletFx.blastExplosion;
}
};
incindiary = new MissileBulletType(2f, 12, "missile"){
{
frontColor = Palette.lightishOrange;
backColor = Palette.lightOrange;
bulletWidth = 7f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.01f;
homingPower = 7f;
splashDamageRadius = 10f;
splashDamage = 10f;
lifetime = 160f;
hiteffect = BulletFx.blastExplosion;
incendSpread = 10f;
incendAmount = 3;
}
};
surge = new MissileBulletType(3.5f, 15, "bullet"){
{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.01f;
splashDamageRadius = 30f;
splashDamage = 22f;
lifetime = 150f;
hiteffect = BulletFx.blastExplosion;
despawneffect = BulletFx.blastExplosion;
}
@Override
public void hit(Bullet b) {
super.hit(b);
for (int i = 0; i < 2; i++) {
Lightning.create(b.getTeam(), Palette.surge, damage, b.x, b.y, Mathf.random(360f), 14);
}
}
};
javelin = new MissileBulletType(5f, 10.5f, "missile"){
{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.003f;
keepVelocity = false;
splashDamageRadius = 20f;
splashDamage = 1f;
lifetime = 90f;
trailColor = Color.valueOf("b6c6fd");
hiteffect = BulletFx.blastExplosion;
despawneffect = BulletFx.blastExplosion;
backColor = Palette.bulletYellowBack;
frontColor = Palette.bulletYellow;
}
@Override
public void update(Bullet b){
super.update(b);
b.getVelocity().rotate(Mathf.sin(Time.time() + b.id * 4422, 8f, 2f));
}
};
swarm = new MissileBulletType(2.7f, 12, "missile"){
{
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.003f;
homingRange = 60f;
keepVelocity = false;
splashDamageRadius = 25f;
splashDamage = 10f;
lifetime = 120f;
trailColor = Color.GRAY;
backColor = Palette.bulletYellowBack;
frontColor = Palette.bulletYellow;
hiteffect = BulletFx.blastExplosion;
despawneffect = BulletFx.blastExplosion;
}
@Override
public void update(Bullet b){
super.update(b);
b.getVelocity().rotate(Mathf.sin(Time.time() + b.id * 4422, 8f, 2f));
}
};
}
}

View File

@@ -1,108 +0,0 @@
package io.anuke.mindustry.content.bullets;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.entities.bullet.BasicBulletType;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.game.ContentList;
public class StandardBullets extends BulletList implements ContentList{
public static BulletType copper, dense, thorium, homing, tracer, mechSmall, glaive, denseBig, thoriumBig, tracerBig;
@Override
public void load(){
copper = new BasicBulletType(2.5f, 7, "bullet"){
{
bulletWidth = 7f;
bulletHeight = 9f;
}
};
dense = new BasicBulletType(3.5f, 18, "bullet"){
{
bulletWidth = 9f;
bulletHeight = 12f;
armorPierce = 0.2f;
}
};
thorium = new BasicBulletType(4f, 29, "bullet"){
{
bulletWidth = 10f;
bulletHeight = 13f;
armorPierce = 0.5f;
}
};
homing = new BasicBulletType(3f, 9, "bullet"){
{
bulletWidth = 7f;
bulletHeight = 9f;
homingPower = 5f;
}
};
tracer = new BasicBulletType(3.2f, 11, "bullet"){
{
bulletWidth = 10f;
bulletHeight = 12f;
frontColor = Palette.lightishOrange;
backColor = Palette.lightOrange;
incendSpread = 3f;
incendAmount = 1;
incendChance = 0.3f;
}
};
glaive = new BasicBulletType(4f, 7.5f, "bullet"){
{
bulletWidth = 10f;
bulletHeight = 12f;
frontColor = Color.valueOf("feb380");
backColor = Color.valueOf("ea8878");
incendSpread = 3f;
incendAmount = 1;
incendChance = 0.3f;
}
};
mechSmall = new BasicBulletType(4f, 9, "bullet"){
{
bulletWidth = 11f;
bulletHeight = 14f;
lifetime = 40f;
despawneffect = BulletFx.hitBulletSmall;
}
};
denseBig = new BasicBulletType(7f, 42, "bullet"){
{
bulletWidth = 15f;
bulletHeight = 21f;
armorPierce = 0.2f;
}
};
thoriumBig = new BasicBulletType(8f, 65, "bullet"){
{
bulletWidth = 16f;
bulletHeight = 23f;
armorPierce = 0.5f;
}
};
tracerBig = new BasicBulletType(7f, 38, "bullet"){
{
bulletWidth = 16f;
bulletHeight = 21f;
frontColor = Palette.lightishOrange;
backColor = Palette.lightOrange;
incendSpread = 3f;
incendAmount = 2;
incendChance = 0.3f;
}
};
}
}

View File

@@ -1,428 +0,0 @@
package io.anuke.mindustry.content.bullets;
import io.anuke.arc.entities.Effects;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.CapStyle;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Fill;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.content.StatusEffects;
import io.anuke.mindustry.content.fx.BlockFx;
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.Damage;
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.Fire;
import io.anuke.mindustry.entities.effect.Lightning;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Shapes;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.BuildBlock;
import io.anuke.mindustry.world.blocks.distribution.MassDriver.DriverBulletData;
import static io.anuke.mindustry.Vars.content;
import static io.anuke.mindustry.Vars.world;
public class TurretBullets extends BulletList implements ContentList{
public static BulletType fireball, basicFlame, lancerLaser, burstLaser, meltdownLaser,
fuseShot, waterShot, cryoShot, lavaShot, oilShot, lightning, driverBolt, healBullet, arc, damageLightning;
@Override
public void load(){
damageLightning = new BulletType(0.0001f, 0f){
{
lifetime = Lightning.lifetime;
hiteffect = BulletFx.hitLancer;
despawneffect = Fx.none;
status = StatusEffects.shocked;
statusIntensity = 1f;
}
};
healBullet = new BulletType(5.2f, 13){
float healPercent = 3f;
{
hiteffect = BulletFx.hitLaser;
despawneffect = BulletFx.hitLaser;
collidesTeam = true;
}
@Override
public boolean collides(Bullet b, Tile tile){
return tile.getTeam() != b.getTeam() || tile.entity.healthf() < 1f;
}
@Override
public void draw(Bullet b){
Draw.color(Palette.heal);
Lines.stroke(2f);
Lines.lineAngleCenter(b.x, b.y, b.angle(), 7f);
Draw.color(Color.WHITE);
Lines.lineAngleCenter(b.x, b.y, b.angle(), 3f);
Draw.reset();
}
@Override
public void hitTile(Bullet b, Tile tile){
super.hit(b);
tile = tile.target();
if(tile != null && tile.getTeam() == b.getTeam() && !(tile.block() instanceof BuildBlock)){
Effects.effect(BlockFx.healBlockFull, Palette.heal, tile.drawx(), tile.drawy(), tile.block().size);
tile.entity.healBy(healPercent / 100f * tile.entity.maxHealth());
}
}
};
fireball = new BulletType(1f, 4){
{
pierce = true;
hitTiles = false;
collides = false;
collidesTiles = false;
drag = 0.03f;
hiteffect = despawneffect = Fx.none;
}
@Override
public void init(Bullet b){
b.getVelocity().setLength(0.6f + Mathf.random(2f));
}
@Override
public void draw(Bullet b){
//TODO add color to the bullet depending on the color of the flame it came from
Draw.color(Palette.lightFlame, Palette.darkFlame, Color.GRAY, b.fin());
Fill.circle(b.x, b.y, 3f * b.fout());
Draw.reset();
}
@Override
public void update(Bullet b){
if(Mathf.chance(0.04 * Time.delta())){
Tile tile = world.tileWorld(b.x, b.y);
if(tile != null){
Fire.create(tile);
}
}
if(Mathf.chance(0.1 * Time.delta())){
Effects.effect(EnvironmentFx.fireballsmoke, b.x, b.y);
}
if(Mathf.chance(0.1 * Time.delta())){
Effects.effect(EnvironmentFx.ballfire, b.x, b.y);
}
}
};
basicFlame = new BulletType(2.3f, 5){
{
hitsize = 7f;
lifetime = 35f;
pierce = true;
drag = 0.05f;
hiteffect = BulletFx.hitFlameSmall;
despawneffect = Fx.none;
status = StatusEffects.burning;
}
@Override
public void draw(Bullet b){
}
};
lancerLaser = new BulletType(0.001f, 60){
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 = 170f;
{
hiteffect = BulletFx.hitLancer;
despawneffect = Fx.none;
hitsize = 4;
lifetime = 16f;
pierce = true;
}
@Override
public void init(Bullet b){
Damage.collideLine(b, b.getTeam(), hiteffect, b.x, b.y, b.angle(), length);
}
@Override
public void draw(Bullet b){
float f = Mathf.curve(b.fin(), 0f, 0.2f);
float baseLen = length * f;
Lines.lineAngle(b.x, b.y, b.angle(), baseLen);
for(int s = 0; s < 3; s++){
Draw.color(colors[s]);
for(int i = 0; i < tscales.length; i++){
Lines.stroke(7f * b.fout() * (s == 0 ? 1.5f : s == 1 ? 1f : 0.3f) * tscales[i]);
Lines.lineAngle(b.x, b.y, b.angle(), baseLen * lenscales[i]);
}
}
Draw.reset();
}
};
meltdownLaser = new BulletType(0.001f, 26){
Color tmpColor = new Color();
Color[] colors = {Color.valueOf("ec745855"), Color.valueOf("ec7458aa"), Color.valueOf("ff9c5a"), Color.WHITE};
float[] tscales = {1f, 0.7f, 0.5f, 0.2f};
float[] strokes = {2f, 1.5f, 1f, 0.3f};
float[] lenscales = {1f, 1.12f, 1.15f, 1.17f};
float length = 200f;
{
hiteffect = BulletFx.hitMeltdown;
despawneffect = Fx.none;
hitsize = 4;
drawSize = 420f;
lifetime = 16f;
pierce = true;
}
@Override
public void update(Bullet b){
if(b.timer.get(1, 5f)){
Damage.collideLine(b, b.getTeam(), hiteffect, b.x, b.y, b.angle(), length);
}
Effects.shake(1f, 1f, b.x, b.y);
}
@Override
public void hit(Bullet b, float hitx, float hity){
Effects.effect(hiteffect, colors[2], hitx, hity);
if(Mathf.chance(0.4)){
Fire.create(world.tileWorld(hitx+Mathf.range(5f), hity+Mathf.range(5f)));
}
}
@Override
public void draw(Bullet b){
float baseLen = (length) * b.fout();
Lines.lineAngle(b.x, b.y, b.angle(), baseLen);
for(int s = 0; s < colors.length; s++){
Draw.color(tmpColor.set(colors[s]).mul(1f + Mathf.absin(Time.time(), 1f, 0.1f)));
for(int i = 0; i < tscales.length; i++){
vector.trns(b.angle() + 180f, (lenscales[i] - 1f) * 35f);
Lines.stroke((9f + Mathf.absin(Time.time(), 0.8f, 1.5f)) * b.fout() * strokes[s] * tscales[i]);
Lines.lineAngle(b.x + vector.x, b.y + vector.y, b.angle(), baseLen * lenscales[i], CapStyle.none);
}
}
Draw.reset();
}
};
fuseShot = new BulletType(0.01f, 70){
int rays = 3;
float raySpace = 2f;
float rayLength = 80f;
{
hiteffect = BulletFx.hitFuse;
lifetime = 13f;
despawneffect = Fx.none;
pierce = true;
}
@Override
public void init(Bullet b) {
for (int i = 0; i < rays; i++) {
float offset = (i-rays/2)*raySpace;
vector.trns(b.angle(), 0.01f, offset);
Damage.collideLine(b, b.getTeam(), hiteffect, b.x, b.y, b.angle(), rayLength - Math.abs(i - (rays/2))*20f);
}
}
@Override
public void draw(Bullet b) {
super.draw(b);
Draw.color(Color.WHITE, Palette.surge, b.fin());
for(int i = 0; i < 7; i++){
vector.trns(b.angle(), i * 8f);
float sl = Mathf.clamp(b.fout()-0.5f) * (80f - i *10);
Shapes.tri(b.x + vector.x, b.y + vector.y, 4f, sl, b.angle() + 90);
Shapes.tri(b.x + vector.x, b.y + vector.y, 4f, sl, b.angle() - 90);
}
Shapes.tri(b.x, b.y, 13f, (rayLength+50) * b.fout(), b.angle());
Shapes.tri(b.x, b.y, 13f, 10f * b.fout(), b.angle() + 180f);
Draw.reset();
}
//TODO
};
waterShot = new LiquidBulletType(Liquids.water){
{
status = StatusEffects.wet;
statusIntensity = 0.5f;
knockback = 0.65f;
}
};
cryoShot = new LiquidBulletType(Liquids.cryofluid){
{
status = StatusEffects.freezing;
statusIntensity = 0.5f;
}
};
lavaShot = new LiquidBulletType(Liquids.lava){
{
damage = 4;
speed = 1.9f;
drag = 0.03f;
status = StatusEffects.melting;
statusIntensity = 0.5f;
}
};
oilShot = new LiquidBulletType(Liquids.oil){
{
speed = 2f;
drag = 0.03f;
status = StatusEffects.tarred;
statusIntensity = 0.5f;
}
};
lightning = new BulletType(0.001f, 12f){
{
lifetime = 1f;
despawneffect = Fx.none;
hiteffect = BulletFx.hitLancer;
keepVelocity = false;
}
@Override
public void draw(Bullet b){
}
@Override
public void init(Bullet b){
Lightning.create(b.getTeam(), Palette.lancerLaser, damage, b.x, b.y, b.angle(), 30);
}
};
arc = new BulletType(0.001f, 8){
{
lifetime = 1;
despawneffect = Fx.none;
hiteffect = BulletFx.hitLancer;
}
@Override
public void draw(Bullet b){
}
@Override
public void init(Bullet b){
Lightning.create(b.getTeam(), Palette.lancerLaser, damage, b.x, b.y, b.angle(), 36);
}
};
driverBolt = new BulletType(5.3f, 50){
{
collidesTiles = false;
lifetime = 200f;
despawneffect = BlockFx.smeltsmoke;
hiteffect = BulletFx.hitBulletBig;
drag = 0.005f;
}
@Override
public void draw(Bullet b){
float w = 11f, h = 13f;
Draw.color(Palette.bulletYellowBack);
Draw.rect("shell-back", b.x, b.y, w, h, b.angle() + 90);
Draw.color(Palette.bulletYellow);
Draw.rect("shell", b.x, b.y, w, h, b.angle() + 90);
Draw.reset();
}
@Override
public void update(Bullet b){
//data MUST be an instance of DriverBulletData
if(!(b.getData() instanceof DriverBulletData)){
hit(b);
return;
}
float hitDst = 7f;
DriverBulletData data = (DriverBulletData) b.getData();
//if the target is dead, just keep flying until the bullet explodes
if(data.to.isDead()){
return;
}
float baseDst = data.from.dst(data.to);
float dst1 = b.dst(data.from);
float dst2 = b.dst(data.to);
boolean intersect = false;
//bullet has gone past the destination point: but did it intersect it?
if(dst1 > baseDst){
float angleTo = b.angleTo(data.to);
float baseAngle = data.to.angleTo(data.from);
//if angles are nearby, then yes, it did
if(Angles.near(angleTo, baseAngle, 2f)){
intersect = true;
//snap bullet position back; this is used for low-FPS situations
b.set(data.to.x + Angles.trnsx(baseAngle, hitDst), data.to.y + Angles.trnsy(baseAngle, hitDst));
}
}
//if on course and it's in range of the target
if(Math.abs(dst1 + dst2 - baseDst) < 4f && dst2 <= hitDst){
intersect = true;
} //else, bullet has gone off course, does not get recieved.
if(intersect){
data.to.handlePayload(b, data);
}
}
@Override
public void despawned(Bullet b){
super.despawned(b);
if(!(b.getData() instanceof DriverBulletData)) return;
DriverBulletData data = (DriverBulletData) b.getData();
data.to.isRecieving = false;
for(int i = 0; i < data.items.length; i++){
int amountDropped = Mathf.random(0, data.items[i]);
if(amountDropped > 0){
float angle = b.angle() + Mathf.range(100f);
Effects.effect(EnvironmentFx.dropItem, Color.WHITE, b.x, b.y, angle, content.item(i));
}
}
}
@Override
public void hit(Bullet b, float hitx, float hity){
super.hit(b, hitx, hity);
despawned(b);
}
};
}
}

View File

@@ -1,99 +0,0 @@
package io.anuke.mindustry.content.bullets;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.entities.bullet.BasicBulletType;
import io.anuke.mindustry.entities.bullet.BombBulletType;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.effect.Fire;
import io.anuke.mindustry.entities.effect.Puddle;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.world.Tile;
import io.anuke.arc.math.Mathf;
import static io.anuke.mindustry.Vars.world;
public class WeaponBullets extends BulletList{
public static BulletType tungstenShotgun, bombExplosive, bombIncendiary, bombOil, shellCarbide;
@Override
public void load(){
tungstenShotgun = new BasicBulletType(5f, 8, "bullet"){
{
bulletWidth = 8f;
bulletHeight = 9f;
bulletShrink = 0.5f;
lifetime = 50f;
drag = 0.04f;
}
};
bombExplosive = new BombBulletType(10f, 20f, "shell"){
{
bulletWidth = 9f;
bulletHeight = 13f;
hiteffect = BulletFx.flakExplosion;
}
};
bombIncendiary = new BombBulletType(7f, 10f, "shell"){
{
bulletWidth = 8f;
bulletHeight = 12f;
hiteffect = BulletFx.flakExplosion;
backColor = Palette.lightOrange;
frontColor = Palette.lightishOrange;
}
@Override
public void hit(Bullet b, float x, float y){
super.hit(b, x, y);
for(int i = 0; i < 3; i++){
float cx = x + Mathf.range(10f);
float cy = y + Mathf.range(10f);
Tile tile = world.tileWorld(cx, cy);
if(tile != null){
Fire.create(tile);
}
}
}
};
bombOil = new BombBulletType(2f, 3f, "shell"){
{
bulletWidth = 8f;
bulletHeight = 12f;
hiteffect = BlockFx.pulverize;
backColor = new Color(0x4f4f4fff);
frontColor = Color.GRAY;
}
@Override
public void hit(Bullet b, float x, float y){
super.hit(b, x, y);
for(int i = 0; i < 3; i++){
Tile tile = world.tileWorld(x + Mathf.range(8f), y + Mathf.range(8f));
Puddle.deposit(tile, Liquids.oil, 5f);
}
}
};
shellCarbide = new BasicBulletType(3.4f, 20, "bullet"){
{
bulletWidth = 10f;
bulletHeight = 12f;
bulletShrink = 0.4f;
lifetime = 40f;
drag = 0.025f;
fragBullets = 5;
hiteffect = BulletFx.flakExplosion;
fragBullet = tungstenShotgun;
}
};
}
}

View File

@@ -1,330 +0,0 @@
package io.anuke.mindustry.content.fx;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.game.ContentList;
import io.anuke.arc.entities.Effects.Effect;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Fill;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Tmp;
import static io.anuke.mindustry.Vars.tilesize;
public class BlockFx extends FxList implements ContentList{
public static Effect reactorsmoke, nuclearsmoke, nuclearcloud, redgeneratespark, generatespark, fuelburn, plasticburn,
pulverize, pulverizeRed, pulverizeRedder, pulverizeSmall, pulverizeMedium, producesmoke, smeltsmoke, formsmoke, blastsmoke,
lava, dooropen, doorclose, dooropenlarge, doorcloselarge, purify, purifyoil, purifystone, generate, mine, mineBig, mineHuge,
smelt, teleportActivate, teleport, teleportOut, ripple, bubble, commandSend, healBlock, healBlockFull, healWaveMend, overdriveWave,
overdriveBlockFull, shieldBreak;
@Override
public void load(){
reactorsmoke = new Effect(17, e -> {
Angles.randLenVectors(e.id, 4, e.fin() * 8f, (x, y) -> {
float size = 1f + e.fout() * 5f;
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
});
nuclearsmoke = new Effect(40, e -> {
Angles.randLenVectors(e.id, 4, e.fin() * 13f, (x, y) -> {
float size = e.fslope() * 4f;
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
});
nuclearcloud = new Effect(90, 200f, e -> {
Angles.randLenVectors(e.id, 10, e.finpow() * 90f, (x, y) -> {
float size = e.fout() * 14f;
Draw.color(Color.LIME, Color.GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
});
redgeneratespark = new Effect(18, e -> {
Angles.randLenVectors(e.id, 5, e.fin() * 8f, (x, y) -> {
float len = e.fout() * 4f;
Draw.color(Palette.redSpark, Color.GRAY, e.fin());
//Draw.alpha(e.fout());
Draw.rect("circle", e.x + x, e.y + y, len, len);
Draw.reset();
});
});
generatespark = new Effect(18, e -> {
Angles.randLenVectors(e.id, 5, e.fin() * 8f, (x, y) -> {
float len = e.fout() * 4f;
Draw.color(Palette.orangeSpark, Color.GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, len, len);
Draw.reset();
});
});
fuelburn = new Effect(23, e -> {
Angles.randLenVectors(e.id, 5, e.fin() * 9f, (x, y) -> {
float len = e.fout() * 4f;
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, len, len);
Draw.reset();
});
});
plasticburn = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.fin() * 5f, (x, y) -> {
Draw.color(Color.valueOf("e9ead3"), Color.GRAY, e.fin());
Fill.circle(e.x + x, e.y + y, e.fout() * 1f);
Draw.reset();
});
});
pulverize = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.fin() * 8f, (x, y) -> {
Draw.color(Palette.stoneGray);
Fill.square(e.x + x, e.y + y, e.fout() * 2f + 0.5f, 45);
Draw.reset();
});
});
pulverizeRed = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.fin() * 8f, (x, y) -> {
Draw.color(Palette.redDust, Palette.stoneGray, e.fin());
Fill.square(e.x + x, e.y + y, e.fout() * 2f + 0.5f, 45);
Draw.reset();
});
});
pulverizeRedder = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.fin() * 9f, (x, y) -> {
Draw.color(Palette.redderDust, Palette.stoneGray, e.fin());
Fill.square(e.x + x, e.y + y, e.fout() * 2.5f + 0.5f, 45);
Draw.reset();
});
});
pulverizeSmall = new Effect(30, e -> {
Angles.randLenVectors(e.id, 3, e.fin() * 5f, (x, y) -> {
Draw.color(Palette.stoneGray);
Fill.square(e.x + x, e.y + y, e.fout() * 1f + 0.5f, 45);
Draw.reset();
});
});
pulverizeMedium = new Effect(30, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.fin() * 8f, (x, y) -> {
Draw.color(Palette.stoneGray);
Fill.square(e.x + x, e.y + y, e.fout() * 1f + 0.5f, 45);
Draw.reset();
});
});
producesmoke = new Effect(12, e -> {
Angles.randLenVectors(e.id, 8, 4f + e.fin() * 18f, (x, y) -> {
Draw.color(Color.WHITE, Palette.accent, e.fin());
Fill.square(e.x + x, e.y + y, 1f + e.fout() * 3f, 45);
Draw.reset();
});
});
smeltsmoke = new Effect(15, e -> {
Angles.randLenVectors(e.id, 6, 4f + e.fin() * 5f, (x, y) -> {
Draw.color(Color.WHITE, e.color, e.fin());
Fill.square(e.x + x, e.y + y, 0.5f + e.fout() * 2f, 45);
Draw.reset();
});
});
formsmoke = new Effect(40, e -> {
Angles.randLenVectors(e.id, 6, 5f + e.fin() * 8f, (x, y) -> {
Draw.color(Palette.plasticSmoke, Color.LIGHT_GRAY, e.fin());
Fill.square(e.x + x, e.y + y, 0.2f + e.fout() * 2f, 45);
Draw.reset();
});
});
blastsmoke = new Effect(26, e -> {
Angles.randLenVectors(e.id, 12, 1f + e.fin() * 23f, (x, y) -> {
float size = 2f + e.fout() * 6f;
Draw.color(Color.LIGHT_GRAY, Color.DARK_GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
});
lava = new Effect(18, e -> {
Angles.randLenVectors(e.id, 3, 1f + e.fin() * 10f, (x, y) -> {
float size = e.fslope() * 4f;
Draw.color(Color.ORANGE, Color.GRAY, e.fin());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
});
dooropen = new Effect(10, e -> {
Lines.stroke(e.fout() * 1.6f);
Lines.square(e.x, e.y, tilesize / 2f + e.fin() * 2f);
Draw.reset();
});
doorclose = new Effect(10, e -> {
Lines.stroke(e.fout() * 1.6f);
Lines.square(e.x, e.y, tilesize / 2f + e.fout() * 2f);
Draw.reset();
});
dooropenlarge = new Effect(10, e -> {
Lines.stroke(e.fout() * 1.6f);
Lines.square(e.x, e.y, tilesize + e.fin() * 2f);
Draw.reset();
});
doorcloselarge = new Effect(10, e -> {
Lines.stroke(e.fout() * 1.6f);
Lines.square(e.x, e.y, tilesize + e.fout() * 2f);
Draw.reset();
});
purify = new Effect(10, e -> {
Draw.color(Color.ROYAL, Color.GRAY, e.fin());
Lines.stroke(2f);
Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6);
Draw.reset();
});
purifyoil = new Effect(10, e -> {
Draw.color(Color.BLACK, Color.GRAY, e.fin());
Lines.stroke(2f);
Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6);
Draw.reset();
});
purifystone = new Effect(10, e -> {
Draw.color(Color.ORANGE, Color.GRAY, e.fin());
Lines.stroke(2f);
Lines.spikes(e.x, e.y, e.fin() * 4f, 2, 6);
Draw.reset();
});
generate = new Effect(11, e -> {
Draw.color(Color.ORANGE, Color.YELLOW, e.fin());
Lines.stroke(1f);
Lines.spikes(e.x, e.y, e.fin() * 5f, 2, 8);
Draw.reset();
});
mine = new Effect(20, e -> {
Angles.randLenVectors(e.id, 6, 3f + e.fin() * 6f, (x, y) -> {
Draw.color(e.color, Color.LIGHT_GRAY, e.fin());
Fill.square(e.x + x, e.y + y, e.fout() * 2f, 45);
Draw.reset();
});
});
mineBig = new Effect(30, e -> {
Angles.randLenVectors(e.id, 6, 4f + e.fin() * 8f, (x, y) -> {
Draw.color(e.color, Color.LIGHT_GRAY, e.fin());
Fill.square(e.x + x, e.y + y, e.fout() * 2f + 0.2f, 45);
Draw.reset();
});
});
mineHuge = new Effect(40, e -> {
Angles.randLenVectors(e.id, 8, 5f + e.fin() * 10f, (x, y) -> {
Draw.color(e.color, Color.LIGHT_GRAY, e.fin());
Fill.square(e.x + x, e.y + y, e.fout() * 2f + 0.5f, 45);
Draw.reset();
});
});
smelt = new Effect(20, e -> {
Angles.randLenVectors(e.id, 6, 2f + e.fin() * 5f, (x, y) -> {
Draw.color(Color.WHITE, e.color, e.fin());
Fill.square(e.x + x, e.y + y, 0.5f + e.fout() * 2f, 45);
Draw.reset();
});
});
teleportActivate = new Effect(50, e -> {
Draw.color(e.color);
e.scaled(8f, e2 -> {
Lines.stroke(e2.fout() * 4f);
Lines.circle(e2.x, e2.y, 4f + e2.fin() * 27f);
});
Lines.stroke(e.fout() * 2f);
Angles.randLenVectors(e.id, 30, 4f + 40f * e.fin(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fin() * 4f + 1f);
});
Draw.reset();
});
teleport = new Effect(60, e -> {
Draw.color(e.color);
Lines.stroke(e.fin() * 2f);
Lines.circle(e.x, e.y, 7f + e.fout() * 8f);
Angles.randLenVectors(e.id, 20, 6f + 20f * e.fout(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fin() * 4f + 1f);
});
Draw.reset();
});
teleportOut = new Effect(20, e -> {
Draw.color(e.color);
Lines.stroke(e.fout() * 2f);
Lines.circle(e.x, e.y, 7f + e.fin() * 8f);
Angles.randLenVectors(e.id, 20, 4f + 20f * e.fin(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 4f + 1f);
});
Draw.reset();
});
ripple = new GroundEffect(false, 30, e -> {
Draw.color(Tmp.c1.set(e.color).shiftValue(0.1f));
Lines.stroke(e.fout() + 0.4f);
Lines.circle(e.x, e.y, 2f + e.fin() * 4f);
Draw.reset();
});
bubble = new Effect(20, e -> {
Draw.color(Tmp.c1.set(e.color).shiftValue(0.1f));
Lines.stroke(e.fout() + 0.2f);
Angles.randLenVectors(e.id, 2, 8f, (x, y) -> {
Lines.circle(e.x + x, e.y + y, 1f + e.fin() * 3f);
});
Draw.reset();
});
commandSend = new Effect(28, e -> {
Draw.color(Palette.command);
Lines.stroke(e.fout() * 2f);
Lines.poly(e.x, e.y, 40, 4f + e.finpow() * 120f);
Draw.color();
});
healWaveMend = new Effect(40, e -> {
Draw.color(e.color);
Lines.stroke(e.fout() * 2f);
Lines.poly(e.x, e.y, 30, e.finpow() * e.rotation);
Draw.color();
});
overdriveWave = new Effect(50, e -> {
Draw.color(e.color);
Lines.stroke(e.fout() * 1f);
Lines.poly(e.x, e.y, 30, e.finpow() * e.rotation);
Draw.color();
});
healBlock = new Effect(20, e -> {
Draw.color(Palette.heal);
Lines.stroke(2f * e.fout() + 0.5f);
Lines.square(e.x, e.y, 1f + (e.fin() * e.rotation * tilesize/2f-1f));
Draw.color();
});
healBlockFull = new Effect(20, e -> {
Draw.color(e.color);
Draw.alpha(e.fout());
Fill.square(e.x, e.y, e.rotation * tilesize / 2f);
Draw.color();
});
overdriveBlockFull = new Effect(60, e -> {
Draw.color(e.color);
Draw.alpha(e.fslope() * 0.4f);
Fill.square(e.x, e.y, e.rotation * tilesize);
Draw.color();
});
shieldBreak = new Effect(40, e -> {
Draw.color(Palette.accent);
Lines.stroke(3f * e.fout());
Lines.poly(e.x, e.y, 6, e.rotation + e.fin(), 90);
Draw.reset();
});
}
}

View File

@@ -1,281 +0,0 @@
package io.anuke.mindustry.content.fx;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.game.ContentList;
import io.anuke.arc.entities.Effects.Effect;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Fill;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
public class BulletFx extends FxList implements ContentList{
public static Effect hitBulletSmall, hitFuse, hitBulletBig, hitFlameSmall, hitLiquid, hitLaser, hitLancer, hitMeltdown, despawn, flakExplosion, blastExplosion, plasticExplosion,
artilleryTrail, incendTrail, missileTrail, absorb, flakExplosionBig, plasticExplosionFlak;
@Override
public void load(){
hitBulletSmall = new Effect(14, e -> {
Draw.color(Color.WHITE, Palette.lightOrange, e.fin());
e.scaled(7f, s -> {
Lines.stroke(0.5f + s.fout());
Lines.circle(e.x, e.y, s.fin()*5f);
});
Lines.stroke(0.5f + e.fout());
Angles.randLenVectors(e.id, 5, e.fin() * 15f, (x, y) -> {
float ang = Mathf.angle(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 3 + 1f);
});
Draw.reset();
});
hitFuse = new Effect(14, e -> {
Draw.color(Color.WHITE, Palette.surge, e.fin());
e.scaled(7f, s -> {
Lines.stroke(0.5f + s.fout());
Lines.circle(e.x, e.y, s.fin()*7f);
});
Lines.stroke(0.5f + e.fout());
Angles.randLenVectors(e.id, 6, e.fin() * 15f, (x, y) -> {
float ang = Mathf.angle(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 3 + 1f);
});
Draw.reset();
});
hitBulletBig = new Effect(13, e -> {
Draw.color(Color.WHITE, Palette.lightOrange, e.fin());
Lines.stroke(0.5f + e.fout() * 1.5f);
Angles.randLenVectors(e.id, 8, e.finpow() * 30f, e.rotation, 50f, (x, y) -> {
float ang = Mathf.angle(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1.5f);
});
Draw.reset();
});
hitFlameSmall = new Effect(14, e -> {
Draw.color(Palette.lightFlame, Palette.darkFlame, e.fin());
Lines.stroke(0.5f + e.fout());
Angles.randLenVectors(e.id, 5, e.fin() * 15f, e.rotation, 50f, (x, y) -> {
float ang = Mathf.angle(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 3 + 1f);
});
Draw.reset();
});
hitLiquid = new Effect(16, e -> {
Draw.color(e.color);
Angles.randLenVectors(e.id, 5, e.fin() * 15f, e.rotation + 180f, 60f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 2f);
});
Draw.reset();
});
hitLancer = new Effect(12, e -> {
Draw.color(Color.WHITE);
Lines.stroke(e.fout() * 1.5f);
Angles.randLenVectors(e.id, 8, e.finpow() * 17f, e.rotation, 360f, (x, y) -> {
float ang = Mathf.angle(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1f);
});
Draw.reset();
});
hitMeltdown = new Effect(12, e -> {
Draw.color(Palette.meltdownHit);
Lines.stroke(e.fout() * 2f);
Angles.randLenVectors(e.id, 6, e.finpow() * 18f, e.rotation, 360f, (x, y) -> {
float ang = Mathf.angle(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 4 + 1f);
});
Draw.reset();
});
hitLaser = new Effect(8, e -> {
Draw.color(Color.WHITE, Palette.heal, e.fin());
Lines.stroke(0.5f + e.fout());
Lines.circle(e.x, e.y, e.fin()*5f);
Draw.reset();
});
despawn = new Effect(12, e -> {
Draw.color(Palette.lighterOrange, Color.GRAY, e.fin());
Lines.stroke(e.fout());
Angles.randLenVectors(e.id, 7, e.fin() * 7f, e.rotation, 40f, (x, y) -> {
float ang = Mathf.angle(x, y);
Lines.lineAngle(e.x + x, e.y + y, ang, e.fout() * 2 + 1f);
});
Draw.reset();
});
flakExplosion = new Effect(20, e -> {
Draw.color(Palette.bulletYellow);
e.scaled(6, i -> {
Lines.stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 10f);
});
Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 5, 2f + 23f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 3f + 0.5f);
});
Draw.color(Palette.lighterOrange);
Lines.stroke(1f * e.fout());
Angles.randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
});
Draw.reset();
});
plasticExplosion = new Effect(24, e -> {
Draw.color(Palette.plastaniumFront);
e.scaled(7, i -> {
Lines.stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 24f);
});
Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 7, 2f + 28f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.5f);
});
Draw.color(Palette.plastaniumBack);
Lines.stroke(1f * e.fout());
Angles.randLenVectors(e.id + 1, 4, 1f + 25f * e.finpow(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
});
Draw.reset();
});
plasticExplosionFlak = new Effect(28, e -> {
Draw.color(Palette.plastaniumFront);
e.scaled(7, i -> {
Lines.stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 34f);
});
Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 7, 2f + 30f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.5f);
});
Draw.color(Palette.plastaniumBack);
Lines.stroke(1f * e.fout());
Angles.randLenVectors(e.id + 1, 4, 1f + 30f * e.finpow(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
});
Draw.reset();
});
blastExplosion = new Effect(22, e -> {
Draw.color(Palette.missileYellow);
e.scaled(6, i -> {
Lines.stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 15f);
});
Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 5, 2f + 23f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.5f);
});
Draw.color(Palette.missileYellowBack);
Lines.stroke(1f * e.fout());
Angles.randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
});
Draw.reset();
});
artilleryTrail = new Effect(50, e -> {
Draw.color(e.color);
Fill.circle(e.x, e.y, e.rotation * e.fout());
Draw.reset();
});
incendTrail = new Effect(50, e -> {
Draw.color(Palette.lightOrange);
Fill.circle(e.x, e.y, e.rotation * e.fout());
Draw.reset();
});
missileTrail = new Effect(50, e -> {
Draw.color(e.color);
Fill.circle(e.x, e.y, e.rotation * e.fout());
Draw.reset();
});
absorb = new Effect(12, e -> {
Draw.color(Palette.accent);
Lines.stroke(2f * e.fout());
Lines.circle(e.x, e.y, 5f * e.fout());
Draw.reset();
});
flakExplosionBig = new Effect(30, e -> {
Draw.color(Palette.bulletYellowBack);
e.scaled(6, i -> {
Lines.stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 25f);
});
Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 6, 2f + 23f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.5f);
});
Draw.color(Palette.bulletYellow);
Lines.stroke(1f * e.fout());
Angles.randLenVectors(e.id + 1, 4, 1f + 23f * e.finpow(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
});
Draw.reset();
});
}
}

View File

@@ -1,137 +0,0 @@
package io.anuke.mindustry.content.fx;
import io.anuke.arc.entities.Effects.Effect;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Fill;
import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.type.Item;
public class EnvironmentFx extends FxList implements ContentList{
public static Effect burning, fire, smoke, steam, fireballsmoke, ballfire, freezing, melting, wet, oily, overdriven, dropItem;
@Override
public void load(){
burning = new Effect(35f, e -> {
Draw.color(Palette.lightFlame, Palette.darkFlame, e.fin());
Angles.randLenVectors(e.id, 3, 2f + e.fin() * 7f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.1f + e.fout() * 1.4f);
});
Draw.color();
});
fire = new Effect(35f, e -> {
Draw.color(Palette.lightFlame, Palette.darkFlame, e.fin());
Angles.randLenVectors(e.id, 2, 2f + e.fin() * 7f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.2f + e.fslope() * 1.5f);
});
Draw.color();
});
smoke = new Effect(35f, e -> {
Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 1, 2f + e.fin() * 7f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.2f + e.fslope() * 1.5f);
});
Draw.color();
});
steam = new Effect(35f, e -> {
Draw.color(Color.LIGHT_GRAY);
Angles.randLenVectors(e.id, 2, 2f + e.fin() * 7f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.2f + e.fslope() * 1.5f);
});
Draw.color();
});
fireballsmoke = new Effect(25f, e -> {
Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 1, 2f + e.fin() * 7f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.2f + e.fout() * 1.5f);
});
Draw.color();
});
ballfire = new Effect(25f, e -> {
Draw.color(Palette.lightFlame, Palette.darkFlame, e.fin());
Angles.randLenVectors(e.id, 2, 2f + e.fin() * 7f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.2f + e.fout() * 1.5f);
});
Draw.color();
});
freezing = new Effect(40f, e -> {
Draw.color(Liquids.cryofluid.color);
Angles.randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 1.2f);
});
Draw.color();
});
melting = new Effect(40f, e -> {
Draw.color(Liquids.lava.color, Color.WHITE, e.fout() / 5f + Mathf.randomSeedRange(e.id, 0.12f));
Angles.randLenVectors(e.id, 2, 1f + e.fin() * 3f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, .2f + e.fout() * 1.2f);
});
Draw.color();
});
wet = new Effect(40f, e -> {
Draw.color(Liquids.water.color);
Angles.randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 1f);
});
Draw.color();
});
oily = new Effect(42f, e -> {
Draw.color(Liquids.oil.color);
Angles.randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 1f);
});
Draw.color();
});
overdriven = new Effect(20f, e -> {
Draw.color(Palette.accent);
Angles.randLenVectors(e.id, 2, 1f + e.fin() * 2f, (x, y) -> {
Fill.square(e.x + x, e.y + y, e.fout() * 2.3f+0.5f);
});
Draw.color();
});
dropItem = new Effect(20f, e -> {
float length = 20f * e.finpow();
float size = 7f * e.fout();
Draw.rect(((Item) e.data).region, e.x + Angles.trnsx(e.rotation, length), e.y + Angles.trnsy(e.rotation, length), size, size);
});
}
}

View File

@@ -1,97 +0,0 @@
package io.anuke.mindustry.content.fx;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.game.ContentList;
import io.anuke.arc.entities.Effects.Effect;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Fill;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
public class ExplosionFx extends FxList implements ContentList{
public static Effect shockwave, bigShockwave, nuclearShockwave, explosion, blockExplosion, blockExplosionSmoke;
@Override
public void load(){
shockwave = new Effect(10f, 80f, e -> {
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
Lines.stroke(e.fout() * 2f + 0.2f);
Lines.circle(e.x, e.y, e.fin() * 28f);
Draw.reset();
});
bigShockwave = new Effect(10f, 80f, e -> {
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
Lines.stroke(e.fout() * 3f);
Lines.circle(e.x, e.y, e.fin() * 50f);
Draw.reset();
});
nuclearShockwave = new Effect(10f, 200f, e -> {
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
Lines.stroke(e.fout() * 3f + 0.2f);
Lines.poly(e.x, e.y, 40, e.fin() * 140f);
Draw.reset();
});
explosion = new Effect(30, e -> {
e.scaled(7, i -> {
Lines.stroke(3f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 10f);
});
Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 6, 2f + 19f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 3f + 0.5f);
Fill.circle(e.x + x / 2f, e.y + y / 2f, e.fout() * 1f);
});
Draw.color(Palette.lighterOrange, Palette.lightOrange, Color.GRAY, e.fin());
Lines.stroke(1.5f * e.fout());
Angles.randLenVectors(e.id + 1, 8, 1f + 23f * e.finpow(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
});
Draw.reset();
});
blockExplosion = new Effect(30, e -> {
e.scaled(7, i -> {
Lines.stroke(3.1f * i.fout());
Lines.circle(e.x, e.y, 3f + i.fin() * 14f);
});
Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 6, 2f + 19f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 3f + 0.5f);
Fill.circle(e.x + x / 2f, e.y + y / 2f, e.fout() * 1f);
});
Draw.color(Palette.lighterOrange, Palette.lightOrange, Color.GRAY, e.fin());
Lines.stroke(1.7f * e.fout());
Angles.randLenVectors(e.id + 1, 9, 1f + 23f * e.finpow(), (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), 1f + e.fout() * 3f);
});
Draw.reset();
});
blockExplosionSmoke = new Effect(30, e -> {
Draw.color(Color.GRAY);
Angles.randLenVectors(e.id, 6, 4f + 30f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 3f);
Fill.circle(e.x + x / 2f, e.y + y / 2f, e.fout() * 1f);
});
Draw.reset();
});
}
}

View File

@@ -1,69 +0,0 @@
package io.anuke.mindustry.content.fx;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.game.ContentList;
import io.anuke.arc.entities.Effects.Effect;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Fill;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Angles;
import static io.anuke.mindustry.Vars.tilesize;
public class Fx extends FxList implements ContentList{
public static Effect none, placeBlock, breakBlock, smoke, spawn, tapBlock, select;
@Override
public void load(){
none = new Effect(0, 0f, e -> {
});
placeBlock = new Effect(16, e -> {
Draw.color(Palette.accent);
Lines.stroke(3f - e.fin() * 2f);
Lines.square(e.x, e.y, tilesize / 2f * e.rotation + e.fin() * 3f);
Draw.reset();
});
tapBlock = new Effect(12, e -> {
Draw.color(Palette.accent);
Lines.stroke(3f - e.fin() * 2f);
Lines.circle(e.x, e.y, 4f + (tilesize / 1.5f * e.rotation) * e.fin());
Draw.reset();
});
breakBlock = new Effect(12, e -> {
Draw.color(Palette.remove);
Lines.stroke(3f - e.fin() * 2f);
Lines.square(e.x, e.y, tilesize / 2f * e.rotation + e.fin() * 3f);
Angles.randLenVectors(e.id, 3 + (int) (e.rotation * 3), e.rotation * 2f + (tilesize * e.rotation) * e.finpow(), (x, y) -> {
Fill.square(e.x + x, e.y + y, 1f + e.fout() * (3f + e.rotation));
});
Draw.reset();
});
select = new Effect(23, e -> {
Draw.color(Palette.accent);
Lines.stroke(e.fout() * 3f);
Lines.circle(e.x, e.y, 3f + e.fin() * 14f);
Draw.reset();
});
smoke = new Effect(100, e -> {
Draw.color(Color.GRAY, Palette.darkishGray, e.fin());
float size = 7f - e.fin() * 7f;
Draw.rect("circle", e.x, e.y, size, size);
Draw.reset();
});
spawn = new Effect(23, e -> {
Lines.stroke(2f * e.fout());
Draw.color(Palette.accent);
Lines.poly(e.x, e.y, 4, 3f + e.fin() * 8f);
Draw.reset();
});
}
}

View File

@@ -1,12 +0,0 @@
package io.anuke.mindustry.content.fx;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ContentType;
public abstract class FxList implements ContentList{
@Override
public ContentType type(){
return ContentType.effect;
}
}

View File

@@ -1,225 +0,0 @@
package io.anuke.mindustry.content.fx;
import io.anuke.arc.Core;
import io.anuke.arc.entities.Effects.Effect;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Fill;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Shapes;
public class ShootFx extends FxList implements ContentList{
public static Effect shootSmall, shootHeal, shootSmallSmoke, shootBig, shootBig2, shootBigSmoke, shootBigSmoke2, shootSmallFlame, shootLiquid, shellEjectSmall, shellEjectMedium, shellEjectBig, lancerLaserShoot, lancerLaserShootSmoke, lancerLaserCharge, lancerLaserChargeBegin, lightningCharge, lightningShoot;
@Override
public void load(){
shootSmall = new Effect(8, e -> {
Draw.color(Palette.lighterOrange, Palette.lightOrange, e.fin());
float w = 1f + 5 * e.fout();
Shapes.tri(e.x, e.y, w, 15f * e.fout(), e.rotation);
Shapes.tri(e.x, e.y, w, 3f * e.fout(), e.rotation + 180f);
Draw.reset();
});
shootHeal = new Effect(8, e -> {
Draw.color(Palette.heal);
float w = 1f + 5 * e.fout();
Shapes.tri(e.x, e.y, w, 17f * e.fout(), e.rotation);
Shapes.tri(e.x, e.y, w, 4f * e.fout(), e.rotation + 180f);
Draw.reset();
});
shootSmallSmoke = new Effect(20f, e -> {
Draw.color(Palette.lighterOrange, Color.LIGHT_GRAY, Color.GRAY, e.fin());
Angles.randLenVectors(e.id, 5, e.finpow() * 6f, e.rotation, 20f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 1.5f);
});
Draw.reset();
});
shootBig = new Effect(9, e -> {
Draw.color(Palette.lighterOrange, Palette.lightOrange, e.fin());
float w = 1.2f + 7 * e.fout();
Shapes.tri(e.x, e.y, w, 25f * e.fout(), e.rotation);
Shapes.tri(e.x, e.y, w, 4f * e.fout(), e.rotation + 180f);
Draw.reset();
});
shootBig2 = new Effect(10, e -> {
Draw.color(Palette.lightOrange, Color.GRAY, e.fin());
float w = 1.2f + 8 * e.fout();
Shapes.tri(e.x, e.y, w, 29f * e.fout(), e.rotation);
Shapes.tri(e.x, e.y, w, 5f * e.fout(), e.rotation + 180f);
Draw.reset();
});
shootBigSmoke = new Effect(17f, e -> {
Draw.color(Palette.lighterOrange, Color.LIGHT_GRAY, Color.GRAY, e.fin());
Angles.randLenVectors(e.id, 8, e.finpow() * 19f, e.rotation, 10f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 2f + 0.2f);
});
Draw.reset();
});
shootBigSmoke2 = new Effect(18f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Color.GRAY, e.fin());
Angles.randLenVectors(e.id, 9, e.finpow() * 23f, e.rotation, 20f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 2.4f + 0.2f);
});
Draw.reset();
});
shootSmallFlame = new Effect(30f, e -> {
Draw.color(Palette.lightFlame, Palette.darkFlame, Color.GRAY, e.fin());
Angles.randLenVectors(e.id, 8, e.finpow() * 36f, e.rotation, 10f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.65f + e.fout() * 1.5f);
});
Draw.reset();
});
shootLiquid = new Effect(40f, e -> {
Draw.color(e.color, Color.WHITE, e.fout() / 6f + Mathf.randomSeedRange(e.id, 0.1f));
Angles.randLenVectors(e.id, 6, e.finpow() * 60f, e.rotation, 11f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.5f + e.fout() * 2.5f);
});
Draw.reset();
});
shellEjectSmall = new GroundEffect(30f, 400f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.fin());
float rot = Math.abs(e.rotation) + 90f;
int i = Mathf.sign(e.rotation);
float len = (2f + e.finpow() * 6f) * i;
float lr = rot + e.fin() * 30f * i;
Fill.rect(e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
1f, 2f, rot + e.fin() * 50f * i);
Draw.color();
});
shellEjectMedium = new GroundEffect(34f, 400f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.fin());
float rot = e.rotation + 90f;
for(int i : Mathf.signs){
float len = (2f + e.finpow() * 10f) * i;
float lr = rot + e.fin() * 20f * i;
Draw.rect(Core.atlas.find("casing"),
e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
2f, 3f, rot);
}
Draw.color(Color.LIGHT_GRAY, Color.GRAY, e.fin());
for(int i : Mathf.signs){
Angles.randLenVectors(e.id, 4, 1f + e.finpow() * 11f, e.rotation + 90f * i, 20f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 1.5f);
});
}
Draw.color();
});
shellEjectBig = new GroundEffect(22f, 400f, e -> {
Draw.color(Palette.lightOrange, Color.LIGHT_GRAY, Palette.lightishGray, e.fin());
float rot = e.rotation + 90f;
for(int i : Mathf.signs){
float len = (4f + e.finpow() * 8f) * i;
float lr = rot + Mathf.randomSeedRange(e.id + i + 6, 20f * e.fin()) * i;
Draw.rect(Core.atlas.find("casing"),
e.x + Angles.trnsx(lr, len) + Mathf.randomSeedRange(e.id + i + 7, 3f * e.fin()),
e.y + Angles.trnsy(lr, len) + Mathf.randomSeedRange(e.id + i + 8, 3f * e.fin()),
2.5f, 4f,
rot + e.fin() * 30f * i + Mathf.randomSeedRange(e.id + i + 9, 40f * e.fin()));
}
Draw.color(Color.LIGHT_GRAY);
for(int i : Mathf.signs){
Angles.randLenVectors(e.id, 4, -e.finpow() * 15f, e.rotation + 90f * i, 25f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 2f);
});
}
Draw.color();
});
lancerLaserShoot = new Effect(21f, e -> {
Draw.color(Palette.lancerLaser);
for(int i : Mathf.signs){
Shapes.tri(e.x, e.y, 4f * e.fout(), 29f, e.rotation + 90f * i);
}
Draw.reset();
});
lancerLaserShootSmoke = new Effect(26f, 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.angle(x, y), e.fout() * 9f);
});
Draw.reset();
});
lancerLaserCharge = new Effect(38f, e -> {
Draw.color(Palette.lancerLaser);
Angles.randLenVectors(e.id, 2, 1f + 20f * e.fout(), e.rotation, 120f, (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fslope() * 3f + 1f);
});
Draw.reset();
});
lancerLaserChargeBegin = new Effect(71f, e -> {
Draw.color(Palette.lancerLaser);
Fill.circle(e.x, e.y, e.fin() * 3f);
Draw.color();
Fill.circle(e.x, e.y, e.fin() * 2f);
});
lightningCharge = new Effect(38f, e -> {
Draw.color(Palette.lancerLaser);
Angles.randLenVectors(e.id, 2, 1f + 20f * e.fout(), e.rotation, 120f, (x, y) -> {
Shapes.tri(e.x + x, e.y + y, e.fslope() * 3f + 1, e.fslope() * 3f + 1, Mathf.angle(x, y));
});
Draw.reset();
});
lightningShoot = new Effect(12f, e -> {
Draw.color(Color.WHITE, Palette.lancerLaser, e.fin());
Lines.stroke(e.fout() * 1.2f + 0.5f);
Angles.randLenVectors(e.id, 7, 25f * e.finpow(), e.rotation, 50f, (x, y) -> {
Lines.lineAngle(e.x + x, e.y + y, Mathf.angle(x, y), e.fin() * 5f + 2f);
});
Draw.reset();
});
}
}

View File

@@ -1,78 +0,0 @@
package io.anuke.mindustry.content.fx;
import io.anuke.mindustry.entities.effect.GroundEffectEntity.GroundEffect;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.game.ContentList;
import io.anuke.arc.entities.Effects.Effect;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Fill;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
public class UnitFx extends FxList implements ContentList{
public static Effect vtolHover, unitDrop, unitPickup, unitLand, pickup, healWave, heal, landShock;
@Override
public void load(){
vtolHover = new Effect(40f, e -> {
float len = e.finpow() * 10f;
float ang = e.rotation + Mathf.randomSeedRange(e.id, 30f);
Draw.color(Palette.lightFlame, Palette.lightOrange, e.fin());
Fill.circle(e.x + Angles.trnsx(ang, len), e.y + Angles.trnsy(ang, len), 2f * e.fout());
Draw.reset();
});
unitDrop = new GroundEffect(30, e -> {
Draw.color(Palette.lightishGray);
Angles.randLenVectors(e.id, 9, 3 + 20f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.4f);
});
Draw.reset();
});
unitLand = new GroundEffect(30, e -> {
Draw.color(Palette.lightishGray, e.color, e.rotation);
Angles.randLenVectors(e.id, 6, 17f * e.finpow(), (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 4f + 0.3f);
});
Draw.reset();
});
unitPickup = new GroundEffect(18, e -> {
Draw.color(Palette.lightishGray);
Lines.stroke(e.fin() * 2f);
Lines.poly(e.x, e.y, 4, 13f * e.fout());
Draw.reset();
});
landShock = new GroundEffect(12, e -> {
Draw.color(Palette.lancerLaser);
Lines.stroke(e.fout() * 3f);
Lines.poly(e.x, e.y, 12, 20f * e.fout());
Draw.reset();
});
pickup = new Effect(18, e -> {
Draw.color(Palette.lightishGray);
Lines.stroke(e.fout() * 2f);
Lines.spikes(e.x, e.y, 1f + e.fin() * 6f, e.fout() * 4f, 6);
Draw.reset();
});
healWave = new Effect(22, e -> {
Draw.color(Palette.heal);
Lines.stroke(e.fout() * 2f);
Lines.poly(e.x, e.y, 30, 4f + e.finpow() * 60f);
Draw.color();
});
heal = new Effect(11, e -> {
Draw.color(Palette.heal);
Lines.stroke(e.fout() * 2f);
Lines.poly(e.x, e.y, 10, 2f + e.finpow() * 7f);
Draw.color();
});
}
}

View File

@@ -6,9 +6,6 @@ import io.anuke.arc.collection.ObjectSet;
import io.anuke.arc.function.Consumer;
import io.anuke.arc.util.Log;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.content.blocks.*;
import io.anuke.mindustry.content.bullets.*;
import io.anuke.mindustry.content.fx.*;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.bullet.BulletType;
@@ -42,13 +39,7 @@ public class ContentLoader{
private ObjectSet<Consumer<Content>> initialization = new ObjectSet<>();
private ContentList[] content = {
//effects
new BlockFx(),
new BulletFx(),
new EnvironmentFx(),
new ExplosionFx(),
new Fx(),
new ShootFx(),
new UnitFx(),
//items
new Items(),
@@ -60,16 +51,7 @@ public class ContentLoader{
new Liquids(),
//bullets
new ArtilleryBullets(),
new FlakBullets(),
new MissileBullets(),
new StandardBullets(),
new TurretBullets(),
new WeaponBullets(),
//ammotypes
new AmmoTypes(),
new Bullets(),
//weapons
new Weapons(),
@@ -82,18 +64,6 @@ public class ContentLoader{
//blocks
new Blocks(),
new DefenseBlocks(),
new DistributionBlocks(),
new ProductionBlocks(),
new TurretBlocks(),
new DebugBlocks(),
new LiquidBlocks(),
new StorageBlocks(),
new UnitBlocks(),
new PowerBlocks(),
new CraftingBlocks(),
new UpgradeBlocks(),
new OreBlocks(),
//not really a content class, but this makes initialization easier
new ColorMapper(),
@@ -279,7 +249,5 @@ public class ContentLoader{
TypeTrait.registerType(Lightning.class, Lightning::new);
}
private class ImpendingDoomException extends RuntimeException{
public ImpendingDoomException(String s){ super(s); }
}
private class ImpendingDoomException extends RuntimeException{ ImpendingDoomException(String s){ super(s); }}
}

View File

@@ -347,7 +347,7 @@ public class NetClient implements ApplicationListener{
Call.onClientShapshot(lastSent++, Time.millis(), player.x, player.y,
player.pointerX, player.pointerY, player.rotation, player.baseRotation,
player.getVelocity().x, player.getVelocity().y,
player.velocity().x, player.velocity().y,
player.getMineTile(),
player.isBoosting, player.isShooting, requests,
Core.camera.position.x, Core.camera.position.y,

View File

@@ -22,7 +22,7 @@ import io.anuke.arc.util.Time;
import io.anuke.arc.util.io.ByteBufferOutput;
import io.anuke.arc.util.io.CountableByteArrayOutputStream;
import io.anuke.mindustry.content.Mechs;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest;
@@ -329,7 +329,7 @@ public class NetServer implements ApplicationListener{
//set interpolator target to *new* position so it moves toward it
player.getInterpolator().read(player.x, player.y, newx, newy, sent, rotation, baseRotation);
player.getVelocity().set(xVelocity, yVelocity); //only for visual calculation purposes, doesn't actually update the player
player.velocity().set(xVelocity, yVelocity); //only for visual calculation purposes, doesn't actually update the player
connection.lastRecievedClientSnapshot = snapshotID;
connection.lastRecievedClientTime = Time.millis();

View File

@@ -21,7 +21,7 @@ import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.util.ScreenRecorder;
import io.anuke.arc.util.Time;
import io.anuke.arc.util.pooling.Pools;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.TileEntity;

View File

@@ -15,7 +15,7 @@ import io.anuke.arc.util.Tmp;
import io.anuke.mindustry.ai.BlockIndexer;
import io.anuke.mindustry.ai.Pathfinder;
import io.anuke.mindustry.ai.WaveSpawner;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.game.EventType.TileChangeEvent;
import io.anuke.mindustry.game.EventType.WorldLoadEvent;

View File

@@ -4,7 +4,7 @@ import io.anuke.arc.collection.IntArray;
import io.anuke.arc.function.IntPositionConsumer;
import io.anuke.arc.util.Pack;
import io.anuke.arc.util.Structs;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.maps.MapTileData;
import io.anuke.mindustry.maps.MapTileData.DataPosition;
import io.anuke.mindustry.maps.MapTileData.TileDataMarker;

View File

@@ -5,7 +5,7 @@ import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Pack;
import io.anuke.arc.util.Structs;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.editor.DrawOperation.TileOperation;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.maps.MapTileData;

View File

@@ -18,7 +18,7 @@ import io.anuke.arc.scene.ui.layout.Unit;
import io.anuke.arc.scene.utils.UIUtils;
import io.anuke.arc.util.*;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.blocks.StorageBlocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.core.Platform;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.io.MapIO;
@@ -521,7 +521,7 @@ public class MapEditorDialog extends Dialog implements Disposable{
for(Block block : Vars.content.blocks()){
TextureRegion[] regions = block.getCompactIcon();
if((block.synthetic() && (Recipe.getByResult(block) == null || !control.unlocks.isUnlocked(Recipe.getByResult(block))))
&& block != StorageBlocks.core){
&& block != Blocks.core){
continue;
}

View File

@@ -10,8 +10,8 @@ import io.anuke.arc.math.geom.Geometry;
import io.anuke.arc.math.geom.Rectangle;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.bullets.TurretBullets;
import io.anuke.mindustry.content.fx.ExplosionFx;
import io.anuke.mindustry.content.Bullets;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.effect.Fire;
import io.anuke.mindustry.entities.effect.Lightning;
@@ -37,7 +37,7 @@ public class Damage{
}
for(int i = 0; i < Mathf.clamp(flammability / 4, 0, 30); i++){
Time.run(i / 2f, () -> Call.createBullet(TurretBullets.fireball, x, y, Mathf.random(360f)));
Time.run(i / 2f, () -> Call.createBullet(Bullets.fireball, x, y, Mathf.random(360f)));
}
int waves = Mathf.clamp((int) (explosiveness / 4), 0, 30);
@@ -46,21 +46,21 @@ public class Damage{
int f = i;
Time.run(i * 2f, () -> {
Damage.damage(x, y, Mathf.clamp(radius + explosiveness, 0, 50f) * ((f + 1f) / waves), explosiveness / 2f);
Effects.effect(ExplosionFx.blockExplosionSmoke, x + Mathf.range(radius), y + Mathf.range(radius));
Effects.effect(Fx.blockExplosionSmoke, x + Mathf.range(radius), y + Mathf.range(radius));
});
}
if(explosiveness > 15f){
Effects.effect(ExplosionFx.shockwave, x, y);
Effects.effect(Fx.shockwave, x, y);
}
if(explosiveness > 30f){
Effects.effect(ExplosionFx.bigShockwave, x, y);
Effects.effect(Fx.bigShockwave, x, y);
}
float shake = Math.min(explosiveness / 4f + 3f, 9f);
Effects.shake(shake, shake, x, y);
Effects.effect(ExplosionFx.blockExplosion, x, y);
Effects.effect(Fx.blockExplosion, x, y);
}
public static void createIncend(float x, float y, float range, int amount){
@@ -110,7 +110,7 @@ public class Damage{
rect.height += expand * 2;
Consumer<Unit> cons = e -> {
e.getHitbox(hitrect);
e.hitbox(hitrect);
Rectangle other = hitrect;
other.y -= expand;
other.x -= expand;
@@ -134,7 +134,7 @@ public class Damage{
Consumer<Unit> cons = entity -> {
if(!predicate.test(entity)) return;
entity.getHitbox(hitrect);
entity.hitbox(hitrect);
if(!hitrect.overlaps(rect)){
return;
}
@@ -165,7 +165,7 @@ public class Damage{
entity.damage(amount);
//TODO better velocity displacement
float dst = tr.set(entity.x - x, entity.y - y).len();
entity.getVelocity().add(tr.setLength((1f - dst / radius) * 2f));
entity.velocity().add(tr.setLength((1f - dst / radius) * 2f));
};
rect.setSize(radius * 2).setCenter(x, y);

View File

@@ -20,7 +20,7 @@ import io.anuke.arc.util.Pack;
import io.anuke.arc.util.Time;
import io.anuke.arc.util.pooling.Pools;
import io.anuke.mindustry.content.Mechs;
import io.anuke.mindustry.content.fx.UnitFx;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.effect.ScorchDecal;
import io.anuke.mindustry.entities.traits.*;
import io.anuke.mindustry.game.Team;
@@ -100,17 +100,17 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
}
@Override
public void getHitbox(Rectangle rectangle){
public void hitbox(Rectangle rectangle){
rectangle.setSize(mech.hitsize).setCenter(x, y);
}
@Override
public void getHitboxTile(Rectangle rectangle){
public void hitboxTile(Rectangle rectangle){
rectangle.setSize(mech.hitsize * 2f / 3f).setCenter(x, y);
}
@Override
public float getDrag(){
public float drag(){
return mech.drag;
}
@@ -208,7 +208,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
}
@Override
public float getMass(){
public float mass(){
return mech.mass;
}
@@ -241,7 +241,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
}
@Override
public float getMaxVelocity(){
public float maxVelocity(){
return mech.maxSpeed;
}
@@ -502,7 +502,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
if(mech.shake > 1f){
Effects.shake(mech.shake, mech.shake, this);
}
Effects.effect(UnitFx.unitLand, tile.floor().minimapColor, x, y, tile.floor().isLiquid ? 1f : 0.5f);
Effects.effect(Fx.unitLand, tile.floor().minimapColor, x, y, tile.floor().isLiquid ? 1f : 0.5f);
}
mech.onLand(this);
achievedFlight = false;
@@ -571,7 +571,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
}else if(getCarry() != null){
dropCarry();
}else{
Unit unit = Units.getClosest(team, x, y, 8f, u -> !u.isFlying() && u.getMass() <= mech.carryWeight);
Unit unit = Units.getClosest(team, x, y, 8f, u -> !u.isFlying() && u.mass() <= mech.carryWeight);
if(unit != null){
carry(unit);
@@ -629,7 +629,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
protected void updateFlying(){
if(Units.invalidateTarget(target, this) && !(target instanceof TileEntity && ((TileEntity) target).damaged() && target.getTeam() == team &&
mech.canHeal && dst(target) < getWeapon().getAmmo().getRange())){
mech.canHeal && dst(target) < getWeapon().getAmmo().range())){
target = null;
}
@@ -675,7 +675,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
float expansion = 3f;
getHitbox(rect);
hitbox(rect);
rect.x -= expansion;
rect.y -= expansion;
rect.width += expansion * 2f;
@@ -709,11 +709,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
if(target == null){
isShooting = false;
if(Core.settings.getBool("autotarget")){
target = Units.getClosestTarget(team, x, y, getWeapon().getAmmo().getRange());
target = Units.getClosestTarget(team, x, y, getWeapon().getAmmo().range());
if(mech.canHeal && target == null){
target = Geometry.findClosest(x, y, world.indexer.getDamaged(Team.blue));
if(target != null && dst(target) > getWeapon().getAmmo().getRange()){
if(target != null && dst(target) > getWeapon().getAmmo().range()){
target = null;
}else if(target != null){
target = ((Tile) target).entity;
@@ -725,14 +725,14 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
}
}
}else if(target.isValid() || (target instanceof TileEntity && ((TileEntity) target).damaged() && target.getTeam() == team &&
mech.canHeal && dst(target) < getWeapon().getAmmo().getRange())){
mech.canHeal && dst(target) < getWeapon().getAmmo().range())){
//rotate toward and shoot the target
if(mech.turnCursor){
rotation = Mathf.slerpDelta(rotation, angleTo(target), 0.2f);
}
Vector2 intercept =
Predict.intercept(x, y, target.getX(), target.getY(), target.getVelocity().x - velocity.x, target.getVelocity().y - velocity.y, getWeapon().getAmmo().bullet.speed);
Predict.intercept(x, y, target.getX(), target.getY(), target.velocity().x - velocity.x, target.velocity().y - velocity.y, getWeapon().getAmmo().speed);
pointerX = intercept.x;
pointerY = intercept.y;

View File

@@ -13,7 +13,7 @@ import io.anuke.arc.math.geom.Point2;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.util.Interval;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.traits.TargetTrait;
import io.anuke.mindustry.game.Team;
@@ -257,7 +257,7 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
}
@Override
public Vector2 getVelocity(){
public Vector2 velocity(){
return Vector2.ZERO;
}

View File

@@ -15,7 +15,7 @@ import io.anuke.arc.math.geom.Geometry;
import io.anuke.arc.math.geom.Rectangle;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.entities.traits.*;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.game.Teams.TeamData;
@@ -124,7 +124,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
}
@Override
public Vector2 getVelocity(){
public Vector2 velocity(){
return velocity;
}
@@ -190,7 +190,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
}
public void avoidOthers(float scaling){
getHitbox(queryRect);
hitbox(queryRect);
queryRect.setSize(queryRect.getWidth() * scaling);
Units.getNearby(queryRect, t -> {
@@ -228,7 +228,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
if(isCarried()){ //carried units do not take into account velocity normally
set(carrier.getX(), carrier.getY());
velocity.set(carrier.getVelocity());
velocity.set(carrier.velocity());
return;
}
@@ -236,7 +236,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
status.update(this);
velocity.limit(getMaxVelocity()).scl(1f + (status.getSpeedMultiplier()-1f) * Time.delta());
velocity.limit(maxVelocity()).scl(1f + (status.getSpeedMultiplier()-1f) * Time.delta());
if(isFlying()){
x += velocity.x * Time.delta();
@@ -289,7 +289,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
if(Math.abs(py - y) <= 0.0001f) velocity.y = 0f;
}
velocity.scl(Mathf.clamp(1f - getDrag() * (isFlying() ? 1f : floor.dragMultiplier) * Time.delta()));
velocity.scl(Mathf.clamp(1f - drag() * (isFlying() ? 1f : floor.dragMultiplier) * Time.delta()));
}
public void applyEffect(StatusEffect effect, float intensity){
@@ -355,7 +355,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
public abstract float getArmor();
public abstract float getMass();
public abstract float mass();
public abstract boolean isFlying();

View File

@@ -48,7 +48,7 @@ public class Units{
/**See {@link #invalidateTarget(TargetTrait, Team, float, float, float)}*/
public static boolean invalidateTarget(TargetTrait target, Unit targeter){
return invalidateTarget(target, targeter.team, targeter.x, targeter.y, targeter.getWeapon().getAmmo().getRange());
return invalidateTarget(target, targeter.team, targeter.x, targeter.y, targeter.getWeapon().getAmmo().range());
}
/**Returns whether there are any entities on this tile.*/
@@ -67,7 +67,7 @@ public class Units{
Units.getNearby(rect, unit -> {
if(boolResult) return;
if(!unit.isFlying()){
unit.getHitbox(hitrect);
unit.hitbox(hitrect);
if(hitrect.overlaps(rect)){
boolResult = true;
@@ -89,7 +89,7 @@ public class Units{
Units.getNearby(rect, unit -> {
if(value[0] || !pred.test(unit) || unit.isDead()) return;
if(!unit.isFlying()){
unit.getHitbox(hitrect);
unit.hitbox(hitrect);
if(hitrect.overlaps(rect)){
value[0] = true;

View File

@@ -1,13 +1,13 @@
package io.anuke.mindustry.entities.bullet;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.arc.entities.Effects;
import io.anuke.arc.entities.Effects.Effect;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.mindustry.content.Fx;
//TODO scale velocity depending on fslope()
public class ArtilleryBulletType extends BasicBulletType{
protected Effect trailEffect = BulletFx.artilleryTrail;
protected Effect trailEffect = Fx.artilleryTrail;
public ArtilleryBulletType(float speed, float damage, String bulletSprite){
super(speed, damage, bulletSprite);
@@ -34,9 +34,9 @@ public class ArtilleryBulletType extends BasicBulletType{
float height = bulletHeight * ((1f - bulletShrink) + bulletShrink * b.fout());
Draw.color(backColor);
Draw.rect(backRegion, b.x, b.y, bulletWidth * scale, height * scale, b.angle() - 90);
Draw.rect(backRegion, b.x, b.y, bulletWidth * scale, height * scale, b.rot() - 90);
Draw.color(frontColor);
Draw.rect(frontRegion, b.x, b.y, bulletWidth * scale, height * scale, b.angle() - 90);
Draw.rect(frontRegion, b.x, b.y, bulletWidth * scale, height * scale, b.rot() - 90);
Draw.color();
}
}

View File

@@ -10,12 +10,11 @@ import io.anuke.arc.math.Mathf;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.entities.Damage;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.effect.Lightning;
import io.anuke.mindustry.entities.traits.TargetTrait;
import io.anuke.mindustry.graphics.Palette;
/**
* A BulletType for most ammo-based bullets shot from turrets and units.
*/
/**An extended BulletType for most ammo-based bullets shot from turrets and units.*/
public class BasicBulletType extends BulletType{
public Color backColor = Palette.bulletYellowBack, frontColor = Palette.bulletYellow;
public float bulletWidth = 5f, bulletHeight = 7f;
@@ -36,6 +35,9 @@ public class BasicBulletType extends BulletType{
public float homingPower = 0f;
public float homingRange = 50f;
public int lightining;
public int lightningLength = 5;
public TextureRegion backRegion;
public TextureRegion frontRegion;
@@ -57,9 +59,9 @@ public class BasicBulletType extends BulletType{
float height = bulletHeight * ((1f - bulletShrink) + bulletShrink * b.fout());
Draw.color(backColor);
Draw.rect(backRegion, b.x, b.y, bulletWidth, height, b.angle() - 90);
Draw.rect(backRegion, b.x, b.y, bulletWidth, height, b.rot() - 90);
Draw.color(frontColor);
Draw.rect(frontRegion, b.x, b.y, bulletWidth, height, b.angle() - 90);
Draw.rect(frontRegion, b.x, b.y, bulletWidth, height, b.rot() - 90);
Draw.color();
}
@@ -70,7 +72,7 @@ public class BasicBulletType extends BulletType{
if(homingPower > 0.0001f){
TargetTrait target = Units.getClosestTarget(b.getTeam(), b.x, b.y, homingRange);
if(target != null){
b.getVelocity().setAngle(Angles.moveToward(b.getVelocity().angle(), b.angleTo(target), homingPower * Time.delta()));
b.velocity().setAngle(Angles.moveToward(b.velocity().angle(), b.angleTo(target), homingPower * Time.delta()));
}
}
}
@@ -104,5 +106,9 @@ public class BasicBulletType extends BulletType{
if(fragBullet != null || splashDamageRadius > 0){
hit(b);
}
for (int i = 0; i < lightining; i++) {
Lightning.create(b.getTeam(), Palette.surge, damage, b.x, b.y, Mathf.random(360f), lightningLength);
}
}
}

View File

@@ -3,14 +3,15 @@ package io.anuke.mindustry.entities.bullet;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.arc.entities.EntityGroup;
import io.anuke.arc.entities.impl.BulletEntity;
import io.anuke.arc.entities.trait.Entity;
import io.anuke.arc.entities.trait.SolidTrait;
import io.anuke.arc.entities.trait.VelocityTrait;
import io.anuke.arc.entities.impl.SolidEntity;
import io.anuke.arc.entities.trait.*;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Rectangle;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.util.Interval;
import io.anuke.arc.util.Time;
import io.anuke.arc.util.Tmp;
import io.anuke.arc.util.pooling.Pool.Poolable;
import io.anuke.arc.util.pooling.Pools;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.effect.Lightning;
@@ -26,14 +27,18 @@ import java.io.IOException;
import static io.anuke.mindustry.Vars.*;
public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncTrait, AbsorbTrait{
private static Vector2 vector = new Vector2();
public class Bullet extends SolidEntity implements DamageTrait, ScaleTrait, Poolable, DrawTrait, VelocityTrait, TimeTrait, TeamTrait, SyncTrait, AbsorbTrait{
public Interval timer = new Interval(3);
private float lifeScl;
private Team team;
private Object data;
private boolean supressCollision, supressOnce, initialized;
protected BulletType type;
protected Entity owner;
protected float time;
/**Internal use only!*/
public Bullet(){
}
@@ -62,7 +67,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
bullet.velocity.set(0, type.speed).setAngle(angle).scl(velocityScl);
if(type.keepVelocity){
bullet.velocity.add(owner instanceof VelocityTrait ? ((VelocityTrait) owner).getVelocity() : Vector2.ZERO);
bullet.velocity.add(owner instanceof VelocityTrait ? ((VelocityTrait) owner).velocity() : Vector2.ZERO);
}
bullet.team = team;
@@ -83,6 +88,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
return create(type, parent.owner, parent.team, x, y, angle, velocityScl);
}
/**Internal use only.*/
@Remote(called = Loc.server)
public static void createBullet(BulletType type, float x, float y, float angle){
create(type, null, Team.none, x, y, angle);
@@ -97,12 +103,6 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
supressOnce = true;
}
@Override
public void absorb(){
supressCollision = true;
remove();
}
public BulletType getBulletType(){
return type;
}
@@ -124,22 +124,29 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
this.data = data;
}
@Override
public void absorb(){
supressCollision = true;
remove();
}
@Override
public float drawSize(){
return type.drawSize;
}
@Override
public float getDamage(){
public float damage(){
//todo hacky way to get damage, refactor
if(owner instanceof Unit){
return super.getDamage() * ((Unit) owner).getDamageMultipler();
return type.damage * ((Unit) owner).getDamageMultipler();
}
if(owner instanceof Lightning && data instanceof Float){
return (Float)data;
}
return super.getDamage();
return type.damage;
}
@Override
@@ -172,35 +179,44 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
return team;
}
@Override
public void draw(){
type.draw(this);
}
@Override
public float getShieldDamage(){
return Math.max(getDamage(), type.splashDamage);
return Math.max(damage(), type.splashDamage);
}
@Override
public boolean collides(SolidTrait other){
return type.collides && super.collides(other) && !supressCollision && !(other instanceof Unit && ((Unit) other).isFlying() && !type.collidesAir);
return type.collides && (other != owner && !(other instanceof DamageTrait)) && !supressCollision && !(other instanceof Unit && ((Unit) other).isFlying() && !type.collidesAir);
}
@Override
public void collision(SolidTrait other, float x, float y){
super.collision(other, x, y);
if(!type.pierce) remove();
type.hit(this, x, y);
if(other instanceof Unit){
Unit unit = (Unit) other;
unit.getVelocity().add(vector.set(other.getX(), other.getY()).sub(x, y).setLength(type.knockback / unit.getMass()));
unit.velocity().add(Tmp.v3.set(other.getX(), other.getY()).sub(x, y).setLength(type.knockback / unit.mass()));
unit.applyEffect(type.status, type.statusIntensity);
}
}
@Override
public void update(){
super.update();
type.update(this);
x += velocity.x * Time.delta();
y += velocity.y * Time.delta();
velocity.scl(Mathf.clamp(1f - type.drag * Time.delta()));
time += Time.delta() * 1f/(lifeScl);
time = Mathf.clamp(time, 0, type.lifetime);
if(time >= type.lifetime){
if(!supressCollision) type.despawned(this);
remove();
}
if(type.hitTiles && collidesTiles() && !supressCollision && initialized){
world.raycastEach(world.toTile(lastPosition().x), world.toTile(lastPosition().y), world.toTile(x), world.toTile(y), (x, y) -> {
@@ -234,20 +250,12 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
initialized = true;
}
@Override
protected void updateLife(){
time += Time.delta() * 1f/(lifeScl);
time = Mathf.clamp(time, 0, type.lifetime());
if(time >= type.lifetime){
if(!supressCollision) type.despawned(this);
remove();
}
}
@Override
public void reset(){
super.reset();
type = null;
owner = null;
velocity.setZero();
time = 0f;
timer.clear();
lifeScl = 1f;
team = null;
@@ -257,6 +265,31 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
initialized = false;
}
@Override
public void hitbox(Rectangle rectangle){
rectangle.setSize(type.hitSize).setCenter(x, y);
}
@Override
public void hitboxTile(Rectangle rectangle){
rectangle.setSize(type.hitSize).setCenter(x, y);
}
@Override
public float lifetime(){
return type.lifetime;
}
@Override
public void time(float time){
this.time = time;
}
@Override
public float time(){
return time;
}
@Override
public void removed(){
Pools.free(this);
@@ -266,4 +299,44 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
public EntityGroup targetGroup(){
return bulletGroup;
}
@Override
public void added(){
type.init(this);
}
@Override
public void draw(){
type.draw(this);
}
@Override
public float fin(){
return time / type.lifetime;
}
@Override
public Vector2 velocity(){
return velocity;
}
public void velocity(float speed, float angle){
velocity.set(0, speed).setAngle(angle);
}
public void limit(float f){
velocity.limit(f);
}
/** Sets the bullet's rotation in degrees.*/
public void rot(float angle){
velocity.setAngle(angle);
}
/** @return the bullet's rotation.*/
public float rot(){
float angle = Mathf.atan2(velocity.x, velocity.y) * Mathf.radiansToDegrees;
if(angle < 0) angle += 360;
return angle;
}
}

View File

@@ -2,24 +2,35 @@ package io.anuke.mindustry.entities.bullet;
import io.anuke.arc.entities.Effects;
import io.anuke.arc.entities.Effects.Effect;
import io.anuke.arc.entities.impl.BaseBulletType;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.mindustry.content.StatusEffects;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.StatusEffect;
import io.anuke.mindustry.world.Tile;
public abstract class BulletType extends Content implements BaseBulletType<Bullet>{
public abstract class BulletType extends Content{
public float lifetime;
public float speed;
public float damage;
public float hitsize = 4;
public float drawSize = 20f;
public float hitSize = 4;
public float drawSize = 40f;
public float drag = 0f;
public boolean pierce;
public Effect hiteffect, despawneffect;
public Effect hitEffect, despawnEffect;
/**Effect created when shooting.*/
public Effect shootEffect = Fx.shootSmall;
/**Extra smoke effect created when shooting.*/
public Effect smokeEffect = Fx.shootSmallSmoke;
/**Extra inaccuracy when firing.*/
public float inaccuracy = 0f;
/**How many bullets get created per ammo item/liquid.*/
public float ammoMultiplier = 1f;
/**Multiplied by turret reload speed to get final shoot speed.*/
public float reloadMultiplier = 1f;
/**Recoil from shooter entities.*/
public float recoil;
public float splashDamage = 0f;
/**Knockback in velocity.*/
@@ -45,14 +56,17 @@ public abstract class BulletType extends Content implements BaseBulletType<Bulle
/**Whether velocity is inherited from the shooter.*/
public boolean keepVelocity = true;
protected Vector2 vector = new Vector2();
public BulletType(float speed, float damage){
this.speed = speed;
this.damage = damage;
lifetime = 40f;
hiteffect = BulletFx.hitBulletSmall;
despawneffect = BulletFx.hitBulletSmall;
hitEffect = Fx.hitBulletSmall;
despawnEffect = Fx.hitBulletSmall;
}
/**Returns maximum distance the bullet this bullet type has can travel.*/
public float range(){
return speed * lifetime;
}
public boolean collides(Bullet bullet, Tile tile){
@@ -63,59 +77,25 @@ public abstract class BulletType extends Content implements BaseBulletType<Bulle
hit(b);
}
@Override
public float drawSize(){
return 40;
public void hit(Bullet b){
hit(b, b.x, b.y);
}
@Override
public float lifetime(){
return lifetime;
}
@Override
public float speed(){
return speed;
}
@Override
public float damage(){
return damage;
}
@Override
public float hitSize(){
return hitsize;
}
@Override
public float drag(){
return drag;
}
@Override
public boolean pierce(){
return pierce;
}
@Override
public Effect hitEffect(){
return hiteffect;
}
@Override
public Effect despawnEffect(){
return despawneffect;
}
@Override
public void hit(Bullet b, float hitx, float hity){
Effects.effect(hiteffect, hitx, hity, b.angle());
Effects.effect(hitEffect, hitx, hity, b.rot());
}
@Override
public void despawned(Bullet b){
Effects.effect(despawneffect, b.x, b.y, b.angle());
Effects.effect(despawnEffect, b.x, b.y, b.rot());
}
public void draw(Bullet b){
}
public void init(Bullet b){
}
public void update(Bullet b){
}
@Override

View File

@@ -1,7 +1,7 @@
package io.anuke.mindustry.entities.bullet;
import io.anuke.arc.math.geom.Rectangle;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.Units;
import io.anuke.arc.util.Time;
@@ -13,7 +13,7 @@ public abstract class FlakBulletType extends BasicBulletType{
super(speed, damage, "shell");
splashDamage = 15f;
splashDamageRadius = 34f;
hiteffect = BulletFx.flakExplosionBig;
hitEffect = Fx.flakExplosionBig;
bulletWidth = 8f;
bulletHeight = 10f;
}

View File

@@ -7,8 +7,7 @@ import io.anuke.arc.graphics.g2d.Fill;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Geometry;
import io.anuke.arc.math.geom.Point2;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.effect.Fire;
import io.anuke.mindustry.entities.effect.Puddle;
import io.anuke.mindustry.type.Liquid;
@@ -25,8 +24,10 @@ public class LiquidBulletType extends BulletType{
this.liquid = liquid;
lifetime = 70f;
despawneffect = Fx.none;
hiteffect = BulletFx.hitLiquid;
status = liquid.effect;
statusIntensity = 0.5f;
despawnEffect = Fx.none;
hitEffect = Fx.hitLiquid;
drag = 0.01f;
knockback = 0.5f;
}
@@ -54,7 +55,7 @@ public class LiquidBulletType extends BulletType{
@Override
public void hit(Bullet b, float hitx, float hity){
Effects.effect(hiteffect, liquid.color, hitx, 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){

View File

@@ -0,0 +1,107 @@
package io.anuke.mindustry.entities.bullet;
import io.anuke.arc.entities.Effects;
import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.world.blocks.distribution.MassDriver.DriverBulletData;
import static io.anuke.mindustry.Vars.content;
public class MassDriverBolt extends BulletType{
public MassDriverBolt(){
super(5.3f, 50);
collidesTiles = false;
lifetime = 200f;
despawnEffect = Fx.smeltsmoke;
hitEffect = Fx.hitBulletBig;
drag = 0.005f;
}
@Override
public void draw(Bullet b){
float w = 11f, h = 13f;
Draw.color(Palette.bulletYellowBack);
Draw.rect("shell-back", b.x, b.y, w, h, b.rot() + 90);
Draw.color(Palette.bulletYellow);
Draw.rect("shell", b.x, b.y, w, h, b.rot() + 90);
Draw.reset();
}
@Override
public void update(Bullet b){
//data MUST be an instance of DriverBulletData
if(!(b.getData() instanceof DriverBulletData)){
hit(b);
return;
}
float hitDst = 7f;
DriverBulletData data = (DriverBulletData) b.getData();
//if the target is dead, just keep flying until the bullet explodes
if(data.to.isDead()){
return;
}
float baseDst = data.from.dst(data.to);
float dst1 = b.dst(data.from);
float dst2 = b.dst(data.to);
boolean intersect = false;
//bullet has gone past the destination point: but did it intersect it?
if(dst1 > baseDst){
float angleTo = b.angleTo(data.to);
float baseAngle = data.to.angleTo(data.from);
//if angles are nearby, then yes, it did
if(Angles.near(angleTo, baseAngle, 2f)){
intersect = true;
//snap bullet position back; this is used for low-FPS situations
b.set(data.to.x + Angles.trnsx(baseAngle, hitDst), data.to.y + Angles.trnsy(baseAngle, hitDst));
}
}
//if on course and it's in range of the target
if(Math.abs(dst1 + dst2 - baseDst) < 4f && dst2 <= hitDst){
intersect = true;
} //else, bullet has gone off course, does not get recieved.
if(intersect){
data.to.handlePayload(b, data);
}
}
@Override
public void despawned(Bullet b){
super.despawned(b);
if(!(b.getData() instanceof DriverBulletData)) return;
DriverBulletData data = (DriverBulletData) b.getData();
data.to.isRecieving = false;
for(int i = 0; i < data.items.length; i++){
int amountDropped = Mathf.random(0, data.items[i]);
if(amountDropped > 0){
float angle = b.rot() + Mathf.range(100f);
Effects.effect(Fx.dropItem, Color.WHITE, b.x, b.y, angle, content.item(i));
}
}
}
@Override
public void hit(Bullet b, float hitx, float hity){
super.hit(b, hitx, hity);
despawned(b);
}
}

View File

@@ -1,7 +1,7 @@
package io.anuke.mindustry.entities.bullet;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.arc.entities.Effects;
import io.anuke.arc.util.Time;
@@ -10,6 +10,9 @@ import io.anuke.arc.math.Mathf;
public class MissileBulletType extends BasicBulletType{
protected Color trailColor = Palette.missileYellowBack;
protected float weaveScale = 0f;
protected float weaveMag = -1f;
public MissileBulletType(float speed, float damage, String bulletSprite){
super(speed, damage, bulletSprite);
backColor = Palette.missileYellowBack;
@@ -22,7 +25,11 @@ public class MissileBulletType extends BasicBulletType{
super.update(b);
if(Mathf.chance(Time.delta() * 0.2)){
Effects.effect(BulletFx.missileTrail, trailColor, b.x, b.y, 2f);
Effects.effect(Fx.missileTrail, trailColor, b.x, b.y, 2f);
}
if(weaveMag > 0){
b.velocity().rotate(Mathf.sin(Time.time() + b.id * 4422, weaveScale, weaveMag));
}
}
}

View File

@@ -13,9 +13,9 @@ import io.anuke.arc.util.Structs;
import io.anuke.arc.util.Time;
import io.anuke.arc.util.pooling.Pool.Poolable;
import io.anuke.arc.util.pooling.Pools;
import io.anuke.mindustry.content.Bullets;
import io.anuke.mindustry.content.StatusEffects;
import io.anuke.mindustry.content.bullets.TurretBullets;
import io.anuke.mindustry.content.fx.EnvironmentFx;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.Damage;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.traits.SaveTrait;
@@ -93,11 +93,11 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{
@Override
public void update(){
if(Mathf.chance(0.1 * Time.delta())){
Effects.effect(EnvironmentFx.fire, x + Mathf.range(4f), y + Mathf.range(4f));
Effects.effect(Fx.fire, x + Mathf.range(4f), y + Mathf.range(4f));
}
if(Mathf.chance(0.05 * Time.delta())){
Effects.effect(EnvironmentFx.smoke, x + Mathf.range(4f), y + Mathf.range(4f));
Effects.effect(Fx.fireSmoke, x + Mathf.range(4f), y + Mathf.range(4f));
}
if(Net.client()){
@@ -136,7 +136,7 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{
create(other);
if(Mathf.chance(fireballChance * Time.delta() * Mathf.clamp(flammability / 10f))){
Call.createBullet(TurretBullets.fireball, x, y, Mathf.random(360f));
Call.createBullet(Bullets.fireball, x, y, Mathf.random(360f));
}
}

View File

@@ -19,7 +19,7 @@ import io.anuke.arc.math.geom.Position;
import io.anuke.arc.math.geom.Rectangle;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.util.pooling.Pools;
import io.anuke.mindustry.content.bullets.TurretBullets;
import io.anuke.mindustry.content.Bullets;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.bullet.Bullet;
@@ -72,7 +72,7 @@ public class Lightning extends TimedEntity implements DrawTrait, SyncTrait, Time
hit.clear();
for (int i = 0; i < length/2; i++) {
Bullet.create(TurretBullets.damageLightning, l, team, x, y, 0f, 1f, 1f, dmg);
Bullet.create(Bullets.damageLightning, l, team, x, y, 0f, 1f, 1f, dmg);
l.lines.add(new Vector2(x + Mathf.range(3f), y + Mathf.range(3f)));
rect.setSize(hitRange).setCenter(x, y);

View File

@@ -19,10 +19,9 @@ import io.anuke.arc.util.Time;
import io.anuke.arc.util.pooling.Pool.Poolable;
import io.anuke.arc.util.pooling.Pools;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.bullets.TurretBullets;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.content.fx.EnvironmentFx;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Bullets;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.traits.SaveTrait;
import io.anuke.mindustry.entities.traits.SyncTrait;
@@ -85,7 +84,7 @@ public class Puddle extends SolidEntity implements SaveTrait, Poolable, DrawTrai
Puddle p = map.get(tile.pos());
if(generation == 0 && p != null && p.lastRipple <= Time.time() - 40f){
Effects.effect(BlockFx.ripple, tile.floor().liquidDrop.color,
Effects.effect(Fx.ripple, tile.floor().liquidDrop.color,
(tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f);
p.lastRipple = Time.time();
}
@@ -108,7 +107,7 @@ public class Puddle extends SolidEntity implements SaveTrait, Poolable, DrawTrai
p.accepting = Math.max(amount, p.accepting);
if(generation == 0 && p.lastRipple <= Time.time() - 40f && p.amount >= maxLiquid / 2f){
Effects.effect(BlockFx.ripple, p.liquid.color, (tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f);
Effects.effect(Fx.ripple, p.liquid.color, (tile.worldx() + source.worldx()) / 2f, (tile.worldy() + source.worldy()) / 2f);
p.lastRipple = Time.time();
}
}else{
@@ -130,16 +129,16 @@ public class Puddle extends SolidEntity implements SaveTrait, Poolable, DrawTrai
(liquid.flammability > 0.3f && dest.temperature > 0.7f)){ //flammable liquid + hot liquid
Fire.create(tile);
if(Mathf.chance(0.006 * amount)){
Call.createBullet(TurretBullets.fireball, x, y, Mathf.random(360f));
Call.createBullet(Bullets.fireball, x, y, Mathf.random(360f));
}
}else if(dest.temperature > 0.7f && liquid.temperature < 0.55f){ //cold liquid poured onto hot puddle
if(Mathf.chance(0.5f * amount)){
Effects.effect(EnvironmentFx.steam, x, y);
Effects.effect(Fx.steam, x, y);
}
return -0.1f * amount;
}else if(liquid.temperature > 0.7f && dest.temperature < 0.55f){ //hot liquid poured onto cold puddle
if(Mathf.chance(0.8f * amount)){
Effects.effect(EnvironmentFx.steam, x, y);
Effects.effect(Fx.steam, x, y);
}
return -0.4f * amount;
}
@@ -156,12 +155,12 @@ public class Puddle extends SolidEntity implements SaveTrait, Poolable, DrawTrai
}
@Override
public void getHitbox(Rectangle rectangle){
public void hitbox(Rectangle rectangle){
rectangle.setCenter(x, y).setSize(tilesize);
}
@Override
public void getHitboxTile(Rectangle rectangle){
public void hitboxTile(Rectangle rectangle){
rectangle.setCenter(x, y).setSize(0f);
}
@@ -203,13 +202,13 @@ public class Puddle extends SolidEntity implements SaveTrait, Poolable, DrawTrai
Units.getNearby(rect.setSize(Mathf.clamp(amount / (maxLiquid / 1.5f)) * 10f).setCenter(x, y), unit -> {
if(unit.isFlying()) return;
unit.getHitbox(rect2);
unit.hitbox(rect2);
if(!rect.overlaps(rect2)) return;
unit.applyEffect(liquid.effect, 0.5f);
if(unit.getVelocity().len() > 0.1){
Effects.effect(BlockFx.ripple, liquid.color, unit.x, unit.y);
if(unit.velocity().len() > 0.1){
Effects.effect(Fx.ripple, liquid.color, unit.x, unit.y);
}
});

View File

@@ -11,6 +11,6 @@ public interface AbsorbTrait extends Entity, TeamTrait, DamageTrait{
}
default float getShieldDamage(){
return getDamage();
return damage();
}
}

View File

@@ -15,8 +15,8 @@ import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Unit;
@@ -285,7 +285,7 @@ public interface BuilderTrait extends Entity{
}
if(Mathf.chance(0.06 * Time.delta())){
Effects.effect(BlockFx.pulverizeSmall,
Effects.effect(Fx.pulverizeSmall,
tile.worldx() + Mathf.range(tilesize / 2f),
tile.worldy() + Mathf.range(tilesize / 2f), 0f, item.color);
}

View File

@@ -2,7 +2,7 @@ package io.anuke.mindustry.entities.traits;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.content.fx.UnitFx;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.gen.Call;
import io.anuke.arc.entities.Effects;
@@ -26,7 +26,7 @@ public interface CarryTrait extends TeamTrait, SolidTrait, TargetTrait{
if(trait.getCarry() != null){ //already carrying something, drop it
//drop current
Effects.effect(UnitFx.unitDrop, trait.getCarry());
Effects.effect(Fx.unitDrop, trait.getCarry());
trait.getCarry().setCarrier(null);
trait.setCarry(null);
@@ -37,7 +37,7 @@ public interface CarryTrait extends TeamTrait, SolidTrait, TargetTrait{
trait.setCarry(unit);
unit.setCarrier(trait);
Effects.effect(UnitFx.unitPickup, trait);
Effects.effect(Fx.unitPickup, trait);
}
}

View File

@@ -18,14 +18,14 @@ public interface TargetTrait extends Position, VelocityTrait{
if(this instanceof SolidTrait){
return ((SolidTrait) this).getDeltaX();
}
return getVelocity().x;
return velocity().x;
}
default float getTargetVelocityY(){
if(this instanceof SolidTrait){
return ((SolidTrait) this).getDeltaY();
}
return getVelocity().y;
return velocity().y;
}
/**

View File

@@ -14,7 +14,7 @@ import io.anuke.arc.math.geom.Rectangle;
import io.anuke.arc.util.Interval;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.fx.ExplosionFx;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.Damage;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Unit;
@@ -77,7 +77,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
unit.onSuperDeath();
ScorchDecal.create(unit.x, unit.y);
Effects.effect(ExplosionFx.explosion, unit);
Effects.effect(Fx.explosion, unit);
Effects.shake(2f, 2f, unit);
//must run afterwards so the unit's group is not null when sending the removal packet
@@ -85,7 +85,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
}
@Override
public float getDrag(){
public float drag(){
return type.drag;
}
@@ -184,7 +184,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
}
public void targetClosest(){
target = Units.getClosestTarget(team, x, y, Math.max(getWeapon().getAmmo().getRange(), type.range), u -> type.targetAir || !u.isFlying());
target = Units.getClosestTarget(team, x, y, Math.max(getWeapon().getAmmo().range(), type.range), u -> type.targetAir || !u.isFlying());
}
public TileEntity getClosestEnemyCore(){
@@ -275,7 +275,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
}
@Override
public float getMass(){
public float mass(){
return type.mass;
}
@@ -326,7 +326,7 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
}
@Override
public float getMaxVelocity(){
public float maxVelocity(){
return type.maxVelocity;
}
@@ -357,12 +357,12 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
}
@Override
public void getHitbox(Rectangle rectangle){
public void hitbox(Rectangle rectangle){
rectangle.setSize(type.hitsize).setCenter(x, y);
}
@Override
public void getHitboxTile(Rectangle rectangle){
public void hitboxTile(Rectangle rectangle){
rectangle.setSize(type.hitsizeTile).setCenter(x, y);
}

View File

@@ -8,10 +8,10 @@ import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.entities.Predict;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.traits.CarriableTrait;
import io.anuke.mindustry.entities.traits.CarryTrait;
import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.type.AmmoType;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.meta.BlockFlag;
@@ -74,11 +74,11 @@ public abstract class FlyingUnit extends BaseUnit implements CarryTrait{
}else{
attack(150f);
if((Angles.near(angleTo(target), rotation, 15f) || !getWeapon().getAmmo().bullet.keepVelocity) //bombers don't care about rotation
&& dst(target) < Math.max(getWeapon().getAmmo().getRange(), type.range)){
AmmoType ammo = getWeapon().getAmmo();
if((Angles.near(angleTo(target), rotation, 15f) || !getWeapon().getAmmo().keepVelocity) //bombers don't care about rotation
&& dst(target) < Math.max(getWeapon().getAmmo().range(), type.range)){
BulletType ammo = getWeapon().getAmmo();
Vector2 to = Predict.intercept(FlyingUnit.this, target, ammo.bullet.speed);
Vector2 to = Predict.intercept(FlyingUnit.this, target, ammo.speed);
getWeapon().update(FlyingUnit.this, to.x, to.y);
}

View File

@@ -10,8 +10,8 @@ import io.anuke.mindustry.Vars;
import io.anuke.mindustry.entities.Predict;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.type.AmmoType;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.type.Weapon;
import io.anuke.mindustry.world.Tile;
@@ -43,11 +43,11 @@ public abstract class GroundUnit extends BaseUnit{
TileEntity core = getClosestEnemyCore();
float dst = core == null ? 0 : dst(core);
if(core != null && dst < getWeapon().getAmmo().getRange() / 1.1f){
if(core != null && dst < getWeapon().getAmmo().range() / 1.1f){
target = core;
}
if(dst > getWeapon().getAmmo().getRange() * 0.5f){
if(dst > getWeapon().getAmmo().range() * 0.5f){
moveToCore();
}
}
@@ -187,13 +187,13 @@ public abstract class GroundUnit extends BaseUnit{
}
if(!Units.invalidateTarget(target, this)){
if(dst(target) < getWeapon().getAmmo().getRange()){
if(dst(target) < getWeapon().getAmmo().range()){
rotate(angleTo(target));
if(Angles.near(angleTo(target), rotation, 13f)){
AmmoType ammo = getWeapon().getAmmo();
BulletType ammo = getWeapon().getAmmo();
Vector2 to = Predict.intercept(GroundUnit.this, target, ammo.bullet.speed);
Vector2 to = Predict.intercept(GroundUnit.this, target, ammo.speed);
getWeapon().update(GroundUnit.this, to.x, to.y);
}

View File

@@ -6,7 +6,7 @@ import io.anuke.arc.entities.EntityGroup;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Geometry;
import io.anuke.arc.util.Structs;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Units;

View File

@@ -1,12 +1,7 @@
package io.anuke.mindustry.game;
import io.anuke.mindustry.type.ContentType;
/**Interface for a list of content to be loaded in {@link io.anuke.mindustry.core.ContentLoader}.*/
public interface ContentList{
/**This method should create all the content.*/
void load();
/**This method should return the type of content being loaded.*/
ContentType type();
}

View File

@@ -8,7 +8,7 @@ import io.anuke.arc.graphics.Color;
import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.glutils.FrameBuffer;
import io.anuke.arc.util.Tmp;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.game.EventType.TileChangeEvent;
import io.anuke.mindustry.game.EventType.WorldLoadEvent;
import io.anuke.mindustry.game.Team;

View File

@@ -9,7 +9,7 @@ import io.anuke.arc.math.geom.Rectangle;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.util.Time;
import io.anuke.arc.util.Tmp;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.input.InputHandler;

View File

@@ -7,7 +7,7 @@ import io.anuke.arc.graphics.g2d.Draw;
import io.anuke.arc.graphics.g2d.Lines;
import io.anuke.arc.graphics.g2d.TextureRegion;
import io.anuke.arc.math.Mathf;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.graphics.Palette;

View File

@@ -11,8 +11,8 @@ import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.fx.EnvironmentFx;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.effect.ItemTransfer;
import io.anuke.mindustry.entities.traits.BuilderTrait.BuildRequest;
@@ -57,7 +57,7 @@ public abstract class InputHandler implements InputProcessor{
throw new ValidateException(player, "Player cannot drop an item.");
}
Effects.effect(EnvironmentFx.dropItem, Color.WHITE, player.x, player.y, angle, player.inventory.getItem().item);
Effects.effect(Fx.dropItem, Color.WHITE, player.x, player.y, angle, player.inventory.getItem().item);
player.inventory.clearItem();
}

View File

@@ -18,8 +18,8 @@ import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Align;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.TileEntity;
@@ -559,7 +559,7 @@ public class MobileInput extends InputHandler implements GestureListener{
consumed = true;
player.dropCarry(); //drop off unit
}else{
Unit unit = Units.getClosest(player.getTeam(), Core.input.mouseWorld(x, y).x, Core.input.mouseWorld(x, y).y, 4f, u -> !u.isFlying() && u.getMass() <= player.mech.carryWeight);
Unit unit = Units.getClosest(player.getTeam(), Core.input.mouseWorld(x, y).x, Core.input.mouseWorld(x, y).y, 4f, u -> !u.isFlying() && u.mass() <= player.mech.carryWeight);
if(unit != null){
consumed = true;

View File

@@ -8,8 +8,7 @@ import io.anuke.arc.graphics.Pixmap;
import io.anuke.arc.graphics.Pixmap.Format;
import io.anuke.arc.util.Pack;
import io.anuke.arc.util.Structs;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.blocks.StorageBlocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.maps.MapMeta;
@@ -96,7 +95,7 @@ public class MapIO{
}
}
data.write(x, y, DataPosition.wall, StorageBlocks.core.id);
data.write(x, y, DataPosition.wall, Blocks.core.id);
data.write(x, y, DataPosition.rotationTeam, Pack.byteByte((byte)0, (byte)Team.blue.ordinal()));
}
}

View File

@@ -5,8 +5,7 @@ import io.anuke.arc.entities.Entities;
import io.anuke.arc.entities.EntityGroup;
import io.anuke.arc.entities.trait.Entity;
import io.anuke.arc.util.Pack;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.blocks.StorageBlocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.entities.traits.SaveTrait;
import io.anuke.mindustry.entities.traits.TypeTrait;
import io.anuke.mindustry.game.Content;
@@ -134,7 +133,7 @@ public abstract class SaveFileVersion{
tile.entity.readConfig(stream);
tile.entity.read(stream);
if(tile.block() == StorageBlocks.core){
if(tile.block() == Blocks.core){
state.teams.get(t).cores.add(tile);
}
}else if(wallid == 0){

View File

@@ -292,16 +292,6 @@ public class TypeIO{
return content.liquid(buffer.get());
}
@WriteClass(AmmoType.class)
public static void writeAmmo(ByteBuffer buffer, AmmoType type){
buffer.put(type.id);
}
@ReadClass(AmmoType.class)
public static AmmoType readAmmo(ByteBuffer buffer){
return content.getByID(ContentType.weapon, buffer.get());
}
@WriteClass(BulletType.class)
public static void writeBulletType(ByteBuffer buffer, BulletType type){
buffer.put(type.id);

View File

@@ -4,7 +4,7 @@ import io.anuke.arc.collection.IntIntMap;
import io.anuke.arc.util.Pack;
import io.anuke.arc.util.Structs;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.world.Block;
import java.nio.ByteBuffer;

View File

@@ -2,14 +2,7 @@ package io.anuke.mindustry.maps;
import io.anuke.arc.collection.Array;
import io.anuke.arc.collection.GridMap;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.content.Mechs;
import io.anuke.mindustry.content.UnitTypes;
import io.anuke.mindustry.content.blocks.CraftingBlocks;
import io.anuke.mindustry.content.blocks.ProductionBlocks;
import io.anuke.mindustry.content.blocks.UnitBlocks;
import io.anuke.mindustry.content.blocks.UpgradeBlocks;
import io.anuke.mindustry.content.*;
import io.anuke.mindustry.entities.units.UnitCommand;
import io.anuke.mindustry.maps.missions.*;
import io.anuke.mindustry.type.Item;
@@ -30,9 +23,9 @@ public class SectorPresets{
//command center mission
add(new SectorPreset(0, 1,
Array.ofRecursive(
Missions.blockRecipe(UnitBlocks.daggerFactory),
Missions.blockRecipe(Blocks.daggerFactory),
new UnitMission(UnitTypes.dagger),
Missions.blockRecipe(UnitBlocks.commandCenter),
Missions.blockRecipe(Blocks.commandCenter),
new CommandMission(UnitCommand.retreat),
new CommandMission(UnitCommand.attack),
new BattleMission()
@@ -42,7 +35,7 @@ public class SectorPresets{
//pad mission
add(new SectorPreset(0, -2,
Array.ofRecursive(
Missions.blockRecipe(mobile ? UpgradeBlocks.alphaPad : UpgradeBlocks.dartPad),
Missions.blockRecipe(mobile ? Blocks.alphaPad : Blocks.dartPad),
new MechMission(mobile ? Mechs.alpha : Mechs.dart),
new WaveMission(15)
),
@@ -51,10 +44,10 @@ public class SectorPresets{
//oil mission
add(new SectorPreset(-2, 0,
Array.ofRecursive(
Missions.blockRecipe(ProductionBlocks.cultivator),
Missions.blockRecipe(ProductionBlocks.waterExtractor),
Missions.blockRecipe(Blocks.cultivator),
Missions.blockRecipe(Blocks.waterExtractor),
new ContentMission(Items.biomatter),
Missions.blockRecipe(CraftingBlocks.biomatterCompressor),
Missions.blockRecipe(Blocks.biomatterCompressor),
new ContentMission(Liquids.oil),
new BattleMission()
),

View File

@@ -1,10 +1,8 @@
package io.anuke.mindustry.maps;
import io.anuke.arc.collection.Array;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.blocks.ProductionBlocks;
import io.anuke.mindustry.content.blocks.StorageBlocks;
import io.anuke.mindustry.content.blocks.UnitBlocks;
import io.anuke.mindustry.maps.missions.BlockMission;
import io.anuke.mindustry.maps.missions.ItemMission;
import io.anuke.mindustry.maps.missions.Mission;
@@ -91,13 +89,13 @@ public class TutorialSector{
//intentionally unlocalized
new ItemMission(Items.copper, 50).setMessage("An updated tutorial will return next build.\nFor now, you'll have to deal with... this."),
new BlockMission(ProductionBlocks.mechanicalDrill),
new BlockMission(Blocks.mechanicalDrill),
new ItemMission(Items.copper, 100),
new ItemMission(Items.lead, 50),
// new BlockMission(CraftingBlocks.smelter),
new ItemMission(Items.densealloy, 10),
new BlockMission(Blocks.smelter),
new WaveMission(5)
);
}
@@ -108,9 +106,9 @@ public class TutorialSector{
private static void generateBase(){
int x = sectorSize - 50, y = sectorSize - 50;
world.setBlock(world.tile(x, y), StorageBlocks.core, waveTeam);
world.setBlock(world.tile(x - 1, y + 2), UnitBlocks.daggerFactory, waveTeam);
world.setBlock(world.tile(x - 1, y - 3), UnitBlocks.daggerFactory, waveTeam);
world.setBlock(world.tile(x, y), Blocks.core, waveTeam);
world.setBlock(world.tile(x - 1, y + 2), Blocks.daggerFactory, waveTeam);
world.setBlock(world.tile(x - 1, y - 3), Blocks.daggerFactory, waveTeam);
//since placed() is not called here, add core manually
state.teams.get(waveTeam).cores.add(world.tile(x, y));

View File

@@ -9,11 +9,10 @@ import io.anuke.arc.function.TriFunction;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Geometry;
import io.anuke.arc.math.geom.Point2;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.content.blocks.*;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.type.AmmoType;
import io.anuke.mindustry.type.Recipe;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Edges;
@@ -55,7 +54,7 @@ public class FortressGenerator{
}
void gen(){
gen.setBlock(enemyX, enemyY, StorageBlocks.core, team);
gen.setBlock(enemyX, enemyY, Blocks.core, team);
gen.random.nextBoolean();
float difficultyScl = Mathf.clamp(gen.sector.difficulty / 20f + gen.random.range(0.25f), 0f, 0.9999f);
@@ -74,12 +73,14 @@ public class FortressGenerator{
float placeChance = difficultyScl*0.75f+0.25f;
IntIntMap ammoPerType = new IntIntMap();
//todo implement
/*
for(Block turret : turrets){
if(!(turret instanceof ItemTurret)) continue;
ItemTurret t = (ItemTurret)turret;
int size = t.getAmmoTypes().length;
ammoPerType.put(t.id, Mathf.clamp((int)(size* difficultyScl) + gen.random.range(1), 0, size - 1));
}
}*/
TriFunction<Tile, Block, Predicate<Tile>, Boolean> checker = (current, block, pred) -> {
for(Point2 point : Edges.getEdges(block.size)){
@@ -108,25 +109,25 @@ public class FortressGenerator{
Array<IntPositionConsumer> passes = Array.with(
//initial seeding solar panels
placer.get(PowerBlocks.largeSolarPanel, 0.001f),
placer.get(Blocks.largeSolarPanel, 0.001f),
//extra seeding
seeder.get(PowerBlocks.solarPanel, tile -> tile.block() == PowerBlocks.largeSolarPanel && gen.random.chance(0.3)),
seeder.get(Blocks.solarPanel, tile -> tile.block() == Blocks.largeSolarPanel && gen.random.chance(0.3)),
//coal gens
seeder.get(PowerBlocks.combustionGenerator, tile -> tile.block() instanceof SolarGenerator && gen.random.chance(0.2)),
seeder.get(Blocks.combustionGenerator, tile -> tile.block() instanceof SolarGenerator && gen.random.chance(0.2)),
//water extractors
seeder.get(ProductionBlocks.waterExtractor, tile -> tile.block() instanceof NuclearReactor && gen.random.chance(0.5)),
seeder.get(Blocks.waterExtractor, tile -> tile.block() instanceof NuclearReactor && gen.random.chance(0.5)),
//mend projectors
seeder.get(DefenseBlocks.mendProjector, tile -> tile.block() instanceof PowerGenerator && gen.random.chance(0.04)),
seeder.get(Blocks.mendProjector, tile -> tile.block() instanceof PowerGenerator && gen.random.chance(0.04)),
//power turrets
seeder.get(powerTurret, tile -> tile.block() instanceof PowerGenerator && gen.random.chance(0.04)),
//repair point
seeder.get(UnitBlocks.repairPoint, tile -> tile.block() instanceof PowerGenerator && gen.random.chance(0.1)),
seeder.get(Blocks.repairPoint, tile -> tile.block() instanceof PowerGenerator && gen.random.chance(0.1)),
//turrets1
seeder.get(turret1, tile -> tile.block() instanceof PowerBlock && gen.random.chance(0.22 - turret1.size*0.02)),
@@ -135,22 +136,22 @@ public class FortressGenerator{
seeder.get(turret2, tile -> tile.block() instanceof PowerBlock && gen.random.chance(0.12 - turret2.size*0.02)),
//shields
seeder.get(DefenseBlocks.forceProjector, tile -> (tile.block() instanceof CoreBlock || tile.block() instanceof UnitFactory) && gen.random.chance(0.2 * dscl2)),
seeder.get(Blocks.forceProjector, tile -> (tile.block() instanceof CoreBlock || tile.block() instanceof UnitFactory) && gen.random.chance(0.2 * dscl2)),
//unit pads (assorted)
seeder.get(UnitBlocks.daggerFactory, tile -> (tile.block() instanceof MendProjector || tile.block() instanceof ForceProjector) && gen.random.chance(0.3 * dscl2)),
seeder.get(Blocks.daggerFactory, tile -> (tile.block() instanceof MendProjector || tile.block() instanceof ForceProjector) && gen.random.chance(0.3 * dscl2)),
//unit pads (assorted)
seeder.get(UnitBlocks.wraithFactory, tile -> (tile.block() instanceof MendProjector || tile.block() instanceof ForceProjector) && gen.random.chance(0.3 * dscl2)),
seeder.get(Blocks.wraithFactory, tile -> (tile.block() instanceof MendProjector || tile.block() instanceof ForceProjector) && gen.random.chance(0.3 * dscl2)),
//unit pads (assorted)
seeder.get(UnitBlocks.titanFactory, tile -> (tile.block() instanceof MendProjector || tile.block() instanceof ForceProjector) && gen.random.chance(0.23 * dscl2)),
seeder.get(Blocks.titanFactory, tile -> (tile.block() instanceof MendProjector || tile.block() instanceof ForceProjector) && gen.random.chance(0.23 * dscl2)),
//unit pads (assorted)
seeder.get(UnitBlocks.ghoulFactory, tile -> (tile.block() instanceof MendProjector || tile.block() instanceof ForceProjector) && gen.random.chance(0.23 * dscl2)),
seeder.get(Blocks.ghoulFactory, tile -> (tile.block() instanceof MendProjector || tile.block() instanceof ForceProjector) && gen.random.chance(0.23 * dscl2)),
//vaults
seeder.get(StorageBlocks.vault, tile -> (tile.block() instanceof CoreBlock || tile.block() instanceof ForceProjector) && gen.random.chance(0.4)),
seeder.get(Blocks.vault, tile -> (tile.block() instanceof CoreBlock || tile.block() instanceof ForceProjector) && gen.random.chance(0.4)),
//big turrets
seeder.get(bigTurret, tile -> tile.block() instanceof StorageBlock && gen.random.chance(0.65)),
@@ -172,7 +173,7 @@ public class FortressGenerator{
},
//mines
placer.get(DefenseBlocks.shockMine, 0.02f * difficultyScl),
placer.get(Blocks.shockMine, 0.02f * difficultyScl),
//fill up turrets w/ ammo
(x, y) -> {
@@ -181,11 +182,12 @@ public class FortressGenerator{
if(block instanceof PowerTurret){
tile.entity.power.satisfaction = 1.0f;
}else if(block instanceof ItemTurret){
//todo implement
/*}else if(block instanceof ItemTurret){
ItemTurret turret = (ItemTurret)block;
AmmoType[] type = turret.getAmmoTypes();
int index = ammoPerType.get(block.id, 0);
block.handleStack(type[index].item, block.acceptStack(type[index].item, 1000, tile, null), tile, null);
block.handleStack(type[index].item, block.acceptStack(type[index].item, 1000, tile, null), tile, null);*/
}else if(block instanceof NuclearReactor){
tile.entity.items.add(Items.thorium, 30);
}else if(block instanceof LiquidTurret){

View File

@@ -11,9 +11,7 @@ import io.anuke.arc.util.Structs;
import io.anuke.arc.util.noise.RidgedPerlin;
import io.anuke.arc.util.noise.Simplex;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.blocks.OreBlocks;
import io.anuke.mindustry.content.blocks.StorageBlocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.maps.Map;
import io.anuke.mindustry.maps.MapTileData;
@@ -191,10 +189,10 @@ public class WorldGenerator{
}
}
world.setBlock(tiles[spawns.get(0).x][spawns.get(0).y], StorageBlocks.core, Team.blue);
world.setBlock(tiles[spawns.get(0).x][spawns.get(0).y], Blocks.core, Team.blue);
if(state.mode.isPvp){
world.setBlock(tiles[spawns.get(1).x][spawns.get(1).y], StorageBlocks.core, Team.red);
world.setBlock(tiles[spawns.get(1).x][spawns.get(1).y], Blocks.core, Team.red);
}
world.endMapLoad();
@@ -237,7 +235,7 @@ public class WorldGenerator{
if(entry.noise.octaveNoise2D(1, 0.7, 1f / (4 + i * 2), x, y) / 4f +
Math.abs(0.5f - entry.noise.octaveNoise2D(2, 0.7, 1f / (50 + i * 2), x, y)) > 0.48f &&
Math.abs(0.5f - entry.noise.octaveNoise2D(1, 1, 1f / (55 + i * 4), x, y)) > 0.22f){
tile.setFloor((Floor) OreBlocks.get(tile.floor(), entry.item));
tile.setFloor((Floor) OreBlock.get(tile.floor(), entry.item));
break;
}
}
@@ -393,7 +391,7 @@ public class WorldGenerator{
Item entry = ores.get(i);
if(Math.abs(0.5f - sim.octaveNoise2D(2, 0.7, 1f / (50 + i * 2), offsetX, offsetY)) > 0.23f &&
Math.abs(0.5f - sim2.octaveNoise2D(1, 1, 1f / (40 + i * 4), offsetX, offsetY)) > 0.32f){
floor = OreBlocks.get(floor, entry);
floor = OreBlock.get(floor, entry);
break;
}
}

View File

@@ -2,7 +2,7 @@ package io.anuke.mindustry.maps.missions;
import io.anuke.arc.math.geom.Point2;
import io.anuke.arc.collection.Array;
import io.anuke.mindustry.content.blocks.StorageBlocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.maps.generation.Generation;
import io.anuke.mindustry.world.Tile;
@@ -39,7 +39,7 @@ public abstract class MissionWithStartingCore extends Mission{
}
Tile startingCoreTile = gen.tiles[spawnPoints.first().x][spawnPoints.first().y];
startingCoreTile.setBlock(StorageBlocks.core);
startingCoreTile.setBlock(Blocks.core);
startingCoreTile.setTeam(team);
state.teams.get(team).cores.add(startingCoreTile);

View File

@@ -6,7 +6,7 @@ import io.anuke.arc.collection.ObjectMap.Entry;
import io.anuke.arc.entities.Entities;
import io.anuke.arc.util.Pack;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.game.Team;

View File

@@ -1,12 +0,0 @@
package io.anuke.mindustry.type;
/**Used to store ammo amounts in turrets.*/
public class AmmoEntry{
public AmmoType type;
public int amount;
public AmmoEntry(AmmoType type, int amount){
this.type = type;
this.amount = amount;
}
}

View File

@@ -1,75 +0,0 @@
package io.anuke.mindustry.type;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.game.Content;
import io.anuke.arc.entities.Effects.Effect;
public class AmmoType extends Content {
/**The item used. Always null if liquid isn't.*/
public final Item item;
/**The liquid used. Always null if item isn't.*/
public final Liquid liquid;
/**The resulting bullet. Never null.*/
public final BulletType bullet;
/**
* For item ammo, this is amount given per ammo item.
* For liquid ammo, this is amount used per shot.
*/
public final float quantityMultiplier;
/**Reload speed multiplier.*/
public float reloadMultiplier = 1f;
/**Bullet recoil strength.*/
public float recoil = 0f;
/**Additional inaccuracy in degrees.*/
public float inaccuracy;
/**Effect created when shooting.*/
public Effect shootEffect = Fx.none;
/**Extra smoke effect created when shooting.*/
public Effect smokeEffect = Fx.none;
/**Range. Use a value < 0 to calculate from bullet.*/
public float range = -1f;
/**
* Creates an AmmoType with no liquid or item. Used for power-based ammo.
*/
public AmmoType(BulletType result){
this.item = null;
this.liquid = null;
this.bullet = result;
this.quantityMultiplier = 1f;
this.reloadMultiplier = 1f;
}
/**
* Creates an AmmoType with an item.
*/
public AmmoType(Item item, BulletType result, float multiplier){
this.item = item;
this.liquid = null;
this.bullet = result;
this.quantityMultiplier = multiplier;
}
/**
* Creates an AmmoType with a liquid.
*/
public AmmoType(Liquid liquid, BulletType result, float multiplier){
this.item = null;
this.liquid = liquid;
this.bullet = result;
this.quantityMultiplier = multiplier;
}
/**
* Returns maximum distance the bullet this ammo type has can travel.
*/
public float getRange(){
return range < 0 ? bullet.speed * bullet.lifetime : range;
}
@Override
public ContentType getContentType(){
return ContentType.ammo;
}
}

View File

@@ -11,7 +11,6 @@ public enum ContentType {
weapon,
status,
unit,
ammo,
weather,
effect
}

View File

@@ -10,9 +10,10 @@ import io.anuke.arc.math.Angles;
import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.traits.ShooterTrait;
import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.gen.Call;
@@ -24,7 +25,7 @@ public class Weapon extends Content{
/**minimum cursor distance from player, fixes 'cross-eyed' shooting.*/
protected static float minPlayerDist = 20f;
/**ammo type map. set with setAmmo()*/
protected AmmoType ammo;
protected BulletType ammo;
/**shell ejection effect*/
protected Effect ejectEffect = Fx.none;
/**weapon reload in frames*/
@@ -47,7 +48,7 @@ public class Weapon extends Content{
protected float velocityRnd = 0f;
/**whether to shoot the weapons in different arms one after another, rather than all at once*/
protected boolean roundrobin = false;
/**translator for vector calulations*/
/**vector for vector calulations*/
protected Vector2 tr = new Vector2();
public TextureRegion equipRegion, region;
@@ -81,11 +82,11 @@ public class Weapon extends Content{
Weapon weapon = shooter.getWeapon();
Angles.shotgun(weapon.shots, weapon.spacing, rotation, f -> weapon.bullet(shooter, x, y, f + Mathf.range(weapon.inaccuracy)));
AmmoType ammo = weapon.ammo;
BulletType ammo = weapon.ammo;
weapon.tr.trns(rotation + 180f, ammo.recoil);
shooter.getVelocity().add(weapon.tr);
shooter.velocity().add(weapon.tr);
weapon.tr.trns(rotation, 3f);
@@ -109,7 +110,7 @@ public class Weapon extends Content{
return ContentType.weapon;
}
public AmmoType getAmmo(){
public BulletType getAmmo(){
return ammo;
}
@@ -165,7 +166,7 @@ public class Weapon extends Content{
if(owner == null) return;
tr.trns(angle, 3f);
Bullet.create(ammo.bullet,
Bullet.create(ammo,
owner, owner.getTeam(), x + tr.x, y + tr.y, angle, (1f - velocityRnd) + Mathf.random(velocityRnd));
}
}

View File

@@ -8,7 +8,7 @@ import io.anuke.arc.scene.Group;
import io.anuke.arc.scene.actions.Actions;
import io.anuke.arc.scene.ui.layout.Table;
import io.anuke.arc.util.Align;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.input.InputHandler;
import io.anuke.mindustry.world.Block;

View File

@@ -6,7 +6,7 @@ import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Vector2;
import io.anuke.arc.util.Time;
import io.anuke.mindustry.Vars;
import io.anuke.mindustry.content.fx.EnvironmentFx;
import io.anuke.mindustry.content.Fx;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.effect.Puddle;
@@ -157,13 +157,13 @@ public abstract class BaseBlock extends MappableContent{
tile.entity.damage(1 * Time.delta());
next.entity.damage(1 * Time.delta());
if(Mathf.chance(0.1 * Time.delta())){
Effects.effect(EnvironmentFx.fire, (tile.worldx() + next.worldx()) / 2f, (tile.worldy() + next.worldy()) / 2f);
Effects.effect(Fx.fire, (tile.worldx() + next.worldx()) / 2f, (tile.worldy() + next.worldy()) / 2f);
}
}else if((liquid.temperature > 0.7f && other.temperature < 0.55f) ||
(other.temperature > 0.7f && liquid.temperature < 0.55f)){
tile.entity.liquids.remove(liquid, Math.min(tile.entity.liquids.get(liquid), 0.7f * Time.delta()));
if(Mathf.chance(0.2f * Time.delta())){
Effects.effect(EnvironmentFx.steam, (tile.worldx() + next.worldx()) / 2f, (tile.worldy() + next.worldy()) / 2f);
Effects.effect(Fx.steam, (tile.worldx() + next.worldx()) / 2f, (tile.worldy() + next.worldy()) / 2f);
}
}
}

View File

@@ -352,7 +352,7 @@ public class Block extends BaseBlock {
}
public void handleBulletHit(TileEntity entity, Bullet bullet){
entity.damage(bullet.getDamage());
entity.damage(bullet.damage());
}
public void update(Tile tile){

View File

@@ -6,7 +6,7 @@ import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Geometry;
import io.anuke.arc.math.geom.Point2;
import io.anuke.arc.math.geom.Rectangle;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.game.EventType.BlockBuildBeginEvent;
import io.anuke.mindustry.game.Team;

View File

@@ -5,7 +5,6 @@ import io.anuke.arc.collection.ObjectIntMap;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.type.ContentType;
import static io.anuke.mindustry.Vars.content;
@@ -49,9 +48,4 @@ public class ColorMapper implements ContentList{
colorMap.put(block, color);
}
}
@Override
public ContentType type(){
return ContentType.block;
}
}

View File

@@ -2,12 +2,11 @@ package io.anuke.mindustry.world;
import io.anuke.arc.collection.IntMap;
import io.anuke.arc.graphics.Color;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.content.blocks.OreBlocks;
import io.anuke.mindustry.game.ContentList;
import io.anuke.mindustry.type.ContentType;
import io.anuke.mindustry.world.blocks.Floor;
import io.anuke.mindustry.world.blocks.OreBlock;
public class LegacyColorMapper implements ContentList{
private static IntMap<LegacyBlock> blockMap = new IntMap<>();
@@ -39,15 +38,10 @@ public class LegacyColorMapper implements ContentList{
map("6e501e", Blocks.dirt, 0);
map("ed5334", Blocks.lava, 0);
map("292929", Blocks.tar, 0);
map("c3a490", OreBlocks.get(Blocks.stone, Items.copper), 0);
map("161616", OreBlocks.get(Blocks.stone, Items.coal), 0);
map("6277bc", OreBlocks.get(Blocks.stone, Items.titanium), 0);
map("83bc58", OreBlocks.get(Blocks.stone, Items.thorium), 0);
}
@Override
public ContentType type(){
return ContentType.block;
map("c3a490", OreBlock.get(Blocks.stone, Items.copper), 0);
map("161616", OreBlock.get(Blocks.stone, Items.coal), 0);
map("6277bc", OreBlock.get(Blocks.stone, Items.titanium), 0);
map("83bc58", OreBlock.get(Blocks.stone, Items.thorium), 0);
}
private void map(String color, Block block, int elevation){

Some files were not shown because too many files have changed in this diff Show More