Autodrive

by dorfl
Car equipment for train avoidance, logistic network integration, circuit network connectivity, fuel refill, ammo reload, radio control, enemy targeting, and gate control. Requires a vehicle grid mod.
a day ago
0.17
477
Owner: dorfl
Source: N/A
Homepage: https://gitlab.com/aerosuidae/autodrive
License: MIT
Created: 15 days ago
Latest Version: 0.1.15 (a day ago)
Factorio version: 0.17
Downloaded: 477 times

Requires one of the vehicle grid mods! Most should work if they allow regular armor equipment. Or consider Vehicle Grid as an optional dependency.

Sensors

Autodrive started as a mash-up of ideas for making cars smarter using grid equipment sensors, mix-and-match style:

  • Train sensor: Car will sense a nearby moving train and brake automatically, or accelerate hard if already crossing rails. Does nothing useful if you're driving along rails!
  • Enemy sensor: Car will sense and target nearby enemies within range of its guns. Does nothing if vehicle is unarmed.
  • Fuel sensor: Car will refuel from its inventory.
  • Ammo sensor: Car will reload ammunition from its inventory.
  • Gate sensor: Car will open gates without a driver. Enables path finding through gates (see below).
  • Logistic network sensor: Car will interact with the logistic network when parked. Filtered trunk slots are refilled like a requester chest, and unfiltered slots are exported like an active provider chest. Grew out of my old Logiquipment mod.
  • Circuit network sensor: Car will interact with the circuit network via a Shortwave channel. Use the radio control to select a car and a radio to associate the two. Send X and Y signals to the shortwave channel to direct the car.

All work when driving a vehicle manually, when a vehicle is parked, and when it's under remote control.

Trains

The train sensor is your friend... but it's not perfect. For high-traffic train areas block off the rails with walls to force cars to path to gates. When RC driving all the way cross the map, quickly scan the dashed yellow path and ensure there are no long segments where a car will be driving along rails.

The train sensor will accelerate a car very hard to get it off the rails in time to avoid a fast train, so don't stand in front of your car because it might kill you to save itself :-)

Logistic Network

  1. Put a logistic network sensor into a car grid
  2. Set some trunk filtered slots (middle mouse btn). These will be treated like logistic request slots
  3. Park the car inside a logistics zone with robots -- mod won't activate if a car is moving
  4. Robots should arrive...

Note that:

  • Sensor only ticks every few seconds, so be patient :)
  • Filtered trunk slots are used to set the request slots of a hidden requester chest
  • Unfiltered trunk slots are considered trash and put into a hidden active provider chest
  • If the current fuel is requested in a slot, fuel tank will be filled up first
  • Entering and starting the car is fine -- items still in hidden chests will be reclaimed

Remote Control

Autodrive includes a remote-control automatic pathing tool. The RC is similar to the one in AAI Programmable Vehicles. Fine to run both mods in a game, but the sensors only work when AAI vehicle AI is turned off and the Autodrive remote-control is used. Sensors will not work for programmed vehicles because the tick handlers will fight for control.

Vehicle Roboports

One long-time problem with AAI and vehicle grids is losing robots and some types of grid equipment inventory contents. Autodrive is designed to solve those bugs, so for eg, it's fine to kit out a Hauler with a personal roboport and a burner grid generator, and send it off to build remote mining outposts.

Pathing

Cars request paths with clearance max(width, height) x 1.6 which avoids crashes and getting stuck on opther entities. Mostly. The Factorio path-finding API exposed in 0.17 sometimes returns strange paths.

Bounce Crashing

Cars bounce backward a bit after a crash which usually leaves enough clearance to re-path. You might have seen this behaviour in other RTS games. They also auto-heal themselves and the other entity a bit :-)

Trees

A car driving with the RC will try to path between trees, bounce-crashing and removing any tree it actually hits. The Hauler can bulldoze it's way, albeit very slowly, through any forest.

Circuit Network

The circuit network can be used to emulate the remote control:

  1. Build and place a circuit sensor in a car grid.
  2. Build a shortwave radio and set the channel (instructions in that mod) to something, say Car(17).
  3. Use the remote control tool to drag-select both the car and the radio at the same time. Car will bind to the chosen channel and display it as a yellow caption while selected, eg car:17.
  4. Send X and Y signals to the radio I/O port to direct the car to a drive to a map location.
  5. Car will check for a signal change once per second.

There's a Markers mod to help choose and track map co-ordinates. I guess these become something like waypoints, except they're just informational; you still have to explicitly send X,Y signals.

Cars report back on the same channel once per second:

  • V: current X co-ordinate
  • W: current Y co-ordinate
  • A: duration since arrival at current map location in ticks
  • B: duration since arrival at current map location in seconds (floor(A/60))
  • D: duration since departure in ticks
  • E: duration since departure in seconds (floor(B/60))

A and D are mutually exclusive.

Note that X=0, Y=0 doesn't work, due to Factorio's convention of treating 0 as no-signal.

UPS

The biggest UPS hits are:

  • Cars actively driving beacuse it's Lua and on-tick. Having lots of vehicles is fine, just not all pathing and driving at once...
  • Cars with a logistic sensor left parked in a logistic network zone for no reason. Remove the sensor or park cars outside the yellow zone once they've finished logistics requests.

AAI Programmable Vehicles compatability

Yes, except the RC and AI notes above. AAI stand-alone vehicles like the Hauler, Warden and Chaingunner work with both mods.

Logistic Carts compatability

Yes, both mods can run together, but sensors don't work on carts.