Implemented number key weapon switching
This commit is contained in:
@@ -3,6 +3,7 @@ package io.anuke.mindustry;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
import com.badlogic.gdx.Input.Buttons;
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
|
||||
import io.anuke.mindustry.entities.Weapon;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
@@ -55,6 +56,11 @@ public class Input{
|
||||
Cursors.restoreCursor();
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i ++)
|
||||
if(Inputs.keyUp(Keys.valueOf(""+(i+1))) && getWeapon(i) != null){
|
||||
currentWeapon = getWeapon(i);
|
||||
ui.updateWeapons();
|
||||
}
|
||||
|
||||
if(Inputs.buttonUp(Buttons.LEFT) && recipe != null &&
|
||||
World.validPlace(World.tilex(), World.tiley(), recipe.result) && !ui.hasMouse()){
|
||||
@@ -104,4 +110,25 @@ public class Input{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int currentWeapons(){
|
||||
int i = 0;
|
||||
|
||||
for(Weapon w : Weapon.values())
|
||||
if(weapons.get(w))
|
||||
i ++;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public static Weapon getWeapon(int id){
|
||||
int i = 0;
|
||||
|
||||
for(Weapon w : Weapon.values())
|
||||
if(weapons.get(w))
|
||||
if(i ++ == id)
|
||||
return w;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Vars{
|
||||
public static final float wavespace = 20*60;
|
||||
public static final float enemyspawnspace = 65;
|
||||
public static final float breakduration = 30;
|
||||
public static boolean debug = false;
|
||||
public static boolean debug = true;
|
||||
|
||||
public static final Vector2 vector = new Vector2();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user