Batteries - NeisesMike/VehicleFramework GitHub Wiki
A vehicle "needs" batteries in order to have power.
In reality, Vehicle Framework will give your vehicle unlimited power if you don't specify batteries!
Overview
ModVehicle has two fields for batteries:
public virtual List<VehicleParts.VehicleBattery> Batteries => new List<VehicleParts.VehicleBattery>();
public virtual List<VehicleParts.VehicleBattery> BackupBatteries => new List<VehicleParts.VehicleBattery>();
The Batteries are what you expect. They power the ModVehicle like the Seamoth's power cell powers it.
On the other hand, the BackupBatteries are reserved mostly for the AutoPilot. For example, if your vehicle completely dies upside down, the Auto-Pilot will draw on its own power source to level the vehicle back out. Additionally, the Auto-Pilot will remain generally functional after the vehicle "normally dies," and will continue to offer support as long as the backup battery lasts.
Here is the definition for the VehicleBattery Struct
public struct VehicleBattery
{
public GameObject BatterySlot;
public Transform BatteryProxy;
}
BatterySlot
is what you will click to initiate a battery reload. That is, you will click BatterySlot when you want to change out a dead power cell. Be sure this GameObject has a collider!
BatteryProxy
is a location for where a physically observable battery model will be created/destroyed when the player adds/removes a battery. You can safely leave this null.