Add traffic lane GPS weighting toolkit
This commit is contained in:
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -lt 3 ]]; then
|
||||
echo "usage: $0 <game-dir> <archive-or-archive-dir> <work-dir>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
game_dir=$1
|
||||
archive_path=$2
|
||||
work_dir=$3
|
||||
container=${CP77_TOOLBOX_CONTAINER:-2077}
|
||||
tool='${HOME}/.dotnet/tools/cp77tools'
|
||||
|
||||
raw_dir="${work_dir}/01_raw"
|
||||
json_dir="${work_dir}/02_json"
|
||||
patched_json_dir="${work_dir}/03_json_patched"
|
||||
patched_raw_dir="${work_dir}/04_raw_patched"
|
||||
packed_dir="${work_dir}/05_packed"
|
||||
|
||||
mkdir -p "${raw_dir}" "${json_dir}" "${patched_json_dir}" "${patched_raw_dir}" "${packed_dir}"
|
||||
|
||||
toolbox run --container "${container}" bash -lc \
|
||||
"${tool} extract '$archive_path' --gamepath '$game_dir' --outpath '$raw_dir' --regex 'traffic.*persistent|persistent.*traffic|traffic.*lane|world.*traffic'"
|
||||
|
||||
toolbox run --container "${container}" bash -lc \
|
||||
"${tool} convert serialize '$raw_dir' --outpath '$json_dir'"
|
||||
|
||||
python3 tools/patch_traffic_lanes.py "${json_dir}" "${patched_json_dir}" --copy-unchanged
|
||||
|
||||
toolbox run --container "${container}" bash -lc \
|
||||
"${tool} convert deserialize '$patched_json_dir' --outpath '$patched_raw_dir'"
|
||||
|
||||
toolbox run --container "${container}" bash -lc \
|
||||
"${tool} pack '$patched_raw_dir' --outpath '$packed_dir'"
|
||||
|
||||
echo "packed archive output: ${packed_dir}"
|
||||
Reference in New Issue
Block a user