Keybind search bar + modding support
This commit is contained in:
@@ -1,127 +1,109 @@
|
||||
package mindustry.input;
|
||||
|
||||
import arc.KeyBinds.*;
|
||||
import arc.input.InputDevice.*;
|
||||
import arc.input.*;
|
||||
import arc.input.KeyBind.*;
|
||||
import mindustry.*;
|
||||
|
||||
public enum Binding implements KeyBind{
|
||||
move_x(new Axis(KeyCode.a, KeyCode.d), "general"),
|
||||
move_y(new Axis(KeyCode.s, KeyCode.w)),
|
||||
mouse_move(KeyCode.mouseBack),
|
||||
pan(KeyCode.mouseForward),
|
||||
public class Binding{
|
||||
public static final KeyBind
|
||||
|
||||
boost(KeyCode.shiftLeft),
|
||||
respawn(KeyCode.v),
|
||||
control(KeyCode.controlLeft),
|
||||
select(KeyCode.mouseLeft),
|
||||
deselect(KeyCode.mouseRight),
|
||||
break_block(KeyCode.mouseRight),
|
||||
moveX = KeyBind.add("move_x", new Axis(KeyCode.a, KeyCode.d), "general"),
|
||||
moveY = KeyBind.add("move_y", new Axis(KeyCode.s, KeyCode.w)),
|
||||
mouseMove = KeyBind.add("mouse_move", KeyCode.mouseBack),
|
||||
pan = KeyBind.add("pan", KeyCode.mouseForward),
|
||||
|
||||
pickupCargo(KeyCode.leftBracket),
|
||||
dropCargo(KeyCode.rightBracket),
|
||||
boost = KeyBind.add("boost", KeyCode.shiftLeft),
|
||||
respawn = KeyBind.add("respawn", KeyCode.v),
|
||||
control = KeyBind.add("control", KeyCode.controlLeft),
|
||||
select = KeyBind.add("select", KeyCode.mouseLeft),
|
||||
deselect = KeyBind.add("deselect", KeyCode.mouseRight),
|
||||
breakBlock = KeyBind.add("break_block", KeyCode.mouseRight),
|
||||
|
||||
clear_building(KeyCode.q),
|
||||
pause_building(KeyCode.e),
|
||||
rotate(new Axis(KeyCode.scroll)),
|
||||
rotateplaced(KeyCode.r),
|
||||
diagonal_placement(KeyCode.controlLeft),
|
||||
pick(KeyCode.mouseMiddle),
|
||||
pickupCargo = KeyBind.add("pickupCargo", KeyCode.leftBracket),
|
||||
dropCargo = KeyBind.add("dropCargo", KeyCode.rightBracket),
|
||||
|
||||
rebuild_select(KeyCode.b),
|
||||
schematic_select(KeyCode.f),
|
||||
schematic_flip_x(KeyCode.z),
|
||||
schematic_flip_y(KeyCode.x),
|
||||
schematic_menu(KeyCode.t),
|
||||
clearBuilding = KeyBind.add("clear_building", KeyCode.q),
|
||||
pauseBuilding = KeyBind.add("pause_building", KeyCode.e),
|
||||
rotate = KeyBind.add("rotate", new Axis(KeyCode.scroll)),
|
||||
rotatePlaced = KeyBind.add("rotateplaced", KeyCode.r),
|
||||
diagonalPlacement = KeyBind.add("diagonal_placement", KeyCode.controlLeft),
|
||||
pick = KeyBind.add("pick", KeyCode.mouseMiddle),
|
||||
|
||||
rebuildSelect = KeyBind.add("rebuild_select", KeyCode.b),
|
||||
schematicSelect = KeyBind.add("schematic_select", KeyCode.f),
|
||||
schematicFlipX = KeyBind.add("schematic_flip_x", KeyCode.z),
|
||||
schematicFlipY = KeyBind.add("schematic_flip_y", KeyCode.x),
|
||||
schematicMenu = KeyBind.add("schematic_menu", KeyCode.t),
|
||||
|
||||
|
||||
command_mode(KeyCode.shiftLeft, "command"),
|
||||
command_queue(KeyCode.mouseMiddle),
|
||||
create_control_group(KeyCode.controlLeft),
|
||||
commandMode = KeyBind.add("command_mode", KeyCode.shiftLeft, "command"),
|
||||
commandQueue = KeyBind.add("command_queue", KeyCode.mouseMiddle),
|
||||
createControlGroup = KeyBind.add("create_control_group", KeyCode.controlLeft),
|
||||
|
||||
select_all_units(KeyCode.g),
|
||||
select_all_unit_factories(KeyCode.h),
|
||||
selectAllUnits = KeyBind.add("select_all_units", KeyCode.g),
|
||||
selectAllUnitFactories = KeyBind.add("select_all_unit_factories", KeyCode.h),
|
||||
|
||||
cancel_orders(KeyCode.unset),
|
||||
cancelOrders = KeyBind.add("cancel_orders", KeyCode.unset),
|
||||
|
||||
unit_stance_shoot(KeyCode.unset),
|
||||
unit_stance_hold_fire(KeyCode.unset),
|
||||
unit_stance_pursue_target(KeyCode.unset),
|
||||
unit_stance_patrol(KeyCode.unset),
|
||||
unit_stance_ram(KeyCode.unset),
|
||||
unitStanceShoot = KeyBind.add("unit_stance_shoot", KeyCode.unset),
|
||||
unitStanceHoldFire = KeyBind.add("unit_stance_hold_fire", KeyCode.unset),
|
||||
unitStancePursueTarget = KeyBind.add("unit_stance_pursue_target", KeyCode.unset),
|
||||
unitStancePatrol = KeyBind.add("unit_stance_patrol", KeyCode.unset),
|
||||
unitStanceRam = KeyBind.add("unit_stance_ram", KeyCode.unset),
|
||||
|
||||
unit_command_move(KeyCode.unset),
|
||||
unit_command_repair(KeyCode.unset),
|
||||
unit_command_rebuild(KeyCode.unset),
|
||||
unit_command_assist(KeyCode.unset),
|
||||
unit_command_mine(KeyCode.unset),
|
||||
unit_command_boost(KeyCode.unset),
|
||||
unit_command_enter_payload(KeyCode.unset),
|
||||
unit_command_load_units(KeyCode.unset),
|
||||
unit_command_load_blocks(KeyCode.unset),
|
||||
unit_command_unload_payload(KeyCode.unset),
|
||||
unit_command_loop_payload(KeyCode.unset),
|
||||
unitCommandMove = KeyBind.add("unit_command_move", KeyCode.unset),
|
||||
unitCommandRepair = KeyBind.add("unit_command_repair", KeyCode.unset),
|
||||
unitCommandRebuild = KeyBind.add("unit_command_rebuild", KeyCode.unset),
|
||||
unitCommandAssist = KeyBind.add("unit_command_assist", KeyCode.unset),
|
||||
unitCommandNine = KeyBind.add("unit_command_mine", KeyCode.unset),
|
||||
unitCommandBoost = KeyBind.add("unit_command_boost", KeyCode.unset),
|
||||
unitCommandEnterPayload = KeyBind.add("unit_command_enter_payload", KeyCode.unset),
|
||||
unitCommandLoadUnits = KeyBind.add("unit_command_load_units", KeyCode.unset),
|
||||
unitCommandLoadBlocks = KeyBind.add("unit_command_load_blocks", KeyCode.unset),
|
||||
unitCommandUnloadPayload = KeyBind.add("unit_command_unload_payload", KeyCode.unset),
|
||||
unitCommandLoopPayload = KeyBind.add("unit_command_loop_payload", KeyCode.unset),
|
||||
|
||||
category_prev(KeyCode.comma, "blocks"),
|
||||
category_next(KeyCode.period),
|
||||
categoryPrev = KeyBind.add("category_prev", KeyCode.comma, "blocks"),
|
||||
categoryNext = KeyBind.add("category_next", KeyCode.period),
|
||||
|
||||
block_select_left(KeyCode.left),
|
||||
block_select_right(KeyCode.right),
|
||||
block_select_up(KeyCode.up),
|
||||
block_select_down(KeyCode.down),
|
||||
block_select_01(KeyCode.num1),
|
||||
block_select_02(KeyCode.num2),
|
||||
block_select_03(KeyCode.num3),
|
||||
block_select_04(KeyCode.num4),
|
||||
block_select_05(KeyCode.num5),
|
||||
block_select_06(KeyCode.num6),
|
||||
block_select_07(KeyCode.num7),
|
||||
block_select_08(KeyCode.num8),
|
||||
block_select_09(KeyCode.num9),
|
||||
block_select_10(KeyCode.num0),
|
||||
blockSelectLeft = KeyBind.add("block_select_left", KeyCode.left),
|
||||
blockSelectRight = KeyBind.add("block_select_right", KeyCode.right),
|
||||
blockSelectUp = KeyBind.add("block_select_up", KeyCode.up),
|
||||
blockSelectDown = KeyBind.add("block_select_down", KeyCode.down),
|
||||
blockSelect01 = KeyBind.add("block_select_01", KeyCode.num1),
|
||||
blockSelect02 = KeyBind.add("block_select_02", KeyCode.num2),
|
||||
blockSelect03 = KeyBind.add("block_select_03", KeyCode.num3),
|
||||
blockSelect04 = KeyBind.add("block_select_04", KeyCode.num4),
|
||||
blockSelect05 = KeyBind.add("block_select_05", KeyCode.num5),
|
||||
blockSelect06 = KeyBind.add("block_select_06", KeyCode.num6),
|
||||
blockSelect07 = KeyBind.add("block_select_07", KeyCode.num7),
|
||||
blockSelect08 = KeyBind.add("block_select_08", KeyCode.num8),
|
||||
blockSelect09 = KeyBind.add("block_select_09", KeyCode.num9),
|
||||
blockSelect10 = KeyBind.add("block_select_10", KeyCode.num0),
|
||||
|
||||
zoom(new Axis(KeyCode.scroll), "view"),
|
||||
detach_camera(KeyCode.unset),
|
||||
menu(Vars.android ? KeyCode.back : KeyCode.escape),
|
||||
fullscreen(KeyCode.f11),
|
||||
pause(KeyCode.space),
|
||||
skip_wave(KeyCode.unset),
|
||||
minimap(KeyCode.m),
|
||||
research(KeyCode.j),
|
||||
planet_map(KeyCode.n),
|
||||
block_info(KeyCode.f1),
|
||||
toggle_menus(KeyCode.c),
|
||||
screenshot(KeyCode.p),
|
||||
toggle_power_lines(KeyCode.f5),
|
||||
toggle_block_status(KeyCode.f6),
|
||||
player_list(KeyCode.tab, "multiplayer"),
|
||||
chat(KeyCode.enter),
|
||||
chat_history_prev(KeyCode.up),
|
||||
chat_history_next(KeyCode.down),
|
||||
chat_scroll(new Axis(KeyCode.scroll)),
|
||||
chat_mode(KeyCode.tab),
|
||||
console(KeyCode.f8),
|
||||
zoom = KeyBind.add("zoom", new Axis(KeyCode.scroll), "view"),
|
||||
detachCamera = KeyBind.add("detach_camera", KeyCode.unset),
|
||||
menu = KeyBind.add("menu", Vars.android ? KeyCode.back : KeyCode.escape),
|
||||
fullscreen = KeyBind.add("fullscreen", KeyCode.f11),
|
||||
pause = KeyBind.add("pause", KeyCode.space),
|
||||
skipWave = KeyBind.add("skip_wave", KeyCode.unset),
|
||||
minimap = KeyBind.add("minimap", KeyCode.m),
|
||||
research = KeyBind.add("research", KeyCode.j),
|
||||
planetMap = KeyBind.add("planet_map", KeyCode.n),
|
||||
blockInfo = KeyBind.add("block_info", KeyCode.f1),
|
||||
toggleMenus = KeyBind.add("toggle_menus", KeyCode.c),
|
||||
screenshot = KeyBind.add("screenshot", KeyCode.p),
|
||||
togglePowerLines = KeyBind.add("toggle_power_lines", KeyCode.f5),
|
||||
toggleBlockStatus = KeyBind.add("toggle_block_status", KeyCode.f6),
|
||||
playerList = KeyBind.add("player_list", KeyCode.tab, "multiplayer"),
|
||||
chat = KeyBind.add("chat", KeyCode.enter),
|
||||
chatHistoryPrev = KeyBind.add("chat_history_prev", KeyCode.up),
|
||||
chatHistoryNext = KeyBind.add("chat_history_next", KeyCode.down),
|
||||
chatScroll = KeyBind.add("chat_scroll", new Axis(KeyCode.scroll)),
|
||||
chatMode = KeyBind.add("chat_mode", KeyCode.tab),
|
||||
console = KeyBind.add("console", KeyCode.f8)
|
||||
;
|
||||
|
||||
private final KeybindValue defaultValue;
|
||||
private final String category;
|
||||
|
||||
Binding(KeybindValue defaultValue, String category){
|
||||
this.defaultValue = defaultValue;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
Binding(KeybindValue defaultValue){
|
||||
this(defaultValue, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeybindValue defaultValue(DeviceType type){
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String category(){
|
||||
return category;
|
||||
}
|
||||
//dummy static class initializer
|
||||
public static void init(){}
|
||||
}
|
||||
|
||||
@@ -77,14 +77,14 @@ public class DesktopInput extends InputHandler{
|
||||
if(!showHint()) return str;
|
||||
str.setLength(0);
|
||||
if(!isBuilding && !Core.settings.getBool("buildautopause") && !player.unit().isBuilding()){
|
||||
str.append(Core.bundle.format("enablebuilding", Core.keybinds.get(Binding.pause_building).key.toString()));
|
||||
str.append(Core.bundle.format("enablebuilding", Binding.pauseBuilding.value.key.toString()));
|
||||
}else if(player.unit().isBuilding()){
|
||||
str.append(Core.bundle.format(isBuilding ? "pausebuilding" : "resumebuilding", Core.keybinds.get(Binding.pause_building).key.toString()))
|
||||
.append("\n").append(Core.bundle.format("cancelbuilding", Core.keybinds.get(Binding.clear_building).key.toString()))
|
||||
.append("\n").append(Core.bundle.format("selectschematic", Core.keybinds.get(Binding.schematic_select).key.toString()));
|
||||
str.append(Core.bundle.format(isBuilding ? "pausebuilding" : "resumebuilding", Binding.pauseBuilding.value.key.toString()))
|
||||
.append("\n").append(Core.bundle.format("cancelbuilding", Binding.clearBuilding.value.key.toString()))
|
||||
.append("\n").append(Core.bundle.format("selectschematic", Binding.schematicSelect.value.key.toString()));
|
||||
}
|
||||
if(!player.dead() && !player.unit().spawnedByCore()){
|
||||
str.append(str.length() != 0 ? "\n" : "").append(Core.bundle.format("respawn", Core.keybinds.get(Binding.respawn).key.toString()));
|
||||
str.append(str.length() != 0 ? "\n" : "").append(Core.bundle.format("respawn", Binding.respawn.value.key.toString()));
|
||||
}
|
||||
return str;
|
||||
}).style(Styles.outlineLabel);
|
||||
@@ -98,8 +98,8 @@ public class DesktopInput extends InputHandler{
|
||||
t.table(Styles.black6, b -> {
|
||||
b.defaults().left();
|
||||
b.label(() -> Core.bundle.format("schematic.flip",
|
||||
Core.keybinds.get(Binding.schematic_flip_x).key.toString(),
|
||||
Core.keybinds.get(Binding.schematic_flip_y).key.toString())).style(Styles.outlineLabel).visible(() -> Core.settings.getBool("hints"));
|
||||
Binding.schematicFlipX.value.key.toString(),
|
||||
Binding.schematicFlipY.value.key.toString())).style(Styles.outlineLabel).visible(() -> Core.settings.getBool("hints"));
|
||||
b.row();
|
||||
b.table(a -> {
|
||||
a.button("@schematic.add", Icon.save, this::showSchematicSave).colspan(2).size(250f, 50f).disabled(f -> lastSchematic == null || lastSchematic.file != null);
|
||||
@@ -120,14 +120,14 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
//draw break selection
|
||||
if(mode == breaking){
|
||||
drawBreakSelection(selectX, selectY, cursorX, cursorY, !(Core.input.keyDown(Binding.schematic_select) && schemX != -1 && schemY != -1) ? maxLength : Vars.maxSchematicSize, false);
|
||||
drawBreakSelection(selectX, selectY, cursorX, cursorY, !(Core.input.keyDown(Binding.schematicSelect) && schemX != -1 && schemY != -1) ? maxLength : Vars.maxSchematicSize, false);
|
||||
}
|
||||
|
||||
if(!Core.scene.hasKeyboard() && mode != breaking){
|
||||
|
||||
if(Core.input.keyDown(Binding.schematic_select) && schemX != -1 && schemY != -1){
|
||||
if(Core.input.keyDown(Binding.schematicSelect) && schemX != -1 && schemY != -1){
|
||||
drawSelection(schemX, schemY, cursorX, cursorY, Vars.maxSchematicSize);
|
||||
}else if(Core.input.keyDown(Binding.rebuild_select)){
|
||||
}else if(Core.input.keyDown(Binding.rebuildSelect)){
|
||||
drawRebuildSelection(schemX, schemY, cursorX, cursorY);
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ public class DesktopInput extends InputHandler{
|
||||
public void update(){
|
||||
super.update();
|
||||
|
||||
if(net.active() && Core.input.keyTap(Binding.player_list) && (scene.getKeyboardFocus() == null || scene.getKeyboardFocus().isDescendantOf(ui.listfrag.content) || scene.getKeyboardFocus().isDescendantOf(ui.minimapfrag.elem))){
|
||||
if(net.active() && Core.input.keyTap(Binding.playerList) && (scene.getKeyboardFocus() == null || scene.getKeyboardFocus().isDescendantOf(ui.listfrag.content) || scene.getKeyboardFocus().isDescendantOf(ui.minimapfrag.elem))){
|
||||
ui.listfrag.toggle();
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ public class DesktopInput extends InputHandler{
|
||||
boolean detached = settings.getBool("detach-camera", false);
|
||||
|
||||
if(!scene.hasField() && !scene.hasDialog()){
|
||||
if(input.keyTap(Binding.detach_camera)){
|
||||
if(input.keyTap(Binding.detachCamera)){
|
||||
settings.put("detach-camera", detached = !detached);
|
||||
if(!detached){
|
||||
panning = false;
|
||||
@@ -242,7 +242,7 @@ public class DesktopInput extends InputHandler{
|
||||
spectating = null;
|
||||
}
|
||||
|
||||
if((Math.abs(Core.input.axis(Binding.move_x)) > 0 || Math.abs(Core.input.axis(Binding.move_y)) > 0 || input.keyDown(Binding.mouse_move))){
|
||||
if((Math.abs(Core.input.axis(Binding.moveX)) > 0 || Math.abs(Core.input.axis(Binding.moveY)) > 0 || input.keyDown(Binding.mouseMove))){
|
||||
panning = false;
|
||||
spectating = null;
|
||||
}
|
||||
@@ -253,11 +253,11 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
if(!locked){
|
||||
if(((player.dead() || state.isPaused() || detached) && !ui.chatfrag.shown()) && !scene.hasField() && !scene.hasDialog()){
|
||||
if(input.keyDown(Binding.mouse_move)){
|
||||
if(input.keyDown(Binding.mouseMove)){
|
||||
panCam = true;
|
||||
}
|
||||
|
||||
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(camSpeed));
|
||||
Core.camera.position.add(Tmp.v1.setZero().add(Core.input.axis(Binding.moveX), Core.input.axis(Binding.moveY)).nor().scl(camSpeed));
|
||||
}else if((!player.dead() || spectating != null) && !panning){
|
||||
//TODO do not pan
|
||||
Team corePanTeam = state.won ? state.rules.waveTeam : player.team();
|
||||
@@ -277,10 +277,10 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
if(!locked && block == null && !scene.hasField() && !scene.hasDialog() &&
|
||||
//disable command mode when player unit can boost and command mode binding is the same
|
||||
!(!player.dead() && player.unit().type.canBoost && keybinds.get(Binding.command_mode).key == keybinds.get(Binding.boost).key)){
|
||||
!(!player.dead() && player.unit().type.canBoost && Binding.commandMode.value.key == Binding.boost.value.key)){
|
||||
if(settings.getBool("commandmodehold")){
|
||||
commandMode = input.keyDown(Binding.command_mode);
|
||||
}else if(input.keyTap(Binding.command_mode)){
|
||||
commandMode = input.keyDown(Binding.commandMode);
|
||||
}else if(input.keyTap(Binding.commandMode)){
|
||||
commandMode = !commandMode;
|
||||
}
|
||||
}else{
|
||||
@@ -291,7 +291,7 @@ public class DesktopInput extends InputHandler{
|
||||
selectedUnits.removeAll(u -> !u.allowCommand() || !u.isValid() || u.team != player.team());
|
||||
|
||||
if(commandMode && !scene.hasField() && !scene.hasDialog()){
|
||||
if(input.keyTap(Binding.select_all_units)){
|
||||
if(input.keyTap(Binding.selectAllUnits)){
|
||||
selectedUnits.clear();
|
||||
commandBuildings.clear();
|
||||
for(var unit : player.team().data().units){
|
||||
@@ -301,7 +301,7 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
}
|
||||
|
||||
if(input.keyTap(Binding.select_all_unit_factories)){
|
||||
if(input.keyTap(Binding.selectAllUnitFactories)){
|
||||
selectedUnits.clear();
|
||||
commandBuildings.clear();
|
||||
for(var build : player.team().data().buildings){
|
||||
@@ -318,7 +318,7 @@ public class DesktopInput extends InputHandler{
|
||||
if(controlGroups[i] == null) controlGroups[i] = new IntSeq();
|
||||
|
||||
IntSeq group = controlGroups[i];
|
||||
boolean creating = input.keyDown(Binding.create_control_group);
|
||||
boolean creating = input.keyDown(Binding.createControlGroup);
|
||||
|
||||
//clear existing if making a new control group
|
||||
//if any of the control group edit buttons are pressed take the current selection
|
||||
@@ -405,16 +405,16 @@ public class DesktopInput extends InputHandler{
|
||||
|
||||
if(state.isGame() && !scene.hasDialog() && !scene.hasField()){
|
||||
if(Core.input.keyTap(Binding.minimap)) ui.minimapfrag.toggle();
|
||||
if(Core.input.keyTap(Binding.planet_map) && state.isCampaign()) ui.planet.toggle();
|
||||
if(Core.input.keyTap(Binding.planetMap) && state.isCampaign()) ui.planet.toggle();
|
||||
if(Core.input.keyTap(Binding.research) && state.isCampaign()) ui.research.toggle();
|
||||
}
|
||||
|
||||
if(state.isMenu() || Core.scene.hasDialog()) return;
|
||||
|
||||
//zoom camera
|
||||
if((!Core.scene.hasScroll() || Core.input.keyDown(Binding.diagonal_placement)) && !ui.chatfrag.shown() && !ui.consolefrag.shown() && Math.abs(Core.input.axisTap(Binding.zoom)) > 0
|
||||
&& !Core.input.keyDown(Binding.rotateplaced) && (Core.input.keyDown(Binding.diagonal_placement) ||
|
||||
!keybinds.get(Binding.zoom).equals(keybinds.get(Binding.rotate)) || ((!player.isBuilder() || !isPlacing() || !block.rotate) && selectPlans.isEmpty()))){
|
||||
if((!Core.scene.hasScroll() || Core.input.keyDown(Binding.diagonalPlacement)) && !ui.chatfrag.shown() && !ui.consolefrag.shown() && Math.abs(Core.input.axisTap(Binding.zoom)) > 0
|
||||
&& !Core.input.keyDown(Binding.rotatePlaced) && (Core.input.keyDown(Binding.diagonalPlacement) ||
|
||||
!Binding.zoom.value.equals(Binding.rotate.value) || ((!player.isBuilder() || !isPlacing() || !block.rotate) && selectPlans.isEmpty()))){
|
||||
renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ public class DesktopInput extends InputHandler{
|
||||
selectScale = 0f;
|
||||
}
|
||||
|
||||
if(!Core.input.keyDown(Binding.diagonal_placement) && Math.abs((int)Core.input.axisTap(Binding.rotate)) > 0){
|
||||
if(!Core.input.keyDown(Binding.diagonalPlacement) && Math.abs((int)Core.input.axisTap(Binding.rotate)) > 0){
|
||||
rotation = Mathf.mod(rotation + (int)Core.input.axisTap(Binding.rotate), 4);
|
||||
|
||||
if(splan != null){
|
||||
@@ -500,7 +500,7 @@ public class DesktopInput extends InputHandler{
|
||||
cursorType = ui.targetCursor;
|
||||
}
|
||||
|
||||
if(input.keyTap(Binding.command_queue) && keybinds.get(Binding.command_queue).key.type != KeyType.mouse){
|
||||
if(input.keyTap(Binding.commandQueue) && Binding.commandQueue.value.key.type != KeyType.mouse){
|
||||
commandTap(input.mouseX(), input.mouseY(), true);
|
||||
}
|
||||
}
|
||||
@@ -514,7 +514,7 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
|
||||
|
||||
if(cursor.build != null && cursor.interactable(player.team()) && !isPlacing() && Math.abs(Core.input.axisTap(Binding.rotate)) > 0 && Core.input.keyDown(Binding.rotateplaced) && cursor.block().rotate && cursor.block().quickRotate){
|
||||
if(cursor.build != null && cursor.interactable(player.team()) && !isPlacing() && Math.abs(Core.input.axisTap(Binding.rotate)) > 0 && Core.input.keyDown(Binding.rotatePlaced) && cursor.block().rotate && cursor.block().quickRotate){
|
||||
Call.rotateBlock(player, cursor.build, Core.input.axisTap(Binding.rotate) > 0);
|
||||
}
|
||||
}
|
||||
@@ -593,16 +593,16 @@ public class DesktopInput extends InputHandler{
|
||||
player.unit().mineTile = null;
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(Binding.clear_building) && !player.dead()){
|
||||
if(Core.input.keyTap(Binding.clearBuilding) && !player.dead()){
|
||||
player.unit().clearBuilding();
|
||||
}
|
||||
|
||||
if((Core.input.keyTap(Binding.schematic_select) || Core.input.keyTap(Binding.rebuild_select)) && !Core.scene.hasKeyboard() && mode != breaking){
|
||||
if((Core.input.keyTap(Binding.schematicSelect) || Core.input.keyTap(Binding.rebuildSelect)) && !Core.scene.hasKeyboard() && mode != breaking){
|
||||
schemX = rawCursorX;
|
||||
schemY = rawCursorY;
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(Binding.schematic_menu) && !Core.scene.hasKeyboard()){
|
||||
if(Core.input.keyTap(Binding.schematicMenu) && !Core.scene.hasKeyboard()){
|
||||
if(ui.schematics.isShown()){
|
||||
ui.schematics.hide();
|
||||
}else{
|
||||
@@ -610,13 +610,13 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(Binding.clear_building) || isPlacing()){
|
||||
if(Core.input.keyTap(Binding.clearBuilding) || isPlacing()){
|
||||
lastSchematic = null;
|
||||
selectPlans.clear();
|
||||
}
|
||||
|
||||
if(!Core.scene.hasKeyboard() && selectX == -1 && selectY == -1 && schemX != -1 && schemY != -1){
|
||||
if(Core.input.keyRelease(Binding.schematic_select)){
|
||||
if(Core.input.keyRelease(Binding.schematicSelect)){
|
||||
lastSchematic = schematics.create(schemX, schemY, rawCursorX, rawCursorY);
|
||||
useSchematic(lastSchematic);
|
||||
if(selectPlans.isEmpty()){
|
||||
@@ -624,7 +624,7 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
schemX = -1;
|
||||
schemY = -1;
|
||||
}else if(input.keyRelease(Binding.rebuild_select)){
|
||||
}else if(input.keyRelease(Binding.rebuildSelect)){
|
||||
|
||||
rebuildArea(schemX, schemY, rawCursorX, rawCursorY);
|
||||
schemX = -1;
|
||||
@@ -633,11 +633,11 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
|
||||
if(!selectPlans.isEmpty()){
|
||||
if(Core.input.keyTap(Binding.schematic_flip_x)){
|
||||
if(Core.input.keyTap(Binding.schematicFlipX)){
|
||||
flipPlans(selectPlans, true);
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(Binding.schematic_flip_y)){
|
||||
if(Core.input.keyTap(Binding.schematicFlipY)){
|
||||
flipPlans(selectPlans, false);
|
||||
}
|
||||
}
|
||||
@@ -656,7 +656,7 @@ public class DesktopInput extends InputHandler{
|
||||
linePlans.clear();
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(Binding.pause_building)){
|
||||
if(Core.input.keyTap(Binding.pauseBuilding)){
|
||||
isBuilding = !isBuilding;
|
||||
buildWasAutoPaused = false;
|
||||
|
||||
@@ -693,7 +693,7 @@ public class DesktopInput extends InputHandler{
|
||||
tappedOne = false;
|
||||
BuildPlan plan = getPlan(cursorX, cursorY);
|
||||
|
||||
if(Core.input.keyDown(Binding.break_block)){
|
||||
if(Core.input.keyDown(Binding.breakBlock)){
|
||||
mode = none;
|
||||
}else if(!selectPlans.isEmpty()){
|
||||
flushPlans(selectPlans);
|
||||
@@ -732,7 +732,7 @@ public class DesktopInput extends InputHandler{
|
||||
}else if(Core.input.keyTap(Binding.deselect) && !selectPlans.isEmpty()){
|
||||
selectPlans.clear();
|
||||
lastSchematic = null;
|
||||
}else if(Core.input.keyTap(Binding.break_block) && !Core.scene.hasMouse() && player.isBuilder() && !commandMode){
|
||||
}else if(Core.input.keyTap(Binding.breakBlock) && !Core.scene.hasMouse() && player.isBuilder() && !commandMode){
|
||||
//is recalculated because setting the mode to breaking removes potential multiblock cursor offset
|
||||
deleting = false;
|
||||
mode = breaking;
|
||||
@@ -752,7 +752,7 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
|
||||
if(mode == placing && block != null){
|
||||
if(!overrideLineRotation && !Core.input.keyDown(Binding.diagonal_placement) && (selectX != cursorX || selectY != cursorY) && ((int)Core.input.axisTap(Binding.rotate) != 0)){
|
||||
if(!overrideLineRotation && !Core.input.keyDown(Binding.diagonalPlacement) && (selectX != cursorX || selectY != cursorY) && ((int)Core.input.axisTap(Binding.rotate) != 0)){
|
||||
rotation = ((int)((Angles.angle(selectX, selectY, cursorX, cursorY) + 45) / 90f)) % 4;
|
||||
overrideLineRotation = true;
|
||||
}
|
||||
@@ -760,13 +760,13 @@ public class DesktopInput extends InputHandler{
|
||||
overrideLineRotation = false;
|
||||
}
|
||||
|
||||
if(Core.input.keyRelease(Binding.break_block) && Core.input.keyDown(Binding.schematic_select) && mode == breaking){
|
||||
if(Core.input.keyRelease(Binding.breakBlock) && Core.input.keyDown(Binding.schematicSelect) && mode == breaking){
|
||||
lastSchematic = schematics.create(schemX, schemY, rawCursorX, rawCursorY);
|
||||
schemX = -1;
|
||||
schemY = -1;
|
||||
}
|
||||
|
||||
if(Core.input.keyRelease(Binding.break_block) || Core.input.keyRelease(Binding.select)){
|
||||
if(Core.input.keyRelease(Binding.breakBlock) || Core.input.keyRelease(Binding.select)){
|
||||
|
||||
if(mode == placing && block != null){ //touch up while placing, place everything in selection
|
||||
if(input.keyDown(Binding.boost)){
|
||||
@@ -778,7 +778,7 @@ public class DesktopInput extends InputHandler{
|
||||
linePlans.clear();
|
||||
Events.fire(new LineConfirmEvent());
|
||||
}else if(mode == breaking){ //touch up while breaking, break everything in selection
|
||||
removeSelection(selectX, selectY, cursorX, cursorY, !Core.input.keyDown(Binding.schematic_select) ? maxLength : Vars.maxSchematicSize);
|
||||
removeSelection(selectX, selectY, cursorX, cursorY, !Core.input.keyDown(Binding.schematicSelect) ? maxLength : Vars.maxSchematicSize);
|
||||
if(lastSchematic != null){
|
||||
useSchematic(lastSchematic);
|
||||
lastSchematic = null;
|
||||
@@ -808,11 +808,11 @@ public class DesktopInput extends InputHandler{
|
||||
mode = none;
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(Binding.toggle_block_status)){
|
||||
if(Core.input.keyTap(Binding.toggleBlockStatus)){
|
||||
Core.settings.put("blockstatus", !Core.settings.getBool("blockstatus"));
|
||||
}
|
||||
|
||||
if(Core.input.keyTap(Binding.toggle_power_lines)){
|
||||
if(Core.input.keyTap(Binding.togglePowerLines)){
|
||||
if(Core.settings.getInt("lasersopacity") == 0){
|
||||
Core.settings.put("lasersopacity", Core.settings.getInt("preferredlaseropacity", 100));
|
||||
}else{
|
||||
@@ -849,7 +849,7 @@ public class DesktopInput extends InputHandler{
|
||||
commandTap(x, y);
|
||||
}
|
||||
|
||||
if(button == keybinds.get(Binding.command_queue).key){
|
||||
if(button == Binding.commandQueue.value.key){
|
||||
commandTap(x, y, true);
|
||||
}
|
||||
|
||||
@@ -897,8 +897,8 @@ public class DesktopInput extends InputHandler{
|
||||
boolean omni = unit.type.omniMovement;
|
||||
|
||||
float speed = unit.speed();
|
||||
float xa = Core.input.axis(Binding.move_x);
|
||||
float ya = Core.input.axis(Binding.move_y);
|
||||
float xa = Core.input.axis(Binding.moveX);
|
||||
float ya = Core.input.axis(Binding.moveY);
|
||||
boolean boosted = (unit instanceof Mechc && unit.isFlying());
|
||||
|
||||
if(settings.getBool("detach-camera")){
|
||||
@@ -912,7 +912,7 @@ public class DesktopInput extends InputHandler{
|
||||
}
|
||||
}else{
|
||||
movement.set(xa, ya).nor().scl(speed);
|
||||
if(Core.input.keyDown(Binding.mouse_move)){
|
||||
if(Core.input.keyDown(Binding.mouseMove)){
|
||||
movement.add(input.mouseWorld().sub(player).scl(1f / 25f * speed)).limit(speed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,17 +62,17 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
final static int maxLength = 100;
|
||||
final static Rect r1 = new Rect(), r2 = new Rect();
|
||||
final static Seq<Unit> tmpUnits = new Seq<>(false);
|
||||
final static Binding[] controlGroupBindings = {
|
||||
Binding.block_select_01,
|
||||
Binding.block_select_02,
|
||||
Binding.block_select_03,
|
||||
Binding.block_select_04,
|
||||
Binding.block_select_05,
|
||||
Binding.block_select_06,
|
||||
Binding.block_select_07,
|
||||
Binding.block_select_08,
|
||||
Binding.block_select_09,
|
||||
Binding.block_select_10
|
||||
final static KeyBind[] controlGroupBindings = {
|
||||
Binding.blockSelect01,
|
||||
Binding.blockSelect02,
|
||||
Binding.blockSelect03,
|
||||
Binding.blockSelect04,
|
||||
Binding.blockSelect05,
|
||||
Binding.blockSelect06,
|
||||
Binding.blockSelect07,
|
||||
Binding.blockSelect08,
|
||||
Binding.blockSelect09,
|
||||
Binding.blockSelect10
|
||||
};
|
||||
|
||||
/** If true, there is a cutscene currently occurring in logic. */
|
||||
@@ -1905,7 +1905,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
}
|
||||
|
||||
public boolean isRebuildSelecting(){
|
||||
return input.keyDown(Binding.rebuild_select);
|
||||
return input.keyDown(Binding.rebuildSelect);
|
||||
}
|
||||
|
||||
public float mouseAngle(float x, float y){
|
||||
@@ -2161,7 +2161,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
||||
|
||||
void iterateLine(int startX, int startY, int endX, int endY, Cons<PlaceLine> cons){
|
||||
Seq<Point2> points;
|
||||
boolean diagonal = Core.input.keyDown(Binding.diagonal_placement);
|
||||
boolean diagonal = Core.input.keyDown(Binding.diagonalPlacement);
|
||||
|
||||
if(Core.settings.getBool("swapdiagonal") && mobile){
|
||||
diagonal = !diagonal;
|
||||
|
||||
@@ -778,14 +778,14 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
}
|
||||
|
||||
//zoom camera
|
||||
if(!locked && !scene.hasKeyboard() && !scene.hasScroll() && Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && !Core.input.keyDown(Binding.rotateplaced) && (Core.input.keyDown(Binding.diagonal_placement) || ((!player.isBuilder() || !isPlacing() || !block.rotate) && selectPlans.isEmpty()))){
|
||||
if(!locked && !scene.hasKeyboard() && !scene.hasScroll() && Math.abs(Core.input.axisTap(Binding.zoom)) > 0 && !Core.input.keyDown(Binding.rotatePlaced) && (Core.input.keyDown(Binding.diagonalPlacement) || ((!player.isBuilder() || !isPlacing() || !block.rotate) && selectPlans.isEmpty()))){
|
||||
renderer.scaleCamera(Core.input.axisTap(Binding.zoom));
|
||||
}
|
||||
|
||||
if(!Core.settings.getBool("keyboard") && !locked && !scene.hasKeyboard()){
|
||||
//move camera around
|
||||
float camSpeed = 6f;
|
||||
Vec2 delta = Tmp.v1.setZero().add(Core.input.axis(Binding.move_x), Core.input.axis(Binding.move_y)).nor().scl(Time.delta * camSpeed);
|
||||
Vec2 delta = Tmp.v1.setZero().add(Core.input.axis(Binding.moveX), Core.input.axis(Binding.moveY)).nor().scl(Time.delta * camSpeed);
|
||||
Core.camera.position.add(delta);
|
||||
if(!delta.isZero()){
|
||||
spectating = null;
|
||||
|
||||
Reference in New Issue
Block a user