Changeset - 7b7976688cb5
[Not reviewed]
0 1 0
Branko Majic (branko) - 23 months ago 2022-06-04 16:31:00
branko@majic.rs
Noticket: [factorio_manager.sh] Prompt user for map preset when reseting the server map.
1 file changed with 20 insertions and 1 deletions:
0 comments (0 inline, 0 general)
games/factorio_manager.sh
Show inline comments
 
@@ -1164,6 +1164,21 @@ function select_factorio_version() {
 
    return 0
 
}
 

	
 
#
 
# Prompts user to specify the map preset to use for generating the
 
# map.
 
#
 
# Sets:
 
#
 
#   map_preset
 
#
 
function select_map_preset() {
 
    declare -g map_preset=""
 

	
 
    read -r -e -p "Please specify what map preset you would like to use (enter for 'default'): " map_preset
 
    [[ -z $map_preset ]] && map_preset="default"
 
}
 

	
 
#
 
# Removes all registered lock files. Lock files are registered via the
 
# global array variable "lock_files". This function is meant to be
 
@@ -2632,6 +2647,10 @@ elif [[ $command == reset-server-map ]]; then
 
        exit "$ERROR_CONFIGURATION"
 
    fi
 

	
 
    # Prompt user to specify the preset.
 
    select_map_preset
 
    info "Preset '$map_preset' will be used to generate the map"
 

	
 
    # Request from user to confirm the destructive action.
 
    critical_confirmation "Resetting the server map will wipe the default save game as well." \
 
                          "Aborted server map reset, no changes have been made to instance files." \
 
@@ -2642,7 +2661,7 @@ elif [[ $command == reset-server-map ]]; then
 
        exit "$ERROR_GENERAL"
 
    fi
 

	
 
    if ! "$factorio_bin" --config "$game_config" --create "$main_save"; then
 
    if ! "$factorio_bin" --config "$game_config" --create "$main_save" --preset "$map_preset"; then
 
        error "Failed to generate default savegame/map under: $main_save"
 
        exit "$ERROR_GENERAL"
 
    fi
0 comments (0 inline, 0 general)