BatterySaveFix
Fixes bloated item and battery save data by pruning stale instance entries and preserving current battery values for kept items.
| Last updated | 2 hours ago |
| Total downloads | 14 |
| Total rating | 0 |
| Categories | Mods Server-side |
| Dependency string | Kai09TA-BatterySaveFix-1.1.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2304README
BatterySaveFix
Fixes bloated battery/item save data in REPO by keeping only the item instances that should actually exist and preserving the latest battery values for those kept entries.
Overview
Some save files can accumulate too many per-item instance entries such as:
Item Gun Handgun/1Item Gun Handgun/2Item Gun Handgun/3
even when only a smaller number of those items should actually exist.
As this grows, the save becomes unnecessarily large and can increase synced data size. In severe cases, this may contribute to Photon/PUN network issues such as buffer overloads.
This mod repairs that save data during load/save handling.
What this mod does
- Keeps only the item instance entries that should remain based on purchased item counts
- Removes excess per-instance keys from:
itemitemStatBattery
- Preserves battery values for kept item instances
- Rebuilds live battery state before saving
- Starts the game's internal battery initialization routine where needed so battery restore works correctly
- Applies host-only logic in multiplayer
Current behavior
The mod currently uses this rule:
- For each purchased item type, keep the earliest instance keys first
- Example:
- if
itemsPurchased["Item Gun Handgun"] == 1 - keep
Item Gun Handgun/1 - remove
/2,/3, and later entries
- if
Battery values for kept entries are preserved from runtime state when saving.
Why host-only
In multiplayer, only the host meaningfully owns and saves the run data.
Clients do not meaningfully repair persistent save data, so this mod only performs its repair/save logic on:
- singleplayer
- multiplayer host
What it fixes
- oversized save files
- duplicated historical item instance entries
- battery data attached to removed stale entries
- cases where save size keeps growing over time
What it does not try to do
- rewrite the game's whole inventory/save architecture
- change vanilla item behavior
- guarantee compatibility with every mod that creates items in unusual ways
Notes
- Existing bloated saves can be cleaned the next time they are loaded/saved with this mod active
- After cleanup, the cleaned content remains in the save file
- If you remove the mod later, vanilla behavior resumes, but already-cleaned data stays cleaned until the game bloats it again
Installation
- Install BepInEx 5 for REPO
- Put
BatterySaveFix.dllinto yourBepInEx/pluginsfolder - Launch the game
Recommended usage
- Load the affected save with the mod enabled
- Let the game save normally
- Continue playing and verify the save no longer grows abnormally
Known limitations
- This mod keeps entries based mainly on purchased counts, so unusual modded item workflows may not perfectly match every edge case
- More testing is still recommended for heavily modded runs
Changelog
1.0
- Initial release
- Added save cleanup for excessive per-instance item keys
- Preserved kept battery values during save
- Added host-only repair logic
- Reduced save bloat and restored multiplayer usability in affected cases
BatterySaveFix
REPO の肥大化した battery / item セーブデータを整理し、実際に存在すべき個体だけを保持しつつ、その個体の最新 battery 値を維持する Mod です。
概要
一部のセーブでは、次のような個体キーが過剰に蓄積することがあります。
Item Gun Handgun/1Item Gun Handgun/2Item Gun Handgun/3
本来そこまで存在していないはずのアイテムでも、履歴のように個体データだけが増え続け、セーブサイズが肥大化します。
これが進行すると、同期データ量も大きくなり、ひどい場合は Photon / PUN のバッファ問題につながることがあります。
この Mod は、そのセーブデータをロード・保存時に整理します。
この Mod がやること
- 購入数に応じて、実際に残すべき item 個体キーだけを保持
- 余分な個体キーを以下から削除
itemitemStatBattery
- 残す個体の battery 値を保持
- 保存直前に、実際のシーン上の battery 状態を再収集
- battery 復元が正しく動くよう、必要な内部初期化処理を起動
- マルチプレイではホストのみで処理
現在の動作ルール
現在は次のルールで整理します。
- 各アイテム種別について、購入数ぶんだけ先頭の個体キーを残す
- 例:
itemsPurchased["Item Gun Handgun"] == 1Item Gun Handgun/1を保持/2,/3以降を削除
保存時には、保持対象になった個体へ runtime 上の battery 値を反映します。
なぜホスト限定なのか
マルチプレイでは、実際に意味のあるセーブ処理を行うのは基本的にホストです。
クライアント側で修正しても永続セーブにはほぼ効果がないため、この Mod の修正処理は次の場合のみ動作します。
- シングルプレイ
- マルチプレイのホスト
修正できるもの
- 肥大化したセーブファイル
- 重複・蓄積した item 個体キー
- 削除されるべき古い個体に紐づいた battery データ
- プレイ継続でセーブがどんどん膨らむ問題
この Mod がやらないこと
- ゲーム全体のセーブ/インベントリ設計の作り直し
- バニラのアイテム仕様変更
- 特殊な生成方法を使うすべての Mod への完全対応
注意
- 既に肥大化しているセーブも、この Mod を有効にした状態でロード/保存すれば整理されます
- 一度整理された内容は、そのままセーブファイルに残ります
- 後で Mod を外した場合、バニラ挙動には戻りますが、整理済みデータ自体が消えるわけではありません
ただし、その後は再びバニラの蓄積挙動が進行する可能性があります
導入方法
- REPO 用の BepInEx 5 を導入
BatterySaveFix.dllをBepInEx/pluginsに入れる- ゲームを起動
推奨される使い方
- 問題のあるセーブを、この Mod を有効にしてロード
- 通常通り保存させる
- 以後、セーブサイズが異常増加しないか確認しながらプレイ
既知の制限
- 現状は主に購入数ベースで保持個体を判断しているため、特殊な Mod アイテム運用では一部ケースが完全一致しない可能性があります
- 大量の Mod を併用している環境では継続検証を推奨します
Changelog
1.0
- 初回リリース
- 過剰な item 個体キーのセーブ整理を追加
- 保持対象の battery 値を保存時に維持
- マルチプレイでホスト限定の修正処理を追加
- セーブ肥大化を軽減し、影響を受けた環境でマルチプレイ動作を改善