This commit is contained in:
Florian Schüller 2016-09-30 13:00:59 +00:00 committed by GitHub
commit 28e2afb8d9
2 changed files with 2335 additions and 13 deletions

View File

@ -97,22 +97,31 @@ if counted == 0:
cl = tuple(int(n / counted) for n in cl)
print("%d %d %d" % cl)
==SCRIPT==
#!/bin/bash -e
#!/bin/bash
AVGCOLOR_PATH=/path/to/avgcolor.py
MTGAME_PATH=/path/to/minetest_game
NODESTXT_PATH=./nodes.txt
COLORSTXT_PATH=./colors.txt
AVGCOLOR_PATH=avgcolor.py
MTGAME_PATH=/usr/share/games/minetest
MTGAME_ALT_PATH=~/.minetest/mods
NODESTXT_PATH=~/.minetest/mods/dumpnodes/nodes.txt
COLORSTXT_PATH=colors.txt
while read -r p; do
set -- junk $p
shift
if [[ ! $1 == "#" && ! $1 == "" ]]; then
echo $1 `python $AVGCOLOR_PATH $(find $MTGAME_PATH -type f -name $2)`
echo $1 1>&2
else
echo "$p"
fi
set -- junk $p
shift
if [[ ! $1 == "#" && ! $1 == "" && ! $2 == "" ]]; then
#don't know why there is a bracket sometimes...
SEARCH_FILE=$(echo $2 | tr -d "(")
FILENAME=$(find $MTGAME_PATH $MTGAME_ALT_PATH -type f -name $SEARCH_FILE|head -n1)
if [ -f "$FILENAME" ]; then
COLOR=$(python $AVGCOLOR_PATH $FILENAME)
echo $1 $COLOR
echo $1 1>&2
else
echo "Skipping $2 (didn't find it)" >&2
fi
else
echo "$p"
fi
done < $NODESTXT_PATH > $COLORSTXT_PATH
# Use nicer colors for water and lava:
sed -re 's/^default:(river_)?water_([^ ]+) [0-9 ]+$/default:\1water_\2 39 66 106 128 224/g' $COLORSTXT_PATH -i
@ -122,6 +131,7 @@ sed -re 's/^default:(.*glass) ([0-9 ]+)$/default:\1 \2 64 16/g' $COLORSTXT_PATH
sed -re 's/^doors:(.*glass[^ ]*) ([0-9 ]+)$/doors:\1 \2 64 16/g' $COLORSTXT_PATH -i
# Fix xpanes color:
sed -re 's/^xpanes:(pane_[0-9]+|bar_[0-9]+) [0-9 ]+$/xpanes:\1 194 194 227 64 16/g' $COLORSTXT_PATH -i
==INSTRUCTIONS==
1) Make sure avgcolors.py outputs the usage instructions
2) Add the dumpnodes mod to Minetest

2312
colors.txt

File diff suppressed because it is too large Load Diff