Implemented dual wielding

This commit is contained in:
Anuken
2018-01-06 11:43:41 -05:00
parent e5ae5ae122
commit 07bc8a04f6
18 changed files with 60 additions and 177 deletions

View File

@@ -13,8 +13,10 @@ public class UpgradeRecipes {
Weapon.mortar, list(stack(Item.titanium, 40), stack(Item.steel, 60))
);
public ItemStack[] get(Upgrade upgrade){
return recipes.get(upgrade);
private static final ItemStack[] empty = {};
public static ItemStack[] get(Upgrade upgrade){
return recipes.get(upgrade, empty);
}
public static Entries<Upgrade, ItemStack[]> getAllRecipes(){

View File

@@ -30,7 +30,7 @@ public class Weapon extends Upgrade{
multigun = new Weapon("multigun", 6, BulletType.multishot){
{
effect = Fx.shoot2;
inaccuracy = 8f;
inaccuracy = 6f;
}
},
flamer = new Weapon("flamer", 5, BulletType.flame){
@@ -39,7 +39,7 @@ public class Weapon extends Upgrade{
inaccuracy = 12f;
}
},
railgun = new Weapon("railgun", 40, BulletType.sniper){
railgun = new Weapon("railgun", 30, BulletType.sniper){
{
shootsound = "railgun";
effect = Fx.railshoot;
@@ -67,9 +67,11 @@ public class Weapon extends Upgrade{
this.type = type;
}
public void update(Player p){
if(Timers.get(p, "reload", reload)){
shoot(p, p.x, p.y, Angles.mouseAngle(p.x, p.y));
public void update(Player p, boolean left){
if(Timers.get(p, "reload"+left, reload)){
float ang = Angles.mouseAngle(p.x, p.y);
Angles.translation(ang + Mathf.sign(left) * -70f, 2f);
shoot(p, p.x + Angles.x(), p.y + Angles.y(), Angles.mouseAngle(p.x + Angles.x(), p.y + Angles.y()));
}
}