OnBoard Computer
Dependencies:
- computer_core
Add a board computer to your cars and write a Lua program to give them an AI
Forum: https://forums.factorio.com/viewtopic.php?f=93&t=53985
OnBoard APIs
OnBoard mod add an On-board computer
item, placed in the equipment grid of a car it gives access to an API car
\
The car API
provides these functions
- car.hasDriver()
: Return true if a player is in the car (driver)
- car.hasPassenger()
: Return true if a player is in the car (passenger)
- car.getPosition()
: Returns the current position of the car
- car.getSpeed()
: Return the speed of the car in km/h
- car.getOrientation()
: Return the orientation of the car
- car.scanSurface(position)
: Scan a position in a radius of 20 tiles, return true or false if the car will collides at and return the tile name
- car.getFuel()
: Returns the fuel in the tank of the car
- car.startEngine()
: Starts the car engine
- car.stopEngine()
: Stop the car engine
- car.accelerate()
: Press the gas pedals
- car.brake()
: Press the brake pedal
- car.reverse()
: Put the car into reverse
- car.turnRight()
: Turn the steering wheel to the right
- car.turnLeft()
: Turn the steering wheel to the left
- car.straight()
: Put back the wheels straight
- car.getCargo()
: Returns the contents of the car
- car.trafficInformation()
: Scan trafic in a radius of 20 tiles, return entities information
- car.getWaypoint(name)
: Find a waypoint by its name, and return its position
OnBoard APIs WITH "OnBoard Military Computer"
All APIs from "OnBoard Computer" and :
- car.getHealth()
: Return the health of the car
- car.getShield()
: Return the shield of the car
- car.getEnergy()
: Return the energy stored in all batteries of the car
- car.getAmmo()
: Returns the number of ammo remaining
- car.shootOnPosition(position)
: Shoot on given position
- car.stopShooting()
: Stop shooting
- car.detectEnemies(radius, position)
: Detect enemies in a radius around the given position (maximum detection distance: 25)
- car.detectAllies(radius, position)
: Detect allies in a radius around the given position (maximum detection distance: 25)