mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-11 02:28:27 +00:00
Add enablemod and disablemod commands
This commit is contained in:
parent
54d0e81ee8
commit
0403d29495
@ -242,6 +242,22 @@ instances.
|
||||
Runs the `uninstallmod` command followed by the `installmod`
|
||||
command
|
||||
|
||||
`enablemod <modnum>`::
|
||||
`enablemod <modnum>=<modtype>`::
|
||||
Enables the `arkmod_<modnum>` setting in the instance config.
|
||||
modtype defaults to `game`.
|
||||
Mod types:
|
||||
|
||||
`game`;;
|
||||
A mod in `GameModIds`
|
||||
|
||||
`map`;;
|
||||
The `MapModId` mod
|
||||
|
||||
`tc`;;
|
||||
`totalconversion`;;
|
||||
The `TotalConversionMod` mod
|
||||
|
||||
`backup`::
|
||||
Backs up the saved world and game config files to a compressed
|
||||
tar file in the backups directory specified in the config
|
||||
@ -495,6 +511,30 @@ the global config.
|
||||
the `-StructureDestructionTag=DestroySwampSnowStructures`
|
||||
option.
|
||||
|
||||
`arkmod_<modnum>=<modtype>`::
|
||||
Specifies a mod that can be enabled or disabled using
|
||||
`enablemod` and `disablemod`. Note that mod ids specified
|
||||
using these options are in addition to those specified directly
|
||||
in the `ark_GameModIds` option, and override those specified in the
|
||||
`ark_MapModId`, `serverMapMod` and `ark_TotalConversionMod`
|
||||
options. Options are processed in the order they are specified
|
||||
in the instance config file, and `arkmod_*` options in the
|
||||
common config file are not applied.
|
||||
Mod types:
|
||||
|
||||
`game`;;
|
||||
A mod to be specified in `GameModIds`
|
||||
|
||||
`map`;;
|
||||
The mod to be specified in `MapModId`
|
||||
|
||||
`tc`;;
|
||||
`totalconversion`;;
|
||||
The mod to be specified in `TotalConversionMod`
|
||||
|
||||
`disabled`;;
|
||||
A disabled mod
|
||||
|
||||
Common ARK options
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@ -1843,6 +1843,37 @@ doUninstallMod(){
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Enables a mod in the config
|
||||
#
|
||||
doEnableMod(){
|
||||
local modid="${1%=*}"
|
||||
local modtype="${1#*=}"
|
||||
if [ "$modtype" = "$1" ]; then
|
||||
modtype=game
|
||||
fi
|
||||
local modvar="arkmod_${modid}"
|
||||
if [ -n "${!modvar}" ]; then
|
||||
sed -i "s|^\(${modvar}\)=[^ ]*|\1=${modtype}|" "$configfile"
|
||||
else
|
||||
echo "${modvar}=${modtype}" >>"$configfile"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Disable a mod in the config
|
||||
#
|
||||
doDisableMod(){
|
||||
local modid="$1"
|
||||
local modvar="arkmod_$modid"
|
||||
if [ "$ark_GameModIds" = *"$modid"* ]; then
|
||||
sed -i "s|^\(ark_GameModIds=\(\|[\"']\)\(\|[^\"' ]*,\)\)${modid},*|\1|" "$configfile"
|
||||
fi
|
||||
if [ -n "$modvar" ]; then
|
||||
sed -i "s|^\(arkmod_${modid}\)=[^ ]*|\1=disabled|" "$configfile"
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Removes mod from steamcmd workshop directory
|
||||
#
|
||||
@ -2506,6 +2537,12 @@ main(){
|
||||
installmod)
|
||||
doInstallMod "${args[@]}"
|
||||
;;
|
||||
enablemod)
|
||||
doEnableMod "${args[@]}"
|
||||
;;
|
||||
disablemod)
|
||||
doDisableMod "${args[@]}"
|
||||
;;
|
||||
installmods)
|
||||
doInstallAllMods
|
||||
;;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user