#!/bin/sh

DIR_CONFIG="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/"
DIR_GAME="${DIR_CONFIG}../../../"
CONFIG=$(basename "${DIR_CONFIG}")



# << Profile configuration: START

GAME="svencoop"
IP=$(ip route get 1 | awk '{print $NF;exit}')
PORT=27035
SPORT=26902
PLAYERS=12
MAP="_server_start"

# >> Profile configuration: END



printf "Launching SvenDS with the \"${CONFIG}\" configuration profile...\n\n"

cd "${DIR_GAME}"
./svends_run -console -game "${GAME}" +ip "${IP}" -port "${PORT}" +maxplayers "${PLAYERS}" +servercfgfile "servers/${CONFIG}/server.cfg" +logsdir "servers/${CONFIG}/logs" +log on +map "${MAP}"
cd "${DIR_CONFIG}"

printf "\nSvenDS has closed.\n"
exit 0
