Click to Move

by houcky

Allows players to middle click to move their character to a destination.

Utilities
5 days ago
2.0 - 2.1
1.91K
Transportation
Owner:
houcky
Source:
https://github.com/henriquempimenta/c...
Homepage:
https://github.com/henriquempimenta/c...
License:
MIT
Created:
a year ago
Latest Version:
0.1.20017 (5 days ago)
Factorio version:
2.0 - 2.1
Downloaded by:
1.91K users

Click2Move for Factorio

A quality-of-life mod that enables point-and-click movement for your character and vehicles. Inspired by ARPG and RTS games, simply click where you want to go, and the pathfinder will take you there.

Features

  • Point-and-Click Movement: Use a mouse click to set a destination for your character or the vehicle you are driving.
  • Path Queuing: Hold Shift while clicking to queue up multiple destinations.
  • Waypoint Skipping: Straight sections consume multiple waypoints already passed between updates, keeping fast characters with exoskeletons and vehicles moving toward the next target. Turns retain their normal proximity rule, and final destinations are checked separately.
  • Numbered Destinations: Queued destinations are numbered on the map so the route order is visible at a glance.
  • Vehicle Support: Control cars, tanks, and occupied spidertrons as well as your character. Spidertrons use their own autopilot and finish exactly where it stops.
  • Corner Speed: Cars and tanks brake for rounded corners, heading corrections and the destination, forwards and in reverse. Steering and speed planning use the same route of straight sections and tangent arcs. Corners are taken on a racing line that uses both sides of the cleared corridor, and a lane shift round an obstacle becomes one wide curve; every curve is checked against the original path. A bounded refinement widens neighboring bends together, reduces peak and total bending, and lets the final curve reach the destination without imposing an unnecessary final heading. Gentle approach corrections use wider radii to avoid an extra braking cycle. Rounding stays within the path's recorded clearance after allowing for the rotated vehicle body and tracking error; zero or unknown clearance keeps explicit waypoint steering. Speed limits use each vehicle's braking force, weight, friction and turning rate, including the fuel's effect on braking and, for tanks, the fuel and powered exoskeletons' effect on turning. A vehicle outside its cleared corridor crawls back towards it, and fast cars reserve enough distance to brake before a turn.
  • Obstacle-Free Routes: Routes are requested with the neutral force so the pathfinder treats rocks, trees and buildings as obstacles. If the returned route still requires destruction, the mod reports "No path found". Each leg uses one initial request; busy pathfinder responses can retry later.
  • Vehicle Braking: Vehicles retain control at destinations until their speed and scripted drift settle before advancing the queue. If braking leaves a vehicle outside the arrival radius, it approaches farther inside and stops again.
  • Visual Path: See the calculated path drawn on the ground, so you know exactly where you're headed. The route and numbered destinations also appear on the map when remote view is zoomed out.
  • Destination Marker: A crosshair marks your final destination.
  • Movement GUI: A small panel appears in the top-left showing your current destination and the number of queued goals. It also includes a "Cancel" button to immediately stop all automatic movement.
  • Shortcut Mode: Toggle Click2Move on or off from the shortcut bar.
  • Disable on Arrival: Optionally turn Click2Move off after reaching the last queued destination, so the middle mouse button returns to its normal use.
  • Stuck Detection: If your character or vehicle gets stuck, the mod will automatically attempt to find a new path to your destination.
  • Configurable: Customize the mod's behavior through a variety of settings in the "Mod settings" menu.

How to Use

  • Move: Press Mouse Button 3 (the middle mouse button by default) on the terrain to move to that location.
  • Queue Moves: Hold Shift and press Mouse Button 3 to add a destination to your movement queue.
  • Cancel Movement:
    • Click the "Cancel" button in the top-left GUI.
    • Use the "Cancel Click2Move" custom input if you bind one in Factorio's controls.
    • Move your character manually with the keyboard (WASD).
    • Use the vehicle movement keys to take over driving in normal view. Panning in remote view does not cancel movement.
    • Set a new destination without holding Shift (this will clear the old queue).
  • Toggle Mode: Press Control + Shift + M or use the shortcut bar button to enable or disable Click2Move. Disabling it cancels the current movement and ignores future movement clicks until re-enabled. With Disable on arrival enabled, the mode turns off by itself after the last queued destination is reached; cancelled or unreachable routes leave it on.

Movement continues while map or remote view is open, so you can inspect the route and pan the camera. Use the cancel command or GUI to stop it from those views.

Car and tank commands require the driver's seat. Changing drivers clears the previous driver's route while preserving the new driver's input.

Giving a spidertron a command with a spidertron remote, or another mod assigning it a destination, takes over from Click2Move and clears its route without overwriting that command.

The default keybind can be changed in Factorio's control settings. Look for "Click to Move".

Inspecting margins and curves

