diff --git a/files/bin/xml.sh b/files/bin/xml.sh index 1a65394..c949197 100755 --- a/files/bin/xml.sh +++ b/files/bin/xml.sh @@ -21,30 +21,30 @@ do TYPE=$(echo ${i} | cut -d. -f2) UP=${FILE^^} VAL=${!UP} - DIR="${WORKSHOP_DIR}/${ID}" - OUT="${DIR}/${i}" - if echo ${VAL} | grep -qE "^http" - then - echo - echo "${i} is a URL, downloading to ${OUT}" - curl -so ${OUT} ${VAL} - elif echo ${VAL} | grep -qE "^local" - then - echo - echo "${i} comes from mod integration, copying to ${OUT}" - echo -n " " - cp -v "${FILES}/mods/${ID}/${i}" "${OUT}" - elif echo ${VAL} | grep -qE "^\./" - then - echo - echo "${FILE} comes from the mod as ${VAL}, copying to ${OUT}" - echo -n " " - cp -v "${DIR}/${VAL}" "${OUT}" - fi - if [ -f ${OUT} ] - then - if [[ ${TYPE} = "xml" ]] - then + DIR="${WORKSHOP_DIR}/${ID}" + OUT="${DIR}/${i}" + if echo ${VAL} | grep -qE "^http" + then + echo + echo "${i} is a URL, downloading to ${OUT}" + curl -so ${OUT} ${VAL} + elif echo ${VAL} | grep -qE "^local" + then + echo + echo "${i} comes from mod integration, copying to ${OUT}" + echo -n " " + cp -v "${FILES}/mods/${ID}/${i}" "${OUT}" + elif echo ${VAL} | grep -qE "^\./" + then + echo + echo "${FILE} comes from the mod as ${VAL}, copying to ${OUT}" + echo -n " " + cp -v "${DIR}/${VAL}" "${OUT}" + fi + if [ -f ${OUT} ] + then + if [[ ${TYPE} = "xml" ]] + then xmllint --noout ${OUT} 2> /dev/null && ( echo -e " ${green}${OUT} passes XML lint test!${default}" ) || ( @@ -58,8 +58,14 @@ do ) && ( echo -e " ${green}${OUT} passes JSON lint test!${default}" ) - fi - fi + fi + fi 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 diff --git a/files/mods/1891132304/cfggameplay.json b/files/mods/2981609048/cfggameplay.json similarity index 100% rename from files/mods/1891132304/cfggameplay.json rename to files/mods/2981609048/cfggameplay.json diff --git a/files/mods/1891132304/cfgweather.xml b/files/mods/2981609048/cfgweather.xml similarity index 100% rename from files/mods/1891132304/cfgweather.xml rename to files/mods/2981609048/cfgweather.xml diff --git a/files/mods/2981609048/init.c b/files/mods/2981609048/init.c new file mode 100644 index 0000000..c433712 --- /dev/null +++ b/files/mods/2981609048/init.c @@ -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 ++} diff --git a/files/mods/1891132304/types.xml b/files/mods/2981609048/types.xml similarity index 100% rename from files/mods/1891132304/types.xml rename to files/mods/2981609048/types.xml diff --git a/files/mods/1891132304/xml.env b/files/mods/2981609048/xml.env similarity index 100% rename from files/mods/1891132304/xml.env rename to files/mods/2981609048/xml.env diff --git a/files/mods/3115714092/cfgeventspawns.xml b/files/mods/3115714092/cfgeventspawns.xml index 4621cb3..e576048 100644 --- a/files/mods/3115714092/cfgeventspawns.xml +++ b/files/mods/3115714092/cfgeventspawns.xml @@ -16,5 +16,4 @@ - diff --git a/files/mods/3115714092/start.sh b/files/mods/3115714092/start.sh new file mode 100644 index 0000000..b3c54be --- /dev/null +++ b/files/mods/3115714092/start.sh @@ -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 diff --git a/files/mods/3115714092/xml.env b/files/mods/3115714092/xml.env index 568a4c1..fe147de 100644 --- a/files/mods/3115714092/xml.env +++ b/files/mods/3115714092/xml.env @@ -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 CFGEVENTSPAWNS=local CFGSPAWNABLETYPES=local diff --git a/files/mods/@WinterChernarusV2 b/files/mods/@WinterChernarusV2 new file mode 120000 index 0000000..94b4f33 --- /dev/null +++ b/files/mods/@WinterChernarusV2 @@ -0,0 +1 @@ +2981609048 \ No newline at end of file diff --git a/server/bin/dz b/server/bin/dz index 3e6fdab..610c84d 100755 --- a/server/bin/dz +++ b/server/bin/dz @@ -134,7 +134,7 @@ report() { } mergexml(){ - echo + echo # First copy the pristine files from upstream echo -e "${green}Copying upstream files into local mpmissions for map ${MAP}${default}": find /mpmissions/${MAP} \( \ @@ -153,9 +153,10 @@ mergexml(){ for link in $(ls -tdr ${SERVER_PROFILE}/@* 2> /dev/null) do ID=$(readlink ${link} | awk -F/ '{print $NF}') - # Going to have to maintain a matrix of file names -> root node -> child node permutations C="" 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" do var=$(echo ${i} | cut -d: -f1) @@ -262,6 +263,14 @@ mergexml(){ cp ${WORKSHOP_DIR}/${ID}/${var,,}.xml ${MPMISSIONS}/${MAP}/${var,,}.xml fi 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 if [ -d ${SERVER_PROFILE}/custom ] then