Surge uses / Fixes, optimizations / Turret implementation base

This commit is contained in:
Anuken
2018-08-27 23:50:23 -04:00
parent 9b57550f3d
commit 802e7b12d0
42 changed files with 875 additions and 720 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 B

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 B

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 B

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 416 B

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 523 B

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 140 KiB

@@ -53,7 +53,7 @@ public class Pathfinder{
public Tile getTargetTile(Team team, Tile tile){ public Tile getTargetTile(Team team, Tile tile){
float[][] values = paths[team.ordinal()].weights; float[][] values = paths[team.ordinal()].weights;
if(values == null) return tile; if(values == null || tile == null) return tile;
float value = values[tile.x][tile.y]; float value = values[tile.x][tile.y];
@@ -13,7 +13,8 @@ public class AmmoTypes implements ContentList{
public static AmmoType bulletCopper, bulletDense, bulletThorium, bulletSilicon, bulletPyratite, public static AmmoType bulletCopper, bulletDense, bulletThorium, bulletSilicon, bulletPyratite,
shotgunTungsten, bombExplosive, bombIncendiary, bombOil, shellCarbide, flamerThermite, weaponMissile, weaponMissileSwarm, bulletMech, shotgunTungsten, bombExplosive, bombIncendiary, bombOil, shellCarbide, flamerThermite, weaponMissile, weaponMissileSwarm, bulletMech,
healBlaster, bulletGlaive, healBlaster, bulletGlaive,
flakLead, flakExplosive, flakPlastic, flakSurge, missileExplosive, missileIncindiary, missileSurge, flakExplosive, flakPlastic, flakSurge,
missileExplosive, missileIncindiary, missileSurge,
artilleryDense, artilleryPlastic, artilleryHoming, artilleryIncindiary, artilleryExplosive, artilleryDense, artilleryPlastic, artilleryHoming, artilleryIncindiary, artilleryExplosive,
basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid; basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid;
@@ -29,7 +30,6 @@ public class AmmoTypes implements ContentList{
inaccuracy = 5f; inaccuracy = 5f;
}}; }};
bulletGlaive = new AmmoType(Items.pyratite, StandardBullets.glaive, 3){{ bulletGlaive = new AmmoType(Items.pyratite, StandardBullets.glaive, 3){{
shootEffect = ShootFx.shootSmall; shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke; smokeEffect = ShootFx.shootSmallSmoke;
@@ -118,24 +118,19 @@ public class AmmoTypes implements ContentList{
//flak //flak
flakLead = new AmmoType(Items.lead, FlakBullets.lead, 5){{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
}};
flakExplosive = new AmmoType(Items.blastCompound, FlakBullets.explosive, 5){{ flakExplosive = new AmmoType(Items.blastCompound, FlakBullets.explosive, 5){{
shootEffect = ShootFx.shootSmall; shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootSmallSmoke; smokeEffect = ShootFx.shootBigSmoke;
}}; }};
flakPlastic = new AmmoType(Items.plastanium, FlakBullets.plastic, 5){{ flakPlastic = new AmmoType(Items.plastanium, FlakBullets.plastic, 5){{
shootEffect = ShootFx.shootSmall; shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootSmallSmoke; smokeEffect = ShootFx.shootBigSmoke;
}}; }};
flakSurge = new AmmoType(Items.surgealloy, FlakBullets.surge, 5){{ flakSurge = new AmmoType(Items.surgealloy, FlakBullets.surge, 5){{
shootEffect = ShootFx.shootSmall; shootEffect = ShootFx.shootBig;
smokeEffect = ShootFx.shootSmallSmoke; smokeEffect = ShootFx.shootBigSmoke;
}}; }};
//missiles //missiles
@@ -22,14 +22,18 @@ public class Recipes implements ContentList{
new Recipe(defense, DefenseBlocks.compositeWall, new ItemStack(Items.densealloy, 12)); new Recipe(defense, DefenseBlocks.compositeWall, new ItemStack(Items.densealloy, 12));
new Recipe(defense, DefenseBlocks.compositeWallLarge, new ItemStack(Items.densealloy, 12 * 4)); new Recipe(defense, DefenseBlocks.compositeWallLarge, new ItemStack(Items.densealloy, 12 * 4));
new Recipe(defense, DefenseBlocks.door, new ItemStack(Items.densealloy, 12), new ItemStack(Items.silicon, 8));
new Recipe(defense, DefenseBlocks.doorLarge, new ItemStack(Items.densealloy, 12 * 4), new ItemStack(Items.silicon, 8 * 4));
new Recipe(defense, DefenseBlocks.thoriumWall, new ItemStack(Items.thorium, 12)); new Recipe(defense, DefenseBlocks.thoriumWall, new ItemStack(Items.thorium, 12));
new Recipe(defense, DefenseBlocks.thoriumWallLarge, new ItemStack(Items.thorium, 12 * 4)); new Recipe(defense, DefenseBlocks.thoriumWallLarge, new ItemStack(Items.thorium, 12 * 4));
new Recipe(defense, DefenseBlocks.phaseWall, new ItemStack(Items.phasematter, 12)); new Recipe(defense, DefenseBlocks.phaseWall, new ItemStack(Items.phasematter, 12));
new Recipe(defense, DefenseBlocks.phaseWallLarge, new ItemStack(Items.phasematter, 12 * 4)); new Recipe(defense, DefenseBlocks.phaseWallLarge, new ItemStack(Items.phasematter, 12 * 4));
new Recipe(defense, DefenseBlocks.door, new ItemStack(Items.densealloy, 12), new ItemStack(Items.silicon, 8)); new Recipe(defense, DefenseBlocks.surgeWall, new ItemStack(Items.surgealloy, 12));
new Recipe(defense, DefenseBlocks.doorLarge, new ItemStack(Items.densealloy, 12 * 4), new ItemStack(Items.silicon, 8 * 4)); new Recipe(defense, DefenseBlocks.surgeWallLarge, new ItemStack(Items.surgealloy, 12 * 4));
//projectors //projectors
new Recipe(defense, DefenseBlocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250)); new Recipe(defense, DefenseBlocks.mendProjector, new ItemStack(Items.lead, 200), new ItemStack(Items.densealloy, 150), new ItemStack(Items.titanium, 150), new ItemStack(Items.silicon, 250));
@@ -38,12 +42,13 @@ public class Recipes implements ContentList{
new Recipe(weapon, TurretBlocks.duo, new ItemStack(Items.copper, 40)); new Recipe(weapon, TurretBlocks.duo, new ItemStack(Items.copper, 40));
new Recipe(weapon, TurretBlocks.scorch, new ItemStack(Items.copper, 50), new ItemStack(Items.densealloy, 20)); new Recipe(weapon, TurretBlocks.scorch, new ItemStack(Items.copper, 50), new ItemStack(Items.densealloy, 20));
new Recipe(weapon, TurretBlocks.hail, new ItemStack(Items.copper, 60), new ItemStack(Items.densealloy, 35)); new Recipe(weapon, TurretBlocks.hail, new ItemStack(Items.copper, 60), new ItemStack(Items.densealloy, 35));
new Recipe(weapon, TurretBlocks.lancer, new ItemStack(Items.copper, 50), new ItemStack(Items.lead, 100), new ItemStack(Items.silicon, 90)); new Recipe(weapon, TurretBlocks.lancer, new ItemStack(Items.copper, 50), new ItemStack(Items.lead, 100), new ItemStack(Items.silicon, 90));
new Recipe(weapon, TurretBlocks.wave, new ItemStack(Items.densealloy, 60), new ItemStack(Items.titanium, 70), new ItemStack(Items.lead, 150)); new Recipe(weapon, TurretBlocks.wave, new ItemStack(Items.densealloy, 60), new ItemStack(Items.titanium, 70), new ItemStack(Items.lead, 150));
new Recipe(weapon, TurretBlocks.swarmer, new ItemStack(Items.densealloy, 70), new ItemStack(Items.titanium, 70), new ItemStack(Items.plastanium, 90), new ItemStack(Items.silicon, 60));
new Recipe(weapon, TurretBlocks.salvo, new ItemStack(Items.copper, 210), new ItemStack(Items.densealloy, 190), new ItemStack(Items.thorium, 130)); new Recipe(weapon, TurretBlocks.salvo, new ItemStack(Items.copper, 210), new ItemStack(Items.densealloy, 190), new ItemStack(Items.thorium, 130));
new Recipe(weapon, TurretBlocks.swarmer, new ItemStack(Items.densealloy, 70), new ItemStack(Items.titanium, 70), new ItemStack(Items.plastanium, 90), new ItemStack(Items.silicon, 60));
new Recipe(weapon, TurretBlocks.ripple, new ItemStack(Items.copper, 300), new ItemStack(Items.densealloy, 220), new ItemStack(Items.thorium, 120)); new Recipe(weapon, TurretBlocks.ripple, new ItemStack(Items.copper, 300), new ItemStack(Items.densealloy, 220), new ItemStack(Items.thorium, 120));
new Recipe(weapon, TurretBlocks.cyclone, new ItemStack(Items.copper, 210), new ItemStack(Items.densealloy, 190), new ItemStack(Items.thorium, 130));
new Recipe(weapon, TurretBlocks.fuse, new ItemStack(Items.copper, 300), new ItemStack(Items.densealloy, 220), new ItemStack(Items.thorium, 120));
//DISTRIBUTION //DISTRIBUTION
new Recipe(distribution, DistributionBlocks.conveyor, new ItemStack(Items.copper, 1)); new Recipe(distribution, DistributionBlocks.conveyor, new ItemStack(Items.copper, 1));
@@ -4,14 +4,11 @@ import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.content.fx.BlockFx; import io.anuke.mindustry.content.fx.BlockFx;
import io.anuke.mindustry.type.ContentList; import io.anuke.mindustry.type.ContentList;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.Wall; import io.anuke.mindustry.world.blocks.defense.*;
import io.anuke.mindustry.world.blocks.defense.DeflectorWall;
import io.anuke.mindustry.world.blocks.defense.Door;
import io.anuke.mindustry.world.blocks.defense.MendProjector;
public class DefenseBlocks extends BlockList implements ContentList{ public class DefenseBlocks extends BlockList implements ContentList{
public static Block copperWall, copperWallLarge, compositeWall, compositeWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge, deflectorwall, deflectorwalllarge, public static Block copperWall, copperWallLarge, compositeWall, compositeWallLarge, thoriumWall, thoriumWallLarge, door, doorLarge, deflectorwall, deflectorwalllarge,
phaseWall, phaseWallLarge, mendProjector; phaseWall, phaseWallLarge, surgeWall, surgeWallLarge, mendProjector;
@Override @Override
public void load(){ public void load(){
@@ -62,6 +59,15 @@ public class DefenseBlocks extends BlockList implements ContentList{
size = 2; 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"){{ door = new Door("door"){{
health = 100 * wallHealthMultiplier; health = 100 * wallHealthMultiplier;
}}; }};
@@ -1,6 +1,7 @@
package io.anuke.mindustry.content.blocks; package io.anuke.mindustry.content.blocks;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.content.AmmoTypes; import io.anuke.mindustry.content.AmmoTypes;
import io.anuke.mindustry.content.fx.ShootFx; import io.anuke.mindustry.content.fx.ShootFx;
import io.anuke.mindustry.type.AmmoType; import io.anuke.mindustry.type.AmmoType;
@@ -51,7 +52,16 @@ public class TurretBlocks extends BlockList implements ContentList{
health = 120; health = 120;
}}; }};
scorch = new LiquidTurret("scorch"){{ scorch = new LiquidTurret("scorch"){
protected TextureRegion shootRegion;
@Override
public void load(){
super.load();
shootRegion = Draw.region(name + "-shoot");
}
{
ammoTypes = new AmmoType[]{AmmoTypes.basicFlame}; ammoTypes = new AmmoType[]{AmmoTypes.basicFlame};
recoil = 0f; recoil = 0f;
reload = 4f; reload = 4f;
@@ -59,8 +69,9 @@ public class TurretBlocks extends BlockList implements ContentList{
ammoUseEffect = ShootFx.shellEjectSmall; ammoUseEffect = ShootFx.shellEjectSmall;
health = 160; health = 160;
drawer = (tile, entity) -> Draw.rect(entity.target != null ? name + "-shoot" : name, tile.drawx() + tr2.x, tile.drawy() + tr2.y, entity.rotation - 90); 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"){{ wave = new LiquidTurret("wave"){{
ammoTypes = new AmmoType[]{AmmoTypes.water, AmmoTypes.lava, AmmoTypes.cryofluid, AmmoTypes.oil}; ammoTypes = new AmmoType[]{AmmoTypes.water, AmmoTypes.lava, AmmoTypes.cryofluid, AmmoTypes.oil};
@@ -180,8 +191,16 @@ public class TurretBlocks extends BlockList implements ContentList{
}}; }};
cyclone = new ItemTurret("cyclone"){{ cyclone = new ItemTurret("cyclone"){{
ammoTypes = new AmmoType[]{AmmoTypes.flakLead, AmmoTypes.flakExplosive, AmmoTypes.flakPlastic, AmmoTypes.flakSurge}; ammoTypes = new AmmoType[]{AmmoTypes.flakExplosive, AmmoTypes.flakPlastic, AmmoTypes.flakSurge};
xRand = 4f;
reload = 8f;
range = 140f;
size = 3; size = 3;
recoil = 3f;
shots = 2;
rotatespeed = 20f;
inaccuracy = 13f;
shootCone = 30f;
}}; }};
fuse = new ItemTurret("fuse"){{ fuse = new ItemTurret("fuse"){{
@@ -1,40 +1,31 @@
package io.anuke.mindustry.content.bullets; package io.anuke.mindustry.content.bullets;
import io.anuke.mindustry.entities.bullet.BasicBulletType;
import io.anuke.mindustry.entities.bullet.BulletType; import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.entities.bullet.FlakBulletType;
import io.anuke.mindustry.type.ContentList; import io.anuke.mindustry.type.ContentList;
public class FlakBullets extends BulletList implements ContentList{ public class FlakBullets extends BulletList implements ContentList{
public static BulletType lead, plastic, explosive, surge; public static BulletType plastic, explosive, surge;
@Override @Override
public void load(){ public void load(){
lead = new BasicBulletType(3f, 5, "bullet"){
plastic = new FlakBulletType(4f, 5){
{ {
bulletWidth = 7f;
bulletHeight = 9f;
} }
}; };
plastic = new BasicBulletType(3f, 5, "bullet"){ explosive = new FlakBulletType(4f, 5){
{ {
bulletWidth = 7f;
bulletHeight = 9f;
} }
}; };
explosive = new BasicBulletType(3f, 5, "bullet"){ surge = new FlakBulletType(4f, 5){
{ {
bulletWidth = 7f;
bulletHeight = 9f;
}
};
surge = new BasicBulletType(3f, 5, "bullet"){
{
bulletWidth = 7f;
bulletHeight = 9f;
} }
}; };
} }
@@ -12,7 +12,7 @@ import io.anuke.ucore.util.Mathf;
public class BulletFx extends FxList implements ContentList{ public class BulletFx extends FxList implements ContentList{
public static Effect hitBulletSmall, hitBulletBig, hitFlameSmall, hitLiquid, hitLaser, hitLancer, despawn, flakExplosion, blastExplosion, plasticExplosion, public static Effect hitBulletSmall, hitBulletBig, hitFlameSmall, hitLiquid, hitLaser, hitLancer, despawn, flakExplosion, blastExplosion, plasticExplosion,
artilleryTrail, incendTrail, missileTrail, absorb; artilleryTrail, incendTrail, missileTrail, absorb, flakExplosionBig;
@Override @Override
public void load(){ public void load(){
@@ -197,6 +197,30 @@ public class BulletFx extends FxList implements ContentList{
Lines.circle(e.x, e.y, 5f * e.fout()); Lines.circle(e.x, e.y, 5f * e.fout());
Draw.reset(); 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.atan2(x, y), 1f + e.fout() * 3f);
});
Draw.reset();
});
} }
} }
@@ -368,6 +368,11 @@ public class Control extends Module{
input.update(); input.update();
} }
//auto-update rpc every 5 seconds
if(Timers.get("rpcUpdate", 60 * 5)){
Platform.instance.updateRPC();
}
//check unlocked sectors //check unlocked sectors
if(world.getSector() != null && !world.getSector().complete){ if(world.getSector() != null && !world.getSector().complete){
//all assigned missions are complete //all assigned missions are complete
@@ -127,7 +127,7 @@ public class NetServer extends Module{
if(preventDuplicates){ if(preventDuplicates){
for(Player player : playerGroup.all()){ for(Player player : playerGroup.all()){
if(player.name.equalsIgnoreCase(packet.name)){ if(player.name.trim().equalsIgnoreCase(packet.name.trim())){
kick(id, KickReason.nameInUse); kick(id, KickReason.nameInUse);
return; return;
} }
@@ -518,6 +518,7 @@ public class NetServer extends Module{
} }
String fixName(String name){ String fixName(String name){
name = name.trim();
if(name.equals("[") || name.equals("]")){ if(name.equals("[") || name.equals("]")){
return ""; return "";
} }
@@ -14,7 +14,7 @@ import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Edges; import io.anuke.mindustry.world.Edges;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Wall; import io.anuke.mindustry.world.blocks.defense.Wall;
import io.anuke.mindustry.world.consumers.Consume; import io.anuke.mindustry.world.consumers.Consume;
import io.anuke.mindustry.world.modules.ConsumeModule; import io.anuke.mindustry.world.modules.ConsumeModule;
import io.anuke.mindustry.world.modules.InventoryModule; import io.anuke.mindustry.world.modules.InventoryModule;
@@ -108,6 +108,10 @@ public class Bullet extends BulletEntity<BulletType> implements TeamTrait, SyncT
return data; return data;
} }
public void setData(Object data){
this.data = data;
}
@Override @Override
public float getDamage(){ public float getDamage(){
if(owner instanceof Unit){ if(owner instanceof Unit){
@@ -0,0 +1,41 @@
package io.anuke.mindustry.entities.bullet;
import com.badlogic.gdx.math.Rectangle;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.entities.Units;
import io.anuke.ucore.core.Timers;
public abstract class FlakBulletType extends BasicBulletType{
protected static Rectangle rect = new Rectangle();
protected float explodeRange = 30f;
public FlakBulletType(float speed, float damage){
super(speed, damage, "shell");
splashDamage = 15f;
splashDamageRadius = 34f;
hiteffect = BulletFx.flakExplosionBig;
bulletWidth = 8f;
bulletHeight = 10f;
}
@Override
public void update(Bullet b){
super.update(b);
if(b.getData() instanceof Integer) return;
if(b.timer.get(2, 6)){
Units.getNearbyEnemies(b.getTeam(), rect.setSize(explodeRange*2f).setCenter(b.x, b.y), unit -> {
if(b.getData() instanceof Float) return;
if(unit.distanceTo(b) < explodeRange){
b.setData(0);
Timers.run(5f, () -> {
if(b.getData() instanceof Integer){
b.time(b.lifetime());
}
});
}
});
}
}
}
@@ -56,6 +56,7 @@ public class Lightning extends TimedEntity implements Poolable, DrawTrait, SyncT
Call.createLighting(lastSeed++, team, effect, color, damage, x, y, targetAngle, length); Call.createLighting(lastSeed++, team, effect, color, damage, x, y, targetAngle, length);
} }
/**Do not invoke!*/
@Remote(called = Loc.server) @Remote(called = Loc.server)
public static void createLighting(int seed, Team team, Effect effect, Color color, float damage, float x, float y, float targetAngle, int length){ public static void createLighting(int seed, Team team, Effect effect, Color color, float damage, float x, float y, float targetAngle, int length){
Lightning l = Pooling.obtain(Lightning.class); Lightning l = Pooling.obtain(Lightning.class);
@@ -251,6 +251,7 @@ public abstract class GroundUnit extends BaseUnit{
if(enemy == null) return; if(enemy == null) return;
Tile tile = world.tileWorld(x, y); Tile tile = world.tileWorld(x, y);
if(tile == null) return;
Tile targetTile = world.pathfinder().getTargetTile(enemy, tile); Tile targetTile = world.pathfinder().getTargetTile(enemy, tile);
TileEntity core = getClosestCore(); TileEntity core = getClosestCore();
@@ -68,6 +68,8 @@ public class Palette{
lightTrail = Color.valueOf("ffe2a9"), lightTrail = Color.valueOf("ffe2a9"),
surge = Color.valueOf("f3e979"),
redSpark = Color.valueOf("fbb97f"), redSpark = Color.valueOf("fbb97f"),
orangeSpark = Color.valueOf("d2b29c"), orangeSpark = Color.valueOf("d2b29c"),
@@ -248,7 +248,7 @@ public class WorldGenerator{
double iceridge = rid.getValue(x+99999, y, 1f / 300f) + sim3.octaveNoise2D(2, 1f, 1f/14f, x, y)/11f; double iceridge = rid.getValue(x+99999, y, 1f / 300f) + sim3.octaveNoise2D(2, 1f, 1f/14f, x, y)/11f;
double elevation = elevationOf(x, y, detailed); double elevation = elevationOf(x, y, detailed);
double temp = vn.noise(x, y, 1f / 300f) * sim3.octaveNoise2D(detailed ? 2 : 1, 1, 1f / 13f, x, y)/13f double temp = vn.noise(x, y, 1f / 300f) * sim3.octaveNoise2D(detailed ? 2 : 1, 1, 1f / 13f, x, y)/13f
+ sim3.octaveNoise2D(detailed ? 12 : 9, 0.6, 1f / 1020f, x, y); + sim3.octaveNoise2D(detailed ? 12 : 9, 0.6, 1f / 1100f, x, y);
int lerpDst = 20; int lerpDst = 20;
lerpDst *= lerpDst; lerpDst *= lerpDst;
@@ -272,7 +272,7 @@ public class WorldGenerator{
floor = Blocks.water; floor = Blocks.water;
}else if(elevation < 0.85){ }else if(elevation < 0.85){
floor = Blocks.sand; floor = Blocks.sand;
}else if (elevation < 2.5 && temp > 0.4){ }else if (elevation < 2.5 && temp > 0.5){
floor = Blocks.sand; floor = Blocks.sand;
}else if(temp < 0.42){ }else if(temp < 0.42){
floor = Blocks.snow; floor = Blocks.snow;
@@ -313,7 +313,7 @@ public class WorldGenerator{
double elevationOf(int x, int y, boolean detailed){ double elevationOf(int x, int y, boolean detailed){
double ridge = rid.getValue(x, y, 1f / 400f); double ridge = rid.getValue(x, y, 1f / 400f);
return sim.octaveNoise2D(detailed ? 7 : 4, 0.62, 1f / 740, x, y) * 6.1 - 1 - ridge; return sim.octaveNoise2D(detailed ? 7 : 4, 0.62, 1f / 800, x, y) * 6.1 - 1 - ridge;
} }
public static class GenResult{ public static class GenResult{
@@ -174,7 +174,6 @@ public class ContentDisplay{
table.add(Bundles.format("text.mech.minepower", mech.drillPower)); table.add(Bundles.format("text.mech.minepower", mech.drillPower));
table.row(); table.row();
} }
} }
public static void displayUnit(Table table, UnitType unit){ public static void displayUnit(Table table, UnitType unit){
@@ -7,7 +7,6 @@ import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Wall;
import io.anuke.ucore.core.Graphics; import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
@@ -8,7 +8,6 @@ import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Units; import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.input.CursorType; import io.anuke.mindustry.input.CursorType;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Wall;
import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect; import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
@@ -4,7 +4,6 @@ import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Wall;
import io.anuke.mindustry.world.blocks.defense.DeflectorWall.DeflectorEntity; import io.anuke.mindustry.world.blocks.defense.DeflectorWall.DeflectorEntity;
import io.anuke.ucore.core.Graphics; import io.anuke.ucore.core.Graphics;
import io.anuke.ucore.core.Timers; import io.anuke.ucore.core.Timers;
@@ -13,10 +12,10 @@ import io.anuke.ucore.util.Mathf;
import static io.anuke.mindustry.Vars.tilesize; import static io.anuke.mindustry.Vars.tilesize;
public class PhaseWall extends Wall{ public class MendingWall extends Wall{
protected float regenSpeed = 0.25f; protected float regenSpeed = 0.25f;
public PhaseWall(String name){ public MendingWall(String name){
super(name); super(name);
update = true; update = true;
} }
@@ -0,0 +1,26 @@
package io.anuke.mindustry.world.blocks.defense;
import io.anuke.mindustry.content.fx.BulletFx;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.effect.Lightning;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.ucore.util.Mathf;
public class SurgeWall extends Wall{
protected float lightningChance = 0.05f;
protected float lightningDamage = 11f;
protected int lightningLength = 20;
public SurgeWall(String name){
super(name);
}
@Override
public void handleBulletHit(TileEntity entity, Bullet bullet){
super.handleBulletHit(entity, bullet);
if(Mathf.chance(lightningChance)){
Lightning.create(entity.getTeam(), BulletFx.hitLancer, Palette.surge, lightningDamage, bullet.x, bullet.y, bullet.angle() + 180f, lightningLength);
}
}
}
@@ -1,4 +1,4 @@
package io.anuke.mindustry.world.blocks; package io.anuke.mindustry.world.blocks.defense;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.meta.BlockGroup; import io.anuke.mindustry.world.meta.BlockGroup;
@@ -9,7 +9,6 @@ import static io.anuke.mindustry.Vars.tilesize;
public class BurstTurret extends ItemTurret{ public class BurstTurret extends ItemTurret{
protected float burstSpacing = 5; protected float burstSpacing = 5;
protected float xRand = 0f;
public BurstTurret(String name){ public BurstTurret(String name){
super(name); super(name);
@@ -58,6 +58,7 @@ public abstract class Turret extends Block{
protected float rotatespeed = 5f; //in degrees per tick protected float rotatespeed = 5f; //in degrees per tick
protected float shootCone = 8f; protected float shootCone = 8f;
protected float shootShake = 0f; protected float shootShake = 0f;
protected float xRand = 0f;
protected boolean targetAir = true; protected boolean targetAir = true;
protected Translator tr = new Translator(); protected Translator tr = new Translator();
@@ -274,13 +275,13 @@ public abstract class Turret extends Block{
entity.heat = 1f; entity.heat = 1f;
AmmoType type = peekAmmo(tile); AmmoType type = peekAmmo(tile);
useAmmo(tile);
tr.trns(entity.rotation, size * tilesize / 2); tr.trns(entity.rotation, size * tilesize / 2, Mathf.range(xRand));
bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy + type.inaccuracy)); bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy + type.inaccuracy));
effects(tile); effects(tile);
useAmmo(tile);
} }
protected void bullet(Tile tile, BulletType type, float angle){ protected void bullet(Tile tile, BulletType type, float angle){
@@ -49,7 +49,7 @@ public class Conveyor extends Block{
itemCapacity = 4; itemCapacity = 4;
} }
private static int compareItems(Long a, Long b){ private static int compareItems(long a, long b){
pos1.set(a, ItemPos.packShorts); pos1.set(a, ItemPos.packShorts);
pos2.set(b, ItemPos.packShorts); pos2.set(b, ItemPos.packShorts);
return Float.compare(pos1.y, pos2.y); return Float.compare(pos1.y, pos2.y);
@@ -1,15 +1,24 @@
package io.anuke.mindustry.world.blocks.production; package io.anuke.mindustry.world.blocks.production;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Mathf;
public class PlastaniumCompressor extends GenericCrafter{ public class PlastaniumCompressor extends GenericCrafter{
protected TextureRegion topRegion;
public PlastaniumCompressor(String name){ public PlastaniumCompressor(String name){
super(name); super(name);
} }
@Override
public void load(){
super.load();
topRegion = Draw.region(name + "-top");
}
@Override @Override
public void draw(Tile tile){ public void draw(Tile tile){
super.draw(tile); super.draw(tile);
@@ -17,7 +26,7 @@ public class PlastaniumCompressor extends GenericCrafter{
GenericCrafterEntity entity = tile.entity(); GenericCrafterEntity entity = tile.entity();
Draw.alpha(Mathf.absin(entity.totalProgress, 3f, 0.9f) * entity.warmup); Draw.alpha(Mathf.absin(entity.totalProgress, 3f, 0.9f) * entity.warmup);
Draw.rect(name + "-top", tile.drawx(), tile.drawy()); Draw.rect(topRegion, tile.drawx(), tile.drawy());
Draw.reset(); Draw.reset();
} }
} }
@@ -46,6 +46,7 @@ public class UnitPad extends Block{
protected UnitType type; protected UnitType type;
protected float produceTime = 1000f; protected float produceTime = 1000f;
protected float launchVelocity = 0f; protected float launchVelocity = 0f;
protected TextureRegion topRegion;
public UnitPad(String name){ public UnitPad(String name){
super(name); super(name);
@@ -78,6 +79,13 @@ public class UnitPad extends Block{
} }
} }
@Override
public void load(){
super.load();
topRegion = Draw.region(name + "-top");
}
@Override @Override
public boolean outputsItems(){ public boolean outputsItems(){
return false; return false;
@@ -135,7 +143,7 @@ public class UnitPad extends Block{
Draw.reset(); Draw.reset();
Draw.rect(name + "-top", tile.drawx(), tile.drawy()); Draw.rect(topRegion, tile.drawx(), tile.drawy());
} }
@Override @Override