mirror of
https://ceregatti.org/git/daniel/dayzdockerserver.git
synced 2025-05-06 14:21:18 +00:00
Implement start scripts to do all the extra stuff, like remove nodes from XML files.
Add WinterChernarusV2 mod's init changes.
This commit is contained in:
parent
a92cdaf539
commit
40f31d0b14
11 changed files with 109 additions and 31 deletions
|
@ -21,30 +21,30 @@ do
|
||||||
TYPE=$(echo ${i} | cut -d. -f2)
|
TYPE=$(echo ${i} | cut -d. -f2)
|
||||||
UP=${FILE^^}
|
UP=${FILE^^}
|
||||||
VAL=${!UP}
|
VAL=${!UP}
|
||||||
DIR="${WORKSHOP_DIR}/${ID}"
|
DIR="${WORKSHOP_DIR}/${ID}"
|
||||||
OUT="${DIR}/${i}"
|
OUT="${DIR}/${i}"
|
||||||
if echo ${VAL} | grep -qE "^http"
|
if echo ${VAL} | grep -qE "^http"
|
||||||
then
|
then
|
||||||
echo
|
echo
|
||||||
echo "${i} is a URL, downloading to ${OUT}"
|
echo "${i} is a URL, downloading to ${OUT}"
|
||||||
curl -so ${OUT} ${VAL}
|
curl -so ${OUT} ${VAL}
|
||||||
elif echo ${VAL} | grep -qE "^local"
|
elif echo ${VAL} | grep -qE "^local"
|
||||||
then
|
then
|
||||||
echo
|
echo
|
||||||
echo "${i} comes from mod integration, copying to ${OUT}"
|
echo "${i} comes from mod integration, copying to ${OUT}"
|
||||||
echo -n " "
|
echo -n " "
|
||||||
cp -v "${FILES}/mods/${ID}/${i}" "${OUT}"
|
cp -v "${FILES}/mods/${ID}/${i}" "${OUT}"
|
||||||
elif echo ${VAL} | grep -qE "^\./"
|
elif echo ${VAL} | grep -qE "^\./"
|
||||||
then
|
then
|
||||||
echo
|
echo
|
||||||
echo "${FILE} comes from the mod as ${VAL}, copying to ${OUT}"
|
echo "${FILE} comes from the mod as ${VAL}, copying to ${OUT}"
|
||||||
echo -n " "
|
echo -n " "
|
||||||
cp -v "${DIR}/${VAL}" "${OUT}"
|
cp -v "${DIR}/${VAL}" "${OUT}"
|
||||||
fi
|
fi
|
||||||
if [ -f ${OUT} ]
|
if [ -f ${OUT} ]
|
||||||
then
|
then
|
||||||
if [[ ${TYPE} = "xml" ]]
|
if [[ ${TYPE} = "xml" ]]
|
||||||
then
|
then
|
||||||
xmllint --noout ${OUT} 2> /dev/null && (
|
xmllint --noout ${OUT} 2> /dev/null && (
|
||||||
echo -e " ${green}${OUT} passes XML lint test!${default}"
|
echo -e " ${green}${OUT} passes XML lint test!${default}"
|
||||||
) || (
|
) || (
|
||||||
|
@ -58,8 +58,14 @@ do
|
||||||
) && (
|
) && (
|
||||||
echo -e " ${green}${OUT} passes JSON lint test!${default}"
|
echo -e " ${green}${OUT} passes JSON lint test!${default}"
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo
|
if [ -f "${FILES}/mods/${ID}/start.sh" ]
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "Copy ${FILES}/mods/${ID}/start.sh -> ${DIR}/start.sh"
|
||||||
|
cp "${FILES}/mods/${ID}/start.sh" "${DIR}/start.sh"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
54
files/mods/2981609048/init.c
Normal file
54
files/mods/2981609048/init.c
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
--- init.c 2023-12-22 09:06:49.416111938 +0000
|
||||||
|
+++ init.c.new 2023-12-22 09:08:58.365653156 +0000
|
||||||
|
@@ -1,34 +1,19 @@
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
- //INIT ECONOMY--------------------------------------
|
||||||
|
- Hive ce = CreateHive();
|
||||||
|
- if ( ce )
|
||||||
|
- ce.InitOffline();
|
||||||
|
-
|
||||||
|
- //DATE RESET AFTER ECONOMY INIT-------------------------
|
||||||
|
+ CreateHive();
|
||||||
|
+ GetHive().InitOffline();
|
||||||
|
int year, month, day, hour, minute;
|
||||||
|
- int reset_month = 9, reset_day = 20;
|
||||||
|
- GetGame().GetWorld().GetDate(year, month, day, hour, minute);
|
||||||
|
+ GetGame().GetWorld().GetDate( year, month, day, hour, minute );
|
||||||
|
|
||||||
|
- if ((month == reset_month) && (day < reset_day))
|
||||||
|
+ //Change here the dates for whatever months you desire
|
||||||
|
+ if ( month < 12 )
|
||||||
|
{
|
||||||
|
- GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
|
||||||
|
+ year = 2011;
|
||||||
|
+ month = 12;
|
||||||
|
+ day = 25;
|
||||||
|
+ GetGame().GetWorld().SetDate( year, month, day, hour, minute );
|
||||||
|
}
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
- if ((month == reset_month + 1) && (day > reset_day))
|
||||||
|
- {
|
||||||
|
- GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
- {
|
||||||
|
- if ((month < reset_month) || (month > reset_month + 1))
|
||||||
|
- {
|
||||||
|
- GetGame().GetWorld().SetDate(year, reset_month, reset_day, hour, minute);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
+}
|
||||||
|
|
||||||
|
class CustomMission: MissionServer
|
||||||
|
{
|
||||||
|
@@ -95,4 +80,4 @@
|
||||||
|
Mission CreateCustomMission(string path)
|
||||||
|
{
|
||||||
|
return new CustomMission();
|
||||||
|
-}
|
||||||
|
\ No newline at end of file
|
||||||
|
+}
|
|
@ -16,5 +16,4 @@
|
||||||
<pos x="673.779" z="8747.024" a="0" y="194.405" group="HypeTrain_Myshkino"/>
|
<pos x="673.779" z="8747.024" a="0" y="194.405" group="HypeTrain_Myshkino"/>
|
||||||
<pos x="3262.817" z="12430.286" a="0" y="219.495" group="HypeTrain_Petrovka"/>
|
<pos x="3262.817" z="12430.286" a="0" y="219.495" group="HypeTrain_Petrovka"/>
|
||||||
</event>
|
</event>
|
||||||
<event name="StaticTrain"/>
|
|
||||||
</eventposdef>
|
</eventposdef>
|
||||||
|
|
9
files/mods/3115714092/start.sh
Normal file
9
files/mods/3115714092/start.sh
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This is run in the directory with the target files
|
||||||
|
|
||||||
|
# Remove static trains
|
||||||
|
xmlstarlet ed -L -d '//eventposdef/event[@name="StaticTrain"]' cfgeventspawns.xml
|
||||||
|
|
||||||
|
# Remove spawn locations of former trains to prevent floating loot on tracks
|
||||||
|
xmlstarlet ed -L -d '//map/group[starts-with(@name,"Land_Train_")]' mapgrouppos.xml
|
|
@ -1,4 +1,4 @@
|
||||||
# The following two files are map-specific, supporting chernarus, livonia, and namalsk
|
# The following two files are specific to chernarus, but livonia, and namalsk are also *currently* supported.
|
||||||
CFGEVENTGROUPS=local
|
CFGEVENTGROUPS=local
|
||||||
CFGEVENTSPAWNS=local
|
CFGEVENTSPAWNS=local
|
||||||
CFGSPAWNABLETYPES=local
|
CFGSPAWNABLETYPES=local
|
||||||
|
|
1
files/mods/@WinterChernarusV2
Symbolic link
1
files/mods/@WinterChernarusV2
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
2981609048
|
|
@ -134,7 +134,7 @@ report() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mergexml(){
|
mergexml(){
|
||||||
echo
|
echo
|
||||||
# First copy the pristine files from upstream
|
# First copy the pristine files from upstream
|
||||||
echo -e "${green}Copying upstream files into local mpmissions for map ${MAP}${default}":
|
echo -e "${green}Copying upstream files into local mpmissions for map ${MAP}${default}":
|
||||||
find /mpmissions/${MAP} \( \
|
find /mpmissions/${MAP} \( \
|
||||||
|
@ -153,9 +153,10 @@ mergexml(){
|
||||||
for link in $(ls -tdr ${SERVER_PROFILE}/@* 2> /dev/null)
|
for link in $(ls -tdr ${SERVER_PROFILE}/@* 2> /dev/null)
|
||||||
do
|
do
|
||||||
ID=$(readlink ${link} | awk -F/ '{print $NF}')
|
ID=$(readlink ${link} | awk -F/ '{print $NF}')
|
||||||
# Going to have to maintain a matrix of file names -> root node -> child node permutations
|
|
||||||
C=""
|
C=""
|
||||||
FOUND=0
|
FOUND=0
|
||||||
|
# This loop handles Central Economy files
|
||||||
|
# A matrix of file names -> root node -> child node permutations
|
||||||
for i in "CFGSPAWNABLETYPES:spawnabletypes:type" "EVENTS:events:event" "TYPES:types:type"
|
for i in "CFGSPAWNABLETYPES:spawnabletypes:type" "EVENTS:events:event" "TYPES:types:type"
|
||||||
do
|
do
|
||||||
var=$(echo ${i} | cut -d: -f1)
|
var=$(echo ${i} | cut -d: -f1)
|
||||||
|
@ -262,6 +263,14 @@ mergexml(){
|
||||||
cp ${WORKSHOP_DIR}/${ID}/${var,,}.xml ${MPMISSIONS}/${MAP}/${var,,}.xml
|
cp ${WORKSHOP_DIR}/${ID}/${var,,}.xml ${MPMISSIONS}/${MAP}/${var,,}.xml
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
# Here are where start actions happen
|
||||||
|
if [ -f "${WORKSHOP_DIR}/${ID}/start.sh" ]
|
||||||
|
then
|
||||||
|
echo "Running start script -> ${WORKSHOP_DIR}/${ID}/start.sh"
|
||||||
|
pushd ${MPMISSIONS}/${MAP} > /dev/null
|
||||||
|
bash -x "${WORKSHOP_DIR}/${ID}/start.sh"
|
||||||
|
popd > /dev/null
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
if [ -d ${SERVER_PROFILE}/custom ]
|
if [ -d ${SERVER_PROFILE}/custom ]
|
||||||
then
|
then
|
||||||
|
|
Loading…
Add table
Reference in a new issue