mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-14 19:48:27 +00:00
Merge branch '1.6-dev.unstable' into 1.6-dev
This commit is contained in:
commit
60d0f86cca
@ -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
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@ -660,6 +660,22 @@ doRun() {
|
||||
|
||||
arkserveropts="$serverMap"
|
||||
|
||||
while read varname; do
|
||||
val="${!varname}"
|
||||
modid="${varname#arkmod_}"
|
||||
case "$val" in
|
||||
game*|enabled)
|
||||
ark_GameModIds="${ark_GameModIds}${ark_GameModIds:+,}${modid}"
|
||||
;;
|
||||
map*)
|
||||
serverMapModId="${modid}"
|
||||
;;
|
||||
tc|total*)
|
||||
ark_TotalConversionMod="${modid}"
|
||||
;;
|
||||
esac
|
||||
done < <(sed -n 's/^\(arkmod_[^= ]*\)=.*/\1/p' <"$configfile")
|
||||
|
||||
if [ -n "$serverMapModId" ]; then
|
||||
serverMap="$(perl -e '
|
||||
my $data;
|
||||
@ -1488,6 +1504,11 @@ getModIds(){
|
||||
echo "${serverMapModId}"
|
||||
echo "${ark_TotalConversionMod}"
|
||||
echo "${ark_GameModIds}" | tr ',' '\n'
|
||||
for v in "${!arkmod_@}"; do
|
||||
if [ "${!v}" != "disabled" ]; then
|
||||
echo "${v#arkmod_}"
|
||||
fi
|
||||
done
|
||||
find "${arkserverroot}/ShooterGame/Content/Mods" -maxdepth 1 -type d -printf "%P\n"
|
||||
) | sort | uniq | grep '^[1-9][0-9]*$'
|
||||
}
|
||||
@ -1822,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
|
||||
#
|
||||
@ -2485,6 +2537,12 @@ main(){
|
||||
installmod)
|
||||
doInstallMod "${args[@]}"
|
||||
;;
|
||||
enablemod)
|
||||
doEnableMod "${args[@]}"
|
||||
;;
|
||||
disablemod)
|
||||
doDisableMod "${args[@]}"
|
||||
;;
|
||||
installmods)
|
||||
doInstallAllMods
|
||||
;;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user