From df2b50cd1cedb2308e7905230762fa30c149954b Mon Sep 17 00:00:00 2001 From: Mnemotechnician Date: Thu, 20 Apr 2023 13:39:09 +0300 Subject: [PATCH] Made compatible with v143 (1-line change) --- mod.hjson | 8 ++++---- src/newcontrols/input/AIInput.java | 4 +--- src/newcontrols/ui/fragments/ActionPanel.java | 3 ++- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/mod.hjson b/mod.hjson index 7db4496..e9e2c8b 100644 --- a/mod.hjson +++ b/mod.hjson @@ -1,13 +1,13 @@ -#!VERSION 1.12 +#!VERSION 1.13 #!BRANCH "master" #!REPO "Mnemotechnician/New-Controls-Public" #!NO_UPDATE 1 displayName: "New controls" name: "newcontrols" -author: "Мнемотехник" -description: "This mod is multiplayer-compatible!\n\nSo, basically... This mod adds new ways of controlling your unit (mostly for mobile): fully manual and fully ai.\n\nManual mode consists of two thumbsticks and an action panel.\nAi mode includes three actions (attack, mine, patrol) + auto action selection.\n\nCheck readme.md for detailed info." -version: 1.1.2 +author: "Mnemotechnician" +description: "This mod is multiplayer-compatible!\n\nThis mod adds new ways of controlling your unit (mostly for mobile): fully manual and fully automatic.\n\nThe manual mode enables you to control your unit with two joysticks and a control panel.\n The AI mode includes three automatic actions (attack, mine, patrol) + automatic action selection.\n\nCheck readme.md for detailed info." +version: 1.1.3 minGameVersion: 143.1 hidden: true diff --git a/src/newcontrols/input/AIInput.java b/src/newcontrols/input/AIInput.java index f570b9b..8ad4b92 100644 --- a/src/newcontrols/input/AIInput.java +++ b/src/newcontrols/input/AIInput.java @@ -28,7 +28,6 @@ * Emulates basic player actions && handles thumbstick controls, configurable. */ public class AIInput extends InputHandler { - public enum AIAction {NONE, AUTO, ATTACK, MINE, PATROL, IDLE} public Interval updateInterval = new Interval(4); @@ -126,7 +125,6 @@ protected boolean tileTappedH(Building build) { if (build == null) { inv.hide(); config.hideConfig(); - commandBuild = null; return false; } boolean consumed = false, showedInventory = false; @@ -145,7 +143,7 @@ protected boolean tileTappedH(Building build) { } //otherwise... } else if (!config.hasConfigMouse()) { //make sure a configuration fragment isn't on the cursor - //then, if it's shown and the current block 'agrees' to hide, hide it. + //then if it's shown and the current block 'agrees' to hide, hide it. if (config.isShown() && config.getSelected().onConfigureBuildTapped(build)) { consumed = true; config.hideConfig(); diff --git a/src/newcontrols/ui/fragments/ActionPanel.java b/src/newcontrols/ui/fragments/ActionPanel.java index e3849cb..970f9b9 100644 --- a/src/newcontrols/ui/fragments/ActionPanel.java +++ b/src/newcontrols/ui/fragments/ActionPanel.java @@ -75,7 +75,8 @@ public static void buildPortrait(Table origin, final AIInput input) { protected static void unitPickup() { // todo migrate to kotlin if i'm ever going to continue this // because java sucks. imagine not understanding that [self] is a (Unit & Payloadc). - if (!(player.unit() instanceof Payloadc pay)) return; + if (!(player.unit() instanceof Payloadc)) return; + Payloadc pay = (Payloadc) player.unit(); Unit self = player.unit(); Unit target = Units.closest(player.team(), self.x, self.y, 8f, u -> u != self && u.isGrounded() && pay.canPickup(u) && u.within(self, u.hitSize + 8f));