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 TypeFieldDescriptionbooleanarc.struct.Seq<mindustry.gen.Building>booleanbooleanfloatfloatfinal BlockConfigFragmentarc.struct.IntSeq[]Groups of units saved to different hotkeysarc.util.Intervalarc.input.GestureDetectorbooleanarc.struct.Seq<arc.func.Boolp>If any of these functions return true, input is locked.final BlockInventoryFragmentbooleanfloatarc.struct.Queue<BuildPlan>mindustry.gen.Unitmindustry.input.InputHandler.PlaceLinearc.struct.Seq<BuildPlan>arc.math.geom.Vec2floatbooleanIf true, there is a cutscene currently occurring in logic.floatbooleanfinal PlanConfigFragmentfloatintarc.struct.Seq<mindustry.gen.Unit>arc.struct.Seq<BuildPlan>mindustry.gen.Unitbooleanarc.scene.Groupboolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd()voidaddLock(arc.func.Boolp lock) Adds an input lock; if this function returns true, input is locked.arc.util.Eachable<BuildPlan>allPlans()voidbreakBlock(int x, int y) static voidbuildingControlSelect(mindustry.gen.Player player, mindustry.gen.Building build) voidbuildPlacementUI(arc.scene.ui.layout.Table table) voidbuildUI(arc.scene.Group group) booleanbooleancanShoot()voidstatic voidclearItems(mindustry.gen.Building build) static voidcommandBuilding(mindustry.gen.Player player, int[] buildings, arc.math.geom.Vec2 target) voidcommandTap(float screenX, float screenY) voidcommandTap(float screenX, float screenY, boolean queue) static voidcommandUnits(mindustry.gen.Player player, int[] unitIds, mindustry.gen.Building buildTarget, mindustry.gen.Unit unitTarget, arc.math.geom.Vec2 posTarget, boolean queueCommand, boolean finalBatch) static voidcreateItemTransfer(Item item, int amount, float x, float y, arc.math.geom.Position to, Runnable done) static voiddeletePlans(mindustry.gen.Player player, int[] positions) voidvoidvoidvoiddrawBreaking(int x, int y) voiddrawBreaking(BuildPlan plan) protected voiddrawBreakSelection(int x1, int y1, int x2, int y2) protected voiddrawBreakSelection(int x1, int y1, int x2, int y2, int maxLength) protected voiddrawBreakSelection(int x1, int y1, int x2, int y2, int maxLength, boolean useSelectPlans) voiddrawCommand(mindustry.gen.Building build) voiddrawCommand(mindustry.gen.Unit sel) voidvoiddrawCommanded(boolean flying) voiddrawOverlapCheck(Block block, int cursorX, int cursorY, boolean valid) protected voiddrawOverPlan(BuildPlan plan) protected voiddrawOverPlan(BuildPlan plan, boolean valid) voidprotected voidDraws a placement icon for a specific block.protected voidprotected voidprotected voiddrawRebuildSelection(int x1, int y1, int x2, int y2) voiddrawSelected(int x, int y, Block block, arc.graphics.Color color) protected voiddrawSelection(int x1, int y1, int x2, int y2, int maxLength) protected voiddrawSelection(int x1, int y1, int x2, int y2, int maxLength, arc.graphics.Color col1, arc.graphics.Color col2, boolean withText) voiddrawTop()voidstatic voiddropItem(mindustry.gen.Player player, float angle) voidprotected voidflushPlans(arc.struct.Seq<BuildPlan> plans) protected voidflushPlansReverse(arc.struct.Seq<BuildPlan> plans) protected voidflushSelectPlans(arc.struct.Seq<BuildPlan> plans) floatfloatprotected BuildPlangetPlan(int x, int y) protected BuildPlanReturns the selection plan that overlaps this position, or null.booleanbooleanbooleanbooleanbooleanbooleanlocked()floatmouseAngle(float x, float y) booleanbooleanvoidpanCamera(arc.math.geom.Vec2 position) Forces the camera to a position and enables panning on desktop.static voidpayloadDropped(mindustry.gen.Unit unit, float x, float y) static voidpickedBuildPayload(mindustry.gen.Unit unit, mindustry.gen.Building build, boolean onGround) static voidpickedUnitPayload(mindustry.gen.Unit unit, mindustry.gen.Unit target) booleanplanMatches(BuildPlan plan) voidrebuildArea(int x1, int y1, int x2, int y2) voidremove()static voidremoveQueueBlock(int x, int y, boolean breaking) protected voidremoveSelection(int x1, int y1, int x2, int y2) Remove everything from the queue in a selection.protected voidremoveSelection(int x1, int y1, int x2, int y2, boolean flush) Remove everything from the queue in a selection.protected voidremoveSelection(int x1, int y1, int x2, int y2, boolean flush, int maxLength) Remove everything from the queue in a selection.protected voidremoveSelection(int x1, int y1, int x2, int y2, int maxLength) Remove everything from the queue in a selection.static voidrequestBuildPayload(mindustry.gen.Player player, mindustry.gen.Building build) static voidrequestDropPayload(mindustry.gen.Player player, float x, float y) static voidrequestItem(mindustry.gen.Player player, mindustry.gen.Building build, Item item, int amount) static voidrequestUnitPayload(mindustry.gen.Player player, mindustry.gen.Unit target) static voidrotateBlock(mindustry.gen.Player player, mindustry.gen.Building build, boolean direction) voidrotatePlans(arc.struct.Seq<BuildPlan> plans, int direction) protected intprotected intbooleanarc.struct.Seq<mindustry.gen.Building>selectedCommandBuildings(float x, float y, float w, float h) mindustry.gen.UnitselectedCommandUnit(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.Buildingmindustry.gen.UnitselectedEnemyUnit(float x, float y) mindustry.gen.Unitvoidvoidstatic voidstatic voidsetUnitCommand(mindustry.gen.Player player, int[] unitIds, UnitCommand command) static voidsetUnitStance(mindustry.gen.Player player, int[] unitIds, UnitStance stance, boolean enable) protected voidvoidspectate(mindustry.gen.Unit unit) static voidvoidstatic voidtileConfig(mindustry.gen.Player player, mindustry.gen.Building build, Object value) static voidstatic voidtransferInventory(mindustry.gen.Player player, mindustry.gen.Building build) static voidtransferItemEffect(Item item, float x, float y, mindustry.gen.Itemsc to) static voidtransferItemTo(mindustry.gen.Unit unit, Item item, int amount, float x, float y, mindustry.gen.Building build) static voidtransferItemToUnit(Item item, float x, float y, mindustry.gen.Itemsc to) voidtryBreakBlock(int x, int y) voidtryDropItems(mindustry.gen.Building build, float x, float y) voidvoidstatic voidunitBuildingControlSelect(mindustry.gen.Unit unit, mindustry.gen.Building build) static voidunitClear(mindustry.gen.Player player) static voidunitControl(mindustry.gen.Player player, mindustry.gen.Unit unit) static voidunitEnteredPayload(mindustry.gen.Unit unit, mindustry.gen.Building build) voidupdate()protected voidupdateLine(int x1, int y1) protected voidupdateLine(int x1, int y1, int x2, int y2) voidvoiduseSchematic(Schematic schem) abstract voiduseSchematic(Schematic schem, boolean checkHidden) booleanvalidBreak(int x, int y) booleanvalidPlace(int x, int y, Block type, int rotation) booleanvalidPlace(int x, int y, Block type, int rotation, BuildPlan ignore) booleanvalidPlace(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, waitMethods inherited from interface arc.input.GestureDetector.GestureListener
fling, longPress, pan, panStop, pinch, pinchStop, tap, touchDown, zoomMethods inherited from interface arc.input.InputProcessor
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
public static void setUnitStance(mindustry.gen.Player player, int[] unitIds, UnitStance stance, boolean enable) -
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) -
drawCommand
public void drawCommand(mindustry.gen.Building build) -
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
-
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, boolean withText) -
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) -
selectedCommandBuildings
public arc.struct.Seq<mindustry.gen.Building> selectedCommandBuildings(float x, float y, float w, float h) -
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
-