BatterySystem 1.6.0

Please do not ask when mod authors will update their mods to 3.9.X
Bothering mod authors will lead to warnings and repeat offenses will lead to eventual bans.

Electronics now require drainable batteries.

Huge thank you to Jiro for making this mod!

This mod is not mine, I have only refactored the code & fixed some of the largest issues!

Features

  • All Headsets, Tactical devices, Sights & Thermal/NVGs now require batteries and have a slot reserved for them. Batteries are drained over time when the item is equipped and in use.
  • Without batteries Sights lose their reticle (you can still see through them!) and NVDs & tactical devices won't work.
  • Bots have batteries in their gear & backpacks. Lower level enemies generally have more drained batteries.
  • Several crafts in the hideout make it possible to recharge & make batteries.
  • Device description lets you know which battery type is required, but generally headphones always take AAs, Sights take either AAs or CR2032s, Holographic sights (like EOTECHs) and flashlights take CR123s.

Replaces Existing items:

D Size Batteries => CR2032 Batteries

Rechargable Batteries => CR123 Batteries


Installation

  1. Install like normal: Drop the extracted user/ and BepInEx/ folders into your SPT installation folder.
  2. Refresh Item Icons: After starting the Server, in Launcher click Settings > Clean Temp files.

Compability

BatterySystem conflicts with any mod that modifies D Size Battery or Rechargable Battery.

Any mod that alters hearing (such as a deafening effect) won't probably work well with unpowered headsets. I recommend disabling BatterySystem for headsets in the F12-menu.


Adding compatibility for custom electronics such as collimators:

  1. Open up order.json in your SPT-AKI/user/mods/order.json
  2. Add the folder names of your mods that add electronics. Add Jiro-BatterySystem after them:

JSON: order.json

Code
{  
    "order": [    
        "CustomSightModFolderName",    
        "AnotherCustomSightFolderName",    
        "Jiro-BatterySystem"  
    ]
}

Custom electronics default to using CR2032 batteries.


