diff --git a/Run.sh b/Run.sh index 27c41fd..a2ae23e 100755 --- a/Run.sh +++ b/Run.sh @@ -36,6 +36,12 @@ function del_ServerActors() { del_iniKey 'XC_Engine.XC_GameEngine' ServerActors $1 } +function getmodprefix() { + UNUFile=$(find $OUTPUT_DIR/System -type f -name "UN*.u" -exec basename {} \;) + UNBaseName="${UNUFile%.*}" + echo $UNBaseName +} + function install() { rsync -a $SCRIPT_DIR/Help/ $OUTPUT_DIR/Help --exclude '.git' rsync -a $SCRIPT_DIR/System/ $OUTPUT_DIR/System --exclude '.git' @@ -44,8 +50,7 @@ function install() { } function enable() { - UNUFile=$(find $OUTPUT_DIR/System -type f -name "UN*.u" -exec basename {} \;) - UNBaseName="${UNUFile%.*}" + UNBaseName=getmodprefix() VAUFile=$(find $OUTPUT_DIR/System -type f -name "VAH*.u" -exec basename {} \;) VABaseName="${VAUFile%.*}" @@ -58,8 +63,7 @@ function enable() { } function disable() { - UNUFile=$(find $OUTPUT_DIR/System -type f -name "UN*.u" -exec basename {} \;) - UNBaseName="${UNUFile%.*}" + UNBaseName=getmodprefix() VAUFile=$(find $OUTPUT_DIR/System -type f -name "VAH*.u" -exec basename {} \;) VABaseName="${VAUFile%.*}" @@ -72,63 +76,45 @@ function disable() { } function enableCG() { - UNUFile=$(find $OUTPUT_DIR/System -type f -name "UN*.u" -exec basename {} \;) - UNBaseName="${UNUFile%.*}" - - add_ServerActors $UNBaseName.NewNetCG - + UNBaseName=getmodprefix() + add_ServerActors $UNBaseName.NewNetCG echo enable ok } function disableCG() { - UNUFile=$(find $OUTPUT_DIR/System -type f -name "UN*.u" -exec basename {} \;) - UNBaseName="${UNUFile%.*}" - + UNBaseName=getmodprefix() del_ServerActors $UNBaseName.NewNetCG - echo disable ok } function enableDJ() { - UNUFile=$(find $OUTPUT_DIR/System -type f -name "UN*.u" -exec basename {} \;) - UNBaseName="${UNUFile%.*}" - - add_ServerActors $UNBaseName.DoubleJump - + UNBaseName=getmodprefix() + add_ServerActors $UNBaseName.DoubleJump echo enable ok } function disableDJ() { - UNUFile=$(find $OUTPUT_DIR/System -type f -name "UN*.u" -exec basename {} \;) - UNBaseName="${UNUFile%.*}" - + UNBaseName=getmodprefix() del_ServerActors $UNBaseName.DoubleJump - echo disable ok } function enableGM() { - UNUFile=$(find $OUTPUT_DIR/System -type f -name "UN*.u" -exec basename {} \;) - UNBaseName="${UNUFile%.*}" - - add_ServerActors $UNBaseName.GrapMut - + UNBaseName=getmodprefix() + add_ServerActors $UNBaseName.GrapMut echo enable ok } function disableGM() { - UNUFile=$(find $OUTPUT_DIR/System -type f -name "UN*.u" -exec basename {} \;) - UNBaseName="${UNUFile%.*}" - + UNBaseName=getmodprefix() del_ServerActors $UNBaseName.GrapMut - echo disable ok } function show_help() { echo - echo "Usage: $0 { install | enable | disable } []" + echo "Usage: $0 { getmodprefix |install | enable | disable } []" echo " $0 { enableCG | disableCG } []" echo " $0 { enableDJ | disableDJ } []" echo " $0 { enableGM | disableGM } []" @@ -163,6 +149,10 @@ function check_game_dir() { } case "$1" in + 'getmodprefix') + check_game_dir + getmodprefix + ;; 'install') check_game_dir install