From 6a767bd2613c29793bf1eedd1e825feed17a98bc Mon Sep 17 00:00:00 2001 From: Marco Spreckels Date: Mon, 29 Jan 2024 17:37:50 +0100 Subject: [PATCH 1/9] set palworldsettings via envsubst and templating --- Dockerfile | 5 +- scripts/compile-settings.sh | 64 ++++++ scripts/files/PalWorldSettings.ini.template | 2 + scripts/start.sh | 237 +------------------- 4 files changed, 72 insertions(+), 236 deletions(-) create mode 100644 scripts/compile-settings.sh create mode 100644 scripts/files/PalWorldSettings.ini.template diff --git a/Dockerfile b/Dockerfile index 5fd8106f0..3b5a5c875 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ xdg-user-dirs=0.17-2 \ procps=2:3.3.17-5 \ wget=1.21-1+deb11u1 \ + gettext-base \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -31,8 +32,8 @@ ENV PORT= \ TZ=UTC \ SERVER_DESCRIPTION= -COPY ./scripts/* /home/steam/server/ -RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh /home/steam/server/backup.sh && \ +COPY ./scripts /home/steam/server/ +RUN chmod +x /home/steam/server/init.sh /home/steam/server/compile-settings.sh /home/steam/server/start.sh /home/steam/server/backup.sh && \ mv /home/steam/server/backup.sh /usr/local/bin/backup WORKDIR /home/steam/server diff --git a/scripts/compile-settings.sh b/scripts/compile-settings.sh new file mode 100644 index 000000000..7ede552f8 --- /dev/null +++ b/scripts/compile-settings.sh @@ -0,0 +1,64 @@ +export DIFFICULTY=${DIFFICULTY:-None} +export DAY_TIME_SPEED_RATE=${DAY_TIME_SPEED_RATE:-1.000000} +export NIGHT_TIME_SPEED_RATE=${NIGHT_TIME_SPEED_RATE:-1.000000} +export EXP_RATE=${EXP_RATE:-1.000000} +export PAL_CAPTURE_RATE=${PAL_CAPTURE_RATE:-1.000000} +export PAL_SPAWN_NUM_RATE=${PAL_SPAWN_NUM_RATE:-1.000000} +export PAL_DAMAGE_RATE_ATTACK=${PAL_DAMAGE_RATE_ATTACK:-1.000000} +export PAL_DAMAGE_RATE_DEFENSE=${PAL_DAMAGE_RATE_DEFENSE:-1.000000} +export PLAYER_DAMAGE_RATE_ATTACK=${PLAYER_DAMAGE_RATE_ATTACK:-1.000000} +export PLAYER_DAMAGE_RATE_DEFENSE=${PLAYER_DAMAGE_RATE_DEFENSE:-1.000000} +export PLAYER_STOMACH_DECREACE_RATE=${PLAYER_STOMACH_DECREACE_RATE:-1.000000} +export PLAYER_STAMINA_DECREACE_RATE=${PLAYER_STAMINA_DECREACE_RATE:-1.000000} +export PLAYER_AUTO_HPREGENE_RATE=${PLAYER_AUTO_HPREGENE_RATE:-1.000000} +export PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP=${PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP:-1.000000} +export PAL_STOMACH_DECREACE_RATE=${PAL_STOMACH_DECREACE_RATE:-1.000000} +export PAL_STAMINA_DECREACE_RATE=${PAL_STAMINA_DECREACE_RATE:-1.000000} +export PAL_AUTO_HPREGENE_RATE=${PAL_AUTO_HPREGENE_RATE:-1.000000} +export PAL_AUTO_HP_REGENE_RATE_IN_SLEEP=${PAL_AUTO_HP_REGENE_RATE_IN_SLEEP:-1.000000} +export BUILD_OBJECT_DAMAGE_RATE=${BUILD_OBJECT_DAMAGE_RATE:-1.000000} +export BUILD_OBJECT_DETERIORATION_DAMAGE_RATE=${BUILD_OBJECT_DETERIORATION_DAMAGE_RATE:-1.000000} +export COLLECTION_DROP_RATE=${COLLECTION_DROP_RATE:-1.000000} +export COLLECTION_OBJECT_HP_RATE=${COLLECTION_OBJECT_HP_RATE:-1.000000} +export COLLECTION_OBJECT_RESPAWN_SPEED_RATE=${COLLECTION_OBJECT_RESPAWN_SPEED_RATE:-1.000000} +export ENEMY_DROP_ITEM_RATE=${ENEMY_DROP_ITEM_RATE:-1.000000} +export DEATH_PENALTY=${DEATH_PENALTY:-All} +export ENABLE_PLAYER_TO_PLAYER_DAMAGE=${ENABLE_PLAYER_TO_PLAYER_DAMAGE:-False} +export ENABLE_FRIENDLY_FIRE=${ENABLE_FRIENDLY_FIRE:-False} +export ENABLE_INVADER_ENEMY=${ENABLE_INVADER_ENEMY:-True} +export ACTIVE_UNKO=${ACTIVE_UNKO:-False} +export ENABLE_AIM_ASSIST_PAD=${ENABLE_AIM_ASSIST_PAD:-True} +export ENABLE_AIM_ASSIST_KEYBOARD=${ENABLE_AIM_ASSIST_KEYBOARD:-False} +export DROP_ITEM_MAX_NUM=${DROP_ITEM_MAX_NUM:-3000} +export DROP_ITEM_MAX_NUM_UNKO=${DROP_ITEM_MAX_NUM_UNKO:-100} +export BASE_CAMP_MAX_NUM=${BASE_CAMP_MAX_NUM:-128} +export BASE_CAMP_WORKER_MAX_NUM=${BASE_CAMP_WORKER_MAX_NUM:-15} +export DROP_ITEM_ALIVE_MAX_HOURS=${DROP_ITEM_ALIVE_MAX_HOURS:-1.000000} +export AUTO_RESET_GUILD_NO_ONLINE_PLAYERS=${AUTO_RESET_GUILD_NO_ONLINE_PLAYERS:-False} +export AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS=${AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS:-72.000000} +export GUILD_PLAYER_MAX_NUM=${GUILD_PLAYER_MAX_NUM:-20} +export PAL_EGG_DEFAULT_HATCHING_TIME=${PAL_EGG_DEFAULT_HATCHING_TIME:-72.000000} +export WORK_SPEED_RATE=${WORK_SPEED_RATE:-1.000000} +export IS_MULTIPLAY=${IS_MULTIPLAY:-False} +export IS_PVP=${IS_PVP:-False} +export CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP=${CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP:-False} +export ENABLE_NON_LOGIN_PENALTY=${ENABLE_NON_LOGIN_PENALTY:-True} +export ENABLE_FAST_TRAVEL=${ENABLE_FAST_TRAVEL:-True} +export IS_START_LOCATION_SELECT_BY_MAP=${IS_START_LOCATION_SELECT_BY_MAP:-True} +export EXIST_PLAYER_AFTER_LOGOUT=${EXIST_PLAYER_AFTER_LOGOUT:-False} +export ENABLE_DEFENSE_OTHER_GUILD_PLAYER=${ENABLE_DEFENSE_OTHER_GUILD_PLAYER:-False} +export COOP_PLAYER_MAX_NUM=${COOP_PLAYER_MAX_NUM:-4} +export SERVER_PLAYER_MAX_NUM=${SERVER_PLAYER_MAX_NUM:-32} +export SERVER_NAME=${SERVER_NAME:-"Default Palworld Server"} +export SERVER_DESCRIPTION=${SERVER_DESCRIPTION:-""} +export ADMIN_PASSWORD=${ADMIN_PASSWORD:-""} +export SERVER_PASSWORD=${SERVER_PASSWORD:-""} +export PUBLIC_PORT=${PUBLIC_PORT:-8211} +export PUBLIC_IP=${PUBLIC_IP:-""} +export RCON_ENABLED=${RCON_ENABLED:-False} +export RCON_PORT=${RCON_PORT:-25575} +export REGION=${REGION:-""} +export USE_AUTH=${USE_AUTH:-True} +export BAN_LIST_URL=${BAN_LIST_URL:-"https://api.palworldgame.com/api/banlist.txt"} + +envsubst < ./files/PalWorldSettings.ini.template > /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini \ No newline at end of file diff --git a/scripts/files/PalWorldSettings.ini.template b/scripts/files/PalWorldSettings.ini.template new file mode 100644 index 000000000..b36877152 --- /dev/null +++ b/scripts/files/PalWorldSettings.ini.template @@ -0,0 +1,2 @@ +[/Script/Pal.PalGameWorldSettings] +OptionSettings=(Difficulty=$DIFFICULTY,DayTimeSpeedRate=$DAY_TIME_SPEED_RATE,NightTimeSpeedRate=$NIGHT_TIME_SPEED_RATE,ExpRate=$EXP_RATE,PalCaptureRate=$PAL_CAPTURE_RATE,PalSpawnNumRate=$PAL_SPAWN_NUM_RATE,PalDamageRateAttack=$PAL_DAMAGE_RATE_ATTACK,PalDamageRateDefense=$PAL_DAMAGE_RATE_DEFENSE,PlayerDamageRateAttack=$PLAYER_DAMAGE_RATE_ATTACK,PlayerDamageRateDefense=$PLAYER_DAMAGE_RATE_DEFENSE,PlayerStomachDecreaceRate=$PLAYER_STOMACH_DECREACE_RATE,PlayerStaminaDecreaceRate=$PLAYER_STAMINA_DECREACE_RATE,PlayerAutoHPRegeneRate=$PLAYER_AUTO_HPREGENE_RATE,PlayerAutoHpRegeneRateInSleep=$PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP,PalStomachDecreaceRate=$PAL_STOMACH_DECREACE_RATE,PalStaminaDecreaceRate=$PAL_STAMINA_DECREACE_RATE,PalAutoHPRegeneRate=$PAL_AUTO_HPREGENE_RATE,PalAutoHpRegeneRateInSleep=$PAL_AUTO_HP_REGENE_RATE_IN_SLEEP,BuildObjectDamageRate=$BUILD_OBJECT_DAMAGE_RATE,BuildObjectDeteriorationDamageRate=$BUILD_OBJECT_DETERIORATION_DAMAGE_RATE,CollectionDropRate=$COLLECTION_DROP_RATE,CollectionObjectHpRate=$COLLECTION_OBJECT_HP_RATE,CollectionObjectRespawnSpeedRate=$COLLECTION_OBJECT_RESPAWN_SPEED_RATE,EnemyDropItemRate=$ENEMY_DROP_ITEM_RATE,DeathPenalty=$DEATH_PENALTY,bEnablePlayerToPlayerDamage=$ENABLE_PLAYER_TO_PLAYER_DAMAGE,bEnableFriendlyFire=$ENABLE_FRIENDLY_FIRE,bEnableInvaderEnemy=$ENABLE_INVADER_ENEMY,bActiveUNKO=$ACTIVE_UNKO,bEnableAimAssistPad=$ENABLE_AIM_ASSIST_PAD,bEnableAimAssistKeyboard=$ENABLE_AIM_ASSIST_KEYBOARD,DropItemMaxNum=$DROP_ITEM_MAX_NUM,DropItemMaxNum_UNKO=$DROP_ITEM_MAX_NUM_UNKO,BaseCampMaxNum=$BASE_CAMP_MAX_NUM,BaseCampWorkerMaxNum=$BASE_CAMP_WORKER_MAX_NUM,DropItemAliveMaxHours=$DROP_ITEM_ALIVE_MAX_HOURS,bAutoResetGuildNoOnlinePlayers=$AUTO_RESET_GUILD_NO_ONLINE_PLAYERS,AutoResetGuildTimeNoOnlinePlayers=$AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS,GuildPlayerMaxNum=$GUILD_PLAYER_MAX_NUM,PalEggDefaultHatchingTime=$PAL_EGG_DEFAULT_HATCHING_TIME,WorkSpeedRate=$WORK_SPEED_RATE,bIsMultiplay=$IS_MULTIPLAY,bIsPvP=$IS_PVP,bCanPickupOtherGuildDeathPenaltyDrop=$CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP,bEnableNonLoginPenalty=$ENABLE_NON_LOGIN_PENALTY,bEnableFastTravel=$ENABLE_FAST_TRAVEL,bIsStartLocationSelectByMap=$IS_START_LOCATION_SELECT_BY_MAP,bExistPlayerAfterLogout=$EXIST_PLAYER_AFTER_LOGOUT,bEnableDefenseOtherGuildPlayer=$ENABLE_DEFENSE_OTHER_GUILD_PLAYER,CoopPlayerMaxNum=$COOP_PLAYER_MAX_NUM,ServerPlayerMaxNum=$SERVER_PLAYER_MAX_NUM,ServerName=$SERVER_NAME,ServerDescription=$SERVER_DESCRIPTION,AdminPassword=$ADMIN_PASSWORD,ServerPassword=$SERVER_PASSWORD,PublicPort=$PUBLIC_PORT,PublicIP=$PUBLIC_IP,RCONEnabled=$RCON_ENABLED,RCONPort=$RCON_PORT,Region=$REGION,bUseAuth=$USE_AUTH,BanListURL=$BAN_LIST_URL) \ No newline at end of file diff --git a/scripts/start.sh b/scripts/start.sh index fba063ae8..bb9074e28 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -39,8 +39,6 @@ if [ "${MULTITHREADING}" = true ]; then STARTCOMMAND+=("-useperfthreads" "-NoAsyncLoadingThread" "-UseMultithreadForDS") fi -cd /palworld || exit - printf "\e[0;32m*****CHECKING FOR EXISTING CONFIG*****\e[0m\n" # shellcheck disable=SC2143 @@ -56,238 +54,9 @@ if [ ! "$(grep -s '[^[:space:]]' /palworld/Pal/Saved/Config/LinuxServer/PalWorld cp /palworld/DefaultPalWorldSettings.ini /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini fi -if [ -n "${PLAYERS}" ]; then - echo "PLAYERS=${PLAYERS}" - sed -E -i "s/ServerPlayerMaxNum=[0-9]*/ServerPlayerMaxNum=$PLAYERS/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PUBLIC_IP}" ]; then - echo "PUBLIC_IP=${PUBLIC_IP}" - sed -E -i "s/PublicIP=\"[^\"]*\"/PublicIP=\"$PUBLIC_IP\"/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PUBLIC_PORT}" ]; then - echo "PUBLIC_PORT=${PUBLIC_PORT}" - sed -E -i "s/PublicPort=[0-9]*/PublicPort=$PUBLIC_PORT/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${DIFFICULTY}" ]; then - echo "DIFFICULTY=$DIFFICULTY" - sed -E -i "s/Difficulty=[a-zA-Z]*/Difficulty=$DIFFICULTY/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${DAYTIME_SPEEDRATE}" ]; then - echo "DAYTIME_SPEEDRATE=$DAYTIME_SPEEDRATE" - sed -E -i "s/DayTimeSpeedRate=[+-]?([0-9]*[.])?[0-9]+/DayTimeSpeedRate=$DAYTIME_SPEEDRATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${NIGHTTIME_SPEEDRATE}" ]; then - echo "NIGHTTIME_SPEEDRATE=$NIGHTTIME_SPEEDRATE" - sed -E -i "s/NightTimeSpeedRate=[+-]?([0-9]*[.])?[0-9]+/NightTimeSpeedRate=$NIGHTTIME_SPEEDRATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${EXP_RATE}" ]; then - echo "EXP_RATE=$EXP_RATE" - sed -E -i "s/ExpRate=[+-]?([0-9]*[.])?[0-9]+/ExpRate=$EXP_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PAL_CAPTURE_RATE}" ]; then - echo "PAL_CAPTURE_RATE=$PAL_CAPTURE_RATE" - sed -E -i "s/PalCaptureRate=[+-]?([0-9]*[.])?[0-9]+/PalCaptureRate=$PAL_CAPTURE_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PAL_SPAWN_NUM_RATE}" ]; then - echo "PAL_SPAWN_NUM_RATE=$PAL_SPAWN_NUM_RATE" - sed -E -i "s/PalSpawnNumRate=[+-]?([0-9]*[.])?[0-9]+/PalSpawnNumRate=$PAL_SPAWN_NUM_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PAL_DAMAGE_RATE_ATTACK}" ]; then - echo "PAL_DAMAGE_RATE_ATTACK=$PAL_DAMAGE_RATE_ATTACK" - sed -E -i "s/PalDamageRateAttack=[+-]?([0-9]*[.])?[0-9]+/PalDamageRateAttack=$PAL_DAMAGE_RATE_ATTACK/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PAL_DAMAGE_RATE_DEFENSE}" ]; then - echo "PAL_DAMAGE_RATE_DEFENSE=$PAL_DAMAGE_RATE_DEFENSE" - sed -E -i "s/PalDamageRateDefense=[+-]?([0-9]*[.])?[0-9]+/PalDamageRateDefense=$PAL_DAMAGE_RATE_DEFENSE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PLAYER_DAMAGE_RATE_ATTACK}" ]; then - echo "PLAYER_DAMAGE_RATE_ATTACK=$PLAYER_DAMAGE_RATE_ATTACK" - sed -E -i "s/PlayerDamageRateAttack=[+-]?([0-9]*[.])?[0-9]+/PlayerDamageRateAttack=$PLAYER_DAMAGE_RATE_ATTACK/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PLAYER_DAMAGE_RATE_DEFENSE}" ]; then - echo "PLAYER_DAMAGE_RATE_DEFENSE=$PLAYER_DAMAGE_RATE_DEFENSE" - sed -E -i "s/PlayerDamageRateDefense=[+-]?([0-9]*[.])?[0-9]+/PlayerDamageRateDefense=$PLAYER_DAMAGE_RATE_DEFENSE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PLAYER_STOMACH_DECREASE_RATE}" ]; then - echo "PLAYER_STOMACH_DECREASE_RATE=$PLAYER_STOMACH_DECREASE_RATE" - sed -E -i "s/PlayerStomachDecreaceRate=[+-]?([0-9]*[.])?[0-9]+/PlayerStomachDecreaceRate=$PLAYER_STOMACH_DECREASE_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PLAYER_STAMINA_DECREASE_RATE}" ]; then - echo "PLAYER_STAMINA_DECREASE_RATE=$PLAYER_STAMINA_DECREASE_RATE" - sed -E -i "s/PlayerStaminaDecreaceRate=[+-]?([0-9]*[.])?[0-9]+/PlayerStaminaDecreaceRate=$PLAYER_STAMINA_DECREASE_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PLAYER_AUTO_HP_REGEN_RATE}" ]; then - echo "PLAYER_AUTO_HP_REGEN_RATE=$PLAYER_AUTO_HP_REGEN_RATE" - sed -E -i "s/PlayerAutoHPRegeneRate=[+-]?([0-9]*[.])?[0-9]+/PlayerAutoHPRegeneRate=$PLAYER_AUTO_HP_REGEN_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PLAYER_AUTO_HP_REGEN_RATE_IN_SLEEP}" ]; then - echo "PLAYER_AUTO_HP_REGEN_RATE_IN_SLEEP=$PLAYER_AUTO_HP_REGEN_RATE_IN_SLEEP" - sed -E -i "s/PlayerAutoHpRegeneRateInSleep=[+-]?([0-9]*[.])?[0-9]+/PlayerAutoHpRegeneRateInSleep=$PLAYER_AUTO_HP_REGEN_RATE_IN_SLEEP/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PAL_STOMACH_DECREASE_RATE}" ]; then - echo "PAL_STOMACH_DECREASE_RATE=$PAL_STOMACH_DECREASE_RATE" - sed -E -i "s/PalStomachDecreaceRate=[+-]?([0-9]*[.])?[0-9]+/PalStomachDecreaceRate=$PAL_STOMACH_DECREASE_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PAL_STAMINA_DECREASE_RATE}" ]; then - echo "PAL_STAMINA_DECREASE_RATE=$PAL_STAMINA_DECREASE_RATE" - sed -E -i "s/PalStaminaDecreaceRate=[+-]?([0-9]*[.])?[0-9]+/PalStaminaDecreaceRate=$PAL_STAMINA_DECREASE_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PAL_AUTO_HP_REGEN_RATE}" ]; then - echo "PAL_AUTO_HP_REGEN_RATE=$PAL_AUTO_HP_REGEN_RATE" - sed -E -i "s/PalAutoHPRegeneRate=[+-]?([0-9]*[.])?[0-9]+/PalAutoHPRegeneRate=$PAL_AUTO_HP_REGEN_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PAL_AUTO_HP_REGEN_RATE_IN_SLEEP}" ]; then - echo "PAL_AUTO_HP_REGEN_RATE_IN_SLEEP=$PAL_AUTO_HP_REGEN_RATE_IN_SLEEP" - sed -E -i "s/PalAutoHpRegeneRateInSleep=[+-]?([0-9]*[.])?[0-9]+/PalAutoHpRegeneRateInSleep=$PAL_AUTO_HP_REGEN_RATE_IN_SLEEP/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${BUILD_OBJECT_DAMAGE_RATE}" ]; then - echo "BUILD_OBJECT_DAMAGE_RATE=$BUILD_OBJECT_DAMAGE_RATE" - sed -E -i "s/BuildObjectDamageRate=[+-]?([0-9]*[.])?[0-9]+/BuildObjectDamageRate=$BUILD_OBJECT_DAMAGE_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${BUILD_OBJECT_DETERIORATION_DAMAGE_RATE}" ]; then - echo "BUILD_OBJECT_DETERIORATION_DAMAGE_RATE=$BUILD_OBJECT_DETERIORATION_DAMAGE_RATE" - sed -E -i "s/BuildObjectDeteriorationDamageRate=[+-]?([0-9]*[.])?[0-9]+/BuildObjectDeteriorationDamageRate=$BUILD_OBJECT_DETERIORATION_DAMAGE_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${COLLECTION_DROP_RATE}" ]; then - echo "COLLECTION_DROP_RATE=$COLLECTION_DROP_RATE" - sed -E -i "s/CollectionDropRate=[+-]?([0-9]*[.])?[0-9]+/CollectionDropRate=$COLLECTION_DROP_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${COLLECTION_OBJECT_HP_RATE}" ]; then - echo "COLLECTION_OBJECT_HP_RATE=$COLLECTION_OBJECT_HP_RATE" - sed -E -i "s/CollectionObjectHpRate=[+-]?([0-9]*[.])?[0-9]+/CollectionObjectHpRate=$COLLECTION_OBJECT_HP_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${COLLECTION_OBJECT_RESPAWN_SPEED_RATE}" ]; then - echo "COLLECTION_OBJECT_RESPAWN_SPEED_RATE=$COLLECTION_OBJECT_RESPAWN_SPEED_RATE" - sed -E -i "s/CollectionObjectRespawnSpeedRate=[+-]?([0-9]*[.])?[0-9]+/CollectionObjectRespawnSpeedRate=$COLLECTION_OBJECT_RESPAWN_SPEED_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${ENEMY_DROP_ITEM_RATE}" ]; then - echo "ENEMY_DROP_ITEM_RATE=$ENEMY_DROP_ITEM_RATE" - sed -E -i "s/EnemyDropItemRate=[+-]?([0-9]*[.])?[0-9]+/EnemyDropItemRate=$ENEMY_DROP_ITEM_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${DEATH_PENALTY}" ]; then - echo "DEATH_PENALTY=$DEATH_PENALTY" - sed -E -i "s/DeathPenalty=[a-zA-Z]*/DeathPenalty=$DEATH_PENALTY/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${ENABLE_PLAYER_TO_PLAYER_DAMAGE}" ]; then - echo "ENABLE_PLAYER_TO_PLAYER_DAMAGE=$ENABLE_PLAYER_TO_PLAYER_DAMAGE" - sed -E -i "s/bEnablePlayerToPlayerDamage=[a-zA-Z]*/bEnablePlayerToPlayerDamage=$ENABLE_PLAYER_TO_PLAYER_DAMAGE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${ENABLE_FRIENDLY_FIRE}" ]; then - echo "ENABLE_FRIENDLY_FIRE=$ENABLE_FRIENDLY_FIRE" - sed -E -i "s/bEnableFriendlyFire=[a-zA-Z]*/bEnableFriendlyFire=$ENABLE_FRIENDLY_FIRE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${ENABLE_INVADER_ENEMY}" ]; then - echo "ENABLE_INVADER_ENEMY=$ENABLE_INVADER_ENEMY" - sed -E -i "s/bEnableInvaderEnemy=[a-zA-Z]*/bEnableInvaderEnemy=$ENABLE_INVADER_ENEMY/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${ACTIVE_UNKO}" ]; then - echo "ACTIVE_UNKO=$ACTIVE_UNKO" - sed -E -i "s/bActiveUNKO=[a-zA-Z]*/bActiveUNKO=$ACTIVE_UNKO/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${ENABLE_AIM_ASSIST_PAD}" ]; then - echo "ENABLE_AIM_ASSIST_PAD=$ENABLE_AIM_ASSIST_PAD" - sed -E -i "s/bEnableAimAssistPad=[a-zA-Z]*/bEnableAimAssistPad=$ENABLE_AIM_ASSIST_PAD/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${ENABLE_AIM_ASSIST_KEYBOARD}" ]; then - echo "ENABLE_AIM_ASSIST_KEYBOARD=$ENABLE_AIM_ASSIST_KEYBOARD" - sed -E -i "s/bEnableAimAssistKeyboard=[a-zA-Z]*/bEnableAimAssistKeyboard=$ENABLE_AIM_ASSIST_KEYBOARD/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${DROP_ITEM_MAX_NUM}" ]; then - echo "DROP_ITEM_MAX_NUM=$DROP_ITEM_MAX_NUM" - sed -E -i "s/DropItemMaxNum=[0-9]*/DropItemMaxNum=$DROP_ITEM_MAX_NUM/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${DROP_ITEM_MAX_NUM_UNKO}" ]; then - echo "DROP_ITEM_MAX_NUM_UNKO=$DROP_ITEM_MAX_NUM_UNKO" - sed -E -i "s/DropItemMaxNum_UNKO=[0-9]*/DropItemMaxNum_UNKO=$DROP_ITEM_MAX_NUM_UNKO/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${BASE_CAMP_MAX_NUM}" ]; then - echo "BASE_CAMP_MAX_NUM=$BASE_CAMP_MAX_NUM" - sed -E -i "s/BaseCampMaxNum=[0-9]*/BaseCampMaxNum=$BASE_CAMP_MAX_NUM/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${BASE_CAMP_WORKER_MAXNUM}" ]; then - echo "BASE_CAMP_WORKER_MAXNUM=$BASE_CAMP_WORKER_MAXNUM" - sed -E -i "s/BaseCampWorkerMaxNum=[0-9]*/BaseCampWorkerMaxNum=$BASE_CAMP_WORKER_MAXNUM/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${DROP_ITEM_ALIVE_MAX_HOURS}" ]; then - echo "DROP_ITEM_ALIVE_MAX_HOURS=$DROP_ITEM_ALIVE_MAX_HOURS" - sed -E -i "s/DropItemAliveMaxHours=[+-]?([0-9]*[.])?[0-9]+/DropItemAliveMaxHours=$DROP_ITEM_ALIVE_MAX_HOURS/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${AUTO_RESET_GUILD_NO_ONLINE_PLAYERS}" ]; then - echo "AUTO_RESET_GUILD_NO_ONLINE_PLAYERS=$AUTO_RESET_GUILD_NO_ONLINE_PLAYERS" - sed -E -i "s/bAutoResetGuildNoOnlinePlayers=[a-zA-Z]*/bAutoResetGuildNoOnlinePlayers=$AUTO_RESET_GUILD_NO_ONLINE_PLAYERS/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS}" ]; then - echo "AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS=$AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS" - sed -E -i "s/AutoResetGuildTimeNoOnlinePlayers=[+-]?([0-9]*[.])?[0-9]+/AutoResetGuildTimeNoOnlinePlayers=$AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${GUILD_PLAYER_MAX_NUM}" ]; then - echo "GUILD_PLAYER_MAX_NUM=$GUILD_PLAYER_MAX_NUM" - sed -E -i "s/GuildPlayerMaxNum=[0-9]*/GuildPlayerMaxNum=$GUILD_PLAYER_MAX_NUM/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${PAL_EGG_DEFAULT_HATCHING_TIME}" ]; then - echo "PAL_EGG_DEFAULT_HATCHING_TIME=$PAL_EGG_DEFAULT_HATCHING_TIME" - sed -E -i "s/PalEggDefaultHatchingTime=[+-]?([0-9]*[.])?[0-9]+/PalEggDefaultHatchingTime=$PAL_EGG_DEFAULT_HATCHING_TIME/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${WORK_SPEED_RATE}" ]; then - echo "WORK_SPEED_RATE=$WORK_SPEED_RATE" - sed -E -i "s/WorkSpeedRate=[+-]?([0-9]*[.])?[0-9]+/WorkSpeedRate=$WORK_SPEED_RATE/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${IS_MULTIPLAY}" ]; then - echo "IS_MULTIPLAY=$IS_MULTIPLAY" - sed -E -i "s/bIsMultiplay=[a-zA-Z]*/bIsMultiplay=$IS_MULTIPLAY/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${IS_PVP}" ]; then - echo "IS_PVP=$IS_PVP" - sed -E -i "s/bIsPvP=[a-zA-Z]*/bIsPvP=$IS_PVP/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP}" ]; then - echo "CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP=$CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP" - sed -E -i "s/bCanPickupOtherGuildDeathPenaltyDrop=[a-zA-Z]*/bCanPickupOtherGuildDeathPenaltyDrop=$CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${ENABLE_NON_LOGIN_PENALTY}" ]; then - echo "ENABLE_NON_LOGIN_PENALTY=$ENABLE_NON_LOGIN_PENALTY" - sed -E -i "s/bEnableNonLoginPenalty=[a-zA-Z]*/bEnableNonLoginPenalty=$ENABLE_NON_LOGIN_PENALTY/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${ENABLE_FAST_TRAVEL}" ]; then - echo "ENABLE_FAST_TRAVEL=$ENABLE_FAST_TRAVEL" - sed -E -i "s/bEnableFastTravel=[a-zA-Z]*/bEnableFastTravel=$ENABLE_FAST_TRAVEL/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${IS_START_LOCATION_SELECT_BY_MAP}" ]; then - echo "IS_START_LOCATION_SELECT_BY_MAP=$IS_START_LOCATION_SELECT_BY_MAP" - sed -E -i "s/bIsStartLocationSelectByMap=[a-zA-Z]*/bIsStartLocationSelectByMap=$IS_START_LOCATION_SELECT_BY_MAP/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${EXIST_PLAYER_AFTER_LOGOUT}" ]; then - echo "EXIST_PLAYER_AFTER_LOGOUT=$EXIST_PLAYER_AFTER_LOGOUT" - sed -E -i "s/bExistPlayerAfterLogout=[a-zA-Z]*/bExistPlayerAfterLogout=$EXIST_PLAYER_AFTER_LOGOUT/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${ENABLE_DEFENSE_OTHER_GUILD_PLAYER}" ]; then - echo "ENABLE_DEFENSE_OTHER_GUILD_PLAYER=$ENABLE_DEFENSE_OTHER_GUILD_PLAYER" - sed -E -i "s/bEnableDefenseOtherGuildPlayer=[a-zA-Z]*/bEnableDefenseOtherGuildPlayer=$ENABLE_DEFENSE_OTHER_GUILD_PLAYER/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${COOP_PLAYER_MAX_NUM}" ]; then - echo "COOP_PLAYER_MAX_NUM=$COOP_PLAYER_MAX_NUM" - sed -E -i "s/CoopPlayerMaxNum=[0-9]*/CoopPlayerMaxNum=$COOP_PLAYER_MAX_NUM/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${REGION}" ]; then - echo "REGION=$REGION" - sed -E -i "s/Region=\"[^\"]*\"/Region=\"$REGION\"/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${USEAUTH}" ]; then - echo "USEAUTH=$USEAUTH" - sed -E -i "s/bUseAuth=[a-zA-Z]*/bUseAuth=$USEAUTH/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${BAN_LIST_URL}" ]; then - echo "BAN_LIST_URL=$BAN_LIST_URL" - sed -E -i "s~BanListURL=\"[^\"]*\"~BanListURL=\"$BAN_LIST_URL\"~" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${RCON_ENABLED}" ]; then - echo "RCON_ENABLED=${RCON_ENABLED}" - sed -i "s/RCONEnabled=[a-zA-Z]*/RCONEnabled=$RCON_ENABLED/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi -if [ -n "${RCON_PORT}" ]; then - echo "RCON_PORT=${RCON_PORT}" - sed -i "s/RCONPort=[0-9]*/RCONPort=$RCON_PORT/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi +./compile-settings.sh + +cd /palworld || exit # Configure RCON settings cat >/home/steam/server/rcon.yaml < Date: Mon, 29 Jan 2024 17:49:48 +0100 Subject: [PATCH 2/9] linting --- Dockerfile | 2 +- scripts/compile-settings.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3b5a5c875..e6650461a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ xdg-user-dirs=0.17-2 \ procps=2:3.3.17-5 \ wget=1.21-1+deb11u1 \ - gettext-base \ + gettext-base=0.21-4 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/scripts/compile-settings.sh b/scripts/compile-settings.sh index 7ede552f8..c158fa235 100644 --- a/scripts/compile-settings.sh +++ b/scripts/compile-settings.sh @@ -1,3 +1,5 @@ +#!/bin/bash + export DIFFICULTY=${DIFFICULTY:-None} export DAY_TIME_SPEED_RATE=${DAY_TIME_SPEED_RATE:-1.000000} export NIGHT_TIME_SPEED_RATE=${NIGHT_TIME_SPEED_RATE:-1.000000} From 354a02aff28e97b400ea344867566841f1aa6a3d Mon Sep 17 00:00:00 2001 From: Marco Spreckels Date: Tue, 30 Jan 2024 16:45:20 +0100 Subject: [PATCH 3/9] set quotations correctly, format template file, remove the need to check for palworldsettings.ini if its created on startup anyways --- scripts/compile-settings.sh | 87 ++++++++++++++++++--- scripts/files/PalWorldSettings.ini.template | 66 +++++++++++++++- scripts/start.sh | 15 +--- 3 files changed, 143 insertions(+), 25 deletions(-) mode change 100644 => 100755 scripts/compile-settings.sh diff --git a/scripts/compile-settings.sh b/scripts/compile-settings.sh old mode 100644 new mode 100755 index c158fa235..dc201b676 --- a/scripts/compile-settings.sh +++ b/scripts/compile-settings.sh @@ -51,16 +51,85 @@ export EXIST_PLAYER_AFTER_LOGOUT=${EXIST_PLAYER_AFTER_LOGOUT:-False} export ENABLE_DEFENSE_OTHER_GUILD_PLAYER=${ENABLE_DEFENSE_OTHER_GUILD_PLAYER:-False} export COOP_PLAYER_MAX_NUM=${COOP_PLAYER_MAX_NUM:-4} export SERVER_PLAYER_MAX_NUM=${SERVER_PLAYER_MAX_NUM:-32} -export SERVER_NAME=${SERVER_NAME:-"Default Palworld Server"} -export SERVER_DESCRIPTION=${SERVER_DESCRIPTION:-""} -export ADMIN_PASSWORD=${ADMIN_PASSWORD:-""} -export SERVER_PASSWORD=${SERVER_PASSWORD:-""} -export PUBLIC_PORT=${PUBLIC_PORT:-8211} -export PUBLIC_IP=${PUBLIC_IP:-""} +export SERVER_NAME=\"${SERVER_NAME:-"Default Palworld Server"}\" +export SERVER_DESCRIPTION=\"${SERVER_DESCRIPTION:-""}\" +export ADMIN_PASSWORD=\"${ADMIN_PASSWORD:-""}\" +export SERVER_PASSWORD=\"${SERVER_PASSWORD:-""}\" +export PUBLIC_PORT=${PORT:-8211} +export PUBLIC_IP=\"${PUBLIC_IP:-""}\" export RCON_ENABLED=${RCON_ENABLED:-False} export RCON_PORT=${RCON_PORT:-25575} -export REGION=${REGION:-""} +export REGION=\"${REGION:-""}\" export USE_AUTH=${USE_AUTH:-True} -export BAN_LIST_URL=${BAN_LIST_URL:-"https://api.palworldgame.com/api/banlist.txt"} +export BAN_LIST_URL=\"${BAN_LIST_URL:-https://api.palworldgame.com/api/banlist.txt}\" -envsubst < ./files/PalWorldSettings.ini.template > /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini \ No newline at end of file +echo "====Debug====" +echo "DIFFICULTY = $DIFFICULTY" +echo "DAY_TIME_SPEED_RATE = $DAY_TIME_SPEED_RATE" +echo "NIGHT_TIME_SPEED_RATE = $NIGHT_TIME_SPEED_RATE" +echo "EXP_RATE = $EXP_RATE" +echo "PAL_CAPTURE_RATE = $PAL_CAPTURE_RATE" +echo "PAL_SPAWN_NUM_RATE = $PAL_SPAWN_NUM_RATE" +echo "PAL_DAMAGE_RATE_ATTACK = $PAL_DAMAGE_RATE_ATTACK" +echo "PAL_DAMAGE_RATE_DEFENSE = $PAL_DAMAGE_RATE_DEFENSE" +echo "PLAYER_DAMAGE_RATE_ATTACK = $PLAYER_DAMAGE_RATE_ATTACK" +echo "PLAYER_DAMAGE_RATE_DEFENSE = $PLAYER_DAMAGE_RATE_DEFENSE" +echo "PLAYER_STOMACH_DECREACE_RATE = $PLAYER_STOMACH_DECREACE_RATE" +echo "PLAYER_STAMINA_DECREACE_RATE = $PLAYER_STAMINA_DECREACE_RATE" +echo "PLAYER_AUTO_HPREGENE_RATE = $PLAYER_AUTO_HPREGENE_RATE" +echo "PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP = $PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP" +echo "PAL_STOMACH_DECREACE_RATE = $PAL_STOMACH_DECREACE_RATE" +echo "PAL_STAMINA_DECREACE_RATE = $PAL_STAMINA_DECREACE_RATE" +echo "PAL_AUTO_HPREGENE_RATE = $PAL_AUTO_HPREGENE_RATE" +echo "PAL_AUTO_HP_REGENE_RATE_IN_SLEEP = $PAL_AUTO_HP_REGENE_RATE_IN_SLEEP" +echo "BUILD_OBJECT_DAMAGE_RATE = $BUILD_OBJECT_DAMAGE_RATE" +echo "BUILD_OBJECT_DETERIORATION_DAMAGE_RATE = $BUILD_OBJECT_DETERIORATION_DAMAGE_RATE" +echo "COLLECTION_DROP_RATE = $COLLECTION_DROP_RATE" +echo "COLLECTION_OBJECT_HP_RATE = $COLLECTION_OBJECT_HP_RATE" +echo "COLLECTION_OBJECT_RESPAWN_SPEED_RATE = $COLLECTION_OBJECT_RESPAWN_SPEED_RATE" +echo "ENEMY_DROP_ITEM_RATE = $ENEMY_DROP_ITEM_RATE" +echo "DEATH_PENALTY = $DEATH_PENALTY" +echo "ENABLE_PLAYER_TO_PLAYER_DAMAGE = $ENABLE_PLAYER_TO_PLAYER_DAMAGE" +echo "ENABLE_FRIENDLY_FIRE = $ENABLE_FRIENDLY_FIRE" +echo "ENABLE_INVADER_ENEMY = $ENABLE_INVADER_ENEMY" +echo "ACTIVE_UNKO = $ACTIVE_UNKO" +echo "ENABLE_AIM_ASSIST_PAD = $ENABLE_AIM_ASSIST_PAD" +echo "ENABLE_AIM_ASSIST_KEYBOARD = $ENABLE_AIM_ASSIST_KEYBOARD" +echo "DROP_ITEM_MAX_NUM = $DROP_ITEM_MAX_NUM" +echo "DROP_ITEM_MAX_NUM_UNKO = $DROP_ITEM_MAX_NUM_UNKO" +echo "BASE_CAMP_MAX_NUM = $BASE_CAMP_MAX_NUM" +echo "BASE_CAMP_WORKER_MAX_NUM = $BASE_CAMP_WORKER_MAX_NUM" +echo "DROP_ITEM_ALIVE_MAX_HOURS = $DROP_ITEM_ALIVE_MAX_HOURS" +echo "AUTO_RESET_GUILD_NO_ONLINE_PLAYERS = $AUTO_RESET_GUILD_NO_ONLINE_PLAYERS" +echo "AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS = $AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS" +echo "GUILD_PLAYER_MAX_NUM = $GUILD_PLAYER_MAX_NUM" +echo "PAL_EGG_DEFAULT_HATCHING_TIME = $PAL_EGG_DEFAULT_HATCHING_TIME" +echo "WORK_SPEED_RATE = $WORK_SPEED_RATE" +echo "IS_MULTIPLAY = $IS_MULTIPLAY" +echo "IS_PVP = $IS_PVP" +echo "CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP = $CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP" +echo "ENABLE_NON_LOGIN_PENALTY = $ENABLE_NON_LOGIN_PENALTY" +echo "ENABLE_FAST_TRAVEL = $ENABLE_FAST_TRAVEL" +echo "IS_START_LOCATION_SELECT_BY_MAP = $IS_START_LOCATION_SELECT_BY_MAP" +echo "EXIST_PLAYER_AFTER_LOGOUT = $EXIST_PLAYER_AFTER_LOGOUT" +echo "ENABLE_DEFENSE_OTHER_GUILD_PLAYER = $ENABLE_DEFENSE_OTHER_GUILD_PLAYER" +echo "COOP_PLAYER_MAX_NUM = $COOP_PLAYER_MAX_NUM" +echo "SERVER_PLAYER_MAX_NUM = $SERVER_PLAYER_MAX_NUM" +echo "SERVER_NAME = $SERVER_NAME" +echo "SERVER_DESCRIPTION = $SERVER_DESCRIPTION" +echo "ADMIN_PASSWORD = $ADMIN_PASSWORD" +echo "SERVER_PASSWORD = $SERVER_PASSWORD" +echo "PUBLIC_PORT = $PUBLIC_PORT" +echo "PUBLIC_IP = $PUBLIC_IP" +echo "RCON_ENABLED = $RCON_ENABLED" +echo "RCON_PORT = $RCON_PORT" +echo "REGION = $REGION" +echo "USE_AUTH = $USE_AUTH" +echo "BAN_LIST_URL = $BAN_LIST_URL" +echo "====Debug====" + +mkdir -p /palworld/Pal/Saved/Config/LinuxServer +cat > /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini < /dev/null - - # Wait for shutdown - sleep 5 - cp /palworld/DefaultPalWorldSettings.ini /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini -fi +printf "\e[0;32m*****GENERATING CONFIGS*****\e[0m\n" ./compile-settings.sh From 4f6f62dcca3163413a3579fa77bfd105d9ab6cd8 Mon Sep 17 00:00:00 2001 From: Marco Spreckels Date: Tue, 30 Jan 2024 17:28:29 +0100 Subject: [PATCH 4/9] env naming --- scripts/compile-settings.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/compile-settings.sh b/scripts/compile-settings.sh index dc201b676..25a9abe0d 100755 --- a/scripts/compile-settings.sh +++ b/scripts/compile-settings.sh @@ -50,7 +50,7 @@ export IS_START_LOCATION_SELECT_BY_MAP=${IS_START_LOCATION_SELECT_BY_MAP:-True} export EXIST_PLAYER_AFTER_LOGOUT=${EXIST_PLAYER_AFTER_LOGOUT:-False} export ENABLE_DEFENSE_OTHER_GUILD_PLAYER=${ENABLE_DEFENSE_OTHER_GUILD_PLAYER:-False} export COOP_PLAYER_MAX_NUM=${COOP_PLAYER_MAX_NUM:-4} -export SERVER_PLAYER_MAX_NUM=${SERVER_PLAYER_MAX_NUM:-32} +export SERVER_PLAYER_MAX_NUM=${PLAYERS:-32} export SERVER_NAME=\"${SERVER_NAME:-"Default Palworld Server"}\" export SERVER_DESCRIPTION=\"${SERVER_DESCRIPTION:-""}\" export ADMIN_PASSWORD=\"${ADMIN_PASSWORD:-""}\" From 72fb1c7b5cc16eb0a21cfa8d313700693ff3ecce Mon Sep 17 00:00:00 2001 From: Marco Spreckels Date: Wed, 31 Jan 2024 17:00:02 +0100 Subject: [PATCH 5/9] Fix trimming CLRF lineending instead of RF --- scripts/compile-settings.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/compile-settings.sh b/scripts/compile-settings.sh index 25a9abe0d..82b97dd18 100755 --- a/scripts/compile-settings.sh +++ b/scripts/compile-settings.sh @@ -131,5 +131,5 @@ echo "====Debug====" mkdir -p /palworld/Pal/Saved/Config/LinuxServer cat > /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini < Date: Wed, 31 Jan 2024 17:14:45 +0100 Subject: [PATCH 6/9] Env var naming --- scripts/compile-settings.sh | 12 ++++++------ scripts/files/PalWorldSettings.ini.template | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/compile-settings.sh b/scripts/compile-settings.sh index 82b97dd18..b9509785d 100755 --- a/scripts/compile-settings.sh +++ b/scripts/compile-settings.sh @@ -1,8 +1,8 @@ #!/bin/bash export DIFFICULTY=${DIFFICULTY:-None} -export DAY_TIME_SPEED_RATE=${DAY_TIME_SPEED_RATE:-1.000000} -export NIGHT_TIME_SPEED_RATE=${NIGHT_TIME_SPEED_RATE:-1.000000} +export DAYTIME_SPEEDRATE=${DAYTIME_SPEEDRATE:-1.000000} +export NIGHTTIME_SPEEDRATE=${NIGHTTIME_SPEEDRATE:-1.000000} export EXP_RATE=${EXP_RATE:-1.000000} export PAL_CAPTURE_RATE=${PAL_CAPTURE_RATE:-1.000000} export PAL_SPAWN_NUM_RATE=${PAL_SPAWN_NUM_RATE:-1.000000} @@ -60,13 +60,13 @@ export PUBLIC_IP=\"${PUBLIC_IP:-""}\" export RCON_ENABLED=${RCON_ENABLED:-False} export RCON_PORT=${RCON_PORT:-25575} export REGION=\"${REGION:-""}\" -export USE_AUTH=${USE_AUTH:-True} +export USEAUTH=${USEAUTH:-True} export BAN_LIST_URL=\"${BAN_LIST_URL:-https://api.palworldgame.com/api/banlist.txt}\" echo "====Debug====" echo "DIFFICULTY = $DIFFICULTY" -echo "DAY_TIME_SPEED_RATE = $DAY_TIME_SPEED_RATE" -echo "NIGHT_TIME_SPEED_RATE = $NIGHT_TIME_SPEED_RATE" +echo "DAYTIME_SPEEDRATE = $DAYTIME_SPEEDRATE" +echo "NIGHTTIME_SPEEDRATE = $NIGHTTIME_SPEEDRATE" echo "EXP_RATE = $EXP_RATE" echo "PAL_CAPTURE_RATE = $PAL_CAPTURE_RATE" echo "PAL_SPAWN_NUM_RATE = $PAL_SPAWN_NUM_RATE" @@ -124,7 +124,7 @@ echo "PUBLIC_IP = $PUBLIC_IP" echo "RCON_ENABLED = $RCON_ENABLED" echo "RCON_PORT = $RCON_PORT" echo "REGION = $REGION" -echo "USE_AUTH = $USE_AUTH" +echo "USEAUTH = $USEAUTH" echo "BAN_LIST_URL = $BAN_LIST_URL" echo "====Debug====" diff --git a/scripts/files/PalWorldSettings.ini.template b/scripts/files/PalWorldSettings.ini.template index 3d50e0d87..6aff90253 100644 --- a/scripts/files/PalWorldSettings.ini.template +++ b/scripts/files/PalWorldSettings.ini.template @@ -1,7 +1,7 @@ OptionSettings=( Difficulty=$DIFFICULTY, -DayTimeSpeedRate=$DAY_TIME_SPEED_RATE, -NightTimeSpeedRate=$NIGHT_TIME_SPEED_RATE, +DayTimeSpeedRate=$DAYTIME_SPEEDRATE, +NightTimeSpeedRate=$NIGHTTIME_SPEEDRATE, ExpRate=$EXP_RATE, PalCaptureRate=$PAL_CAPTURE_RATE, PalSpawnNumRate=$PAL_SPAWN_NUM_RATE, @@ -59,6 +59,6 @@ PublicIP=$PUBLIC_IP, RCONEnabled=$RCON_ENABLED, RCONPort=$RCON_PORT, Region=$REGION, -bUseAuth=$USE_AUTH, +bUseAuth=$USEAUTH, BanListURL=$BAN_LIST_URL ) \ No newline at end of file From 28e5ca91470c0bf570887d0a3a6a96879a057704 Mon Sep 17 00:00:00 2001 From: Marco Spreckels Date: Wed, 31 Jan 2024 17:20:56 +0100 Subject: [PATCH 7/9] Reintroduce backup and update logic --- scripts/start.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/start.sh b/scripts/start.sh index 1bc59ddcc..7ed628f12 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -29,6 +29,22 @@ printf "\e[0;32m*****GENERATING CONFIGS*****\e[0m\n" cd /palworld || exit +rm -f "/home/steam/server/crontab" +if [ "${BACKUP_ENABLED}" = true ]; then + echo "BACKUP_ENABLED=${BACKUP_ENABLED}" + + echo "$BACKUP_CRON_EXPRESSION bash /usr/local/bin/backup" >> "/home/steam/server/crontab" +fi + +if [ "${AUTO_UPDATE_ENABLED}" = true ] && [ "${UPDATE_ON_BOOT}" = true ]; then + echo "AUTO_UPDATE_ENABLED=${AUTO_UPDATE_ENABLED}" + echo "$AUTO_UPDATE_CRON_EXPRESSION bash /usr/local/bin/update" >> "/home/steam/server/crontab" +fi + +if { [ "${AUTO_UPDATE_ENABLED}" = true ] && [ "${UPDATE_ON_BOOT}" = true ]; } || [ "${BACKUP_ENABLED}" = true ]; then + supercronic "/home/steam/server/crontab" & +fi + # Configure RCON settings cat >/home/steam/server/rcon.yaml < Date: Wed, 31 Jan 2024 17:21:30 +0100 Subject: [PATCH 8/9] formatting --- scripts/start.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/start.sh b/scripts/start.sh index 7ed628f12..f040279b3 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -32,7 +32,6 @@ cd /palworld || exit rm -f "/home/steam/server/crontab" if [ "${BACKUP_ENABLED}" = true ]; then echo "BACKUP_ENABLED=${BACKUP_ENABLED}" - echo "$BACKUP_CRON_EXPRESSION bash /usr/local/bin/backup" >> "/home/steam/server/crontab" fi From 30e2b5545bcbbb587b518cda30ce2f1f62f1ced4 Mon Sep 17 00:00:00 2001 From: Marco Spreckels Date: Sun, 4 Feb 2024 18:37:50 +0100 Subject: [PATCH 9/9] Add DEBUG Envvar, Add logging --- scripts/compile-settings.sh | 138 +++++++++++++++++++----------------- scripts/start.sh | 10 ++- 2 files changed, 77 insertions(+), 71 deletions(-) diff --git a/scripts/compile-settings.sh b/scripts/compile-settings.sh index b9509785d..dad3b27e7 100755 --- a/scripts/compile-settings.sh +++ b/scripts/compile-settings.sh @@ -1,5 +1,7 @@ #!/bin/bash +echo "Compiling PalWorldSettings.ini..." + export DIFFICULTY=${DIFFICULTY:-None} export DAYTIME_SPEEDRATE=${DAYTIME_SPEEDRATE:-1.000000} export NIGHTTIME_SPEEDRATE=${NIGHTTIME_SPEEDRATE:-1.000000} @@ -63,73 +65,79 @@ export REGION=\"${REGION:-""}\" export USEAUTH=${USEAUTH:-True} export BAN_LIST_URL=\"${BAN_LIST_URL:-https://api.palworldgame.com/api/banlist.txt}\" -echo "====Debug====" -echo "DIFFICULTY = $DIFFICULTY" -echo "DAYTIME_SPEEDRATE = $DAYTIME_SPEEDRATE" -echo "NIGHTTIME_SPEEDRATE = $NIGHTTIME_SPEEDRATE" -echo "EXP_RATE = $EXP_RATE" -echo "PAL_CAPTURE_RATE = $PAL_CAPTURE_RATE" -echo "PAL_SPAWN_NUM_RATE = $PAL_SPAWN_NUM_RATE" -echo "PAL_DAMAGE_RATE_ATTACK = $PAL_DAMAGE_RATE_ATTACK" -echo "PAL_DAMAGE_RATE_DEFENSE = $PAL_DAMAGE_RATE_DEFENSE" -echo "PLAYER_DAMAGE_RATE_ATTACK = $PLAYER_DAMAGE_RATE_ATTACK" -echo "PLAYER_DAMAGE_RATE_DEFENSE = $PLAYER_DAMAGE_RATE_DEFENSE" -echo "PLAYER_STOMACH_DECREACE_RATE = $PLAYER_STOMACH_DECREACE_RATE" -echo "PLAYER_STAMINA_DECREACE_RATE = $PLAYER_STAMINA_DECREACE_RATE" -echo "PLAYER_AUTO_HPREGENE_RATE = $PLAYER_AUTO_HPREGENE_RATE" -echo "PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP = $PLAYER_AUTO_HP_REGENE_RATE_IN_SLEEP" -echo "PAL_STOMACH_DECREACE_RATE = $PAL_STOMACH_DECREACE_RATE" -echo "PAL_STAMINA_DECREACE_RATE = $PAL_STAMINA_DECREACE_RATE" -echo "PAL_AUTO_HPREGENE_RATE = $PAL_AUTO_HPREGENE_RATE" -echo "PAL_AUTO_HP_REGENE_RATE_IN_SLEEP = $PAL_AUTO_HP_REGENE_RATE_IN_SLEEP" -echo "BUILD_OBJECT_DAMAGE_RATE = $BUILD_OBJECT_DAMAGE_RATE" -echo "BUILD_OBJECT_DETERIORATION_DAMAGE_RATE = $BUILD_OBJECT_DETERIORATION_DAMAGE_RATE" -echo "COLLECTION_DROP_RATE = $COLLECTION_DROP_RATE" -echo "COLLECTION_OBJECT_HP_RATE = $COLLECTION_OBJECT_HP_RATE" -echo "COLLECTION_OBJECT_RESPAWN_SPEED_RATE = $COLLECTION_OBJECT_RESPAWN_SPEED_RATE" -echo "ENEMY_DROP_ITEM_RATE = $ENEMY_DROP_ITEM_RATE" -echo "DEATH_PENALTY = $DEATH_PENALTY" -echo "ENABLE_PLAYER_TO_PLAYER_DAMAGE = $ENABLE_PLAYER_TO_PLAYER_DAMAGE" -echo "ENABLE_FRIENDLY_FIRE = $ENABLE_FRIENDLY_FIRE" -echo "ENABLE_INVADER_ENEMY = $ENABLE_INVADER_ENEMY" -echo "ACTIVE_UNKO = $ACTIVE_UNKO" -echo "ENABLE_AIM_ASSIST_PAD = $ENABLE_AIM_ASSIST_PAD" -echo "ENABLE_AIM_ASSIST_KEYBOARD = $ENABLE_AIM_ASSIST_KEYBOARD" -echo "DROP_ITEM_MAX_NUM = $DROP_ITEM_MAX_NUM" -echo "DROP_ITEM_MAX_NUM_UNKO = $DROP_ITEM_MAX_NUM_UNKO" -echo "BASE_CAMP_MAX_NUM = $BASE_CAMP_MAX_NUM" -echo "BASE_CAMP_WORKER_MAX_NUM = $BASE_CAMP_WORKER_MAX_NUM" -echo "DROP_ITEM_ALIVE_MAX_HOURS = $DROP_ITEM_ALIVE_MAX_HOURS" -echo "AUTO_RESET_GUILD_NO_ONLINE_PLAYERS = $AUTO_RESET_GUILD_NO_ONLINE_PLAYERS" -echo "AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS = $AUTO_RESET_GUILD_TIME_NO_ONLINE_PLAYERS" -echo "GUILD_PLAYER_MAX_NUM = $GUILD_PLAYER_MAX_NUM" -echo "PAL_EGG_DEFAULT_HATCHING_TIME = $PAL_EGG_DEFAULT_HATCHING_TIME" -echo "WORK_SPEED_RATE = $WORK_SPEED_RATE" -echo "IS_MULTIPLAY = $IS_MULTIPLAY" -echo "IS_PVP = $IS_PVP" -echo "CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP = $CAN_PICKUP_OTHER_GUILD_DEATH_PENALTY_DROP" -echo "ENABLE_NON_LOGIN_PENALTY = $ENABLE_NON_LOGIN_PENALTY" -echo "ENABLE_FAST_TRAVEL = $ENABLE_FAST_TRAVEL" -echo "IS_START_LOCATION_SELECT_BY_MAP = $IS_START_LOCATION_SELECT_BY_MAP" -echo "EXIST_PLAYER_AFTER_LOGOUT = $EXIST_PLAYER_AFTER_LOGOUT" -echo "ENABLE_DEFENSE_OTHER_GUILD_PLAYER = $ENABLE_DEFENSE_OTHER_GUILD_PLAYER" -echo "COOP_PLAYER_MAX_NUM = $COOP_PLAYER_MAX_NUM" -echo "SERVER_PLAYER_MAX_NUM = $SERVER_PLAYER_MAX_NUM" -echo "SERVER_NAME = $SERVER_NAME" -echo "SERVER_DESCRIPTION = $SERVER_DESCRIPTION" -echo "ADMIN_PASSWORD = $ADMIN_PASSWORD" -echo "SERVER_PASSWORD = $SERVER_PASSWORD" -echo "PUBLIC_PORT = $PUBLIC_PORT" -echo "PUBLIC_IP = $PUBLIC_IP" -echo "RCON_ENABLED = $RCON_ENABLED" -echo "RCON_PORT = $RCON_PORT" -echo "REGION = $REGION" -echo "USEAUTH = $USEAUTH" -echo "BAN_LIST_URL = $BAN_LIST_URL" -echo "====Debug====" +if [ "${DEBUG,,}" = true ]; then +cat < /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini <