# Can't use charges from car batteries as part of a recipe. How to fix?

**URL:** https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515
**Category:** The Toolbox
**Created:** [May 18, 2018, 9:00am UTC](https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515 "2018-05-18T09:00:15Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![DaviBones](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@DaviBones](https://discourse.cataclysmdda.org/u/DaviBones)
#### Post date: [May 18, 2018, 9:00am UTC](https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515/1 "2018-05-18T09:00:15Z")

</div>

I tried setting up a recipe to use charges from any of the various types of vehicle batteries, but the game doesn’t see that you have a charged battery when you go to craft it. The recipe shows up in the crafting menu as expected: “car battery (1 charge) OR small storage battery (1 charge) …”

Any ideas what might be going on here? Presumably this is outside the realm of JSON, what cpp file would I dig through to try to debug and solve this?

---

<div class="post-metadata">

### Author: ![DeWolf](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@DeWolf](https://discourse.cataclysmdda.org/u/DeWolf)
#### Post date: [May 18, 2018, 1:57pm UTC](https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515/2 "2018-05-18T13:57:27Z")

</div>

Do you mind posting the recipe?

---

<div class="post-metadata">

### Author: ![DaviBones](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@DaviBones](https://discourse.cataclysmdda.org/u/DaviBones)
#### Post date: [May 18, 2018, 11:01pm UTC](https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515/3 "2018-05-18T23:01:14Z")

</div>

Sure, not a problem.

```
  {
    "result": "tin",
    "type": "recipe",
    "byproducts": [[ "steel_chunk"] ],
    "category": "CC_OTHER",
    "subcategory": "CSC_OTHER_MATERIALS",
    "skill_used": "fabrication",
    "difficulty": 2,
    "time": 30000,
    "batch_time_factors": [50, 2],
    "autolearn": true,
    "qualities" : [{ "id":"CONTAIN","level":1 }],
    "using": [[ "electric_current", 1] ],
    "components": [[ [ "acid", 1] ], [[ "water", 3], ["water_clean", 3] ], [[ "can_food_unsealed", 1] ] ]
  }

```

“electric current” is defined in data/json/requirements/toolsets.json as follows:

```
  {
    "id": "electric_current",
    "type": "requirement",
    "//": "A source of electricity and something to apply it with",
    "tools": [
      [[ "battery_car", 1], ["battery_motorbike", 1], ["small_storage_battery", 1], ["medium_storage_battery", 1], ["storage_battery", 1] ],
      [[ "cable", -1] ]
    ]
  }

```

Side note, if anyone’s curious, the recipe is based on [this patent](https://patents.google.com/patent/US511774A/en).

---

<div class="post-metadata">

### Author: ![DeWolf](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@DeWolf](https://discourse.cataclysmdda.org/u/DeWolf)
#### Post date: [May 19, 2018, 12:02am UTC](https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515/4 "2018-05-19T00:02:22Z")

</div>

I have no personal experience using that particular indicator so unfortunately the only fix I can give is to assign those batteries as tools and use the charge in that sense. A bit hacky but it’s all that I can think of right now.

---

<div class="post-metadata">

### Author: ![DaviBones](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@DaviBones](https://discourse.cataclysmdda.org/u/DaviBones)
#### Post date: [May 19, 2018, 12:18am UTC](https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515/5 "2018-05-19T00:18:28Z")

</div>

Is this what you mean by “assign as tools”?

```
  {
    "result": "tin",
    "type": "recipe",
    "byproducts": [[ "steel_chunk"] ],
    "category": "CC_OTHER",
    "subcategory": "CSC_OTHER_MATERIALS",
    "skill_used": "fabrication",
    "difficulty": 2,
    "time": 30000,
    "batch_time_factors": [50, 2],
    "autolearn": true,
    "qualities" : [{ "id":"CONTAIN","level":1 }],
    "tools": [
      [[ "battery_car", 1], ["battery_motorbike", 1], ["small_storage_battery", 1], ["medium_storage_battery", 1], ["storage_battery", 1] ],
      [[ "cable", -1] ]
    ],
    "components": [[ [ "acid", 1] ], [[ "water", 3], ["water_clean", 3] ], [[ "can_food_unsealed", 1] ] ]
  }

```

That didn’t work either, batteries are still seen as not being available. As before, if I don’t require charges to be consumed, everything works fine.

---

<div class="post-metadata">

### Author: ![DaviBones](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@DaviBones](https://discourse.cataclysmdda.org/u/DaviBones)
#### Post date: [May 19, 2018, 12:38am UTC](https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515/6 "2018-05-19T00:38:13Z")

</div>

Ah, I see, the vehicle batteries are defined as magazines, not tools. Unfortunately, switching them to tools breaks their functionality (expected) and presumably, consuming ammo from magazines in a crafting recipe is not supported in the code. Does anyone know where I would go to add said support? I am still pretty unfamiliar with the source code so I don’t really know where to start.

---

<div class="post-metadata">

### Author: ![Lazy\_lizard](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lazy\_lizard](https://discourse.cataclysmdda.org/u/Lazy_lizard)
#### Post date: [May 19, 2018, 1:26am UTC](https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515/7 "2018-05-19T01:26:31Z")

</div>

You might need to define a “power supply” tool that can accept car batteries as a magazine. See the acetylene torch as an example of tools that accept magazines.

---

<div class="post-metadata">

### Author: ![DeWolf](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@DeWolf](https://discourse.cataclysmdda.org/u/DeWolf)
#### Post date: [May 19, 2018, 1:29am UTC](https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515/8 "2018-05-19T01:29:55Z")

</div>

I still don’t see why this shouldn’t work I mean if it works for tools such as welders where they are filled with batteries in a not same sense but similar why?

---

<div class="post-metadata">

### Author: ![Lazy\_lizard](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@Lazy\_lizard](https://discourse.cataclysmdda.org/u/Lazy_lizard)
#### Post date: [May 19, 2018, 2:05am UTC](https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515/9 "2018-05-19T02:05:07Z")

</div>

Magazines are containers. They technically don’t have charges, just contain charges of ammo.

---

<div class="post-metadata">

### Author: ![DeWolf](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@DeWolf](https://discourse.cataclysmdda.org/u/DeWolf)
#### Post date: [May 19, 2018, 2:07am UTC](https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515/10 "2018-05-19T02:07:23Z")

</div>

What are the charges for car batteries? Regular batteries or something else.

---

<div class="post-metadata">

### Author: ![DaviBones](https://avatars.discourse-cdn.com/v4/letter/d/76d3ee/32.png) [@DaviBones](https://discourse.cataclysmdda.org/u/DaviBones)
#### Post date: [May 19, 2018, 3:27am UTC](https://discourse.cataclysmdda.org/t/cant-use-charges-from-car-batteries-as-part-of-a-recipe-how-to-fix/15515/11 "2018-05-19T03:27:14Z")

</div>

Yes, car batteries are magazines that use batteries as ammo. However they have the tags “NO\_RELOAD” and “NO\_UNLOAD” so that you can’t unload and reload them like normal magazines.

EDIT: Almost forgot, good thinking @Lazy_lizard, I will definitely use your suggestion. Thanks for the help!
