Removed Upgrade class / Buffed units / Bugfixes

This commit is contained in:
Anuken
2018-08-24 09:39:02 -04:00
parent ee835f6514
commit 5e8686db77
15 changed files with 96 additions and 89 deletions

View File

@@ -395,6 +395,7 @@ content.item.name=Items
content.liquid.name=Liquids content.liquid.name=Liquids
content.unit-type.name=Units content.unit-type.name=Units
content.recipe.name=Blocks content.recipe.name=Blocks
content.mech.name=Mechs
item.stone.name=Stone item.stone.name=Stone
item.stone.description=A common raw material. Used for separating and refining into other materials, or melting into lava. 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.oil.name=Oil
liquid.cryofluid.name=Cryofluid 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.explosiveness=[LIGHT_GRAY]Explosiveness: {0}
text.item.flammability=[LIGHT_GRAY]Flammability: {0} text.item.flammability=[LIGHT_GRAY]Flammability: {0}
text.item.radioactivity=[LIGHT_GRAY]Radioactivity: {0} text.item.radioactivity=[LIGHT_GRAY]Radioactivity: {0}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 141 KiB

View File

@@ -16,7 +16,6 @@ import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.graphics.Shaders; import io.anuke.mindustry.graphics.Shaders;
import io.anuke.mindustry.type.ContentList; import io.anuke.mindustry.type.ContentList;
import io.anuke.mindustry.type.Mech; import io.anuke.mindustry.type.Mech;
import io.anuke.mindustry.type.Upgrade;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Core; import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Effects; import io.anuke.ucore.core.Effects;
@@ -45,6 +44,7 @@ public class Mechs implements ContentList{
boostSpeed = 0.85f; boostSpeed = 0.85f;
weapon = Weapons.blaster; weapon = Weapons.blaster;
maxSpeed = 4f; maxSpeed = 4f;
altChargeAlpha = 0.03f;
} }
@Override @Override
@@ -250,6 +250,6 @@ public class Mechs implements ContentList{
@Override @Override
public Array<? extends Content> getAll(){ public Array<? extends Content> getAll(){
return Upgrade.all(); return Mech.all();
} }
} }

View File

