Class InputHandler

java.lang.Object
mindustry.input.InputHandler
All Implemented Interfaces:
GestureDetector.GestureListener, InputProcessor
Direct Known Subclasses:
DesktopInput, MobileInput

public abstract class InputHandler extends Object implements InputProcessor, GestureDetector.GestureListener
  • Field Details

    • logicCutscene

      public boolean logicCutscene
      If true, there is a cutscene currently occurring in logic.
    • logicCamPan

      public Vec2 logicCamPan
    • logicCamSpeed

      public float logicCamSpeed
    • logicCutsceneZoom

      public float logicCutsceneZoom
    • inputLocks

      public Seq<Boolp> inputLocks
      If any of these functions return true, input is locked.
    • controlInterval

      public Interval controlInterval
    • block

      @Nullable public Block block
    • overrideLineRotation

      public boolean overrideLineRotation
    • rotation

      public int rotation
    • droppingItem

      public boolean droppingItem
    • uiGroup

      public Group uiGroup
    • isBuilding

      public boolean isBuilding
    • buildWasAutoPaused

      public boolean buildWasAutoPaused
    • wasShooting

      public boolean wasShooting
    • controlledType

      @Nullable public UnitType controlledType
    • recentRespawnTimer

      public float recentRespawnTimer
    • lastSchematic

      @Nullable public Schematic lastSchematic
    • detector

      public GestureDetector detector
    • line

      public mindustry.input.InputHandler.PlaceLine line
    • resultplan

      public BuildPlan resultplan
    • bplan

      public BuildPlan bplan
    • linePlans

      public Seq<BuildPlan> linePlans
    • selectPlans

      public Seq<BuildPlan> selectPlans
    • selectedUnits

      public Seq<mindustry.gen.Unit> selectedUnits
    • commandBuildings

      public Seq<mindustry.gen.Building> commandBuildings
    • commandMode

      public boolean commandMode
    • commandRect

      public boolean commandRect
    • tappedOne

      public boolean tappedOne
    • commandRectX

      public float commandRectX
    • commandRectY

      public float commandRectY
    • inv

      public final BlockInventoryFragment inv
    • config

      public final BlockConfigFragment config
  • Constructor Details

    • InputHandler

      public InputHandler()
  • Method Details

    • transferItemEffect

      public static void transferItemEffect(Item item, float x, float y, mindustry.gen.Itemsc to)
    • takeItems

      public static void takeItems(mindustry.gen.Building build, Item item, int amount, mindustry.gen.Unit to)
    • transferItemToUnit

      public static void transferItemToUnit(Item item, float x, float y, mindustry.gen.Itemsc to)
    • setItem

      public static void setItem(mindustry.gen.Building build, Item item, int amount)
    • clearItems

      public static void clearItems(mindustry.gen.Building build)
    • transferItemTo

      public static void transferItemTo(@Nullable mindustry.gen.Unit unit, Item item, int amount, float x, float y, mindustry.gen.Building build)
    • deletePlans

      public static void deletePlans(mindustry.gen.Player player, int[] positions)
    • createItemTransfer

      public static void createItemTransfer(Item item, int amount, float x, float y, Position to, Runnable done)
    • commandUnits

      public static void commandUnits(mindustry.gen.Player player, int[] unitIds, @Nullable mindustry.gen.Building buildTarget, @Nullable mindustry.gen.Unit unitTarget, @Nullable Vec2 posTarget)
    • setUnitCommand

      public static void setUnitCommand(mindustry.gen.Player player, int[] unitIds, UnitCommand command)
    • commandBuilding

      public static void commandBuilding(mindustry.gen.Player player, int[] buildings, Vec2 target)
    • requestItem

      public static void requestItem(mindustry.gen.Player player, mindustry.gen.Building build, Item item, int amount)
    • transferInventory

      public static void transferInventory(mindustry.gen.Player player, mindustry.gen.Building build)
    • removeQueueBlock

      public static void removeQueueBlock(int x, int y, boolean breaking)
    • requestUnitPayload

      public static void requestUnitPayload(mindustry.gen.Player player, mindustry.gen.Unit target)
    • requestBuildPayload

      public static void requestBuildPayload(mindustry.gen.Player player, mindustry.gen.Building build)
    • pickedUnitPayload

      public static void pickedUnitPayload(mindustry.gen.Unit unit, mindustry.gen.Unit target)
    • pickedBuildPayload

      public static void pickedBuildPayload(mindustry.gen.Unit unit, mindustry.gen.Building build, boolean onGround)
    • requestDropPayload

      public static void requestDropPayload(mindustry.gen.Player player, float x, float y)
    • payloadDropped

      public static void payloadDropped(mindustry.gen.Unit unit, float x, float y)
    • dropItem

      public static void dropItem(mindustry.gen.Player player, float angle)
    • rotateBlock

      public static void rotateBlock(@Nullable mindustry.gen.Player player, mindustry.gen.Building build, boolean direction)
    • tileConfig

      public static void tileConfig(@Nullable mindustry.gen.Player player, mindustry.gen.Building build, @Nullable Object value)
    • tileTap

      public static void tileTap(@Nullable mindustry.gen.Player player, Tile tile)
    • buildingControlSelect

      public static void buildingControlSelect(mindustry.gen.Player player, mindustry.gen.Building build)
    • unitBuildingControlSelect

      public static void unitBuildingControlSelect(mindustry.gen.Unit unit, mindustry.gen.Building build)
    • unitControl

      public static void unitControl(mindustry.gen.Player player, @Nullable mindustry.gen.Unit unit)
    • unitClear

      public static void unitClear(mindustry.gen.Player player)
    • addLock

      public void addLock(Boolp lock)
      Adds an input lock; if this function returns true, input is locked. Used for mod 'cutscenes' or custom camera panning.
    • locked

      public boolean locked()
      Returns:
      whether most input is locked, for 'cutscenes'
    • allPlans

      public Eachable<BuildPlan> allPlans()
    • isUsingSchematic

      public boolean isUsingSchematic()
    • update

      public void update()
    • checkUnit

      public void checkUnit()
    • tryPickupPayload

      public void tryPickupPayload()
    • tryDropPayload

      public void tryDropPayload()
    • getMouseX

      public float getMouseX()
    • getMouseY

      public float getMouseY()
    • buildPlacementUI

      public void buildPlacementUI(Table table)
    • buildUI

      public void buildUI(Group group)
    • updateState

      public void updateState()
    • multiUnitSelect

      public boolean multiUnitSelect()
    • selectUnitsRect

      public void selectUnitsRect()
    • selectTypedUnits

      public void selectTypedUnits()
    • tapCommandUnit

      public void tapCommandUnit()
    • commandTap

      public void commandTap(float screenX, float screenY)
    • drawCommand

      public void drawCommand(mindustry.gen.Unit sel)
    • drawCommanded

      public void drawCommanded()
    • drawBottom

      public void drawBottom()
    • drawTop

      public void drawTop()
    • drawOverSelect

      public void drawOverSelect()
    • drawSelected

      public void drawSelected(int x, int y, Block block, Color color)
    • drawBreaking

      public void drawBreaking(BuildPlan plan)
    • drawOverlapCheck

      public void drawOverlapCheck(Block block, int cursorX, int cursorY, boolean valid)
    • planMatches

      public boolean planMatches(BuildPlan plan)
    • drawBreaking

      public void drawBreaking(int x, int y)
    • useSchematic

      public void useSchematic(Schematic schem)
    • showSchematicSave

      protected void showSchematicSave()
    • rotatePlans

      public void rotatePlans(Seq<BuildPlan> plans, int direction)
    • flipPlans

      public void flipPlans(Seq<BuildPlan> plans, boolean x)
    • schemOriginX

      protected int schemOriginX()
    • schemOriginY

      protected int schemOriginY()
    • getPlan

      @Nullable protected BuildPlan getPlan(int x, int y)
      Returns:
      the selection plan that overlaps this position, or null.
    • getPlan

      @Nullable protected BuildPlan getPlan(int x, int y, int size, BuildPlan skip)
      Returns the selection plan that overlaps this position, or null.
    • drawBreakSelection

      protected void drawBreakSelection(int x1, int y1, int x2, int y2, int maxLength)
    • drawRebuildSelection

      protected void drawRebuildSelection(int x, int y, int x2, int y2)
    • drawBreakSelection

      protected void drawBreakSelection(int x1, int y1, int x2, int y2)
    • drawSelection

      protected void drawSelection(int x1, int y1, int x2, int y2, int maxLength)
    • drawSelection

      protected void drawSelection(int x1, int y1, int x2, int y2, int maxLength, Color col1, Color col2)
    • flushSelectPlans

      protected void flushSelectPlans(Seq<BuildPlan> plans)
    • flushPlansReverse

      protected void flushPlansReverse(Seq<BuildPlan> plans)
    • flushPlans

      protected void flushPlans(Seq<BuildPlan> plans)
    • drawOverPlan

      protected void drawOverPlan(BuildPlan plan)
    • drawOverPlan

      protected void drawOverPlan(BuildPlan plan, boolean valid)
    • drawPlan

      protected void drawPlan(BuildPlan plan)
    • drawPlan

      protected void drawPlan(BuildPlan plan, boolean valid)
    • drawPlan

      protected void drawPlan(int x, int y, Block block, int rotation)
      Draws a placement icon for a specific block.
    • removeSelection

      protected void removeSelection(int x1, int y1, int x2, int y2)
      Remove everything from the queue in a selection.
    • removeSelection

      protected void removeSelection(int x1, int y1, int x2, int y2, int maxLength)
      Remove everything from the queue in a selection.
    • removeSelection

      protected void removeSelection(int x1, int y1, int x2, int y2, boolean flush)
      Remove everything from the queue in a selection.
    • removeSelection

      protected void removeSelection(int x1, int y1, int x2, int y2, boolean flush, int maxLength)
      Remove everything from the queue in a selection.
    • updateLine

      protected void updateLine(int x1, int y1, int x2, int y2)
    • updateLine

      protected void updateLine(int x1, int y1)
    • panCamera

      public void panCamera(Vec2 position)
      Forces the camera to a position and enables panning on desktop.
    • selectedBlock

      public boolean selectedBlock()
    • isPlacing

      public boolean isPlacing()
    • isBreaking

      public boolean isBreaking()
    • isRebuildSelecting

      public boolean isRebuildSelecting()
    • mouseAngle

      public float mouseAngle(float x, float y)
    • selectedUnit

      @Nullable public mindustry.gen.Unit selectedUnit()
    • selectedControlBuild

      @Nullable public mindustry.gen.Building selectedControlBuild()
    • selectedCommandUnit

      @Nullable public mindustry.gen.Unit selectedCommandUnit(float x, float y)
    • selectedEnemyUnit

      @Nullable public mindustry.gen.Unit selectedEnemyUnit(float x, float y)
    • selectedCommandUnits

      public Seq<mindustry.gen.Unit> selectedCommandUnits(float x, float y, float w, float h, Boolf<mindustry.gen.Unit> predicate)
    • selectedCommandUnits

      public Seq<mindustry.gen.Unit> selectedCommandUnits(float x, float y, float w, float h)
    • remove

      public void remove()
    • add

      public void add()
    • canShoot

      public boolean canShoot()
    • onConfigurable

      public boolean onConfigurable()
    • isDroppingItem

      public boolean isDroppingItem()
    • canDropItem

      public boolean canDropItem()
    • tryDropItems

      public void tryDropItems(@Nullable mindustry.gen.Building build, float x, float y)
    • rebuildArea

      public void rebuildArea(int x, int y, int x2, int y2)
    • tryBreakBlock

      public void tryBreakBlock(int x, int y)
    • validPlace

      public boolean validPlace(int x, int y, Block type, int rotation)
    • validPlace

      public boolean validPlace(int x, int y, Block type, int rotation, BuildPlan ignore)
    • validBreak

      public boolean validBreak(int x, int y)
    • breakBlock

      public void breakBlock(int x, int y)
    • drawArrow

      public void drawArrow(Block block, int x, int y, int rotation)
    • drawArrow

      public void drawArrow(Block block, int x, int y, int rotation, boolean valid)