Skip to content

Commit

Permalink
refactor: remove unnecessary code duplication in info_game.sh
Browse files Browse the repository at this point in the history
The commit removes duplicated code for retrieving server information from the game configuration file. Specifically, it removes redundant lines related to rconpassword, rconport, and serverpassword. This improves code readability and maintainability.
  • Loading branch information
dgibbs64 committed Oct 27, 2023
1 parent 3142025 commit 03d44e5
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions lgsm/modules/info_game.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1138,25 +1138,18 @@ fn_info_game_col() {
# Filetype: cfg
fn_info_game_cs2() {
if [ -f "${servercfgfullpath}" ]; then
fn_info_game_valve_keyvalues "rconpassword" "rcon_password"
fn_info_game_valve_keyvalues "servername" "hostname"
fn_info_game_valve_keyvalues "serverpassword" "sv_password"
fi
# Steamport can be between 26901-26910 and is normally automatically set.
# Some servers might support -steamport parameter to set
if [ "${steamport}" == "0" ] || [ -v "${steamport}" ]; then
steamport="$(echo "${ssinfo}" | grep "${srcdslinuxpid}" | awk '{print $5}' | grep ":269" | cut -d ":" -f2)"
fi
clientport="${clientport:-"0"}"
defaultmap="${defaultmap:-"NOT SET"}"
maxplayers="${maxplayers:-"0"}"
port="${port:-"0"}"
queryport="${port:-"0"}"
rconpassword="${rconpassword:-"NOT SET"}"
rconport="${port:-"0"}"
servername="${servername:-"NOT SET"}"
serverpassword="${serverpassword:-"NOT SET"}"
# steamport="${steamport:-"0"}" Steamport is optional so we dont want it to show as not set.
}

# Config Type: ini
Expand Down

0 comments on commit 03d44e5

Please sign in to comment.