The idea is to provide a way to easily removes all the upgrades from a submarine (and its linked submarine, aka shuttle) automatically.
The usecase is for example if you are uncompressing your campaign file and edit your submarine mid-campaign and you want to use these modifications in future campaigns. Since the submarine properties are edited in the submarine file when you upgrade something, using this .sub file without reverting the upgrades in a new campaign is OP because you will start with all the stats already upgraded. (and you can even upgrade them again !)
So this tool restores all the items to their original values while retaining the modifications that you made to the sub.
With python3 installed. (Carefull the installer creation doesn't work on windows with a python version installed from the micrososft store)
- Install pip:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
- Install virtualenv
pip install virtualenv
- Create virtualenv
virtualenv env
- Load env
With visual studio code, use the "Select interpreter command".
If on windows: check execution policy with Get-ExecutionPolicy
Windows online help
Change policy to remote signed to authorize script to execute.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
- Install requirements
pip install -r .\requirements.txt
Drop your .sub file retrieved from your campaign in the workingdir/input folder where you downloaded the python script. You can get using using the Save-Decompressor
The tool will automatically loop over all the sub files in there and produces 3 files in the workingdir/output/ folder.
- subfilename.xml : the original xml describing the sub as zipped in the original .sub file.
- subfilename_noUpgrades.xml : the submarines with all its upgrades removed and its original valeus restored.
- subfilename.sub : Upgrades removed version of the submarines but in a .sub format. (gzipped)
To start the script in dev env, no option is required, just run python3 main.py
With executable, just run the executable
Once the .sub has been produced, you can load it inside the editor to check that the values have indeed been restored to their original.
Within the dev env, run
python -m PyInstaller --name "Barotrauma-Upgrades-Remover" --add-data "workingdir/input/drop_your_sub_file_here.txt;workingdir/input/drop_your_sub_file_here.txt" "src\main.py" --noconfirm