Okay, so my change wasn’t quite there after some testing anyways.
I’m honestly a little stumped as to what is going on. If the item type is TOOL then battery charges in the pocket don’t sync up with how many “charges” the item has. battery will be 1500 and charges 0, this appears to prevent items from using the ups as the see it as uncharged. The name will also be “UPS 0/1500” despite the pocket being full of battery. The ups also fails to charge in this state, if totally empty it will add one battery but charges and the name will not update, it will also prevent other items in the charger from charging.
However, if I change the item type to TOOL_ARMOR like it is in aftershock it will functionally recharge as well as display the proper charge it its title, however, all items no longer recognize it as a UPS.
If i try to reconfigure it like the electric jackhammer, forgo the pocket and just use
Then as soon as something uses the UPS it will add batteries down at the bottom of the item description. Item use will continue to drain those batteries but will leave the Charges: 1500 and then throw errors (can’t set ammo null in ups as it is not an ammo item& item::ammo_set(const itype_id&, int) : 579) when it runs out of the mystery batteries it added.
I’m guessing item type TOOL has some special handling for charges and stuff. I’ll screw around with this more tomorrow, maybe put on my big boy pants and learn some c++.