Loads of bugfixes, gameplay tweaks

This commit is contained in:
Anuken 2018-06-22 19:14:50 -04:00
parent 57d5628750
commit 74878b5cb1
38 changed files with 748 additions and 568 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 114 KiB

View File

@ -36,7 +36,7 @@ public class Vars{
//respawn time in frames
public static final float respawnduration = 60*4;
//time between waves in frames (on normal mode)
public static final float wavespace = 60*60;
public static final float wavespace = 60*60*2;
//waves can last no longer than 3 minutes, otherwise the next one spawns
public static final float maxwavespace = 60*60*4f;

View File

@ -61,7 +61,7 @@ public class WaveSpawner {
for(int i = 0; i < spawned; i ++){
BaseUnit unit = UnitTypes.scout.create(Team.red);
unit.inventory.addAmmo(AmmoTypes.bulletIron);
unit.inventory.addAmmo(AmmoTypes.bulletLead);
unit.setWave();
unit.setSquad(squad);
unit.set(spawn.x * quadsize * tilesize + quadsize * tilesize/2f + Mathf.range(quadsize*tilesize/3f),
@ -80,7 +80,7 @@ public class WaveSpawner {
for(int i = 0; i < spawned; i ++){
BaseUnit unit = UnitTypes.vtol.create(Team.red);
unit.inventory.addAmmo(AmmoTypes.bulletIron);
unit.inventory.addAmmo(AmmoTypes.bulletLead);
unit.setWave();
unit.setSquad(squad);
unit.set(baseX + Mathf.range(spread), baseY + Mathf.range(spread));

View File

@ -8,9 +8,9 @@ import io.anuke.mindustry.type.AmmoType;
import io.anuke.mindustry.type.ContentList;
public class AmmoTypes implements ContentList {
public static AmmoType bulletIron, bulletLead, bulletSteel, bulletThorium, bulletSilicon, bulletThermite,
public static AmmoType bulletTungsten, bulletLead, bulletCarbide, bulletThorium, bulletSilicon, bulletThermite,
flakLead, flakExplosive, flakPlastic, flakSurge, missileExplosive, missileIncindiary, missileSurge,
artilleryLead, artilleryThorium, artilleryPlastic, artilleryHoming, artilleryIncindiary,
artilleryCarbide, artilleryThorium, artilleryPlastic, artilleryHoming, artilleryIncindiary,
basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid;
@Override
@ -18,27 +18,31 @@ public class AmmoTypes implements ContentList {
//bullets
bulletIron = new AmmoType(Items.tungsten, StandardBullets.iron, 3) {{
bulletLead = new AmmoType(Items.lead, StandardBullets.lead, 5) {{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
reloadMultiplier = 1.6f;
inaccuracy = 5f;
}};
bulletTungsten = new AmmoType(Items.tungsten, StandardBullets.tungsten, 2) {{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
reloadMultiplier = 0.8f;
}};
bulletCarbide = new AmmoType(Items.carbide, StandardBullets.carbide, 2) {{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
reloadMultiplier = 0.6f;
}};
bulletThorium = new AmmoType(Items.thorium, StandardBullets.thorium, 2) {{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
}};
bulletLead = new AmmoType(Items.lead, StandardBullets.lead, 3) {{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
}};
bulletSteel = new AmmoType(Items.carbide, StandardBullets.steel, 3) {{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
}};
bulletThorium = new AmmoType(Items.thorium, StandardBullets.thorium, 3) {{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
}};
bulletSilicon = new AmmoType(Items.silicon, StandardBullets.homing, 3) {{
bulletSilicon = new AmmoType(Items.silicon, StandardBullets.homing, 4) {{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
}};
@ -46,6 +50,7 @@ public class AmmoTypes implements ContentList {
bulletThermite = new AmmoType(Items.thermite, StandardBullets.tracer, 3) {{
shootEffect = ShootFx.shootSmall;
smokeEffect = ShootFx.shootSmallSmoke;
inaccuracy = 3f;
}};
//flak
@ -89,7 +94,7 @@ public class AmmoTypes implements ContentList {
//artillery
artilleryLead = new AmmoType(Items.lead, ArtilleryBullets.lead, 1) {{
artilleryCarbide = new AmmoType(Items.carbide, ArtilleryBullets.carbide, 1) {{
shootEffect = ShootFx.shootBig2;
smokeEffect = ShootFx.shootBigSmoke2;
}};

View File

@ -17,13 +17,16 @@ public class Recipes implements ContentList{
new Recipe(defense, DefenseBlocks.tungstenWall, new ItemStack(Items.tungsten, 12));
new Recipe(defense, DefenseBlocks.tungstenWallLarge, new ItemStack(Items.tungsten, 12*4));
//TURRETS
new Recipe(weapon, WeaponBlocks.duo, new ItemStack(Items.tungsten, 20));
new Recipe(weapon, WeaponBlocks.scorch, new ItemStack(Items.tungsten, 25), new ItemStack(Items.carbide, 20));
new Recipe(weapon, WeaponBlocks.hail, new ItemStack(Items.tungsten, 25), new ItemStack(Items.carbide, 25));
new Recipe(defense, DefenseBlocks.carbideWall, new ItemStack(Items.carbide, 12));
new Recipe(defense, DefenseBlocks.carbideWallLarge, new ItemStack(Items.carbide, 12*4));
new Recipe(weapon, WeaponBlocks.lancer, new ItemStack(Items.tungsten, 25), new ItemStack(Items.lead, 25), new ItemStack(Items.silicon, 25));
new Recipe(weapon, WeaponBlocks.arc, new ItemStack(Items.tungsten, 25), new ItemStack(Items.lead, 30), new ItemStack(Items.silicon, 30));
//TURRETS
new Recipe(weapon, TurretBlocks.duo, new ItemStack(Items.tungsten, 20));
new Recipe(weapon, TurretBlocks.scorch, new ItemStack(Items.tungsten, 25), new ItemStack(Items.carbide, 20));
new Recipe(weapon, TurretBlocks.hail, new ItemStack(Items.tungsten, 25), new ItemStack(Items.carbide, 25));
new Recipe(weapon, TurretBlocks.lancer, new ItemStack(Items.tungsten, 25), new ItemStack(Items.lead, 25), new ItemStack(Items.silicon, 25));
new Recipe(weapon, TurretBlocks.arc, new ItemStack(Items.tungsten, 25), new ItemStack(Items.lead, 30), new ItemStack(Items.silicon, 30));
//DISTRIBUTION
new Recipe(distribution, DistributionBlocks.conveyor, new ItemStack(Items.lead, 1));
@ -42,11 +45,20 @@ public class Recipes implements ContentList{
new Recipe(distribution, DistributionBlocks.bridgeconveyor, new ItemStack(Items.carbide, 8), new ItemStack(Items.tungsten, 8));
//CRAFTING
new Recipe(crafting, CraftingBlocks.smelter, new ItemStack(Items.tungsten, 40));
new Recipe(crafting, CraftingBlocks.siliconsmelter, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 50));
new Recipe(crafting, CraftingBlocks.arcsmelter, new ItemStack(Items.tungsten, 60), new ItemStack(Items.carbide, 60), new ItemStack(Items.lead, 50));
new Recipe(crafting, CraftingBlocks.pulverizer, new ItemStack(Items.tungsten, 50), new ItemStack(Items.lead, 50));
//smelting
new Recipe(crafting, CraftingBlocks.smelter, new ItemStack(Items.tungsten, 40));
new Recipe(crafting, CraftingBlocks.arcsmelter, new ItemStack(Items.tungsten, 60), new ItemStack(Items.carbide, 60), new ItemStack(Items.lead, 50));
new Recipe(crafting, CraftingBlocks.siliconsmelter, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 50));
//misc
new Recipe(crafting, CraftingBlocks.pulverizer, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 50));
new Recipe(crafting, CraftingBlocks.thermiteMixer, new ItemStack(Items.tungsten, 100), new ItemStack(Items.lead, 50));
new Recipe(crafting, CraftingBlocks.blastMixer, new ItemStack(Items.tungsten, 60), new ItemStack(Items.lead, 60), new ItemStack(Items.carbide, 40));
//processing
new Recipe(crafting, CraftingBlocks.separator, new ItemStack(Items.tungsten, 60), new ItemStack(Items.carbide, 50));
new Recipe(crafting, CraftingBlocks.centrifuge, new ItemStack(Items.tungsten, 130), new ItemStack(Items.carbide, 130), new ItemStack(Items.silicon, 30), new ItemStack(Items.titanium, 40));
//POWER
new Recipe(power, PowerBlocks.powernode, new ItemStack(Items.tungsten, 2), new ItemStack(Items.lead, 6));
@ -65,6 +77,7 @@ public class Recipes implements ContentList{
new Recipe(production, ProductionBlocks.carbideDrill, new ItemStack(Items.tungsten, 40), new ItemStack(Items.carbide, 40));
new Recipe(production, ProductionBlocks.waterextractor, new ItemStack(Items.tungsten, 50), new ItemStack(Items.carbide, 50), new ItemStack(Items.lead, 40));
new Recipe(production, ProductionBlocks.cultivator, new ItemStack(Items.tungsten, 20), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 20));
//UNITS
new Recipe(units, UnitBlocks.droneFactory, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 50), new ItemStack(Items.silicon, 30));
@ -81,7 +94,7 @@ public class Recipes implements ContentList{
new Recipe(liquid, LiquidBlocks.bridgeconduit, new ItemStack(Items.carbide, 8), new ItemStack(Items.lead, 8));
//new Recipe(liquid, LiquidBlocks.laserconduit, new ItemStack(Items.titanium, 2), new ItemStack(Items.lead, 2), new ItemStack(Items.phasematter, 10));
new Recipe(liquid, LiquidBlocks.mechanicalPump, new ItemStack(Items.tungsten, 10), new ItemStack(Items.lead, 10), new ItemStack(Items.silicon, 10));
new Recipe(liquid, LiquidBlocks.mechanicalPump, new ItemStack(Items.tungsten, 30), new ItemStack(Items.lead, 20));
//new Recipe(liquid, LiquidBlocks.rotaryPump, new ItemStack(Items.carbide, 10), new ItemStack(Items.surgealloy, 5));
//new Recipe(liquid, LiquidBlocks.thermalPump, new ItemStack(Items.carbide, 10), new ItemStack(Items.surgealloy, 5));
@ -114,16 +127,16 @@ public class Recipes implements ContentList{
new Recipe(defense, DefenseBlocks.phasewall, new ItemStack(Items.titanium, 1));
new Recipe(defense, DefenseBlocks.phasewalllarge, new ItemStack(Items.titanium, 1));
new Recipe(weapon, WeaponBlocks.wave, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, WeaponBlocks.lancer, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, WeaponBlocks.arc, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, WeaponBlocks.swarmer, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, WeaponBlocks.ripple, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, WeaponBlocks.fuse, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, WeaponBlocks.ripple, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, WeaponBlocks.cyclone, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, WeaponBlocks.spectre, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, WeaponBlocks.meltdown, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, TurretBlocks.wave, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, TurretBlocks.lancer, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, TurretBlocks.arc, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, TurretBlocks.swarmer, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, TurretBlocks.ripple, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, TurretBlocks.fuse, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, TurretBlocks.ripple, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, TurretBlocks.cyclone, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, TurretBlocks.spectre, new ItemStack(Items.tungsten, 1));
new Recipe(weapon, TurretBlocks.meltdown, new ItemStack(Items.tungsten, 1));
new Recipe(crafting, CraftingBlocks.alloysmelter, new ItemStack(Items.titanium, 50), new ItemStack(Items.carbide, 50));
new Recipe(crafting, CraftingBlocks.alloyfuser, new ItemStack(Items.carbide, 30), new ItemStack(Items.tungsten, 30));

View File

@ -28,7 +28,7 @@ public class UnitTypes implements ContentList {
speed = 0.2f;
drag = 0.4f;
range = 40f;
setAmmo(AmmoTypes.bulletIron);
setAmmo(AmmoTypes.bulletLead);
}};
vtol = new UnitType("vtol", team -> new Vtol(vtol, team)){{
@ -37,7 +37,7 @@ public class UnitTypes implements ContentList {
drag = 0.01f;
isFlying = true;
reload = 7;
setAmmo(AmmoTypes.bulletIron);
setAmmo(AmmoTypes.bulletLead);
}};
}

View File

@ -18,7 +18,7 @@ public class Weapons implements ContentList {
reload = 15f;
roundrobin = true;
ejectEffect = ShootFx.shellEjectSmall;
setAmmo(AmmoTypes.bulletIron);
setAmmo(AmmoTypes.bulletLead);
}};
blaster2 = new Weapon("clustergun") {{
@ -34,7 +34,7 @@ public class Weapons implements ContentList {
reload = 12f;
roundrobin = true;
ejectEffect = ShootFx.shellEjectSmall;
setAmmo(AmmoTypes.bulletSteel);
setAmmo(AmmoTypes.bulletCarbide);
}};
blaster4 = new Weapon("vulcan") {{

View File

@ -133,7 +133,9 @@ public class Blocks extends BlockList implements ContentList{
snow = new Floor("snow");
grass = new Floor("grass");
grass = new Floor("grass"){{
hasOres = true;
}};
shrub = new Rock("shrub");

View File

@ -11,7 +11,9 @@ import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.production.*;
public class CraftingBlocks extends BlockList implements ContentList {
public static Block smelter, arcsmelter, siliconsmelter, plasteelcompressor, phaseweaver, alloysmelter, alloyfuser, cryofluidmixer, melter, separator, centrifuge, biomatterCompressor, pulverizer, oilRefinery, stoneFormer, incinerator;
public static Block smelter, arcsmelter, siliconsmelter, plasteelcompressor, phaseweaver, alloysmelter, alloyfuser,
thermiteMixer, blastMixer,
cryofluidmixer, melter, separator, centrifuge, biomatterCompressor, pulverizer, oilRefinery, stoneFormer, incinerator;
@Override
public void load() {
@ -112,6 +114,30 @@ public class CraftingBlocks extends BlockList implements ContentList {
size = 2;
}};
blastMixer = new GenericCrafter("blast-mixer") {{
itemCapacity = 20;
hasItems = true;
hasPower = true;
inputLiquid = Liquids.oil;
liquidUse = 0.05f;
inputItem = new ItemStack(Items.thermite, 1);
output = Items.blastCompound;
powerUse = 0.04f;
size = 2;
}};
thermiteMixer = new PowerSmelter("thermite-mixer") {{
itemCapacity = 20;
hasItems = true;
hasPower = true;
inputs = new ItemStack[]{new ItemStack(Items.coal, 1), new ItemStack(Items.lead, 2), new ItemStack(Items.sand, 2)};
result = Items.thermite;
powerUse = 0.02f;
size = 2;
}};
melter = new PowerCrafter("melter") {{
health = 200;
outputLiquid = Liquids.lava;

View File

@ -12,15 +12,16 @@ import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Strings;
public class WeaponBlocks extends BlockList implements ContentList {
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.bulletIron, AmmoTypes.bulletLead, AmmoTypes.bulletSteel, AmmoTypes.bulletThermite};
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletThermite};
reload = 25f;
restitution = 0.03f;
range = 80f;
ammoUseEffect = ShootFx.shellEjectSmall;
}};
/*
@ -37,8 +38,9 @@ public class WeaponBlocks extends BlockList implements ContentList {
}};*/
hail = new ItemTurret("hail") {{
ammoTypes = new AmmoType[]{AmmoTypes.artilleryLead, AmmoTypes.artilleryHoming, AmmoTypes.artilleryIncindiary};
ammoTypes = new AmmoType[]{AmmoTypes.artilleryCarbide, AmmoTypes.artilleryHoming, AmmoTypes.artilleryIncindiary};
reload = 40f;
range = 200f;
}};
scorch = new LiquidTurret("scorch") {{
@ -111,7 +113,7 @@ public class WeaponBlocks extends BlockList implements ContentList {
salvo = new ItemTurret("salvo") {{
size = 2;
range = 100f;
ammoTypes = new AmmoType[]{AmmoTypes.bulletIron, AmmoTypes.bulletLead, AmmoTypes.bulletSteel, AmmoTypes.bulletThermite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletThermite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
reload = 70f;
restitution = 0.03f;
ammoEjectBack = 3f;
@ -135,7 +137,7 @@ public class WeaponBlocks extends BlockList implements ContentList {
}};
ripple = new ItemTurret("ripple") {{
ammoTypes = new AmmoType[]{AmmoTypes.artilleryLead, AmmoTypes.artilleryHoming, AmmoTypes.artilleryIncindiary, AmmoTypes.artilleryPlastic, AmmoTypes.artilleryThorium};
ammoTypes = new AmmoType[]{AmmoTypes.artilleryCarbide, AmmoTypes.artilleryHoming, AmmoTypes.artilleryIncindiary, AmmoTypes.artilleryPlastic, AmmoTypes.artilleryThorium};
size = 3;
}};
@ -151,7 +153,7 @@ public class WeaponBlocks extends BlockList implements ContentList {
}};
spectre = new ItemTurret("eraser") {{
ammoTypes = new AmmoType[]{AmmoTypes.bulletIron, AmmoTypes.bulletLead, AmmoTypes.bulletSteel, AmmoTypes.bulletThermite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
ammoTypes = new AmmoType[]{AmmoTypes.bulletTungsten, AmmoTypes.bulletLead, AmmoTypes.bulletCarbide, AmmoTypes.bulletThermite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
reload = 25f;
restitution = 0.03f;
ammoUseEffect = ShootFx.shellEjectSmall;

View File

@ -6,12 +6,12 @@ import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.type.ContentList;
public class ArtilleryBullets extends BulletList implements ContentList{
public static BulletType lead, thorium, plastic, homing, incindiary, surge;
public static BulletType carbide, thorium, plastic, homing, incindiary, surge;
@Override
public void load() {
lead = new BasicBulletType(3f, 0, "shell") {
carbide = new BasicBulletType(3f, 0, "shell") {
{
hiteffect = BulletFx.flakExplosion;
knockback = 0.8f;

View File

@ -5,36 +5,38 @@ import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.type.ContentList;
public class StandardBullets extends BulletList implements ContentList {
public static BulletType iron, lead, steel, thorium, homing, tracer;
public static BulletType tungsten, lead, carbide, thorium, homing, tracer;
@Override
public void load() {
iron = new BasicBulletType(3f, 5, "bullet") {
tungsten = new BasicBulletType(3.2f, 10, "bullet") {
{
bulletWidth = 9f;
bulletHeight = 11f;
}
};
lead = new BasicBulletType(2.5f, 5, "bullet") {
{
bulletWidth = 7f;
bulletHeight = 9f;
}
};
lead = new BasicBulletType(3f, 5, "bullet") {
carbide = new BasicBulletType(3.5f, 18, "bullet") {
{
bulletWidth = 7f;
bulletHeight = 9f;
bulletWidth = 9f;
bulletHeight = 12f;
armorPierce = 0.2f;
}
};
steel = new BasicBulletType(3f, 5, "bullet") {
thorium = new BasicBulletType(4f, 25, "bullet") {
{
bulletWidth = 7f;
bulletHeight = 9f;
}
};
thorium = new BasicBulletType(3f, 5, "bullet") {
{
bulletWidth = 7f;
bulletHeight = 9f;
bulletWidth = 10f;
bulletHeight = 13f;
armorPierce = 0.5f;
}
};

View File

@ -11,7 +11,7 @@ import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
public class UnitFx extends FxList implements ContentList {
public static Effect vtolHover, unitDrop, unitPickup;
public static Effect vtolHover, unitDrop, unitPickup, pickup;
@Override
public void load() {
@ -38,5 +38,12 @@ public class UnitFx extends FxList implements ContentList {
Lines.poly(e.x, e.y, 4, 13f * 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();
});
}
}

View File

@ -75,7 +75,7 @@ public class ContentLoader {
new DefenseBlocks(),
new DistributionBlocks(),
new ProductionBlocks(),
new WeaponBlocks(),
new TurretBlocks(),
new DebugBlocks(),
new LiquidBlocks(),
new StorageBlocks(),

View File

@ -6,7 +6,9 @@ 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;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.entities.traits.SaveTrait;
import io.anuke.mindustry.entities.traits.SyncTrait;
import io.anuke.mindustry.gen.CallEntity;
import io.anuke.mindustry.net.In;
@ -31,7 +33,7 @@ import java.io.IOException;
import static io.anuke.mindustry.Vars.*;
public class ItemDrop extends SolidEntity implements SyncTrait, DrawTrait, VelocityTrait, TimeTrait, Poolable {
public class ItemDrop extends SolidEntity implements SaveTrait, SyncTrait, DrawTrait, VelocityTrait, TimeTrait, Poolable {
public static int typeID = -1;
private static final float sinkLifetime = 80f;
@ -62,6 +64,10 @@ public class ItemDrop extends SolidEntity implements SyncTrait, DrawTrait, Veloc
@Remote(called = Loc.server, in = In.entities)
public static void onPickup(int itemid){
ItemDrop drop = itemGroup.getByID(itemid);
if(drop != null){
Effects.effect(UnitFx.pickup, drop);
}
itemGroup.removeByID(itemid);
}
@ -104,9 +110,14 @@ public class ItemDrop extends SolidEntity implements SyncTrait, DrawTrait, Veloc
@Override
public void collision(SolidTrait other, float x, float y) {
Player player = (Player)other;
if(player.inventory.canAcceptItem(item, amount)){
player.inventory.addItem(item, amount);
CallEntity.onPickup(getID());
if(player.inventory.canAcceptItem(item, 1)){
int used = Math.min(amount, player.inventory.capacity() - player.inventory.getItem().amount);
player.inventory.addItem(item, used);
amount -= used;
if(amount <= 0) {
CallEntity.onPickup(getID());
}
}
}
@ -182,6 +193,22 @@ public class ItemDrop extends SolidEntity implements SyncTrait, DrawTrait, Veloc
return itemGroup;
}
@Override
public void writeSave(DataOutput data) throws IOException {
data.writeFloat(x);
data.writeFloat(y);
data.writeByte(item.id);
data.writeShort(amount);
}
@Override
public void readSave(DataInput data) throws IOException {
x = data.readFloat();
y = data.readFloat();
item = Item.getByID(data.readByte());
amount = data.readShort();
}
@Override
public void write(DataOutput data) throws IOException{
data.writeFloat(x);

View File

@ -13,11 +13,13 @@ public class UnitDrops {
dropTable = new Item[]{Items.tungsten, Items.lead, Items.carbide};
}
for(Item item : dropTable){
if(Mathf.chance(0.2)){
int amount = Mathf.random(1, 30);
CallEntity.createItemDrop(item, amount, unit.x + Mathf.range(2f), unit.y + Mathf.range(2f),
unit.getVelocity().x + Mathf.range(0.5f), unit.getVelocity().y + Mathf.range(0.5f));
for (int i = 0; i < 3; i++) {
for(Item item : dropTable){
if(Mathf.chance(0.2)){
int amount = Mathf.random(1, 5);
CallEntity.createItemDrop(item, amount, unit.x + Mathf.range(2f), unit.y + Mathf.range(2f),
unit.getVelocity().x + Mathf.range(3f), unit.getVelocity().y + Mathf.range(3f));
}
}
}
}

View File

@ -184,11 +184,19 @@ public class Drone extends FlyingUnit implements BuilderTrait {
public final UnitState
build = new UnitState(){
public void entered() {
target = null;
}
public void update() {
BuildEntity entity = (BuildEntity)target;
TileEntity core = getClosestCore();
if(entity == null){
setState(repair);
return;
}
if(core == null) return;
if(entity.progress() < 1f && entity.tile.block() instanceof BuildBlock){ //building is valid
@ -243,6 +251,9 @@ public class Drone extends FlyingUnit implements BuilderTrait {
}
},
mine = new UnitState() {
public void entered() {
target = null;
}
public void update() {
if(targetItem == null) {
@ -253,7 +264,11 @@ public class Drone extends FlyingUnit implements BuilderTrait {
if(inventory.isFull()){
setState(drop);
}else{
//only mines tungsten for now
if(targetItem != null && !inventory.canAcceptItem(targetItem)){
setState(drop);
return;
}
retarget(() -> {
if(getMineTile() == null){
findItem();
@ -279,6 +294,9 @@ public class Drone extends FlyingUnit implements BuilderTrait {
}
},
drop = new UnitState() {
public void entered() {
target = null;
}
public void update() {
if(inventory.isEmpty()){

View File

@ -169,6 +169,9 @@ public abstract class InputHandler extends InputAdapter{
/**Returns the tile at the specified MOUSE coordinates.*/
Tile tileAt(float x, float y){
Vector2 vec = Graphics.world(x, y);
if(isPlacing()){
vec.sub(recipe.result.offset(), recipe.result.offset());
}
return world.tileWorld(vec.x, vec.y);
}

View File

@ -21,9 +21,11 @@ public class AmmoType implements Content{
* For liquid ammo, this is amount used per shot.*/
public final float quantityMultiplier;
/**Reload speed multiplier.*/
public float speedMultiplier = 1f;
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.*/
@ -40,7 +42,7 @@ public class AmmoType implements Content{
this.liquid = null;
this.bullet = result;
this.quantityMultiplier = 1f;
this.speedMultiplier = 1f;
this.reloadMultiplier = 1f;
}
/**Creates an AmmoType with an item.*/

View File

@ -80,7 +80,7 @@ public class DebugFragment implements Fragment {
new button("spawng", () ->{
BaseUnit unit = UnitTypes.scout.create(player.getTeam());
unit.set(player.x, player.y);
unit.inventory.addAmmo(AmmoTypes.bulletIron);
unit.inventory.addAmmo(AmmoTypes.bulletLead);
unit.setWave();
unit.add();
});

View File

@ -36,12 +36,14 @@ public abstract class BaseBlock {
/**Remove a stack from this inventory, and return the amount removed.*/
public int removeStack(Tile tile, Item item, int amount){
tile.entity.wakeUp();
tile.entity.items.removeItem(item, amount);
return amount;
}
/**Handle a stack input.*/
public void handleStack(Item item, int amount, Tile tile, Unit source){
tile.entity.wakeUp();
tile.entity.items.addItem(item, amount);
}

View File

@ -4,7 +4,6 @@ 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.blocks.defense.Turret;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.core.Timers;
@ -21,6 +20,7 @@ public class CooledTurret extends Turret {
public CooledTurret(String name) {
super(name);
hasLiquids = true;
liquidCapacity = 20f;
}
@Override
@ -29,7 +29,7 @@ public class CooledTurret extends Turret {
TurretEntity entity = tile.entity();
float used = Math.min(Math.min(entity.liquids.amount, maxUsed * Timers.delta()), ((reload - entity.reload) / coolantMultiplier) / entity.liquids.liquid.heatCapacity);
float used = Math.min(Math.min(entity.liquids.amount, maxUsed * Timers.delta()), Math.max(0, ((reload - entity.reload) / coolantMultiplier) / entity.liquids.liquid.heatCapacity));
entity.reload += (used * entity.liquids.liquid.heatCapacity) / entity.liquids.liquid.heatCapacity;
entity.liquids.amount -= used;

View File

@ -24,7 +24,7 @@ public class DoubleTurret extends ItemTurret {
tr.trns(entity.rotation - 90, shotWidth * i, size * tilesize / 2);
bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy));
useAmmo(tile);
effects(tile);
useAmmo(tile);
}
}

View File

@ -11,8 +11,6 @@ import io.anuke.mindustry.world.meta.BlockBar;
public class ItemTurret extends CooledTurret {
protected int maxAmmo = 100;
//TODO implement this!
/**A value of 'null' means this turret does not need ammo.*/
protected AmmoType[] ammoTypes;
protected ObjectMap<Item, AmmoType> ammoMap = new ObjectMap<>();

View File

@ -7,7 +7,6 @@ import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.world.BarType;
import io.anuke.mindustry.world.meta.BlockBar;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.defense.Turret;
import io.anuke.ucore.core.Effects;
public abstract class LiquidTurret extends Turret {

View File

@ -1,4 +1,4 @@
package io.anuke.mindustry.world.blocks.defense;
package io.anuke.mindustry.world.blocks.defense.turrets;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
@ -8,14 +8,15 @@ import io.anuke.mindustry.entities.Predict;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.entities.Units;
import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.bullet.BulletType;
import io.anuke.mindustry.graphics.Layer;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.type.AmmoEntry;
import io.anuke.mindustry.type.AmmoType;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.meta.BlockGroup;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.meta.BlockGroup;
import io.anuke.mindustry.world.meta.BlockStat;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Effects.Effect;
@ -166,6 +167,7 @@ public abstract class Turret extends Block{
if(Float.isNaN(entity.rotation)){
entity.rotation = 0;
}
entity.rotation = Angles.moveToward(entity.rotation, targetRot, 5f * Timers.delta());
if(Angles.angleDist(entity.rotation, targetRot) < shootCone){
@ -208,7 +210,7 @@ public abstract class Turret extends Block{
entity.reload = 0f;
}else{
entity.reload += Timers.delta() * peekAmmo(tile).speedMultiplier;
entity.reload += Timers.delta() * peekAmmo(tile).reloadMultiplier;
}
}
@ -218,17 +220,18 @@ public abstract class Turret extends Block{
entity.recoil = recoil;
entity.heat = 1f;
AmmoType type = peekAmmo(tile);
useAmmo(tile);
tr.trns(entity.rotation, size * tilesize / 2);
bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy));
bullet(tile, ammo.bullet, entity.rotation + Mathf.range(inaccuracy + type.inaccuracy));
effects(tile);
}
protected void bullet(Tile tile, BulletType type, float angle){
io.anuke.mindustry.entities.bullet.Bullet.create(type, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle);
Bullet.create(type, tile.entity, tile.getTeam(), tile.drawx() + tr.x, tile.drawy() + tr.y, angle);
}
protected void effects(Tile tile){

View File

@ -3,7 +3,6 @@ package io.anuke.mindustry.world.blocks.distribution;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.utils.LongArray;
import io.anuke.mindustry.content.Items;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.entities.Unit;
import io.anuke.mindustry.graphics.Layer;
@ -62,11 +61,12 @@ public class Conveyor extends Block{
@Override
public void draw(Tile tile){
ConveyorEntity entity = tile.entity();
byte rotation = tile.getRotation();
GridPoint2 point = Geometry.d4[rotation];
int offset = acceptItem(Items.stone, tile, null) ? (int)((Timers.time()/4f)%8) : 0;
int offset = entity.clogHeat <= 0.5f ? (int)((Timers.time()/4f)%8) : 0;
TextureRegion region = Draw.region(name);
region1.setRegion(region, 0, 0, region.getRegionWidth() - offset, region.getRegionHeight());
@ -192,6 +192,12 @@ public class Conveyor extends Block{
}
}
if(entity.minitem <= 0.0001f){
entity.clogHeat = Mathf.lerpDelta(entity.clogHeat, 1f, 0.05f);
}else{
entity.clogHeat = Mathf.lerpDelta(entity.clogHeat, 0f, 1f);
}
entity.carrying = 0f;
entity.minCarry = 2f;
@ -301,6 +307,8 @@ public class Conveyor extends Block{
float carrying;
float minCarry = 2f;
float clogHeat = 0f;
@Override
public void write(DataOutputStream stream) throws IOException{
stream.writeInt(convey.size);

View File

@ -2,8 +2,8 @@ package io.anuke.mindustry.world.blocks.distribution;
import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.meta.BlockGroup;
import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.meta.BlockGroup;
import io.anuke.ucore.core.Timers;
public class Router extends Block{
@ -21,7 +21,7 @@ public class Router extends Block{
@Override
public void update(Tile tile){
int iterations = Math.max(1, (int) (Timers.delta() + 0.4f));
boolean moved = false;
boolean moved = tile.entity.items.totalItems() > 0;
for(int i = 0; i < iterations; i ++) {
if (tile.entity.items.totalItems() > 0) {

View File

@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.production;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import io.anuke.mindustry.content.blocks.Blocks;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.type.Item;
@ -80,7 +81,7 @@ public class Cultivator extends Drill {
@Override
public boolean isValid(Tile tile){
return tile.block().drops != null && tile.block().drops.item == result;
return tile.floor() == Blocks.grass;
}
public static class CultivatorEntity extends DrillEntity{

View File

@ -1,10 +1,9 @@
package io.anuke.mindustry.world.blocks.production;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.entities.TileEntity;
import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Effects;
@ -22,8 +21,6 @@ public class SolidPump extends Pump {
protected float updateEffectChance = 0.02f;
protected float rotateSpeed = 1f;
protected final Array<Tile> drawTiles = new Array<>();
public SolidPump(String name){
super(name);
hasPower = true;
@ -84,19 +81,20 @@ public class SolidPump extends Pump {
}
@Override
public boolean isLayer(Tile tile) {
public boolean canPlaceOn(Tile tile) {
if(isMultiblock()){
for(Tile other : tile.getLinkedTiles(drawTiles)){
if(isValid(other)){
return false;
return true;
}
}
return true;
return false;
}else{
return !isValid(tile);
return isValid(tile);
}
}
@Override
protected boolean isValid(Tile tile){
return !tile.floor().isLiquid;
}

View File

@ -14,10 +14,12 @@ import io.anuke.ucore.util.Mathf;
public class ProcGen {
private Simplex sim = new Simplex();
private Simplex sim2 = new Simplex();
private Simplex sim3 = new Simplex();
public MapTileData generate(GenProperties props){
sim.setSeed(Mathf.random(99999));
sim2.setSeed(Mathf.random(99999));
sim3.setSeed(Mathf.random(99999));
MapTileData data = new MapTileData(300, 300);
TileDataMarker marker = data.newDataMarker();
@ -47,6 +49,10 @@ public class ProcGen {
}
}
if(sim3.octaveNoise2D(4, 0.5, 1f/120f, x, y) > 0.5){
marker.floor = (byte)Blocks.grass.id;
}
marker.elevation = (byte)Math.max(elevation, 0);
data.write(marker);