CleverRaven/Cataclysm-DDA — pull request #5158 by belenos- (2013-12-21 07:30:58+00:00)
Title: [CR] Vehicle electrical system improvements

````
Gameplay changes:
-gasoline/plasma engines no longer have built-in alternators
-added 3 new alternator part types: motorcycle, car, truck
-alternators will slightly reduce engine power available for vehicle speed/acceleration
-> the bigger alternator (or multiple alternators) or the smaller the engine, the larger the effect.
-alternator electrical load affects fuel consumption at idle.
-> a vehicle with many lights, fridges, chargers, etc. will burn more fuel while idling.
-> idle control allows for practical generator applications: power your workbench with gas instead of solar.
-added alternators to appropriate pre-defined vehicles

-reactors now produce electricity directly, instead of acting as fuel for electric motors
-reactors only generate electricity on demand, so when your vehicle's electrical requirements are being met by other means (solar or alternators), no plutonium will be consumed
-reactors can be turned on/off.
-> install on your solar vehicles for use only at night or in an emergency
-reactors now have a (very high) power output limit
-> it is now possible to overload a reactor resulting in an electrical shortage.

Under-the-hood changes:
-added concept of electrical power 'epower' to vehicles, which is defined in watts
-> the pre-existing 'power' property can be thought of as mechanical power.
-all electrical parts now have an epower property
-vehicle parts can have a positive or negative epower or power
-alternators convert power to epower (ie. they have a negative power rating and positive epower rating)
-alternators have a conversion efficiency of 50% to 60%
-> So installing alternators on electric motors will only result in a net loss of power (just like real life!)
-electric motors convert epower to power (i.e. they have a positive power rating and a negative epower rating)
-electric motors have a conversion efficiency of 90% to 95%
-all electric power accounting (production and consumption) is done in epower, with the final result applied to the batteries.
-> This allows for small loads (e.g. the vehicle tracker) to have an impact on battery (and therefore fuel) over time.
-epower sources are used in this order: solar, batteries, alternators(gas/plasma), then reactors(plutonium).
-> common fuel is used first, exotic used last.
-> reactors can be turned off and saved for emergencies.
-engine idle speed controlled by alternator load, which varies based on vehicle epower load.
-> Higher idle speeds will cause the engine to consume fuel at a higher rate.
-fuel consumption is now also more granular.
-> Lower fuel consumption at idle is now possible.

Other changes/fixes:
-added caches for alternators, engines, solar_panels, and reactors
-> should make the game run faster in or around vehicles
-made better use of existing fuel tank cache.
-refresh caches on vehicle load.
-added small storage battery to bubble car (acts as a buffer between the reactor and electic motor)
-added missing car battery to cube van
-added missing car battery to hippy van

TODO/ideas:
- add a small, continous epower draw to running gas/plasma engines (simulates an ignition coil)
-> as a result, if alternator is destroyed, engines will slowly drain battery
-> if battery hits 0, engine stalls
- discharge battery slightly when starting gas engines (simulates starter motor)
-> as a result, batteries will be required to restart dead vehicles found in the street
- add a small engine better suited to a generator, say power 20 (10 HP)
-> a power 20 engine will have lowest possible idle rate of 1 battery-equivelant charge/turn
-> alternately, make engine variable size actually affect power output
- add a large alternator better suited to a generator, say epower 4500 (4.5kW)
- add a 'generator control' part - automatically starts/stops engines on battery threshold
- add a generator cart 'vehicle', using above components, to be found in hardware stores
- limit alternators to engine locations?
- prevent alternators from being installed with footpedals
-> footpedals are overpowered at 70 power (35 HP), possible exploit for easy epower
- add a 'fuel cell' part - produces epower directly from hydrogen (basically a reactor that uses hydrogen)
````