Add support for custom integrations. The first is no food, which makes a new types.xml of all the food class items for use with CE, then sets nominal to 0 in all entries.

Have server logs go into a logs directory, with sub-directories in there with the date to contain that run's logs.
Fix XML handling output.
Update bogus DayZ version.
Add custom integration docs.
This commit is contained in:
Daniel Ceregatti 2023-09-28 15:39:13 -07:00
parent 371d6d2b38
commit 9513fc4d97
4 changed files with 77 additions and 5 deletions

View file

@ -35,9 +35,9 @@ do
if [ -f ${OUT} ] if [ -f ${OUT} ]
then then
xmllint --noout ${OUT} 2> /dev/null && ( xmllint --noout ${OUT} 2> /dev/null && (
echo -e "${green}${OUT}.xml passes XML lint test!${default}" echo -e "${green}${OUT} passes XML lint test!${default}"
) || ( ) || (
echo -e "${yellow}${OUT}.xml does not pass XML lint test!${default}" echo -e "${yellow}${OUT} does not pass XML lint test!${default}"
) )
fi fi
done done

View file

@ -2,6 +2,35 @@
## These are the custom integrations possible with dayzdockerserver ## These are the custom integrations possible with dayzdockerserver
### Lowered login/logout time
To lower the login/logout time from the default 15 seconds.
Go into the server container:
```shell
docker compose exec server bash
```
Make a new directory in /profiles/custom called login and go into it:
```shell
mkdir -p /profiles/custom/login
cd /profiles/custom/login
```
Generate a globals.xml with the changed values:
```shell
cat > globals.xml << EOF
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<variables>
<var name="TimeLogin" type="0" value="1"/>
<var name="TimeLogout" type="0" value="1"/>
</variables>
EOF
```
### No food ### No food
For a more survival-oriented experience, one can prevent food from spawning in the world, forcing players to hunt and fish for food. For a more survival-oriented experience, one can prevent food from spawning in the world, forcing players to hunt and fish for food.
@ -26,12 +55,17 @@ xmlstarlet ed \
-s / -t elem -n food \ -s / -t elem -n food \
-m "/types/type[category[contains(@name, 'food')]]" "/food" \ -m "/types/type[category[contains(@name, 'food')]]" "/food" \
-d /types \ -d /types \
-r /food -v /types \ -r food -v types \
-u //nominal -v 0 \ -u //nominal -v 0 \
/serverfiles/mpmissions/dayzOffline.chernarusplus/db/types.xml \ /serverfiles/mpmissions/dayzOffline.chernarusplus/db/types.xml \
> types.xml > types.xml
``` ```
Always lint any XML file that is created/merged:
```shell
xmllint --noout types.xml
```
Explanation: Explanation:
* Start xmlstarlet in edit mode * Start xmlstarlet in edit mode
* Add a new XML node at the root named "food" * Add a new XML node at the root named "food"

View file

@ -127,7 +127,7 @@ report() {
echo echo
echo -e "========================================== End log ======================================${default}" echo -e "========================================== End log ======================================${default}"
# Back these files up into a new directory with the current time stamp in the name # Back these files up into a new directory with the current time stamp in the name
DIR="${SERVER_PROFILE}/logs-$(date +%Y-%m-%d-%H-%M-%S)" DIR="${SERVER_PROFILE}/logs/$(date +%Y-%m-%d-%H-%M-%S)"
mkdir -p ${DIR} mkdir -p ${DIR}
cd ${SERVER_PROFILE} cd ${SERVER_PROFILE}
mv -v *.log *.RPT *.mdmp ${DIR} 2> /dev/null mv -v *.log *.RPT *.mdmp ${DIR} 2> /dev/null
@ -199,6 +199,44 @@ mergexml(){
fi fi
done done
done done
if [ -d ${SERVER_PROFILE}/custom ]
then
# First, remove any existing files, via the custom_ prefix
rm -rf ${MPMISSIONS}/${MAP}/custom_*
for dir in $(ls ${SERVER_PROFILE}/custom 2> /dev/null)
do
FOUND=0
C=""
for i in "CFGSPAWNABLETYPES:spawnabletypes:type" "EVENTS:events:event" "TYPES:types:type" "GLOBALS:globals:var"
do
var=$(echo ${i} | cut -d: -f1)
CHECK=$(echo ${i} | cut -d: -f2)
CHILD=$(echo ${i} | cut -d: -f3)
if [ -f "${SERVER_PROFILE}/custom/${dir}/${var,,}.xml" ]
then
if [[ ${FOUND} = 0 ]]
then
echo
echo -e "${green}Adding custom integration ${dir}${default}"
FOUND=1
fi
mkdir -p ${MPMISSIONS}/${MAP}/custom_${dir}
echo -n "Copy "
cp -v ${SERVER_PROFILE}/custom/${dir}/${var,,}.xml ${MPMISSIONS}/${MAP}/custom_${dir}/${var,,}.xml
C+="-s / -t elem -n file -a /file -t attr -n name -v ${var,,}.xml -a /file -t attr -n type -v ${CHECK} -m /file /ce "
fi
done
if [[ ${C} != "" ]]
then
# Merge into the current mpmissions file
echo "Create new XML node <ce folder=\"custom_${dir}\"> -> ${MPMISSIONS}/${MAP}/cfgeconomycore.xml"
find ${MPMISSIONS}/${MAP} -name cfgeconomycore.xml -exec \
xmlstarlet ed -L -s / -t elem -n ce \
-a /ce -t attr -n folder -v "custom_${dir}" ${C} \
-m /ce /economycore {} \;
fi
done
fi
} }
# Start the server in the foreground # Start the server in the foreground

View file

@ -122,7 +122,7 @@ const config = {
const getVersion = (installed) => { const getVersion = (installed) => {
if(installed) { if(installed) {
return "1.21.bogus" return "1.22.bogus"
} }
return "" return ""
} }