@@ -20,7 +20,7 @@ public class UnitTypes implements ContentList{
ammoCapacity = 0; ammoCapacity = 0;
range = 50f; range = 50f;
healSpeed = 0.05f; healSpeed = 0.05f;
health = 45; health = 60;
}}; }};
dagger = new UnitType("dagger", Dagger.class, Dagger::new){{ dagger = new UnitType("dagger", Dagger.class, Dagger::new){{
@@ -29,7 +29,7 @@ public class UnitTypes implements ContentList{
drag = 0.4f; drag = 0.4f;
range = 40f; range = 40f;
weapon = Weapons.chainBlaster; weapon = Weapons.chainBlaster;
health = 90; health = 180;
}}; }};
titan = new UnitType("titan", Titan.class, Titan::new){{ titan = new UnitType("titan", Titan.class, Titan::new){{
@@ -37,8 +37,8 @@ public class UnitTypes implements ContentList{
speed = 0.18f; speed = 0.18f;
drag = 0.4f; drag = 0.4f;
range = 10f; range = 10f;
weapon = Weapons.chainBlaster; weapon = Weapons.flamethrower;
health = 280; health = 500;
}}; }};
interceptor = new UnitType("interceptor", Interceptor.class, Interceptor::new){{ interceptor = new UnitType("interceptor", Interceptor.class, Interceptor::new){{
@@ -47,10 +47,11 @@ public class UnitTypes implements ContentList{
drag = 0.01f; drag = 0.01f;
weapon = Weapons.chainBlaster; weapon = Weapons.chainBlaster;
isFlying = true; isFlying = true;
health = 70;
}}; }};
monsoon = new UnitType("monsoon", Monsoon.class, Monsoon::new){{ monsoon = new UnitType("monsoon", Monsoon.class, Monsoon::new){{
health = 230; health = 250;
speed = 0.2f; speed = 0.2f;
maxVelocity = 1.4f; maxVelocity = 1.4f;
drag = 0.01f; drag = 0.01f;
@@ -67,8 +68,7 @@ public class UnitTypes implements ContentList{
ammoCapacity = 0; ammoCapacity = 0;
range = 70f; range = 70f;
itemCapacity = 70; itemCapacity = 70;
health = 120; health = 220;
health = 45;
buildPower = 0.9f; buildPower = 0.9f;
minePower = 1.1f; minePower = 1.1f;
healSpeed = 0.09f; healSpeed = 0.09f;

View File

@@ -5,7 +5,6 @@ import io.anuke.mindustry.content.fx.Fx;
import io.anuke.mindustry.content.fx.ShootFx; import io.anuke.mindustry.content.fx.ShootFx;
import io.anuke.mindustry.game.Content; import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.type.ContentList; import io.anuke.mindustry.type.ContentList;
import io.anuke.mindustry.type.Upgrade;
import io.anuke.mindustry.type.Weapon; import io.anuke.mindustry.type.Weapon;
public class Weapons implements ContentList{ public class Weapons implements ContentList{
@@ -117,6 +116,6 @@ public class Weapons implements ContentList{
@Override @Override
public Array<? extends Content> getAll(){ public Array<? extends Content> getAll(){
return Upgrade.all(); return Weapon.all();
} }
} }

View File

@@ -16,7 +16,7 @@ public class UnitBlocks extends BlockList implements ContentList{
public void load(){ public void load(){
dronePad = new UnitPad("drone-pad"){{ dronePad = new UnitPad("drone-pad"){{
type = UnitTypes.drone; type = UnitTypes.drone;
produceTime = 4300; produceTime = 5500;
size = 2; size = 2;
consumes.power(0.08f); consumes.power(0.08f);
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 30), new ItemStack(Items.lead, 30)}); 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"){{ fabricatorPad = new UnitPad("fabricator-pad"){{
type = UnitTypes.fabricator; type = UnitTypes.fabricator;
produceTime = 5000; produceTime = 7000;
size = 2; size = 2;
consumes.power(0.2f); consumes.power(0.2f);
consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80)}); consumes.items(new ItemStack[]{new ItemStack(Items.silicon, 70), new ItemStack(Items.lead, 80), new ItemStack(Items.titanium, 80)});

View File

@@ -22,7 +22,6 @@ import io.anuke.mindustry.net.Net;
import io.anuke.mindustry.net.NetConnection; import io.anuke.mindustry.net.NetConnection;
import io.anuke.mindustry.type.ItemStack; import io.anuke.mindustry.type.ItemStack;
import io.anuke.mindustry.type.Mech; import io.anuke.mindustry.type.Mech;
import io.anuke.mindustry.type.Upgrade;
import io.anuke.mindustry.type.Weapon; import io.anuke.mindustry.type.Weapon;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
@@ -762,13 +761,13 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
byte mechid = stream.readByte(); byte mechid = stream.readByte();
int index = stream.readByte(); int index = stream.readByte();
players[index].readSaveSuper(stream); players[index].readSaveSuper(stream);
players[index].mech = Upgrade.getByID(mechid); players[index].mech = Mech.getByID(mechid);
players[index].dead = false; players[index].dead = false;
}else if(local){ }else if(local){
byte mechid = stream.readByte(); byte mechid = stream.readByte();
stream.readByte(); stream.readByte();
readSaveSuper(stream); readSaveSuper(stream);
mech = Upgrade.getByID(mechid); mech = Mech.getByID(mechid);
dead = false; dead = false;
} }
} }
@@ -804,7 +803,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
boolean boosting = (bools & 4) != 0; boolean boosting = (bools & 4) != 0;
boolean alt = (bools & 8) != 0; boolean alt = (bools & 8) != 0;
color.set(buffer.readInt()); color.set(buffer.readInt());
mech = Upgrade.getByID(buffer.readByte()); mech = Mech.getByID(buffer.readByte());
int mine = buffer.readInt(); int mine = buffer.readInt();
spawner = buffer.readInt(); spawner = buffer.readInt();
float baseRotation = buffer.readShort() / 2f; float baseRotation = buffer.readShort() / 2f;

View File

@@ -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.game.Team; import io.anuke.mindustry.game.Team;
import io.anuke.mindustry.type.AmmoType; import io.anuke.mindustry.type.AmmoType;
import io.anuke.mindustry.type.Upgrade;
import io.anuke.mindustry.type.Weapon; import io.anuke.mindustry.type.Weapon;
import io.anuke.mindustry.world.Tile; import io.anuke.mindustry.world.Tile;
import io.anuke.mindustry.world.blocks.Floor; import io.anuke.mindustry.world.blocks.Floor;
@@ -211,7 +210,7 @@ public abstract class GroundUnit extends BaseUnit{
@Override @Override
public void read(DataInput data, long time) throws IOException{ public void read(DataInput data, long time) throws IOException{
super.read(data, time); super.read(data, time);
weapon = Upgrade.getByID(data.readByte()); weapon = Weapon.getByID(data.readByte());
} }
@Override @Override
@@ -222,7 +221,7 @@ public abstract class GroundUnit extends BaseUnit{
@Override @Override
public void readSave(DataInput stream) throws IOException{ public void readSave(DataInput stream) throws IOException{
weapon = Upgrade.getByID(stream.readByte()); weapon = Weapon.getByID(stream.readByte());
super.readSave(stream); super.readSave(stream);
} }

View File

@@ -223,7 +223,7 @@ public class TypeIO{
@ReadClass(Weapon.class) @ReadClass(Weapon.class)
public static Weapon readWeapon(ByteBuffer buffer){ public static Weapon readWeapon(ByteBuffer buffer){
return Upgrade.getByID(buffer.get()); return Weapon.getByID(buffer.get());
} }
@WriteClass(Mech.class) @WriteClass(Mech.class)
@@ -233,7 +233,7 @@ public class TypeIO{
@ReadClass(Mech.class) @ReadClass(Mech.class)
public static Mech readMech(ByteBuffer buffer){ public static Mech readMech(ByteBuffer buffer){
return Upgrade.getByID(buffer.get()); return Mech.getByID(buffer.get());
} }
@WriteClass(Liquid.class) @WriteClass(Liquid.class)

View File

@@ -2,20 +2,29 @@ package io.anuke.mindustry.type;
import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Array;
import io.anuke.mindustry.content.Weapons; import io.anuke.mindustry.content.Weapons;
import io.anuke.mindustry.entities.Player; import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.game.UnlockableContent; import io.anuke.mindustry.game.UnlockableContent;
import io.anuke.mindustry.graphics.Palette; import io.anuke.mindustry.graphics.Palette;
import io.anuke.mindustry.ui.ContentDisplay; import io.anuke.mindustry.ui.ContentDisplay;
import io.anuke.ucore.graphics.Draw; import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.scene.ui.layout.Table; import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Bundles;
import static io.anuke.mindustry.Vars.mobile; import static io.anuke.mindustry.Vars.mobile;
//TODO merge unit type with mech //TODO merge unit type with mech
public class Mech extends Upgrade implements UnlockableContent{ public class Mech implements UnlockableContent{
public boolean flying; private static Array<Mech> 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 speed = 1.1f;
public float maxSpeed = 1.1f; public float maxSpeed = 1.1f;
public float boostSpeed = 0.75f; public float boostSpeed = 0.75f;
@@ -39,8 +48,24 @@ public class Mech extends Upgrade implements UnlockableContent{
public TextureRegion baseRegion, legRegion, region, iconRegion; public TextureRegion baseRegion, legRegion, region, iconRegion;
public Mech(String name, boolean flying){ public Mech(String name, boolean flying){
super(name);
this.flying = flying; this.flying = flying;
this.id = lastid++;
this.name = name;
this.description = Bundles.get("mech." + name + ".description");
mechs.add(this);
}
public static Array<Mech> 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){} public void updateAlt(Player player){}
@@ -92,4 +117,14 @@ public class Mech extends Upgrade implements UnlockableContent{
region = Draw.region(name); region = Draw.region(name);
iconRegion = Draw.region("mech-icon-" + name); iconRegion = Draw.region("mech-icon-" + name);
} }
@Override
public String toString(){
return localizedName();
}
@Override
public Array<? extends Content> getAll(){
return all();
}
} }

View File

@@ -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<Upgrade> 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 <T extends Upgrade> void forEach(Consumer<T> type, Predicate<Upgrade> pred){
for(Upgrade u : upgrades){
if(pred.test(u)){
type.accept((T) u);
}
}
}
public static Array<Upgrade> all(){
return upgrades;
}
public static <T extends Upgrade> 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<? extends Content> getAll(){
return all();
}
}

View File

@@ -1,6 +1,7 @@
package io.anuke.mindustry.type; package io.anuke.mindustry.type;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Array;
import io.anuke.annotations.Annotations.Loc; import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote; import io.anuke.annotations.Annotations.Remote;
import io.anuke.mindustry.Vars; 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.Player;
import io.anuke.mindustry.entities.bullet.Bullet; import io.anuke.mindustry.entities.bullet.Bullet;
import io.anuke.mindustry.entities.traits.ShooterTrait; import io.anuke.mindustry.entities.traits.ShooterTrait;
import io.anuke.mindustry.game.Content;
import io.anuke.mindustry.gen.Call; import io.anuke.mindustry.gen.Call;
import io.anuke.mindustry.net.Net; import io.anuke.mindustry.net.Net;
import io.anuke.ucore.core.Effects; 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.Mathf;
import io.anuke.ucore.util.Translator; import io.anuke.ucore.util.Translator;
public class Weapon extends Upgrade{ public class Weapon implements Content{
private static Array<Weapon> weapons = new Array<>();
private static byte lastid;
public final byte id;
public final String name;
/**minimum cursor distance from player, fixes 'cross-eyed' shooting.*/ /**minimum cursor distance from player, fixes 'cross-eyed' shooting.*/
protected static float minPlayerDist = 20f; protected static float minPlayerDist = 20f;
/**ammo type map. set with setAmmo()*/ /**ammo type map. set with setAmmo()*/
@@ -50,7 +58,9 @@ public class Weapon extends Upgrade{
public TextureRegion equipRegion, region; public TextureRegion equipRegion, region;
protected Weapon(String name){ protected Weapon(String name){
super(name); this.id = lastid ++;
this.name = name;
weapons.add(this);
} }
@Remote(targets = Loc.server, called = Loc.both, unreliable = true) @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); shooter.getTimer().get(shooter.getShootTimer(left), weapon.reload);
} }
public static Array<Weapon> all() {
return weapons;
}
public static Weapon getByID(int id){
return weapons.get(id);
}
@Override @Override
public void load(){ public void load(){
equipRegion = Draw.region(name + "-equip"); equipRegion = Draw.region(name + "-equip");
@@ -103,6 +121,11 @@ public class Weapon extends Upgrade{
return "weapon"; return "weapon";
} }
@Override
public Array<? extends Content> getAll() {
return weapons;
}
public AmmoType getAmmo(){ public AmmoType getAmmo(){
return ammo; return ammo;
} }

View File

@@ -14,7 +14,7 @@ public class ItemImage extends Stack{
public ItemImage(TextureRegion region, Supplier<CharSequence> text){ public ItemImage(TextureRegion region, Supplier<CharSequence> text){
Table t = new Table().left().bottom(); 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.row();
t.label(text).get().setFontScale(Unit.dp.scl(0.5f)); t.label(text).get().setFontScale(Unit.dp.scl(0.5f));
@@ -25,7 +25,7 @@ public class ItemImage extends Stack{
public ItemImage(ItemStack stack){ public ItemImage(ItemStack stack){
Table t = new Table().left().bottom(); 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.row();
t.add(stack.amount + "").get().setFontScale(Unit.dp.scl(0.5f)); t.add(stack.amount + "").get().setFontScale(Unit.dp.scl(0.5f));

View File

@@ -139,7 +139,7 @@ public class SettingsMenuDialog extends SettingsDialog{
} }
if(!gwt){ if(!gwt){
graphics.checkPref("multithread", true, threads::setEnabled); graphics.checkPref("multithread", mobile, threads::setEnabled);
if(Settings.getBool("multithread")){ if(Settings.getBool("multithread")){
threads.setEnabled(true); threads.setEnabled(true);

View File

@@ -6,7 +6,6 @@ import io.anuke.mindustry.entities.units.UnitType;
import io.anuke.mindustry.type.Item; import io.anuke.mindustry.type.Item;
import io.anuke.mindustry.type.Liquid; import io.anuke.mindustry.type.Liquid;
import io.anuke.mindustry.type.Mech; import io.anuke.mindustry.type.Mech;
import io.anuke.mindustry.type.Upgrade;
import io.anuke.mindustry.world.Block; import io.anuke.mindustry.world.Block;
import io.anuke.mindustry.world.blocks.Floor; import io.anuke.mindustry.world.blocks.Floor;
import io.anuke.mindustry.world.blocks.OreBlock; import io.anuke.mindustry.world.blocks.OreBlock;
@@ -72,10 +71,7 @@ public class Generators {
}); });
context.generate("mech-icons", () -> { context.generate("mech-icons", () -> {
for(Upgrade upgrade : Upgrade.all()){ for(Mech mech : Mech.all()){
if(!(upgrade instanceof Mech)) continue;
Mech mech = (Mech)upgrade;
mech.load(); mech.load();
mech.weapon.load(); mech.weapon.load();