Skip to content

Commit

Permalink
Made compatible with v143 (1-line change)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mnemotechnician committed Apr 20, 2023
1 parent e53763b commit df2b50c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions mod.hjson
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 1 addition & 3 deletions src/newcontrols/input/AIInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/newcontrols/ui/fragments/ActionPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit df2b50c

Please sign in to comment.