Commands are now content

This commit is contained in:
Anuken
2023-09-23 17:10:19 -04:00
parent cafec1386c
commit 276245bf3c
7 changed files with 107 additions and 66 deletions

View File

@@ -4,37 +4,27 @@ import arc.*;
import arc.scene.style.*;
import arc.struct.*;
import arc.util.*;
import mindustry.ctype.*;
import mindustry.gen.*;
import mindustry.input.*;
public class UnitStance{
/** List of all stances by ID. */
public class UnitStance extends MappableContent{
/** @deprecated now a content type, use the methods in Vars.content instead */
@Deprecated
public static final Seq<UnitStance> all = new Seq<>();
public static final UnitStance
public static UnitStance stop, shoot, holdFire, pursueTarget, patrol, ram;
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;
/** Named used for tooltip/description. */
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, Binding keybind){
this.name = name;
super(name);
this.icon = icon;
this.keybind = keybind;
id = all.size;
all.add(this);
}
@@ -50,8 +40,22 @@ public class UnitStance{
return (char) Iconc.codes.get(icon, Iconc.cancel);
}
@Override
public ContentType getContentType(){
return ContentType.unitStance;
}
@Override
public String toString(){
return "UnitStance:" + name;
}
public static void loadAll(){
stop = new UnitStance("stop", "cancel", Binding.cancel_orders);
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);
}
}