Crash fixes / New ammo types / New turrets / Missiles added

This commit is contained in:
Anuken 2018-07-01 14:36:16 -04:00
parent 7177e0a576
commit 02b8e34242
48 changed files with 1182 additions and 931 deletions

View File

@ -27,7 +27,7 @@ allprojects {
gdxVersion = '1.9.8'
roboVMVersion = '2.3.0'
aiVersion = '1.8.1'
uCoreVersion = 'a19e59c800'
uCoreVersion = '2a244b3d35'
getVersionString = {
String buildVersion = getBuildVersion()

View File

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 356 B

After

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 682 B

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 227 B

View File

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 129 KiB

View File

@ -9,10 +9,10 @@ import io.anuke.mindustry.type.AmmoType;
import io.anuke.mindustry.type.ContentList;
public class AmmoTypes implements ContentList {
public static AmmoType bulletTungsten, bulletLead, bulletCarbide, bulletThorium, bulletSilicon, bulletThermite,
public static AmmoType bulletTungsten, bulletLead, bulletCarbide, bulletThorium, bulletSilicon, bulletPyratite,
shotgunTungsten, bombExplosive, bombIncendiary, bombOil, shellCarbide, flamerThermite,
flakLead, flakExplosive, flakPlastic, flakSurge, missileExplosive, missileIncindiary, missileSurge,
artilleryCarbide, artilleryThorium, artilleryPlastic, artilleryHoming, artilleryIncindiary,
artilleryCarbide, artilleryPlastic, artilleryHoming, artilleryIncindiary, artilleryExplosive,
basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid;
@Override
@ -72,8 +72,8 @@ public class AmmoTypes implements ContentList {
}};
bulletThorium = new AmmoType(Items.thorium, StandardBullets.thorium, 2) {{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootBigSmoke;
}};
bulletSilicon = new AmmoType(Items.silicon, StandardBullets.homing, 5) {{
@ -82,7 +82,7 @@ public class AmmoTypes implements ContentList {
reloadMultiplier = 1.4f;
}};
bulletThermite = new AmmoType(Items.pyratite, StandardBullets.tracer, 3) {{
bulletPyratite = new AmmoType(Items.pyratite, StandardBullets.tracer, 3) {{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
inaccuracy = 3f;
@ -115,11 +115,13 @@ public class AmmoTypes implements ContentList {
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) {{
@ -129,29 +131,33 @@ public class AmmoTypes implements ContentList {
//artillery
artilleryCarbide = new AmmoType(Items.carbide, ArtilleryBullets.carbide, 1) {{
artilleryCarbide = new AmmoType(Items.carbide, ArtilleryBullets.carbide, 2) {{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}};
artilleryThorium = new AmmoType(Items.thorium, ArtilleryBullets.thorium, 1) {{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}};
artilleryPlastic = new AmmoType(Items.plastanium, ArtilleryBullets.plastic, 1) {{
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, 1) {{
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;
}};
//flame

View File

@ -82,7 +82,7 @@ public class Items implements ContentList{
explosiveness = 0.6f;
}};
pyratite = new Item("pyratite", Color.valueOf("ff795e")) {{
pyratite = new Item("pyratite", Color.valueOf("ffaa5f")) {{
flammability = 0.7f;
explosiveness = 0.2f;
}};

View File

@ -33,9 +33,9 @@ public class Recipes implements ContentList{
new Recipe(weapon, TurretBlocks.lancer, new ItemStack(Items.tungsten, 50), new ItemStack(Items.lead, 100), new ItemStack(Items.silicon, 90));
new Recipe(weapon, TurretBlocks.wave, new ItemStack(Items.carbide, 60), new ItemStack(Items.titanium, 70), new ItemStack(Items.lead, 150));
new Recipe(weapon, TurretBlocks.swarmer, new ItemStack(Items.carbide, 70), new ItemStack(Items.titanium, 70), new ItemStack(Items.plastanium, 90), new ItemStack(Items.silicon, 60), new ItemStack(Items.phasematter, 60));
new Recipe(weapon, TurretBlocks.salvo, new ItemStack(Items.tungsten, 160), new ItemStack(Items.carbide, 190), new ItemStack(Items.thorium, 130));
new Recipe(weapon, TurretBlocks.ripple, new ItemStack(Items.tungsten, 170), new ItemStack(Items.carbide, 220), new ItemStack(Items.thorium, 120));
new Recipe(weapon, TurretBlocks.swarmer, new ItemStack(Items.carbide, 70), new ItemStack(Items.titanium, 70), new ItemStack(Items.plastanium, 90), new ItemStack(Items.silicon, 60));
new Recipe(weapon, TurretBlocks.salvo, new ItemStack(Items.tungsten, 210), new ItemStack(Items.carbide, 190), new ItemStack(Items.thorium, 130));
new Recipe(weapon, TurretBlocks.ripple, new ItemStack(Items.tungsten, 300), new ItemStack(Items.carbide, 220), new ItemStack(Items.thorium, 120));
//DISTRIBUTION
new Recipe(distribution, DistributionBlocks.conveyor, new ItemStack(Items.lead, 1));

View File

@ -76,7 +76,7 @@ public class Weapons implements ContentList {
reload = 10f;
roundrobin = true;
ejectEffect = ShootFx.shellEjectSmall;
setAmmo(AmmoTypes.bulletThermite);
setAmmo(AmmoTypes.bulletPyratite);
}};
bomber = new Weapon("bomber") {{

View File

@ -18,13 +18,14 @@ public class TurretBlocks extends BlockList implements ContentList {
@Override
public void load() {
duo = new DoubleTurret("duo") {{
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletThermite, AmmoTypes.bulletSilicon};
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletPyratite, AmmoTypes.bulletSilicon};
reload = 25f;
restitution = 0.03f;
range = 80f;
shootCone = 15f;
ammoUseEffect = ShootFx.shellEjectSmall;
health = 80;
inaccuracy = 3f;
}};
/*
scatter = new BurstTurret("scatter") {{
@ -115,22 +116,30 @@ public class TurretBlocks extends BlockList implements ContentList {
size = 2;
}};
swarmer = new ItemTurret("swarmer") {{
ammoTypes = new AmmoType[]{AmmoTypes.missileExplosive, AmmoTypes.missileIncindiary, AmmoTypes.missileSurge};
swarmer = new BurstTurret("swarmer") {{
ammoTypes = new AmmoType[]{AmmoTypes.missileExplosive, AmmoTypes.missileIncindiary/*, AmmoTypes.missileSurge*/};
reload = 60f;
shots = 4;
burstSpacing = 5;
inaccuracy = 10f;
range = 140f;
xRand = 6f;
size = 2;
health = 380;
}};
salvo = new ItemTurret("salvo") {{
salvo = new BurstTurret("salvo") {{
size = 2;
range = 100f;
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletThermite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
reload = 70f;
range = 110f;
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletCarbide, AmmoTypes.bulletPyratite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
reload = 40f;
restitution = 0.03f;
ammoEjectBack = 3f;
cooldown = 0.03f;
recoil = 3f;
shootShake = 2f;
burstSpacing = 4;
shots = 3;
ammoUseEffect = ShootFx.shellEjectBig;
drawer = (tile, entity) -> {
@ -146,12 +155,23 @@ public class TurretBlocks extends BlockList implements ContentList {
}
};
health = 430;
health = 360;
}};
ripple = new ArtilleryTurret("ripple") {{
ammoTypes = new AmmoType[]{AmmoTypes.artilleryCarbide, AmmoTypes.artilleryHoming, AmmoTypes.artilleryIncindiary, AmmoTypes.artilleryPlastic, AmmoTypes.artilleryThorium};
ammoTypes = new AmmoType[]{AmmoTypes.artilleryCarbide, 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 = 300f;
health = 550;
}};
@ -168,7 +188,7 @@ public class TurretBlocks extends BlockList implements ContentList {
}};
spectre = new ItemTurret("spectre") {{
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletThermite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletPyratite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
reload = 25f;
restitution = 0.03f;
ammoUseEffect = ShootFx.shellEjectSmall;

View File

@ -4,15 +4,16 @@ import io.anuke.mindustry.content.fx.BulletFx;
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.type.ContentList;
public class ArtilleryBullets extends BulletList implements ContentList{
public static BulletType carbide, thorium, plastic, homing, incindiary, surge;
public static BulletType carbide, plastic, plasticFrag, homing, incindiary, explosive, surge;
@Override
public void load() {
carbide = new ArtilleryBulletType(3f, 4, "shell") {
carbide = new ArtilleryBulletType(3f, 0, "shell") {
{
hiteffect = BulletFx.flakExplosion;
knockback = 0.8f;
@ -24,58 +25,81 @@ public class ArtilleryBullets extends BulletList implements ContentList{
}
};
thorium = new BasicBulletType(3f, 0, "shell") {
plasticFrag = new BasicBulletType(2.5f, 6, "bullet") {
{
hiteffect = BulletFx.flakExplosion;
knockback = 0.8f;
lifetime = 90f;
drag = 0.01f;
bulletWidth = bulletHeight = 9f;
bulletShrink = 0.1f;
bulletWidth = 10f;
bulletHeight = 12f;
bulletShrink = 1f;
lifetime = 15f;
backColor = Palette.plastaniumBack;
frontColor = Palette.plastaniumFront;
}
};
plastic = new BasicBulletType(3f, 0, "shell") {
plastic = new ArtilleryBulletType(3.3f, 0, "shell") {
{
hiteffect = BulletFx.flakExplosion;
knockback = 0.8f;
lifetime = 90f;
drag = 0.01f;
bulletWidth = bulletHeight = 9f;
bulletShrink = 0.1f;
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 BasicBulletType(3f, 0, "shell") {
homing = new ArtilleryBulletType(3f, 0, "shell") {
{
hiteffect = BulletFx.flakExplosion;
knockback = 0.8f;
lifetime = 90f;
drag = 0.01f;
bulletWidth = bulletHeight = 9f;
bulletShrink = 0.1f;
lifetime = 45f;
bulletWidth = bulletHeight = 11f;
collidesTiles = false;
splashDamageRadius = 25f;
splashDamage = 33f;
homingPower = 2f;
homingRange = 50f;
}
};
incindiary = new BasicBulletType(3f, 0, "shell") {
incindiary = new ArtilleryBulletType(3f, 0, "shell") {
{
hiteffect = BulletFx.flakExplosion;
hiteffect = BulletFx.blastExplosion;
knockback = 0.8f;
lifetime = 90f;
drag = 0.01f;
bulletWidth = bulletHeight = 9f;
bulletShrink = 0.1f;
lifetime = 60f;
bulletWidth = bulletHeight = 13f;
collidesTiles = false;
splashDamageRadius = 25f;
splashDamage = 30f;
incendAmount = 4;
incendSpread = 11f;
frontColor = Palette.lightishOrange;
backColor = Palette.lightOrange;
trailEffect = BulletFx.incendTrail;
}
};
surge = new BasicBulletType(3f, 0, "shell") {
explosive = new ArtilleryBulletType(2f, 0, "shell") {
{
hiteffect = BulletFx.flakExplosion;
hiteffect = BulletFx.blastExplosion;
knockback = 0.8f;
lifetime = 90f;
drag = 0.01f;
bulletWidth = bulletHeight = 9f;
bulletShrink = 0.1f;
lifetime = 70f;
bulletWidth = bulletHeight = 14f;
collidesTiles = false;
splashDamageRadius = 45f;
splashDamage = 50f;
backColor = Palette.missileYellowBack;
frontColor = Palette.missileYellow;
}
};
surge = new ArtilleryBulletType(3f, 0, "shell") {
{
//TODO
}
};
}

View File

@ -1,7 +1,9 @@
package io.anuke.mindustry.content.bullets;
import io.anuke.mindustry.entities.bullet.BasicBulletType;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.bullet.MissileBulletType;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.type.ContentList;
public class MissileBullets extends BulletList implements ContentList {
@ -10,21 +12,39 @@ public class MissileBullets extends BulletList implements ContentList {
@Override
public void load() {
explosive = new BasicBulletType(3f, 5, "bullet") {
explosive = new MissileBulletType(1.8f, 10, "missile") {
{
bulletWidth = 7f;
bulletHeight = 9f;
bulletWidth = 8f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.01f;
splashDamageRadius = 30f;
splashDamage = 30f;
lifetime = 150f;
hiteffect = BulletFx.blastExplosion;
despawneffect = BulletFx.blastExplosion;
}
};
incindiary = new BasicBulletType(3f, 5, "bullet") {
incindiary = new MissileBulletType(2f, 12, "missile") {
{
frontColor = Palette.lightishOrange;
backColor = Palette.lightOrange;
bulletWidth = 7f;
bulletHeight = 9f;
bulletHeight = 8f;
bulletShrink = 0f;
drag = -0.01f;
homingPower = 7f;
splashDamageRadius = 10f;
splashDamage = 10f;
lifetime = 160f;
hiteffect = BulletFx.blastExplosion;
incendSpread = 10f;
incendAmount = 3;
}
};
surge = new BasicBulletType(3f, 5, "bullet") {
surge = new MissileBulletType(3f, 5, "bullet") {
{
bulletWidth = 7f;
bulletHeight = 9f;

View File

@ -1,13 +1,9 @@
package io.anuke.mindustry.content.bullets;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.bullet.BasicBulletType;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.type.ContentList;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Angles;
public class StandardBullets extends BulletList implements ContentList {
public static BulletType tungsten, lead, carbide, thorium, homing, tracer;
@ -46,25 +42,22 @@ public class StandardBullets extends BulletList implements ContentList {
};
homing = new BasicBulletType(3f, 9, "bullet") {
float homingPower = 5f;
{
bulletWidth = 7f;
bulletHeight = 9f;
}
@Override
public void update(Bullet b) {
Unit target = Units.getClosestEnemy(b.getTeam(), b.x, b.y, 40f, unit -> true);
if(target != null){
b.getVelocity().setAngle(Angles.moveToward(b.getVelocity().angle(), b.angleTo(target), homingPower * Timers.delta()));
}
homingPower = 5f;
}
};
tracer = new BasicBulletType(3f, 5, "bullet") {
tracer = new BasicBulletType(3.2f, 11, "bullet") {
{
bulletWidth = 7f;
bulletHeight = 9f;
bulletWidth = 10f;
bulletHeight = 12f;
frontColor = Palette.lightishOrange;
backColor = Palette.lightOrange;
incendSpread = 3f;
incendAmount = 1;
incendChance = 0.3f;
}
};
}

View File

@ -11,7 +11,8 @@ import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
public class BulletFx extends FxList implements ContentList {
public static Effect hitBulletSmall, hitBulletBig, hitFlameSmall, hitLiquid, hitLancer, despawn, flakExplosion, artilleryTrail;
public static Effect hitBulletSmall, hitBulletBig, hitFlameSmall, hitLiquid, hitLancer, despawn, flakExplosion, blastExplosion, plasticExplosion,
artilleryTrail, incendTrail, missileTrail;
@Override
public void load() {
@ -110,8 +111,68 @@ public class BulletFx extends FxList implements ContentList {
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.atan2(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.atan2(x, y), 1f + e.fout() * 3f);
});
Draw.reset();
});
artilleryTrail = new Effect(50, e -> {
Draw.color(Palette.bulletYellowBack);
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(Palette.missileYellowBack);
Fill.circle(e.x, e.y, e.rotation * e.fout());
Draw.reset();
});

View File

@ -3,7 +3,6 @@ package io.anuke.mindustry.core;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Base64Coder;
import com.badlogic.gdx.utils.IntSet;
import com.badlogic.gdx.utils.Pools;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.annotations.Annotations.Variant;
import io.anuke.mindustry.core.GameState.State;
@ -26,6 +25,7 @@ import io.anuke.ucore.io.delta.DEZDecoder;
import io.anuke.ucore.modules.Module;
import io.anuke.ucore.util.Log;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Pooling;
import io.anuke.ucore.util.Timer;
import java.io.DataInputStream;
@ -199,7 +199,7 @@ public class NetClient extends Module {
if(timer.get(0, playerSyncTime)){
ClientSnapshotPacket packet = Pools.obtain(ClientSnapshotPacket.class);
ClientSnapshotPacket packet = Pooling.obtain(ClientSnapshotPacket.class);
packet.lastSnapshot = lastSnapshotBaseID;
packet.snapid = lastSent++;
Net.send(packet, SendMode.udp);

View File

@ -7,7 +7,6 @@ import com.badlogic.gdx.graphics.Texture.TextureWrap;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.ObjectIntMap;
import com.badlogic.gdx.utils.Pools;
import com.badlogic.gdx.utils.TimeUtils;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.core.GameState.State;
@ -40,6 +39,7 @@ import io.anuke.ucore.graphics.Surface;
import io.anuke.ucore.modules.RendererModule;
import io.anuke.ucore.scene.utils.Cursors;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Pooling;
import io.anuke.ucore.util.Translator;
import static io.anuke.mindustry.Vars.*;
@ -79,7 +79,7 @@ public class Renderer extends RendererModule{
if(view.overlaps(pos)){
if(!(effect instanceof GroundEffect)) {
EffectEntity entity = Pools.obtain(EffectEntity.class);
EffectEntity entity = Pooling.obtain(EffectEntity.class);
entity.effect = effect;
entity.color = color;
entity.rotation = rotation;
@ -91,7 +91,7 @@ public class Renderer extends RendererModule{
}
threads.runGraphics(() -> effectGroup.add(entity));
}else{
GroundEffectEntity entity = Pools.obtain(GroundEffectEntity.class);
GroundEffectEntity entity = Pooling.obtain(GroundEffectEntity.class);
entity.effect = effect;
entity.color = color;
entity.rotation = rotation;

View File

@ -6,6 +6,7 @@ import com.badlogic.gdx.math.Vector2;
import io.anuke.mindustry.content.bullets.TurretBullets;
import io.anuke.mindustry.content.fx.ExplosionFx;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.entities.effect.Fire;
import io.anuke.mindustry.entities.effect.Lightning;
import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.gen.CallEntity;
@ -64,6 +65,17 @@ public class Damage {
Effects.effect(ExplosionFx.blockExplosion, x, y);
}
public static void createIncend(float x, float y, float range, int amount){
for (int i = 0; i < amount; i++) {
float cx = x + Mathf.range(range);
float cy = y + Mathf.range(range);
Tile tile = world.tileWorld(cx, cy);
if(tile != null){
Fire.create(tile);
}
}
}
/**Damages entities in a line.
* Only enemies of the specified team are damaged.*/
public static void collideLine(SolidEntity hitter, Team team, Effect effect, float x, float y, float angle, float length){

View File

@ -1,11 +1,11 @@
package io.anuke.mindustry.entities;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Pools;
import io.anuke.mindustry.content.StatusEffects;
import io.anuke.mindustry.entities.traits.Saveable;
import io.anuke.mindustry.type.StatusEffect;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Pooling;
import java.io.DataInput;
import java.io.DataOutput;
@ -50,7 +50,7 @@ public class StatusController implements Saveable{
}
//otherwise, no opposites found, add direct effect
StatusEntry entry = Pools.obtain(StatusEntry.class);
StatusEntry entry = Pooling.obtain(StatusEntry.class);
entry.set(effect, newTime);
statuses.add(entry);
}
@ -70,7 +70,7 @@ public class StatusController implements Saveable{
entry.time = Math.max(entry.time - Timers.delta(), 0);
if(entry.time <= 0){
Pools.free(entry);
Pooling.free(entry);
removals.add(entry);
}else{
speedMultiplier *= entry.effect.speedMultiplier;
@ -116,7 +116,7 @@ public class StatusController implements Saveable{
@Override
public void readSave(DataInput stream) throws IOException {
for (StatusEntry effect : statuses){
Pools.free(effect);
Pooling.free(effect);
}
statuses.clear();
@ -125,7 +125,7 @@ public class StatusController implements Saveable{
for (int i = 0; i < amount; i++) {
byte id = stream.readByte();
float time = stream.readShort() / 2f;
StatusEntry entry = Pools.obtain(StatusEntry.class);
StatusEntry entry = Pooling.obtain(StatusEntry.class);
entry.set(StatusEffect.getByID(id), time);
statuses.add(entry);
}

View File

@ -2,21 +2,26 @@ package io.anuke.mindustry.entities.bullet;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.graphics.Draw;
//TODO scale velocity depending on fslope()
public class ArtilleryBulletType extends BasicBulletType {
protected Effect trailEffect = BulletFx.artilleryTrail;
public ArtilleryBulletType(float speed, float damage, String bulletSprite) {
super(speed, damage, bulletSprite);
collidesTiles = false;
collides = false;
hitShake = 1f;
}
@Override
public void update(Bullet b) {
super.update(b);
if(b.timer.get(0, 3 + b.fslope()*2f)){
Effects.effect(BulletFx.artilleryTrail, b.x, b.y, b.fslope() * 4f);
Effects.effect(trailEffect, backColor, b.x, b.y, b.fslope() * 4f);
}
}

View File

@ -3,7 +3,11 @@ package io.anuke.mindustry.entities.bullet;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.entities.Damage;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
@ -23,9 +27,18 @@ public class BasicBulletType extends BulletType {
public float splashDamageRadius = -1f;
public float splashDamage = 6f;
public int incendAmount = 0;
public float incendSpread = 8f;
public float incendChance = 1f;
public float homingPower = 0f;
public float homingRange = 40f;
public TextureRegion backRegion;
public TextureRegion frontRegion;
public float hitShake = 0f;
public BasicBulletType(float speed, float damage, String bulletSprite) {
super(speed, damage);
this.bulletSprite = bulletSprite;
@ -48,10 +61,24 @@ public class BasicBulletType extends BulletType {
Draw.color();
}
@Override
public void update(Bullet b) {
super.update(b);
if(homingPower > 0.0001f){
Unit target = Units.getClosestEnemy(b.getTeam(), b.x, b.y, homingRange, unit -> true);
if(target != null){
b.getVelocity().setAngle(Angles.moveToward(b.getVelocity().angle(), b.angleTo(target), homingPower * Timers.delta()));
}
}
}
@Override
public void hit(Bullet b, float x, float y) {
super.hit(b, x, y);
Effects.shake(hitShake, hitShake, b);
if(fragBullet != null) {
for (int i = 0; i < fragBullets; i++) {
float len = Mathf.random(1f, 7f);
@ -60,8 +87,12 @@ public class BasicBulletType extends BulletType {
}
}
if(Mathf.chance(incendChance)) {
Damage.createIncend(x, y, incendSpread, incendAmount);
}
if(splashDamageRadius > 0){
Damage.damage(x, y, splashDamageRadius, splashDamage);
Damage.damage(b.getTeam(), x, y, splashDamageRadius, splashDamage);
}
}

View File

@ -1,7 +1,6 @@
package io.anuke.mindustry.entities.bullet;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Pools;
import com.badlogic.gdx.utils.TimeUtils;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
@ -17,6 +16,7 @@ import io.anuke.ucore.entities.impl.BulletEntity;
import io.anuke.ucore.entities.trait.Entity;
import io.anuke.ucore.entities.trait.SolidTrait;
import io.anuke.ucore.entities.trait.VelocityTrait;
import io.anuke.ucore.util.Pooling;
import io.anuke.ucore.util.Timer;
import java.io.DataInput;
@ -48,7 +48,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
}
public static void create (BulletType type, Entity owner, Team team, float x, float y, float angle, float velocityScl, Object data){
Bullet bullet = Pools.obtain(Bullet.class);
Bullet bullet = Pooling.obtain(Bullet.class);
bullet.type = type;
bullet.owner = owner;
bullet.data = data;
@ -214,7 +214,7 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
@Override
public void removed() {
Pools.free(this);
Pooling.free(this);
}
@Override

View File

@ -0,0 +1,24 @@
package io.anuke.mindustry.entities.bullet;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.ucore.core.Effects;
public class MissileBulletType extends BasicBulletType {
public MissileBulletType(float speed, float damage, String bulletSprite) {
super(speed, damage, bulletSprite);
backColor = Palette.missileYellowBack;
frontColor = Palette.missileYellow;
homingPower = 6f;
}
@Override
public void update(Bullet b) {
super.update(b);
if(b.timer.get(0, 4f)){
Effects.effect(BulletFx.missileTrail, b.x, b.y, 2f);
}
}
}

View File

@ -3,7 +3,6 @@ package io.anuke.mindustry.entities.effect;
import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.utils.IntMap;
import com.badlogic.gdx.utils.Pool.Poolable;
import com.badlogic.gdx.utils.Pools;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.content.StatusEffects;
@ -24,6 +23,7 @@ import io.anuke.ucore.entities.EntityGroup;
import io.anuke.ucore.entities.impl.TimedEntity;
import io.anuke.ucore.util.Geometry;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Pooling;
import java.io.DataInput;
import java.io.DataOutput;
@ -48,7 +48,7 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable
Fire fire = map.get(tile.packedPosition());
if(fire == null){
fire = Pools.obtain(Fire.class);
fire = Pooling.obtain(Fire.class);
fire.tile = tile;
fire.lifetime = baseLifetime;
fire.set(tile.worldx(), tile.worldy());

View File

@ -3,7 +3,6 @@ package io.anuke.mindustry.entities.effect;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Pool.Poolable;
import com.badlogic.gdx.utils.Pools;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.content.fx.UnitFx;
@ -29,6 +28,7 @@ import io.anuke.ucore.entities.trait.TimeTrait;
import io.anuke.ucore.entities.trait.VelocityTrait;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Pooling;
import java.io.DataInput;
import java.io.DataOutput;
@ -48,7 +48,7 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT
private float sinktime;
public static ItemDrop create(Item item, int amount, float x, float y, float angle){
ItemDrop drop = Pools.obtain(ItemDrop.class);
ItemDrop drop = Pooling.obtain(ItemDrop.class);
drop.item = item;
drop.amount = amount;
drop.velocity.set(4f, 0f).rotate(angle);
@ -190,7 +190,7 @@ public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawT
@Override
public void removed() {
Pools.free(this);
Pooling.free(this);
}
@Override

View File

@ -2,7 +2,6 @@ package io.anuke.mindustry.entities.effect;
import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Pools;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.entities.Unit;
@ -19,6 +18,7 @@ import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Fill;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Pooling;
import static io.anuke.mindustry.Vars.effectGroup;
import static io.anuke.mindustry.Vars.threads;
@ -61,7 +61,7 @@ public class ItemTransfer extends TimedEntity implements DrawTrait{
}
public static void create(Item item, float fromx, float fromy, PosTrait to, Runnable done){
ItemTransfer tr = Pools.obtain(ItemTransfer.class);
ItemTransfer tr = Pooling.obtain(ItemTransfer.class);
tr.item = item;
tr.from.set(fromx, fromy);
tr.to = to;
@ -93,7 +93,7 @@ public class ItemTransfer extends TimedEntity implements DrawTrait{
if(done != null){
threads.run(done);
}
Pools.free(this);
Pooling.free(this);
}
@Override

View File

@ -5,7 +5,6 @@ import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Pool.Poolable;
import com.badlogic.gdx.utils.Pools;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.content.StatusEffects;
@ -24,6 +23,7 @@ import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Pooling;
import io.anuke.ucore.util.SeedRandom;
import static io.anuke.mindustry.Vars.bulletGroup;
@ -48,7 +48,7 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait{
@Remote(called = Loc.server, in = In.entities)
public static void createLighting(int seed, Team team, Effect effect, Color color, float damage, float x, float y, float targetAngle, int length){
Lightning l = Pools.obtain(Lightning.class);
Lightning l = Pooling.obtain(Lightning.class);
l.x = x;
l.y = y;
@ -126,7 +126,7 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait{
@Override
public void removed() {
Pools.free(this);
Pooling.free(this);
}
@Override

View File

@ -5,7 +5,6 @@ import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.utils.IntMap;
import com.badlogic.gdx.utils.Pool.Poolable;
import com.badlogic.gdx.utils.Pools;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.content.Liquids;
@ -32,6 +31,7 @@ import io.anuke.ucore.graphics.Hue;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Geometry;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Pooling;
import java.io.DataInput;
import java.io.DataOutput;
@ -89,7 +89,7 @@ public class Puddle extends BaseEntity implements SaveTrait, Poolable, DrawTrait
if(p == null){
if(Net.client()) return; //not clientside.
Puddle puddle = Pools.obtain(Puddle.class);
Puddle puddle = Pooling.obtain(Puddle.class);
puddle.tile = tile;
puddle.liquid = liquid;
puddle.amount = amount;

View File

@ -6,6 +6,12 @@ public class Palette {
public static final Color bulletYellow = Color.valueOf("ffeec9");
public static final Color bulletYellowBack = Color.valueOf("f9c87a");
public static final Color missileYellow = Color.valueOf("ffd2ae");
public static final Color missileYellowBack = Color.valueOf("e58956");
public static final Color plastaniumBack = Color.valueOf("d8d97f");
public static final Color plastaniumFront = Color.valueOf("fffac6");
public static final Color lightFlame = Color.valueOf("ffdd55");
public static final Color darkFlame = Color.valueOf("db401c");

View File

@ -8,22 +8,23 @@ import com.badlogic.gdx.net.HttpRequestBuilder;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.IntMap;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.Pools;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import io.anuke.mindustry.core.Platform;
import io.anuke.mindustry.net.Packet.ImportantPacket;
import io.anuke.mindustry.net.Packet.UnimportantPacket;
import io.anuke.mindustry.net.Packets.StreamBegin;
import io.anuke.mindustry.net.Streamable.StreamBuilder;
import io.anuke.mindustry.net.Packets.StreamChunk;
import io.anuke.mindustry.net.Streamable.StreamBuilder;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.function.BiConsumer;
import io.anuke.ucore.function.Consumer;
import io.anuke.ucore.util.Log;
import io.anuke.ucore.util.Pooling;
import java.io.IOException;
import static io.anuke.mindustry.Vars.*;
import static io.anuke.mindustry.Vars.headless;
import static io.anuke.mindustry.Vars.ui;
public class Net{
public static final Object packetPoolLock = new Object();
@ -186,14 +187,14 @@ public class Net{
if(clientListeners.get(object.getClass()) != null) clientListeners.get(object.getClass()).accept(object);
if(listeners.get(object.getClass()) != null) listeners.get(object.getClass()).accept(object);
synchronized (packetPoolLock) {
Pools.free(object);
Pooling.free(object);
}
}else if(!(object instanceof UnimportantPacket)){
packetQueue.add(object);
Log.info("Queuing packet {0}.", ClassReflection.getSimpleName(object.getClass()));
}else{
synchronized (packetPoolLock) {
Pools.free(object);
Pooling.free(object);
}
}
}else{
@ -208,7 +209,7 @@ public class Net{
if(serverListeners.get(object.getClass()) != null) serverListeners.get(object.getClass()).accept(connection, object);
if(listeners.get(object.getClass()) != null) listeners.get(object.getClass()).accept(object);
synchronized (packetPoolLock) {
Pools.free(object);
Pooling.free(object);
}
}else{
Log.err("Unhandled packet type: '{0}'!", ClassReflection.getSimpleName(object.getClass()));

View File

@ -116,7 +116,9 @@ public class BuildBlock extends Block {
public void drawShadow(Tile tile) {
BuildEntity entity = tile.entity();
entity.recipe.result.drawShadow(tile);
if(entity.recipe != null && entity.recipe.result != null){
entity.recipe.result.drawShadow(tile);
}
}
@Override

View File

@ -10,6 +10,8 @@ import io.anuke.ucore.scene.ui.ButtonGroup;
import io.anuke.ucore.scene.ui.ImageButton;
import io.anuke.ucore.scene.ui.layout.Table;
import static io.anuke.mindustry.Vars.control;
public interface SelectionTrait {
default void buildItemTable(Table table, Supplier<Item> holder, Consumer<Item> consumer){
@ -19,7 +21,10 @@ public interface SelectionTrait {
ButtonGroup<ImageButton> group = new ButtonGroup<>();
Table cont = new Table();
for(int i = 0; i < items.size; i ++){
int i = 0;
for(Item item : items){
if(!control.database().isUnlocked(item)) continue;
final int f = i;
ImageButton button = cont.addImageButton("white", "toggle", 24, () -> consumer.accept(items.get(f)))
@ -27,7 +32,7 @@ public interface SelectionTrait {
button.getStyle().imageUp = new TextureRegionDrawable(new TextureRegion(items.get(i).region));
button.setChecked(holder.get().id == f);
if(i%4 == 3){
if(i++%4 == 3){
cont.row();
}
}

View File

@ -11,9 +11,11 @@ import static io.anuke.mindustry.Vars.tilesize;
/**Artillery turrets have special shooting calculations done to hit targets.*/
public class ArtilleryTurret extends ItemTurret {
protected float velocityInaccuracy = 0f;
public ArtilleryTurret(String name) {
super(name);
targetAir = false;
}
@Override
@ -32,8 +34,10 @@ public class ArtilleryTurret extends ItemTurret {
float dst = entity.distanceTo(predict.x, predict.y);
float maxTraveled = type.bullet.lifetime * type.bullet.speed;
Bullet.create(ammo.bullet, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y,
entity.rotation + Mathf.range(inaccuracy + type.inaccuracy), dst/maxTraveled);
for (int i = 0; i < shots; i++) {
Bullet.create(ammo.bullet, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y,
entity.rotation + Mathf.range(inaccuracy + type.inaccuracy), dst/maxTraveled + Mathf.range(velocityInaccuracy));
}
effects(tile);
useAmmo(tile);

View File

@ -9,6 +9,7 @@ import static io.anuke.mindustry.Vars.tilesize;
public class BurstTurret extends ItemTurret {
protected float burstSpacing = 5;
protected float xRand = 0f;
public BurstTurret(String name) {
super(name);
@ -27,7 +28,7 @@ public class BurstTurret extends ItemTurret {
entity.recoil = recoil;
tr.trns(entity.rotation, size * tilesize / 2);
tr.trns(entity.rotation, size * tilesize / 2, Mathf.range(xRand));
useAmmo(tile);
bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy));
effects(tile);

View File

@ -4,6 +4,8 @@ import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.entities.effect.Fire;
import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.meta.BlockStat;
import io.anuke.mindustry.world.meta.values.LiquidFilterValue;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.core.Timers;
@ -24,6 +26,13 @@ public class CooledTurret extends Turret {
liquidCapacity = 20f;
}
@Override
public void setStats() {
super.setStats();
stats.add(BlockStat.inputLiquidAux, new LiquidFilterValue(liquid -> liquid.temperature <= 0.5f && liquid.flammability < 0.2f));
}
@Override
protected void updateShooting(Tile tile) {
super.updateShooting(tile);

View File

@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.defense.turrets;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.entities.Predict;
@ -56,6 +57,7 @@ public abstract class Turret extends Block{
protected float rotatespeed = 5f; //in degrees per tick
protected float shootCone = 8f;
protected float shootShake = 0f;
protected boolean targetAir = true;
protected Translator tr = new Translator();
protected Translator tr2 = new Translator();
@ -177,16 +179,20 @@ public abstract class Turret extends Block{
if(entity.timer.get(timerTarget, targetInterval)){
entity.target = Units.getClosestEnemy(tile.getTeam(),
tile.drawx(), tile.drawy(), range, e -> !e.isDead());
tile.drawx(), tile.drawy(), range, e -> !e.isDead() && (!e.isFlying() || targetAir));
}
if(entity.target != null){
AmmoType type = peekAmmo(tile);
float speed = type.bullet.speed;
if(speed < 0.1f) speed = 9999999f;
Vector2 result = Predict.intercept(entity, entity.target, speed);
if(result.isZero()){
result.set(entity.target.getX(), entity.target.getY());
}
float targetRot = Predict.intercept(entity, entity.target, speed)
.sub(tile.drawx(), tile.drawy()).angle();
float targetRot = result.sub(tile.drawx(), tile.drawy()).angle();
if(Float.isNaN(entity.rotation)){
entity.rotation = 0;

View File

@ -2,7 +2,6 @@ package io.anuke.mindustry.world.blocks.distribution;
import com.badlogic.gdx.utils.ObjectSet;
import com.badlogic.gdx.utils.Pool.Poolable;
import com.badlogic.gdx.utils.Pools;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.content.bullets.TurretBullets;
@ -26,6 +25,7 @@ import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Lines;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Pooling;
import java.io.DataInputStream;
import java.io.DataOutputStream;
@ -186,7 +186,7 @@ public class MassDriver extends Block {
entity.reload = 1f;
DriverBulletData data = Pools.obtain(DriverBulletData.class);
DriverBulletData data = Pooling.obtain(DriverBulletData.class);
data.from = entity;
data.to = other;
System.arraycopy(entity.items.items, 0, data.items, 0, data.items.length);

View File

@ -18,12 +18,12 @@ public class LiquidFilterValue implements StatValue {
Array<Liquid> list = new Array<>();
for(Liquid item : Liquid.all()){
if(filter.test(item)) list.add(item);
if(!item.isHidden() && filter.test(item)) list.add(item);
}
for (int i = 0; i < list.size; i++) {
Liquid item = list.get(i);
table.addImage("liquid-icon").color(item.color).size(8*3).padRight(2).padLeft(2);
table.addImage("liquid-icon").color(item.color).size(8*3).padRight(2).padLeft(2).padTop(2).padBottom(2);
if(i != list.size - 1){
table.add("/");
}

View File

@ -1,11 +1,11 @@
package io.anuke.kryonet;
import com.badlogic.gdx.utils.Pools;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.esotericsoftware.kryonet.FrameworkMessage;
import com.esotericsoftware.kryonet.serialization.Serialization;
import io.anuke.mindustry.net.Packet;
import io.anuke.mindustry.net.Registrator;
import io.anuke.ucore.util.Pooling;
import java.nio.ByteBuffer;
@ -27,7 +27,7 @@ public class ByteSerializer implements Serialization {
byteBuffer.put(id);
((Packet) o).write(byteBuffer);
synchronized (packetPoolLock) {
Pools.free(o);
Pooling.free(o);
}
}
}
@ -40,7 +40,7 @@ public class ByteSerializer implements Serialization {
}else{
Class<?> type = Registrator.getByID(id);
synchronized (packetPoolLock) {
Packet packet = (Packet) Pools.obtain(type);
Packet packet = (Packet) Pooling.obtain(type);
packet.read(byteBuffer);
return packet;
}