I'm not completely certain this is a bug or intentional, but I was leaning towards bug since the description of the Battery System specifically mentions it's for use with "normal, everyday batteries."
I can see where you are coming from. Perhaps the cable charger CBM could be used to take energy from the storage batteries instead?
Whoah, we have battery tag now.
Fallout from #18681? Possibly this?.. Wrong, sorry.
Ping @codemime (sorry if not needed).
Are you sure it's not a preexisting behavior? I mean, the line you're referencing is, basically, this line.
Ah, there it is!
Wasn't sure then, pretty sure it's not now. Will check if preexisting.
Present at f8f5b93d8a27a03112be8142518cb12e5ccadd9d (Jan 2).
Present at e1de5dad7bde19249581fe52d658b4baf6e76a07 (Dec 3).
Can't eat either (i.e. bugged) at some package built on 2016.11.22.
Related (EDIT: closed):
ammo_type for battery and plutonium #18908Those were caused by:
Was addressed in:
EDIT: Guess #19482 made vehicle batteries consumable.
EDIT2: See a few comments below!
Tangent!
With the introduction of Cable Charger CBM, this could be reworked as @CoroNaut suggested.
EDIT: Or, perhaps not. bio_cable (Cable Charger) is a port and requires an external cable:
You have a complex port mounted above your hip. While active, it will drain power through a jumper cable held on your person.
513 } else if( bio.id == "bio_cable" ) {
514 bool has_cable = has_item_with( []( const item & it ) {
515 return it.active && it.has_flag( "CABLE_SPOOL" );
516 });
517
518 if( !has_cable ) {
519 add_msg_if_player( m_info,
520 _( "You need a jumper cable connected to a vehicle to drain power from it." ) );
521 }
522 }
Note: UPS or, say, flashlight (on/off) can't be consumed.
I figured that using Cable Charger CBM on a regular battery would be equivalent to attaching it to a car (its intended purpose). You are essentially attaching it to the battery mounted on the car. So in theory, you would have the required jumper cable and when "eating" the battery, you actually use the jumper cable and attach to it similar to a vehicle.
"You have a battery draining attachment, and thus can make use of the energy contained in normal, everyday batteries. Use 'E' to consume batteries. Can be toggled on and off at will."
Since it is a battery draining attachment, shouldn't it leave the battery intact?
@Coolthulhu
Whoah, we have battery tag now.
They are a fickle and frustrating ammo type, im curious. were they recently changed into their own type of item recently? and if so, could this type of item be used to classify other batteries inside the game, if not already? such as the vehicle battery / UPS batteries and perhaps future iterations of battery type items?
were they recently changed into their own type of item recently?
They were always an item type and ammo type, but vehicle batteries got turned into magazines that contain battery ammo few months ago.
We still have the old batteries around. We'll probably want to get rid of them because they are weird, inherently non-rechargeable and pretty limiting in few other ways, but for now they need to exist because everything is made with them in mind and we don't have support for multiple magazines per item.
For example, an actual battery with charge in it would work for a flashlight, but not for welder (which often needs 200+ charges), meaning it would either need to have multiple batteries (no support), new battery type (3+ incompatible battery types for handheld tools would be a great way to annoy the players) or some way to deal with battery change mid-craft (no support).
@keyspace, @Regularitee, @CoroNaut, @Coolthulhu and @codemime. as well as @kevingranade
does the Cable Charger CBM only feed through vehicle batteries?
I would also assume that it could be used to access UPS power?

Seeing as the real world UPS or Uninterrupted Power Supply serves a vague similarity with the Ingame UPS or Unified Power System it would be accessable by some sort of cables or wiring.
I see the UPS ingame as almost a battery pack, kind of like this:

