From 05f34e5d6a74a014a36c7a69d0f16bb3d58ccfd5 Mon Sep 17 00:00:00 2001 From: ulteq Date: Tue, 5 May 2015 22:21:29 +0200 Subject: [PATCH 01/31] Attempt to fix https://github.com/acemod/ACE3/issues/1025 --- addons/weather/functions/fnc_updateWind.sqf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/weather/functions/fnc_updateWind.sqf b/addons/weather/functions/fnc_updateWind.sqf index 06bb57d093..b362458fdb 100644 --- a/addons/weather/functions/fnc_updateWind.sqf +++ b/addons/weather/functions/fnc_updateWind.sqf @@ -13,11 +13,16 @@ if (!GVAR(syncWind)) exitWith { ACE_wind = wind }; +private ["_newWaves"]; + ACE_wind = [] call FUNC(getWind); setWind [ACE_wind select 0, ACE_wind select 1, true]; 2 setGusts 0; // Set waves: 0 when no wind, 1 when wind >= 16 m/s -1 setWaves (((vectorMagnitude ACE_wind) / 16.0) min 1.0); +_newWaves = ((vectorMagnitude ACE_wind) / 16.0) min 1.0; +if (abs(_newWaves - waves) > 0.1) then { + 1 setWaves _newWaves; +}; TRACE_3("Wind/ACE_wind/Deviation(m/s)",wind,ACE_wind,Round((vectorMagnitude (ACE_wind vectorDiff wind)) * 1000) / 1000); From cea6d0063d809f981db070e1f1da797e79e37117 Mon Sep 17 00:00:00 2001 From: ulteq Date: Thu, 7 May 2015 17:49:59 +0200 Subject: [PATCH 02/31] Disables the CfgAISkill class to prevent it from affecting players. --- addons/ai/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/ai/config.cpp b/addons/ai/config.cpp index fdcb6afe9d..0d5f7c62c3 100644 --- a/addons/ai/config.cpp +++ b/addons/ai/config.cpp @@ -12,5 +12,5 @@ class CfgPatches { }; }; -#include "CfgAISkill.hpp" +//#include "CfgAISkill.hpp" #include "CfgWeapons.hpp" From 027a3dd4ac1c89d8fb56c177a84d57c3f55ae785 Mon Sep 17 00:00:00 2001 From: jaynus Date: Thu, 7 May 2015 12:52:19 -0700 Subject: [PATCH 03/31] AB map tweaking. Just a bit of optimization and crash checking. --- .../advanced_ballistics/AdvancedBallistics.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/extensions/advanced_ballistics/AdvancedBallistics.cpp b/extensions/advanced_ballistics/AdvancedBallistics.cpp index 6e964f8921..554c21b601 100644 --- a/extensions/advanced_ballistics/AdvancedBallistics.cpp +++ b/extensions/advanced_ballistics/AdvancedBallistics.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #define M_PI 3.14159265358979323846f @@ -57,7 +57,7 @@ struct Map { }; std::vector bulletDatabase; -std::map mapDatabase; +std::unordered_map mapDatabase; std::string worldName = ""; Map* map = &mapDatabase[""]; @@ -339,10 +339,8 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) tickTime = strtod(strtok_s(NULL, ":", &next_token), NULL); tickTime += strtod(strtok_s(NULL, ":", &next_token), NULL); - while (index >= bulletDatabase.size()) { - Bullet bullet; - bulletDatabase.push_back(bullet); - } + if (index >= bulletDatabase.size()) + bulletDatabase.resize(index); bulletDatabase[index].airFriction = airFriction; bulletDatabase[index].ballisticCoefficients = ballisticCoefficients; @@ -611,8 +609,12 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) mapGrids = (int)ceil((double)mapSize / 50.0) + 1; gridCells = mapGrids * mapGrids; + + auto map_iter = mapDatabase.find(worldName); + if (map_iter == mapDatabase.end()) + return; + map = &map_iter->second; - map = &mapDatabase[worldName]; if (map->gridHeights.size() == gridCells) { int n = sprintf_s(output, outputSize, "%s", "Terrain already initialized"); return; From 3e6c203655eacd9b88b7fdf504ca75e90ed28c97 Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 8 May 2015 06:57:19 -0700 Subject: [PATCH 04/31] size+1 --- extensions/advanced_ballistics/AdvancedBallistics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/advanced_ballistics/AdvancedBallistics.cpp b/extensions/advanced_ballistics/AdvancedBallistics.cpp index 554c21b601..e6c55184a7 100644 --- a/extensions/advanced_ballistics/AdvancedBallistics.cpp +++ b/extensions/advanced_ballistics/AdvancedBallistics.cpp @@ -340,7 +340,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) tickTime += strtod(strtok_s(NULL, ":", &next_token), NULL); if (index >= bulletDatabase.size()) - bulletDatabase.resize(index); + bulletDatabase.resize(index+1); bulletDatabase[index].airFriction = airFriction; bulletDatabase[index].ballisticCoefficients = ballisticCoefficients; From 24505f59e16559b6eb176f6843a43aa83e800a74 Mon Sep 17 00:00:00 2001 From: KoffeinFlummi Date: Fri, 8 May 2015 19:27:42 +0200 Subject: [PATCH 05/31] Add option to stringtablediag to only show markdown --- tools/stringtablediag.py | 44 ++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/tools/stringtablediag.py b/tools/stringtablediag.py index c4aab0b104..8cd585ac2a 100755 --- a/tools/stringtablediag.py +++ b/tools/stringtablediag.py @@ -57,14 +57,16 @@ def main(): projectpath = os.path.dirname(os.path.dirname(scriptpath)) projectpath = os.path.join(projectpath, "addons") - print("#########################") - print("# Stringtable Diag Tool #") - print("#########################") + if "--markdown" not in sys.argv: + print("#########################") + print("# Stringtable Diag Tool #") + print("#########################") languages = get_all_languages(projectpath) - print("\nLanguages present in the repo:") - print(", ".join(languages)) + if "--markdown" not in sys.argv: + print("\nLanguages present in the repo:") + print(", ".join(languages)) keysum = 0 localizedsum = list(map(lambda x: 0, languages)) @@ -76,31 +78,33 @@ def main(): if keynumber == 0: continue - print("\n# " + module) + if "--markdown" not in sys.argv: + print("\n# " + module) keysum += keynumber for i in range(len(localized)): - print(" %s %s / %i" % ((languages[i]+":").ljust(10), str(localized[i]).ljust(3), keynumber)) + if "--markdown" not in sys.argv: + print(" %s %s / %i" % ((languages[i]+":").ljust(10), str(localized[i]).ljust(3), keynumber)) localizedsum[i] += localized[i] if localized[i] < keynumber: missing[i].append(module) - print("\n###########") - print("# RESULTS #") - print("###########") + if "--markdown" not in sys.argv: + print("\n###########") + print("# RESULTS #") + print("###########") + print("\nTotal number of keys: %i\n" % (keysum)) - print("\nTotal number of keys: %i\n" % (keysum)) + for i in range(len(languages)): + if localizedsum[i] == keysum: + print("%s No missing stringtable entries." % ((languages[i] + ":").ljust(12))) + else: + print("%s %s missing stringtable entry/entries." % ((languages[i] + ":").ljust(12), str(keysum - localizedsum[i]).rjust(4)), end="") + print(" ("+", ".join(missing[i])+")") - for i in range(len(languages)): - if localizedsum[i] == keysum: - print("%s No missing stringtable entries." % ((languages[i] + ":").ljust(12))) - else: - print("%s %s missing stringtable entry/entries." % ((languages[i] + ":").ljust(12), str(keysum - localizedsum[i]).rjust(4)), end="") - print(" ("+", ".join(missing[i])+")") + print("\n\n### MARKDOWN ###\n") - print("\n\n### MARKDOWN ###") - - print("\nTotal number of keys: %i\n" % (keysum)) + print("Total number of keys: %i\n" % (keysum)) print("| Language | Missing Entries | Relevant Modules | % done |") print("|----------|----------------:|------------------|--------|") From 6d44889292e093d032ebfaba0debfd630507841f Mon Sep 17 00:00:00 2001 From: KoffeinFlummi Date: Fri, 8 May 2015 19:27:58 +0200 Subject: [PATCH 06/31] Add deploy script --- tools/deploy.py | 101 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100755 tools/deploy.py diff --git a/tools/deploy.py b/tools/deploy.py new file mode 100755 index 0000000000..baefbf44e2 --- /dev/null +++ b/tools/deploy.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python3 + +#################################### +# ACE3 automatic deployment script # +# ================================ # +# This is not meant to be run # +# directly! # +#################################### + +import os +import sys +import shutil +import traceback +import subprocess as sp +from pygithub3 import Github + + +TRANSLATIONISSUE = 367 +TRANSLATIONBODY = """**How to translate ACE3:** +https://github.com/acemod/ACE3/blob/master/documentation/development/how-to-translate-ace3.md + +{} +""" + +REPOUSER = "acemod" +REPONAME = "ACE3" +REPOPATH = "{}/{}".format(REPOUSER,REPONAME) + +USERNAME = "ACE3 Travis" +USEREMAIL = "travis@ace3mod.com" + + +def update_translations(token): + diag = sp.check_output(["python3", "tools/stringtablediag.py", "--markdown"]) + diag = str(diag, "utf-8") + repo = Github(token).get_repo(REPOPATH) + issue = repo.get_issue(TRANSLATIONISSUE) + issue.edit(body=TRANSLATIONBODY.format(diag)) + + +def deploy_documentation(token): + devnull = open(os.devnull, "w") + url = "https://{}@github.com/{}".format(token, REPOPATH) + + sp.check_call(["git", "clone", url, "out", "--depth", "10", "--branch", "gh-pages"], stdout=devnull, stderr=devnull) + os.chdir("out") + + sp.check_call(["git", "config", "user.name", USERNAME]) + sp.check_call(["git", "config", "user.email", USEREMAIL]) + + for root, dirs, files in os.walk("../documentation", topdown=False): + target = root.replace("../documentation", "wiki") + if root == "../documentation": + continue + for name in files: + print("{} => {}".format(os.path.join(root, name), os.path.join(target, name))) + shutil.copyfile(os.path.join(root, name), os.path.join(target, name)) + + sp.check_call(["git", "add", "--all", "."]) + sp.check_call(["git", "commit", "-m", "Automatic gh-pages deployment"]) + sp.check_call(["git", "push", "origin", "gh-pages"], stdout=devnull, stderr=devnull) + + os.chdir("..") + + +def main(): + print("Obtaining token ...") + try: + token = os.environ["GH_TOKEN"] + except: + print("Could not obtain token.") + print(traceback.format_exc()) + return 1 + else: + print("done.") + + print("\nUpdating translation issue ...") + try: + update_translations(token) + except: + print("Failed to update translation issue.") + print(traceback.format_exc()) + return 1 + else: + print("done.") + + print("\nDeploying documentation ...") + try: + deploy_documentation(token) + except: + print("Failed to deploy documentation.") + print(traceback.format_exc()) + return 1 + else: + print("done.") + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) From b1f16132e561814278d68f8ff98a18a52c6e8f77 Mon Sep 17 00:00:00 2001 From: KoffeinFlummi Date: Fri, 8 May 2015 19:28:06 +0200 Subject: [PATCH 07/31] Add travis file --- .travis.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..65990248bf --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: python +python: + - "3.4" +before_script: + - pip install pygithub + - pip install pygithub3 +script: + - python3 tools/deploy.py +env: + global: + - secure: "KcJQbknBOdC5lA4nFGKPXVRVIGLDXDRzC8XkHuXJCE9pIR/wbxbkvx8fHKcC6SC9eHgzneC3+o4m4+CjIbVvIwDgslRbJ8Y59i90ncONmdoRx1HUYHwuYWVZm9HJFjCsIbrEqhSyyKS+PB3WZVOLbErtNHsgS8f43PTh5Ujg7Vg=" From 38b03e2b180c9236bc58c49e3a157aee0cdc224f Mon Sep 17 00:00:00 2001 From: KoffeinFlummi Date: Fri, 8 May 2015 19:37:14 +0200 Subject: [PATCH 08/31] Only commit if there's something to do --- tools/deploy.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/deploy.py b/tools/deploy.py index baefbf44e2..501987810a 100755 --- a/tools/deploy.py +++ b/tools/deploy.py @@ -57,8 +57,12 @@ def deploy_documentation(token): shutil.copyfile(os.path.join(root, name), os.path.join(target, name)) sp.check_call(["git", "add", "--all", "."]) - sp.check_call(["git", "commit", "-m", "Automatic gh-pages deployment"]) - sp.check_call(["git", "push", "origin", "gh-pages"], stdout=devnull, stderr=devnull) + + filenum = sp.check_output(["git", "status", "--porcelain"]) + filenum = len(str(filenum, "utf-8").split("\n")) - 1 + if filenum > 0: + sp.check_call(["git", "commit", "-m", "Automatic gh-pages deployment"]) + sp.check_call(["git", "push", "origin", "gh-pages"], stdout=devnull, stderr=devnull) os.chdir("..") From a5fb8a1a4f7fe5cbbe81d0ec1491a4de9b13b693 Mon Sep 17 00:00:00 2001 From: KoffeinFlummi Date: Fri, 8 May 2015 19:37:25 +0200 Subject: [PATCH 09/31] Restore missing line --- .../development/setting-up-the-development-environment.md | 1 + 1 file changed, 1 insertion(+) diff --git a/documentation/development/setting-up-the-development-environment.md b/documentation/development/setting-up-the-development-environment.md index 14d5e067c9..8a572c1ec6 100644 --- a/documentation/development/setting-up-the-development-environment.md +++ b/documentation/development/setting-up-the-development-environment.md @@ -14,6 +14,7 @@ This page describes how you can setup your development environment for ACE3, all - Arma 3 (duh) - A proper installation of the Arma 3 Tools (available on Steam) - A properly setup P-drive +- Run ArmA 3 and Arma 3 Tools directly from steam once to install registry entries (and again after every update) - Python 3.x, available [here](http://www.python.org) - The following Mikero Tools (available [here](https://dev.withsix.com/projects/mikero-pbodll/files)): DePBO, Rapify, MakePBO, PBOProject - A properly setup PATH variable (containing Python and the Mikero tools) From e674229dde4d49dd51d5e23e4fe637e365c6e52c Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 8 May 2015 20:10:40 +0200 Subject: [PATCH 10/31] enabledFor > enableFor --- addons/medical/XEH_postInit.sqf | 2 -- addons/medical/functions/fnc_hasMedicalEnabled.sqf | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 1bb0e744bc..f8129e5e78 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -2,8 +2,6 @@ #include "script_component.hpp" -GVAR(enabledFor) = 1; // TODO remove this once we implement settings. Just here to get the vitals working. - GVAR(heartBeatSounds_Fast) = ["ACE_heartbeat_fast_1", "ACE_heartbeat_fast_2", "ACE_heartbeat_fast_3"]; GVAR(heartBeatSounds_Normal) = ["ACE_heartbeat_norm_1", "ACE_heartbeat_norm_2"]; GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; diff --git a/addons/medical/functions/fnc_hasMedicalEnabled.sqf b/addons/medical/functions/fnc_hasMedicalEnabled.sqf index ee433c1715..fb5a45fe70 100644 --- a/addons/medical/functions/fnc_hasMedicalEnabled.sqf +++ b/addons/medical/functions/fnc_hasMedicalEnabled.sqf @@ -15,7 +15,7 @@ _unit = _this select 0; _medicalEnabled = _unit getvariable QGVAR(enableMedical); if (isnil "_medicalEnabled") exitwith { - (((GVAR(enabledFor) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enabledFor) == 1)); + (((GVAR(enableFor) == 0 && (isPlayer _unit || (_unit getvariable [QEGVAR(common,isDeadPlayer), false])))) || (GVAR(enableFor) == 1)); }; _medicalEnabled; From 7294056da0b2412c7c3443fef670cfe4f31d3481 Mon Sep 17 00:00:00 2001 From: commy2 Date: Fri, 8 May 2015 20:13:20 +0200 Subject: [PATCH 11/31] keep ai tweaks except of relaod --- addons/ai/CfgAISkill.hpp | 3 ++- addons/ai/config.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/ai/CfgAISkill.hpp b/addons/ai/CfgAISkill.hpp index dfa0299509..c01b5eb96e 100644 --- a/addons/ai/CfgAISkill.hpp +++ b/addons/ai/CfgAISkill.hpp @@ -21,7 +21,8 @@ class CfgAISkill { courage[] = {0,0, 1,0.7}; // {0,0,1,1}; endurance[] = {0,0, 1,0.7}; // {0,0,1,1}; general[] = {0,0, 1,0.9}; // {0,0,1,1}; - reloadSpeed[] = {0,0, 1,0.8}; // {0,0,1,1}; + // apparently breaks rapid firing in single fire mode for players + //reloadSpeed[] = {0,0, 1,0.8}; // {0,0,1,1}; spotDistance[] = {0,0, 1,0.9}; // {0,0.2,1,0.4}; spotTime[] = {0,0, 1,0.7}; // {0,0,1,0.7}; }; diff --git a/addons/ai/config.cpp b/addons/ai/config.cpp index 0d5f7c62c3..fdcb6afe9d 100644 --- a/addons/ai/config.cpp +++ b/addons/ai/config.cpp @@ -12,5 +12,5 @@ class CfgPatches { }; }; -//#include "CfgAISkill.hpp" +#include "CfgAISkill.hpp" #include "CfgWeapons.hpp" From b7b6cb60860ec724f56ecbfcd360c0c6e3623bad Mon Sep 17 00:00:00 2001 From: jaynus Date: Fri, 8 May 2015 11:27:17 -0700 Subject: [PATCH 12/31] Fixed: Adds an enabler config to ace_frag, disabling the PFH for any round not enabled. --- addons/frag/CfgAmmo.hpp | 30 +++++++++++++++++++++++++++++ addons/frag/functions/fnc_fired.sqf | 6 +++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/addons/frag/CfgAmmo.hpp b/addons/frag/CfgAmmo.hpp index ac20dabf5e..19414965b2 100644 --- a/addons/frag/CfgAmmo.hpp +++ b/addons/frag/CfgAmmo.hpp @@ -10,6 +10,8 @@ class CfgAmmo { //}; class Bo_GBU12_LGB; class ACE_GBU12 : Bo_GBU12_LGB { + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; GVAR(metal) = 140000; GVAR(charge) = 87000; @@ -23,6 +25,8 @@ class CfgAmmo { class GrenadeBase; class Grenade; class GrenadeHand: Grenade { + GVAR(enabled) = 1; + GVAR(skip) = 0; GVAR(force) = 1; // This is a good high-drag frag type for grenades. @@ -46,6 +50,8 @@ class CfgAmmo { class RocketBase; class R_Hydra_HE: RocketBase { // Source: http://fas.org/man/dod-101/sys/missile/hydra-70.htm + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; GVAR(metal) = 3850; GVAR(charge) = 1040; @@ -66,6 +72,8 @@ class CfgAmmo { class BombCore; class Bo_Mk82: BombCore { + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; GVAR(metal) = 140000; GVAR(charge) = 87000; @@ -75,6 +83,8 @@ class CfgAmmo { class G_40mm_HE: GrenadeBase { // Source: http://www.inetres.com/gp/military/infantry/grenade/40mm_ammo.html#M441 + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_tiny_HD"}; GVAR(metal) = 200; GVAR(charge) = 32; @@ -83,6 +93,8 @@ class CfgAmmo { }; class G_40mm_HEDP: G_40mm_HE { // Source: http://www.inetres.com/gp/military/infantry/grenade/40mm_ammo.html#M433 + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_tiny_HD"}; GVAR(metal) = 200; GVAR(charge) = 45; @@ -107,6 +119,8 @@ class CfgAmmo { class Sh_125mm_HEAT; class Sh_155mm_AMOS: ShellBase { // Source: http://www.globalsecurity.org/military/systems/munitions/m795.htm + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; GVAR(metal) = 36000; GVAR(charge) = 9979; @@ -115,6 +129,8 @@ class CfgAmmo { }; class Sh_82mm_AMOS : Sh_155mm_AMOS { // Source: http://www.arsenal-bg.com/defense_police/mortar_bombs_82mm.htm + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; GVAR(metal) = 3200; GVAR(charge) = 420; @@ -122,6 +138,8 @@ class CfgAmmo { GVAR(gurney_k) = 1/2; }; class ModuleOrdnanceMortar_F_Ammo: Sh_82mm_AMOS { + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; GVAR(metal) = 800; GVAR(charge) = 4200; @@ -129,6 +147,8 @@ class CfgAmmo { GVAR(gurney_k) = 1/2; }; class Sh_105mm_HEAT_MP : Sh_125mm_HEAT { + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; GVAR(metal) = 11400; GVAR(charge) = 7100; @@ -136,6 +156,8 @@ class CfgAmmo { GVAR(gurney_k) = 1/2; }; class Sh_120mm_HE : ShellBase { + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; GVAR(metal) = 23000; GVAR(charge) = 3148; @@ -143,6 +165,8 @@ class CfgAmmo { GVAR(gurney_k) = 1/2; }; class Sh_125mm_HE: Sh_120mm_HE { + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; GVAR(metal) = 16000; GVAR(charge) = 3200; @@ -150,6 +174,8 @@ class CfgAmmo { GVAR(gurney_k) = 1/2; }; class ModuleOrdnanceHowitzer_F_ammo: Sh_155mm_AMOS { + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_large", "ACE_frag_large", "ACE_frag_large_HD", "ACE_frag_large", "ACE_frag_huge", "ACE_frag_huge_HD", "ACE_frag_huge"}; GVAR(metal) = 1950; GVAR(charge) = 15800; @@ -175,6 +201,8 @@ class CfgAmmo { class MissileBase; class Missile_AGM_02_F : MissileBase { // Source: http://fas.org/man/dod-101/sys/smart/agm-65.htm + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; GVAR(metal) = 56250; GVAR(charge) = 39000; @@ -183,6 +211,8 @@ class CfgAmmo { }; class M_Hellfire_AT: MissileBase { // Source: http://www.designation-systems.net/dusrm/m-114.html + GVAR(enabled) = 1; + GVAR(classes)[] = {"ACE_frag_medium", "ACE_frag_medium_HD"}; GVAR(metal) = 8000; GVAR(charge) = 2400; diff --git a/addons/frag/functions/fnc_fired.sqf b/addons/frag/functions/fnc_fired.sqf index 7ed717c2b8..9b89e40897 100644 --- a/addons/frag/functions/fnc_fired.sqf +++ b/addons/frag/functions/fnc_fired.sqf @@ -1,6 +1,6 @@ #include "script_component.hpp" -private ["_gun", "_type", "_round", "_doFragTrack", "_doSpall", "_spallTrack", "_spallTrackID"]; +private ["_enabled", "_gun", "_type", "_round", "_doFragTrack", "_doSpall", "_spallTrack", "_spallTrackID"]; if (!GVAR(enabled)) exitWith {}; @@ -8,10 +8,14 @@ _gun = _this select 0; _type = _this select 4; _round = _this select 6; +_enabled = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(enabled)); +if(_enabled < 1) exitWith {}; + if(_round in GVAR(blackList)) exitWith { GVAR(blackList) = GVAR(blackList) - [_round]; }; + _doFragTrack = false; if(_gun == ACE_player) then { _doFragTrack = true; From a4c710bd28c5822912f46088e0bd92ce9620408d Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 8 May 2015 13:36:24 -0500 Subject: [PATCH 13/31] Switch scopes to use firedBIS --- addons/scopes/CfgEventHandlers.hpp | 4 ++-- addons/scopes/functions/fnc_firedEH.sqf | 27 ++++++++++++++----------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/addons/scopes/CfgEventHandlers.hpp b/addons/scopes/CfgEventHandlers.hpp index b3d70a2861..5c23e0c462 100644 --- a/addons/scopes/CfgEventHandlers.hpp +++ b/addons/scopes/CfgEventHandlers.hpp @@ -10,10 +10,10 @@ class Extended_PostInit_EventHandlers { }; }; -class Extended_Fired_EventHandlers { +class Extended_FiredBIS_EventHandlers { class CAManBase { class ADDON { - fired = QUOTE(_this call FUNC(firedEH);); + firedBIS = QUOTE(_this call FUNC(firedEH);); }; }; }; diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index 8753019931..1b692e340a 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -3,12 +3,13 @@ * Adjusts the flight path of the bullet according to the zeroing * * Argument: - * 0: Unit - * 1: Weapon - * 3: Muzzle - * 4: Magazine - * 5: Ammo - * 6: Projectile + * 0: unit - Object the event handler is assigned to + * 1: weapon - Fired weapon + * 2: muzzle - Muzzle that was used + * 3: mode - Current mode of the fired weapon + * 4: ammo - Ammo used + * 5: magazine - magazine name which was used + * 6: projectile - Object of the projectile that was shot * * Return value: * None @@ -20,23 +21,25 @@ private ["_unit", "_adjustment", "_weapon", "_projectile", "_weaponIndex", "_zeroing", "_adjustment"]; _unit = _this select 0; +_weapon = _this select 1; +_projectile = _this select 6; // Exit if the unit doesn't have any adjusment variable -_adjustment = _unit getVariable QGVAR(Adjustment); -if (isNil "_adjustment") exitWith {}; +_adjustment = _unit getVariable [QGVAR(Adjustment), []]; +if (_adjustment isEqualTo []) exitWith {}; // Exit if the unit isn't a player if !([_unit] call EFUNC(common,isPlayer)) exitWith {}; -_weapon = _this select 1; -_projectile = _this select 5; - _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); if (_weaponIndex < 0) exitWith {}; _zeroing = _adjustment select _weaponIndex; +//Exit if adjusment is zero: +if (_zeroing isEqualTo [0,0,0]) exitWith {}; + // Convert zeroing from mils to degrees -_zeroing = [_zeroing, {_this * 0.05625}] call EFUNC(common,map); +_zeroing = _zeroing vectorMultiply 0.05625; [_projectile, (_zeroing select 1), (_zeroing select 0) + (_zeroing select 2), 0] call EFUNC(common,changeProjectileDirection); From 53360ff0a736dc5f3de4c4885af42476d2bae4b3 Mon Sep 17 00:00:00 2001 From: KoffeinFlummi Date: Fri, 8 May 2015 20:40:40 +0200 Subject: [PATCH 14/31] Add some more descriptive output to deploy.py --- tools/deploy.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/deploy.py b/tools/deploy.py index 501987810a..b9fade83a0 100755 --- a/tools/deploy.py +++ b/tools/deploy.py @@ -62,7 +62,10 @@ def deploy_documentation(token): filenum = len(str(filenum, "utf-8").split("\n")) - 1 if filenum > 0: sp.check_call(["git", "commit", "-m", "Automatic gh-pages deployment"]) + print("Pushing changes ...") sp.check_call(["git", "push", "origin", "gh-pages"], stdout=devnull, stderr=devnull) + else: + print("No changes.") os.chdir("..") From b57f731dd06facd0531685ac3d753e66252badd6 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 9 May 2015 04:59:10 +0200 Subject: [PATCH 15/31] disable laserpointer inheritance for rhs --- .../laserpointer/functions/fnc_switchLaserLightMode.sqf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/laserpointer/functions/fnc_switchLaserLightMode.sqf b/addons/laserpointer/functions/fnc_switchLaserLightMode.sqf index f996d6b270..423090796f 100644 --- a/addons/laserpointer/functions/fnc_switchLaserLightMode.sqf +++ b/addons/laserpointer/functions/fnc_switchLaserLightMode.sqf @@ -29,11 +29,17 @@ _pointer = switch (_weapon) do { if (_pointer == "") exitWith {}; +private "_config"; +_config = configFile >> "CfgWeapons" >> _pointer; + private "_nextPointer"; -_nextPointer = getText (configFile >> "CfgWeapons" >> _pointer >> "ACE_nextModeClass"); +_nextPointer = getText (_config >> "ACE_nextModeClass"); if (_nextPointer == "") exitWith {}; +// disable inheritance for this entry, because addons claim this as a base class for convenience +if !((_config >> "ACE_nextModeClass") in configProperties [_config, "true", false]) exitWith {}; + private ["_description", "_picture"]; _description = getText (configFile >> "CfgWeapons" >> _nextPointer >> "ACE_modeDescription"); From ddf32052c4cd9f1a8460048c607cf47d96369487 Mon Sep 17 00:00:00 2001 From: bux578 Date: Sat, 9 May 2015 08:02:13 +0200 Subject: [PATCH 16/31] fix removeWhiteSpace function name used `string_removeWhiteSpace` but had to be `stringRemoveWhiteSpace` due to 612fa69c1c4cf7ed8b81c5086dc90877d0eda400 --- .../functions/fnc_moduleAmbianceSound.sqf | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf index c02d19aa5f..6e5643754c 100644 --- a/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf +++ b/addons/missionmodules/functions/fnc_moduleAmbianceSound.sqf @@ -26,39 +26,39 @@ _activated = [_this,2,true,[true]] call BIS_fnc_param; // We only play this on the locality of the logic, since the sounds are broadcasted across the network if (_activated && local _logic) then { _ambianceSounds = []; - _unparsedSounds = _logic getvariable ["soundFiles", ""]; - _minimalDistance = (_logic getvariable ["minimalDistance", 400]) max 1; - _maximalDistance = (_logic getvariable ["maximalDistance", 10]) max _minimalDistance; - _minDelayBetweensounds = (_logic getvariable ["minimalDelay", 10]) max 1; - _maxDelayBetweenSounds = (_logic getvariable ["maximalDelay", 170]) max _minDelayBetweensounds; - _volume = (_logic getvariable ["soundVolume", 30]) max 1; - _followPlayers = _logic getvariable ["followPlayers", false]; + _unparsedSounds = _logic getVariable ["soundFiles", ""]; + _minimalDistance = (_logic getVariable ["minimalDistance", 400]) max 1; + _maximalDistance = (_logic getVariable ["maximalDistance", 10]) max _minimalDistance; + _minDelayBetweensounds = (_logic getVariable ["minimalDelay", 10]) max 1; + _maxDelayBetweenSounds = (_logic getVariable ["maximalDelay", 170]) max _minDelayBetweensounds; + _volume = (_logic getVariable ["soundVolume", 30]) max 1; + _followPlayers = _logic getVariable ["followPlayers", false]; _splittedList = [_unparsedSounds, ","] call BIS_fnc_splitString; _nilCheckPassedList = ""; { - _x = [_x] call EFUNC(common,string_removeWhiteSpace); - _splittedList set [_foreachIndex, _x]; - }foreach _splittedList; + _x = [_x] call EFUNC(common,stringRemoveWhiteSpace); + _splittedList set [_forEachIndex, _x]; + }forEach _splittedList; _soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; { - if (isclass (missionConfigFile >> "CfgSounds" >> _x)) then { - _ambianceSounds pushback (_soundPath + (getArray(missionConfigFile >> "CfgSounds" >> _x >> "sound") select 0)); + if (isClass (missionConfigFile >> "CfgSounds" >> _x)) then { + _ambianceSounds pushBack (_soundPath + (getArray(missionConfigFile >> "CfgSounds" >> _x >> "sound") select 0)); } else { - if (isclass (configFile >> "CfgSounds" >> _x)) then { - _ambianceSounds pushback ((getArray(configFile >> "CfgSounds" >> _x >> "sound") select 0)); + if (isClass (configFile >> "CfgSounds" >> _x)) then { + _ambianceSounds pushBack ((getArray(configFile >> "CfgSounds" >> _x >> "sound") select 0)); }; }; - }foreach _splittedList; + }forEach _splittedList; - if (count _ambianceSounds == 0) exitwith {}; + if (count _ambianceSounds == 0) exitWith {}; { if !([".", _x, true] call BIS_fnc_inString) then { - _ambianceSounds set [_foreachIndex, _x + ".wss"]; + _ambianceSounds set [_forEachIndex, _x + ".wss"]; }; - }foreach _ambianceSounds; + }forEach _ambianceSounds; [{ private ["_args", "_logic", "_ambianceSounds", "_minimalDistance", "_maximalDistance", "_minDelayBetweensounds", "_maxDelayBetweenSounds", "_volume", "_followPlayers","_lastTimePlayed", "_newPos"]; @@ -68,7 +68,7 @@ if (_activated && local _logic) then { _maxDelayBetweenSounds = _args select 5; _lastTimePlayed = _args select 8; - if (!alive _logic) exitwith { + if (!alive _logic) exitWith { [(_this select 1)] call cba_fnc_removePerFrameHandler; }; From 57131496f2b25f0ad98be39ee0a26c3325c596ea Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 9 May 2015 13:25:19 +0200 Subject: [PATCH 17/31] check for outdated pbo files --- addons/common/XEH_postInit.sqf | 12 +---- addons/common/XEH_preInit.sqf | 1 + addons/common/functions/fnc_checkFiles.sqf | 59 ++++++++++++++++++++++ 3 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 addons/common/functions/fnc_checkFiles.sqf diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 53de6b5d69..1c9155b3a2 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -84,6 +84,7 @@ if(!isServer) then { ["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler); [FUNC(syncedEventPFH), 0.5, []] call cba_fnc_addPerFrameHandler; +call FUNC(checkFiles); /***************************************************************/ /***************************************************************/ @@ -250,14 +251,3 @@ if(isMultiplayer && { time > 0 || isNull player } ) then { }; }, 0, []] call cba_fnc_addPerFrameHandler; }; - -// check dlls -{ - if (_x callExtension "version" == "") then { - private "_errorMsg"; - _errorMsg = format ["Extension %1.dll not installed.", _x]; - - diag_log text format ["[ACE] ERROR: %1", _errorMsg]; - ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); - }; -} forEach getArray (configFile >> "ACE_Extensions" >> "extensions"); diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 54a5118cb0..5c2ad1e592 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -21,6 +21,7 @@ PREP(canInteract); PREP(canInteractWith); PREP(canUseWeapon); PREP(changeProjectileDirection); +PREP(checkFiles); PREP(checkPBOs); PREP(claim); PREP(closeDialogIfTargetMoves); diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf new file mode 100644 index 0000000000..868882151d --- /dev/null +++ b/addons/common/functions/fnc_checkFiles.sqf @@ -0,0 +1,59 @@ +/* + * Author: commy2 + * + * Compares version numbers of PBOs and DLLs. + * + * Argument: + * 0: Mode (Number) + * + * Return value: + * None. + */ +#include "script_component.hpp" + +/////////////// +// check addons +/////////////// +private "_version"; +_version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr"); + +diag_log text format ["[ACE]: ACE is version %1", _version]; /////////////////////////////////////////////////////////////////////////// + +private ["_addons", "_index"]; + +_addons = activatedAddons; + +// speed up search. all ace pbos are loaded after ace_main. +_index = _addons find "ace_main"; +reverse _addons; +_addons resize (count _addons - _index); +_addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter); + +{ + if (getText (configFile >> "CfgPatches" >> _x >> "versionStr") != _version) then { + private "_errorMsg"; + _errorMsg = format ["File %1.pbo is outdated.", _x]; + + diag_log text format ["[ACE] ERROR: %1", _errorMsg]; + + if (hasInterface) then { + ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); + }; + }; +} forEach _addons; + +/////////////// +// check dlls +/////////////// +{ + if (_x callExtension "version" == "") then { + private "_errorMsg"; + _errorMsg = format ["Extension %1.dll not installed.", _x]; + + diag_log text format ["[ACE] ERROR: %1", _errorMsg]; + + if (hasInterface) then { + ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); + }; + }; +} forEach getArray (configFile >> "ACE_Extensions" >> "extensions"); From 7d28fbcdbd2c4937e8fe7c8b646d44b2a24401fc Mon Sep 17 00:00:00 2001 From: bux578 Date: Sat, 9 May 2015 14:12:54 +0200 Subject: [PATCH 18/31] force travis to only build for master --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 65990248bf..388b1f114f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,6 @@ +branches: + only: + - master language: python python: - "3.4" From 4f6d0599e0316e345a70a5427bab0edeb421fa57 Mon Sep 17 00:00:00 2001 From: bux578 Date: Sat, 9 May 2015 14:30:10 +0200 Subject: [PATCH 19/31] travis build test --- .../development/setting-up-the-development-environment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/development/setting-up-the-development-environment.md b/documentation/development/setting-up-the-development-environment.md index 8a572c1ec6..2a88e185bf 100644 --- a/documentation/development/setting-up-the-development-environment.md +++ b/documentation/development/setting-up-the-development-environment.md @@ -11,7 +11,7 @@ This page describes how you can setup your development environment for ACE3, all ## 1. Requirements -- Arma 3 (duh) +- Arma 3 - A proper installation of the Arma 3 Tools (available on Steam) - A properly setup P-drive - Run ArmA 3 and Arma 3 Tools directly from steam once to install registry entries (and again after every update) From f848ff740fa9abf5080ff1f123644753489927d3 Mon Sep 17 00:00:00 2001 From: bux578 Date: Sat, 9 May 2015 15:05:55 +0200 Subject: [PATCH 20/31] Revert "travis build test" This reverts commit 4f6d0599e0316e345a70a5427bab0edeb421fa57. --- .../development/setting-up-the-development-environment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/development/setting-up-the-development-environment.md b/documentation/development/setting-up-the-development-environment.md index 2a88e185bf..8a572c1ec6 100644 --- a/documentation/development/setting-up-the-development-environment.md +++ b/documentation/development/setting-up-the-development-environment.md @@ -11,7 +11,7 @@ This page describes how you can setup your development environment for ACE3, all ## 1. Requirements -- Arma 3 +- Arma 3 (duh) - A proper installation of the Arma 3 Tools (available on Steam) - A properly setup P-drive - Run ArmA 3 and Arma 3 Tools directly from steam once to install registry entries (and again after every update) From 52a904478be97ceda7377003aedfc6c95a1870a0 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 9 May 2015 15:32:34 +0200 Subject: [PATCH 21/31] laser selfdesignate has wrong version number macro setup --- addons/laser_selfdesignate/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/laser_selfdesignate/config.cpp b/addons/laser_selfdesignate/config.cpp index 19ec28063b..597500caf6 100644 --- a/addons/laser_selfdesignate/config.cpp +++ b/addons/laser_selfdesignate/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_laser"}; - version = VERSION; + VERSION_CONFIG; }; }; From f0cca5b33ea1b341bedd5f06c1d59f0526c2f88c Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 9 May 2015 16:01:53 +0200 Subject: [PATCH 22/31] ignore ace in checkPBO module, also fix #1020 --- addons/common/XEH_postInit.sqf | 2 - addons/common/functions/fnc_checkFiles.sqf | 2 +- .../common/functions/fnc_moduleCheckPBOs.sqf | 108 ++++---- .../scripts/Version/checkVersionNumber.sqf | 261 ++++++++---------- 4 files changed, 169 insertions(+), 204 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 1c9155b3a2..696aa16f9b 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -64,8 +64,6 @@ if (_currentVersion != _previousVersion) then { profileNamespace setVariable ["ACE_VersionNumberString", _currentVersion]; }; -0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber); - // ACE events "ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); }; "ACEc" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); }; diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf index 868882151d..35cb552a8a 100644 --- a/addons/common/functions/fnc_checkFiles.sqf +++ b/addons/common/functions/fnc_checkFiles.sqf @@ -17,7 +17,7 @@ private "_version"; _version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr"); -diag_log text format ["[ACE]: ACE is version %1", _version]; /////////////////////////////////////////////////////////////////////////// +diag_log text format ["[ACE]: ACE is version %1", _version]; private ["_addons", "_index"]; diff --git a/addons/common/functions/fnc_moduleCheckPBOs.sqf b/addons/common/functions/fnc_moduleCheckPBOs.sqf index 4b5ea2374a..5f06f6d60e 100644 --- a/addons/common/functions/fnc_moduleCheckPBOs.sqf +++ b/addons/common/functions/fnc_moduleCheckPBOs.sqf @@ -22,7 +22,7 @@ _checkAll = _logic getVariable ["CheckAll", false]; _whitelist = call compile (_logic getVariable ["Whitelist", "[]"]); if (isNil "_whitelist") then { - _whitelist = []; + _whitelist = []; }; _whitelist = [_whitelist, {toLower _this}] call FUNC(map); @@ -31,67 +31,71 @@ ACE_Version_CheckAll = _checkAll; ACE_Version_Whitelist = _whitelist; if (!isServer) then { - [_mode, _checkAll, _whitelist] spawn { - _mode = _this select 0; - _checkAll = _this select 1; - _whitelist = _this select 2; + [_mode, _checkAll, _whitelist] spawn { + _mode = _this select 0; + _checkAll = _this select 1; + _whitelist = _this select 2; - waitUntil { - sleep 1; - !isNil "ACE_Version_ClientErrors" - }; + waitUntil { + sleep 1; + !isNil "ACE_Version_ClientErrors" + }; - _missingAddon = ACE_Version_ClientErrors select 0; - _missingAddonServer = ACE_Version_ClientErrors select 1; - _oldVersionClient = ACE_Version_ClientErrors select 2; - _oldVersionServer = ACE_Version_ClientErrors select 3; + _missingAddon = ACE_Version_ClientErrors select 0; + _missingAddonServer = ACE_Version_ClientErrors select 1; + _oldVersionClient = ACE_Version_ClientErrors select 2; + _oldVersionServer = ACE_Version_ClientErrors select 3; - // Display error message. - if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then { - _text = "[ACE] Version mismatch:

