# Cable Charger CBM disconnects if vehicle moves (even while you are inside)

**URL:** <https://discourse.cataclysmdda.org/t/cable-charger-cbm-disconnects-if-vehicle-moves-even-while-you-are-inside/17132>\
**Category:** The Garage\
**Created:** [October 24, 2018, 11:34am UTC](https://discourse.cataclysmdda.org/t/cable-charger-cbm-disconnects-if-vehicle-moves-even-while-you-are-inside/17132 "2018-10-24T11:34:31Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![nameless\_survivor](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/nameless_survivor/32/4476_2.png) [@nameless\_survivor](https://discourse.cataclysmdda.org/u/nameless_survivor)\
**Post date:** [October 24, 2018, 11:34am UTC](https://discourse.cataclysmdda.org/t/cable-charger-cbm-disconnects-if-vehicle-moves-even-while-you-are-inside/17132/1 "2018-10-24T11:34:31Z")

</div>

So I plugged my character into my deathmobile before driving, hoping to recharge en route to my next scavenging location, but the jumper cables appear to be tethering to the ground tile instead of the vehicle itself. As a result, ithe jumper cables disconnect if your vehicle moves, even while you are inside. You should be able to wire yourself into the cigarette lighter like a cell phone or something. Any way we can get a fix on this, or is it a programming limitation?

---

<div class="post-metadata">

**Author:** ![darktoes](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@darktoes](https://discourse.cataclysmdda.org/u/darktoes)\
**Post date:** [October 24, 2018, 12:10pm UTC](https://discourse.cataclysmdda.org/t/cable-charger-cbm-disconnects-if-vehicle-moves-even-while-you-are-inside/17132/2 "2018-10-24T12:10:56Z")

</div>

To my knowledge it’s a programming limitation. Vehicles are currently voodoo black magic as it is, stuff like this is a byproduct.

It’s probably doable, but I suspect there’s important groundwork that needs to be done beforehand.

---

<div class="post-metadata">

**Author:** ![nameless\_survivor](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/nameless_survivor/32/4476_2.png) [@nameless\_survivor](https://discourse.cataclysmdda.org/u/nameless_survivor)\
**Post date:** [October 24, 2018, 12:30pm UTC](https://discourse.cataclysmdda.org/t/cable-charger-cbm-disconnects-if-vehicle-moves-even-while-you-are-inside/17132/3 "2018-10-24T12:30:51Z")

</div>

Hmm. Ok. What if we tried fixing it from another direction then:  
Add a new condition for charging to the cable charger CBM, to increase player energy while within 1 tile of a vehicle dashboard.

That way you could still drain the batteries of other vehicles by hooking jumper cables to your nipples, or whatever it is they are clamping to, and also be able to draw power from your own vehicle while driving.

---

<div class="post-metadata">

**Author:** ![darktoes](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@darktoes](https://discourse.cataclysmdda.org/u/darktoes)\
**Post date:** [October 24, 2018, 12:37pm UTC](https://discourse.cataclysmdda.org/t/cable-charger-cbm-disconnects-if-vehicle-moves-even-while-you-are-inside/17132/4 "2018-10-24T12:37:56Z")

</div>

Maybe? I haven’t a clue how it’s all handled. I think Mlangsdorf was working on vehicles last, so you might try chatting him up on Discord. Or just make a Github issue for it.

---

<div class="post-metadata">

**Author:** ![mlangsdorf](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/mlangsdorf/32/2462_2.png) [@mlangsdorf](https://discourse.cataclysmdda.org/u/mlangsdorf)\
**Post date:** [October 24, 2018, 1:52pm UTC](https://discourse.cataclysmdda.org/t/cable-charger-cbm-disconnects-if-vehicle-moves-even-while-you-are-inside/17132/5 "2018-10-24T13:52:04Z")

</div>

There’s already a github issue, thanks.

I thought this was more complicated than it was, but the answer turns out to be that the interaction of the jumper cable and the cable charger system is not super well thought out.

When you first activate a jumper cable, it records the global pos3 of the vehicle part you’re attaching it to. When you activate it again, it installs itself as a vehicle part on both vehicles. But if you’re using a cable charger system, you don’t do the second part, so the cable charger is just in item in your inventory, attached to a nominal vehicle at the initial global pos3. When it comes time to process the cable, if the vehicle has moved away from that initial global pos3, then the disconnect code happens normally.

What should happen is that when you activate a cable charger system, the jumper cable’s “state” var should be set to “cable\_charger”. get\_cable\_target should take player \*p as an argument and if the state is “cable\_charger”, check if p is a passenger and if so, return the pos3 of p.

I was going to go hack at NPC AI but what the heck, this should be easy to fix.

---

<div class="post-metadata">

**Author:** ![nameless\_survivor](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/nameless_survivor/32/4476_2.png) [@nameless\_survivor](https://discourse.cataclysmdda.org/u/nameless_survivor)\
**Post date:** [October 24, 2018, 3:06pm UTC](https://discourse.cataclysmdda.org/t/cable-charger-cbm-disconnects-if-vehicle-moves-even-while-you-are-inside/17132/6 "2018-10-24T15:06:46Z")

</div>

> [@mlangsdorf](#):
>
> I was going to go hack at NPC AI but what the heck, this should be easy to fix.

If we have to choose between better NPC AI and being able to charge while driving, I’ll just pull over to charge lol.

---

<div class="post-metadata">

**Author:** ![mlangsdorf](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/mlangsdorf/32/2462_2.png) [@mlangsdorf](https://discourse.cataclysmdda.org/u/mlangsdorf)\
**Post date:** [October 24, 2018, 4:26pm UTC](https://discourse.cataclysmdda.org/t/cable-charger-cbm-disconnects-if-vehicle-moves-even-while-you-are-inside/17132/7 "2018-10-24T16:26:54Z")

</div>

It was only a couple of hours work, and the NPC AI stuff has more than a few days of effort left in it. So the change didn’t really delay anything.

---

<div class="post-metadata">

**Author:** ![Entity](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/entity/32/3376_2.png) [@Entity](https://discourse.cataclysmdda.org/u/Entity)\
**Post date:** [October 24, 2018, 5:28pm UTC](https://discourse.cataclysmdda.org/t/cable-charger-cbm-disconnects-if-vehicle-moves-even-while-you-are-inside/17132/8 "2018-10-24T17:28:36Z")

</div>

Maybe instead of constantly checking if the cable is connected to the player and vehicle, a charge port could be installed into a seat and just passively charge the person sitting on it.

---

<div class="post-metadata">

**Author:** ![darktoes](https://avatars.discourse-cdn.com/v4/letter/d/b9e5f3/32.png) [@darktoes](https://discourse.cataclysmdda.org/u/darktoes)\
**Post date:** [October 25, 2018, 12:39am UTC](https://discourse.cataclysmdda.org/t/cable-charger-cbm-disconnects-if-vehicle-moves-even-while-you-are-inside/17132/9 "2018-10-25T00:39:29Z")

</div>

> [@mlangsdorf](#):
>
> There’s already a github issue, thanks.

I suspected as much. Latenight laziness strikes again!  
I appreciate the fix though, that bothered me as well.

---

<div class="post-metadata">

**Author:** ![mlangsdorf](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/mlangsdorf/32/2462_2.png) [@mlangsdorf](https://discourse.cataclysmdda.org/u/mlangsdorf)\
**Post date:** [November 2, 2018, 4:12am UTC](https://discourse.cataclysmdda.org/t/cable-charger-cbm-disconnects-if-vehicle-moves-even-while-you-are-inside/17132/10 "2018-11-02T04:12:28Z")

</div>

Turned out to be a little less easy than I thought, but it’s fixed now and the code committed to the latest experimental.
