Package mindustry.input
Class InputHandler
java.lang.Object
mindustry.input.InputHandler
- All Implemented Interfaces:
arc.input.GestureDetector.GestureListener
,arc.input.InputProcessor
- Direct Known Subclasses:
DesktopInput
,MobileInput
public abstract class InputHandler
extends Object
implements arc.input.InputProcessor, arc.input.GestureDetector.GestureListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
arc.struct.Seq<mindustry.gen.Building>
boolean
boolean
float
float
final BlockConfigFragment
arc.struct.IntSeq[]
Groups of units saved to different hotkeysarc.util.Interval
arc.input.GestureDetector
boolean
arc.struct.Seq<arc.func.Boolp>
If any of these functions return true, input is locked.final BlockInventoryFragment
boolean
float
arc.struct.Queue<BuildPlan>
mindustry.gen.Unit
mindustry.input.InputHandler.PlaceLine
arc.struct.Seq<BuildPlan>
arc.math.geom.Vec2
float
boolean
If true, there is a cutscene currently occurring in logic.float
boolean
final PlanConfigFragment
float
int
arc.struct.Seq<mindustry.gen.Unit>
arc.struct.Seq<BuildPlan>
mindustry.gen.Unit
boolean
arc.scene.Group
boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add()
void
addLock
(arc.func.Boolp lock) Adds an input lock; if this function returns true, input is locked.arc.util.Eachable<BuildPlan>
allPlans()
void
breakBlock
(int x, int y) static void
buildingControlSelect
(mindustry.gen.Player player, mindustry.gen.Building build) void
buildPlacementUI
(arc.scene.ui.layout.Table table) void
buildUI
(arc.scene.Group group) boolean
boolean
canShoot()
void
static void
clearItems
(mindustry.gen.Building build) static void
commandBuilding
(mindustry.gen.Player player, int[] buildings, arc.math.geom.Vec2 target) void
commandTap
(float screenX, float screenY) void
commandTap
(float screenX, float screenY, boolean queue) static void
commandUnits
(mindustry.gen.Player player, int[] unitIds, mindustry.gen.Building buildTarget, mindustry.gen.Unit unitTarget, arc.math.geom.Vec2 posTarget, boolean queueCommand, boolean finalBatch) static void
createItemTransfer
(Item item, int amount, float x, float y, arc.math.geom.Position to, Runnable done) static void
deletePlans
(mindustry.gen.Player player, int[] positions) void
void
void
void
drawBreaking
(int x, int y) void
drawBreaking
(BuildPlan plan) protected void
drawBreakSelection
(int x1, int y1, int x2, int y2) protected void
drawBreakSelection
(int x1, int y1, int x2, int y2, int maxLength) protected void
drawBreakSelection
(int x1, int y1, int x2, int y2, int maxLength, boolean useSelectPlans) void
drawCommand
(mindustry.gen.Unit sel) void
void
drawCommanded
(boolean flying) void
drawOverlapCheck
(Block block, int cursorX, int cursorY, boolean valid) protected void
drawOverPlan
(BuildPlan plan) protected void
drawOverPlan
(BuildPlan plan, boolean valid) void
protected void
Draws a placement icon for a specific block.protected void
protected void
protected void
drawRebuildSelection
(int x1, int y1, int x2, int y2) void
drawSelected
(int x, int y, Block block, arc.graphics.Color color) protected void
drawSelection
(int x1, int y1, int x2, int y2, int maxLength) protected void
drawSelection
(int x1, int y1, int x2, int y2, int maxLength, arc.graphics.Color col1, arc.graphics.Color col2) void
drawTop()
void
static void
dropItem
(mindustry.gen.Player player, float angle) void
protected void
flushPlans
(arc.struct.Seq<BuildPlan> plans) protected void
flushPlansReverse
(arc.struct.Seq<BuildPlan> plans) protected void
flushSelectPlans
(arc.struct.Seq<BuildPlan> plans) float
float
protected BuildPlan
getPlan
(int x, int y) protected BuildPlan
Returns the selection plan that overlaps this position, or null.boolean
boolean
boolean
boolean
boolean
boolean
locked()
float
mouseAngle
(float x, float y) boolean
boolean
void
panCamera
(arc.math.geom.Vec2 position) Forces the camera to a position and enables panning on desktop.static void
payloadDropped
(mindustry.gen.Unit unit, float x, float y) static void
pickedBuildPayload
(mindustry.gen.Unit unit, mindustry.gen.Building build, boolean onGround) static void
pickedUnitPayload
(mindustry.gen.Unit unit, mindustry.gen.Unit target) boolean
planMatches
(BuildPlan plan) void
rebuildArea
(int x1, int y1, int x2, int y2) void
remove()
static void
removeQueueBlock
(int x, int y, boolean breaking) protected void
removeSelection
(int x1, int y1, int x2, int y2) Remove everything from the queue in a selection.protected void
removeSelection
(int x1, int y1, int x2, int y2, boolean flush) Remove everything from the queue in a selection.protected void
removeSelection
(int x1, int y1, int x2, int y2, boolean flush, int maxLength) Remove everything from the queue in a selection.protected void
removeSelection
(int x1, int y1, int x2, int y2, int maxLength) Remove everything from the queue in a selection.static void
requestBuildPayload
(mindustry.gen.Player player, mindustry.gen.Building build) static void
requestDropPayload
(mindustry.gen.Player player, float x, float y) static void
requestItem
(mindustry.gen.Player player, mindustry.gen.Building build, Item item, int amount) static void
requestUnitPayload
(mindustry.gen.Player player, mindustry.gen.Unit target) static void
rotateBlock
(mindustry.gen.Player player, mindustry.gen.Building build, boolean direction) void
rotatePlans
(arc.struct.Seq<BuildPlan> plans, int direction) protected int
protected int
boolean
mindustry.gen.Unit
selectedCommandUnit
(float x, float y) arc.struct.Seq<mindustry.gen.Unit>
selectedCommandUnits
(float x, float y, float w, float h) arc.struct.Seq<mindustry.gen.Unit>
selectedCommandUnits
(float x, float y, float w, float h, arc.func.Boolf<mindustry.gen.Unit> predicate) mindustry.gen.Building
mindustry.gen.Unit
selectedEnemyUnit
(float x, float y) mindustry.gen.Unit
void
void
static void
static void
setUnitCommand
(mindustry.gen.Player player, int[] unitIds, UnitCommand command) static void
setUnitStance
(mindustry.gen.Player player, int[] unitIds, UnitStance stance) protected void
void
spectate
(mindustry.gen.Unit unit) static void
void
static void
tileConfig
(mindustry.gen.Player player, mindustry.gen.Building build, Object value) static void
static void
transferInventory
(mindustry.gen.Player player, mindustry.gen.Building build) static void
transferItemEffect
(Item item, float x, float y, mindustry.gen.Itemsc to) static void
transferItemTo
(mindustry.gen.Unit unit, Item item, int amount, float x, float y, mindustry.gen.Building build) static void
transferItemToUnit
(Item item, float x, float y, mindustry.gen.Itemsc to) void
tryBreakBlock
(int x, int y) void
tryDropItems
(mindustry.gen.Building build, float x, float y) void
void
static void
unitBuildingControlSelect
(mindustry.gen.Unit unit, mindustry.gen.Building build) static void
unitClear
(mindustry.gen.Player player) static void
unitControl
(mindustry.gen.Player player, mindustry.gen.Unit unit) static void
unitEnteredPayload
(mindustry.gen.Unit unit, mindustry.gen.Building build) void
update()
protected void
updateLine
(int x1, int y1) protected void
updateLine
(int x1, int y1, int x2, int y2) void
void
useSchematic
(Schematic schem) boolean
validBreak
(int x, int y) boolean
validPlace
(int x, int y, Block type, int rotation) boolean
validPlace
(int x, int y, Block type, int rotation, BuildPlan ignore) boolean
validPlace
(int x, int y, Block type, int rotation, BuildPlan ignore, boolean ignoreUnits) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface arc.input.GestureDetector.GestureListener
fling, longPress, pan, panStop, pinch, pinchStop, tap, touchDown, zoom
Methods inherited from interface arc.input.InputProcessor
connected, disconnected, keyDown, keyTyped, keyUp, mouseMoved, scrolled, touchDown, touchDragged, touchUp
-
Field Details
-
logicCutscene
public boolean logicCutsceneIf true, there is a cutscene currently occurring in logic. -
logicCamPan
public arc.math.geom.Vec2 logicCamPan -
logicCamSpeed
public float logicCamSpeed -
logicCutsceneZoom
public float logicCutsceneZoom -
inputLocks
public arc.struct.Seq<arc.func.Boolp> inputLocksIf any of these functions return true, input is locked. -
controlInterval
public arc.util.Interval controlInterval -
block
-
overrideLineRotation
public boolean overrideLineRotation -
rotation
public int rotation -
droppingItem
public boolean droppingItem -
itemDepositCooldown
public float itemDepositCooldown -
uiGroup
public arc.scene.Group uiGroup -
isBuilding
public boolean isBuilding -
buildWasAutoPaused
public boolean buildWasAutoPaused -
wasShooting
public boolean wasShooting -
controlledType
-
recentRespawnTimer
public float recentRespawnTimer -
lastSchematic
-
detector
public arc.input.GestureDetector detector -
line
public mindustry.input.InputHandler.PlaceLine line -
resultplan
-
bplan
-
linePlans
-
selectPlans
-
lastPlans
-
lastUnit
@Nullable public mindustry.gen.Unit lastUnit -
spectating
@Nullable public mindustry.gen.Unit spectating -
selectedUnits
public arc.struct.Seq<mindustry.gen.Unit> selectedUnits -
commandBuildings
public arc.struct.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 -
controlGroups
public arc.struct.IntSeq[] controlGroupsGroups of units saved to different hotkeys -
inv
-
config
-
planConfig
-
-
Constructor Details
-
InputHandler
public InputHandler()
-
-
Method Details
-
transferItemEffect
-
takeItems
public static void takeItems(mindustry.gen.Building build, Item item, int amount, mindustry.gen.Unit to) -
transferItemToUnit
-
setItem
-
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
-
commandUnits
public static void commandUnits(mindustry.gen.Player player, int[] unitIds, @Nullable mindustry.gen.Building buildTarget, @Nullable mindustry.gen.Unit unitTarget, @Nullable arc.math.geom.Vec2 posTarget, boolean queueCommand, boolean finalBatch) -
setUnitCommand
-
setUnitStance
-
commandBuilding
public static void commandBuilding(mindustry.gen.Player player, int[] buildings, arc.math.geom.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) -
unitEnteredPayload
public static void unitEnteredPayload(mindustry.gen.Unit unit, mindustry.gen.Building build) -
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
-
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(arc.func.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
-
isUsingSchematic
public boolean isUsingSchematic() -
spectate
public void spectate(mindustry.gen.Unit unit) -
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(arc.scene.ui.layout.Table table) -
buildUI
public void buildUI(arc.scene.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) -
commandTap
public void commandTap(float screenX, float screenY, boolean queue) -
drawCommand
public void drawCommand(mindustry.gen.Unit sel) -
drawCommanded
public void drawCommanded() -
drawCommanded
public void drawCommanded(boolean flying) -
drawUnitSelection
public void drawUnitSelection() -
drawBottom
public void drawBottom() -
drawTop
public void drawTop() -
drawOverSelect
public void drawOverSelect() -
drawSelected
-
drawBreaking
-
drawOverlapCheck
-
planMatches
-
drawBreaking
public void drawBreaking(int x, int y) -
useSchematic
-
showSchematicSave
protected void showSchematicSave() -
rotatePlans
-
flipPlans
-
schemOriginX
protected int schemOriginX() -
schemOriginY
protected int schemOriginY() -
getPlan
- Returns:
- the selection plan that overlaps this position, or null.
-
getPlan
Returns the selection plan that overlaps this position, or null. -
drawBreakSelection
protected void drawBreakSelection(int x1, int y1, int x2, int y2, int maxLength) -
drawBreakSelection
protected void drawBreakSelection(int x1, int y1, int x2, int y2, int maxLength, boolean useSelectPlans) -
drawRebuildSelection
protected void drawRebuildSelection(int x1, int y1, 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, arc.graphics.Color col1, arc.graphics.Color col2) -
flushSelectPlans
-
flushPlansReverse
-
flushPlans
-
drawOverPlan
-
drawOverPlan
-
drawPlan
-
drawPlan
-
drawPlan
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(arc.math.geom.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 arc.struct.Seq<mindustry.gen.Unit> selectedCommandUnits(float x, float y, float w, float h, arc.func.Boolf<mindustry.gen.Unit> predicate) -
selectedCommandUnits
public arc.struct.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 x1, int y1, int x2, int y2) -
tryBreakBlock
public void tryBreakBlock(int x, int y) -
validPlace
-
validPlace
-
validPlace
-
validBreak
public boolean validBreak(int x, int y) -
breakBlock
public void breakBlock(int x, int y) -
drawArrow
-
drawArrow
-