CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.65k stars 4.18k forks source link

add multifuel engine support #23123

Closed ymber closed 5 years ago

ymber commented 6 years ago

Multifuel engine support would allow for vehicle parts that make diesel more useful and realistic implementations of gas turbines. Gas turbines would be a lot better for huge vehicles and tanks than the status quo of bolting enough V12s to it to move 50 tons.

Fuel to use should be selected by the player in all cases where multiple options are available in the vehicle.

kevingranade commented 6 years ago

If I understand, you mean diesel-like engines that can be configured to accept multiple fuel types, possibly simultaneously. An extension of this would allow blending fuels in tanks, so for example you can just dump any diesel or gasoline you find into a tank, and an appropriate engine can run from it. (Potentially also vegetable oil and ethanol?)

I think setting up the engines would be fairly simple, blending fuels would be significantly more complex.

Regarding gas turbines, it looks like they typically handle multifuel well, can you give some example vehicles that have them? The only land vehicle I'm aware of offhand that uses them is the Abrams, but main battle tanks are pretty overkill for dda.

ymber commented 6 years ago

That's the idea. Engines that run on any of a specified list of fuels. The engine part shouldn't be too hard but I wasn't planning to do fuel mixing at the moment. That should be a generalized system for any liquid and making that happen would be a lot more code than basic fuel selection.

Tanks are probably the most significant use of turboshafts in land vehicles. I think having tanks would be good for rare spawns in national guard camp motor pools or something. You also get some trains that use them (JetTrain, GT1-001), some experimental supercars (C-X75, Howmet TX), bikes (MTT Turbine Superbike), and a handful of buses. Using a turboshaft engine to power a generator is also fairly common.

Epictyphlosion commented 6 years ago

You mean like a flex-fuel engine? That could be a possibility

mlangsdorf commented 6 years ago

I plan to work on this after #24794 is merged.

vpart_info fuel_type can be either a fuel itype_id or a list of fuel itype_ids. if an active engine has more than 1 fuel itype_id and has fuel for more than 1 type, the controls menu has an additional option to select between fuels. current fuel type is stored in the vehicle_part. there may be some adjusting of code paths. fuels may be get an additional flag E_COMBUSTIBLE to prevent people from making mods that use inert fuels in a COMBUSTION engine, but honestly, I don't know if I care. basic engine characteristics like m2c are going to be constant per engine unless there's a really good reason to have them vary.