"; - _error = format ["ACE version mismatch: %1: ", profileName]; + // Display error message. + if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then { + _text = "[ACE] Version mismatch:

"; + _error = format ["ACE version mismatch: %1: ", profileName]; - if (_missingAddon) then { - _text = _text + "Detected missing addon on client
"; - _error = _error + "Missing file(s); "; - }; - if (_missingAddonServer) then { - _text = _text + "Detected missing addon on server
"; - _error = _error + "Additional file(s); "; - }; - if (_oldVersionClient) then { - _text = _text + "Detected old client version
"; - _error = _error + "Older version; "; - }; - if (_oldVersionServer) then { - _text = _text + "Detected old server version
"; - _error = _error + "Newer version; "; - }; + if (_missingAddon) then { + _text = _text + "Detected missing addon on client
"; + _error = _error + "Missing file(s); "; + }; + if (_missingAddonServer) then { + _text = _text + "Detected missing addon on server
"; + _error = _error + "Additional file(s); "; + }; + if (_oldVersionClient) then { + _text = _text + "Detected old client version
"; + _error = _error + "Older version; "; + }; + if (_oldVersionServer) then { + _text = _text + "Detected old server version
"; + _error = _error + "Newer version; "; + }; - //[_error, "{systemChat _this}"] call FUNC(execRemoteFnc); - diag_log text _error; + //[_error, "{systemChat _this}"] call FUNC(execRemoteFnc); + diag_log text _error; - _text = composeText [lineBreak, parseText format ["%1", _text]]; + _text = composeText [lineBreak, parseText format ["%1", _text]]; - _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer; - _rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true]; + _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer; + _rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true]; - disableSerialization; - _ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint"; - _ctrlHint ctrlSetStructuredText _text; + disableSerialization; + _ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint"; + _ctrlHint ctrlSetStructuredText _text; - if (_mode == 0) then { - sleep 10; - _rscLayer cutFadeOut 0.2; - }; + if (_mode == 0) then { + sleep 10; + _rscLayer cutFadeOut 0.2; + }; - if (_mode == 2) then { - sleep 10; - waitUntil {alive player}; - [player] call FUNC(adminKick); - }; - }; - }; + if (_mode == 2) then { + sleep 10; + waitUntil {alive player}; + [player] call FUNC(adminKick); + }; + }; + }; }; diag_log text format ["[ACE]: Check-PBOs Module Initialized. Mode: %1.", _mode]; + +if (_checkAll) then { + 0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber); +}; diff --git a/addons/common/scripts/Version/checkVersionNumber.sqf b/addons/common/scripts/Version/checkVersionNumber.sqf index e6509cd9c4..1bc002153c 100644 --- a/addons/common/scripts/Version/checkVersionNumber.sqf +++ b/addons/common/scripts/Version/checkVersionNumber.sqf @@ -1,193 +1,156 @@ // by commy2 #include "script_component.hpp" -sleep 1; //wait for module - _files = []; -if (missionNamespace getVariable ["ACE_Version_CheckAll", false]) then { - { - if (toLower _x find "a3_" != 0 && {!(toLower _x in (missionNamespace getVariable ["ACE_Version_Whitelist", []]))}) then { - _files pushBack _x; +{ + if (_x find "a3_" != 0 && {_x find "ace_" != 0} && {!(toLower _x in (missionNamespace getVariable ["ACE_Version_Whitelist", []]))}) then { + _files pushBack _x; }; - } forEach activatedAddons; -} else { - { - if (toLower _x find "ace_" == 0) then { - _files pushBack _x; - }; - } forEach activatedAddons; -}; - -_versionMain = parseNumber getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version"); +} forEach activatedAddons; _versions = []; { - _version = parseNumber getText (configFile >> "CfgPatches" >> _x >> "version"); - _versions set [_forEachIndex, _version]; + _version = parseNumber getText (configFile >> "CfgPatches" >> _x >> "version"); + _versions set [_forEachIndex, _version]; } forEach _files; -_versionFull = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "versionStr"); -diag_log text format ["[ACE] Full Version Number: %1", _versionFull]; - if (isServer) then { - diag_log text format ["[ACE] Server: ACE_Common is Version %1.", _versionMain]; - - { - if (toLower _x find "ace_" == 0) then {// - _version = _versions select _forEachIndex; - if (_version != _versionMain) then { - diag_log text format ["[ACE] Server: %1 is Version %2.", _x, _version]; - }; - }; - } forEach _files; - - ACE_Version_ServerVersions = [_files, _versions]; - publicVariable "ACE_Version_ServerVersions"; + ACE_Version_ServerVersions = [_files, _versions]; + publicVariable "ACE_Version_ServerVersions"; } else { - diag_log text format ["[ACE] Client: ACE_Common is Version %1.", _versionMain]; - - { - if (toLower _x find "ace_" == 0) then {// - _version = _versions select _forEachIndex; - if (_version != _versionMain) then { - diag_log text format ["[ACE] Client: %1 is Version %2.", _x, _version]; - }; - }; - } forEach _files; - - ACE_Version_ClientVersions = [_files, _versions]; + ACE_Version_ClientVersions = [_files, _versions]; }; // Begin client version check if (!isServer) then { - // Wait for server to send the servers files and version numbers - waitUntil { - sleep 1; - !isNil "ACE_Version_ClientVersions" && {!isNil "ACE_Version_ServerVersions"} - }; - - _client = profileName; - - _files = ACE_Version_ClientVersions select 0; - _versions = ACE_Version_ClientVersions select 1; - - _serverFiles = ACE_Version_ServerVersions select 0; - _serverVersions = ACE_Version_ServerVersions select 1; - - // Compare client and server files and versions - _missingAddons = []; - _oldVersionsClient = []; - _oldVersionsServer = []; - { - _serverVersion = _serverVersions select _forEachIndex; - - _index = _files find _x; - if (_index == -1) then { - if (_x != "ace_serverconfig") then {_missingAddons pushBack _x;}; - } else { - - _clientVersion = _versions select _index; - - if (_clientVersion < _serverVersion) then { - _oldVersionsClient pushBack [_x, _clientVersion, _serverVersion]; - }; - - if (_clientVersion > _serverVersion) then { - _oldVersionsServer pushBack [_x, _clientVersion, _serverVersion]; - }; + // Wait for server to send the servers files and version numbers + waitUntil { + sleep 1; + !isNil "ACE_Version_ClientVersions" && {!isNil "ACE_Version_ServerVersions"} }; - } forEach _serverFiles; - // find client files which the server doesn't have - _missingAddonsServer = []; - { - _index = _serverFiles find _x; - if (_index == -1) then { - _missingAddonsServer pushBack _x; - } - } forEach _files; + _client = profileName; - // display and log error messages - _fnc_cutComma = { - _string = _this; - _string = toArray _string; + _files = ACE_Version_ClientVersions select 0; + _versions = ACE_Version_ClientVersions select 1; - _count = count _string; - _string set [_count - 2, toArray "." select 0]; - _string set [_count - 1, -1]; - _string = _string - [-1]; + _serverFiles = ACE_Version_ServerVersions select 0; + _serverVersions = ACE_Version_ServerVersions select 1; - toString _string; - }; - - _missingAddon = false; - if (count _missingAddons > 0) then { - _missingAddon = true; - - _error = format ["[ACE] %1: ERROR missing addon(s): ", _client]; + // Compare client and server files and versions + _missingAddons = []; + _oldVersionsClient = []; + _oldVersionsServer = []; { - _error = _error + format ["%1, ", _x]; + _serverVersion = _serverVersions select _forEachIndex; - if (_forEachIndex > 9) exitWith {};// - } forEach _missingAddons; + _index = _files find _x; + if (_index == -1) then { + if (_x != "ace_serverconfig") then {_missingAddons pushBack _x;}; + } else { - _error = _error call _fnc_cutComma; + _clientVersion = _versions select _index; - diag_log text _error; - [_error, "{systemChat _this}"] call FUNC(execRemoteFnc); - }; + if (_clientVersion < _serverVersion) then { + _oldVersionsClient pushBack [_x, _clientVersion, _serverVersion]; + }; - _missingAddonServer = false; - if (count _missingAddonsServer > 0) then { - _missingAddonServer = true; + if (_clientVersion > _serverVersion) then { + _oldVersionsServer pushBack [_x, _clientVersion, _serverVersion]; + }; + }; + } forEach _serverFiles; - _error = format ["[ACE] %1: ERROR missing server addon(s): ", _client]; + // find client files which the server doesn't have + _missingAddonsServer = []; { - _error = _error + format ["%1, ", _x]; + _index = _serverFiles find _x; + if (_index == -1) then { + _missingAddonsServer pushBack _x; + } + } forEach _files; - if (_forEachIndex > 9) exitWith {};// - } forEach _missingAddonsServer; + // display and log error messages + _fnc_cutComma = { + _string = _this; + _string = toArray _string; - _error = _error call _fnc_cutComma; + _count = count _string; + _string set [_count - 2, toArray "." select 0]; + _string set [_count - 1, -1]; + _string = _string - [-1]; - diag_log text _error; - [_error, "{systemChat _this}"] call FUNC(execRemoteFnc); - }; + toString _string; + }; - _oldVersionClient = false; - if (count _oldVersionsClient > 0) then { - _oldVersionClient = true; + _missingAddon = false; + if (count _missingAddons > 0) then { + _missingAddon = true; - _error = format ["[ACE] %1: ERROR outdated addon(s): ", _client]; - { - _error = _error + format ["%1 (client: %2, server: %3), ", _x select 0, _x select 1, _x select 2]; + _error = format ["[ACE] %1: ERROR missing addon(s): ", _client]; + { + _error = _error + format ["%1, ", _x]; - if (_forEachIndex > 9) exitWith {};// - } forEach _oldVersionsClient; + if (_forEachIndex > 9) exitWith {};// + } forEach _missingAddons; - _error = _error call _fnc_cutComma; + _error = _error call _fnc_cutComma; - diag_log text _error; - [_error, "{systemChat _this}"] call FUNC(execRemoteFnc); - }; + diag_log text _error; + [_error, "{systemChat _this}"] call FUNC(execRemoteFnc); + }; - _oldVersionServer = false; - if (count _oldVersionsServer > 0) then { - _oldVersionServer = true; + _missingAddonServer = false; + if (count _missingAddonsServer > 0) then { + _missingAddonServer = true; - _error = format ["[ACE] %1: ERROR outdated server addon(s): ", _client]; - { - _error = _error + format ["%1 (client: %2, server: %3), ", _x select 0, _x select 1, _x select 2]; + _error = format ["[ACE] %1: ERROR missing server addon(s): ", _client]; + { + _error = _error + format ["%1, ", _x]; - if (_forEachIndex > 9) exitWith {};// - } forEach _oldVersionsServer; + if (_forEachIndex > 9) exitWith {};// + } forEach _missingAddonsServer; - _error = _error call _fnc_cutComma; + _error = _error call _fnc_cutComma; - diag_log text _error; - [_error, "{systemChat _this}"] call FUNC(execRemoteFnc); - }; + diag_log text _error; + [_error, "{systemChat _this}"] call FUNC(execRemoteFnc); + }; - ACE_Version_ClientErrors = [_missingAddon, _missingAddonServer, _oldVersionClient, _oldVersionServer]; + _oldVersionClient = false; + if (count _oldVersionsClient > 0) then { + _oldVersionClient = true; + + _error = format ["[ACE] %1: ERROR outdated addon(s): ", _client]; + { + _error = _error + format ["%1 (client: %2, server: %3), ", _x select 0, _x select 1, _x select 2]; + + if (_forEachIndex > 9) exitWith {};// + } forEach _oldVersionsClient; + + _error = _error call _fnc_cutComma; + + diag_log text _error; + [_error, "{systemChat _this}"] call FUNC(execRemoteFnc); + }; + + _oldVersionServer = false; + if (count _oldVersionsServer > 0) then { + _oldVersionServer = true; + + _error = format ["[ACE] %1: ERROR outdated server addon(s): ", _client]; + { + _error = _error + format ["%1 (client: %2, server: %3), ", _x select 0, _x select 1, _x select 2]; + + if (_forEachIndex > 9) exitWith {};// + } forEach _oldVersionsServer; + + _error = _error call _fnc_cutComma; + + diag_log text _error; + [_error, "{systemChat _this}"] call FUNC(execRemoteFnc); + }; + + ACE_Version_ClientErrors = [_missingAddon, _missingAddonServer, _oldVersionClient, _oldVersionServer]; }; From 3976c4d64ff7e723b7daf55f332282ebd3697ca4 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 9 May 2015 16:06:44 +0200 Subject: [PATCH 23/31] the spaces --- addons/common/functions/fnc_checkPBOs.sqf | 4 +- .../common/functions/fnc_moduleCheckPBOs.sqf | 104 +++++++++--------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/addons/common/functions/fnc_checkPBOs.sqf b/addons/common/functions/fnc_checkPBOs.sqf index 7c4aaeba13..2b738e2f1a 100644 --- a/addons/common/functions/fnc_checkPBOs.sqf +++ b/addons/common/functions/fnc_checkPBOs.sqf @@ -25,11 +25,11 @@ _checkAll = _this select 1; _whitelist = _this select 2; if (isNil "_checkAll") then { - _checkAll = false; + _checkAll = false; }; if (isNil "_whitelist") then { - _whitelist = "[]"; + _whitelist = "[]"; }; _logic = "Logic" createVehicleLocal [0,0,0]; diff --git a/addons/common/functions/fnc_moduleCheckPBOs.sqf b/addons/common/functions/fnc_moduleCheckPBOs.sqf index 5f06f6d60e..7137f1ea1d 100644 --- a/addons/common/functions/fnc_moduleCheckPBOs.sqf +++ b/addons/common/functions/fnc_moduleCheckPBOs.sqf @@ -22,7 +22,7 @@ _checkAll = _logic getVariable ["CheckAll", false]; _whitelist = call compile (_logic getVariable ["Whitelist", "[]"]); if (isNil "_whitelist") then { - _whitelist = []; + _whitelist = []; }; _whitelist = [_whitelist, {toLower _this}] call FUNC(map); @@ -31,67 +31,67 @@ ACE_Version_CheckAll = _checkAll; ACE_Version_Whitelist = _whitelist; if (!isServer) then { - [_mode, _checkAll, _whitelist] spawn { - _mode = _this select 0; - _checkAll = _this select 1; - _whitelist = _this select 2; + [_mode, _checkAll, _whitelist] spawn { + _mode = _this select 0; + _checkAll = _this select 1; + _whitelist = _this select 2; - waitUntil { - sleep 1; - !isNil "ACE_Version_ClientErrors" - }; + waitUntil { + sleep 1; + !isNil "ACE_Version_ClientErrors" + }; - _missingAddon = ACE_Version_ClientErrors select 0; - _missingAddonServer = ACE_Version_ClientErrors select 1; - _oldVersionClient = ACE_Version_ClientErrors select 2; - _oldVersionServer = ACE_Version_ClientErrors select 3; + _missingAddon = ACE_Version_ClientErrors select 0; + _missingAddonServer = ACE_Version_ClientErrors select 1; + _oldVersionClient = ACE_Version_ClientErrors select 2; + _oldVersionServer = ACE_Version_ClientErrors select 3; - // Display error message. - if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then { - _text = "[ACE] Version mismatch:

"; - _error = format ["ACE version mismatch: %1: ", profileName]; + // Display error message. + if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then { + _text = "[ACE] Version mismatch:

"; + _error = format ["ACE version mismatch: %1: ", profileName]; - if (_missingAddon) then { - _text = _text + "Detected missing addon on client
"; - _error = _error + "Missing file(s); "; - }; - if (_missingAddonServer) then { - _text = _text + "Detected missing addon on server
"; - _error = _error + "Additional file(s); "; - }; - if (_oldVersionClient) then { - _text = _text + "Detected old client version
"; - _error = _error + "Older version; "; - }; - if (_oldVersionServer) then { - _text = _text + "Detected old server version
"; - _error = _error + "Newer version; "; - }; + if (_missingAddon) then { + _text = _text + "Detected missing addon on client
"; + _error = _error + "Missing file(s); "; + }; + if (_missingAddonServer) then { + _text = _text + "Detected missing addon on server
"; + _error = _error + "Additional file(s); "; + }; + if (_oldVersionClient) then { + _text = _text + "Detected old client version
"; + _error = _error + "Older version; "; + }; + if (_oldVersionServer) then { + _text = _text + "Detected old server version
"; + _error = _error + "Newer version; "; + }; - //[_error, "{systemChat _this}"] call FUNC(execRemoteFnc); - diag_log text _error; + //[_error, "{systemChat _this}"] call FUNC(execRemoteFnc); + diag_log text _error; - _text = composeText [lineBreak, parseText format ["%1", _text]]; + _text = composeText [lineBreak, parseText format ["%1", _text]]; - _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer; - _rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true]; + _rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer; + _rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true]; - disableSerialization; - _ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint"; - _ctrlHint ctrlSetStructuredText _text; + disableSerialization; + _ctrlHint = uiNamespace getVariable "ACE_ctrlErrorHint"; + _ctrlHint ctrlSetStructuredText _text; - if (_mode == 0) then { - sleep 10; - _rscLayer cutFadeOut 0.2; - }; + if (_mode == 0) then { + sleep 10; + _rscLayer cutFadeOut 0.2; + }; - if (_mode == 2) then { - sleep 10; - waitUntil {alive player}; - [player] call FUNC(adminKick); - }; - }; - }; + if (_mode == 2) then { + sleep 10; + waitUntil {alive player}; + [player] call FUNC(adminKick); + }; + }; + }; }; diag_log text format ["[ACE]: Check-PBOs Module Initialized. Mode: %1.", _mode]; From 7fb56d4fd56ff032511477108f45cee65c340e04 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 9 May 2015 17:03:51 +0200 Subject: [PATCH 24/31] simple check to compare client and server version of ace --- addons/common/functions/fnc_checkFiles.sqf | 34 +++++++++++++++++++- addons/common/functions/fnc_errorMessage.sqf | 15 +++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf index 35cb552a8a..6aa38d61c0 100644 --- a/addons/common/functions/fnc_checkFiles.sqf +++ b/addons/common/functions/fnc_checkFiles.sqf @@ -17,7 +17,7 @@ private "_version"; _version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr"); -diag_log text format ["[ACE]: ACE is version %1", _version]; +diag_log text format ["[ACE]: ACE is version %1.", _version]; private ["_addons", "_index"]; @@ -57,3 +57,35 @@ _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter); }; }; } forEach getArray (configFile >> "ACE_Extensions" >> "extensions"); + +/////////////// +// check server version +/////////////// +if (isMultiplayer) then { + if (isServer) then { + // send servers version of ACE to all clients + GVAR(ServerVersion) = _version; + publicVariable QGVAR(ServerVersion); + } else { + // clients have to wait for the variable + [{ + if (isNil QGVAR(ServerVersion)) exitWith {}; + + private "_version"; + _version = _this select 0; + + if (_version != GVAR(ServerVersion)) then { + private "_errorMsg"; + _errorMsg = format ["Client/Server Version Mismatch. Server: %1, Client: %2.", GVAR(ServerVersion), _version]; + + diag_log text format ["[ACE] ERROR: %1", _errorMsg]; + + if (hasInterface) then {diag_log str "1"; + ["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage); + }; + }; + + [_this select 1] call CBA_fnc_removePerFrameHandler; + }, 1, _version] call CBA_fnc_addPerFrameHandler; + }; +}; diff --git a/addons/common/functions/fnc_errorMessage.sqf b/addons/common/functions/fnc_errorMessage.sqf index e061772942..9665fed5bb 100644 --- a/addons/common/functions/fnc_errorMessage.sqf +++ b/addons/common/functions/fnc_errorMessage.sqf @@ -15,6 +15,21 @@ disableSerialization; endLoadingScreen; + +// no message without player possible +if (!hasInterface) exitWith {}; + +// wait for display +if (isNull (call BIS_fnc_displayMission)) exitWith { + [{ + if (isNull (call BIS_fnc_displayMission)) exitWith {}; + + (_this select 0) call FUNC(errorMessage); + [_this select 1] call CBA_fnc_removePerFrameHandler; + + }, 1, _this] call CBA_fnc_addPerFrameHandler; +}; + private ["_textHeader", "_textMessage", "_onOK", "_onCancel"]; _textHeader = _this select 0; From 30ff90453bdc7a143f4b02253b844a991b760fdf Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 9 May 2015 18:32:19 +0200 Subject: [PATCH 25/31] wind deflection has wrong version number macro setup --- addons/winddeflection/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/winddeflection/config.cpp b/addons/winddeflection/config.cpp index e0c77420cf..02480bf013 100644 --- a/addons/winddeflection/config.cpp +++ b/addons/winddeflection/config.cpp @@ -7,9 +7,9 @@ class CfgPatches { requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_weather"}; versionDesc = "ACE Wind Deflection"; - version = VERSION; author[] = {$STR_ACE_Common_ACETeam, "Glowbal", "Ruthberg"}; authorUrl = "http://csemod.com"; + VERSION_CONFIG;` }; }; From b80602fbae025d0862a219a76ff6302b49386b52 Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 9 May 2015 18:55:00 +0200 Subject: [PATCH 26/31] Fixed a typo --- addons/winddeflection/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/winddeflection/config.cpp b/addons/winddeflection/config.cpp index 02480bf013..e420debb66 100644 --- a/addons/winddeflection/config.cpp +++ b/addons/winddeflection/config.cpp @@ -9,7 +9,7 @@ class CfgPatches { versionDesc = "ACE Wind Deflection"; author[] = {$STR_ACE_Common_ACETeam, "Glowbal", "Ruthberg"}; authorUrl = "http://csemod.com"; - VERSION_CONFIG;` + VERSION_CONFIG; }; }; From aa6c3ddf2c53d95fe843265f416d2aa0a69ca3a7 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 9 May 2015 19:34:35 +0200 Subject: [PATCH 27/31] fix: check files script, order in activatedAddons is not guaranteed --- addons/common/functions/fnc_checkFiles.sqf | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf index 6aa38d61c0..b0ea8a5200 100644 --- a/addons/common/functions/fnc_checkFiles.sqf +++ b/addons/common/functions/fnc_checkFiles.sqf @@ -4,7 +4,7 @@ * Compares version numbers of PBOs and DLLs. * * Argument: - * 0: Mode (Number) + * None. * * Return value: * None. @@ -19,14 +19,8 @@ _version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr"); diag_log text format ["[ACE]: ACE is version %1.", _version]; -private ["_addons", "_index"]; - +private "_addons"; _addons = activatedAddons; - -// speed up search. all ace pbos are loaded after ace_main. -_index = _addons find "ace_main"; -reverse _addons; -_addons resize (count _addons - _index); _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter); { From 253ed6946e3f270db9c21ecdb622b5a09f4472f6 Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 9 May 2015 20:02:22 +0200 Subject: [PATCH 28/31] scope firedEH cleanup --- addons/scopes/functions/fnc_firedEH.sqf | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index 1b692e340a..020431c27b 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -18,25 +18,20 @@ */ #include "script_component.hpp" -private ["_unit", "_adjustment", "_weapon", "_projectile", "_weaponIndex", "_zeroing", "_adjustment"]; - +private ["_unit", "_adjustment", "_projectile", "_weaponIndex", "_zeroing", "_adjustment"]; _unit = _this select 0; -_weapon = _this select 1; _projectile = _this select 6; -// Exit if the unit doesn't have any adjusment variable +if !([_unit] call EFUNC(common,isPlayer)) exitWith {}; + _adjustment = _unit getVariable [QGVAR(Adjustment), []]; if (_adjustment isEqualTo []) exitWith {}; -// Exit if the unit isn't a player -if !([_unit] call EFUNC(common,isPlayer)) exitWith {}; - _weaponIndex = [_unit, currentWeapon _unit] call EFUNC(common,getWeaponIndex); if (_weaponIndex < 0) exitWith {}; _zeroing = _adjustment select _weaponIndex; -//Exit if adjusment is zero: if (_zeroing isEqualTo [0,0,0]) exitWith {}; // Convert zeroing from mils to degrees From 6b5d95906d357f4432f94c75736d9aed3e501a90 Mon Sep 17 00:00:00 2001 From: jaynus Date: Sat, 9 May 2015 12:41:01 -0700 Subject: [PATCH 29/31] Disables multiple openings of the kestrel & atrag. Allows the overlay toggle, but disables the opening of multiple ones. Used onUnload handlers. Supports both limiting interact and keybinds. Fixes #1086 --- addons/atragmx/RscTitles.hpp | 1 + addons/atragmx/XEH_preInit.sqf | 1 + addons/atragmx/functions/fnc_create_dialog.sqf | 3 +++ addons/atragmx/functions/fnc_init.sqf | 2 ++ addons/atragmx/functions/fnc_on_close_dialog.sqf | 4 ++++ addons/atragmx/initKeybinds.sqf | 2 +- addons/kestrel4500/RscTitles.hpp | 2 ++ addons/kestrel4500/XEH_postInit.sqf | 2 +- addons/kestrel4500/XEH_preInit.sqf | 3 +++ addons/kestrel4500/functions/fnc_createKestrelDialog.sqf | 1 + addons/kestrel4500/functions/fnc_onCloseDialog.sqf | 4 ++++ addons/kestrel4500/functions/fnc_onCloseDisplay.sqf | 4 ++++ addons/kestrel4500/initKeybinds.sqf | 5 +++-- 13 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 addons/atragmx/functions/fnc_on_close_dialog.sqf create mode 100644 addons/kestrel4500/functions/fnc_onCloseDialog.sqf create mode 100644 addons/kestrel4500/functions/fnc_onCloseDisplay.sqf diff --git a/addons/atragmx/RscTitles.hpp b/addons/atragmx/RscTitles.hpp index 4ae08c20aa..cefc7a26eb 100644 --- a/addons/atragmx/RscTitles.hpp +++ b/addons/atragmx/RscTitles.hpp @@ -142,6 +142,7 @@ class ATragMX_Display { name="ATragMX_Display"; idd=-1; onLoad="uiNamespace setVariable ['ATragMX_Display', (_this select 0)]"; + onUnload=QUOTE(_this call FUNC(on_close_dialog)); movingEnable=1; controlsBackground[]={}; objects[]={}; diff --git a/addons/atragmx/XEH_preInit.sqf b/addons/atragmx/XEH_preInit.sqf index 6ec288b9c7..62bf2181c7 100644 --- a/addons/atragmx/XEH_preInit.sqf +++ b/addons/atragmx/XEH_preInit.sqf @@ -68,5 +68,6 @@ PREP(update_target_data); PREP(update_target_selection); PREP(update_unit_selection); PREP(update_zero_range); +PREP(on_close_dialog); ADDON = true; diff --git a/addons/atragmx/functions/fnc_create_dialog.sqf b/addons/atragmx/functions/fnc_create_dialog.sqf index 09e413d535..e0be3c6941 100644 --- a/addons/atragmx/functions/fnc_create_dialog.sqf +++ b/addons/atragmx/functions/fnc_create_dialog.sqf @@ -16,6 +16,7 @@ #include "script_component.hpp" //if (dialog) exitWith { false }; +if(GVAR(active)) exitWith { false }; if (underwater ACE_player) exitWith { false }; if (!("ACE_ATragMX" in (uniformItems ACE_player)) && !("ACE_ATragMX" in (vestItems ACE_player))) exitWith { false }; @@ -47,4 +48,6 @@ GVAR(showTargetSpeedAssistTimer) call FUNC(show_target_speed_assist_timer); lbAdd [6000, _x select 0]; } forEach GVAR(gunList); +GVAR(active) = true; + true diff --git a/addons/atragmx/functions/fnc_init.sqf b/addons/atragmx/functions/fnc_init.sqf index e4fe1b67a4..30b17ebf90 100644 --- a/addons/atragmx/functions/fnc_init.sqf +++ b/addons/atragmx/functions/fnc_init.sqf @@ -15,6 +15,8 @@ */ #include "script_component.hpp" +GVAR(active) = false; + GVAR(workingMemory) = +(GVAR(gunList) select 0); GVAR(scopeUnits) = ["MILs", "TMOA", "SMOA", "Clicks"]; diff --git a/addons/atragmx/functions/fnc_on_close_dialog.sqf b/addons/atragmx/functions/fnc_on_close_dialog.sqf new file mode 100644 index 0000000000..32ba4e4c43 --- /dev/null +++ b/addons/atragmx/functions/fnc_on_close_dialog.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" + +uiNamespace setVariable ['ATragMX_Display', nil]; +GVAR(active) = false; \ No newline at end of file diff --git a/addons/atragmx/initKeybinds.sqf b/addons/atragmx/initKeybinds.sqf index 796d7f9d97..98bddf04e4 100644 --- a/addons/atragmx/initKeybinds.sqf +++ b/addons/atragmx/initKeybinds.sqf @@ -2,7 +2,7 @@ { // Conditions: canInteract if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; - + if(GVAR(active)) exitWith {}; // Statement [] call FUNC(create_dialog); false diff --git a/addons/kestrel4500/RscTitles.hpp b/addons/kestrel4500/RscTitles.hpp index defb954292..b091a07561 100644 --- a/addons/kestrel4500/RscTitles.hpp +++ b/addons/kestrel4500/RscTitles.hpp @@ -54,6 +54,7 @@ class Kestrel4500_Display name="Kestrel4500_Display"; idd=-1; onLoad="uiNamespace setVariable ['Kestrel4500_Display', (_this select 0)]"; + onUnload=QUOTE(_this call FUNC(onCloseDialog)); movingEnable=1; controlsBackground[]={}; objects[]={}; @@ -217,6 +218,7 @@ class RscTitles { idd=-1; onLoad="with uiNameSpace do { RscKestrel4500 = _this select 0 };"; + onUnload=(_this call FUNC(onCloseDisplay)); movingEnable=0; duration=60; fadeIn="false"; diff --git a/addons/kestrel4500/XEH_postInit.sqf b/addons/kestrel4500/XEH_postInit.sqf index 461ed533db..24a972c326 100644 --- a/addons/kestrel4500/XEH_postInit.sqf +++ b/addons/kestrel4500/XEH_postInit.sqf @@ -22,4 +22,4 @@ GVAR(MeasuredWindSpeed) = 0; GVAR(ImpellerState) = 0; GVAR(Kestrel4500) = false; -GVAR(Overlay) = false; +GVAR(Overlay) = false; \ No newline at end of file diff --git a/addons/kestrel4500/XEH_preInit.sqf b/addons/kestrel4500/XEH_preInit.sqf index d081f485ec..2d5e211a54 100644 --- a/addons/kestrel4500/XEH_preInit.sqf +++ b/addons/kestrel4500/XEH_preInit.sqf @@ -13,4 +13,7 @@ PREP(measureWindSpeed); PREP(updateDisplay); PREP(updateImpellerState); +PREP(onCloseDialog); +PREP(onCloseDisplay); + ADDON = true; diff --git a/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf b/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf index f9cd6cf04a..77e36679de 100644 --- a/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf +++ b/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf @@ -16,6 +16,7 @@ //if (dialog) exitWith { false }; if (underwater ACE_player) exitWith { false }; +if(GVAR(Kestrel4500)) exitWith { false }; if (!("ACE_Kestrel4500" in (uniformItems ACE_player)) && !("ACE_Kestrel4500" in (vestItems ACE_player))) exitWith { false }; GVAR(Overlay) = false; diff --git a/addons/kestrel4500/functions/fnc_onCloseDialog.sqf b/addons/kestrel4500/functions/fnc_onCloseDialog.sqf new file mode 100644 index 0000000000..a45a9decc3 --- /dev/null +++ b/addons/kestrel4500/functions/fnc_onCloseDialog.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" + +uiNamespace setVariable ['Kestrel4500_Display', nil]; +GVAR(Kestrel4500) = false; diff --git a/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf b/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf new file mode 100644 index 0000000000..efb60b322a --- /dev/null +++ b/addons/kestrel4500/functions/fnc_onCloseDisplay.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" + +uiNamespace setVariable ['RscKestrel4500', nil]; +GVAR(Overlay) = false; diff --git a/addons/kestrel4500/initKeybinds.sqf b/addons/kestrel4500/initKeybinds.sqf index f6b4fec3ce..f910bdf552 100644 --- a/addons/kestrel4500/initKeybinds.sqf +++ b/addons/kestrel4500/initKeybinds.sqf @@ -2,7 +2,8 @@ { // Conditions: canInteract if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; - + if(GVAR(Kestrel4500)) exitWith { false }; + // Statement [] call FUNC(createKestrelDialog); false @@ -14,7 +15,7 @@ { // Conditions: canInteract if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; - + // Statement [] call FUNC(displayKestrel); false From 3a10c77f08e5bb90997e44cf31f540a787c6105e Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 9 May 2015 22:09:36 +0200 Subject: [PATCH 30/31] Minor cleanup --- addons/atragmx/functions/fnc_create_dialog.sqf | 3 +-- addons/atragmx/initKeybinds.sqf | 2 +- addons/kestrel4500/functions/fnc_createKestrelDialog.sqf | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/addons/atragmx/functions/fnc_create_dialog.sqf b/addons/atragmx/functions/fnc_create_dialog.sqf index e0be3c6941..6951137577 100644 --- a/addons/atragmx/functions/fnc_create_dialog.sqf +++ b/addons/atragmx/functions/fnc_create_dialog.sqf @@ -15,8 +15,7 @@ */ #include "script_component.hpp" -//if (dialog) exitWith { false }; -if(GVAR(active)) exitWith { false }; +if (GVAR(active)) exitWith { false }; if (underwater ACE_player) exitWith { false }; if (!("ACE_ATragMX" in (uniformItems ACE_player)) && !("ACE_ATragMX" in (vestItems ACE_player))) exitWith { false }; diff --git a/addons/atragmx/initKeybinds.sqf b/addons/atragmx/initKeybinds.sqf index 98bddf04e4..8bc37752f3 100644 --- a/addons/atragmx/initKeybinds.sqf +++ b/addons/atragmx/initKeybinds.sqf @@ -2,7 +2,7 @@ { // Conditions: canInteract if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; - if(GVAR(active)) exitWith {}; + if (GVAR(active)) exitWith {false}; // Statement [] call FUNC(create_dialog); false diff --git a/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf b/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf index 77e36679de..289d0825fc 100644 --- a/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf +++ b/addons/kestrel4500/functions/fnc_createKestrelDialog.sqf @@ -14,9 +14,8 @@ */ #include "script_component.hpp" -//if (dialog) exitWith { false }; +if (GVAR(Kestrel4500)) exitWith { false }; if (underwater ACE_player) exitWith { false }; -if(GVAR(Kestrel4500)) exitWith { false }; if (!("ACE_Kestrel4500" in (uniformItems ACE_player)) && !("ACE_Kestrel4500" in (vestItems ACE_player))) exitWith { false }; GVAR(Overlay) = false; From 4733818e9b09c4e3bf414b62583ee476ede12cfa Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 9 May 2015 15:10:01 -0500 Subject: [PATCH 31/31] Fix weather array for zargabad --- addons/weather/functions/fnc_getMapData.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/weather/functions/fnc_getMapData.sqf b/addons/weather/functions/fnc_getMapData.sqf index 5a090c7388..55c6e9c3c0 100644 --- a/addons/weather/functions/fnc_getMapData.sqf +++ b/addons/weather/functions/fnc_getMapData.sqf @@ -103,7 +103,7 @@ if (toLower worldName in ["takistan", "zargabad", "mountains_acr", "shapur_baf", GVAR(Humidity) = [68, 69, 62, 60, 49, 37, 38, 39, 40, 41, 56, 61]; // Source: https://weatherspark.com/averages/32750/Kabul-Afghanistan - GVAR(WindSpeedMax) = [[4.0, 1.0], [4.1, 1.0], [5.1, 1.1], [6.9, 1.2], [8.9, 1.2], [10.0, 1.1], 0, [8.2, 1.0], [6.9, 1.0], [5.2, 1.0], [3.8, 0.9], [3.7, 0.9]]; + GVAR(WindSpeedMax) = [[4.0, 1.0], [4.1, 1.0], [5.1, 1.1], [6.9, 1.2], [8.9, 1.2], [10.0, 1.1], [9.1,1.0], [8.2, 1.0], [6.9, 1.0], [5.2, 1.0], [3.8, 0.9], [3.7, 0.9]]; GVAR(WindSpeedMean) = [2.2, 2.2, 2.5, 2.8, 3.8, 4.4, 0, 3.3, 2.7, 2.4, 1.8, 1.9]; GVAR(WindSpeedMin) = [[0.2, 0.4], [0.2, 0.4], [0.2, 0.4], [0.3, 0.4], [0.6, 0.4], [0.9, 0.4], [0.7, 0.4], [0.5, 0.4], [0.2, 0.5], [0.1, 0.1], [0, 0.1], [0, 0.1]]; GVAR(WindDirectionProbabilities) = [[0.04, 0.02, 0.05, 0.04, 0.05, 0.04, 0.11, 0.29], // January