diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index ee5301ce6f..228d226da8 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -395,6 +395,7 @@ content.item.name=Items content.liquid.name=Liquids content.unit-type.name=Units content.recipe.name=Blocks +content.mech.name=Mechs item.stone.name=Stone item.stone.description=A common raw material. Used for separating and refining into other materials, or melting into lava. @@ -430,6 +431,15 @@ liquid.lava.name=Lava liquid.oil.name=Oil liquid.cryofluid.name=Cryofluid +mech.alpha.name=Alpha +mech.delta.name=Delta +mech.tau.name=Tau +mech.omega.name=Omega +mech.dart.name=Dart +mech.javelin.name=Javelin +mech.trident.name=Trident +mech.halberd.name=Halberd + text.item.explosiveness=[LIGHT_GRAY]Explosiveness: {0} text.item.flammability=[LIGHT_GRAY]Flammability: {0} text.item.radioactivity=[LIGHT_GRAY]Radioactivity: {0} diff --git a/core/assets/sprites/sprites.png b/core/assets/sprites/sprites.png index e8712b9e44..e67892be82 100644 Binary files a/core/assets/sprites/sprites.png and b/core/assets/sprites/sprites.png differ diff --git a/core/src/io/anuke/mindustry/content/Mechs.java b/core/src/io/anuke/mindustry/content/Mechs.java index 3c9fdeefd1..857dd28f85 100644 --- a/core/src/io/anuke/mindustry/content/Mechs.java +++ b/core/src/io/anuke/mindustry/content/Mechs.java @@ -16,7 +16,6 @@ import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Shaders; import io.anuke.mindustry.type.ContentList; import io.anuke.mindustry.type.Mech; -import io.anuke.mindustry.type.Upgrade; import io.anuke.mindustry.world.Tile; import io.anuke.ucore.core.Core; import io.anuke.ucore.core.Effects; @@ -45,6 +44,7 @@ public class Mechs implements ContentList{ boostSpeed = 0.85f; weapon = Weapons.blaster; maxSpeed = 4f; + altChargeAlpha = 0.03f; } @Override @@ -250,6 +250,6 @@ public class Mechs implements ContentList{ @Override public Array getAll(){ - return Upgrade.all(); + return Mech.all(); } } diff --git a/core/src/io/anuke/mindustry/content/UnitTypes.java b/core/src/io/anuke/mindustry/content/UnitTypes.java index eda50e1c5d..b0fbd30a6b 100644 --- a/core/src/io/anuke/mindustry/content/UnitTypes.java +++ b/core/src/io/anuke/mindustry/content/UnitTypes.java @@ -20,7 +20,7 @@ public class UnitTypes implements ContentList{ ammoCapacity = 0; range = 50f; healSpeed = 0.05f; - health = 45; + health = 60; }}; dagger = new UnitType("dagger", Dagger.class, Dagger::new){{ @@ -29,7 +29,7 @@ public class UnitTypes implements ContentList{ drag = 0.4f; range = 40f; weapon = Weapons.chainBlaster; - health = 90; + health = 180; }}; titan = new UnitType("titan", Titan.class, Titan::new){{ @@ -37,8 +37,8 @@ public class UnitTypes implements ContentList{ speed = 0.18f; drag = 0.4f; range = 10f; - weapon = Weapons.chainBlaster; - health = 280; + weapon = Weapons.flamethrower; + health = 500; }}; interceptor = new UnitType("interceptor", Interceptor.class, Interceptor::new){{ @@ -47,10 +47,11 @@ public class UnitTypes implements ContentList{ drag = 0.01f; weapon = Weapons.chainBlaster; isFlying = true; + health = 70; }}; monsoon = new UnitType("monsoon", Monsoon.class, Monsoon::new){{ - health = 230; + health = 250; speed = 0.2f; maxVelocity = 1.4f; drag = 0.01f; @@ -67,8 +68,7 @@ public class UnitTypes implements ContentList{ ammoCapacity = 0; range = 70f; itemCapacity = 70; - health = 120; - health = 45; + health = 220; buildPower = 0.9f; minePower = 1.1f; healSpeed = 0.09f; diff --git a/core/src/io/anuke/mindustry/content/Weapons.java b/core/src/io/anuke/mindustry/content/Weapons.java index fcc668c986..64ea91c834 100644 --- a/core/src/io/anuke/mindustry/content/Weapons.java +++ b/core/src/io/anuke/mindustry/content/Weapons.java @@ -5,7 +5,6 @@ import io.anuke.mindustry.content.fx.Fx; import io.anuke.mindustry.content.fx.ShootFx; import io.anuke.mindustry.game.Content; import io.anuke.mindustry.type.ContentList; -import io.anuke.mindustry.type.Upgrade; import io.anuke.mindustry.type.Weapon; public class Weapons implements ContentList{ @@ -117,6 +116,6 @@ public class Weapons implements ContentList{ @Override public Array getAll(){ - return Upgrade.all(); + return Weapon.all(); } } diff --git a/core/src/io/anuke/mindustry/content/blocks/UnitBlocks.java b/core/src/io/anuke/mindustry/content/blocks/UnitBlocks.java index 06386a6f06..2d395905b8 100644 --- a/core/src/io/anuke/mindustry/content/blocks/UnitBlocks.java +++ b/core/src/io/anuke/mindustry/content/blocks/UnitBlocks.java @@ -16,7 +16,7 @@ public class UnitBlocks extends BlockList implements ContentList{ public void load(){ dronePad = new UnitPad("drone-pad"){{ type = UnitTypes.drone; - produceTime = 4300; + produceTime = 5500; size = 2; consumes.power(0.08f); consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.lead, 30)}); @@ -24,7 +24,7 @@ public class UnitBlocks extends BlockList implements ContentList{ fabricatorPad = new UnitPad("fabricator-pad"){{ type = UnitTypes.fabricator; - produceTime = 5000; + produceTime = 7000; size = 2; consumes.power(0.2f); consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80)}); diff --git a/core/src/io/anuke/mindustry/entities/Player.java b/core/src/io/anuke/mindustry/entities/Player.java index 30262b32a9..7896edb520 100644 --- a/core/src/io/anuke/mindustry/entities/Player.java +++ b/core/src/io/anuke/mindustry/entities/Player.java @@ -22,7 +22,6 @@ import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.NetConnection; import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.Mech; -import io.anuke.mindustry.type.Upgrade; import io.anuke.mindustry.type.Weapon; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Tile; @@ -762,13 +761,13 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra byte mechid = stream.readByte(); int index = stream.readByte(); players[index].readSaveSuper(stream); - players[index].mech = Upgrade.getByID(mechid); + players[index].mech = Mech.getByID(mechid); players[index].dead = false; }else if(local){ byte mechid = stream.readByte(); stream.readByte(); readSaveSuper(stream); - mech = Upgrade.getByID(mechid); + mech = Mech.getByID(mechid); dead = false; } } @@ -804,7 +803,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra boolean boosting = (bools & 4) != 0; boolean alt = (bools & 8) != 0; color.set(buffer.readInt()); - mech = Upgrade.getByID(buffer.readByte()); + mech = Mech.getByID(buffer.readByte()); int mine = buffer.readInt(); spawner = buffer.readInt(); float baseRotation = buffer.readShort() / 2f; diff --git a/core/src/io/anuke/mindustry/entities/units/GroundUnit.java b/core/src/io/anuke/mindustry/entities/units/GroundUnit.java index e4be523d19..ea1c93a593 100644 --- a/core/src/io/anuke/mindustry/entities/units/GroundUnit.java +++ b/core/src/io/anuke/mindustry/entities/units/GroundUnit.java @@ -8,7 +8,6 @@ import io.anuke.mindustry.entities.TileEntity; import io.anuke.mindustry.entities.Units; import io.anuke.mindustry.game.Team; import io.anuke.mindustry.type.AmmoType; -import io.anuke.mindustry.type.Upgrade; import io.anuke.mindustry.type.Weapon; import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.blocks.Floor; @@ -211,7 +210,7 @@ public abstract class GroundUnit extends BaseUnit{ @Override public void read(DataInput data, long time) throws IOException{ super.read(data, time); - weapon = Upgrade.getByID(data.readByte()); + weapon = Weapon.getByID(data.readByte()); } @Override @@ -222,7 +221,7 @@ public abstract class GroundUnit extends BaseUnit{ @Override public void readSave(DataInput stream) throws IOException{ - weapon = Upgrade.getByID(stream.readByte()); + weapon = Weapon.getByID(stream.readByte()); super.readSave(stream); } diff --git a/core/src/io/anuke/mindustry/io/TypeIO.java b/core/src/io/anuke/mindustry/io/TypeIO.java index 0fe0887096..dcacc29168 100644 --- a/core/src/io/anuke/mindustry/io/TypeIO.java +++ b/core/src/io/anuke/mindustry/io/TypeIO.java @@ -223,7 +223,7 @@ public class TypeIO{ @ReadClass(Weapon.class) public static Weapon readWeapon(ByteBuffer buffer){ - return Upgrade.getByID(buffer.get()); + return Weapon.getByID(buffer.get()); } @WriteClass(Mech.class) @@ -233,7 +233,7 @@ public class TypeIO{ @ReadClass(Mech.class) public static Mech readMech(ByteBuffer buffer){ - return Upgrade.getByID(buffer.get()); + return Mech.getByID(buffer.get()); } @WriteClass(Liquid.class) diff --git a/core/src/io/anuke/mindustry/type/Mech.java b/core/src/io/anuke/mindustry/type/Mech.java index dd1329f3d1..191d8ac782 100644 --- a/core/src/io/anuke/mindustry/type/Mech.java +++ b/core/src/io/anuke/mindustry/type/Mech.java @@ -2,20 +2,29 @@ package io.anuke.mindustry.type; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.utils.Array; import io.anuke.mindustry.content.Weapons; import io.anuke.mindustry.entities.Player; +import io.anuke.mindustry.game.Content; import io.anuke.mindustry.game.UnlockableContent; import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.ui.ContentDisplay; import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.scene.ui.layout.Table; +import io.anuke.ucore.util.Bundles; import static io.anuke.mindustry.Vars.mobile; //TODO merge unit type with mech -public class Mech extends Upgrade implements UnlockableContent{ - public boolean flying; +public class Mech implements UnlockableContent{ + private static Array mechs = new Array<>(); + private static byte lastid; + public final byte id; + public final String name; + public final String description; + + public boolean flying; public float speed = 1.1f; public float maxSpeed = 1.1f; public float boostSpeed = 0.75f; @@ -39,8 +48,24 @@ public class Mech extends Upgrade implements UnlockableContent{ public TextureRegion baseRegion, legRegion, region, iconRegion; public Mech(String name, boolean flying){ - super(name); this.flying = flying; + this.id = lastid++; + this.name = name; + this.description = Bundles.get("mech." + name + ".description"); + + mechs.add(this); + } + + public static Array all() { + return mechs; + } + + public static Mech getByID(int id){ + return mechs.get(id); + } + + public String localizedName(){ + return Bundles.get("mech." + name + ".name"); } public void updateAlt(Player player){} @@ -92,4 +117,14 @@ public class Mech extends Upgrade implements UnlockableContent{ region = Draw.region(name); iconRegion = Draw.region("mech-icon-" + name); } + + @Override + public String toString(){ + return localizedName(); + } + + @Override + public Array getAll(){ + return all(); + } } diff --git a/core/src/io/anuke/mindustry/type/Upgrade.java b/core/src/io/anuke/mindustry/type/Upgrade.java deleted file mode 100644 index 49157843ec..0000000000 --- a/core/src/io/anuke/mindustry/type/Upgrade.java +++ /dev/null @@ -1,54 +0,0 @@ -package io.anuke.mindustry.type; - -import com.badlogic.gdx.utils.Array; -import io.anuke.mindustry.game.Content; -import io.anuke.ucore.function.Consumer; -import io.anuke.ucore.function.Predicate; -import io.anuke.ucore.util.Bundles; - -public abstract class Upgrade implements Content{ - private static Array upgrades = new Array<>(); - private static byte lastid; - - public final byte id; - public final String name; - public final String description; - - public Upgrade(String name){ - this.id = lastid++; - this.name = name; - this.description = Bundles.get("upgrade." + name + ".description"); - - upgrades.add(this); - } - - public static void forEach(Consumer type, Predicate pred){ - for(Upgrade u : upgrades){ - if(pred.test(u)){ - type.accept((T) u); - } - } - } - - public static Array all(){ - return upgrades; - } - - public static T getByID(byte id){ - return (T) upgrades.get(id); - } - - public String localizedName(){ - return Bundles.get("upgrade." + name + ".name"); - } - - @Override - public String toString(){ - return localizedName(); - } - - @Override - public Array getAll(){ - return all(); - } -} diff --git a/core/src/io/anuke/mindustry/type/Weapon.java b/core/src/io/anuke/mindustry/type/Weapon.java index e900563bdd..30cfaa4495 100644 --- a/core/src/io/anuke/mindustry/type/Weapon.java +++ b/core/src/io/anuke/mindustry/type/Weapon.java @@ -1,6 +1,7 @@ package io.anuke.mindustry.type; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import com.badlogic.gdx.utils.Array; import io.anuke.annotations.Annotations.Loc; import io.anuke.annotations.Annotations.Remote; import io.anuke.mindustry.Vars; @@ -8,6 +9,7 @@ import io.anuke.mindustry.content.fx.Fx; import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.traits.ShooterTrait; +import io.anuke.mindustry.game.Content; import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.net.Net; import io.anuke.ucore.core.Effects; @@ -17,7 +19,13 @@ import io.anuke.ucore.util.Angles; import io.anuke.ucore.util.Mathf; import io.anuke.ucore.util.Translator; -public class Weapon extends Upgrade{ +public class Weapon implements Content{ + private static Array weapons = new Array<>(); + private static byte lastid; + + public final byte id; + public final String name; + /**minimum cursor distance from player, fixes 'cross-eyed' shooting.*/ protected static float minPlayerDist = 20f; /**ammo type map. set with setAmmo()*/ @@ -50,7 +58,9 @@ public class Weapon extends Upgrade{ public TextureRegion equipRegion, region; protected Weapon(String name){ - super(name); + this.id = lastid ++; + this.name = name; + weapons.add(this); } @Remote(targets = Loc.server, called = Loc.both, unreliable = true) @@ -92,6 +102,14 @@ public class Weapon extends Upgrade{ shooter.getTimer().get(shooter.getShootTimer(left), weapon.reload); } + public static Array all() { + return weapons; + } + + public static Weapon getByID(int id){ + return weapons.get(id); + } + @Override public void load(){ equipRegion = Draw.region(name + "-equip"); @@ -103,6 +121,11 @@ public class Weapon extends Upgrade{ return "weapon"; } + @Override + public Array getAll() { + return weapons; + } + public AmmoType getAmmo(){ return ammo; } diff --git a/core/src/io/anuke/mindustry/ui/ItemImage.java b/core/src/io/anuke/mindustry/ui/ItemImage.java index 2ef09241ad..b07b3dba1c 100644 --- a/core/src/io/anuke/mindustry/ui/ItemImage.java +++ b/core/src/io/anuke/mindustry/ui/ItemImage.java @@ -14,7 +14,7 @@ public class ItemImage extends Stack{ public ItemImage(TextureRegion region, Supplier text){ Table t = new Table().left().bottom(); - t.label(text).color(Color.DARK_GRAY).padBottom(-21).get().setFontScale(Unit.dp.scl(0.5f)); + t.label(text).color(Color.DARK_GRAY).padBottom(-20).get().setFontScale(Unit.dp.scl(0.5f)); t.row(); t.label(text).get().setFontScale(Unit.dp.scl(0.5f)); @@ -25,7 +25,7 @@ public class ItemImage extends Stack{ public ItemImage(ItemStack stack){ Table t = new Table().left().bottom(); - t.add(stack.amount + "").color(Color.DARK_GRAY).padBottom(-21).get().setFontScale(Unit.dp.scl(0.5f)); + t.add(stack.amount + "").color(Color.DARK_GRAY).padBottom(-20).get().setFontScale(Unit.dp.scl(0.5f)); t.row(); t.add(stack.amount + "").get().setFontScale(Unit.dp.scl(0.5f)); diff --git a/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java b/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java index 01afb58f3d..8f5289a319 100644 --- a/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java +++ b/core/src/io/anuke/mindustry/ui/dialogs/SettingsMenuDialog.java @@ -139,7 +139,7 @@ public class SettingsMenuDialog extends SettingsDialog{ } if(!gwt){ - graphics.checkPref("multithread", true, threads::setEnabled); + graphics.checkPref("multithread", mobile, threads::setEnabled); if(Settings.getBool("multithread")){ threads.setEnabled(true); diff --git a/packer/src/io/anuke/mindustry/Generators.java b/packer/src/io/anuke/mindustry/Generators.java index 6479115ee9..7e160eda40 100644 --- a/packer/src/io/anuke/mindustry/Generators.java +++ b/packer/src/io/anuke/mindustry/Generators.java @@ -6,7 +6,6 @@ import io.anuke.mindustry.entities.units.UnitType; import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Liquid; import io.anuke.mindustry.type.Mech; -import io.anuke.mindustry.type.Upgrade; import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.blocks.Floor; import io.anuke.mindustry.world.blocks.OreBlock; @@ -72,10 +71,7 @@ public class Generators { }); context.generate("mech-icons", () -> { - for(Upgrade upgrade : Upgrade.all()){ - if(!(upgrade instanceof Mech)) continue; - - Mech mech = (Mech)upgrade; + for(Mech mech : Mech.all()){ mech.load(); mech.weapon.load();