Skip to content

Instantly share code, notes, and snippets.

@wjt
Created October 29, 2025 17:28
Show Gist options
  • Select an option

  • Save wjt/5b5608084fa9cb6e47a816a2addd8f90 to your computer and use it in GitHub Desktop.

Select an option

Save wjt/5b5608084fa9cb6e47a816a2addd8f90 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -ex
source=scenes/tileset.tres
declare -A targets=(
[tiles/bridges.tres]="tiles for bridges (and their shadows)"
[tiles/elevation.tres]="cliff tiles (plain and mines)"
[tiles/exterior_floors.tres]="grass, sand, and dirt tiles"
[tiles/foam.tres]="foam tiles"
[tiles/void_chromakey.tres]="chromakey Void texture"
[tiles/water.tres]="water tiles"
)
declare -a heads
for target in "${!targets[@]}"
do
desc="${targets[$target]}"
git switch --detach main
git mv "$source" "$target"
git commit --no-verify \
-m "Move $source to $target" \
-m "Subsequent commits will delete all unrelated tiles from the copy, then
restore the source."
git show "split-tileset:$target" > "$target"
git add "$target"
git commit --no-verify \
-m "Remove unrelated tiles from $target" \
-m "This removes all atlas sources except the $desc,
and all unrelated patterns & terrains."
heads+=($(git rev-parse HEAD))
done
git switch --detach main
git merge --no-verify --no-ff "${heads[@]}" \
-m "Split $source into separate tilesets"
# Now restore the original
git checkout main "$source"
git add "$source"
git commit --no-verify -m "Restore $source"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment