Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/Steam Workshop support #4186

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
7 changes: 7 additions & 0 deletions lgsm/config-default/config-lgsm/arma3server/_default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ mods=""
## Server-side Mods
servermods=""

## Mods to be downloaded from Steam Workshop
# Use workshop ids
# workshopmods="450814997;2131302796"
workshopmods=""

## Path to BattlEye
# Leave empty for default
bepath=""
Expand Down Expand Up @@ -134,6 +139,8 @@ sleeptime="0.5"
# Server appid
appid="233780"
steamcmdforcewindows="no"
# Game appid
gameappid="107410"
# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch
branch=""
betapassword=""
Expand Down
46 changes: 46 additions & 0 deletions lgsm/functions/command_workshop_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# LinuxGSM command_workshop_install.sh module
# Author: Daniel Gibbs
# Contributors: http://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: List and installs available mods along with mods_list.sh and mods_core.sh.

commandname="WORKSHOP-INSTALL"
commandaction="Installing Steam Workshop mods"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set

check.sh
workshop_core.sh

fn_print_header
fn_create_workshop_dir
fn_workshop_get_list

# Displays a list of installed mods.

echo -e ""
echo -e "Installed workshop addons/mods"
echo -e "================================="
fn_workshop_installed_list

for modid in "${workshoplist[@]}"; do
# Check if the mod is already installed and warn the user.
# if ! fn_workshop_check_mod_update $modid; then
# fn_print_warning_nl "$(fn_workshop_get_mod_name ${modid}) is already installed"
# fn_script_log_warn "$(fn_workshop_get_mod_name ${modid}) is already installed"
# echo -e " * Any configs may be overwritten."
# if ! fn_prompt_yn "Continue?" Y; then
# core_exit.sh
# fi
# fn_script_log_info "User selected to continue"
# fi
echo -e ""
echo -e "Installing $(fn_workshop_get_mod_name ${modid})."
echo -e "================================="
fn_workshop_download "${modid}"
fn_workshop_copy_destination "${modid}"s
done

fn_workshop_lowercase
core_exit.sh
36 changes: 36 additions & 0 deletions lgsm/functions/command_workshop_update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# LinuxGSM command_workshop_install.sh module
# Author: Daniel Gibbs
# Contributors: http://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: List and installs available mods along with mods_list.sh and mods_core.sh.

commandname="WORKSHOP-INSTALL"
commandaction="Installing Steam Workshop mods"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set

check.sh
workshop_core.sh
fn_print_header
fn_create_workshop_dir
fn_workshop_get_list

# Displays a list of installed mods.
echo -e "Installed workshop addons/mods"
echo -e "================================="
fn_workshop_installed_list

for modid in "${workshoplist[@]}"; do
modname="$(fn_workshop_get_mod_name ${modid})"
if [ fn_workshop_check_mod_update "${modid}" ]; then
echo "Mod ${modname} (${modid}) is not up to date."
fn_workshop_download "${modid}"
fn_workshop_copy_destination "${modid}"
else
echo "Mod ${modname} is up to date."
fi
done

fn_workshop_lowercase
core_exit.sh
22 changes: 22 additions & 0 deletions lgsm/functions/core_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,21 @@ command_mods_remove.sh() {
fn_fetch_function
}

command_workshop_install.sh() {
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

command_workshop_update.sh() {
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

command_workshop_remove.sh() {
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

command_fastdl.sh() {
functionfile="${FUNCNAME[0]}"
fn_fetch_function
Expand Down Expand Up @@ -287,6 +302,13 @@ mods_core.sh() {
fn_fetch_function
}

# Steam Workshop

workshop_core.sh() {
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

# Dev

command_dev_clear_functions.sh() {
Expand Down
9 changes: 9 additions & 0 deletions lgsm/functions/core_getopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ cmd_validate=("v;validate" "command_validate.sh" "Validate server files with Ste
cmd_mods_install=("mi;mods-install" "command_mods_install.sh" "View and install available mods/addons.")
cmd_mods_remove=("mr;mods-remove" "command_mods_remove.sh" "View and remove an installed mod/addon.")
cmd_mods_update=("mu;mods-update" "command_mods_update.sh" "Update installed mods/addons.")
# Server with Steam Workshop
cmd_workshop_install=("wi;workshop-install" "command_workshop_install.sh" "View and install mods/addons from Steam Workshop.")
cmd_workshop_remove=("wr;workshop-remove" "command_workshop_remove.sh" "View and remove an installed mod/addon from Steam Workshop.")
cmd_workshop_update=("wu;workshop-update" "command_workshop_update.sh" "Update installed mods/addons from Steam Workshop.")
# Server specific.
cmd_change_password=("pw;change-password" "command_ts3_server_pass.sh" "Change TS3 serveradmin password.")
cmd_install_default_resources=("ir;install-default-resources" "command_install_resources_mta.sh" "Install the MTA default resources.")
Expand Down Expand Up @@ -137,6 +141,11 @@ if [ "${engine}" == "source" ] || [ "${shortname}" == "rust" ] || [ "${shortname
currentopt+=("${cmd_mods_install[@]}" "${cmd_mods_remove[@]}" "${cmd_mods_update[@]}")
fi

## Workshop commands.
if [ "${engine}" == "realvirtuality" ]; then
currentopt+=("${cmd_workshop_install[@]}" "${cmd_workshop_remove[@]}" "${cmd_workshop_update[@]}")
fi

## Installer.
currentopt+=("${cmd_install[@]}" "${cmd_auto_install[@]}")

Expand Down
Loading