Keybind search bar + modding support
This commit is contained in:
@@ -2,6 +2,7 @@ package mindustry.ai;
|
||||
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.input.*;
|
||||
import arc.scene.style.*;
|
||||
import arc.util.*;
|
||||
import mindustry.ai.types.*;
|
||||
@@ -31,7 +32,7 @@ public class UnitCommand extends MappableContent{
|
||||
/** If true, this command refreshes the list of stances when selected TODO: do not use, this will likely be removed later!*/
|
||||
public boolean refreshOnSelect = false;
|
||||
/** Key to press for this command. */
|
||||
public @Nullable Binding keybind = null;
|
||||
public @Nullable KeyBind keybind = null;
|
||||
|
||||
public UnitCommand(String name, String icon, Func<Unit, AIController> controller){
|
||||
super(name);
|
||||
@@ -40,7 +41,7 @@ public class UnitCommand extends MappableContent{
|
||||
this.controller = controller == null ? u -> null : controller;
|
||||
}
|
||||
|
||||
public UnitCommand(String name, String icon, Binding keybind, Func<Unit, AIController> controller){
|
||||
public UnitCommand(String name, String icon, KeyBind keybind, Func<Unit, AIController> controller){
|
||||
this(name, icon, controller);
|
||||
this.keybind = keybind;
|
||||
}
|
||||
@@ -69,48 +70,48 @@ public class UnitCommand extends MappableContent{
|
||||
|
||||
public static void loadAll(){
|
||||
|
||||
moveCommand = new UnitCommand("move", "right", Binding.unit_command_move, null){{
|
||||
moveCommand = new UnitCommand("move", "right", Binding.unitCommandMove, null){{
|
||||
drawTarget = true;
|
||||
resetTarget = false;
|
||||
}};
|
||||
repairCommand = new UnitCommand("repair", "modeSurvival", Binding.unit_command_repair, u -> new RepairAI());
|
||||
rebuildCommand = new UnitCommand("rebuild", "hammer", Binding.unit_command_rebuild, u -> new BuilderAI());
|
||||
assistCommand = new UnitCommand("assist", "players", Binding.unit_command_assist, u -> {
|
||||
repairCommand = new UnitCommand("repair", "modeSurvival", Binding.unitCommandRepair, u -> new RepairAI());
|
||||
rebuildCommand = new UnitCommand("rebuild", "hammer", Binding.unitCommandRebuild, u -> new BuilderAI());
|
||||
assistCommand = new UnitCommand("assist", "players", Binding.unitCommandAssist, u -> {
|
||||
var ai = new BuilderAI();
|
||||
ai.onlyAssist = true;
|
||||
return ai;
|
||||
});
|
||||
mineCommand = new UnitCommand("mine", "production", Binding.unit_command_mine, u -> new MinerAI()){{
|
||||
mineCommand = new UnitCommand("mine", "production", Binding.unitCommandNine, u -> new MinerAI()){{
|
||||
refreshOnSelect = true;
|
||||
}};
|
||||
boostCommand = new UnitCommand("boost", "up", Binding.unit_command_boost, u -> new BoostAI()){{
|
||||
boostCommand = new UnitCommand("boost", "up", Binding.unitCommandBoost, u -> new BoostAI()){{
|
||||
switchToMove = false;
|
||||
drawTarget = true;
|
||||
resetTarget = false;
|
||||
}};
|
||||
enterPayloadCommand = new UnitCommand("enterPayload", "downOpen", Binding.unit_command_enter_payload, null){{
|
||||
enterPayloadCommand = new UnitCommand("enterPayload", "downOpen", Binding.unitCommandEnterPayload, null){{
|
||||
switchToMove = false;
|
||||
drawTarget = true;
|
||||
resetTarget = false;
|
||||
snapToBuilding = true;
|
||||
}};
|
||||
loadUnitsCommand = new UnitCommand("loadUnits", "upload", Binding.unit_command_load_units, null){{
|
||||
loadUnitsCommand = new UnitCommand("loadUnits", "upload", Binding.unitCommandLoadUnits, null){{
|
||||
switchToMove = false;
|
||||
drawTarget = true;
|
||||
resetTarget = false;
|
||||
}};
|
||||
loadBlocksCommand = new UnitCommand("loadBlocks", "up", Binding.unit_command_load_blocks, null){{
|
||||
loadBlocksCommand = new UnitCommand("loadBlocks", "up", Binding.unitCommandLoadBlocks, null){{
|
||||
switchToMove = false;
|
||||
drawTarget = true;
|
||||
resetTarget = false;
|
||||
exactArrival = true;
|
||||
}};
|
||||
unloadPayloadCommand = new UnitCommand("unloadPayload", "download", Binding.unit_command_unload_payload, null){{
|
||||
unloadPayloadCommand = new UnitCommand("unloadPayload", "download", Binding.unitCommandUnloadPayload, null){{
|
||||
switchToMove = false;
|
||||
drawTarget = true;
|
||||
resetTarget = false;
|
||||
}};
|
||||
loopPayloadCommand = new UnitCommand("loopPayload", "resize", Binding.unit_command_loop_payload, null){{
|
||||
loopPayloadCommand = new UnitCommand("loopPayload", "resize", Binding.unitCommandLoopPayload, null){{
|
||||
switchToMove = false;
|
||||
drawTarget = true;
|
||||
resetTarget = false;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mindustry.ai;
|
||||
|
||||
import arc.*;
|
||||
import arc.input.*;
|
||||
import arc.scene.style.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
@@ -15,9 +16,9 @@ public class UnitStance extends MappableContent{
|
||||
/** Name of UI icon (from Icon class). */
|
||||
public String icon;
|
||||
/** Key to press for this stance. */
|
||||
public @Nullable Binding keybind;
|
||||
public @Nullable KeyBind keybind;
|
||||
|
||||
public UnitStance(String name, String icon, Binding keybind){
|
||||
public UnitStance(String name, String icon, KeyBind keybind){
|
||||
super(name);
|
||||
this.icon = icon;
|
||||
this.keybind = keybind;
|
||||
@@ -46,12 +47,12 @@ public class UnitStance extends MappableContent{
|
||||
}
|
||||
|
||||
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);
|
||||
stop = new UnitStance("stop", "cancel", Binding.cancelOrders);
|
||||
shoot = new UnitStance("shoot", "commandAttack", Binding.unitStanceShoot);
|
||||
holdFire = new UnitStance("holdfire", "none", Binding.unitStanceHoldFire);
|
||||
pursueTarget = new UnitStance("pursuetarget", "right", Binding.unitStancePursueTarget);
|
||||
patrol = new UnitStance("patrol", "refresh", Binding.unitStancePatrol);
|
||||
ram = new UnitStance("ram", "rightOpen", Binding.unitStanceRam);
|
||||
mineAuto = new UnitStance("mineauto", "settings", null);
|
||||
|
||||
//Only vanilla items are supported for now
|
||||
|
||||
Reference in New Issue
Block a user