Written permission from Jiro to publish this updated version:

  • Version 1.6.0

    Tested with SPT 3.9.4

    • Updated to work with SPT 3.9.4
    • Fixed bug where game would soft lock when you entered a Mounted Firearms
    • Reworked battery spawning to be compatible with Realism Mod (Bots will now have batteries)
    • Headphones that attaches to helmets now use batteries
    • Tactical devices attached to helmets now use batteries
    • Flashlights & Lasers are now always turned off (not only visually) when out of battery, which should fix desync & bots seeing lights that dont have batteries
    • Some work on WIP feature "folding" backup sights (not working yet)
    • Refractored almost all code (should be a lot easier to add new features now)


    ^ Work since Jiro's last update

  • there are a couple of devices that get defaulted incorrectly to cr2032, here is the corrected config.json.

    NOTE: NPZ PK1 Obzor defaults to cr2032 even when put under NoBattery entry.


    {

    "CR123": [

    "5c0558060db834001b735271",

    "5c066e3a0db834001b7353f0",

    "5a1eaa87fcdbcb001865f75e",

    "62ff9920fe938a24c90c10d2",

    "570fd6c2d2720bc6458b457f",

    "558022b54bdc2dac148b458d",

    "5c07dd120db834001c39092d",

    "5c0a2cec0db834001b7ce47d",

    "60a23797a37c940de7062d02",

    "58491f3324597764bc48fa02",

    "584924ec24597768f12ae244",

    "59f9d81586f7744c7506ee62",

    "5b3b6e495acfc4330140bd88",

    "609bab8b455afd752b2e6138",

    "5a800961159bd4315e3a1657",

    "5a5f1ce64f39f90b401987bc",

    "56def37dd2720bec348b456a",

    "61605d88ffa6e502ac5e7eeb",

    "5d2369418abbc306c62e0c80",

    "6272370ee4013c5d7e31f418",

    "6272379924e29f06af4d5ecb",

    "560d657b4bdc2da74d8b4572",

    "5cc9c20cd7f00c001336c65d",

    "5c06595c0db834001a66af6c",

    "626becf9582c3e319310b837",

    "57d17c5e2459775a5c57d17d",

    "59d790f486f77403cb06aec6",

    "544909bb4bdc2d6f028b4577",

    "57fd23e32459772d0805bcf1",

    "5b07dd285acfc4001754240d",

    "5b3a337e5acfc4704b4a19a0",

    "5c5952732e2216398b5abda2",

    "5d1b5e94d7ad1a2b865a96b0",

    "646f62fee779812413011ab7",

    "64785e7c19d732620e045e15",

    "655f13e0a246670fb0373245",

    "63fc44e2429a8a166c7f61e6",

    "644a3df63b0b6f03e101e065",

    "6478641c19d732620e045e17"

    ],

    "CR1225": [

    "6165ac8c290d254f5e6b2f6c",

    "5b30b0dc5acfc400153b7124",

    "616442e4faa1272e43152193"

    ],

    "CR2032": [

    "61659f79d92c473c770213ee",

    "584984812459776a704a82a6",

    "570fd721d2720bc5458b4596",

    "5cebec38d7f00c00110a652a",

    "61657230d92c473c770213d7",

    "57ae0171245977343c27bfcf",

    "58d399e486f77442e0016fe7",

    "58d268fc86f774111273f8c2",

    "5a32aa8bc4a2826c6e06d737",

    "5b3116595acfc40019476364",

    "591c4efa86f7741030027726",

    "5947db3f86f77447880cf76f",

    "5c079ed60db834001a66b372"

    ],

    "AA": [

    "5c0696830db834001d23f5da",

    "57235b6f24597759bf5a30f1",

    "5c110624d174af029e69734c",

    "622efbcb99f4ea1a4d6c9a15",

    "5c7d55de2e221644f31bff68",

    "5c0505e00db834001b735073",

    "609a63b6e2ff132951242d09",

    "6033fa48ffd42c541047f728",

    "6033fa48ffd42c541047f728",

    "5b432b965acfc47a8774094e",

    "5645bcc04bdc2d363b8b4572",

    "628e4e576d783146b124c64d",

    "5e4d34ca86f774264f758330",

    "5f60cd6cf2bcbb675b00dac6",

    "5aa2ba71e5b5b000137b758f",

    "5c165d832e2216398b5a7e36",

    "5a16b9fffcdbcb0176308b34",

    "5a7b483fe899ef0016170d15",

    "5d10b49bd7ad1a1a560708b0",

    "6113d6c3290d254f5e6b27db",

    "6284bd5f95250a29bc628a30",

    "5d2da1e948f035477b1ce2ba",

    "609b9e31506cf869cf3eaf41",

    "5a7c74b3e899ef0014332c29",

    "6544d4187c5457729210d277",

    "6477772ea8a38bb2050ed4db"

    ],

    "CR1632": [

    "570fd79bd2720bc7458b4583",

    "57486e672459770abd687134",

    "577d141e24597739c5255e01"

    ],

    "NoBattery": [

    "618a5d5852ecee1505530b2a",

    "606f2696f2cb2e02a42aceb1"

    ]

    }

  • is there a way we can get support for the new headsets on the update .15 back port mod?

  • I absolutely love this mod and need it. I just wish there was a bit more integration with Realism specifically with the headsets. I play with house rules so if I don't have a bat for the headset I don't wear it, but sometimes I have to put a dead headset on to save space, or sometimes I swap out the battery and it allows me to unwittingly cheat unless I am very strictly removing the headset first etc.


    Anyway thank you so much for the work.

  • SOLVED error seems to be within load order

    Error, Im playing with a whole lot of other mods as well. But nothing should conflict as they are similar to TarkovIRL - Weapons Handling Mod


    TypeError: Cannot read properties of undefined (reading 'Filter')

    TypeError: Cannot read properties of undefined (reading 'Filter')

    at Mod.postDBLoad (K:\Windows-Games\SPT\user\mods\Jiro-BatterySystem\src\batterySystem.ts:67:77)

    at PostDBModLoader.executeModsAsync (C:\snapshot\src\loaders\PostDBModLoader.ts:63:45)

    at PostDBModLoader.onLoad (C:\snapshot\src\loaders\PostDBModLoader.ts:26:24)

    at App.load (C:\snapshot\src\utils\App.ts:51:26)

    TypeError: Cannot read properties of undefined (reading 'Filter')

    TypeError: Cannot read properties of undefined (reading 'Filter')

    at Mod.postDBLoad (K:\Windows-Games\SPT\user\mods\Jiro-BatterySystem\src\batterySystem.ts:67:77)

    at PostDBModLoader.executeModsAsync (C:\snapshot\src\loaders\PostDBModLoader.ts:63:45)

    at PostDBModLoader.onLoad (C:\snapshot\src\loaders\PostDBModLoader.ts:26:24)

    at App.load (C:\snapshot\src\utils\App.ts:51:26)

  • "Battery System: Item 646f62fee779812413011ab7 has no defined battery, defaulting to CR2032!" - (yellow text) - can I ignore it, or is it still a mistake?

  • is possible when the battery runs out ( 0/100 ) , the battery disapears , like a stim or a medkit ?

  • NoBatteries exception list doesn't work. Simplified the code a bit while looking for the issue and it seems like there's extra parentheses (after isHeadwear and before isLaserOrFlashlight).


    I imagine the intended logic is


    Code
    if (isNotGogglesFamily && acceptsBatteries && (isFLIR || isHeadwear || isCollimator || isEarpiece || isLaserOrFlashlight || isTacticalDevice))
    Heart 1
    • were i add that ?


      EDIT: ...just found out and replaced it , but have to make other changes too, but is working great now ..

    • What am I supposed to do with this code? can't find where to put it inside batterySystem.ts

  • ive noticed you cant do the individual laser/flashlight NOT gate trick with this mod

    ie you turn your laser and light on, take one off your gun turn the other off, then put it back on. lets you select your laser OR light with T. so you can have blue laser best laser and a predator light. top combo.

    stuff gets turned off when you take it off your gun unlike vanilla.

  • Is there a way to ensure tactical devices spawn with batteries when playing as scav?

  • i put the files in SPT folder and suddnley i see this


    TypeError: Cannot read properties of undefined (reading 'length')

    TypeError: Cannot read properties of undefined (reading 'length')

    at CustomItemService.addModsToItem (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:717:88)

    at CustomItemService.addModsToItem (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:718:50)

    at CustomItemService.addModsToItem (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:718:50)

    at CustomItemService.addModsToItem (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:718:50)

    at CustomItemService.addModsToItem (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:718:50)

    at CustomItemService.processInventoryType (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:689:22)

    at CustomItemService.processBotInventories (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:638:18)

    at CustomItemService.postDBLoad (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:81:18)

    at SianydeAndACRiness.postDBLoad (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\mod.ts:69:32)

    at PostDBModLoader.executeModsAsync (C:\snapshot\src\loaders\PostDBModLoader.ts:63:45)

    TypeError: Cannot read properties of undefined (reading 'length')

    TypeError: Cannot read properties of undefined (reading 'length')

    at CustomItemService.addModsToItem (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:717:88)

    at CustomItemService.addModsToItem (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:718:50)

    at CustomItemService.addModsToItem (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:718:50)

    at CustomItemService.addModsToItem (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:718:50)

    at CustomItemService.addModsToItem (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:718:50)

    at CustomItemService.processInventoryType (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:689:22)

    at CustomItemService.processBotInventories (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:638:18)

    at CustomItemService.postDBLoad (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\CustomItemService.ts:81:18)

    at SianydeAndACRiness.postDBLoad (D:\SPT\user\mods\WTT-SianydeAndACRiness\src\mod.ts:69:32)

    at PostDBModLoader.executeModsAsync (C:\snapshot\src\loaders\PostDBModLoader.ts:63:45)




    any ideas whats going on?

    Thumbs Up 1
    • sound like a bug related to some wtt mod I don't know about, try disabling it and see if the error persists

    • load batterysystem after WTT gun mods

  • Hey thanks for taking on this project! Any way you'd consider adding a config to make batteries required but keep them a non-drainable resource? As in finding the batteries themselves is the only requirement.

  • Dumb question, but is there any way to make this compatible with Merge Consumables?

  • Is there a way to manually define batteries to custom mods or is it just not supported at all?

  • I get this in server when loading a raid.


    • You should load this mod after Algorithmic level progression mod, I think it will fix the issue.

    • I dont use that mod.

    • Strange, I thought that cased an issue. Maybe you have other mods that change bots loadouts? Try to load this mod after them

    • I do have acids bot progression but I'm fairly certain I had this load after it. I'm testing just in case so you will hear back from me shortly :)

    • Nah, it still happens when this is loaded last. Must be a conflict or something if you aren't getting these.

  • Will there be a way to recharge them batteries?🤔

    Could be part of the workbench or generator part of the hideout.

    Thumbs Up 1
    • For those who thougt: "Dude, I have a generator, but I have no way to recharge my batteries directly from it"

      LOOK NO FURTHER!! WE PRESENT TO YOU THE:

      "Generic-Co Universal Battery Charger (TM)"


      Simply Paste The following code below (Production.json)

      Simple craft added to the generator in the hideout to recharge the batteries slowly but pasivelly. Edit to your heart content.

      ©️ JowM

    • So, how do I go about copy pasting it to said file? New to this and and I'd like to know which file, and where to paste it

      Thumbs Up 1
    • i have added this recharge crafts to the mod MoreHideoutCrafts i ported to 3.9

      in this way you do not need to edit any game file


      MoreHideoutCrafts - Fixed

  • problem using t12w and eotech hhs. when switching hhs aiming

  • How does this work when dying?


    You can't insure batteries. Do they stay in gear with insurance?

    • I can insure my batteries (but that might be some other mod idk), but otherwise no, you lose them

  • Game crashes every time I open Skier's tab, disabling the mod solves the issue. Any idea of what could be causing it? I've put this mod at the end of load order


    • This can happen if you have too many items from mods sold by one merchant, "assort" error. It can be fixed by reducing the amount of goods sold by the Skier, for example you can change seller of other modded items to another trader, or change seller of batteries in this mod.

      So it's not this mod error I think, probably just famous "assort" bug.

    • Thank you, I've been modding tarkov since september last year and wasn't aware of this issue until now

  • Is it still buggy with Realism Headset ?

    • Haven't touched that so probably yes. Haven't noticed any issues though...

  • omg ;( ;( ;( ;( :thumbup: :thumbup: :thumbup:

  • Nice one !

  • SICK

    Happy 1