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

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?

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.

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.

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.

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.

1 Like

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

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.

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.

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

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