Browse Source

Settings Cacher

master
rubenwardy 7 years ago
parent
commit
a51ea6b163
  1. 29
      build.sh
  2. 36
      settings_cache.csv

29
build.sh

@ -0,0 +1,29 @@
# Automatically caches settings in the code
# (turns calls to ctf.setting into constants)
echo Creating build directory $1
rm -fr $1
mkdir $1
echo Copying files
rsync -av --exclude=".*" . $1 > /tmp/0
# Read CSV files
echo Replacing settings...
INPUT=settings_cache.csv
OLDIFS=$IFS
IFS=" "
[ ! -f $INPUT ] &while read sName sValue
do
# Trim sName
sName="$(echo -e "${sName}" | sed -e 's/[[:space:]]*$//')"
# Replace in all files
grep -rl "ctf.setting($sName)" $1 | xargs sed -i "s/ctf.setting($sName)/$sValue/g"
# Print message
echo "Replacing ctf.setting($sName) with $sValue"
done < $INPUT
IFS=$OLDIFS
echo Done

36
settings_cache.csv

@ -0,0 +1,36 @@
"allocate_mode" 3
"autoalloc_on_joinplayer" true
"chat.default" "global"
"chat.global_channel" true
"chat.team_channel" true
"colors.nametag" true
"colors.skins" true
"default_diplo_state" "war"
"diplomacy" false
"flag.allow_multiple" true
"flag.capture_mode" "take"
"flag.capture_take" true
"flag.names" true
"flag.protect_distance" 25
"flag.waypoints" true
"friendly_fire" false
"gui" true
"gui.tab.diplo" false
"gui.tab.flags" false
"gui.tab.news" true
"gui.tab.settings" false
"gui.team" true
"gui.team.initial" "news"
"gui.team.teleport_to_flag" false
"gui.team.teleport_to_spawn" false
"hud" true
"match" true
"match.break_alliances" true
"match.clear_inv" true
"match.destroy_team" true
"match.map_reset_limit" 16
"match.teams" "red, red, 15, 7, 39; blue, blue, -9, 9, -43"
"maximum_in_team" -1
"node_ownership" false
"players_can_change_team" false
"remove_player_on_leave" true
Can't render this file because it contains an unexpected character in line 3 and column 17.
Loading…
Cancel
Save