One thing has been nagging me since forever: you can use car batteries in handheld tools via battery compartment mod ( Battery compartment mod - Cataclysm: Dark Days Ahead ), but you can’t use handheld batteries in vehicles. And there isn’t really a logical reason why you can’t: standard medium battery has the same energy capacity as a “vehicle” motorbike battery, for example.
However, after thinking about the actual implementation for a while, it’s clear that you can’t directly use the code from magazine_battery_mod in reverse (vehicle don’t have “pockets” for batteries the way inventory items do). As such, there are at least 4 ways you can accomplish this “reverse compatibility”:
- add a separate recipe for each type of handheld battery that directly turns it into vehicle-compatible battery. This will require 7 new recipes (to cover all rechargeable battery types), but is rather straight-forward to implement (for me, anyway) and unlikely case unexpected issues.
- add a new vehicle part that, when installed into the vehicle, will allow user to install handheld batteries into the same vehicle tile (problem is, I have no practical knowledge of that area of the vehicle code, and it smells heavily of C++, which is not exactly my forte either)
- create an new item mod that, when installed onto a battery, makes it vehicle-compatible (here I’m not even sure there is a precedent for such thing in the code. Can a simple item mod change how vehicle code sees an item?)
- create an new item that accepts handheld batteries into it’s pocket, and can be installed into the vehicle thereafter (again, no idea if current vehicle code base even supports two-way interaction with an item inside a pocket of another item)
Right now I’m leaning towards option #1, as I understand the code base for that implementation much better. However, I’d like to hear some other opinions here before I push the PR.