Bindings per command/stance

This commit is contained in:
Anuken
2023-09-23 12:02:06 -04:00
parent 2286b54011
commit d63133c720
5 changed files with 67 additions and 62 deletions

View File

@@ -3,7 +3,9 @@ package mindustry.ai;
import arc.*;
import arc.scene.style.*;
import arc.struct.*;
import arc.util.*;
import mindustry.gen.*;
import mindustry.input.*;
public class UnitStance{
/** List of all stances by ID. */
@@ -11,12 +13,12 @@ public class UnitStance{
public static final UnitStance
stop = new UnitStance("stop", "cancel"), //not a real stance, cannot be selected, just cancels ordewrs
shoot = new UnitStance("shoot", "commandAttack"),
holdFire = new UnitStance("holdfire", "none"),
pursueTarget = new UnitStance("pursuetarget", "right"),
patrol = new UnitStance("patrol", "refresh"),
ram = new UnitStance("ram", "rightOpen");
stop = new UnitStance("stop", "cancel", Binding.cancel_orders), //not a real stance, cannot be selected, just cancels ordewrs
shoot = new UnitStance("shoot", "commandAttack", Binding.unit_stance_shoot),
holdFire = new UnitStance("holdfire", "none", Binding.unit_stance_hold_fire),
pursueTarget = new UnitStance("pursuetarget", "right", Binding.unit_stance_pursue_target),
patrol = new UnitStance("patrol", "refresh", Binding.unit_stance_patrol),
ram = new UnitStance("ram", "rightOpen", Binding.unit_stance_ram);
/** Unique ID number. */
public final int id;
@@ -24,10 +26,13 @@ public class UnitStance{
public final String name;
/** Name of UI icon (from Icon class). */
public final String icon;
/** Key to press for this stance. */
public @Nullable Binding keybind = null;
public UnitStance(String name, String icon){
public UnitStance(String name, String icon, Binding keybind){
this.name = name;
this.icon = icon;
this.keybind = keybind;
id = all.size;
all.add(this);