commit 6606c3b3f87bc560afd6461d000fc33042318427 Author: cclecle Date: Sat Jul 23 12:32:44 2022 +0200 first commit diff --git a/Helps/FastCap.txt b/Helps/FastCap.txt new file mode 100644 index 0000000..713797a --- /dev/null +++ b/Helps/FastCap.txt @@ -0,0 +1,26 @@ +FastCap is a mutator that Records the time you used to actually +get the flag from its homebase to your flag. + +It also stores an all-time high, which players can try to break. + +Installation: + +Place FastCap.int and FastCap.u into the \system directory. +Then add ServerPackages=FastCap in your .ini file. +Finally, start the game with the FastCap.FC_Mutator Mutator. +Like: ?mutator=FastCap.FC_Mutator + +Available commands: + +Mutate DeleteHighScore (Admin Only) Deletes the highscore for current map. +Mutate DeleteAllHighScores (Admin Only) Deletes ALL stored highscores. +Mutate ShowHighScore Shows the best time for current map. +Mutate ShowAllHighScores Shows the best times for all maps. + +have fun :) + +TNSe +tnse@unreal2.no + + + diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..3f03e9d --- /dev/null +++ b/Readme.md @@ -0,0 +1,2 @@ +# FastCap Release GIT repository + diff --git a/Run.sh b/Run.sh new file mode 100644 index 0000000..d5d5290 --- /dev/null +++ b/Run.sh @@ -0,0 +1,141 @@ +#!/bin/bash +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +OUTPUT_DIR="$2" +CFG_FILE="$3" +DEFAULT_CFG_FILE=UnrealTournament.ini +function add_iniKeyEx() { + crudini --set $OUTPUT_DIR/System/$1 $2 __$3 $4 + # Warning: ugly hack with sed to allow multiple key instances + to remove space around '=' + sed -i "s/[[:space:]]*__$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')[[:space:]]*=[[:space:]]*/$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')=/g" $OUTPUT_DIR/System/$1 +} +function set_iniKeyEx() { + crudini --set $OUTPUT_DIR/System/$1 $2 $3 $4 +} +# !!Warning!! section is not considered +function del_iniKeyEx() { + sed -i "/[[:space:]]*$(echo $3 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')[[:space:]]*=[[:space:]]*$(echo $4 | sed -e 's/\([[\/.*]\|\]\)/\\&/g')/d" $OUTPUT_DIR/System/$1 +} +function add_iniKey() { + add_iniKeyEx $CFG_FILE $1 $2 $3 +} +function set_iniKey() { + set_iniKeyEx $CFG_FILE $1 $2 $3 +} +# !!Warning!! section is not considered +function del_iniKey() { + del_iniKeyEx $CFG_FILE $1 $2 $3 +} +function add_ServerPackage() { + add_iniKey 'Engine.GameEngine' ServerPackages $1 + add_iniKey 'XC_Engine.XC_GameEngine' ServerPackages $1 +} +function del_ServerPackage() { + del_iniKey 'Engine.GameEngine' ServerPackages $1 + del_iniKey 'XC_Engine.XC_GameEngine' ServerPackages $1 +} +function add_ServerActors() { + add_iniKey 'Engine.GameEngine' ServerActors $1 + add_iniKey 'XC_Engine.XC_GameEngine' ServerActors $1 +} +function del_ServerActors() { + del_iniKey 'Engine.GameEngine' ServerActors $1 + del_iniKey 'XC_Engine.XC_GameEngine' ServerActors $1 +} +function getmodprefix() { + UFile=$(find $OUTPUT_DIR/System -type f -iname "FastCap*.u" -exec basename {} \;) + BaseName="${UFile%.*}" + echo "$BaseName" +} +function install() { + rsync -a $SCRIPT_DIR/Help/ $OUTPUT_DIR/Help/ --exclude '.git' + rsync -a $SCRIPT_DIR/System/ $OUTPUT_DIR/System/ --exclude '.git' + + echo install ok +} +function enable() { + BaseName="$(getmodprefix)" + add_ServerPackage $BaseName + + echo enable ok +} +function disable() { + BaseName="$(getmodprefix)" + del_ServerPackage $BaseName + + echo disable ok +} +function show_help() { + echo + echo "Usage: $0 { getmodprefix | install | enable | disable } [] [ ]" + echo +} +function check_cfg_file_config() { + if [ $# -eq 4 ] + then + echo "CFG_FILE is unset, setting it to $DEFAULT_CFG_FILE" + CFG_FILE=$DEFAULT_CFG_FILE + elif [ $# -eq 5 ] + then + echo "CFG_FILE is set to '$CFG_FILE'" + else + echo "Wrong number of arguments" + show_help + exit 9999 # die with error code 9999 + fi + if [ ! -f $OUTPUT_DIR/System/$CFG_FILE ] + then + echo "$OUTPUT_DIR/System/$CFG_FILE does not exist" + show_help + exit 9999 # die with error code 9999 + fi +} +function check_cfg_file_gen() { + if [ -z ${CFG_FILE} ] + then + echo "CFG_FILE is unset, setting it to $DEFAULT_CFG_FILE" + CFG_FILE=$DEFAULT_CFG_FILE + else + echo "CFG_FILE is set to '$CFG_FILE'" + fi + if [ ! -f $OUTPUT_DIR/System/$CFG_FILE ] + then + echo "$OUTPUT_DIR/System/$CFG_FILE does not exist" + show_help + exit 9999 # die with error code 9999 + fi +} +function check_game_dir() { + ### Check if a directory does not exist ### + if [ -z $OUTPUT_DIR ] + then + echo "incorrect " + show_help + exit 9999 # die with error code 9999 + fi +} +case "$1" in + 'getmodprefix') + check_game_dir + getmodprefix + ;; + 'install') + check_game_dir "$@" + install "$@" + ;; + 'enable') + check_game_dir "$@" + check_cfg_file_gen "$@" + disable "$@" + enable "$@" + ;; + 'disable') + check_game_dir "$@" + check_cfg_file_gen "$@" + disable "$@" + ;; + *) + show_help + exit 1 + ;; +esac +exit 0 diff --git a/System/FastCap.int b/System/FastCap.int new file mode 100644 index 0000000..71f458b --- /dev/null +++ b/System/FastCap.int @@ -0,0 +1,2 @@ +[Public] +Object=(Name=FastCap.FC_Mutator,Class=Class,MetaClass=Engine.Mutator,Description="FastCap,FastCap: Cap the flag FAST") diff --git a/System/FastCap.u b/System/FastCap.u new file mode 100644 index 0000000..b876cd1 Binary files /dev/null and b/System/FastCap.u differ