In Settings → Mod settings → Per player, enable Debug: Draw Path Margins and Debug: Draw Smooth Curve. They work independently of the chat debug switch. Yellow is the original path, cyan shows its recorded margin, orange shows the smaller allowance available for smoothing after reserving room for the rotated vehicle body and tracking error, and magenta is the exact steering reference. The margin outlines show allowed centerline deviation around the route, not obstacle boundaries or the vehicle's full swept footprint. Circular pieces are sampled only for drawing.

Enable Debug: Preview Without Moving, then middle-click a destination to calculate its route without starting movement. A vehicle already moving brakes to a stop first. Change Character Margin or Vehicle Path Margin to recalculate the preview and compare the result. The GUI identifies paused previews; turning preview off keeps the displayed route paused until you click a fresh destination. Cancel clears the overlay. Queued previews calculate the first three paths, matching the normal prefetch window. Flight and spidertron routes have no pathfinder margin or car steering curve. Very large overlays are capped and display a notice when partial.

Known Issues

  • Flickering with Mech Armor: When moving horizontally with mech armor, the character sprite may flicker.
  • Vehicle Steering: Steering can overshoot or oscillate, particularly around tight turns or with vehicles that have strong inertia. Vehicles whose prototypes do not describe braking and turning, and scripted vehicles such as Hovercrafts in drift mode, are not slowed for corners as precisely.
  • Hovercrafts on Factorio 2.0: Hovercrafts compatibility is optional. With Hovercrafts 2.0.x, New drift mode is not supported: it reports reverse movement as forward speed, so a reversing hovercraft can accelerate instead of stopping, and a hovercraft on a pathfinder route can stop short and abandon its destination. Off and Old drift work with the standard and missile hovercrafts. The electric and laser hovercrafts, which Hovercrafts 2.0.x adds only with the Laser Tanks mod, have not been tested. On Factorio 2.1, Hovercrafts 2.1.4 works in every drift mode.
  • Spidertron Remote View: Ordering selected spidertrons from remote view is not supported yet. Remote-view clicks still control the player character or current vehicle.

Mod Settings

You can adjust these settings in Settings -> Mod settings.

Setting Name Type Scope Default Description
Debug mode Bool Per-Player false Enables printing of debug messages to the console for your player.
Debug: Pathfinding / Queue / Stuck Recovery / Vehicle Control Bool Per-Player true Four separate filters for debug output. Only used when Debug mode is on.
Debug: Draw Path Margins Bool Per-Player false Draws the recorded margin and usable smoothing allowance with a color legend.
Debug: Draw Smooth Curve Bool Per-Player false Draws the vehicle's actual steering reference in magenta.
Debug: Preview Without Moving Bool Per-Player false Calculates paused routes; margin changes recalculate the preview. Independent of chat debug mode.
Character margin Float Per-Player 0.45 The safety margin added to the character's bounding box for pathfinding. Larger values avoid tighter gaps.
Update interval Int Global 1 The number of game ticks between movement updates. Lower is smoother but uses more UPS.
Character proximity threshold Float Per-Player 1.5 Base arrival radius in tiles for characters on ground paths or in flight; increases with running speed.
Vehicle proximity threshold Float Per-Player 6.0 How close (in tiles) a car or tank must be to the final goal to consider it "reached". Spidertrons stop where their autopilot stops instead.
Stuck threshold Int Per-Player 30 No-progress limit in game ticks. Ordinary paths wait twice this value; straight-line movement waits this value.
Vehicle path margin Float Per-Player 2.0 The safety margin added to the vehicle's bounding box for pathfinding.
Vehicle Prefer Straight Paths Bool Per-Player false Asks Factorio's pathfinder to prefer straighter vehicle paths. Can be slower to compute.
Disable on arrival Bool Per-Player false Turns Click2Move mode off after the last queued destination is reached.

Note: Settings can be changed on the fly. The global update interval re-registers the movement scheduler when changed. Characters on ground paths or in flight check arrival every tick once the destination is close enough to reach before the next scheduled update. Cars and characters also steer every tick while the next update could take them past a corner, or past a waypoint that straight-line movement cannot prove they passed, and vehicles while one update of turning could carry them past the heading they need. Margin settings apply to paths requested after the change. Vehicles finishing a move keep applying their brakes every tick regardless of this interval.

Stuck recovery lasts 30 game ticks for a character slide and 60 game ticks for a vehicle reverse. These durations and the no-progress limit are independent of the update interval; a larger interval can delay detection until the next scheduled update.

Installation

  1. Install Click to Move from Factorio's in-game Mods menu, or download it from the Factorio Mod Portal.
  2. If downloading manually, place the .zip file into your Factorio mods directory.
    • Windows: C:\Users\<YourUsername>\AppData\Roaming\Factorio\mods
    • Linux: ~/.factorio/mods
    • macOS: ~/Library/Application Support/factorio/mods
  3. Launch Factorio and enable the mod from the "Mods" menu if it's not already enabled.

Author: Me