Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sonroyaalmerol authored Feb 13, 2024
1 parent 2b171cb commit a9562f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 7 additions & 6 deletions scripts/generate-worldoption.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,19 @@ json_struct() {
# Function to generate JSON config
generate_json_config() {
local json_config="{}"
# Replace commas with newlines
config=$(echo "$1" | sed 's/,/\n/g')
local input="$1"

# Replace commas with newline using parameter expansion
local config="${input//,/\\n}"

# Loop through each key-value pair
while IFS='=' read -r key value; do
if [[ "$value" == \"*\" ]]; then
value="${value//\"/}" # Remove quotes from value
fi
config_properties=$(json_struct $(config_to_struct_type "$key") "$value")
config_properties="$(json_struct "$(config_to_struct_type "$key")" "$value")"

if [[ ! -z "$config_properties" ]]; then
if [[ -n "$config_properties" ]]; then
json_config=$(echo "$json_config" | jq --arg key "$key" --argjson config_properties "$config_properties" '.[$key] = $config_properties')
fi
done <<< "$config"
Expand Down Expand Up @@ -145,8 +147,7 @@ convert_json_to_sav() {
local output_path="$2"

echo "WorldOption Generator: Compressing WorldOption to .sav"
echo "$json_data" | python3 -c "$convert_json_to_sav_python" > "$output_path/WorldOption.sav"
if [ $? -eq 0 ]; then
if echo "$json_data" | python3 -c "$convert_json_to_sav_python" > "$output_path/WorldOption.sav"; then
echo "WorldOption Generator: Generated WorldOption.sav file to $output_path"
else
echo "WorldOption Generator: WorldOption.sav generation failed."
Expand Down
3 changes: 1 addition & 2 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ rm -f /palworld/Pal/Saved/SaveGames/0/*/WorldOption.sav
if [ "${GENERATE_WORLD_OPTION,,}" = true ]; then
printf "\e[0;32m%s\e[0m\n" "*****GENERATING WORLDOPTION*****"
printf "\e[0;32m%s\e[0m\n" "***Using PalWorldSettings.ini to create WorldOption.sav***"
/home/steam/server/generate-worldoption.sh
if [ $? != 0 ]; then
if ! /home/steam/server/generate-worldoption.sh; then
echo "WorldOption will not be generated. PalWorldSettings.ini will apply."
fi
fi
Expand Down

0 comments on commit a9562f3

Please sign in to comment.