Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into work
Browse files Browse the repository at this point in the history
  • Loading branch information
ripps818 committed Apr 6, 2024
2 parents d0c7415 + 12418a7 commit b51bc6f
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 56 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

[Back to main](README.md#changelog)

## 2024-04-06

- Disabled recursive Backups by default @Callum027 (#257)

## 2024-04-04

- Fixed rcon-spaces by @Callum027 (#251)
- Added new config options from new default-settings-file
- Bugfix - Change pidof selector to current name "PalServer-Linux-Shipping" by @thijsvanloef

## 2024-03-04

- Fixed typo
Expand Down
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN curl -fsSLO "$SUPERCRONIC_URL" \
RUN curl -fsSLO "$SUPERCRONIC_URL" \
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \
&& chmod +x "$SUPERCRONIC" \
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \
Expand Down Expand Up @@ -86,7 +86,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
RESTART_ENABLED=false \
RESTART_DEBUG_OVERRIDE=false \
RESTART_CRON_EXPRESSION="0 18 * * *" \
# RCON-Playerdection - NEEDS RCON ENABLED!
# RCON-Playerdetection - NEEDS RCON ENABLED!
RCON_PLAYER_DETECTION=true \
RCON_PLAYER_DETECTION_STARTUP_DELAY=60 \
RCON_PLAYER_DETECTION_CHECK_INTERVAL=15 \
Expand Down Expand Up @@ -184,7 +184,11 @@ ENV DEBIAN_FRONTEND=noninteractive \
REGION= \
USEAUTH=true \
BAN_LIST_URL=https://api.palworldgame.com/api/banlist.txt \
SHOW_PLAYER_LIST=false
RESTAPI_ENABLED=true \
RESTAPI_PORT=8212 \
SHOW_PLAYER_LIST=false \
ALLOW_CONNECT_PLATFORM=Steam \
ENABLE_WORLD_BACKUP=false

EXPOSE 8211/udp
EXPOSE 25575/tcp
Expand Down
2 changes: 1 addition & 1 deletion configs/PalWorldSettings.ini.template
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[/Script/Pal.PalGameWorldSettings]
OptionSettings=(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName="Default Palworld Server",ServerDescription="",AdminPassword="",ServerPassword="",PublicPort=8211,PublicIP="",RCONEnabled=False,RCONPort=25575,Region="",bUseAuth=True,BanListURL="https://api.palworldgame.com/api/banlist.txt",bShowPlayerList=false)
OptionSettings=(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName="Default Palworld Server",ServerDescription="",AdminPassword="",ServerPassword="",PublicPort=8211,PublicIP="",RCONEnabled=False,RCONPort=25575,Region="",bUseAuth=True,BanListURL="https://api.palworldgame.com/api/banlist.txt",RESTAPIEnabled=False,RESTAPIPort=8212,bShowPlayerList=False,AllowConnectPlatform=Steam,bIsUseBackupSaveData=True)
6 changes: 5 additions & 1 deletion default.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RESTART_ENABLED=false
RESTART_COUNTDOWN=15
RESTART_DEBUG_OVERRIDE=false
RESTART_CRON_EXPRESSION="0 18 * * *"
# RCON-Playerdection - NEEDS RCON ENABLED!
# RCON-Playerdetection - NEEDS RCON ENABLED!
RCON_PLAYER_DETECTION=true
RCON_PLAYER_DETECTION_STARTUP_DELAY=60
RCON_PLAYER_DETECTION_CHECK_INTERVAL=15
Expand Down Expand Up @@ -116,4 +116,8 @@ RCON_PORT=25575
REGION=
USEAUTH=true
BAN_LIST_URL=https://api.palworldgame.com/api/banlist.txt
RESTAPI_ENABLED=true
RESTAPI_PORT=8212
SHOW_PLAYER_LIST=false
ALLOW_CONNECT_PLATFORM=Steam
ENABLE_WORLD_BACKUP=false
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ services:
published: 8211 # Gamerserver port on your host
protocol: udp
mode: host
- target: 8212 # Gameserver API port inside of the container
published: 8212 # Gameserver API port on your host
protocol: tcp
mode: host
- target: 25575 # RCON port inside of the container
published: 25575 # RCON port on your host
protocol: tcp
Expand Down
6 changes: 5 additions & 1 deletion docs/ENV_VARS.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ Information sources and credits to the following websites:
| ----------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------------- |
| MULTITHREAD_ENABLED | Sets options for "Improved multi-threaded CPU performance" | true | true | Boolean |
| COMMUNITY_SERVER | Set to enabled, the server will appear in the Community-Serverlist | true | true | Boolean |
| SHOW_PLAYER_LIST | bShowPlayerList | Make the player list public on a community server | false | Boolean |
| NETSERVERMAXTICKRATE | NetServerMaxTickRate | Changes the TickRate of the server, be very careful with this setting! | 120 | 30-120 |
| DIFFICULTY | Difficulty | Choose one of the following:<br>`None`<br>`Normal`<br>`Difficult` | None | Enum |
| DAYTIME_SPEEDRATE | DayTimeSpeedRate | Day Time Speed: The lower this number is, the longer each day will last. | 1.000000 | Float |
Expand Down Expand Up @@ -145,6 +144,11 @@ Information sources and credits to the following websites:
| REGION | Region | Area | | String |
| USEAUTH | bUseAuth | Use authentication | true | Boolean |
| BAN_LIST_URL | BanListURL | Which ban list to use | https://api.palworldgame.com/api/banlist.txt | String |
| RESTAPI_ENABLED | RESTAPIEnabled | Enables the RESTAPI | true | Boolean |
| RESTAPI_PORT | RESTAPIPort | Defines the port inside the container where the API should be hosted - RESTAPI: Needs Basic Auth; admin:ADMIN_PASSWORD | 8212 | UInt16 |
| SHOW_PLAYER_LIST | bShowPlayerList | Enables to view player-list ingame via the escape key | false | Boolean |
| ALLOW_CONNECT_PLATFORM | AllowConnectPlatform | Looks like Cross-Play, but according to official documentation, isnt working yet and no more infos given on this; See: https://tech.palworldgame.com/settings-and-operation/configuration | Steam | String |
| ENABLE_WORLD_BACKUP | bIsUseBackupSaveData | Enables internal world backup inside the game-server; off by default, because we have our own backup solution | false | Boolean |


** Updates to descriptions taken from [this reddit post](https://www.reddit.com/r/Palworld/comments/19bumby/settings_explanation/) **
Expand Down
16 changes: 16 additions & 0 deletions includes/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,26 @@ function setup_palworld_settings_ini() {
e "> Setting BanListURL to '$BAN_LIST_URL'"
sed -E -i "s~BanListURL=\"[^\"]*\"~BanListURL=\"$BAN_LIST_URL\"~" "$GAME_SETTINGS_FILE"
fi
if [[ -n ${RESTAPI_ENABLED+x} ]]; then
e "> Setting RESTAPIEnabled to '$RESTAPI_ENABLED'"
sed -E -i "s/RESTAPIEnabled=[a-zA-Z]*/RESTAPIEnabled=$RESTAPI_ENABLED/" "$GAME_SETTINGS_FILE"
fi
if [[ -n ${RESTAPI_PORT+x} ]]; then
e "> Setting RESTAPIPort to '$RESTAPI_PORT'"
sed -E -i "s/RESTAPIPort=[0-9]*/RESTAPIPort=$RESTAPI_PORT/" "$GAME_SETTINGS_FILE"
fi
if [[ -n ${SHOW_PLAYER_LIST+x} ]]; then
e "> Setting bShowPlayerList to '$SHOW_PLAYER_LIST'"
sed -E -i "s/bShowPlayerList=[a-zA-Z]*/bShowPlayerList=$SHOW_PLAYER_LIST/" "$GAME_SETTINGS_FILE"
fi
if [[ -n ${ALLOW_CONNECT_PLATFORM+x} ]]; then
e "> Setting AllowConnectPlatform to '$ALLOW_CONNECT_PLATFORM'"
sed -E -i "s/AllowConnectPlatform=[a-zA-Z]*/AllowConnectPlatform=$ALLOW_CONNECT_PLATFORM/" "$GAME_SETTINGS_FILE"
fi
if [[ -n ${ENABLE_WORLD_BACKUP+x} ]]; then
e "> Setting bIsUseBackupSaveData to '$ENABLE_WORLD_BACKUP'"
sed -E -i "s/bIsUseBackupSaveData=[a-zA-Z]*/bIsUseBackupSaveData=$ENABLE_WORLD_BACKUP/" "$GAME_SETTINGS_FILE"
fi
es ">>> Finished setting up PalWorldSettings.ini"
}

Expand Down
24 changes: 12 additions & 12 deletions includes/playerdetection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ player_detection_loop() {
while true; do
compare_players
sleep "$RCON_PLAYER_DETECTION_CHECK_INTERVAL"
done
done
}

# Function to compare current and previous player lists
compare_players() {
local old_players=("${current_players[@]}")
readarray -t current_players < <(rconcli showplayers | tail -n +2)
readarray -t current_players < <(rcon showplayers 2> /dev/null | tail -n +2)

for player_info in "${current_players[@]}"; do
# Extract player name, UID, and Steam ID from player info
# This part sets the Internal Field Separator (IFS) variable to ','.
# In Bash, the IFS variable determines how Bash recognizes word boundaries.
# By default, it includes space, tab, and newline characters.
# This part sets the Internal Field Separator (IFS) variable to ','.
# In Bash, the IFS variable determines how Bash recognizes word boundaries.
# By default, it includes space, tab, and newline characters.
# By setting it to ',', we're telling Bash to split input lines at commas.
# https://tldp.org/LDP/abs/html/internalvariables.html#IFSREF
IFS=',' read -r -a player_data <<< "$player_info"
Expand Down Expand Up @@ -82,39 +82,39 @@ compare_players() {

# Function to announce a player join
announce_join() {
time=$(date '+%H:%M:%S')
time=$(date '+[%H:%M:%S]')
message="Player $1 has joined the server."
echo "${time}: $message"
if [[ -n $WEBHOOK_ENABLED ]] && [[ $WEBHOOK_ENABLED == "true" ]]; then
send_info_notification "$message"
fi
if [[ -n $RCON_ENABLED ]] && [[ $RCON_ENABLED == "true" ]]; then
broadcast_player_join "${1// /\-}"
broadcast_player_join "${1}"
fi
}

# Function to announce a player join
announce_name_change() {
time=$(date '+%H:%M:%S')
time=$(date '+[%H:%M:%S]')
message="Player $1 has changed their name to $2."
echo "${time}: $message"
if [[ -n $WEBHOOK_ENABLED ]] && [[ $WEBHOOK_ENABLED == "true" ]]; then
send_info_notification "$message"
fi
if [[ -n $RCON_ENABLED ]] && [[ $RCON_ENABLED == "true" ]]; then
broadcast_player_name_change "${1// /\-}" "${2// /\-}"
broadcast_player_name_change "${1}" "${2}"
fi
}

# Function to announce a player leave
announce_leave() {
time=$(date '+%H:%M:%S')
time=$(date '+[%H:%M:%S]')
message="Player $1 has left the server."
echo "${time}: $message"
if [[ -n $WEBHOOK_ENABLED ]] && [[ $WEBHOOK_ENABLED == "true" ]]; then
send_info_notification "$message"
fi
if [[ -n $RCON_ENABLED ]] && [[ $RCON_ENABLED == "true" ]]; then
broadcast_player_leave "${1// /\-}"
broadcast_player_leave "${1}"
fi
}
}
Loading

0 comments on commit b51bc6f

Please sign in to comment.