A battery pack which can be easily plugged in and possibly recharged easily, interchangeable almost like a gun magazine.
This theory is supported by the UPS and the advanced UPS's descriptions, which are "... a device developed ... by military and scientific interests for use in combat and the field ... designed to power armor and some guns ..." and "... an advanced version of the ... UPS ... has been significantly redesigned ... as to consume plutonium fuel cells rather than batteries."
While I do not assume that the Advanced UPS's power would be able to be captured with a measly CBM, its origins may say otherwise, being obtained rarely in electronic loot spawns and the more notable "Power Storage CBM Mk. II", which can be suprisingly powered by no less than "batteries" as noted in its description "CBM developed ... as a replacement for the ... Power Storage CBM. Increases ... power capacity by 250 units."
So that concludes the question/theory. If vehicle batteries are powered by the humble battery, and OFC the batteries cannot be drained by cables, having to be inserted into a medium which they can. why not the UPS or more sketchily the Advanced UPS be used as another medium for such drainage.
This also raises the question of why the Cable Charger CBM, the Unified Power System CBM and the Battery System CBM cannot just be one CBM, possibly along the lines of:
Power Integration CBM
Developed by the popular DoubleTech Industries, This CBM is a module can be used to consume power from traditional power sources, such as batteries, vehicle batteries, and the more obscure UPS power systems. To be used with the Power Storage and Armour Interface CBMs.
Thanks for taking your time to read through this and possibly considering it!
This issue blocks a WIP test (PR #20054 above).
We still have the old batteries around. We'll probably want to get rid of them because they are weird, inherently non-rechargeable and pretty limiting in few other ways, ...
Agreed. However, they can't be removed now, as you've described. So, should:
can_feed_battery_with() and checking for old-school batteries by id; orNote: bio_batteries full description currently has:
You have a battery draining attachment, and thus can make use of the energy contained in normal, everyday batteries. Use 'E' to consume batteries. Can be toggled on and off at will.
The "attachment" part doesn't say if it's extendable or something, but the bionic is "bigger" than bio_cable or bio_ups.
bio_ups:
You have a unified power system wired into your power banks. Objects that run on a UPS can now draw directly from your internal power supply.
They all occupy TORSO.
id | size | consumes | description
--- | --- | --- | ---
bio_batteries | 25 | battery and `battery_car (plus derivatives) | non-specific, "attachment"
bio_cable | 10 | battery/power from vehicle with cable | specific, "port"
bio_ups | 5 | nothing? | non-specific
EDIT: Bionic slot limit currently has no effect - see #16920 for balance discussion.
On Jan 20, 2017 8:30 AM, "Keyspace-1" notifications@github.com wrote:
This issue blocks a WIP test (PR #20054
https://github.com/CleverRaven/Cataclysm-DDA/pull/20054 above).
We still have the old batteries around. We'll probably want to get rid of
them because they are weird, inherently non-rechargeable and pretty
limiting in few other ways, ...
Agreed. However, they can't be removed now, as you've described.
Future plans really aren't pertinent, especially since there's not even
consensus on what they should look like.
So, should:
How about updating can_feed_battery_with() to check some pertinent
attribute of the battery, like volume? Since it's using the 'e'at
command, I always assumed it was being inserted into a receptacle of some
kind, which implies a volume limit.
How about updating can_feed_battery_with() to check some pertinent attribute of the battery, like volume?
Could work! What would be the cutoff volume? This would end up a magic number, unless tied to the bionic's volume (size?). :/
% grep -E "((\"id\"|\"volume\")|[{}])" data/json/items/vehicle/battery.json
{
"id": "battery_car",
"volume": 25,
},
{
"id": "battery_motorbike",
"volume": 5,
},
{
"id": "medium_storage_battery",
"volume": 10,
},
{
"id": "small_storage_battery",
"volume": 2,
},
{
"id": "storage_battery",
"volume": 40,
}
Looks like 1 (250ml?) Is a good candidate.
Well, I've done some debugging. player::can_consume() passes the contents down if the as-is item can't be consumed:
1015 bool player::can_consume( const item &it ) const
1016 {
1017 if( can_consume_as_is( it ) ) {
1018 return true;
1019 }
1020 return !it.is_container_empty() && can_consume_as_is( it.contents.front() );
1021 }
This makes sense for, say, waterskins with water, but for battery_car, the contained battery is passed, which can inevitably be consumed when it trickles down to player::can_feed_battery_with().
Limiting by volume() won't work for large stacks of plain batteries. Limiting by base_volume() or item id will still allow feeding the bionic with a battery_car EDIT: for the reason described above.
Best I've come up with is adding !it.has_flag( "NO_UNLOAD" ) to that player::can_consume() check list (EDIT: line 1020 above).
Items with NO_UNLOAD:
% grep -R -h -Pzo '(?s)\"id\"[^}]*?NO_UNLOAD' data/json | \
sed 's/\"id\":/\n\"id\":/;s/\x00/\n/' | \
grep -E '(\"(id|type)\")' > outa
% emacs outa
% cat outa | column -t
"id": "LAW", "type": "GUN",
"id": "UPS_off", "type": "TOOL",
"id": "control_laptop", "type": "TOOL",
"id": "shock_staff", "type": "TOOL",
"id": "shocktonfa_off", "type": "TOOL",
"id": "tazer", "type": "TOOL",
"id": "battery_car", "type": "MAGAZINE",
"id": "storage_battery", "type": "MAGAZINE",
"id": "emp_gun", "type": "GUN",
"id": "laser_cannon", "type": "GUN",
"id": "laser_rifle", "type": "GUN",
"id": "unbio_blaster_gun", "type": "GUN",
"id": "v29", "type": "GUN",
"id": "v29_cheap", "type": "GUN",
"id": "battery_atomic", "type": "TOOLMOD",
"id": "battery_ups", "type": "TOOLMOD",
"id": "tinyweldtank", "type": "MAGAZINE",
"id": "weldtank", "type": "MAGAZINE",
"id": "corpse",
"id": "cash_card", "type": "TOOL",
7 GUNs, 6 TOOLs, 4 MAGAZINEs, 2 TOOLMODs and 1 corpse. EDIT: Note: mods not checked.
Anything here that should allow consuming its contents?.. Don't think so myself, since items are marked NO_UNLOAD, but better check.
Most helpful comment
@keyspace, @Regularitee, @CoroNaut, @Coolthulhu and @codemime. as well as @kevingranade
does the Cable Charger CBM only feed through vehicle batteries?
I would also assume that it could be used to access UPS power?

Seeing as the real world UPS or Uninterrupted Power Supply serves a vague similarity with the Ingame UPS or Unified Power System it would be accessable by some sort of cables or wiring.
I see the UPS ingame as almost a battery pack, kind of like this:

A battery pack which can be easily plugged in and possibly recharged easily, interchangeable almost like a gun magazine.
This theory is supported by the UPS and the advanced UPS's descriptions, which are "... a device developed ... by military and scientific interests for use in combat and the field ... designed to power armor and some guns ..." and "... an advanced version of the ... UPS ... has been significantly redesigned ... as to consume plutonium fuel cells rather than batteries."
While I do not assume that the Advanced UPS's power would be able to be captured with a measly CBM, its origins may say otherwise, being obtained rarely in electronic loot spawns and the more notable "Power Storage CBM Mk. II", which can be suprisingly powered by no less than "batteries" as noted in its description "CBM developed ... as a replacement for the ... Power Storage CBM. Increases ... power capacity by 250 units."
So that concludes the question/theory. If vehicle batteries are powered by the humble battery, and OFC the batteries cannot be drained by cables, having to be inserted into a medium which they can. why not the UPS or more sketchily the Advanced UPS be used as another medium for such drainage.
This also raises the question of why the Cable Charger CBM, the Unified Power System CBM and the Battery System CBM cannot just be one CBM, possibly along the lines of:
Power Integration CBM
Developed by the popular DoubleTech Industries, This CBM is a module can be used to consume power from traditional power sources, such as batteries, vehicle batteries, and the more obscure UPS power systems. To be used with the Power Storage and Armour Interface CBMs.
Thanks for taking your time to read through this and possibly considering it!