diff --git a/.travis.yml b/.travis.yml
index 388b1f114f..0aadd9cd0b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,6 +9,7 @@ before_script:
- pip install pygithub3
script:
- python3 tools/deploy.py
+ - python3 tools/sqf_validator.py
env:
global:
- secure: "KcJQbknBOdC5lA4nFGKPXVRVIGLDXDRzC8XkHuXJCE9pIR/wbxbkvx8fHKcC6SC9eHgzneC3+o4m4+CjIbVvIwDgslRbJ8Y59i90ncONmdoRx1HUYHwuYWVZm9HJFjCsIbrEqhSyyKS+PB3WZVOLbErtNHsgS8f43PTh5Ujg7Vg="
diff --git a/AUTHORS.txt b/AUTHORS.txt
index 80046475ff..caa19109a7 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -52,6 +52,7 @@ Crusty
Dharma Bellamkonda
Dimaslg
Drill
+Dudakov
eRazeri
evromalarkey
F3 Project
diff --git a/README.md b/README.md
index 5630ea8819..5a01e5d5de 100644
--- a/README.md
+++ b/README.md
@@ -3,10 +3,10 @@
-
+
-
-
+
+
diff --git a/ace_medical.dll b/ace_medical.dll
index 790154d4c4..c54febf34f 100644
Binary files a/ace_medical.dll and b/ace_medical.dll differ
diff --git a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf
index 2ae2bf2f9c..7a432831ad 100644
--- a/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf
+++ b/addons/advanced_ballistics/functions/fnc_handleFirePFH.sqf
@@ -14,10 +14,10 @@
private "_deleted";
-
-
_deleted = 0;
+_aceTimeSecond = floor ACE_time;
+
{
private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"];
_x params["_bullet","_caliber","_bulletTraceVisible","_index"];
@@ -37,7 +37,6 @@ _deleted = 0;
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""];
};
- _aceTimeSecond = floor ACE_time;
call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]);
} forEach GVAR(allBullets);
diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf
index 74c16bdd47..d97c9b952a 100644
--- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf
+++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf
@@ -53,7 +53,9 @@ if (!GVAR(simulateForEveryone) && !(local _unit)) then {
if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; };
if (_abort || !(GVAR(extensionAvailable))) exitWith {
- [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")] call EFUNC(winddeflection,updateTrajectoryPFH);
+ if (missionNamespace getVariable [QEGVAR(windDeflection,enabled), false]) then {
+ EGVAR(windDeflection,trackedBullets) pushBack [_bullet, getNumber(configFile >> "cfgAmmo" >> _ammo >> "airFriction")];
+ };
};
// Get Weapon and Ammo Configurations
diff --git a/addons/advanced_ballistics/stringtable.xml b/addons/advanced_ballistics/stringtable.xml
index 45e0d042a5..5ea26cd906 100644
--- a/addons/advanced_ballistics/stringtable.xml
+++ b/addons/advanced_ballistics/stringtable.xml
@@ -32,7 +32,9 @@
Erweiterte Ballistik
Pokročilá balistika
Balística avançada
+ Balistique avancée
Fejlett ballisztika
+ Продвинутая баллистика
Advanced Ballistics
@@ -41,7 +43,9 @@
Erweiterte Ballistik
Pokročilá balistika
Balística avançada
+ Balistique avancée
Fejlett ballisztika
+ Продвинутая баллистика
Enables advanced ballistics
@@ -50,7 +54,9 @@
Aktiviert die erweiterte Ballistik
Aktivuje pokročilou balistiku
Ativa balística avançada
+ Activer la balistique avancée
Engedélyezi a fejlett ballisztikát
+ Включает продвинутую баллистику
Enabled For Snipers
@@ -59,7 +65,9 @@
Für Scharfschützen aktiviert
Povoleno pro odstřelovače
Ativar para caçadores
+ Activer pour les snipers
Mesterlövészeknek engedélyezve
+ Включена для снайперов
Enables advanced ballistics for non local snipers (when using high power optics)
@@ -68,7 +76,9 @@
Aktiviert die erweiterte Ballistik für nicht lokale Scharfschützen (bei Benutzung von Optiken mit starker Vergrößerung)
Aktivuje pokročilou balistiku pro nelokální odstřelovače (když používá výkonnou optiku)
Ativa balística avançada para caçadores não locais (quando usando miras telescópicas)
+ Active la balistique avancée pour les snipers non locaux (en utilisant les optiques avancées)
Engedélyezi a fejlett ballisztikát nem-helyi mesterlövészeknek (nagy-teljesítményű optika használatakor)
+ Включает продвинутую баллистику для нелокальных снайперов (при использовании мощной оптики)
Enabled For Group Members
@@ -77,7 +87,9 @@
Für Gruppenmitglieder aktiviert
Povoleno pro členy skupiny
Ativada para membros do grupo
+ Activer pour les membres groupés
Csoporttagoknak engedélyezve
+ Включена для группы
Enables advanced ballistics for non local group members
@@ -86,7 +98,9 @@
Aktiviert die erweiterte Ballistik für nicht lokale Gruppenmitglieder
Aktivuje pokročilou balistiku pro nelokální členy skupiny
Ativa balística avançada para membros de grupo não locais
+ Active la balistique avancée pour les membres groupés non locaux
Engedélyezi a fejlett ballisztikát nem-helyi csoporttagoknak
+ Включает продвинутую баллистику для нелокальных членов группы
Enabled For Everyone
@@ -95,7 +109,9 @@
Für jeden aktiviert
Povoleno pro všechny
Ativada para todos
+ Activer pour tout le monde
Mindenkinek engedélyezve
+ Включена для всех
Enables advanced ballistics for all non local players (enabling this may degrade performance during heavy firefights in multiplayer)
@@ -104,7 +120,9 @@
Aktiviert die erweiterte Ballistik für alle nicht lokalen Spieler (das Aktivieren dieser Funktion kann zur Beeinträchtigung des Spielerlebnisses im Multiplayer führen)
Aktivovat pokročilou balistiku pro všechny nelokální hráče (aktivace této možnosti způsobuje pokles snímu za sekundu během těžké přestřelky v multiplayeru)
Ativa balística avançada para todos os jogadores não locais (ativando isso pode degradar a performance durante troca de tiros intensas no multiplayer)
+ Active la balistique avancé pour tous les joueurs non locaux (activer cette option peut avoir un impact sur les performance en multi durant les grands échanges de tirs)
Engedélyezi a fejlett ballisztikát az összes nem-helyi játékosnak (ez a funkció leronthatja a teljesítményt intenzív többjátékos tűzharcok alatt)
+ Включает продвинутую баллистику для всех нелокальных игроков (включение этой опции может снизить производительность при массовых перестрелках в мультиплеере)
Always Enabled For Group Members
@@ -113,7 +131,9 @@
Für Gruppenmitglieder immer aktiviert
Vždy povoleno pro členy skupiny
Sempre ativada para membros do grupo
+ Toujours activer pour les membres groupés
Mindig engedélyezve csoporttagoknak
+ Всегда включена для членов группы
Always enables advanced ballistics when a group member fires
@@ -122,7 +142,9 @@
Aktiviert die erweiterte Ballistik immer, wenn ein Gruppenmitglied schießt
Aktivuje pokročilou balistiku pro členy skupiny
Sempre ative balística avançada quando um membro do grupo disparar
+ Active tout le temps la balistique avancée quand un membre du groupe ouvre le feu
Mindig engedélyezi a fejlett ballisztikát, ha egy csoporttag tüzel
+ Всегда включает продвинутую баллистику когда стреляет член группы
Disabled In FullAuto Mode
@@ -131,7 +153,9 @@
Beim vollautomatischen Feuern deaktiviert
Zakázáno v automatickém režimu střelby
Desabilitar no modo automático
+ Désactiver en mode rafale libre
Automata módban letiltva
+ Выкл. для автомат. режима
Disables the advanced ballistics during full auto fire
@@ -140,7 +164,9 @@
Deaktiviert die erweiterte Ballistik beim vollautomatischen Feuern
Zákáže pokročilou balistiku během střelby v režimu automat
Desabilitar a balística avançada durante fogo automático
+ Désactive la balistique avancée pour les tirs en rafale libre
Letiltja a fejlett ballisztikát automata tüzelés folyamán
+ Выключает продвинутую баллистику при стрельбе в полностью автоматическом режиме
Enable Ammo Temperature Simulation
@@ -149,7 +175,9 @@
Simulation der Munitionstemperatur aktivieren
Povolit simulaci teploty munice
Ativar simulação de temperatura de munição
+ Activer la simulation de la température
Lőszer-hő szimuláció engedélyezése
+ Симуляция температуры для боеприпасов
Muzzle velocity varies with ammo temperature
@@ -158,7 +186,9 @@
Munitionstemperatur hat Einfluss auf die Mündungsgeschwindigkeit
Úsťová rychlost je závislá na teplotě munice
A velocidade de saída varia com a temperatura da munição
+ La température de la munition influe sur la vélocité intiale
A kezdősebesség a lőszer hőmérsékletétől függően változó
+ Начальная скорость пули зависит от температуры
Enable Barrel Length Simulation
@@ -167,7 +197,9 @@
Simulation der Lauflänge aktivieren
Povolit simulaci délky hlavně
Ativar a simulação de comprimento do cano
+ Activer la simulation de la longueur de canon
Csőhossz-szimuláció engedélyezése
+ Симуляция длины ствола
Muzzle velocity varies with barrel length
@@ -176,7 +208,9 @@
Lauflänge beeinflusst Mündungsgeschwindigkeit
Úsťová rychlost je závislá na délce hlavně
A velocidade de saída caria com o comprimento do cano
+ La longueur du canon influe sur la vélocité initale
A kezdősebesség a cső hosszától függően változó
+ Начальная скорость пули зависит от длины ствола
Enable Bullet Trace Effect
@@ -185,7 +219,9 @@
Geschossspureffekt aktivieren
Povolit efekt trasírek
Ativa efeito traçante de projétil
+ Activer l'effet traçante
Nyomkövető-effekt engedélyezése
+ Следы пуль
Enables a bullet trace effect to high caliber bullets (only visible when looking through high power optics)
@@ -194,7 +230,9 @@
Aktiviere Geschossspureffekt für hohe Kaliber (bei Benutzung von Optiken mit starker Vergrößerung)
Aktivuje efekt trasírek z vysokokaliberních zbraní (viditelné pouze skrze výkonnou optiku)
Ativa o efeito traçante de projétil para projéteis de alto calibre (somente visível quando observado por miras telescópicas)
+ Active une tracante pour les munitions de gros calibre (seulement visible en utilisant des optiques avancées)
Engedélyezi a nagy kaliberű lövedékek nyomának vizuális követését (csak nagy teljesítményű optikán keresztül látható)
+ Включает эффект следов пуль для больших калибров (видны только через мощную оптику)
Simulation Interval
@@ -203,7 +241,9 @@
Simulationsintervall
Interval simulace
Intervalo da simulação
+ Intervalle de simulation
Szimuláció intervalluma
+ Интервал симуляции
Defines the interval between every calculation step
@@ -212,7 +252,9 @@
Legt das Intervall zwischen den Berechnungsschritten fest
Určuje interval mezi každým výpočtem
Define o intervalo entre cada cálculo
+ Défini un intervalle de calcul entre deux simulations
Meghatározza a számítási lépések közötti időintervallumot
+ Определяет временной интервал между вычислениями
Simulation Radius
@@ -221,7 +263,9 @@
Simulationsradius
Rozsah simulace
Raio de simulação
+ Rayon de simulation
Szimuláció hatóköre
+ Радиус симуляции
Defines the radius around the player (in meters) at which advanced ballistics are applied to projectiles
@@ -230,14 +274,19 @@
Gibt den Radius (in Metern) um den Spieler an, bei dem die erweiterte Ballistik auf Geschosse angewendet wird
Určuje oblast kolem hráče (v metrech), kde je pokročilá balistika použita na projektil
Define o raio ao redor do jogador (em metros) onde a balística avançada será aplicada aos projéteis
+ Défini le rayon autour du joueur (en mètres) d'application de la balistique avancée
Meghatározza a játékos körüli hatókört (méterben), ahol a lövedékek fejlett ballisztikát használnak
+ Определяет радиус вокруг игрока (в метрах), в котором продвинутая баллистика применяется к снарядам
This module enables advanced ballistics simulation - meaning the trajectory of projectiles is influenced by variables like air temperature, atmospheric pressure, humidity, gravity, the type of ammunition and the weapon from which it was fired.
Moduł ten pozwala aktywować zaawansowaną balistykę biorącą przy obliczeniach trajektorii lotu pocisku pod uwagę takie rzeczy jak temperatura powietrza, ciśnienie atmosferyczne, wilgotność powietrza, siły Coriolisa i Eotvosa, grawitację a także broń z jakiej wykonywany jest strzał oraz rodzaj amunicji. Wszystko to sprowadza się na bardzo dokładne odwzorowanie balistyki.
Tento modul umožňuje aktivovat pokročilou balistiku, která vypočítává trajektorii kulky a bere do úvahy věci jako je teplota vzduchu, atmosférický tlak, vlhkost vzduchu, gravitaci, typ munice a zbraň, ze které je náboj vystřelen. To vše přispívá k velmi přesné balistice.
Este módulo permite que você ative cálculos de balística avançada, fazendo a trajetória do projétil levar em consideração coisas como temperatura do ar, pressão atmosférica, umidade, força de Coriolis, a gravidade, o modelo da arma no qual o disparo é realizado e o tipo de munição. Tudo isso acrescenta-se a um balística muito precisa.
+ Ce module active la simulation de balistique avancée - ie les projectiles sont influencé par des varibles comme le vent, la température, la pression atmosphérique, l'humidité, la gravité, le type de munition et l'arme avec laquelles ils sont tirés
Ez a modul engedélyezi a fejlett ballisztikai szimulációt - a lövedékek röppályáját befolyásolni fogja a levegő hőmérséklete, légnyomás, páratartalom, gravitáció, a lövedék fajtája, valamint a fegyver, amiből kilőtték a lövedéket.
+ Этот модуль включает симуляцию продвинутой баллистики - при этом на траекторию полета снаряда влияют различные параметры, такие как температура воздуха, атмосферное давление, влажность, гравитация, тип боеприпаса и оружия, из которого произвели выстрел.
+ Este módulo permite la simulación balística avanzada - es decir, la trayectoria de los proyectiles está influenciada por variables como la temperatura del aire, la presión atmosférica, la humedad, la gravedad, el tipo de municiones y el arma desde el que fue disparada.
-
\ No newline at end of file
+
diff --git a/addons/aircraft/stringtable.xml b/addons/aircraft/stringtable.xml
index e917ca7e9d..d91af73a1c 100644
--- a/addons/aircraft/stringtable.xml
+++ b/addons/aircraft/stringtable.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/addons/atragmx/stringtable.xml b/addons/atragmx/stringtable.xml
index fce50a4e1d..a8e23ffbda 100644
--- a/addons/atragmx/stringtable.xml
+++ b/addons/atragmx/stringtable.xml
@@ -1,4 +1,4 @@
-
+
@@ -50,4 +50,4 @@
Abrir ATragMX
-
\ No newline at end of file
+
diff --git a/addons/attach/functions/fnc_canDetach.sqf b/addons/attach/functions/fnc_canDetach.sqf
index 915295e6c9..d9796a5a5c 100644
--- a/addons/attach/functions/fnc_canDetach.sqf
+++ b/addons/attach/functions/fnc_canDetach.sqf
@@ -19,6 +19,8 @@
params ["_attachToVehicle", "_unit"];
TRACE_2("params",_attachToVehicle,_unit);
+if ((vehicle _unit) != _unit) exitWith {false};
+
_attachedList = _attachToVehicle getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {false};
diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml
index cfbebd33ab..cc09e8f45d 100644
--- a/addons/attach/stringtable.xml
+++ b/addons/attach/stringtable.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/addons/backpacks/XEH_postInit.sqf b/addons/backpacks/XEH_postInit.sqf
index 639bf74919..375fcd5f89 100644
--- a/addons/backpacks/XEH_postInit.sqf
+++ b/addons/backpacks/XEH_postInit.sqf
@@ -1,3 +1,3 @@
#include "script_component.hpp"
-["backpackOpened", DFUNC(backpackOpened)] call EFUNC(common,addEventHandler);
+["backpackOpened", {_this call FUNC(backpackOpened)}] call EFUNC(common,addEventHandler);
diff --git a/addons/backpacks/functions/fnc_backpackOpened.sqf b/addons/backpacks/functions/fnc_backpackOpened.sqf
index 9488bf6bd9..4e61e8fbcc 100644
--- a/addons/backpacks/functions/fnc_backpackOpened.sqf
+++ b/addons/backpacks/functions/fnc_backpackOpened.sqf
@@ -1,18 +1,19 @@
/*
* Author: commy2
+ * Someone opened your backpack. Play sound and camshake. Execute locally.
*
- * Someone opened your backpack. Execute locally.
- *
- * Argument:
+ * Arguments:
* 0: Who accessed your inventory? (Object)
* 1: Unit that wields the backpack (Object)
* 2: The backpack object (Object)
*
- * Return value:
- * None.
+ * Return Value:
+ * None
+ *
+ * Public: No
*/
#include "script_component.hpp"
-private ["_sounds", "_position"];
+
params ["_target", "_backpack"];
// do cam shake if the target is the player
@@ -20,7 +21,8 @@ if ([_target] call EFUNC(common,isPlayer)) then {
addCamShake [4, 0.5, 5];
};
-// play a rustling sound
+// play a zipper sound effect
+private ["_sounds", "_position"];
_sounds = [
/*"a3\sounds_f\characters\ingame\AinvPknlMstpSlayWpstDnon_medic.wss",
@@ -32,8 +34,7 @@ _sounds = [
QUOTE(PATHTO_R(sounds\zip_out.wav))
];
-_position = _target modelToWorldVisual (_target selectionPosition "Spine3");
-_position = _position call EFUNC(common,positionToASL);
+_position = AGLToASL (_target modelToWorldVisual (_target selectionPosition "Spine3"));
playSound3D [
_sounds select floor random count _sounds,
diff --git a/addons/backpacks/functions/fnc_isBackpack.sqf b/addons/backpacks/functions/fnc_isBackpack.sqf
index 3419d2ed38..fab82c505f 100644
--- a/addons/backpacks/functions/fnc_isBackpack.sqf
+++ b/addons/backpacks/functions/fnc_isBackpack.sqf
@@ -1,23 +1,24 @@
/*
* Author: commy2
+ * Check if the given backpack is an actual backpack that can store items. Parachute, static weapon packs, etc. will return false.
*
- * Check if the given backpack is an actual backpack that can store items. Parachute backpacks will return false for example.
+ * Arguments:
+ * 0: Backpack
-
\ No newline at end of file
+
diff --git a/addons/captives/CfgEventHandlers.hpp b/addons/captives/CfgEventHandlers.hpp
index 9d1a69f4fd..4d12dc10c4 100644
--- a/addons/captives/CfgEventHandlers.hpp
+++ b/addons/captives/CfgEventHandlers.hpp
@@ -25,14 +25,6 @@ class Extended_GetOut_EventHandlers {
};
};
};
-//reset captivity and escorting status when getting killed
-class Extended_Killed_EventHandlers {
- class CAManBase {
- class GVAR(AutoDetachCaptive) {
- killed = QUOTE(_this call FUNC(handleKilled));
- };
- };
-};
//mission start
class Extended_InitPost_EventHandlers {
class CAManBase {
diff --git a/addons/captives/XEH_postInit.sqf b/addons/captives/XEH_postInit.sqf
index 1372b4e10a..26f84e6bd9 100644
--- a/addons/captives/XEH_postInit.sqf
+++ b/addons/captives/XEH_postInit.sqf
@@ -18,7 +18,6 @@ if (isServer) then {
}];
};
-["playerVehicleChanged", {_this call FUNC(handleVehicleChanged)}] call EFUNC(common,addEventHandler);
["zeusDisplayChanged", {_this call FUNC(handleZeusDisplayChanged)}] call EFUNC(common,addEventHandler);
["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler);
["MoveInCaptive", {_this call FUNC(vehicleCaptiveMoveIn)}] call EFUNC(common,addEventHandler);
@@ -27,7 +26,7 @@ if (isServer) then {
["SetHandcuffed", {_this call FUNC(setHandcuffed)}] call EFUNC(common,addEventHandler);
["SetSurrendered", {_this call FUNC(setSurrendered)}] call EFUNC(common,addEventHandler);
-//Medical Integration Events???
+//Medical Integration Events
["medical_onUnconscious", {_this call ACE_Captives_fnc_handleOnUnconscious}] call EFUNC(common,addEventHandler);
if (!hasInterface) exitWith {};
diff --git a/addons/captives/XEH_preInit.sqf b/addons/captives/XEH_preInit.sqf
index d2b5b615bb..b59249b937 100644
--- a/addons/captives/XEH_preInit.sqf
+++ b/addons/captives/XEH_preInit.sqf
@@ -19,7 +19,6 @@ PREP(doUnloadCaptive);
PREP(findEmptyNonFFVCargoSeat);
PREP(handleGetIn);
PREP(handleGetOut);
-PREP(handleKilled);
PREP(handleOnUnconscious);
PREP(handlePlayerChanged);
PREP(handleRespawn);
diff --git a/addons/captives/functions/fnc_canApplyHandcuffs.sqf b/addons/captives/functions/fnc_canApplyHandcuffs.sqf
index 5e7eb34a76..368ce3cb7a 100644
--- a/addons/captives/functions/fnc_canApplyHandcuffs.sqf
+++ b/addons/captives/functions/fnc_canApplyHandcuffs.sqf
@@ -23,4 +23,9 @@ params ["_unit", "_target"];
("ACE_CableTie" in (items _unit)) &&
{alive _target} &&
{!(_target getVariable [QGVAR(isHandcuffed), false])} &&
-(GVAR(requireSurrender) == 0 || ((_target getVariable [QGVAR(isSurrendering), false]) || (currentWeapon _target == "" && GVAR(requireSurrender) == 2)))
+{
+ (_target getVariable ["ACE_isUnconscious", false]) || //isUnconscious
+ {GVAR(requireSurrender) == 0} || //or don't require surrendering
+ {_target getVariable [QGVAR(isSurrendering), false]} || //or is surrendering
+ {(GVAR(requireSurrender) == 2) && {(currentWeapon _target) == ""}} //or "SurrenderOrNoWeapon" and no weapon
+}
diff --git a/addons/captives/functions/fnc_handleGetIn.sqf b/addons/captives/functions/fnc_handleGetIn.sqf
index 5476073b38..d89049a031 100644
--- a/addons/captives/functions/fnc_handleGetIn.sqf
+++ b/addons/captives/functions/fnc_handleGetIn.sqf
@@ -26,7 +26,7 @@ if (local _unit) then {
};
if (_unit getVariable [QGVAR(isSurrendering), false]) then {
- [_unit, false] call FUNC(setSurrender);
+ [_unit, false] call FUNC(setSurrendered);
};
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
diff --git a/addons/captives/functions/fnc_handleKilled.sqf b/addons/captives/functions/fnc_handleKilled.sqf
deleted file mode 100644
index f7b15ec117..0000000000
--- a/addons/captives/functions/fnc_handleKilled.sqf
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Author: PabstMirror
- * Handles when a unit is kill. Reset captivity and escorting status
- *
- * Arguments:
- * 0: _oldUnit
- *
- * Return Value:
- * None
- *
- * Example:
- * [bob1] call ACE_captives_fnc_handleKilled
- *
- * Public: No
- */
-#include "script_component.hpp"
-
-params ["_oldUnit"];
-
-if (!local _oldUnit) exitWith {};
-
-if (_oldUnit getVariable [QGVAR(isHandcuffed), false]) then {
- [_oldUnit, false] call FUNC(setHandcuffed);
-};
-
-if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
- _oldUnit setVariable [QGVAR(isEscorting), false, true];
-};
-
-if (_oldUnit getVariable [QGVAR(isSurrendering), false]) then {
- [_oldUnit, false] call FUNC(setSurrendered);
-};
diff --git a/addons/captives/functions/fnc_handleRespawn.sqf b/addons/captives/functions/fnc_handleRespawn.sqf
index 6f68aea2fe..7e97501576 100644
--- a/addons/captives/functions/fnc_handleRespawn.sqf
+++ b/addons/captives/functions/fnc_handleRespawn.sqf
@@ -20,20 +20,34 @@ params ["_unit","_dead"];
if (!local _unit) exitWith {};
-//With respawn="group", we could be respawning into a unit that is handcuffed/captive
-//If they are, reset and rerun the SET function
-//if not, make sure to explicity disable the setCaptivityStatus, because captiveNum does not work correctly on respawn
+// Group and side respawn can potentially respawn you as a captive unit
+// Base and instant respawn cannot, so captive should be entirely reset
+// So we explicity account for the respawn type
+private ["_respawn"];
+_respawn = [0] call BIS_fnc_missionRespawnType;
-if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
- _unit setVariable [QGVAR(isHandcuffed), false];
- [_unit, true] call FUNC(setHandcuffed);
+if (_respawn > 3) then {
+ if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
+ _unit setVariable [QGVAR(isHandcuffed), false];
+ [_unit, true] call FUNC(setHandcuffed);
+ };
+
+ if (_unit getVariable [QGVAR(isSurrendering), false]) then {
+ _unit setVariable [QGVAR(isSurrendering), false];
+ [_unit, true] call FUNC(setSurrendered);
+ };
} else {
+ if (_unit getVariable [QGVAR(isHandcuffed), false]) then {
+ [_unit, false] call FUNC(setHandcuffed);
+ };
[_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus);
-};
-if (_unit getVariable [QGVAR(isSurrendering), false]) then {
- _unit setVariable [QGVAR(isSurrendering), false];
- [_unit, true] call FUNC(setSurrendered);
-} else {
+ if (_unit getVariable [QGVAR(isSurrendering), false]) then {
+ [_unit, false] call FUNC(setSurrendered);
+ };
[_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus);
+
+ if (_oldUnit getVariable [QGVAR(isEscorting), false]) then {
+ _oldUnit setVariable [QGVAR(isEscorting), false, true];
+ };
};
diff --git a/addons/captives/functions/fnc_setHandcuffed.sqf b/addons/captives/functions/fnc_setHandcuffed.sqf
index a8c8e02fd4..00122862eb 100644
--- a/addons/captives/functions/fnc_setHandcuffed.sqf
+++ b/addons/captives/functions/fnc_setHandcuffed.sqf
@@ -109,3 +109,6 @@ if (_state) then {
showHUD true;
};
};
+
+//Global Event after changes:
+["CaptiveStatusChanged", [_unit, _state, "SetHandcuffed"]] call EFUNC(common,globalEvent);
diff --git a/addons/captives/functions/fnc_setSurrendered.sqf b/addons/captives/functions/fnc_setSurrendered.sqf
index dd9ac417c5..cdba47a406 100644
--- a/addons/captives/functions/fnc_setSurrendered.sqf
+++ b/addons/captives/functions/fnc_setSurrendered.sqf
@@ -101,3 +101,6 @@ if (_state) then {
}, 0, [_unit, (ACE_time + 20)]] call CBA_fnc_addPerFrameHandler;
};
};
+
+//Global Event after changes:
+["CaptiveStatusChanged", [_unit, _state, "SetSurrendered"]] call EFUNC(common,globalEvent);
diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml
index 41391fa96b..864fa7c437 100644
--- a/addons/captives/stringtable.xml
+++ b/addons/captives/stringtable.xml
@@ -164,7 +164,9 @@
Einheit kapitulieren lassen
Vzdávající se jednotka
Fazer unidade se render
+ Faire capituler l'unité
Egység kapitulálása
+ Сделать юнита пленным
Sync a unit to make them surrender.<br />Source: ace_captives
@@ -173,7 +175,9 @@
Einheit synchronisieren, um sie kapitulieren zu lassen.<br />Quelle: ace_captives
Synchronizuj s jednotkou, která se má vzdát.<br />Zdroj: ace_captives
Sincroniza uma unidade para fazer com que ela se renda. <br/>Fonte: ace_captives
+ Synchronise une unité pour la rendre captive. <br/>Source: ace_captives
Egység szinkronizálása, hogy kapituláljon.<br />Forrás: ace_captives
+ Синхронизируйте с юнитами, чтобы сделать их пленными.<br />Источник: ace_captives
Captives Settings
@@ -182,7 +186,9 @@
Nastavení zajatce
Gefangenen-Einstellungen
Ajustes de prisioneiros
+ Options de capitulation
Fogoly-beállítások
+ Настройки пленения
Controls settings for surrender and cable ties
@@ -191,7 +197,9 @@
Toto kontroluje nastavení kapitulace a pout
Einstellungen zur Kapitulation und Kabelbindern
Controla as configurações de rendição e abraçadeiras
+ Contrôle les paramètres de la rédition et des Serflex
Szabályozza a kapituláció és bilincselés beállításait
+ Управляет настройками сдачи в плен и связывания
Can handcuff own side
@@ -200,7 +208,9 @@
Může spoutat spolubojovníky
Kann Teamkollegen fesseln
Pode algemar o próprio lado
+ Peut libérer sa propre faction
Saját oldal megbilincselhető
+ Связать союзника
Can players cabletie units on their own side
@@ -209,7 +219,9 @@
Mohou hráči spoutat jednotky na své straně
Können Spieler eigene Einheiten fesseln
Os jogadores podem algemar unidades do seu lado
+ Les joueurs peuvent utiliser les Serflex sur leur propre camp
A játékosok megkötözhetik-e a saját oldalukon lévő egységeket
+ Разрешить игрокам связывать юнитов своей стороны
Allow surrendering
@@ -218,7 +230,9 @@
Povolit vzdávání
Kapitulation erlauben
Permite rendição
+ Permettre la capitulation
Kapituláció engedélyezése
+ Сдаться в плен
Players can surrender after holstering their weapon
@@ -227,23 +241,37 @@
Hráč se může vzdát poté, co si skryje zbraň
Spieler können kapitulieren, nachdem sie ihre Waffe geholstert haben
Jogadores podem se render depois de guardar sua arma
+ Les joueurs peuvent se rendre après avoir rangé leur arme
A játékosok megadhatják magukat a fegyverük elrakása után
+ Игроки могут сдаться в плен после того, как уберут оружие
Require surrendering
Wymagaj kapitulacji
+ Requer rendição
+ Требовать пленения
+ Requiere rendición
Require Players to surrender before they can be arrested
Wymagaj od graczy kapitulacji zanim będzie można ich zaaresztować
+ Requer que jogadores se rendam antes de poderem ser presos
+ Требуется, чтобы игрок сдался в плен прежде, чем его можно будет связать
+ Requiere que los Jugadores se rindan antes de arrestarlos
Surrendering only
Tylko kapitulacja
+ Somente rendição
+ Только сдавшийся в плен
+ Solo rendición
Surrendering or No weapon
Kapitulacja lub brak broni
+ Rendição ou desarmado
+ Сдавшийся или безоружный
+ Rendición o desarme
-
\ No newline at end of file
+
diff --git a/addons/cargo/CfgEventHandlers.hpp b/addons/cargo/CfgEventHandlers.hpp
index 15aaaadad6..689ba5f19e 100644
--- a/addons/cargo/CfgEventHandlers.hpp
+++ b/addons/cargo/CfgEventHandlers.hpp
@@ -16,85 +16,73 @@ class Extended_Killed_EventHandlers {
};
};
-class Extended_Init_EventHandlers {
+//Need initPost or we have problems with setVariable with 'ACE_Cargo'
+class Extended_InitPost_EventHandlers {
class StaticWeapon {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
-
class ReammoBox_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
-
class Cargo_base_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
};
};
-
class CargoNet_01_box_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
};
};
-
class Land_CargoBox_V1_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
};
};
-
class Land_PaperBox_closed_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
};
};
-
class Car {
class ADDON {
init = QUOTE(_this call DFUNC(initVehicle));
};
};
-
class Tank {
class ADDON {
init = QUOTE(_this call DFUNC(initVehicle));
};
};
-
class Helicopter {
class ADDON {
init = QUOTE(_this call DFUNC(initVehicle));
};
};
-
class Plane {
class ADDON {
init = QUOTE(_this call DFUNC(initVehicle));
};
};
-
class Ship_F {
class ADDON {
init = QUOTE(_this call DFUNC(initVehicle));
};
};
-
class ACE_RepairItem_Base {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
-
class ACE_bodyBagObject {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
-
class ACE_ConcertinaWireCoil {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
diff --git a/addons/cargo/CfgVehicles.hpp b/addons/cargo/CfgVehicles.hpp
index 25bd441b90..ccc23a99aa 100644
--- a/addons/cargo/CfgVehicles.hpp
+++ b/addons/cargo/CfgVehicles.hpp
@@ -10,6 +10,7 @@ class CfgVehicles {
isGlobal = 1;
isTriggerActivated = 0;
author = ECSTRING(common,ACETeam);
+
class Arguments {
class enable {
displayName = CSTRING(ModuleSettings_enable);
@@ -18,13 +19,13 @@ class CfgVehicles {
defaultValue = 1;
};
};
+
class ModuleDescription {
description = CSTRING(SettingsModule_Description);
sync[] = {};
};
};
-
class LandVehicle;
class Car: LandVehicle {
GVAR(space) = 4;
@@ -39,6 +40,7 @@ class CfgVehicles {
};*/
};
};
+
class Tank: LandVehicle {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
@@ -50,27 +52,154 @@ class CfgVehicles {
GVAR(hasCargo) = 1;
};
+ // hemets
+ class Truck_01_base_F: Truck_F {
+ GVAR(space) = 8;
+ };
+ class B_Truck_01_transport_F: Truck_01_base_F {
+ GVAR(space) = 20;
+ };
+ class B_Truck_01_covered_F: B_Truck_01_transport_F {
+ GVAR(space) = 20;
+ };
+ class B_Truck_01_mover_F: B_Truck_01_transport_F {
+ GVAR(space) = 4;
+ };
+ class B_Truck_01_box_F: B_Truck_01_mover_F {
+ GVAR(space) = 40;
+ };
+ class B_Truck_01_Repair_F: B_Truck_01_mover_F {
+ GVAR(space) = 20;
+ };
+ class B_Truck_01_ammo_F: B_Truck_01_mover_F {
+ GVAR(space) = 8;
+ };
+ class B_Truck_01_fuel_F: B_Truck_01_mover_F {
+ GVAR(space) = 4;
+ };
+ class B_Truck_01_medical_F: B_Truck_01_transport_F {
+ GVAR(space) = 8;
+ };
+
+ // kamaz'
+ class Truck_02_base_F: Truck_F { //covers "covered" variants
+ GVAR(space) = 20;
+ };
+ class Truck_02_transport_base_F: Truck_02_base_F {
+ GVAR(space) = 20;
+ };
+ class Truck_02_box_base_F: Truck_02_base_F { // repair variant, not actually cargo box like hemet
+ GVAR(space) = 12;
+ };
+ class Truck_02_medical_base_F: Truck_02_box_base_F {
+ GVAR(space) = 8;
+ };
+ class Truck_02_Ammo_base_F: Truck_02_base_F {
+ GVAR(space) = 12;
+ };
+ class Truck_02_fuel_base_F: Truck_02_base_F {
+ GVAR(space) = 4;
+ };
+
+ // typhoon
+ class Truck_03_base_F: Truck_F {
+ GVAR(space) = 8;
+ };
+ class O_Truck_03_transport_F: Truck_03_base_F {
+ GVAR(space) = 20;
+ };
+ class O_Truck_03_covered_F: Truck_03_base_F {
+ GVAR(space) = 20;
+ };
+ class O_Truck_03_repair_F: Truck_03_base_F {
+ GVAR(space) = 12;
+ };
+ class O_Truck_03_ammo_F: Truck_03_base_F {
+ GVAR(space) = 8;
+ };
+ class O_Truck_03_fuel_F: Truck_03_base_F {
+ GVAR(space) = 4;
+ };
+ class O_Truck_03_medical_F: Truck_03_base_F {
+ GVAR(space) = 8;
+ };
+ class O_Truck_03_device_F: Truck_03_base_F {
+ GVAR(space) = 4;
+ };
+
+ // civ trucks
+ class Van_01_base_F: Truck_F {
+ GVAR(space) = 8;
+ };
+ class Van_01_transport_base_F: Van_01_base_F {
+ GVAR(space) = 8;
+ };
+ class Van_01_box_base_F: Van_01_base_F { // repair variant, not actually cargo box like hemet
+ GVAR(space) = 12;
+ };
+ class Van_01_fuel_base_F: Van_01_base_F {
+ GVAR(space) = 4;
+ };
+
+ // misc. vehicles
+ class Quadbike_01_base_F: Car_F {
+ GVAR(space) = 0;
+ GVAR(hasCargo) = 0;
+ };
+
+ class Kart_01_Base_F: Car_F {
+ GVAR(space) = 0;
+ GVAR(hasCargo) = 0;
+ };
+
+ // helicopters
class Air;
class Helicopter: Air {
GVAR(space) = 8;
GVAR(hasCargo) = 1;
};
+
class Heli_Transport_02_base_F;
class I_Heli_Transport_02_F : Heli_Transport_02_base_F {
GVAR(space) = 20;
GVAR(hasCargo) = 1;
};
+
+ // jets
class Plane: Air {
- GVAR(space) = 4;
- GVAR(hasCargo) = 1;
+ GVAR(space) = 0;
+ GVAR(hasCargo) = 0;
};
+ // boats
class Ship;
class Ship_F: Ship {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
};
+ class Boat_Civil_01_base_F: Ship_F {
+ GVAR(space) = 4;
+ GVAR(hasCargo) = 1;
+ };
+
+ class Boat_F: Ship_F {};
+ class Rubber_duck_base_F: Boat_F {
+ GVAR(space) = 0;
+ GVAR(hasCargo) = 0;
+ };
+
+ class Boat_Armed_01_base_F: Boat_F {
+ GVAR(space) = 8;
+ GVAR(hasCargo) = 1;
+ };
+
+ // submarines
+ class SDV_01_base_F: Boat_F {
+ GVAR(space) = 0;
+ GVAR(hasCargo) = 0;
+ };
+
// Static weapons
class StaticWeapon: LandVehicle {
GVAR(size) = 2; // 1 = small, 2 = large
@@ -97,6 +226,7 @@ class CfgVehicles {
GVAR(size) = 11;
GVAR(canLoad) = 1;
XEH_ENABLED;
+
class ACE_Actions {
class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction);
@@ -114,6 +244,7 @@ class CfgVehicles {
GVAR(hasCargo) = 1;
GVAR(size) = 4;
GVAR(canLoad) = 1;
+
class ACE_Actions {
class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction);
@@ -165,12 +296,14 @@ class CfgVehicles {
GVAR(size) = 50;
XEH_ENABLED;
};
+
class Ruins_F;
class Land_Cargo20_military_ruins_F: Ruins_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
+
class Land_Cargo20_orange_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
@@ -202,7 +335,6 @@ class CfgVehicles {
XEH_ENABLED;
};
-
class Land_Cargo40_blue_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
@@ -238,11 +370,13 @@ class CfgVehicles {
GVAR(size) = 100;
XEH_ENABLED;
};
+
class Land_Cargo40_military_ruins_F: Ruins_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
+
class Land_Cargo40_orange_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
@@ -273,12 +407,14 @@ class CfgVehicles {
GVAR(size) = 100;
XEH_ENABLED;
};
+
// small
class Land_CargoBox_V1_F: ThingX {
GVAR(space) = 7;
GVAR(hasCargo) = 1;
GVAR(size) = 7;
XEH_ENABLED;
+
class ACE_Actions {
class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction);
@@ -290,5 +426,4 @@ class CfgVehicles {
};
};
};
-
};
diff --git a/addons/cargo/functions/fnc_addCargoItem.sqf b/addons/cargo/functions/fnc_addCargoItem.sqf
index 1233d0228d..9f349153c0 100644
--- a/addons/cargo/functions/fnc_addCargoItem.sqf
+++ b/addons/cargo/functions/fnc_addCargoItem.sqf
@@ -6,6 +6,7 @@
* 0: Item Classname
* 1: Vehicle
* 2: Amount (default: 1)
+ * 3: Show Hint (default: false)
*
* Return Value:
* None
@@ -18,7 +19,7 @@
#include "script_component.hpp"
private ["_position", "_item", "_i"];
-params ["_itemClass", "_vehicle", ["_amount", 1]];
+params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]] ];
TRACE_3("params",_itemClass,_vehicle,_amount);
_position = getPos _vehicle;
@@ -29,9 +30,11 @@ for "_i" from 1 to _amount do {
_item = createVehicle [_itemClass, _position, [], 0, "CAN_COLLIDE"];
// Load item or delete it if no space left
- if !([_item, _vehicle] call FUNC(loadItem)) exitWith {
+ if !([_item, _vehicle, _showHint] call FUNC(loadItem)) exitWith {
+ TRACE_1("no room to load item - deleting",_item);
deleteVehicle _item;
};
+ TRACE_1("Item Loaded",_item);
// Invoke listenable event
["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent);
diff --git a/addons/cargo/functions/fnc_canLoad.sqf b/addons/cargo/functions/fnc_canLoad.sqf
index f5d1304a95..f18ceb5835 100644
--- a/addons/cargo/functions/fnc_canLoad.sqf
+++ b/addons/cargo/functions/fnc_canLoad.sqf
@@ -31,4 +31,6 @@ if (_nearestVehicle isKindOf "Cargo_Base_F" || isNull _nearestVehicle) then {
if (isNull _nearestVehicle) exitWith {false};
+if ((locked _nearestVehicle) >= 2) exitWith {false};
+
[_object, _nearestVehicle] call FUNC(canLoadItemIn)
diff --git a/addons/cargo/functions/fnc_initVehicle.sqf b/addons/cargo/functions/fnc_initVehicle.sqf
index efb3b9a5cf..8857030cb7 100644
--- a/addons/cargo/functions/fnc_initVehicle.sqf
+++ b/addons/cargo/functions/fnc_initVehicle.sqf
@@ -25,7 +25,11 @@ _initializedClasses = GETMVAR(GVAR(initializedClasses),[]);
if (isServer) then {
{
if (isClass _x) then {
- ["AddCargoByClass", [getText (_x >> "type"), _vehicle, getNumber (_x >> "amount")]] call EFUNC(common,localEvent);
+ private ["_cargoClassname", "_cargoCount"];
+ _cargoClassname = getText (_x >> "type");
+ _cargoCount = getNumber (_x >> "amount");
+ TRACE_3("adding ACE_Cargo", (configName _x), _cargoClassname, _cargoCount);
+ ["AddCargoByClass", [_cargoClassname, _vehicle, _cargoCount]] call EFUNC(common,localEvent);
};
} count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo"));
};
@@ -41,7 +45,7 @@ if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) ex
private ["_text", "_condition", "_statement", "_icon", "_action"];
_condition = {
params ["_target", "_player"];
- GVAR(enable) && {locked _target < 2} && {[_player, _target, []] call EFUNC(common,canInteractWith)}
+ GVAR(enable) && {locked _target < 2} && {alive _target} && {[_player, _target, []] call EFUNC(common,canInteractWith)}
};
_text = localize LSTRING(openMenu);
_statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);};
diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf
index cf81bdbe6c..11e7638f1b 100644
--- a/addons/cargo/functions/fnc_loadItem.sqf
+++ b/addons/cargo/functions/fnc_loadItem.sqf
@@ -5,6 +5,7 @@
* Arguments:
* 0: Object
* 1: Vehicle
+ * 2: Show Hint (default: true)
*
* Return value:
* Object loaded
@@ -18,14 +19,20 @@
private ["_loaded", "_space", "_itemSize"];
-params ["_item", "_vehicle"];
+params ["_item", "_vehicle", ["_showHint", true, [true]] ];
+TRACE_2("params",_item,_vehicle);
-if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false};
+if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {
+ TRACE_2("canLoadItemIn failed",_item,_vehicle);
+ false
+};
_loaded = _vehicle getVariable [QGVAR(loaded), []];
_loaded pushback _item;
_vehicle setVariable [QGVAR(loaded), _loaded, true];
+TRACE_1("added to loaded array",_loaded);
+
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
_itemSize = [_item] call FUNC(getSizeItem);
_vehicle setVariable [QGVAR(space), _space - _itemSize, true];
@@ -34,6 +41,16 @@ detach _item;
_item attachTo [_vehicle,[0,0,100]];
["hideObjectGlobal", [_item, true]] call EFUNC(common,serverEvent);
+// show hint
+private ["_itemName", "_vehicleName"];
+
+_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
+_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
+
+if (_showHint) then {
+ ["displayTextStructured", [[localize LSTRING(LoadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
+};
+
// Invoke listenable event
["cargoLoaded", [_item, _vehicle]] call EFUNC(common,globalEvent);
diff --git a/addons/cargo/functions/fnc_moduleSettings.sqf b/addons/cargo/functions/fnc_moduleSettings.sqf
index 35e6aede7a..2027fb4bbb 100644
--- a/addons/cargo/functions/fnc_moduleSettings.sqf
+++ b/addons/cargo/functions/fnc_moduleSettings.sqf
@@ -25,4 +25,4 @@ if (!_activated) exitWith {};
[_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule);
-diag_log text "[ACE]: Cargo Module Initialized.";
+ACE_LOGINFO("Cargo Module Initialized.");
diff --git a/addons/cargo/functions/fnc_unloadItem.sqf b/addons/cargo/functions/fnc_unloadItem.sqf
index 1390a8c20d..2630f2104a 100644
--- a/addons/cargo/functions/fnc_unloadItem.sqf
+++ b/addons/cargo/functions/fnc_unloadItem.sqf
@@ -60,6 +60,14 @@ detach _item;
_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent);
+// show hint
+private ["_itemName", "_vehicleName"];
+
+_itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName");
+_vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName");
+
+["displayTextStructured", [[localize LSTRING(UnloadedItem), _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent);
+
// TOOO maybe drag/carry the unloaded item?
// Invoke listenable event
diff --git a/addons/cargo/script_component.hpp b/addons/cargo/script_component.hpp
index 9716d7a536..3f4d6c5d51 100644
--- a/addons/cargo/script_component.hpp
+++ b/addons/cargo/script_component.hpp
@@ -1,6 +1,8 @@
#define COMPONENT cargo
#include "\z\ace\addons\main\script_mod.hpp"
+// #define DEBUG_MODE_FULL
+
#ifdef DEBUG_ENABLED_CARGO
#define DEBUG_MODE_FULL
#endif
diff --git a/addons/cargo/stringtable.xml b/addons/cargo/stringtable.xml
index a39fb16f6f..7f9ac40a15 100644
--- a/addons/cargo/stringtable.xml
+++ b/addons/cargo/stringtable.xml
@@ -4,38 +4,96 @@
Load
Załaduj
+ Carregar
+ Загрузить
+ Naložit
+ Cargar
Unload
Wyładuj
+ Descarregar
+ Выгрузить
+ Vyložit
+ Descargar
Cargo space left: %1
Pozostałe miejsce: %1
+ Espaço de carga restante: %1
+ Осталось мест: %1
+ Volný prostor: %1
+ Espacio de carga restante: %1
Enable Cargo
Aktywuj cargo
+ Ativar carga
+ Включить модуль перевозки грузов
+ Povolit náklad
+ Habilitar carga
Enable the load in cargo module
Aktywuj możliwość załadunku skrzyń i przedmiotów do pojazdów.
+ Ativar o módulo de carregamento de carga
+ Включает модуль погрузки и перевозки грузов
+ Habilitar la carga en el módulo de carga
Cargo Settings
Ustawienia cargo
+ Preferências de carregamento
+ Перевозка грузов
+ Nastavení nákladu
+ Ajustes de carga
Configure the cargo module settings
Skonfiguruj ustawienia modułu cargo.
+ Configura as preferências do módulo de carga
+ Конфигурирует настройки модуля перевозки грузов
+ Configure los ajustes del módulo de carga
+
+
+ %1<br/>loaded into<br/>%2
+ %1<br/>cargado en<br/>%2
+ %1<br/>chargé dans<br/>%2
+ %1<br/>in<br/>%2 verladen
+ %1<br/>załadowano do<br/>%2
+ %1<br/>naloženo do<br/>%2
+ %1<br/>carregado em<br/>%2
+ %1<br/>caricato su<br/>%2
+ %1<br/>berakodva ide:<br/>%2
+ %1<br/>загружен в<br/>%2
+
+
+ Unloaded<br/>%1 from<br/>%2
+ %1<br/>von<br/>%2 abgeladen
+ Descargado/a<br/>%1 de<br/>%2
+ Déchargé<br/>%1 de<br/>%2
+ %1<br/>rozładowano z<br/>%2
+ Nezatížený<br/>%1 do<br/>%2
+ %1<br/>descarregado de<br/>%2
+ Hai scaricato<br/>%1 da<br/>%2
+ 1%<br/>kirakodva ebből:<br/>%2
+ %1<br/>разгружен из<br/>%2
-
\ No newline at end of file
+
diff --git a/addons/common/CfgVehicles.hpp b/addons/common/CfgVehicles.hpp
index 69d6f99924..7c5c9295f9 100644
--- a/addons/common/CfgVehicles.hpp
+++ b/addons/common/CfgVehicles.hpp
@@ -140,4 +140,10 @@ class CfgVehicles {
isBicycle = 1;
XEH_DISABLED;
};
+
+ class Bag_Base;
+ class ACE_FakeBackpack: Bag_Base {
+ scope = 1;
+ maximumLoad = 1E6;
+ };
};
diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf
index 4a194e0fe9..912acce7c4 100644
--- a/addons/common/XEH_postInit.sqf
+++ b/addons/common/XEH_postInit.sqf
@@ -1,16 +1,18 @@
// ACE - Common
-
-// #define ENABLE_PERFORMANCE_COUNTERS
#include "script_component.hpp"
-//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent");
+// #define ENABLE_PERFORMANCE_COUNTERS
-//Singe PFEH to handle execNextFrame and waitAndExec:
+//////////////////////////////////////////////////
+// PFHs
+//////////////////////////////////////////////////
+
+//Singe PFEH to handle execNextFrame, waitAndExec and waitUntilAndExec:
[{
- private ["_entry"];
+ private ["_entry", "_deleted"];
//Handle the waitAndExec array:
- while {((count GVAR(waitAndExecArray)) > 0) && {((GVAR(waitAndExecArray) select 0) select 0) <= ACE_Time}} do {
+ while {!(GVAR(waitAndExecArray) isEqualTo []) && {GVAR(waitAndExecArray) select 0 select 0 <= ACE_Time}} do {
_entry = GVAR(waitAndExecArray) deleteAt 0;
(_entry select 2) call (_entry select 1);
};
@@ -18,47 +20,68 @@
//Handle the execNextFrame array:
{
(_x select 0) call (_x select 1);
- } forEach GVAR(nextFrameBufferA);
+ false
+ } count GVAR(nextFrameBufferA);
+
//Swap double-buffer:
GVAR(nextFrameBufferA) = GVAR(nextFrameBufferB);
GVAR(nextFrameBufferB) = [];
GVAR(nextFrameNo) = diag_frameno + 1;
+
+ //Handle the waitUntilAndExec array:
+ _deleted = 0;
+ {
+ // if condition is satisifed call statement
+ if ((_x select 2) call (_x select 0)) then {
+ // make sure to delete the correct handle when multiple conditions are met in one frame
+ GVAR(waitUntilAndExecArray) deleteAt (_forEachIndex - _deleted);
+ _deleted = _deleted + 1;
+ (_x select 2) call (_x select 1);
+ };
+ } forEach GVAR(waitUntilAndExecArray);
}, 0, []] call CBA_fnc_addPerFrameHandler;
-// Listens for global "SettingChanged" events, to update the force status locally
-["SettingChanged", {
- PARAMS_2(_name,_value);
- if !(count _this > 2) exitWith {};
- private ["_force", "_settingData"];
- _force = _this select 2;
- if (_force) then {
- _settingData = [_name] call FUNC(getSettingData);
- if (count _settingData == 0) exitWith {};
- _settingData set [6,_force];
- };
-}] call FUNC(addEventhandler);
+//////////////////////////////////////////////////
+// Get Map Data
+//////////////////////////////////////////////////
-
-["HeadbugFixUsed", {
- PARAMS_2(_profileName,_animation);
- diag_log text format ["[ACE] Headbug Used: Name: %1, Animation: %2", _profileName, _animation];
-}] call FUNC(addEventHandler);
-
-
-//~~~~~Get Map Data~~~~~
//Find MGRS zone and 100km grid for current map
[] call FUNC(getMGRSdata);
//Prepare variables for FUNC(getMapGridFromPos)/FUNC(getMapPosFromGrid)
[] call FUNC(getMapGridData);
+//////////////////////////////////////////////////
+// Eventhandlers
+//////////////////////////////////////////////////
-["fixCollision", DFUNC(fixCollision)] call FUNC(addEventhandler);
-["fixFloating", DFUNC(fixFloating)] call FUNC(addEventhandler);
-["fixPosition", DFUNC(fixPosition)] call FUNC(addEventhandler);
+// Listens for global "SettingChanged" events, to update the force status locally
+["SettingChanged", {
+ params ["_name", "_value", "_force"];
-["unloadPersonEvent", DFUNC(unloadPersonLocal)] call FUNC(addEventhandler);
+ if (_force) then {
+ private "_settingData";
+ _settingData = [_name] call FUNC(getSettingData);
+
+ if (_settingData isEqualTo []) exitWith {};
+
+ _settingData set [6, _force];
+ };
+}] call FUNC(addEventhandler);
+
+
+// Event to log Fix Headbug output
+["HeadbugFixUsed", {
+ params ["_profileName", "_animation"];
+ ACE_LOGINFO_2("Headbug Used: Name: %1, Animation: %2",_profileName,_animation);
+}] call FUNC(addEventHandler);
+
+["fixCollision", FUNC(fixCollision)] call FUNC(addEventhandler);
+["fixFloating", FUNC(fixFloating)] call FUNC(addEventhandler);
+["fixPosition", FUNC(fixPosition)] call FUNC(addEventhandler);
+
+["unloadPersonEvent", FUNC(unloadPersonLocal)] call FUNC(addEventhandler);
["lockVehicle", {
_this setVariable [QGVAR(lockStatus), locked _this];
@@ -72,69 +95,102 @@
["setDir", {(_this select 0) setDir (_this select 1)}] call FUNC(addEventhandler);
["setFuel", {(_this select 0) setFuel (_this select 1)}] call FUNC(addEventhandler);
["setSpeaker", {(_this select 0) setSpeaker (_this select 1)}] call FUNC(addEventhandler);
+["selectLeader", {(_this select 0) selectLeader (_this select 1)}] call FUNC(addEventHandler);
+["assignTeam", {(_this select 0) assignTeam (_this select 1)}] call FUNC(addEventHandler);
+["setVelocity", {(_this select 0) setVelocity (_this select 1)}] call FUNC(addEventHandler);
if (isServer) then {
["hideObjectGlobal", {(_this select 0) hideObjectGlobal (_this select 1)}] call FUNC(addEventHandler);
+ ["enableSimulationGlobal", {(_this select 0) enableSimulationGlobal (_this select 1)}] call FUNC(addEventHandler);
};
+
+//////////////////////////////////////////////////
+// Set up remote execution
+//////////////////////////////////////////////////
+
+// ACE events
+"ACEg" addPublicVariableEventHandler {_this call FUNC(_handleNetEvent)};
+"ACEc" addPublicVariableEventHandler {_this call FUNC(_handleNetEvent)};
+
+// Synced ACE events
+// Handle JIP scenario
+if (!isServer) then {
+ ["PlayerJip", {
+ ACE_LOGINFO("JIP event synchronization initialized");
+ ["SEH_all", [player]] call FUNC(serverEvent);
+ }] call FUNC(addEventHandler);
+} else {
+ ["SEH_all", FUNC(_handleRequestAllSyncedEvents)] call FUNC(addEventHandler);
+};
+
+["SEH", FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
+["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler);
+
+if (isServer) then {
+ [FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler;
+};
+
+// @todo deprecated
QGVAR(remoteFnc) addPublicVariableEventHandler {
(_this select 1) call FUNC(execRemoteFnc);
};
+// @todo figure out what this does.
[missionNamespace] call FUNC(executePersistent);
+
+//////////////////////////////////////////////////
+// Check files, previous installed version etc.
+//////////////////////////////////////////////////
+
private ["_currentVersion", "_previousVersion"];
-// check previous version number from profile
+
_currentVersion = getText (configFile >> "CfgPatches" >> QUOTE(ADDON) >> "version");
_previousVersion = profileNamespace getVariable ["ACE_VersionNumberString", ""];
+// check previous version number from profile
if (_currentVersion != _previousVersion) then {
// do something
profileNamespace setVariable ["ACE_VersionNumberString", _currentVersion];
};
-// ACE events
-"ACEg" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
-"ACEc" addPublicVariableEventHandler { _this call FUNC(_handleNetEvent); };
-
-// Synced ACE events
-// Handle JIP scenario
-if(!isServer) then {
- ["PlayerJip", {
- diag_log text format["[ACE] * JIP event synchronization initialized"];
- ["SEH_all", [player]] call FUNC(serverEvent);
- }] call FUNC(addEventHandler);
-} else {
- ["SEH_all", FUNC(_handleRequestAllSyncedEvents)] call FUNC(addEventHandler);
-};
-["SEH", FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
-["SEH_s", FUNC(_handleRequestSyncedEvent)] call FUNC(addEventHandler);
-if (isServer) then {
- [FUNC(syncedEventPFH), 0.5, []] call CBA_fnc_addPerFrameHandler;
-};
-
call FUNC(checkFiles);
+//////////////////////////////////////////////////
+// Set up SettingsInitialized eventhandler
+//////////////////////////////////////////////////
+
+["SettingsInitialized", {
+ [
+ GVAR(checkPBOsAction),
+ GVAR(checkPBOsCheckAll),
+ call compile GVAR(checkPBOsWhitelist)
+ ] call FUNC(checkPBOs)
+}] call FUNC(addEventHandler);
+
// Create a pfh to wait until all postinits are ready and settings are initialized
[{
- PARAMS_1(_args);
- EXPLODE_1_PVT(_args,_waitingMsgSent);
+ params ["_args"];
+
+ _args params ["_waitingMsgSent"];
+
// If post inits are not ready then wait
if !(SLX_XEH_MACHINE select 8) exitWith {};
// If settings are not initialized then wait
- if (isNil QGVAR(settings) || {(!isServer) && (isNil QEGVAR(modules,serverModulesRead))}) exitWith {
- if (!_waitingMsgSent) then {
+ if (isNil QGVAR(settings) || {!isServer && isNil QEGVAR(modules,serverModulesRead)}) exitWith {
+ if !(_waitingMsgSent) then {
_args set [0, true];
- diag_log text format["[ACE] Waiting on settings from server"];
+ ACE_LOGINFO("Waiting on settings from server...");
};
};
- [(_this select 1)] call cba_fnc_removePerFrameHandler;
+ [_this select 1] call CBA_fnc_removePerFrameHandler;
- diag_log text format["[ACE] Settings received from server"];
+ ACE_LOGINFO("Settings received from server.");
// Event so that ACE_Modules have their settings loaded:
["InitSettingsFromModules", []] call FUNC(localEvent);
@@ -145,237 +201,300 @@ call FUNC(checkFiles);
call FUNC(loadSettingsLocalizedText);
};
- diag_log text format["[ACE] Settings initialized"];
+ ACE_LOGINFO("Settings initialized.");
//Event that settings are safe to use:
["SettingsInitialized", []] call FUNC(localEvent);
//Set init finished and run all delayed functions:
GVAR(settingsInitFinished) = true;
- diag_log text format ["[ACE] %1 delayed functions running", (count GVAR(runAtSettingsInitialized))];
+ ACE_LOGINFO_1("%1 delayed functions running.",count GVAR(runAtSettingsInitialized));
+
{
- _x params ["_func", "_params"];
- _params call _func;
- } forEach GVAR(runAtSettingsInitialized);
+ (_x select 1) call (_x select 0);
+ false
+ } count GVAR(runAtSettingsInitialized);
+
GVAR(runAtSettingsInitialized) = nil; //cleanup
-
}, 0, [false]] call CBA_fnc_addPerFrameHandler;
-["SettingsInitialized", {
- [
- GVAR(checkPBOsAction),
- GVAR(checkPBOsCheckAll),
- call compile GVAR(checkPBOsWhitelist)
- ] call FUNC(checkPBOs)
-}] call FUNC(addEventHandler);
+/***************************************************************************/
+/***************************************************************************/
+/** everything that only player controlled machines need, goes below this **/
+/***************************************************************************/
+/***************************************************************************/
-
-/***************************************************************/
-/***************************************************************/
-/***************************************************************/
-/***************************************************************/
-/***************************************************************/
-
-// everything that only player controlled machines need, goes below this
if (!hasInterface) exitWith {};
-call COMPILE_FILE(scripts\assignedItemFix);
-call COMPILE_FILE(scripts\initScrollWheel);
+//////////////////////////////////////////////////
+// Set up mouse wheel eventhandler
+//////////////////////////////////////////////////
-DFUNC(mouseZHandler) = {
- waitUntil {!isNull (findDisplay 46)}; sleep 0.1;
- findDisplay 46 displayAddEventHandler ["MouseZChanged", QUOTE( _this call GVAR(onScrollWheel) )];
- [false] call FUNC(disableUserInput);
+call FUNC(assignedItemFix);
+
+GVAR(ScrollWheelFrame) = diag_frameno;
+
+["mainDisplayLoaded", {
+ [{
+ call FUNC(handleScrollWheelInit);
+ call FUNC(handleModifierKeyInit);
+ }, [], 0.1] call FUNC(waitAndExecute); // needs delay, otherwise doesn't work without pressing "RESTART" in editor once. Tested in 1.52RC
+}] call FUNC(addEventHandler);
+
+// add PFH to execute event that fires when the main display (46) is created
+private "_fnc_initMainDisplayCheck";
+_fnc_initMainDisplayCheck = {
+ [{
+ if !(isNull findDisplay 46) then {
+ // Raise ACE event locally
+ ["mainDisplayLoaded", [findDisplay 46]] call FUNC(localEvent);
+ [_this select 1] call CBA_fnc_removePerFrameHandler;
+ };
+ }, 0, []] call CBA_fnc_addPerFrameHandler;
};
-addMissionEventHandler ["Loaded", {[] spawn FUNC(mouseZHandler)}];
-[] spawn FUNC(mouseZHandler);
+call _fnc_initMainDisplayCheck;
+// repeat this every time a savegame is loaded
+addMissionEventHandler ["Loaded", _fnc_initMainDisplayCheck];
+// @todo remove?
enableCamShake true;
+
+//////////////////////////////////////////////////
+// Eventhandler to set player names
+//////////////////////////////////////////////////
+
// Set the name for the current player
["playerChanged", {
- EXPLODE_2_PVT(_this,_newPlayer,_oldPlayer);
+ params ["_newPlayer","_oldPlayer"];
if (alive _newPlayer) then {
- [_newPlayer] call FUNC(setName)
- };
- if (alive _oldPlayer) then {
- [_oldPlayer] call FUNC(setName)
+ [_newPlayer] call FUNC(setName);
};
+ if (alive _oldPlayer) then {
+ [_oldPlayer] call FUNC(setName);
+ };
}] call FUNC(addEventhandler);
-GVAR(OldPlayerInventory) = [ACE_player] call FUNC(getAllGear);
-GVAR(OldPlayerVisionMode) = currentVisionMode ACE_player;
-GVAR(OldZeusDisplayIsOpen) = !(isNull findDisplay 312);
-GVAR(OldCameraView) = cameraView;
-GVAR(OldPlayerVehicle) = vehicle ACE_player;
-GVAR(OldPlayerTurret) = [ACE_player] call FUNC(getTurretIndex);
-GVAR(OldPlayerWeapon) = currentWeapon ACE_player;
+
+//////////////////////////////////////////////////
+// Set up numerous eventhanders for player controlled units
+//////////////////////////////////////////////////
+
+// default variables
+GVAR(OldPlayerVehicle) = vehicle objNull;
+GVAR(OldPlayerTurret) = [objNull] call FUNC(getTurretIndex);
+GVAR(OldPlayerWeapon) = currentWeapon objNull;
+GVAR(OldPlayerInventory) = [objNull] call FUNC(getAllGear);
+GVAR(OldPlayerVisionMode) = currentVisionMode objNull;
+GVAR(OldCameraView) = "";
GVAR(OldVisibleMap) = false;
+GVAR(OldInventoryDisplayIsOpen) = nil; //@todo check this
+GVAR(OldZeusDisplayIsOpen) = false;
+GVAR(OldIsCamera) = false;
+
+// clean up playerChanged eventhandler from preinit and put it in the same PFH as the other events to reduce overhead and guarantee advantageous execution order
+if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then {
+ [GVAR(PreInit_playerChanged_PFHID)] call CBA_fnc_removePerFrameHandler;
+ GVAR(PreInit_playerChanged_PFHID) = nil;
+};
// PFH to raise varios events
[{
BEGIN_COUNTER(stateChecker);
- private ["_newCameraView", "_newInventoryDisplayIsOpen", "_newPlayerInventory", "_newPlayerTurret", "_newPlayerVehicle", "_newPlayerVisionMode", "_newPlayerWeapon", "_newZeusDisplayIsOpen", "_newVisibleMap"];
- // "playerInventoryChanged" event
- _newPlayerInventory = [ACE_player] call FUNC(getAllGear);
- if !(_newPlayerInventory isEqualTo GVAR(OldPlayerInventory)) then {
- // Raise ACE event locally
- GVAR(OldPlayerInventory) = _newPlayerInventory;
- ["playerInventoryChanged", [ACE_player, _newPlayerInventory]] call FUNC(localEvent);
- };
+ private "_data"; // reuse one variable to reduce number of variables that have to be set to private each frame
- // "playerVisionModeChanged" event
- _newPlayerVisionMode = currentVisionMode ACE_player;
- if !(_newPlayerVisionMode isEqualTo GVAR(OldPlayerVisionMode)) then {
- // Raise ACE event locally
- GVAR(OldPlayerVisionMode) = _newPlayerVisionMode;
- ["playerVisionModeChanged", [ACE_player, _newPlayerVisionMode]] call FUNC(localEvent);
- };
+ // "playerChanged" event
+ _data = call FUNC(player);
+ if !(_data isEqualTo ACE_player) then {
+ private "_oldPlayer";
+ _oldPlayer = ACE_player;
- // "inventoryDisplayChanged" event
- _newInventoryDisplayIsOpen = !(isNull findDisplay 602);
- if !(_newInventoryDisplayIsOpen isEqualTo GVAR(OldInventoryDisplayIsOpen)) then {
- // Raise ACE event locally
- GVAR(OldInventoryDisplayIsOpen) = _newInventoryDisplayIsOpen;
- ["inventoryDisplayChanged", [ACE_player, _newInventoryDisplayIsOpen]] call FUNC(localEvent);
- };
+ ACE_player = _data;
+ uiNamespace setVariable ["ACE_player", _data];
- // "zeusDisplayChanged" event
- _newZeusDisplayIsOpen = !(isNull findDisplay 312);
- if !(_newZeusDisplayIsOpen isEqualTo GVAR(OldZeusDisplayIsOpen)) then {
// Raise ACE event locally
- GVAR(OldZeusDisplayIsOpen) = _newZeusDisplayIsOpen;
- ["zeusDisplayChanged", [ACE_player, _newZeusDisplayIsOpen]] call FUNC(localEvent);
- };
-
- // "cameraViewChanged" event
- _newCameraView = cameraView;
- if !(_newCameraView isEqualTo GVAR(OldCameraView)) then {
- // Raise ACE event locally
- GVAR(OldCameraView) = _newCameraView;
- ["cameraViewChanged", [ACE_player, _newCameraView]] call FUNC(localEvent);
+ ["playerChanged", [ACE_player, _oldPlayer]] call FUNC(localEvent);
};
// "playerVehicleChanged" event
- _newPlayerVehicle = vehicle ACE_player;
- if !(_newPlayerVehicle isEqualTo GVAR(OldPlayerVehicle)) then {
+ _data = vehicle ACE_player;
+ if !(_data isEqualTo GVAR(OldPlayerVehicle)) then {
// Raise ACE event locally
- GVAR(OldPlayerVehicle) = _newPlayerVehicle;
- ["playerVehicleChanged", [ACE_player, _newPlayerVehicle]] call FUNC(localEvent);
+ GVAR(OldPlayerVehicle) = _data;
+ ["playerVehicleChanged", [ACE_player, _data]] call FUNC(localEvent);
};
// "playerTurretChanged" event
- _newPlayerTurret = [ACE_player] call FUNC(getTurretIndex);
- if !(_newPlayerTurret isEqualTo GVAR(OldPlayerTurret)) then {
+ _data = [ACE_player] call FUNC(getTurretIndex);
+ if !(_data isEqualTo GVAR(OldPlayerTurret)) then {
// Raise ACE event locally
- GVAR(OldPlayerTurret) = _newPlayerTurret;
- ["playerTurretChanged", [ACE_player, _newPlayerTurret]] call FUNC(localEvent);
+ GVAR(OldPlayerTurret) = _data;
+ ["playerTurretChanged", [ACE_player, _data]] call FUNC(localEvent);
};
// "playerWeaponChanged" event
- _newPlayerWeapon = currentWeapon ACE_player;
- if (_newPlayerWeapon != GVAR(OldPlayerWeapon)) then {
+ _data = currentWeapon ACE_player;
+ if (_data != GVAR(OldPlayerWeapon)) then {
// Raise ACE event locally
- GVAR(OldPlayerWeapon) = _newPlayerWeapon;
- ["playerWeaponChanged", [ACE_player, _newPlayerWeapon]] call FUNC(localEvent);
+ GVAR(OldPlayerWeapon) = _data;
+ ["playerWeaponChanged", [ACE_player, _data]] call FUNC(localEvent);
};
-
+
+ // "playerInventoryChanged" event
+ _data = [ACE_player] call FUNC(getAllGear);
+ if !(_data isEqualTo GVAR(OldPlayerInventory)) then {
+ // Raise ACE event locally
+ GVAR(OldPlayerInventory) = _data;
+ ["playerInventoryChanged", [ACE_player, _data]] call FUNC(localEvent);
+ };
+
+ // "playerVisionModeChanged" event
+ _data = currentVisionMode ACE_player;
+ if !(_data isEqualTo GVAR(OldPlayerVisionMode)) then {
+ // Raise ACE event locally
+ GVAR(OldPlayerVisionMode) = _data;
+ ["playerVisionModeChanged", [ACE_player, _data]] call FUNC(localEvent);
+ };
+
+ // "cameraViewChanged" event
+ _data = cameraView;
+ if !(_data isEqualTo GVAR(OldCameraView)) then {
+ // Raise ACE event locally
+ GVAR(OldCameraView) = _data;
+ ["cameraViewChanged", [ACE_player, _data]] call FUNC(localEvent);
+ };
+
// "visibleMapChanged" event
- _newVisibleMap = visibleMap;
- if (!_newVisibleMap isEqualTo GVAR(OldVisibleMap)) then {
+ _data = visibleMap;
+ if (!_data isEqualTo GVAR(OldVisibleMap)) then {
// Raise ACE event locally
- GVAR(OldVisibleMap) = _newVisibleMap;
- ["visibleMapChanged", [ACE_player, _newVisibleMap]] call FUNC(localEvent);
+ GVAR(OldVisibleMap) = _data;
+ ["visibleMapChanged", [ACE_player, _data]] call FUNC(localEvent);
};
-
+
+ // "inventoryDisplayChanged" event
+ _data = !(isNull findDisplay 602);
+ if !(_data isEqualTo GVAR(OldInventoryDisplayIsOpen)) then {
+ // Raise ACE event locally
+ GVAR(OldInventoryDisplayIsOpen) = _data;
+ ["inventoryDisplayChanged", [ACE_player, _data]] call FUNC(localEvent);
+ };
+
+ // "zeusDisplayChanged" event
+ _data = !(isNull findDisplay 312);
+ if !(_data isEqualTo GVAR(OldZeusDisplayIsOpen)) then {
+ // Raise ACE event locally
+ GVAR(OldZeusDisplayIsOpen) = _data;
+ ["zeusDisplayChanged", [ACE_player, _data]] call FUNC(localEvent);
+ };
+
+ // "activeCameraChanged" event
+ _data = call FUNC(isfeatureCameraActive);
+ if !(_data isEqualTo GVAR(OldIsCamera)) then {
+ // Raise ACE event locally
+ GVAR(OldIsCamera) = _data;
+ ["activeCameraChanged", [ACE_player, _data]] call FUNC(localEvent);
+ };
+
END_COUNTER(stateChecker);
-
}, 0, []] call CBA_fnc_addPerFrameHandler;
-GVAR(OldIsCamera) = false;
+//////////////////////////////////////////////////
+// Eventhandlers for player controlled machines
+//////////////////////////////////////////////////
-[{
+// @todo still needed?
+[QGVAR(StateArrested), false, true, QUOTE(ADDON)] call FUNC(defineVariable);
- // "activeCameraChanged" event
- private ["_isCamera"];
- _isCamera = call FUNC(isfeatureCameraActive);
- if !(_isCamera isEqualTo GVAR(OldIsCamera)) then {
- // Raise ACE event locally
- GVAR(OldIsCamera) = _isCamera;
- ["activeCameraChanged", [ACE_player, _isCamera]] call FUNC(localEvent);
+["displayTextStructured", {_this call FUNC(displayTextStructured)}] call FUNC(addEventhandler);
+["displayTextPicture", {_this call FUNC(displayTextPicture)}] call FUNC(addEventhandler);
+
+["medical_onUnconscious", {
+ params ["_unit", "_isUnconscious"];
+
+ if (local _unit && {!_isUnconscious}) then {
+ [_unit, false, QFUNC(loadPerson), west /* dummy side */] call FUNC(switchToGroupSide);
};
-
-}, 1, []] call CBA_fnc_addPerFrameHandler; // feel free to decrease the sleep ACE_time if you need it.
+}] call FUNC(addEventhandler);
-[QGVAR(StateArrested),false,true,QUOTE(ADDON)] call FUNC(defineVariable);
-
-["displayTextStructured", FUNC(displayTextStructured)] call FUNC(addEventhandler);
-["displayTextPicture", FUNC(displayTextPicture)] call FUNC(addEventhandler);
-["medical_onUnconscious", {if (local (_this select 0) && {!(_this select 1)}) then {[ _this select 0, false, QUOTE(FUNC(loadPerson)), west /* dummy side */] call FUNC(switchToGroupSide);};}] call FUNC(addEventhandler);
+//////////////////////////////////////////////////
+// Add various canInteractWith conditions
+//////////////////////////////////////////////////
["notOnMap", {!visibleMap}] call FUNC(addCanInteractWithCondition);
+
["isNotInside", {
+ params ["_unit", "_target"];
+
// Players can always interact with himself if not boarded
- vehicle (_this select 0) == (_this select 0) ||
+ vehicle _unit == _unit ||
// Players can always interact with his vehicle
- {vehicle (_this select 0) == (_this select 1)} ||
+ {vehicle _unit == _target} ||
// Players can always interact with passengers of the same vehicle
- {!((_this select 0) isEqualTo (_this select 1)) && {vehicle (_this select 0) == vehicle (_this select 1)}}
+ {_unit != _target && {vehicle _unit == vehicle _target}}
}] call FUNC(addCanInteractWithCondition);
+
+//////////////////////////////////////////////////
+// Set up PlayerJIP eventhandler
+//////////////////////////////////////////////////
+
// Lastly, do JIP events
// JIP Detection and event trigger. Run this at the very end, just in case anything uses it
+// Note: usage of player is most likely on purpose
if (didJip) then {
// We are jipping! Get ready and wait, and throw the event
[{
- if((!(isNull player)) && GVAR(settingsInitFinished)) then {
- ["PlayerJip", [player] ] call FUNC(localEvent);
- [(_this select 1)] call cba_fnc_removePerFrameHandler;
+ if(!isNull player && GVAR(settingsInitFinished)) then {
+ ["PlayerJip", [player]] call FUNC(localEvent);
+ [_this select 1] call CBA_fnc_removePerFrameHandler;
};
}, 0, []] call CBA_fnc_addPerFrameHandler;
};
+
+//////////////////////////////////////////////////
+// CBA key input handling
+//////////////////////////////////////////////////
+
//Device Handler:
GVAR(deviceKeyHandlingArray) = [];
GVAR(deviceKeyCurrentIndex) = -1;
// Register localizations for the Keybinding categories
-["ACE3 Equipment", localize LSTRING(ACEKeybindCategoryEquipment)] call cba_fnc_registerKeybindModPrettyName;
-["ACE3 Common", localize LSTRING(ACEKeybindCategoryCommon)] call cba_fnc_registerKeybindModPrettyName;
-["ACE3 Weapons", localize LSTRING(ACEKeybindCategoryWeapons)] call cba_fnc_registerKeybindModPrettyName;
-["ACE3 Movement", localize LSTRING(ACEKeybindCategoryMovement)] call cba_fnc_registerKeybindModPrettyName;
-["ACE3 Scope Adjustment", localize LSTRING(ACEKeybindCategoryScopeAdjustment)] call cba_fnc_registerKeybindModPrettyName;
-["ACE3 Vehicles", localize LSTRING(ACEKeybindCategoryVehicles)] call cba_fnc_registerKeybindModPrettyName;
+["ACE3 Equipment", localize LSTRING(ACEKeybindCategoryEquipment)] call CBA_fnc_registerKeybindModPrettyName;
+["ACE3 Common", localize LSTRING(ACEKeybindCategoryCommon)] call CBA_fnc_registerKeybindModPrettyName;
+["ACE3 Weapons", localize LSTRING(ACEKeybindCategoryWeapons)] call CBA_fnc_registerKeybindModPrettyName;
+["ACE3 Movement", localize LSTRING(ACEKeybindCategoryMovement)] call CBA_fnc_registerKeybindModPrettyName;
+["ACE3 Scope Adjustment", localize LSTRING(ACEKeybindCategoryScopeAdjustment)] call CBA_fnc_registerKeybindModPrettyName;
+["ACE3 Vehicles", localize LSTRING(ACEKeybindCategoryVehicles)] call CBA_fnc_registerKeybindModPrettyName;
-["ACE3 Equipment", QGVAR(openDevice), (localize "STR_ACE_Common_toggleHandheldDevice"),
-{
+["ACE3 Equipment", QGVAR(openDevice), (localize "STR_ACE_Common_toggleHandheldDevice"), {
[] call FUNC(deviceKeyFindValidIndex);
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
[] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 3);
true
},
{false},
-[0xC7, [false, false, false]], false] call cba_fnc_addKeybind; //Home Key
+[0xC7, [false, false, false]], false] call CBA_fnc_addKeybind; //Home Key
-["ACE3 Equipment", QGVAR(closeDevice), (localize "STR_ACE_Common_closeHandheldDevice"),
-{
+["ACE3 Equipment", QGVAR(closeDevice), (localize "STR_ACE_Common_closeHandheldDevice"), {
[] call FUNC(deviceKeyFindValidIndex);
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
[] call ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 4);
true
},
{false},
-[0xC7, [false, true, false]], false] call cba_fnc_addKeybind; //CTRL + Home Key
+[0xC7, [false, true, false]], false] call CBA_fnc_addKeybind; //CTRL + Home Key
-["ACE3 Equipment", QGVAR(cycleDevice), (localize "STR_ACE_Common_cycleHandheldDevices"),
-{
+["ACE3 Equipment", QGVAR(cycleDevice), (localize "STR_ACE_Common_cycleHandheldDevices"), {
[1] call FUNC(deviceKeyFindValidIndex);
if (GVAR(deviceKeyCurrentIndex) == -1) exitWith {false};
_displayName = ((GVAR(deviceKeyHandlingArray) select GVAR(deviceKeyCurrentIndex)) select 0);
@@ -384,6 +503,6 @@ GVAR(deviceKeyCurrentIndex) = -1;
true
},
{false},
-[0xC7, [true, false, false]], false] call cba_fnc_addKeybind; //SHIFT + Home Key
+[0xC7, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + Home Key
GVAR(commonPostInited) = true;
diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf
index 56e3062cd2..ff06c1c3e3 100644
--- a/addons/common/XEH_preInit.sqf
+++ b/addons/common/XEH_preInit.sqf
@@ -1,16 +1,13 @@
// by commy2
#include "script_component.hpp"
-//IGNORE_PRIVATE_WARNING("_handleNetEvent", "_handleRequestAllSyncedEvents", "_handleRequestSyncedEvent", "_handleSyncedEvent");
-
ADDON = false;
-// ACE Common Function
-
PREP(addCanInteractWithCondition);
PREP(addLineToDebugDraw);
PREP(addSetting);
PREP(addToInventory);
+PREP(assignedItemFix);
PREP(assignObjectsInList);
PREP(ambientBrightness);
PREP(applyForceWalkStatus);
@@ -19,17 +16,14 @@ PREP(binarizeNumber);
PREP(blurScreen);
PREP(cachedCall);
PREP(canGetInPosition);
-PREP(canInteract);
PREP(canInteractWith);
PREP(canUseWeapon);
PREP(changeProjectileDirection);
PREP(checkFiles);
PREP(checkPBOs);
PREP(claim);
-PREP(closeDialogIfTargetMoves);
PREP(codeToLetter);
PREP(codeToString);
-PREP(convertKeyCode);
PREP(createOrthonormalReference);
PREP(currentChannel);
PREP(debug);
@@ -85,14 +79,6 @@ PREP(getTargetAzimuthAndInclination);
PREP(getTargetDistance);
PREP(getTargetObject);
PREP(getTurnedOnLights);
-PREP(getTurretCommander);
-PREP(getTurretConfigPath);
-PREP(getTurretCopilot);
-PREP(getTurretGunner);
-PREP(getTurretIndex);
-PREP(getTurrets);
-PREP(getTurretsFFV);
-PREP(getTurretsOther);
PREP(getTurretDirection);
PREP(getUavControlPosition);
PREP(getVehicleCargo);
@@ -105,6 +91,11 @@ PREP(getWindDirection);
PREP(getZoom);
PREP(goKneeling);
PREP(hadamardProduct);
+PREP(handleModifierKey);
+PREP(handleModifierKeyUp);
+PREP(handleModifierKeyInit);
+PREP(handleScrollWheel);
+PREP(handleScrollWheelInit);
PREP(hasItem);
PREP(hasMagazine);
PREP(headBugFix);
@@ -115,7 +106,6 @@ PREP(interpolateFromArray);
PREP(inTransitionAnim);
PREP(inWater);
PREP(isAlive);
-PREP(isArrested);
PREP(isAutoWind);
PREP(isAwake);
PREP(isEngineer);
@@ -135,7 +125,6 @@ PREP(loadSettingsLocalizedText);
PREP(map);
PREP(moduleCheckPBOs);
PREP(moduleLSDVehicles);
-PREP(moveToTempGroup);
PREP(muteUnit);
PREP(muteUnitHandleInitPost);
PREP(muteUnitHandleRespawn);
@@ -148,7 +137,6 @@ PREP(player);
PREP(playerSide);
PREP(positionToASL);
PREP(progressBar);
-PREP(queueAnimation);
PREP(readSettingFromModule);
PREP(receiveRequest);
PREP(removeCanInteractWithCondition);
@@ -156,13 +144,12 @@ PREP(removeSpecificMagazine);
PREP(requestCallback);
PREP(resetAllDefaults);
PREP(restoreVariablesJIP);
-PREP(revertKeyCodeLocalized);
PREP(runAfterSettingsInit);
PREP(sanitizeString);
+PREP(selectWeaponMode);
PREP(sendRequest);
PREP(serverLog);
-PREP(setArrestState);
-PREP(setCanInteract);
+PREP(setAllGear);
PREP(setCaptivityStatus);
PREP(setDefinedVariable);
PREP(setDisableUserInputStatus);
@@ -188,6 +175,7 @@ PREP(toBitmask);
PREP(toHex);
PREP(toNumber);
PREP(unhideUnit);
+PREP(uniqueElements);
PREP(uniqueElementsOnly);
PREP(unloadPerson);
PREP(unloadPersonLocal);
@@ -195,6 +183,7 @@ PREP(unmuteUnit);
PREP(useItem);
PREP(useMagazine);
PREP(waitAndExecute);
+PREP(waitUntilAndExecute);
PREP(waveHeightAt);
PREP(translateToWeaponSpace);
@@ -216,10 +205,12 @@ PREP(getConfigGunner);
PREP(getConfigCommander);
PREP(getHitPoints);
PREP(getHitPointsWithSelections);
+PREP(getSelectionsWithoutHitPoints);
PREP(getReflectorsWithSelections);
PREP(getLightProperties);
PREP(getLightPropertiesWeapon);
PREP(getVehicleCrew);
+PREP(getVehicleUAVCrew);
// turrets
PREP(getTurrets);
@@ -232,14 +223,14 @@ PREP(getDoorTurrets);
PREP(getTurretsFFV);
PREP(getTurretsOther);
+// missing inventory commands
+PREP(binocularMagazine);
+PREP(removeBinocularMagazine);
+
// ACE_Debug
PREP(exportConfig);
PREP(getChildren);
PREP(getDisplayConfigName);
-PREP(log);
-PREP(logControls);
-PREP(logDisplays);
-PREP(logModEntries);
PREP(monitor);
PREP(showUser);
@@ -262,6 +253,17 @@ PREP(localEvent);
PREP(removeEventHandler);
PREP(removeAlLEventHandlers);
+// Synchronized Events
+PREP(syncedEventPFH);
+PREP(addSyncedEventHandler);
+PREP(removeSyncedEventHandler);
+PREP(requestSyncedEvent);
+PREP(syncedEvent);
+
+PREP(_handleSyncedEvent);
+PREP(_handleRequestSyncedEvent);
+PREP(_handleRequestAllSyncedEvents);
+
// other eventhandlers
PREP(addActionEventHandler);
PREP(addActionMenuEventHandler);
@@ -285,29 +287,19 @@ PREP(hashListSelect);
PREP(hashListSet);
PREP(hashListPush);
-// Synchronized Events
-PREP(syncedEventPFH);
-PREP(addSyncedEventHandler);
-PREP(removeSyncedEventHandler);
-PREP(requestSyncedEvent);
-PREP(syncedEvent);
-
-PREP(_handleSyncedEvent);
-PREP(_handleRequestSyncedEvent);
-PREP(_handleRequestAllSyncedEvents);
-
GVAR(syncedEvents) = HASH_CREATE;
-//GVARS for execNextFrame and waitAndExec
+//GVARS for execNextFrame and waitAndExec and waitUntilAndExecute
GVAR(waitAndExecArray) = [];
GVAR(nextFrameNo) = diag_frameno;
GVAR(nextFrameBufferA) = [];
GVAR(nextFrameBufferB) = [];
+GVAR(waitUntilAndExecArray) = [];
GVAR(settingsInitFinished) = false;
GVAR(runAtSettingsInitialized) = [];
-// @TODO: Generic local-managed global-synced objects (createVehicleLocal)
+// @todo: Generic local-managed global-synced objects (createVehicleLocal)
//Debug
ACE_COUNTERS = [];
@@ -317,11 +309,18 @@ if (isServer) then {
call FUNC(loadSettingsOnServer);
};
-ACE_player = player;
+//////////////////////////////////////////////////
+// Set up PlayerChanged eventhandler for pre init
+//////////////////////////////////////////////////
+
+ACE_player = objNull;
+uiNamespace setVariable ["ACE_player", objNull];
+
+// @todo check if this can be removed
if (hasInterface) then {
// PFH to update the ACE_player variable
- [{
+ GVAR(PreInit_playerChanged_PFHID) = [{
if !(ACE_player isEqualTo (call FUNC(player))) then {
private ["_oldPlayer"];
_oldPlayer = ACE_player;
@@ -335,7 +334,11 @@ if (hasInterface) then {
}, 0, []] call CBA_fnc_addPerFrameHandler;
};
+
+//////////////////////////////////////////////////
// Time handling
+//////////////////////////////////////////////////
+
ACE_time = diag_tickTime;
ACE_realTime = diag_tickTime;
ACE_virtualTime = diag_tickTime;
@@ -350,6 +353,8 @@ PREP(timePFH);
// Init toHex
[0] call FUNC(toHex);
-ADDON = true;
+isHC = !hasInterface && !isDedicated; // deprecated because no tag
+missionNamespace setVariable ["ACE_isHC", ACE_isHC];
+uiNamespace setVariable ["ACE_isHC", ACE_isHC];
-isHC = !(hasInterface || isDedicated);
+ADDON = true;
diff --git a/addons/common/functions/fnc_ASLToPosition.sqf b/addons/common/functions/fnc_ASLToPosition.sqf
index 4ff880c019..a5afb1db75 100644
--- a/addons/common/functions/fnc_ASLToPosition.sqf
+++ b/addons/common/functions/fnc_ASLToPosition.sqf
@@ -3,9 +3,9 @@
* Converts ASL to Arma "Position"
*
* Arguments:
- * 0: position x
- * 1: position y
- * 2: position z
+ * 0: position x
+ * 1: position y
+ * 2: position z
*
* Return Value:
* None
diff --git a/addons/common/functions/fnc__handleNetEvent.sqf b/addons/common/functions/fnc__handleNetEvent.sqf
index 7ee1f9c502..e409afe6a3 100644
--- a/addons/common/functions/fnc__handleNetEvent.sqf
+++ b/addons/common/functions/fnc__handleNetEvent.sqf
@@ -1,32 +1,41 @@
-//fnc__handleNetEvent.sqf
-// internal handler for net events
+/*
+ * Author: jaynus
+ * Internal net event handler.
+ *
+ * Arguments:
+ * None
+ *
+ * Return Value:
+ * None
+ *
+ * Public: No
+ */
#include "script_component.hpp"
-private ["_eventName", "_eventArgs", "_eventNames", "_eventIndex", "_eventTargets", "_sentEvents", "_owner", "_serverFlagged", "_events"];
-//IGNORE_PRIVATE_WARNING("_handleNetEvent");
-
-
-PARAMS_2(_eventType,_event);
+params ["_eventType", "_event"];
if (_eventType == "ACEg") then {
- _eventName = _event select 0;
- _eventArgs = _event select 1;
-
+ _event params ["_eventName", "_eventArgs"];
+
+ private ["_eventNames", "_eventIndex"];
+
_eventNames = GVAR(events) select 0;
_eventIndex = _eventNames find _eventName;
+
if (_eventIndex != -1) then {
+ private "_events";
_events = (GVAR(events) select 1) select _eventIndex;
-
+
#ifdef DEBUG_EVENTS
- diag_log text format[ARR_2("* Net Event %1",_eventName)];
- diag_log text format[ARR_2(" args=%1",_eventArgs)];
+ ACE_LOGINFO_1("* Net Event %1",_eventName);
+ ACE_LOGINFO_1(" args=%1",_eventArgs);
#endif
-
+
{
if (!isNil "_x") then {
- _eventArgs call CALLSTACK_NAMED(_x, format[ARR_3("Net Event %1 ID: %2",_eventName,_forEachIndex)]);
+ _eventArgs call CALLSTACK_NAMED(_x, FORMAT_2("Net Event %1 ID: %2",_eventName,_forEachIndex));
#ifdef DEBUG_EVENTS_CALLSTACK
- diag_log text format[ARR_2(" ID: %1",_forEachIndex)];
+ ACE_LOGINFO_1(" ID: %1",_forEachIndex);
#endif
};
} forEach _events;
@@ -35,30 +44,31 @@ if (_eventType == "ACEg") then {
if (_eventType == "ACEc") then {
if (isServer) then {
- _eventName = _event select 0;
- _eventTargets = _event select 1;
- _eventArgs = _event select 2;
-
+ _event params ["_eventName", "_eventTargets", "_eventArgs"];
+
+ private ["_sentEvents", "_owner", "_serverFlagged"];
+
_sentEvents = [];
if (!IS_ARRAY(_eventTargets)) then {
_eventTargets = [_eventTargets];
};
//If not multiplayer, and there are targets, then just run localy
- if ((!isMultiplayer) && {(count _eventTargets) > 0}) exitWith {
- ACEg = [_eventName, _eventArgs];
- ["ACEg", ACEg] call FUNC(_handleNetEvent);
+ if (!isMultiplayer && {count _eventTargets > 0}) exitWith {
+ ACEg = [_eventName, _eventArgs];
+ ["ACEg", ACEg] call FUNC(_handleNetEvent);
};
_serverFlagged = false;
{
_owner = _x;
if (IS_OBJECT(_x)) then {
- _owner = owner _x;
+ _owner = owner _x;
};
- if (!(_owner in _sentEvents)) then {
- PUSH(_sentEvents, _owner);
+ if !(_owner in _sentEvents) then {
+ _sentEvents pushBack _owner;
ACEg = [_eventName, _eventArgs];
+
if (isDedicated || {_x != ACE_player}) then {
if (isDedicated && {local _x} && {!_serverFlagged}) then {
_serverFlagged = true;
@@ -70,6 +80,7 @@ if (_eventType == "ACEc") then {
["ACEg", ACEg] call FUNC(_handleNetEvent);
};
};
- } forEach _eventTargets;
+ false
+ } count _eventTargets;
};
-};
\ No newline at end of file
+};
diff --git a/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf b/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf
index 7c566ce4d1..4e755562b5 100644
--- a/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf
+++ b/addons/common/functions/fnc__handleRequestAllSyncedEvents.sqf
@@ -1,25 +1,27 @@
/*
* Author: jaynus
- *
* Handles a server-side request for synchronization ALL events on JIP to a client.
*
- * Argument:
- * 0: client (object)
- *
- * Return value:
- * Boolean of success
+ * Arguments:
+ * 0: client
+ *
+ * Return Value:
+ * Event is successed
+ *
+ * Public: No
*/
-//#define DEBUG_MODE_FULL
#include "script_component.hpp"
-PARAMS_1(_client);
+
+params ["_client"];
{
- private["_eventName", "_eventEntry", "_eventLog"];
- _eventName = _x;
- _eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
+ private ["_eventEntry", "_eventLog"];
+
+ _eventEntry = HASH_GET(GVAR(syncedEvents),_x);
_eventLog = _eventEntry select 1;
- ["SEH_s", _client, [_eventName, _eventLog] ] call FUNC(targetEvent);
-} forEach (GVAR(syncedEvents) select 0);
+ ["SEH_s", _client, [_x, _eventLog]] call FUNC(targetEvent);
+ false
+} count (GVAR(syncedEvents) select 0);
-true
\ No newline at end of file
+true
diff --git a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf
index fe05bc498b..d4d9b2cf76 100644
--- a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf
+++ b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf
@@ -1,48 +1,50 @@
/*
* Author: jaynus
- *
* Receives either requests for synchronization from clients, or the synchronization data from the server.
*
* Arguments [Client] :
- * 0: eventName (String)
- * 1: eventLog (Array)
- *
+ * 0: eventName
+ * 1: eventLog
+ *
* Arguments [Server] :
- * 0: eventName (String)
- * 1: client (Object)
- *
- * Return value:
- * Boolean of success
+ * 0: eventName
+ * 1: client
+ *
+ * Return Value:
+ * Event is successed
+ *
+ * Public: No
*/
-//#define DEBUG_MODE_FULL
#include "script_component.hpp"
-//IGNORE_PRIVATE_WARNING("_handleSyncedEvent");
-
//SEH_s
-if(isServer) then {
+if (isServer) then {
// Find the event name, and shovel out the events to the client
- PARAMS_2(_eventName,_client);
- private["_eventEntry", "_eventLog"];
-
- if(!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith {
- diag_log text format["[ACE] Error, request for synced event - key not found."];
+ params ["_eventName", "_client"];
+
+ if (!HASH_HASKEY(GVAR(syncedEvents),_eventName)) exitWith {
+ ACE_LOGERROR("Request for synced event - key not found.");
false
};
+
+ private ["_eventEntry", "_eventLog"];
+
_eventEntry = HASH_GET(GVAR(syncedEvents),_eventName);
_eventLog = _eventEntry select 1;
-
- ["SEH_s", _client, [_eventName, _eventLog] ] call FUNC(targetEvent);
+
+ ["SEH_s", _client, [_eventName, _eventLog]] call FUNC(targetEvent);
} else {
- PARAMS_2(_eventName,_eventLog);
- private ["_eventArgs"];
+ params ["_eventName", "_eventLog"];
+
// This is the client handling the response from the server
// Start running the events
{
- _eventArgs = _x select 1;
- [_eventName, _eventArgs, (_x select 2)] call FUNC(_handleSyncedEvent);
- } forEach _eventLog;
- diag_log text format["[ACE] + [%1] synchronized", _eventName];
+ _x params ["", "_eventArgs","_ttl"];
+ [_eventName, _eventArgs, _ttl] call FUNC(_handleSyncedEvent);
+ false
+ } count _eventLog;
+
+ ACE_LOGINFO_1("[%1] synchronized",_eventName);
};
-true
\ No newline at end of file
+true
diff --git a/addons/common/functions/fnc__handleSyncedEvent.sqf b/addons/common/functions/fnc__handleSyncedEvent.sqf
index 053ecb60b7..3ea516513f 100644
--- a/addons/common/functions/fnc__handleSyncedEvent.sqf
+++ b/addons/common/functions/fnc__handleSyncedEvent.sqf
@@ -1,36 +1,40 @@
/*
* Author: jaynus
- *
* Handles synced events being received. Server will log them, and server/client will execute them.
*
* Arguments [Client] :
- * 0: eventName (String)
- * 1: arguments (Array)
- * 2: ttl (Scalar)
- *
- * Return value:
- * Boolean of success
+ * 0: eventName
+ * 1: arguments
+ * 2: ttl
+ *
+ * Return Value:
+ * Boolean of success
+ *
+ * Public: No
*/
-//#define DEBUG_MODE_FULL
#include "script_component.hpp"
-PARAMS_3(_name,_args,_ttl);
-private["_internalData", "_eventLog", "_eventCode"];
-if(!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
- diag_log text format["[ACE] Error, synced event key not found."];
+params ["_name", "_args", "_ttl"];
+
+if (!HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
+ ACE_LOGERROR("Synced event key not found.");
false
};
+private ["_internalData", "_eventCode"];
+
_internalData = HASH_GET(GVAR(syncedEvents),_name);
-if(isServer) then {
+if (isServer) then {
// Server needs to internally log it for synchronization
- if(_ttl > -1) then {
+ if (_ttl > -1) then {
_internalData = HASH_GET(GVAR(syncedEvents),_name);
+
+ private "_eventLog";
_eventLog = _internalData select 1;
_eventLog pushback [ACE_diagTime, _args, _ttl];
};
};
_eventCode = _internalData select 0;
-_args call _eventCode;
\ No newline at end of file
+_args call _eventCode;
diff --git a/addons/common/functions/fnc_addActionEventHandler.sqf b/addons/common/functions/fnc_addActionEventHandler.sqf
index 29b058487b..4d7d96bd44 100644
--- a/addons/common/functions/fnc_addActionEventHandler.sqf
+++ b/addons/common/functions/fnc_addActionEventHandler.sqf
@@ -1,73 +1,66 @@
/*
* Author: commy2
- *
* Add an addAction event to a unit. Used to handle multiple addAction events. Global arguments, local effects. Does only work for player controlled units.
*
- * Argument:
- * 0: Unit the action should be assigned to (Object)
- * 1: Name of the action, e.g. "DefaultAction" (String)
- * 2: Condition (Code or String)
- * 3: Code to execute (Code or String)
+ * Arguments:
+ * 0: Unit the action should be assigned to
+ * 1: Name of the action, e.g. "DefaultAction"
+ * 2: Condition
+ * 3: Code to execute
*
- * Return value:
- * ID of the action (used to remove it later).
+ * Return Value:
+ * ID of the action (used to remove it later)
+ *
+ * Public: No
*/
#include "script_component.hpp"
-private ["_unit", "_action", "_condition", "_statement", "_name", "_actionsVar", "_actionID", "_actions", "_id", "_actionIDs"];
-//IGNORE_PRIVATE_WARNING("_count", "_index", "_return", "_target");
-
-_unit = _this select 0;
-_action = _this select 1;
-_condition = _this select 2;
-_statement = _this select 3;
+params ["_unit", "_action", "_condition", "_statement"];
if (typeName _condition == "STRING") then {
- _condition = compile _condition;
+ _condition = compile _condition;
};
if (typeName _statement == "STRING") then {
- _statement = compile _statement;
+ _statement = compile _statement;
};
-_name = format ["ACE_Action_%1", _action];
+private ["_name", "_actionsVar"];
+_name = format ["ACE_Action_%1", _action];
_actionsVar = _unit getVariable [_name, [-1, [-1, [], []], objNull]];
if (_unit != _actionsVar select 2) then { // check if the unit is still valid, fixes respawn issues
- _actionsVar = [-1, [-1, [], []], objNull];
+ _actionsVar = [-1, [-1, [], []], objNull];
};
-_actionID = _actionsVar select 0;
-_actions = _actionsVar select 1;
+_actionsVar params ["_actionID", "_actionsArray"];
+_actionsArray params ["_id", "_actionIDs", "_actions"];
-_id = (_actions select 0) + 1;
-_actionIDs = _actions select 1;
-_actions = _actions select 2;
+_id = _id + 1;
_actionIDs pushBack _id;
_actions pushBack [_condition, _statement];
// first action to add, unit needs addAction command
if (_actionID == -1) then {
- private "_addAction";
+ private "_addAction";
+ _addAction = call compile format [
+ "[
+ '',
+ {if (inputAction '%1' == 0) exitWith {}; {if (_this call (_x select 0)) then {_this call (_x select 1)}} forEach (((_this select 0) getVariable '%2') select 1 select 2)},
+ nil,
+ -1,
+ false,
+ true,
+ '%1',
+ ""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; _actions = (_this getVariable '%2') select 1 select 2; _count = count _actions; _index = 0; _return = false; while {_index < _count && {!_return}} do {_return = [_target, _this] call ((_actions select _index) select 0); _index = _index + 1}; _return""
+ ]",
+ _action,
+ _name
+ ];
- _addAction = call compile format [
- "[
- '',
- {if (inputAction '%1' == 0) exitWith {}; {if (_this call (_x select 0)) then {_this call (_x select 1)}} forEach (((_this select 0) getVariable '%2') select 1 select 2)},
- nil,
- -1,
- false,
- true,
- '%1',
- ""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; _actions = (_this getVariable '%2') select 1 select 2; _count = count _actions; _index = 0; _return = false; while {_index < _count && {!_return}} do {_return = [_target, _this] call ((_actions select _index) select 0); _index = _index + 1}; _return""
- ]",
- _action,
- _name
- ];
-
- _actionID = _unit addAction _addAction;
+ _actionID = _unit addAction _addAction;
};
_unit setVariable [_name, [_actionID, [_id, _actionIDs, _actions], _unit], false];
diff --git a/addons/common/functions/fnc_addActionMenuEventHandler.sqf b/addons/common/functions/fnc_addActionMenuEventHandler.sqf
index 268cc18d5a..279842ae5c 100644
--- a/addons/common/functions/fnc_addActionMenuEventHandler.sqf
+++ b/addons/common/functions/fnc_addActionMenuEventHandler.sqf
@@ -1,29 +1,25 @@
/*
* Author: commy2
- *
* Add an addAction event to a unit. Used to handle multiple addAction events and add a action to the mouse wheel menu. Global arguments, local effects. Does only work for player controlled units.
*
- * Argument:
- * 0: Unit the action should be assigned to (Object)
- * 1: Menu title of the action (String)
- * 2: Name of the action, e.g. "DefaultAction" (String)
- * 3: Condition (Code or String)
- * 4: Code to execute by the action (Code or String)
- * 5: Condition for the menu action (Code or String)
- * 6: Code to execute from the menu (Code or String)
- * 7: Priority of the action (Number, optional default: 0)
+ * Arguments:
+ * 0: Unit the action should be assigned to
+ * 1: Menu title of the action
+ * 2: Name of the action, e.g. "DefaultAction"
+ * 3: Condition
+ * 4: Code to execute by the action
+ * 5: Condition for the menu action
+ * 6: Code to execute from the menu
+ * 7: Priority of the action (default: 0)
*
- * Return value:
- * ID of the action (used to remove it later).
+ * Return Value:
+ * ID of the action (used to remove it later)
+ *
+ * Public: No
*/
#include "script_component.hpp"
-private ["_name", "_actionsVar", "_id", "_actionIDs", "_actions", "_nameVar", "_addAction", "_actionID"];
-//IGNORE_PRIVATE_WARNING("_target");
-
-PARAMS_8(_unit,_displayName,_action,_condition,_statement,_condition2,_statement2,_priority);
-
-if (isNil "_priority") then {_priority = 0};
+params ["_unit", "_displayName", "_action", "_condition", "_statement", "_condition2", "_statement2", ["_priority", 0]];
if (typeName _condition == "STRING") then {
_condition = compile _condition;
@@ -41,13 +37,16 @@ if (typeName _statement2 == "STRING") then {
_statement2 = compile _statement2;
};
-_name = format ["ACE_ActionMenu_%1", _action];
+private ["_name", "_actionsVar"];
+_name = format ["ACE_ActionMenu_%1", _action];
_actionsVar = _unit getVariable [_name, [-1, [], []]];
-_id = (_actionsVar select 0) + 1;
-_actionIDs = _actionsVar select 1;
-_actions = _actionsVar select 2;
+_actionsVar params ["_id", "_actionIDs", "_actions"];
+
+_id = _id + 1;
+
+private ["_nameVar", "_addAction", "_actionID"];
_nameVar = format ["%1_ID%2", _name, _id];
missionNamespace setVariable [_nameVar, [_condition, _statement, _condition2, _statement2]];
@@ -56,14 +55,14 @@ _actionIDs pushBack _id;
_addAction = call compile format [
"[
- '%2',
- {if (inputAction '%1' == 0) then {if (_this call (%3 select 2)) then {_this call (%3 select 3)}} else {_this call (%3 select 1)}},
- nil,
- %4,
- false,
- true,
- '%1',
- ""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; [_target, _this] call (%3 select 0)""
+ '%2',
+ {if (inputAction '%1' == 0) then {if (_this call (%3 select 2)) then {_this call (%3 select 3)}} else {_this call (%3 select 1)}},
+ nil,
+ %4,
+ false,
+ true,
+ '%1',
+ ""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; [_target, _this] call (%3 select 0)""
]",
_action,
_displayName,
diff --git a/addons/common/functions/fnc_addCanInteractWithCondition.sqf b/addons/common/functions/fnc_addCanInteractWithCondition.sqf
index 10ea084858..740fa9bb9f 100644
--- a/addons/common/functions/fnc_addCanInteractWithCondition.sqf
+++ b/addons/common/functions/fnc_addCanInteractWithCondition.sqf
@@ -1,33 +1,27 @@
/*
* Author: commy2
- *
* Add a condition that gets checked by ace_common_fnc_canInteractWith.
*
* Arguments:
- * 0: The conditions id. Used to remove later or as exception name. An already existing name overwrites. (String)
- * 1: The condition to check. format of "_this" is "[_player, _target]". (Code)
+ * 0: The conditions id. Used to remove later or as exception name. An already existing name overwrites.
+ * 1: The condition to check. format of "_this" is "[_player, _target]".
*
* Return Value:
- * Unit can interact?
+ * None
*
+ * Public: No
*/
#include "script_component.hpp"
-private ["_conditionName", "_conditionFunc"];
-//IGNORE_PRIVATE_WARNING("_player", "_target");
+params ["_conditionName", "_conditionFunc"];
+_conditionName = toLower _conditionName;
-_conditionName = toLower (_this select 0);
-_conditionFunc = _this select 1;
-
-private ["_conditions", "_conditionNames", "_conditionFuncs"];
+private ["_conditions", "_index"];
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
+_conditions params ["_conditionNames", "_conditionFuncs"];
-_conditionNames = _conditions select 0;
-_conditionFuncs = _conditions select 1;
-
-private "_index";
_index = _conditionNames find _conditionName;
if (_index == -1) then {
@@ -37,4 +31,4 @@ if (_index == -1) then {
_conditionNames set [_index, _conditionName];
_conditionFuncs set [_index, _conditionFunc];
-GVAR(InteractionConditions) = [_conditionNames, _conditionFuncs];
+GVAR(InteractionConditions) = _conditions;
diff --git a/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf b/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf
index 4623bb4ddb..95cce02e41 100644
--- a/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf
+++ b/addons/common/functions/fnc_addCuratorUnloadEventhandler.sqf
@@ -1,9 +1,19 @@
-// by commy2
+/*
+ * Author: commy2
+ *
+ * Arguments:
+ * Display where the Unload event was added
+ *
+ * Return Value:
+ * None
+ *
+ * Public: No
+ */
#include "script_component.hpp"
-private "_dlg";
-
disableSerialization;
+
+private "_dlg";
_dlg = ctrlParent _this;
_dlg displayAddEventHandler ["unload", {
diff --git a/addons/common/functions/fnc_addEventHandler.sqf b/addons/common/functions/fnc_addEventHandler.sqf
index 86e034a0d9..599e937918 100644
--- a/addons/common/functions/fnc_addEventHandler.sqf
+++ b/addons/common/functions/fnc_addEventHandler.sqf
@@ -1,33 +1,34 @@
/*
* Author: Nou
+ * Add an event handler.
*
- * Add a event handler.
+ * Arguments:
+ * 0: Event name
+ * 1: Event code
*
- * Argument:
- * 0: Event name (string)
- * 1: Event code (code)
+ * Return Value:
+ * Event handler ID number (for use with fnc_removeEventHandler)
*
- * Return value:
- * Event handler ID number (for use with fnc_removeEventHandler)
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_eventNames", "_eventFunctions", "_eventNameCount", "_eventIndex", "_eventFunctionCount"];
+params ["_eventName", "_eventCode"];
-PARAMS_2(_eventName,_eventCode);
+private ["_eventNames", "_eventFunctions", "_eventIndex"];
_eventNames = GVAR(events) select 0;
_eventFunctions = [];
_eventIndex = _eventNames find _eventName;
+
if (_eventIndex != -1) then {
_eventFunctions = (GVAR(events) select 1) select _eventIndex;
} else {
+ private "_eventNameCount";
_eventNameCount = count _eventNames;
- _eventNames set[_eventNameCount, _eventName];
- (GVAR(events) select 1) set[_eventNameCount, _eventFunctions];
+
+ _eventNames set [_eventNameCount, _eventName];
+ (GVAR(events) select 1) set [_eventNameCount, _eventFunctions];
};
-_eventFunctionCount = count _eventFunctions;
-_eventFunctions set [_eventFunctionCount, _eventCode];
-
-_eventFunctionCount;
\ No newline at end of file
+_eventFunctions pushBack _eventCode // Return event function count
diff --git a/addons/common/functions/fnc_addLineToDebugDraw.sqf b/addons/common/functions/fnc_addLineToDebugDraw.sqf
index 4b8b235811..f0a643e922 100644
--- a/addons/common/functions/fnc_addLineToDebugDraw.sqf
+++ b/addons/common/functions/fnc_addLineToDebugDraw.sqf
@@ -1,15 +1,15 @@
/*
* Author: esteldunedain
- *
* Add line to draw on debug
*
- * Argument:
- * 0: Start point ASL (Array)
- * 1: End point ASL (Array)
- * 2: Color (Array)
+ * Arguments:
+ * 0: Start point ASL
+ * 1: End point ASL
+ * 2: Color
*
- * Return value:
+ * None
*
+ * Public: No
*/
#include "script_component.hpp"
@@ -45,4 +45,4 @@ if (isNil QGVAR(debugDrawHandler)) then {
drawLine3D [_p0, _p1, _x select 2];
} forEach GVAR(debugLines);
}];
-};
\ No newline at end of file
+};
diff --git a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf
index c3975be496..1e060f056a 100644
--- a/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf
+++ b/addons/common/functions/fnc_addMapMarkerCreatedEventHandler.sqf
@@ -1,29 +1,29 @@
/*
* Author: commy2
- *
* Add a map marker creation event handler.
*
- * Argument:
- * 0: Code to execute (Code or String)
+ * Arguments:
+ * 0: Code to execute
*
- * Return value:
- * ID of the event script (used to remove it later).
+ * Return Value:
+ * ID of the event script (used to remove it later).
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_actionsVar", "_id", "_actionIDs", "_actions"];
-
-PARAMS_1(_statement);
+params ["_statement"];
if (typeName _statement == "STRING") then {
_statement = compile _statement;
};
+private "_actionsVar";
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_MapMarker", [-1, [], []]];
-_id = (_actionsVar select 0) + 1;
-_actionIDs = _actionsVar select 1;
-_actions = _actionsVar select 2;
+_actionsVar params ["_id", "_actionIDs", "_actions"];
+
+_id = _id + 1;
if (_id == 0) then {
uiNamespace setVariable ["ACE_EventHandler_MapMarker", count allMapMarkers];
diff --git a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf
index d079b4b17e..ef60270695 100644
--- a/addons/common/functions/fnc_addScrollWheelEventHandler.sqf
+++ b/addons/common/functions/fnc_addScrollWheelEventHandler.sqf
@@ -1,29 +1,30 @@
/*
* Author: commy2
+ * Add an event handler that executes every ACE_time the scroll wheel is used. This is needed, because adding a MouseZ display event handler to display 46 will break in save games.
+ * _this will be [Interval] where 'Interval' is a number.
*
- * Add an event handler that executes every ACE_time the scroll wheel is used. This is needed, because adding a MouseZ display event handler to display 46 will break in save games. Argument will be [Interval] where 'Interval' is a number.
+ * Arguments:
+ * 0: Code to execute
*
- * Argument:
- * 0: Code to execute (Code or String)
+ * Return Value:
+ * ID of the event script (used to remove it later).
*
- * Return value:
- * ID of the event script (used to remove it later).
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_actionsVar", "_id", "_actionIDs", "_actions"];
-
-PARAMS_1(_statement);
+params ["_statement"];
if (typeName _statement == "STRING") then {
- _statement = compile _statement;
+ _statement = compile _statement;
};
+private "_actionsVar";
_actionsVar = missionNamespace getVariable ["ACE_EventHandler_ScrollWheel", [-1, [], []]];
-_id = (_actionsVar select 0) + 1;
-_actionIDs = _actionsVar select 1;
-_actions = _actionsVar select 2;
+_actionsVar params ["_id", "_actionIDs", "_actions"];
+
+_id = _id + 1;
_actionIDs pushBack _id;
_actions pushBack _statement;
diff --git a/addons/common/functions/fnc_addSetting.sqf b/addons/common/functions/fnc_addSetting.sqf
index 42299e6458..06162de6b1 100644
--- a/addons/common/functions/fnc_addSetting.sqf
+++ b/addons/common/functions/fnc_addSetting.sqf
@@ -11,7 +11,7 @@
* 4: localizedDescription
* 5: possibleValues
* 6: isForced
- * 7: defaultValue (Any)
+ * 7: defaultValue
*
* Return Value:
* None
@@ -20,10 +20,9 @@
*/
#include "script_component.hpp"
-PARAMS_8(_name,_typeName,_isClientSetable,_localizedName,_localizedDescription,_possibleValues,_isForced,_value);
-
-private ["_settingData"];
+params ["_name", "", "", "", "", "", "", "_value"]; //["_name", "_typeName", "_isClientSetable", "_localizedName", "_localizedDescription", "_possibleValues", "_isForced", "_value"];
+private "_settingData";
_settingData = [_name] call FUNC(getSettingData);
// Exit if the setting already exists
diff --git a/addons/common/functions/fnc_addSyncedEventHandler.sqf b/addons/common/functions/fnc_addSyncedEventHandler.sqf
index 60c90672ef..801a915dc5 100644
--- a/addons/common/functions/fnc_addSyncedEventHandler.sqf
+++ b/addons/common/functions/fnc_addSyncedEventHandler.sqf
@@ -1,34 +1,29 @@
/*
* Author: jaynus
- *
* Register an event handler for an ACE synced event
*
- * Argument:
- * 0: Name (String)
- * 1: Handler (Code)
- * 2: TTL (Number or Code) [Optional]
- *
- * Return value:
- * Boolean of success
+ * Arguments:
+ * 0: Name
+ * 1: Handler
+ * 2: TTL (optional: 0)
+ *
+ * Return Value:
+ * Boolean of success
+ *
+ * Public: Yes
*/
-//#define DEBUG_MODE_FULL
#include "script_component.hpp"
-//IGNORE_PRIVATE_WARNING("_handleSyncedEvent");
-PARAMS_2(_name,_handler);
+params ["_name", "_handler", ["_ttl", 0]];
-private["_ttl", "_eventId", "_data"];
-if( (count _this) > 2) then {
- _ttl = _this select 2;
-} else {
- _ttl = 0;
-};
-
-if(HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
- diag_log text format["[ACE] Error, duplicate synced event creation."];
+if (HASH_HASKEY(GVAR(syncedEvents),_name)) exitWith {
+ ACE_LOGERROR("Duplicate synced event creation.");
false
};
+private ["_eventId", "_data"];
+
_eventId = [_name, FUNC(_handleSyncedEvent)] call FUNC(addEventHandler);
-_data = [_handler,[],_ttl,_eventId];
-HASH_SET(GVAR(syncedEvents),_name,_data);
\ No newline at end of file
+_data = [_handler, [], _ttl, _eventId];
+
+HASH_SET(GVAR(syncedEvents),_name,_data);
diff --git a/addons/common/functions/fnc_addToInventory.sqf b/addons/common/functions/fnc_addToInventory.sqf
index ba76831ba4..4019de93ac 100644
--- a/addons/common/functions/fnc_addToInventory.sqf
+++ b/addons/common/functions/fnc_addToInventory.sqf
@@ -1,93 +1,141 @@
/*
* Author: Garth 'L-H' de Wet
- * Adds an item,weapon,magazine to the unit's inventory
- * or places it in a weaponHolder if no space.
+ * Adds an item, weapon, or magazine to the unit's inventory or places it in a weaponHolder if no space.
*
* Arguments:
* 0: Unit
* 1: Classname
- * 2: Container (uniform, vest, backpack)
- * 3: Magazine Ammo Count
+ * 2: Container (uniform, vest, backpack) (default: "")
+ * 3: Magazine Ammo Count (default: -1)
*
* Return Value:
- * Array:
- * 0: Added to player (Bool)
- * 1: weaponholder (OBJECT)
+ * 0: Added to player
+ * 1: weaponholder
*
* Public: Yes
*/
-//#define DEBUG_MODE_FULL
#include "script_component.hpp"
-PARAMS_2(_unit,_classname);
-DEFAULT_PARAM(2,_container,"");
-DEFAULT_PARAM(3,_ammoCount,-1);
+params ["_unit", "_classname", ["_container", ""], ["_ammoCount", -1]];
-private ["_addedToPlayer", "_canAdd", "_type", "_pos"];
+private ["_type", "_canAdd", "_addedToUnit"];
-_canAdd = false;
-_addedToPlayer = true;
-
-_type = [_classname] call EFUNC(common,getItemType);
+_type = [_classname] call FUNC(getItemType);
switch (_container) do {
- case "vest": { _canAdd = _unit canAddItemToVest _classname; };
- case "backpack": { _canAdd = _unit canAddItemToBackpack _classname; };
- case "uniform": { _canAdd = _unit canAddItemToUniform _classname; };
- default {_canAdd = _unit canAdd _classname;};
+ case "vest": {
+ _canAdd = _unit canAddItemToVest _classname;
+ };
+ case "backpack": {
+ _canAdd = _unit canAddItemToBackpack _classname;
+ };
+ case "uniform": {
+ _canAdd = _unit canAddItemToUniform _classname;
+ };
+ default {
+ _canAdd = _unit canAdd _classname;
+ };
};
-switch ((_type select 0)) do {
+switch (_type select 0) do {
case "weapon": {
if (_canAdd) then {
+ _addedToUnit = true;
+
switch (_container) do {
- case "vest": { (vestContainer _unit) addWeaponCargoGlobal [_classname, 1]; };
- case "backpack": { (backpackContainer _unit) addWeaponCargoGlobal [_classname, 1]; };
- case "uniform": { (uniformContainer _unit) addWeaponCargoGlobal [_classname, 1]; };
- default { _unit addWeaponGlobal _classname; };
+ case "vest": {
+ (vestContainer _unit) addWeaponCargoGlobal [_classname, 1];
+ };
+ case "backpack": {
+ (backpackContainer _unit) addWeaponCargoGlobal [_classname, 1];
+ };
+ case "uniform": {
+ (uniformContainer _unit) addWeaponCargoGlobal [_classname, 1];
+ };
+ default {
+ _unit addWeaponGlobal _classname;
+ };
};
} else {
- _addedToPlayer = false;
+ _addedToUnit = false;
+
+ private "_pos";
_pos = _unit modelToWorldVisual [0,1,0.05];
- _unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
- _unit addWeaponCargoGlobal [_classname,1];
+
+ _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
+ _unit addWeaponCargoGlobal [_classname, 1];
_unit setPosATL _pos;
};
};
+
case "magazine": {
- if (_ammoCount == -1) then {_ammoCount = getNumber (configFile >> "CfgMagazines" >> _classname >> "count");};
+ if (_ammoCount == -1) then {
+ _ammoCount = getNumber (configFile >> "CfgMagazines" >> _classname >> "count");
+ };
+
if (_canAdd) then {
+ _addedToUnit = true;
+
switch (_container) do {
- case "vest": { (vestContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; };
- case "backpack": { (backpackContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; };
- case "uniform": { (uniformContainer _unit) addMagazineCargoGlobal [_classname, _ammoCount]; };
- default {_unit addMagazine [_classname, _ammoCount]; };
+ case "vest": {
+ (vestContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
+ };
+ case "backpack": {
+ (backpackContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
+ };
+ case "uniform": {
+ (uniformContainer _unit) addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
+ };
+ default {
+ _unit addMagazine [_classname, _ammoCount];
+ };
};
} else {
- _addedToPlayer = false;
+ _addedToUnit = false;
+
+ private "_pos";
_pos = _unit modelToWorldVisual [0,1,0.05];
- _unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
- _unit addMagazineCargoGlobal [_classname, _ammoCount];
+
+ _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
+ _unit addMagazineCargoGlobal [_classname, 1/*_ammoCount*/]; //@todo Bug! This isn't really the ammo, but magazine count. No such command.
_unit setPosATL _pos;
};
};
+
case "item": {
if (_canAdd) then {
+ _addedToUnit = true;
+
switch (_container) do {
- case "vest": { _unit addItemToVest _classname; };
- case "backpack": { _unit addItemToBackpack _classname; };
- case "uniform": { _unit addItemToUniform _classname; };
- default { _unit addItem _classname; };
+ case "vest": {
+ _unit addItemToVest _classname;
+ };
+ case "backpack": {
+ _unit addItemToBackpack _classname;
+ };
+ case "uniform": {
+ _unit addItemToUniform _classname;
+ };
+ default {
+ _unit addItem _classname;
+ };
};
} else {
- _addedToPlayer = false;
+ _addedToUnit = false;
+
+ private "_pos";
_pos = _unit modelToWorldVisual [0,1,0.05];
- _unit = createVehicle ["WeaponHolder_Single_F",_pos,[],0,"NONE"];
- _unit addItemCargoGlobal [_classname,1];
+
+ _unit = createVehicle ["WeaponHolder_Single_F", _pos, [], 0, "NONE"];
+ _unit addItemCargoGlobal [_classname, 1];
_unit setPosATL _pos;
};
};
- default {diag_log format ["ACE: Incorrect item type passed to %1, passed: %2",QFUNC(AddToInventory),_type];};
+
+ default {
+ _addedToUnit = false;
+ ACE_LOGWARNING_2("Incorrect item type passed to %1, passed: %2",QFUNC(AddToInventory),_type);
+ };
};
-[_addedToPlayer,_unit]
+[_addedToUnit, _unit]
diff --git a/addons/common/functions/fnc_ambientBrightness.sqf b/addons/common/functions/fnc_ambientBrightness.sqf
index 172739247f..4ec2840e47 100644
--- a/addons/common/functions/fnc_ambientBrightness.sqf
+++ b/addons/common/functions/fnc_ambientBrightness.sqf
@@ -1,14 +1,15 @@
/*
* Author: commy2, idea by Falke
- *
* Returns a brightness value depending on the sun and moon state. Ranges from 0 to 1 (dark ... bright).
*
- * Argument:
- * None.
+ * Arguments:
+ * None
*
- * Return value:
- * Ambient brightness (Number)
+ * Return Value:
+ * Ambient brightness
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-(sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + (moonIntensity/5) * (1 - overcast)) min 1
+(sunOrMoon * sunOrMoon * (1 - overcast * 0.25) + (moonIntensity / 5) * (1 - overcast)) min 1
diff --git a/addons/common/functions/fnc_applyForceWalkStatus.sqf b/addons/common/functions/fnc_applyForceWalkStatus.sqf
index 2e1c36db4a..d3b58a25a4 100644
--- a/addons/common/functions/fnc_applyForceWalkStatus.sqf
+++ b/addons/common/functions/fnc_applyForceWalkStatus.sqf
@@ -1,25 +1,23 @@
/*
-Name: FUNC(applyForceWalkStatus)
-
-Author: Pabst Mirror
-
-Description:
- Applys the forceWalk status of an unit. Called from Extended_InitPost_EventHandlers.
-
-Parameters:
- 0: OBJECT - Unit
-
-Returns:
- None
-
-Example:
- [ACE_Player] call FUNC(applyForceWalkStatus)
-*/
+ * Author: Pabst Mirror
+ * Applys the forceWalk status of an unit. Called from Extended_InitPost_EventHandlers.
+ *
+ * Arguments:
+ * 0: Unit
+ *
+ * Return Value:
+ * None
+ *
+ * Example:
+ * [ACE_Player] call ace_common_fnc_applyForceWalkStatus
+ *
+ * Public: No
+ */
#include "script_component.hpp"
-private ["_forceWalkNumber"];
+params ["_unit"];
-PARAMS_1(_unit);
+private "_forceWalkNumber";
_forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0];
_unit forceWalk (_forceWalkNumber > 0);
diff --git a/addons/common/functions/fnc_assignObjectsInList.sqf b/addons/common/functions/fnc_assignObjectsInList.sqf
index 0d10066d01..6bbb31d2dc 100644
--- a/addons/common/functions/fnc_assignObjectsInList.sqf
+++ b/addons/common/functions/fnc_assignObjectsInList.sqf
@@ -14,37 +14,40 @@
*
* Public: No
*/
-
#include "script_component.hpp"
-private ["_splittedList", "_nilCheckPassedList"];
params ["_list", "_variable", "_setting", "_global"];
if (typeName _list == "STRING") then {
+ private ["_splittedList", "_nilCheckPassedList"];
+
_splittedList = [_list, ","] call BIS_fnc_splitString;
_nilCheckPassedList = "";
+
{
_x = [_x] call FUNC(stringRemoveWhiteSpace);
- if !(isnil _x) then {
+ if !(isNil _x) then {
if (_nilCheckPassedList == "") then {
_nilCheckPassedList = _x;
} else {
_nilCheckPassedList = _nilCheckPassedList + ","+ _x;
};
};
- }foreach _splittedList;
+ false
+ } count _splittedList;
_list = [] call compile format["[%1]",_nilCheckPassedList];
};
{
- if (!isnil "_x") then {
+ if (!isNil "_x") then {
if (typeName _x == typeName objNull) then {
if (local _x) then {
_x setvariable [_variable, _setting, _global];
};
};
};
-}foreach _list;
+ false
+} count _list;
true
diff --git a/addons/common/functions/fnc_assignedItemFix.sqf b/addons/common/functions/fnc_assignedItemFix.sqf
new file mode 100644
index 0000000000..9f804eaa4d
--- /dev/null
+++ b/addons/common/functions/fnc_assignedItemFix.sqf
@@ -0,0 +1,75 @@
+/*
+ * Author: commy2
+ * Initialized the assigned item fix.
+ *
+ * Arguments:
+ * None
+ *
+ * Return Value:
+ * None
+ *
+ * Public : No
+ */
+#include "script_component.hpp"
+
+private "_config";
+
+ACE_isMapEnabled = call {_config = missionConfigFile >> "showMap"; !isNumber _config || {getNumber _config == 1}}; // default value is 1, so do isNumber check first
+ACE_isCompassEnabled = call {_config = missionConfigFile >> "showCompass"; !isNumber _config || {getNumber _config == 1}};
+ACE_isWatchEnabled = call {_config = missionConfigFile >> "showWatch"; !isNumber _config || {getNumber _config == 1}};
+ACE_isRadioEnabled = call {_config = missionConfigFile >> "showRadio"; !isNumber _config || {getNumber _config == 1}};
+ACE_isGPSEnabled = call {_config = missionConfigFile >> "showGPS"; !isNumber _config || {getNumber _config == 1}};
+
+GVAR(AssignedItems) = [];
+GVAR(AssignedItemsInfo) = [];
+GVAR(AssignedItemsShownItems) = [
+ ACE_isMapEnabled,
+ ACE_isCompassEnabled,
+ ACE_isWatchEnabled,
+ ACE_isRadioEnabled,
+ ACE_isGPSEnabled
+];
+
+["playerInventoryChanged", {
+ params ["_unit", "_assignedItems"];
+
+ _assignedItems = _assignedItems select 17;
+
+ GVAR(AssignedItemsShownItems) = [true, true, true, true, true];
+
+ {
+ if !(_x in GVAR(AssignedItems)) then {
+ GVAR(AssignedItems) pushBack _x;
+ GVAR(AssignedItemsInfo) pushBack toLower getText (configFile >> "CfgWeapons" >> _x >> "ACE_hideItemType");
+ };
+
+ switch (GVAR(AssignedItemsInfo) select (GVAR(AssignedItems) find _x)) do {
+ case ("map"): {
+ GVAR(AssignedItemsShownItems) set [0, false];
+ };
+ case ("compass"): {
+ GVAR(AssignedItemsShownItems) set [1, false];
+ };
+ case ("watch"): {
+ GVAR(AssignedItemsShownItems) set [2, false];
+ };
+ case ("radio"): {
+ GVAR(AssignedItemsShownItems) set [3, false];
+ };
+ case ("gps"): {
+ GVAR(AssignedItemsShownItems) set [4, false];
+ };
+ };
+ false
+ } count _assignedItems;
+
+ //systemChat str GVAR(AssignedItemsShownItems);
+
+ GVAR(AssignedItemsShownItems) params ["_showMap", "_showCompass", "_showWatch", "_showRadio", "_showGPS"];
+
+ showMap _showMap;
+ showCompass _showCompass;
+ showWatch _showWatch;
+ showRadio _showRadio;
+ showGPS (_showGPS || {cameraOn == getConnectedUAV _unit}); //If player is activly controling a UAV, showGPS controls showing the map (m key)
+}] call FUNC(addEventHandler);
diff --git a/addons/common/functions/fnc_binarizeNumber.sqf b/addons/common/functions/fnc_binarizeNumber.sqf
index 0bf968b7ee..aff2f9dc17 100644
--- a/addons/common/functions/fnc_binarizeNumber.sqf
+++ b/addons/common/functions/fnc_binarizeNumber.sqf
@@ -1,23 +1,23 @@
/*
* Author: commy2
- *
* Get a binary equivalent of a decimal number.
*
- * Argument:
- * 0: Decimal Number (Number)
- * 1: Minimum length of the returned Array, note: returned array can be larger (Number, optional default 8)
+ * Arguments:
+ * 0: Decimal Number
+ * 1: Minimum length of the returned Array, note: returned array can be larger (default: 8)
*
- * Return value:
- * Booleans (Array)
+ * Return Value:
+ * Booleans
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_number", "_minLength", "_array", "_index", "_rest"];
+params ["_number", ["_minLength", 8]];
-_number = round (_this select 0);
-_minLength = _this select 1;
+_number = round _number;
-if (isNil "_minLength") then {_minLength = 8};
+private ["_array", "_index", "_rest"];
_array = [];
_array resize _minLength;
@@ -35,4 +35,5 @@ while {_number > 0} do {
_array set [_index, _rest == 1];
_index = _index + 1;
};
+
_array
diff --git a/addons/common/functions/fnc_binocularMagazine.sqf b/addons/common/functions/fnc_binocularMagazine.sqf
new file mode 100644
index 0000000000..f097b90841
--- /dev/null
+++ b/addons/common/functions/fnc_binocularMagazine.sqf
@@ -0,0 +1,40 @@
+/*
+ * Author: commy2
+ * Returns the magazine of the units rangefinder.
+ *
+ * Arguments:
+ * 0: Unit
+ *
+ * Return Value:
+ * Magazine of the units binocular
+ *
+ * Example:
+ * [player] call ace_common_fnc_binocularMagazine
+ *
+ * Public: Yes
+ *
+ * Note: Doesn't work on dead units
+ */
+#include "script_component.hpp"
+
+params ["_unit"];
+
+private ["_binocular", "_muzzle", "_mode", "_magazine"];
+
+_binocular = binocular _unit;
+
+if (_binocular == "") exitWith {""};
+
+_muzzle = currentMuzzle _unit;
+_mode = currentWeaponMode _unit;
+
+_unit selectWeapon _binocular;
+
+// didn't select the binocular (unit probably dead or not local). function won't work. quit with empty string
+if (currentWeapon _unit != _binocular) exitWith {""};
+
+_magazine = currentMagazine _unit;
+
+[_unit, _muzzle, _mode] call FUNC(selectWeaponMode);
+
+_magazine
diff --git a/addons/common/functions/fnc_blurScreen.sqf b/addons/common/functions/fnc_blurScreen.sqf
index 57714b63cd..a3394a1fbf 100644
--- a/addons/common/functions/fnc_blurScreen.sqf
+++ b/addons/common/functions/fnc_blurScreen.sqf
@@ -1,28 +1,32 @@
-/**
- * fn_gui_blurScreen.sqf
- * @Descr:
- * @Author: Glowbal
+/*
+ * Author: Glowbal
*
- * @Arguments: []
- * @Return:
- * @PublicAPI: true
+ * Arguments:
+ * 0: ID
+ * 1: Show?
+ *
+ * Return Value:
+ * None
+ *
+ * Public: Yes
*/
-
#include "script_component.hpp"
-private ["_show"];
-PARAMS_1(_id);
-_show = if (count _this > 1) then {_this select 1} else {false};
+if (!hasInterface) exitWith {};
+
+params ["_id", ["_show", false]];
+
+if (typeName _show == "SCALAR") then {
+ _show = _show == 1;
+};
if (isNil QGVAR(SHOW_BLUR_SCREEN_COLLECTION)) then {
GVAR(SHOW_BLUR_SCREEN_COLLECTION) = [];
};
-if (typeName _show == typeName 0) then {
- _show = (_show == 1);
-};
if (_show) then {
- GVAR(SHOW_BLUR_SCREEN_COLLECTION) pushback _id;
+ GVAR(SHOW_BLUR_SCREEN_COLLECTION) pushBack _id;
+
// show blur
if (isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = ppEffectCreate ["DynamicBlur", 102];
@@ -32,9 +36,10 @@ if (_show) then {
};
} else {
GVAR(SHOW_BLUR_SCREEN_COLLECTION) = GVAR(SHOW_BLUR_SCREEN_COLLECTION) - [_id];
+
if (GVAR(SHOW_BLUR_SCREEN_COLLECTION) isEqualTo []) then {
// hide blur
- if (!isnil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
+ if (!isNil QGVAR(MENU_ppHandle_GUI_BLUR_SCREEN)) then {
ppEffectDestroy GVAR(MENU_ppHandle_GUI_BLUR_SCREEN);
GVAR(MENU_ppHandle_GUI_BLUR_SCREEN) = nil;
};
diff --git a/addons/common/functions/fnc_cachedCall.sqf b/addons/common/functions/fnc_cachedCall.sqf
index f9d9c74dd3..e1e0e16118 100644
--- a/addons/common/functions/fnc_cachedCall.sqf
+++ b/addons/common/functions/fnc_cachedCall.sqf
@@ -1,5 +1,5 @@
/*
- * Author: esteldunedain and Jaynus
+ * Author: esteldunedain, Jaynus
* Returns the result of the function and caches it up to a given ACE_time or event
*
* Arguments:
@@ -8,7 +8,7 @@
* 2: Namespace to store the cache on
* 3: Cache uid
* 4: Max duration of the cache
- * 5: Event that clears the cache (Optional)
+ * 5: Event that clears the cache (default: nil)
*
* Return Value:
* Result of the function
@@ -17,33 +17,31 @@
*/
#include "script_component.hpp"
-PARAMS_5(_params,_function,_namespace,_uid,_duration);
+params ["_params", "_function", "_namespace", "_uid", "_duration", "_event"];
-//IGNORE_PRIVATE_WARNING("_eventName");
-
-if (((_namespace getVariable [_uid, [-99999]]) select 0) < ACE_diagTime) then {
+if ((_namespace getVariable [_uid, [-99999]]) select 0 < ACE_diagTime) then {
_namespace setVariable [_uid, [ACE_diagTime + _duration, _params call _function]];
// Does the cache needs to be cleared on an event?
- if (count _this > 5) then {
- private ["_event","_varName","_cacheList"];
- _event = _this select 5;
- _varName = format [QGVAR(clearCache_%1),_event];
+ if (!isNil "_event") then {
+ private ["_varName", "_cacheList"];
+
+ _varName = format [QGVAR(clearCache_%1), _event];
_cacheList = missionNamespace getVariable _varName;
// If there was no EH to clear these caches, add one
- if (isNil {_cacheList}) then {
+ if (isNil "_cacheList") then {
_cacheList = [];
missionNamespace setVariable [_varName, _cacheList];
[_event, {
- private ["_varName","_cacheList"];
+ private ["_varName", "_cacheList"];
// _eventName is defined on the function that calls the event
#ifdef DEBUG_MODE_FULL
- diag_log text format ["ACE: Clear cached variables on event: %1", _eventName];
+ ACE_LOGINFO_1("Clear cached variables on event: %1",_eventName);
#endif
// Get the list of caches to clear
- _varName = format [QGVAR(clearCache_%1),_eventName];
+ _varName = format [QGVAR(clearCache_%1), _eventName];
_cacheList = missionNamespace getVariable [_varName, []];
// Erase all the cached results
{
@@ -57,11 +55,13 @@ if (((_namespace getVariable [_uid, [-99999]]) select 0) < ACE_diagTime) then {
// Add this cache to the list of the event
_cacheList pushBack [_namespace, _uid];
};
+
#ifdef DEBUG_MODE_FULL
- diag_log format ["Calculated result: %1 %2", _namespace, _uid];
+ ACE_LOGINFO_2("Calculated result: %1 %2",_namespace,_uid);
} else {
- diag_log format ["Cached result : %1 %2", _namespace, _uid];
+ ACE_LOGINFO_2("Cached result: %1 %2",_namespace,_uid);
#endif
+
};
(_namespace getVariable _uid) select 1
diff --git a/addons/common/functions/fnc_canGetInPosition.sqf b/addons/common/functions/fnc_canGetInPosition.sqf
index 2c84f11b4d..45a2642655 100644
--- a/addons/common/functions/fnc_canGetInPosition.sqf
+++ b/addons/common/functions/fnc_canGetInPosition.sqf
@@ -1,35 +1,28 @@
/*
* Author: commy2
- *
* Is the unit able to enter the vehicle in the given position?
*
* Arguments:
- * 0: Unit to enter the vehicle (Object)
- * 1: The vehicle to be entered (Object)
- * 2: Position. Can be "Driver", "Pilot", "Gunner", "Commander", "Copilot", "Turret", "FFV", "Codriver" or "Cargo" (String)
- * 3: Check current distance to vehicles memory point? (Bool, optional default: false)
+ * 0: Unit to enter the vehicle
+ * 1: The vehicle to be entered
+ * 2: Position. Can be "Driver", "Pilot", "Gunner", "Commander", "Copilot", "Turret", "FFV", "Codriver" or "Cargo"
+ * 3: Check current distance to vehicles memory point? (default: false)
* 4: Index. "Turret", "FFV", "Codriver" and "Cargo" support this optional parameter. Which position should be taken.
- * Note: This index is diffrent from Armas "cargoIndex". (Number, optional default: next free index)
+ * Note: This index is diffrent from Armas "cargoIndex". (default: next free index)
*
* Return Value:
- * Nothing
+ * None
+ *
+ * Public: No
*/
#include "script_component.hpp"
#define CANGETINDRIVER (isNull (driver _vehicle) || {!alive driver _vehicle}) && {!lockedDriver _vehicle} && {getNumber (_config >> "isUav") != 1}
#define CANGETINTURRETINDEX (isNull (_vehicle turretUnit _turret) || {!alive (_vehicle turretUnit _turret)}) && {!(_vehicle lockedTurret _turret)} && {getNumber (_config >> "isUav") != 1}
-private ["_position", "_checkDistance", "_index"];
+params ["_unit", "_vehicle", "_position", ["_checkDistance", false], ["_index", -1]];
-_this resize 5;
-
-PARAMS_2(_unit,_vehicle);
-_position = toLower (_this select 2);
-_checkDistance = _this select 3;
-_index = _this select 4; // optional, please don't use
-
-if (isNil "_checkDistance") then {_checkDistance = false};
-if (isNil "_index") then {_index = -1};
+_position = toLower _position;
// general
if (!alive _vehicle || {locked _vehicle > 1}) exitWith {false};
diff --git a/addons/common/functions/fnc_canInteract.sqf b/addons/common/functions/fnc_canInteract.sqf
deleted file mode 100644
index 4b3e22f646..0000000000
--- a/addons/common/functions/fnc_canInteract.sqf
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * fn_canInteract.sqf
- * @Descr: Check if unit can interact with enviroment. Unit has to be awake and not be in arrested state.
- * @Author: Glowbal
- *
- * @Arguments: [unit OBJECT]
- * @Return: BOOL True if unit can interact with enviroment.
- * @PublicAPI: true
- */
-#include "script_component.hpp"
-
-PARAMS_1(_unit);
-
-(((_unit getvariable [QGVAR(canInteract),0]) < 1) && ([_unit] call FUNC(isAwake)) && !([_unit] call FUNC(isArrested)))
\ No newline at end of file
diff --git a/addons/common/functions/fnc_canInteractWith.sqf b/addons/common/functions/fnc_canInteractWith.sqf
index 1a6e766855..31ebf6b89f 100644
--- a/addons/common/functions/fnc_canInteractWith.sqf
+++ b/addons/common/functions/fnc_canInteractWith.sqf
@@ -5,45 +5,33 @@
* Arguments:
* 0: The player.
* 1: The interaction target. objNull to ignore.
- * 2: Exceptions. What general conditions are to skip? (Optional)
+ * 2: Exceptions. What general conditions are to skip? (default: [])
*
* Return Value:
* Unit can interact?
*
- * Public: No
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_exceptions"];
-
-PARAMS_2(_unit,_target);
-
-_exceptions = if (count _this > 2) then {
- _this select 2;
-} else {
- [];
-};
+params ["_unit", "_target", ["_exceptions", []]];
_exceptions = [_exceptions, {toLower _this}] call FUNC(map);
-// exit if the target is not free to interact
private "_owner";
_owner = _target getVariable [QGVAR(owner), objNull];
+// exit if the target is not free to interact
if (!isNull _owner && {_unit != _owner}) exitWith {false};
// check general conditions
-
-private ["_conditions", "_conditionNames", "_conditionFuncs"];
+private ["_conditions", "_canInteract"];
_conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
-_conditionNames = _conditions select 0;
-_conditionFuncs = _conditions select 1;
+_conditions params ["_conditionNames", "_conditionFuncs"];
-private "_canInteract";
_canInteract = true;
-
{
if (!(_x in _exceptions) && {!([_unit, _target] call (_conditionFuncs select _forEachIndex))}) exitWith {
_canInteract = false;
diff --git a/addons/common/functions/fnc_canUseWeapon.sqf b/addons/common/functions/fnc_canUseWeapon.sqf
index ed478a4470..31aaba17a2 100644
--- a/addons/common/functions/fnc_canUseWeapon.sqf
+++ b/addons/common/functions/fnc_canUseWeapon.sqf
@@ -1,14 +1,23 @@
-// by commy2
+/*
+ * Author: commy2
+ * Check if the unit can use a Weapon.
+ * Returns true if the unit is on foot or in a FFV position.
+ *
+ * Arguments:
+ * 0: The Unit
+ *
+ * Return Value:
+ * Can the Unit use Weapons
+ *
+ * Public: Yes
+ */
#include "script_component.hpp"
-// returns true if the unit is on foot or in a ffv position
-
-private ["_config"];
-
-PARAMS_1(_unit);
+params ["_unit"];
if (_unit == vehicle _unit) exitWith {true};
+private "_config";
_config = configFile >> "CfgMovesMaleSdr" >> "States" >> animationState _unit;
isClass _config
diff --git a/addons/common/functions/fnc_changeProjectileDirection.sqf b/addons/common/functions/fnc_changeProjectileDirection.sqf
index 5a65ccff41..79b8c8aeea 100644
--- a/addons/common/functions/fnc_changeProjectileDirection.sqf
+++ b/addons/common/functions/fnc_changeProjectileDirection.sqf
@@ -1,30 +1,23 @@
/*
* Author: commy2
- *
* Adjust a projectiles velocity and dir + up vector.
*
- * Argument:
- * 0: Projectile (Object, CfgAmmo)
- * 1: Adjust azimuth this much. (Number)
- * 2: Adjust inclination this much. (Number)
- * 3: Adjust projectile speed this much. In m/s. (Number, optional default: 0 m/s)
+ * Arguments:
+ * 0: Projectile
+ * 1: Adjust azimuth this much.
+ * 2: Adjust inclination this much.
+ * 3: Adjust projectile speed this much. In m/s. (optional: 0)
*
- * Return value:
- * None.
+ * Return Value:
+ * None
+ *
+ * Public: No
*/
#include "script_component.hpp"
-private ["_adjustSpeed", "_vdir", "_dir", "_up", "_vup", "_vel", "_vlat"];
+params ["_projectile", "_adjustDir", "_adjustUp", ["_adjustSpeed",0]];
-PARAMS_3(_projectile,_adjustDir,_adjustUp);
-
-_adjustSpeed = if (count _this > 3) then {
- _this select 3
-} else {
- 0
-};
-
-["CPD", [_fnc_scriptNameParent, _adjustDir, _adjustUp, _adjustSpeed], nil, false] call FUNC(log);
+private ["_vdir", "_dir", "_up", "_vlat", "_vup", "_vel"];
// get old direction vector
_vdir = vectorNormalized velocity _projectile;
diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf
index c1a0b1cb89..2c8976f042 100644
--- a/addons/common/functions/fnc_checkFiles.sqf
+++ b/addons/common/functions/fnc_checkFiles.sqf
@@ -1,13 +1,14 @@
/*
* Author: commy2
- *
* Compares version numbers of PBOs and DLLs.
*
- * Argument:
- * None.
+ * Arguments:
+ * None
*
- * Return value:
- * None.
+ * Return Value:
+ * None
+ *
+ * Public: No
*/
#include "script_component.hpp"
@@ -17,7 +18,7 @@
private "_version";
_version = getText (configFile >> "CfgPatches" >> "ace_main" >> "versionStr");
-diag_log text format ["[ACE]: ACE is version %1.", _version];
+ACE_LOGINFO_1("ACE is version %1.",_version);
private "_addons";
//_addons = activatedAddons; // broken with High-Command module, see #2134
@@ -30,37 +31,45 @@ _addons = [_addons, {_this find "ace_" == 0}] call FUNC(filter);
private "_errorMsg";
_errorMsg = format ["File %1.pbo is outdated.", _x];
- diag_log text format ["[ACE] ERROR: %1", _errorMsg];
+ ACE_LOGERROR(_errorMsg);
if (hasInterface) then {
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
};
};
-} forEach _addons;
+ false
+} count _addons;
///////////////
// check dlls
///////////////
{
- if (_x callExtension "version" == "") then {
+ private "_versionEx";
+ _versionEx = _x callExtension "version";
+
+ if (_versionEx == "") then {
private "_errorMsg";
_errorMsg = format ["Extension %1.dll not installed.", _x];
- diag_log text format ["[ACE] ERROR: %1", _errorMsg];
+ ACE_LOGERROR(_errorMsg);
if (hasInterface) then {
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
};
} else {
// Print the current extension version
- diag_log text format ["[ACE] Extension version: %1: %2", _x, (_x callExtension "version")];
+ ACE_LOGINFO_2("Extension version: %1: %2",_x,_versionEx);
};
-} forEach getArray (configFile >> "ACE_Extensions" >> "extensions");
+ false
+} count getArray (configFile >> "ACE_Extensions" >> "extensions");
///////////////
// check server version/addons
///////////////
if (isMultiplayer) then {
+ // don't check optional addons
+ _addons = [_addons, {getNumber (configFile >> "CfgPatches" >> _this >> "ACE_isOptional") != 1}] call FUNC(filter);
+
if (isServer) then {
// send servers version of ACE to all clients
GVAR(ServerVersion) = _version;
@@ -72,15 +81,13 @@ if (isMultiplayer) then {
[{
if (isNil QGVAR(ServerVersion) || isNil QGVAR(ServerAddons)) exitWith {};
- private ["_version","_addons"];
- _version = (_this select 0) select 0;
- _addons = (_this select 0) select 1;
+ (_this select 0) params ["_version", "_addons"];
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];
+ ACE_LOGERROR(_errorMsg);
if (hasInterface) then {
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
@@ -91,7 +98,7 @@ if (isMultiplayer) then {
if !(_addons isEqualTo []) then {
_errorMsg = format ["Client/Server Addon Mismatch. Client has extra addons: %1.",_addons];
- diag_log text format ["[ACE] ERROR: %1", _errorMsg];
+ ACE_LOGERROR(_errorMsg);
if (hasInterface) then {
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
diff --git a/addons/common/functions/fnc_checkPBOs.sqf b/addons/common/functions/fnc_checkPBOs.sqf
index 5665ee632c..9cb5ed4d61 100644
--- a/addons/common/functions/fnc_checkPBOs.sqf
+++ b/addons/common/functions/fnc_checkPBOs.sqf
@@ -5,22 +5,20 @@
*
* Arguments:
* 0: Mode
- * 0: Warn once
- * 1: Warn permanently
- * 2: Kick
- * 1: Check all PBOs? (Optional - default: false)
- * 2: Whitelist (Optinal - default: "[]")
+ * 0 = Warn once
+ * 1 = Warn permanently
+ * 2 = Kick
+ * 1: Check all PBOs? (default: false)
+ * 2: Whitelist (default: "[]")
*
- * Return value:
+ * Return Value:
* None
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_mode", "_checkAll", "_whitelist"];
-
-_mode = _this select 0;
-_checkAll = if (count _this > 1) then {_this select 1} else {false};
-_whitelist = if (count _this > 2) then {_this select 2} else {"[]"};
+params ["_mode", ["_checkAll", false], ["_whitelist", "[]"]];
_whitelist = [_whitelist, {toLower _this}] call FUNC(map);
@@ -30,22 +28,17 @@ ACE_Version_Whitelist = _whitelist;
if (!_checkAll) exitWith {}; //ACE is checked by FUNC(checkFiles)
if (!isServer) then {
- [_mode, _checkAll, _whitelist] spawn {
- private ["_missingAddon", "_missingAddonServer", "_oldVersionClient", "_oldVersionServer", "_text", "_error", "_rscLayer", "_ctrlHint"];
- PARAMS_3(_mode,_checkAll,_whitelist);
+ [{
+ if (isNil "ACE_Version_ClientErrors") exitWith {};
- waitUntil {
- sleep 1;
- !isNil "ACE_Version_ClientErrors"
- };
+ ACE_Version_ClientErrors params ["_missingAddon", "_missingAddonServer", "_oldVersionClient", "_oldVersionServer"];
- _missingAddon = ACE_Version_ClientErrors select 0;
- _missingAddonServer = ACE_Version_ClientErrors select 1;
- _oldVersionClient = ACE_Version_ClientErrors select 2;
- _oldVersionServer = ACE_Version_ClientErrors select 3;
+ (_this select 0) params ["_mode", "_checkAll", "_whitelist"];
// Display error message.
if (_missingAddon || {_missingAddonServer} || {_oldVersionClient} || {_oldVersionServer}) then {
+ private ["_text", "_error"];
+
_text = "[ACE] Version mismatch:
";
_error = format ["ACE version mismatch: %1: ", profileName];
@@ -67,11 +60,13 @@ if (!isServer) then {
};
//[_error, "{systemChat _this}"] call FUNC(execRemoteFnc);
- diag_log text _error;
+ ACE_LOGERROR(_error);
if (_mode < 2) then {
_text = composeText [lineBreak, parseText format ["%1", _text]];
+ private ["_rscLayer", "_ctrlHint"];
+
_rscLayer = "ACE_RscErrorHint" call BIS_fnc_rscLayer;
_rscLayer cutRsc ["ACE_RscErrorHint", "PLAIN", 0, true];
@@ -91,9 +86,11 @@ if (!isServer) then {
["[ACE] ERROR", _text, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
};
};
- };
+
+ [_this select 1] call CBA_fnc_removePerFrameHandler;
+ }, 1, [_mode, _checkAll, _whitelist]] call CBA_fnc_addPerFrameHandler;
};
if (_checkAll) then {
- 0 spawn COMPILE_FILE(scripts\Version\checkVersionNumber);
+ 0 spawn COMPILE_FILE(scripts\checkVersionNumber); // @todo
};
diff --git a/addons/common/functions/fnc_claim.sqf b/addons/common/functions/fnc_claim.sqf
index f97b69e194..ac89a80172 100644
--- a/addons/common/functions/fnc_claim.sqf
+++ b/addons/common/functions/fnc_claim.sqf
@@ -1,28 +1,26 @@
/*
* Author: commy2
- *
* Unit claims the ownership over an object. This is used to prevent multiple players from draging the same ammo box or using up the same wheel when repairing etc.
*
* Arguments:
- * 0: Unit that claims another object. ObjNull to remove claim. (Object)
- * 1: The object that gets claimed. (Object)
- * 2: Lock the claimed object aswell? (Bool)
+ * 0: Unit that claims another object. ObjNull to remove claim.
+ * 1: The object that gets claimed.
+ * 2: Lock the claimed object aswell? (optional: false)
*
* Return Value:
- * NONE
+ * None
*
+ * Public: No
*/
#include "script_component.hpp"
-
-PARAMS_3(_unit,_target,_lockTarget);
-if (isNil "_lockTarget") then {_lockTarget = false};
+params ["_unit", "_target", ["_lockTarget", false]];
private "_owner";
_owner = _target getVariable [QGVAR(owner), objNull];
if (!isNull _owner && {!isNull _unit} && {_unit != _owner}) then {
- diag_log text "[ACE] ERROR: Claiming already owned object.";
+ ACE_LOGERROR("Claiming already owned object.");
};
// transfer this immediately
diff --git a/addons/common/functions/fnc_closeDialogIfTargetMoves.sqf b/addons/common/functions/fnc_closeDialogIfTargetMoves.sqf
deleted file mode 100644
index db60180bd1..0000000000
--- a/addons/common/functions/fnc_closeDialogIfTargetMoves.sqf
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: commy2
- *
- * Closes the current dialog if the target moves, changes vehicle etc.
- *
- * Arguments:
- * 0: Target unit
- * 1: Ignore the unit being dead? (Optional, default: No)
- *
- * Return Value:
- * None
- */
-#include "script_component.hpp"
-
-_this spawn {
- PARAMS_2(_target,_ignoreDead);
- private["_inVehicle", "_position", "_vehiclePlayer", "_vehicleTarget"];
-
- if (isNil "_ignoreDead") then {_ignoreDead = false};
-
- _vehicleTarget = vehicle _target;
- _vehiclePlayer = vehicle ACE_player;
- _inVehicle = _target != _vehicleTarget;
-
- _position = getPosASL _target;
-
- _fnc_check = {
- // either unit changed vehicles
- if (_vehiclePlayer != vehicle ACE_player) exitWith {True};
- if (_vehicleTarget != vehicle _target) exitWith {True};
-
- // target died
- if (!alive _target && {!_ignoreDead}) exitWith {True};
-
- // player fell unconscious
- if (ACE_player getVariable ["ACE_isUnconscious", False]) exitWith {True};
-
- // target moved (outside of vehicle)
- (!_inVehicle && {getPosASL _target distanceSqr _position > 1})
- };
-
- waitUntil {
- if (call _fnc_check) then {
- closeDialog 0;
- call EFUNC(interaction,hideMenu);
- };
- (isNil QEGVAR(interaction,MainButton) && !dialog) || {!isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull])} //Exit loop if DisableMouse dialog open
- };
-};
diff --git a/addons/common/functions/fnc_codeToLetter.sqf b/addons/common/functions/fnc_codeToLetter.sqf
index 8e8a9c8a3e..80f6291d0f 100644
--- a/addons/common/functions/fnc_codeToLetter.sqf
+++ b/addons/common/functions/fnc_codeToLetter.sqf
@@ -1,4 +1,19 @@
-// by commy2
+/*
+ * Author: commy2
+ * Converts some keys to an Arma Dik Code.
+ *
+ * Arguments:
+ * 0: Key
+ *
+ * Return Value:
+ * Dik Code
+ *
+ * Public: Yes
+ *
+ * Deprecated
+ */
#include "script_component.hpp"
+ACE_DEPRECATED("ace_common_fnc_codeToLetter","3.5.0","-");
+
["", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] select ([2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 44, 21] find (_this select 0)) + 1
diff --git a/addons/common/functions/fnc_codeToString.sqf b/addons/common/functions/fnc_codeToString.sqf
index 1698182051..4a1b158f21 100644
--- a/addons/common/functions/fnc_codeToString.sqf
+++ b/addons/common/functions/fnc_codeToString.sqf
@@ -1,22 +1,23 @@
/*
* Author: commy2
- *
* Removes the brackets around a code and returns the code as a string. It does nothing if the code is already a string.
*
- * Argument:
- * 0: Code (Code or String)
+ * Arguments:
+ * 0: Code
*
* Return value:
- * Code (String)
+ * Code
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-PARAMS_1(_function);
+params ["_function"];
if (typeName _function == "STRING") exitWith {_function};
_function = toArray str _function;
-_function set [0, -1];
-_function set [count _function - 1, -1];
-_function = toString (_function - [-1]);
-_function
+_function deleteAt 0;
+_function deleteAt (count _function - 1);
+
+toString _function // return
diff --git a/addons/common/functions/fnc_convertKeyCode.sqf b/addons/common/functions/fnc_convertKeyCode.sqf
deleted file mode 100644
index 498a3eb706..0000000000
--- a/addons/common/functions/fnc_convertKeyCode.sqf
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Author: commy2
- *
- * Get a key code used in ACE key input eh.
- *
- * Argument:
- * 0: Arma DIK code (Number)
- * 1: Key state for shift left and shift right key (Bool)
- * 2: Key state for ctrl left and ctrl right key (Bool)
- * 3: Key state for alt and alt gr key (Bool)
- *
- * Return value:
- * Key code (Number)
- */
-#include "script_component.hpp"
-
-#define KEY_MODIFIERS [42, 54, 29, 157, 56, 184]
-
-PARAMS_1(_key);
-
-if (_key in KEY_MODIFIERS) exitWith {_key};
-
-if (_this select 1) then {_key = _key + 0.1};
-if (_this select 2) then {_key = _key + 0.2};
-if (_this select 3) then {_key = _key + 0.4};
-
-_key
diff --git a/addons/common/functions/fnc_createOrthonormalReference.sqf b/addons/common/functions/fnc_createOrthonormalReference.sqf
index 346127c658..4a8db8bba1 100644
--- a/addons/common/functions/fnc_createOrthonormalReference.sqf
+++ b/addons/common/functions/fnc_createOrthonormalReference.sqf
@@ -1,19 +1,21 @@
/*
* Author: esteldunedain
- *
* Returns a orthonormal system of reference aligned with the supplied vector
*
- * Argument:
- * Vector to align the coordinate system with (Array)
+ * Arguments:
+ * Vector to align the coordinate system with
*
- * Return value:
- * 0: v1 (Array)
- * 1: v2 (Array)
- * 2: v3 (Array)
+ * Return Value:
+ * 0: Vector Normalized
+ * 1: Normalized Cross Product Vector
+ * 2: Vector Cross Product
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_v1","_v2","_v3"];
+private ["_v1", "_v2", "_v3"];
+
_v1 = vectorNormalized _this;
_v2 = vectorNormalized (_v1 vectorCrossProduct [0,0,1]);
_v3 = _v2 vectorCrossProduct _v1;
diff --git a/addons/common/functions/fnc_currentChannel.sqf b/addons/common/functions/fnc_currentChannel.sqf
index 127f3b7a54..82dd66b485 100644
--- a/addons/common/functions/fnc_currentChannel.sqf
+++ b/addons/common/functions/fnc_currentChannel.sqf
@@ -1,13 +1,14 @@
/*
* Author: commy2
- *
* Returns the current radio / chat / marker channel.
*
- * Argument:
- * NONE.
+ * Arguments:
+ * None
*
- * Return value:
- * The current channel. Can be "group", "side", "global", "command", "vehicle", "direct" or "custom_X" (String)
+ * Return Value:
+ * The current channel ("group", "side", "global", "command", "vehicle", "direct", "custom_X")
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
diff --git a/addons/common/functions/fnc_debug.sqf b/addons/common/functions/fnc_debug.sqf
index fd1d3d59fa..6430a7bb11 100644
--- a/addons/common/functions/fnc_debug.sqf
+++ b/addons/common/functions/fnc_debug.sqf
@@ -1,58 +1,44 @@
-/**
- * fn_debug.sqf
- * @Descr: Print logging messages through the ACE framework.
- * @Author: Glowbal
+/*
+ * Author: Glowbal
+ * Print logging messages through the ACE framework.
*
- * @Arguments: [message ANY, level NUMBER (Optional)]
- * @Return: BOOL True if message has been printed
- * @PublicAPI: true
+ * Arguments:
+ * 0: Message
+ * 1: Level (default: 2)
+ *
+ * Return Value:
+ * Message is Printed
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
#define DEFAULT_LOGGING_LEVEL -1
#define DEFAULT_TEXT_DISPLAY -1
-private ["_level", "_prefix", "_defaultLoglevel","_defaultLogDisplayLevel", "_message"];
-PARAMS_1(_msg);
-_level = if (count _this > 1) then {_this select 1} else { 2 };
+params ["_msg", ["_level", 2, [0]]];
-if (typeName _level != "NUMBER") then {
- _level = 2;
-};
+private ["_defaultLoglevel", "_defaultLogDisplayLevel"];
-_defaultLoglevel = if (isNil QGVAR(LOGLEVEL)) then {
- DEFAULT_LOGGING_LEVEL;
-} else {
- GVAR(LOGLEVEL);
-};
+_defaultLoglevel = [GVAR(LOGLEVEL), DEFAULT_LOGGING_LEVEL] select isNil QGVAR(LOGLEVEL);
-if (_defaultLoglevel < 0) exitwith {
- false
-};
+if (_defaultLoglevel < 0) exitwith {false};
-_defaultLogDisplayLevel = if (isnil QGVAR(LOGDISPLAY_LEVEL)) then {
- DEFAULT_TEXT_DISPLAY;
-} else {
- GVAR(LOGDISPLAY_LEVEL);
-};
+_defaultLogDisplayLevel = [GVAR(LOGDISPLAY_LEVEL), DEFAULT_TEXT_DISPLAY] select isNil QGVAR(LOGDISPLAY_LEVEL);
if (_level <= _defaultLoglevel) then {
+ private ["_prefix", "_message"];
- _prefix = switch (_level) do {
- case 0: { "ACE Error" };
- case 1: { "ACE Warn" };
- case 2: { "ACE Debug" };
- case 3: { "ACE Info" };
- default { "ACE Unknown" };
- };
- _message = format["[%1] %2",_prefix,_msg];
+ _prefix = ["Unknown", "Error", "Warn", "Debug", "Info"] select ([0, 1, 2, 3] find _level + 1);
+
+ _message = format ["[ACE %1] %2", _prefix, _msg];
if (_level <= _defaultLogDisplayLevel) then {
systemChat _message;
};
diag_log _message;
- // pass it onwards to the log function:
- // [0, [], compile format["%1",_msg], true] call FUNC(log);
+
};
-true
\ No newline at end of file
+
+true
diff --git a/addons/common/functions/fnc_debugModule.sqf b/addons/common/functions/fnc_debugModule.sqf
index 262ae9c02d..4f3da4d7cb 100644
--- a/addons/common/functions/fnc_debugModule.sqf
+++ b/addons/common/functions/fnc_debugModule.sqf
@@ -1,16 +1,18 @@
-/**
- * fn_debugModule.sqf
- * @Descr: N/A
- * @Author: Glowbal
+/*
+ * Author: Glowbal
+ * ?
*
- * @Arguments: []
- * @Return:
- * @PublicAPI: false
+ * Arguments:
+ * None
+ *
+ * Return Value:
+ * None
+ *
+ * Public: No
*/
-
#include "script_component.hpp"
-PARAMS_1(_entity);
+params ["_entity"];
GVAR(LOGDISPLAY_LEVEL) = call compile (_entity getvariable ["logDisplayLevel","4"]);
GVAR(LOGLEVEL) = call compile (_entity getvariable ["logLevel","4"]);
diff --git a/addons/common/functions/fnc_defineVariable.sqf b/addons/common/functions/fnc_defineVariable.sqf
index 28ed5b2015..6ea15adc43 100644
--- a/addons/common/functions/fnc_defineVariable.sqf
+++ b/addons/common/functions/fnc_defineVariable.sqf
@@ -1,38 +1,34 @@
-/**
- * fn_defineVariable.sqf
- * @Descr: Define a variable for the ACE variable framework
- * @Author: Glowbal
+/*
+ * Author: Glowbal
+ * Define a variable for the ACE variable framework
*
- * @Arguments: [name STRING, defaultValue ANY, publicFlag BOOL, category STRING, type NUMBER, persistentFlag BOOL]
- * @Return:
- * @PublicAPI: true
+ * Arguments:
+ * 0: Name
+ * 1: defaultValue
+ * 2: publicFlag
+ * 3: category
+ * 4: type (default: 0)
+ * 5: persistentFlag (default: false)
+ *
+ * Return Value:
+ * None
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_code","_persistent"];
+params ["_name", "_value", "_defaultGlobal", "_category", ["_code", 0], ["_persistent", false]];
-PARAMS_4(_name,_value,_defaultGlobal,_catagory);
+if (isNil "_defaultGlobal") exitWith {};
-_code = 0;
-_persistent = false;
-
-if (count _this < 3) exitwith {};
-if (count _this > 4) then {
- _code = _this select 4;
- if (count _this > 5) then {
- _persistent = _this select 5;
- };
+if (typeName _name != "STRING") exitwith {
+ [format ["Tried to the deinfe a variable with an invalid name: %1 Arguments: %2", _name, _this]] call FUNC(debug);
};
-if (typeName _name != typeName "") exitwith {
- [format["Tried to the deinfe a variable with an invalid name: %1 Arguments: %2", _name, _this]] call FUNC(debug);
-};
-
-if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) then {
+if (isNil QGVAR(OBJECT_VARIABLES_STORAGE)) then {
GVAR(OBJECT_VARIABLES_STORAGE) = [];
};
-GVAR(OBJECT_VARIABLES_STORAGE) pushback [_name,_value,_defaultGlobal,_catagory,_code, _persistent];
-
-missionNamespace setvariable [QGVAR(OBJECT_VARIABLES_STORAGE_) + _name, [_name,_value,_defaultGlobal,_catagory,_code, _persistent]];
+GVAR(OBJECT_VARIABLES_STORAGE) pushBack [_name, _value, _defaultGlobal, _category, _code, _persistent];
+missionNamespace setVariable [QGVAR(OBJECT_VARIABLES_STORAGE_) + _name, [_name, _value, _defaultGlobal, _category, _code, _persistent]];
diff --git a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf
index a8418cd4cd..681ab946e0 100644
--- a/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf
+++ b/addons/common/functions/fnc_deviceKeyFindValidIndex.sqf
@@ -3,7 +3,7 @@
* Finds next valid index for the device array.
*
* Arguments:
- * 0: Offset from currentIndex (use 1 to find next valid after current) or a displayName string or
+ * 0: Offset from currentIndex (use 1 to find next valid after current) or a displayName string (default: 0)
*
* Return Value:
* The new index (-1 if no valid)
@@ -16,23 +16,25 @@
*/
#include "script_component.hpp"
-DEFAULT_PARAM(0,_searchOffsetOrName,0);
+params [["_searchOffsetOrName", 0]];
-private ["_validIndex", "_offsetBy", "_realIndex", "_offset"];
+private ["_validIndex", "_realIndex"];
_validIndex = -1;
-if ((typeName _searchOffsetOrName) == "STRING") then {
+if (typeName _searchOffsetOrName == "STRING") then {
{
- if ((_x select 0) == _searchOffsetOrName) exitWith {
+ if (_x select 0 == _searchOffsetOrName) exitWith {
_validIndex = _forEachIndex;
};
} forEach GVAR(deviceKeyHandlingArray);
} else {
- if ((count GVAR(deviceKeyHandlingArray)) > 0) then {
- _baseIndex = if (GVAR(deviceKeyCurrentIndex) == -1) then {0} else {GVAR(deviceKeyCurrentIndex) + _searchOffsetOrName};
- for "_offset" from _baseIndex to ((count GVAR(deviceKeyHandlingArray)) - 1 + _baseIndex) do {
+ if (count GVAR(deviceKeyHandlingArray) > 0) then {
+ _baseIndex = [GVAR(deviceKeyCurrentIndex) + _searchOffsetOrName, 0] select (GVAR(deviceKeyCurrentIndex) == -1);
+
+ for "_offset" from _baseIndex to (count GVAR(deviceKeyHandlingArray) - 1 + _baseIndex) do {
_realIndex = _offset % (count GVAR(deviceKeyHandlingArray));
+
if ([] call ((GVAR(deviceKeyHandlingArray) select _realIndex) select 2)) exitWith {
_validIndex = _realIndex;
};
diff --git a/addons/common/functions/fnc_deviceKeyRegisterNew.sqf b/addons/common/functions/fnc_deviceKeyRegisterNew.sqf
index 88ffa84af7..416eef2c77 100644
--- a/addons/common/functions/fnc_deviceKeyRegisterNew.sqf
+++ b/addons/common/functions/fnc_deviceKeyRegisterNew.sqf
@@ -10,7 +10,7 @@
* 4: Close Code (on ctrl-home press)
*
* Return Value:
- * Nothing
+ * None
*
* Example:
* [(localize "STR_ACE_microdagr_itemName"), QUOTE(PATHTOF(images\microDAGR_item.paa)), _conditionCode, _toggleCode, _closeCode] call ace_common_fnc_deviceKeyRegisterNew
@@ -19,7 +19,8 @@
*/
#include "script_component.hpp"
-PARAMS_5(_displayName,_iconImage,_conditionCode,_toggleCode,_closeCode);
+params ["_displayName", "_iconImage", "_conditionCode", "_toggleCode", "_closeCode"];
+
+GVAR(deviceKeyHandlingArray) pushBack [_displayName, _iconImage, _conditionCode, _toggleCode, _closeCode];
-GVAR(deviceKeyHandlingArray) pushBack [_displayName,_iconImage,_conditionCode,_toggleCode,_closeCode];
[] call FUNC(deviceKeyFindValidIndex);
diff --git a/addons/common/functions/fnc_disableAI.sqf b/addons/common/functions/fnc_disableAI.sqf
index 0e1985eced..1a66628ffb 100644
--- a/addons/common/functions/fnc_disableAI.sqf
+++ b/addons/common/functions/fnc_disableAI.sqf
@@ -10,15 +10,17 @@
* None
*
* Example:
- * [bob, true] call ace_common_fnc_disableAI;
+ * [bob, true] call ace_common_fnc_disableAI
*
* Public: No
*/
#include "script_component.hpp"
-PARAMS_2(_unit,_disable);
+params ["_unit", "_disable"];
-if ((local _unit) && {!([_unit] call EFUNC(common,isPlayer))}) then {
+if (!local _unit) exitWith {};
+
+if !([_unit] call EFUNC(common,isPlayer)) then {
if (_disable) then {
_unit disableAI "MOVE";
_unit disableAI "TARGET";
@@ -27,7 +29,10 @@ if ((local _unit) && {!([_unit] call EFUNC(common,isPlayer))}) then {
_unit disableConversation true;
} else {
//Sanity check to make sure we don't enable unconsious AI
- if (_unit getVariable ["ace_isunconscious", false] && alive _unit) exitWith {ERROR("Enabling AI for unconsious unit");};
+ if (_unit getVariable ["ace_isunconscious", false] && alive _unit) exitWith {
+ ERROR("Enabling AI for unconsious unit");
+ };
+
_unit enableAI "MOVE";
_unit enableAI "TARGET";
_unit enableAI "AUTOTARGET";
diff --git a/addons/common/functions/fnc_disableUserInput.sqf b/addons/common/functions/fnc_disableUserInput.sqf
index d9485b11e7..8b00cedeac 100644
--- a/addons/common/functions/fnc_disableUserInput.sqf
+++ b/addons/common/functions/fnc_disableUserInput.sqf
@@ -5,23 +5,20 @@
* Arguments:
* 0: True to disable key inputs, false to re-enable them
*
- * Return value:
- * Nothing
+ * Return Value:
+ * None
*
- * Public: Yes
+ * Public: No
*/
-
#include "script_component.hpp"
-private ["_dlg"];
-
-PARAMS_1(_state);
+params ["_state"];
if (_state) then {
disableSerialization;
if (!isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull])) exitWith {};
- if ("ACE_DisableUserInput" in ([BIS_stackedEventHandlers_onEachFrame, {_this select 0}] call FUNC(map))) exitWith {};
+ if (!isNil QGVAR(disableInputPFH)) exitWith {};
// end TFAR and ACRE2 radio transmissions
call FUNC(endRadioTransmission);
@@ -34,21 +31,20 @@ if (_state) then {
closeDialog 0;
createDialog QGVAR(DisableMouse_Dialog);
+ private "_dlg";
_dlg = uiNamespace getVariable QGVAR(dlgDisableMouse);
_dlg displayAddEventHandler ["KeyDown", {
- private ["_key", "_dlg", "_ctrl", "_config", "_acc", "_index"];
- _key = _this select 1;
+ params ["", "_key"];
if (_key == 1 && {alive player}) then {
createDialog (["RscDisplayInterrupt", "RscDisplayMPInterrupt"] select isMultiplayer);
disableSerialization;
- _dlg = finddisplay 49;
- _dlg displayAddEventHandler ["KeyDown", {
- _key = _this select 1;
- !(_key == 1)
- }];
+
+ private ["_dlg", "_ctrl"];
+
+ _dlg = findDisplay 49;
for "_index" from 100 to 2000 do {
(_dlg displayCtrl _index) ctrlEnable false;
@@ -62,19 +58,21 @@ if (_state) then {
_ctrl = _dlg displayctrl ([104, 1010] select isMultiplayer);
_ctrl ctrlSetEventHandler ["buttonClick", QUOTE(closeDialog 0; player setDamage 1; [false] call DFUNC(disableUserInput);)];
- _ctrl ctrlEnable (call {_config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
+ _ctrl ctrlEnable (call {private "_config"; _config = missionConfigFile >> "respawnButton"; !isNumber _config || {getNumber _config == 1}});
_ctrl ctrlSetText "RESPAWN";
_ctrl ctrlSetTooltip "Respawn.";
};
if (_key in actionKeys "TeamSwitch" && {teamSwitchEnabled}) then {
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
+
+ private "_acc";
_acc = accTime;
teamSwitch;
setAccTime _acc;
};
- if (_key in actionKeys "CuratorInterface" && {getAssignedCuratorLogic player in allCurators}) then {
+ if (_key in actionKeys "CuratorInterface" && {getAssignedCuratorLogic player in allCurators}) then {
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
openCuratorInterface;
};
@@ -95,16 +93,17 @@ if (_state) then {
_dlg displayAddEventHandler ["KeyUp", {true}];
- ["ACE_DisableUserInput", "onEachFrame", {
+ GVAR(disableInputPFH) = [{
if (isNull (uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) && {!visibleMap && isNull findDisplay 49 && isNull findDisplay 312 && isNull findDisplay 632}) then {
- ["ACE_DisableUserInput", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
+ [GVAR(disableInputPFH)] call CBA_fnc_removePerFrameHandler;
+ GVAR(disableInputPFH) = nil;
[true] call FUNC(disableUserInput);
};
- }] call BIS_fnc_addStackedEventHandler;
-
+ }, 0, []] call CBA_fnc_addPerFrameHandler;
} else {
- if ("ACE_DisableUserInput" in ([BIS_stackedEventHandlers_onEachFrame, {_this select 0}] call FUNC(map))) then {
- ["ACE_DisableUserInput", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
+ if (!isNil QGVAR(disableInputPFH)) then {
+ [GVAR(disableInputPFH)] call CBA_fnc_removePerFrameHandler;
+ GVAR(disableInputPFH) = nil;
};
(uiNamespace getVariable [QGVAR(dlgDisableMouse), displayNull]) closeDisplay 0;
diff --git a/addons/common/functions/fnc_displayIcon.sqf b/addons/common/functions/fnc_displayIcon.sqf
index 2fd5245465..8421f5be7e 100644
--- a/addons/common/functions/fnc_displayIcon.sqf
+++ b/addons/common/functions/fnc_displayIcon.sqf
@@ -1,24 +1,23 @@
/*
-* Author: Glowbal
-*
-* Draw progress bar and execute given function if succesful.
-* Finish/Failure/Conditional are all passed [args, elapsedTime, totalTime, errorCode]
-*
-* Argument:
-* 0: icon ID
-* 1: show
-* 2: Icon Path
-* 3: Icon color
-* 4: timeAlive. -1 = forever
-*
-* Return value:
-* Nothing
-*
-* Example:
-* ["myID", true, QUOTE(PATHTOF(data\icon_group.paa)), [1,1,1,1], 0] call ace_gui_fnc_displayIcon;
-*/
-
-
+ * Author: Glowbal
+ * Draw progress bar and execute given function if succesful.
+ * Finish/Failure/Conditional are all passed [args, elapsedTime, totalTime, errorCode]
+ *
+ * Arguments:
+ * 0: icon ID
+ * 1: show
+ * 2: Icon Path
+ * 3: Icon color
+ * 4: timeAlive. -1 = forever (default: 6)
+ *
+ * Return Value:
+ * None
+ *
+ * Example:
+ * ["myID", true, QUOTE(PATHTOF(data\icon_group.paa)), [1,1,1,1], 0] call ace_gui_fnc_displayIcon;
+ *
+ * Public: Yes
+ */
#include "script_component.hpp"
// positions for the icon UI
@@ -42,31 +41,37 @@
// other constants
#define DEFAULT_TIME 6
-private ["_allControls", "_refresh", "_timeAlive", "_list"];
-
-PARAMS_4(_iconId,_show,_icon,_color);
-
-_timeAlive = if (count _this > 4) then {_this select 4} else {DEFAULT_TIME};
-
disableSerialization;
-_list = missionNamespace getvariable [QGVAR(displayIconList),[]];
+
+params ["_iconId", "_show", "_icon", "_color", ["_timeAlive", DEFAULT_TIME]];
+
+private ["_list", "_refresh"];
+
+_list = missionNamespace getVariable [QGVAR(displayIconList), []];
_refresh = {
- private ["_allControls"];
// Refreshing of all icons..
- _allControls = missionNamespace getvariable [QGVAR(displayIconListControls), []];
+ private "_allControls";
+ _allControls = missionNamespace getVariable [QGVAR(displayIconListControls), []];
+
{
ctrlDelete _x;
- }foreach _allControls;
+ false
+ } count _allControls;
_allControls = [];
- private ["_ctrl", "_setting", "_position"];
- _setting = missionNamespace getvariable[QGVAR(settingFeedbackIcons), 0];
+ private ["_setting", "_ctrl", "_position"];
+
+ _setting = missionNamespace getVariable [QGVAR(settingFeedbackIcons), 0];
+
if (_setting > 0) then {
{
+ _x params ["", "_xicon", "_xcolor"];
+
// +19000 because we want to make certain we are using free IDCs..
- _ctrl = ((findDisplay 46) ctrlCreate ["RscPicture", _foreachIndex + 19000]);
+ _ctrl = (findDisplay 46) ctrlCreate ["RscPicture", _forEachIndex + 19000];
+
_position = switch (_setting) do {
case TOP_RIGHT_DOWN: {[X_POS_ICONS, Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
case TOP_RIGHT_LEFT: {[X_POS_ICONS_SECOND - ((_foreachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND - (ICON_WIDTH / 2), ICON_WIDTH, ICON_WIDTH]};
@@ -74,46 +79,53 @@ _refresh = {
case TOP_LEFT_RIGHT: {[LEFT_SIDE + (0.5 * ICON_WIDTH) - ((_foreachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND, ICON_WIDTH, ICON_WIDTH]};
default {[X_POS_ICONS, Y_POS_ICONS + (_foreachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
};
+
_ctrl ctrlSetPosition _position;
- _ctrl ctrlsetText (_x select 1);
- _ctrl ctrlSetTextColor (_x select 2);
+ _ctrl ctrlSetText _xicon;
+ _ctrl ctrlSetTextColor _xcolor;
_ctrl ctrlCommit 0;
- _allControls pushback _ctrl;
- }foreach (missionNamespace getvariable [QGVAR(displayIconList),[]]);
+ _allControls pushBack _ctrl;
+ false
+ } forEach (missionNamespace getVariable [QGVAR(displayIconList),[]]);
};
- missionNamespace setvariable [QGVAR(displayIconListControls), _allControls];
+
+ missionNamespace setVariable [QGVAR(displayIconListControls), _allControls];
};
if (_show) then {
- if ({(_x select 0 == _iconId)} count _list == 0) then {
- _list pushback [_iconId, _icon, _color, ACE_time];
+ if ({_x select 0 == _iconId} count _list == 0) then {
+ _list pushBack [_iconId, _icon, _color, ACE_time];
} else {
{
if (_x select 0 == _iconId) exitwith {
- _list set [_foreachIndex, [_iconId, _icon, _color, ACE_time]];
+ _list set [_forEachIndex, [_iconId, _icon, _color, ACE_time]];
};
} forEach _list;
};
- missionNamespace setvariable [QGVAR(displayIconList), _list];
+
+ missionNamespace setVariable [QGVAR(displayIconList), _list];
call _refresh;
if (_timeAlive >= 0) then {
[{
- [_this select 0, false, "", [0,0,0], 0] call FUNC(displayIcon);
- }, [_iconId], _timeAlive, _timeAlive] call EFUNC(common,waitAndExecute);
+ [_this select 0, false, "", [0,0,0], 0] call FUNC(displayIcon);
+ }, [_iconId], _timeAlive, _timeAlive] call FUNC(waitAndExecute);
};
} else {
- if ({(_x select 0 == _iconId)} count _list == 1) then {
+
+ if ({_x select 0 == _iconId} count _list == 1) then {
private "_newList";
_newList = [];
+
{
if (_x select 0 != _iconId) then {
- _newList pushback _x;
+ _newList pushBack _x;
};
- } forEach _list;
+ false
+ } count _list;
- missionNamespace setvariable [QGVAR(displayIconList), _newList];
+ missionNamespace setVariable [QGVAR(displayIconList), _newList];
call _refresh;
};
};
diff --git a/addons/common/functions/fnc_displayText.sqf b/addons/common/functions/fnc_displayText.sqf
index 22349962ac..fce8fdd832 100644
--- a/addons/common/functions/fnc_displayText.sqf
+++ b/addons/common/functions/fnc_displayText.sqf
@@ -1,42 +1,35 @@
/*
* Author: commy2
- *
* Display a message.
*
- * Argument:
- * 0: Message (String)
- * 1: Play a clicking sound (Bool, optional default: false)
- * 2: How long before hiding the message in seconds (Number, optional default: 2 sec)
- * 3: Priority, higher priority messages will override lesser important ones (Number, optional default: 0)
+ * Arguments:
+ * 0: Message
+ * 1: Play a clicking sound (default: false)
+ * 2: How long before hiding the message in seconds (default: 2)
+ * 3: Priority, higher priority messages will override lesser important ones (default: 0)
*
- * Return value:
- * Nothing
+ * Return Value:
+ * None
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-#define DEFAULT_PLAY_SOUND false
-#define DEFAULT_DELAY 2
-#define DEFAULT_PRIORITY 0
-
-_this resize 4;
-
-private ["_lastHintTime", "_lastHintPriority", "_time"];
-
-PARAMS_4(_text,_sound,_delay,_priority);
+params ["_text", ["_sound", false], ["_delay", 2], ["_priority", 0]];
if (isNil QGVAR(lastHint)) then {
GVAR(lastHint) = [0, 0];
};
+if !(typeName _text in ["STRING", "TEXT"]) then {_text = str _text};
+
+private ["_lastHintTime", "_lastHintPriority", "_time"];
+
_lastHintTime = GVAR(lastHint) select 0;
_lastHintPriority = GVAR(lastHint) select 1;
-if !(typeName _text in ["STRING", "TEXT"]) then {_text = str _text};
-if (isNil "_sound") then {_sound = DEFAULT_PLAY_SOUND};
-if (isNil "_delay") then {_delay = DEFAULT_DELAY};
-if (isNil "_priority") then {_priority = DEFAULT_PRIORITY};
-
_time = ACE_time;
+
if (_time > _lastHintTime + _delay || {_priority >= _lastHintPriority}) then {
hintSilent _text;
if (_sound) then {playSound "ACE_Sound_Click"};
diff --git a/addons/common/functions/fnc_displayTextPicture.sqf b/addons/common/functions/fnc_displayTextPicture.sqf
index 93d4d38df7..3bdf908d16 100644
--- a/addons/common/functions/fnc_displayTextPicture.sqf
+++ b/addons/common/functions/fnc_displayTextPicture.sqf
@@ -1,25 +1,21 @@
/*
* Author: commy2, Glowbal
- *
* Display a structured text with image.
*
- * Argument:
+ * Arguments:
* 0: Text
* 1: Image
- * 2: Image color
- * 3: Target Unit. Will only display if target is the player controlled object
+ * 2: Image color (default: [0, 0, 0, 0])
+ * 3: Target Unit. Will only display if target is the player controlled object (default: ACE_player)
*
- * Return value:
- * Nothing
+ * Return Value:
+ * None
+ *
+ * Public: Yes
*/
-
#include "script_component.hpp"
-private ["_imageColor", "_target"];
-PARAMS_2(_text,_image);
-_imageColor = if (count _this > 2) then {_this select 2} else {[1,1,1]};
-_imageColor resize 3;
-_target = if (count _this > 3) then {_this select 3} else {ACE_player};
+params ["_text", "_image", ["_imageColor", [1,1,1]], ["_target", ACE_player]];
if (_target != ACE_player) exitWith {};
@@ -28,16 +24,21 @@ if (typeName _text != "TEXT") then {
if (count _text > 0) then {
{
if (typeName _x == "STRING" && {isLocalized _x}) then {
- _text set [_foreachIndex, localize _x];
+ _text set [_forEachIndex, localize _x];
};
- }foreach _text;
+ } forEach _text;
+
_text = format _text;
};
};
+
if (typeName _text == "STRING" && {isLocalized _text}) then {
_text = localize _text;
};
+
_text = parseText format ["%1", _text];
};
+
_text = composeText [parseText format ["
", _image, _imageColor call BIS_fnc_colorRGBtoHTML], lineBreak, _text];
+
[_text, 2] call FUNC(displayTextStructured);
diff --git a/addons/common/functions/fnc_displayTextStructured.sqf b/addons/common/functions/fnc_displayTextStructured.sqf
index cfe2feb3cb..255a014b6f 100644
--- a/addons/common/functions/fnc_displayTextStructured.sqf
+++ b/addons/common/functions/fnc_displayTextStructured.sqf
@@ -1,23 +1,20 @@
/*
* Author: commy2, Glowbal
- *
* Display a structured text.
*
- * Argument:
+ * Arguments:
* 0: Text
- * 1: Size of the textbox
- * 2: Target Unit. Will only display if target is the player controlled object
+ * 1: Size of the textbox (default: 1.5)
+ * 2: Target Unit. Will only display if target is the player controlled object (default: ACE_player)
*
- * Return value:
- * Nothing
+ * Return Value:
+ * None
+ *
+ * Public: Yes
*/
-
#include "script_component.hpp"
-private ["_text", "_size", "_isShown", "_ctrlHint", "_yPos", "_xPos", "_wPos", "_hPos", "_position", "_target"];
-_text = _this select 0;
-_size = if (count _this > 1) then {_this select 1} else {1.5;};
-_target = if (count _this > 2) then {_this select 2} else {ACE_player};
+params ["_text", ["_size", 1.5], ["_target", ACE_player]];
if (_target != ACE_player) exitWith {};
@@ -38,6 +35,8 @@ if (typeName _text != "TEXT") then {
_text = composeText [lineBreak, parseText format ["%1", _text]];
};
+private ["_isShown", "_ctrlHint", "_xPos", "_yPos", "_wPos", "_hPos", "_position"];
+
_isShown = ctrlShown (uiNamespace getVariable ["ACE_ctrlHint", controlNull]);
("ACE_RscHint" call BIS_fnc_rscLayer) cutRsc ["ACE_RscHint", "PLAIN", 0, true];
@@ -60,8 +59,8 @@ _yPos = safeZoneY + 0.175 * safezoneH;
_wPos = (10 *(((safezoneW / safezoneH) min 1.2) / 40));
_hPos = (2 *((((safezoneW / safezoneH) min 1.2) / 1.2) / 25));
-//Zeus Interface Open and Display would be under the "CREATE" list
-if (!isnull curatorCamera) then {
+// Zeus Interface Open and Display would be under the "CREATE" list
+if (!isNull curatorCamera) then {
_xPos = _xPos min ((safezoneX + safezoneW - 12.5 * (((safezoneW / safezoneH) min 1.2) / 40)) - _wPos);
};
diff --git a/addons/common/functions/fnc_doAnimation.sqf b/addons/common/functions/fnc_doAnimation.sqf
index 07d9ec9e35..42d59f0b72 100644
--- a/addons/common/functions/fnc_doAnimation.sqf
+++ b/addons/common/functions/fnc_doAnimation.sqf
@@ -3,35 +3,22 @@
*
* Execute an animation. This is used to not break things like the unconsciousness animation.
*
- * Argument:
- * 0: Unit (Object)
- * 1: Animation (String)
- * 2: Priority of the animation. (Number, optional default: 0)
- * 0: PlayMove
- * 1: PlayMoveNow
- * 2: SwitchMove (no transitional animation, doesn't overwrite priority 1)
+ * Arguments:
+ * 0: Unit
+ * 1: Animation
+ * 2: Priority of the animation. (default: 0)
+ * 0 = PlayMove
+ * 1 = PlayMoveNow
+ * 2 = SwitchMove (no transitional animation, doesn't overwrite priority 1)
*
- * Return value:
- * Nothing
+ * Return Value:
+ * None
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_force"];
-
-PARAMS_3(_unit,_animation,_priority);
-_force = False;
-
-// no animation given
-if (isNil "_animation") exitWith {
- diag_log format ["[ACE] ERROR: No animation specified in %1", _fnc_scriptNameParent];
-};
-
-if (isNil "_priority") then {
- _priority = 0;
-};
-if (count _this > 3) then {
- _force = _this select 3;
-};
+params ["_unit", "_animation", ["_priority", 0], ["_force", false]];
// don't overwrite more important animations
if (_unit getVariable ["ACE_isUnconscious", false] && {(_animation != "Unconscious")} && {!_force}) exitWith {};
@@ -44,8 +31,10 @@ if (_animation == "") then {
_animation = [_unit] call FUNC(getDefaultAnim);
};
+//if (_animation == animationState _unit) exitWith {};
+
switch (_priority) do {
- case 0 : {
+ case 0: {
if (_unit == vehicle _unit) then {
[_unit, format ["{_this playMove '%1'}", _animation], _unit] call FUNC(execRemoteFnc);
} else {
@@ -53,7 +42,7 @@ switch (_priority) do {
[_unit, format ["{_this playMove '%1'}", _animation]] call FUNC(execRemoteFnc);
};
};
- case 1 : {
+ case 1: {
if (_unit == vehicle _unit) then {
[_unit, format ["{_this playMoveNow '%1'}", _animation], _unit] call FUNC(execRemoteFnc);
} else {
@@ -61,11 +50,20 @@ switch (_priority) do {
[_unit, format ["{_this playMoveNow '%1'}", _animation]] call FUNC(execRemoteFnc);
};
};
- case 2 : {
- // Execute on all machines. SwitchMove has local effects.
- [_unit, format ["{_this switchMove '%1'}", _animation]] call FUNC(execRemoteFnc);
+ case 2: {
+ // try playMoveNow first
+ if (_unit == vehicle _unit) then {
+ [_unit, format ["{_this playMoveNow '%1'}", _animation], _unit] call FUNC(execRemoteFnc);
+ } else {
+ // Execute on all machines. PlayMove and PlayMoveNow are bugged: They have no global effects when executed on remote machines inside vehicles.
+ [_unit, format ["{_this playMoveNow '%1'}", _animation]] call FUNC(execRemoteFnc);
+ };
+
+ // if animation doesn't respond, do switchMove
+ if (animationState _unit != _animation) then {
+ // Execute on all machines. SwitchMove has local effects.
+ [_unit, format ["{_this switchMove '%1'}", _animation]] call FUNC(execRemoteFnc);
+ };
};
default {};
};
-
-["Anim", [_priority, _animation]] call FUNC(log);
diff --git a/addons/common/functions/fnc_dropBackpack.sqf b/addons/common/functions/fnc_dropBackpack.sqf
index 05ee3ab750..26c902a057 100644
--- a/addons/common/functions/fnc_dropBackpack.sqf
+++ b/addons/common/functions/fnc_dropBackpack.sqf
@@ -1,30 +1,24 @@
/*
* Author: commy2
- *
* Drops a backback. Also returns the ground wepaon holder object of the dropped backpack.
*
- * Argument:
- * 0: Unit that has a backpack (Object)
+ * Arguments:
+ * 0: Unit that has a backpack
*
* Return value:
- * Ground wepaon holder with backpack (Object)
+ * Ground wepaon holder with backpack
*
+ * Public: Yes
*/
#include "script_component.hpp"
-PARAMS_1(_unit);
+params ["_unit"];
-private ["_backpackObject","_holder"];
+private ["_backpackObject", "_holder"];
_backpackObject = backpackContainer _unit;
-_unit addBackpack "Bag_Base";
+
+_unit addBackpack "ACE_FakeBackpack";
removeBackpack _unit;
-_holder = objNull;
-{
- if (_backpackObject in everyBackpack _x) exitWith {
- _holder = _x;
- };
-} forEach (position _unit nearObjects ["WeaponHolder", 5]);
-
-_holder
+objectParent _backpackObject // return
diff --git a/addons/common/functions/fnc_dumpArray.sqf b/addons/common/functions/fnc_dumpArray.sqf
index 8572aaf134..182c542df2 100644
--- a/addons/common/functions/fnc_dumpArray.sqf
+++ b/addons/common/functions/fnc_dumpArray.sqf
@@ -1,10 +1,21 @@
-//fnc_dumpArray.sqf
+/*
+ * Author: ?
+ * ?
+ *
+ * Arguments:
+ * 0: Array to be dumped
+ * 1: Depth
+ *
+ * Return Value:
+ * None
+ *
+ * Public: No
+ */
#include "script_component.hpp"
-private ["_pad", "_i", "_x"];
-
-PARAMS_2(_var,_depth);
+params ["_var", "_depth"];
+private "_pad";
_pad = "";
for "_i" from 0 to _depth do {
@@ -14,15 +25,18 @@ for "_i" from 0 to _depth do {
_depth = _depth + 1;
if (IS_ARRAY(_var)) then {
- if ((count _var) > 0) then {
- diag_log text format["%1[", _pad];
+ if (_var isEqualTo []) then {
+ diag_log text format ["%1[],", _pad];
+ } else {
+ diag_log text format ["%1[", _pad];
+
{
[_x, _depth] call FUNC(dumpArray);
- } forEach _var;
- diag_log text format["%1],", _pad];
- } else {
- diag_log text format["%1[],", _pad];
+ false
+ } count _var;
+
+ diag_log text format ["%1],", _pad];
};
} else {
- diag_log text format["%1%2", _pad, [_var] call FUNC(formatVar)];
+ diag_log text format ["%1%2", _pad, [_var] call FUNC(formatVar)];
};
diff --git a/addons/common/functions/fnc_dumpPerformanceCounters.sqf b/addons/common/functions/fnc_dumpPerformanceCounters.sqf
index 0c3d6c8e78..e076831c6f 100644
--- a/addons/common/functions/fnc_dumpPerformanceCounters.sqf
+++ b/addons/common/functions/fnc_dumpPerformanceCounters.sqf
@@ -1,49 +1,68 @@
-//fnc_dumpPerformanceCounters.sqf
-#define DEBUG_MODE_FULL
+/*
+ * Author: ?
+ * Dumps performance counter statistics into Logs.
+ *
+ * Arguments:
+ * None
+ *
+ * Return Value:
+ * None
+ *
+ * Public: No
+ */
#include "script_component.hpp"
+diag_log text format ["REGISTERED ACE PFH HANDLERS"];
+diag_log text format ["-------------------------------------------"];
-diag_log text format["REGISTERED ACE PFH HANDLERS"];
-diag_log text format["-------------------------------------------"];
if (!isNil "ACE_PFH_COUNTER") then {
{
- private ["_isActive"];
_x params ["_pfh", "_parameters"];
- _isActive = if (!isNil {cba_common_PFHhandles select (_pfh select 0)}) then {"ACTIVE"} else {"REMOVED"};
- diag_log text format["Registered PFH: id=%1 [%2, delay %3], %4:%5", (_pfh select 0), (_isActive), (_parameters select 1), (_pfh select 1), (_pfh select 2) ];
- } forEach ACE_PFH_COUNTER;
+
+ private "_isActive";
+ _isActive = ["ACTIVE", "REMOVED"] select isNil {CBA_common_PFHhandles select (_pfh select 0)};
+
+ diag_log text format ["Registered PFH: id=%1 [%2, delay %3], %4:%5", _pfh select 0, _isActive, _parameters select 1, _pfh select 1, _pfh select 2];
+ false
+ } count ACE_PFH_COUNTER;
};
-diag_log text format["ACE COUNTER RESULTS"];
-diag_log text format["-------------------------------------------"];
+diag_log text format ["ACE COUNTER RESULTS"];
+diag_log text format ["-------------------------------------------"];
+
{
- private ["_counterEntry", "_iter", "_total", "_count", "_delta", "_averageResult"];
+ private ["_counterEntry", "_iter", "_total", "_count", "_averageResult", "_delta"];
+
_counterEntry = _x;
_iter = 0;
_total = 0;
_count = 0;
_averageResult = 0;
- if( (count _counterEntry) > 3) then {
+
+ if (count _counterEntry > 3) then {
// calc
{
- if(_iter > 2) then {
+ if (_iter > 2) then {
_count = _count + 1;
_delta = (_x select 1) - (_x select 0);
_total = _total + _delta;
};
+
_iter = _iter + 1;
- } forEach _counterEntry;
-
+ false
+ } count _counterEntry;
+
// results
_averageResult = (_total / _count) * 1000;
-
+
// dump results
- diag_log text format["%1: Average: %2s / %3 = %4ms", (_counterEntry select 0), _total, _count, _averageResult];
+ diag_log text format ["%1: Average: %2s / %3 = %4ms", _counterEntry select 0, _total, _count, _averageResult];
} else {
- diag_log text format["%1: No results", (_counterEntry select 0) ];
+ diag_log text format ["%1: No results", _counterEntry select 0];
};
-} forEach ACE_COUNTERS;
+ false
+} count ACE_COUNTERS;
/*
// Dump PFH Trackers
@@ -71,4 +90,4 @@ diag_log text format["-------------------------------------------"];
//
//} forEach ACRE_EXCESSIVE_FRAME_TRACKER;
-*/
\ No newline at end of file
+*/
diff --git a/addons/common/functions/fnc_endRadioTransmission.sqf b/addons/common/functions/fnc_endRadioTransmission.sqf
index 78a50e9f2c..4597426d67 100644
--- a/addons/common/functions/fnc_endRadioTransmission.sqf
+++ b/addons/common/functions/fnc_endRadioTransmission.sqf
@@ -4,11 +4,12 @@
* End radio transmissions of addons TFAR and ACRE2. TFAR v0.9.7, ACRE Public Beta 2.0.3.571
*
* Arguments:
- * None.
+ * None
*
* Return Value:
- * None.
+ * None
*
+ * Public: No
*/
#include "script_component.hpp"
diff --git a/addons/common/functions/fnc_eraseCache.sqf b/addons/common/functions/fnc_eraseCache.sqf
index 9521bb3630..ae988ced28 100644
--- a/addons/common/functions/fnc_eraseCache.sqf
+++ b/addons/common/functions/fnc_eraseCache.sqf
@@ -13,6 +13,6 @@
*/
#include "script_component.hpp"
-PARAMS_2(_namespace,_uid);
+params ["_namespace", "_uid"];
_namespace setVariable [_uid, nil];
diff --git a/addons/common/functions/fnc_errorMessage.sqf b/addons/common/functions/fnc_errorMessage.sqf
index 3929477e76..f06aa2d30d 100644
--- a/addons/common/functions/fnc_errorMessage.sqf
+++ b/addons/common/functions/fnc_errorMessage.sqf
@@ -29,11 +29,7 @@ if (isNull (call BIS_fnc_displayMission)) exitWith {
}, 1, _this] call CBA_fnc_addPerFrameHandler;
};
-private ["_onOK", "_onCancel"];
-
-PARAMS_2(_textHeader,_textMessage);
-_onOK = ARR_SELECT(_this,2,{});
-_onCancel = ARR_SELECT(_this,3,{});
+params ["_textHeader", "_textMessage", ["_onOK", {}], ["_onCancel", {}]];
if (typeName _textMessage == "STRING") then {
_textMessage = parseText _textMessage;
diff --git a/addons/common/functions/fnc_execNextFrame.sqf b/addons/common/functions/fnc_execNextFrame.sqf
index ddd36be073..7b3f034c6d 100644
--- a/addons/common/functions/fnc_execNextFrame.sqf
+++ b/addons/common/functions/fnc_execNextFrame.sqf
@@ -1,18 +1,19 @@
/*
* Author: esteldunedain
- *
* Executes a code on the next frame
*
- * Argument:
- * 0: Code to execute (Code)
- * 1: Parameters to run the code with (Array)
+ * Arguments:
+ * 0: Code to execute
+ * 1: Parameters to run the code with
*
- * Return value:
- * PFH handler ID
+ * Return Value:
+ * PFH handler ID
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-PARAMS_2(_func,_params);
+params ["_func", "_params"];
if (diag_frameno != GVAR(nextFrameNo)) then {
GVAR(nextFrameBufferA) pushBack [_params, _func];
diff --git a/addons/common/functions/fnc_execPersistentFnc.sqf b/addons/common/functions/fnc_execPersistentFnc.sqf
index dd160b8bfd..dc88a7c3c9 100644
--- a/addons/common/functions/fnc_execPersistentFnc.sqf
+++ b/addons/common/functions/fnc_execPersistentFnc.sqf
@@ -1,29 +1,29 @@
/*
* Author: commy2
- *
* Execute a function on every machine. Function will also be called upon JIP (postInit). The arguments are stored in (_this select 0), while the assigned namespace is stored in (_this select 1).
*
- * Argument:
- * 0: Function arguments (Array)
- * 1: Function to execute, has to be defined on the remote machine first (String)
- * 2: Namespace to save that variable in (Object or Namespace)
- * 3: Name. Will overwrite previously defined functions with that name (String)
+ * Arguments:
+ * 0: Function arguments
+ * 1: Function to execute, has to be defined on the remote machine first
+ * 2: Namespace to save that variable in
+ * 3: Name. Will overwrite previously defined functions with that name
*
- * Return value:
- * Nothing.
+ * Return Value:
+ * None
+ *
+ * Public: No
+ *
+ * Deprecated
*/
#include "script_component.hpp"
-private ["_arguments", "_function", "_unit", "_name"];
-
GVAR(remoteFnc) = _this;
-_arguments = _this select 0;
-_function = call compile (_this select 1);
-_unit = _this select 2;
-_name = _this select 3;
+params ["_arguments", "_function", "_unit", "_name"];
-["Remote", [_arguments, _this select 1, _name], {format ["%1 call %2 id: %3", _this select 0, _this select 1, _this select 2]}, false] call FUNC(log);
+_function = call compile _function;
+
+//["Remote", [_arguments, _this select 1, _name], {format ["%1 call %2 id: %3", _this select 0, _this select 1, _this select 2]}, false] call FUNC(log);
// execute function on every currently connected machine
[[_arguments, _unit], _this select 1, 2] call FUNC(execRemoteFnc);
diff --git a/addons/common/functions/fnc_execRemoteFnc.sqf b/addons/common/functions/fnc_execRemoteFnc.sqf
index 1df17050e6..6b617bf92f 100644
--- a/addons/common/functions/fnc_execRemoteFnc.sqf
+++ b/addons/common/functions/fnc_execRemoteFnc.sqf
@@ -1,35 +1,32 @@
/*
* Author: commy2
- *
* Execute a function on a remote machine in mp.
*
- * Argument:
- * 0: Function arguments (Array)
- * 1: Function to execute, has to be defined on the remote machine first (String)
- * 2: The function will be executed where this unit is local OR the mode were this function should be executed. (Object OR Number, optional default: 2)
- * Mode 0: execute on this machine only
- * Mode 1: execute on server
- * Mode 2: execute on all clients + server
- * Mode 3: execute on dedicated only
+ * Arguments:
+ * 0: Function arguments
+ * 1: Function to execute, has to be defined on the remote machine first
+ * 2: The function will be executed where this unit is local OR the mode were this function should be executed. (default: 2)
+ * 0 = execute on this machine only
+ * 1 = execute on server
+ * 2 = execute on all clients + server
+ * 3 = execute on dedicated only
*
- * Return value:
- * Nothing
+ * Return Value:
+ * None
+ *
+ * Public: No
+ *
+ * Deprecated
*/
#include "script_component.hpp"
-private ["_arguments", "_function", "_unit", "_id"];
-
GVAR(remoteFnc) = _this;
-_arguments = _this select 0;
-_function = call compile (_this select 1);
-_unit = _this select 2;
+params ["_arguments", "_function", ["_unit", 2]];
-if (isNil "_unit") then {
- _unit = 2;
-};
+_function = call compile _function;
-["Remote", [_arguments, _this select 1, _unit], {format ["%1 call %2 to: %3", _this select 0, _this select 1, _this select 2]}, false] call FUNC(log);
+//["Remote", [_arguments, _this select 1, _unit], {format ["%1 call %2 to: %3", _this select 0, _this select 1, _this select 2]}, false] call FUNC(log);
if (typeName _unit == "SCALAR") exitWith {
switch (_unit) do {
@@ -63,8 +60,7 @@ if (local _unit) then {
_arguments call _function;
} else {
if (isServer) then {
- _id = owner _unit;
- _id publicVariableClient QGVAR(remoteFnc);
+ (owner _unit) publicVariableClient QGVAR(remoteFnc);
} else {
publicVariableServer QGVAR(remoteFnc);
};
diff --git a/addons/common/functions/fnc_executePersistent.sqf b/addons/common/functions/fnc_executePersistent.sqf
index a11fbb07aa..3763d1bb58 100644
--- a/addons/common/functions/fnc_executePersistent.sqf
+++ b/addons/common/functions/fnc_executePersistent.sqf
@@ -1,11 +1,22 @@
-// by commy2
+/*
+ * Author: commy2
+ * Execute all Persistent Functions
+ *
+ * Arguments:
+ * ?
+ *
+ * Return Value:
+ * None
+ *
+ * Public: No
+ */
#include "script_component.hpp"
-PARAMS_1(_target);
+params ["_target"];
{
if (isNil "_x") then {
- diag_log text format ["[ACE] ERROR: No argument and function for remote function. ID: %1", _forEachIndex];
+ ACE_LOGERROR_1("No arguments and function for remote function. ID: %1",_forEachIndex);
} else {
if (typeName _x == "ARRAY") then {
[_x select 0, _target] call (_x select 1);
diff --git a/addons/common/functions/fnc_exportConfig.sqf b/addons/common/functions/fnc_exportConfig.sqf
index e8370c8f0f..9b28786e43 100644
--- a/addons/common/functions/fnc_exportConfig.sqf
+++ b/addons/common/functions/fnc_exportConfig.sqf
@@ -1,17 +1,25 @@
-// by commy2
/*
- usage:
-
- (configFile >> "CfgAmmo") call FUNC(exportConfig);
-*/
+ * Author: commy2
+ * Export Config Entrys to RPT logs
+ *
+ * Arguments:
+ * Config Path
+ *
+ * Return Value:
+ * None
+ *
+ * Example:
+ * [configFile >> "CfgAmmo"] call ace_common_fnc_exportConfig;
+ *
+ * Public: No
+ */
#include "script_component.hpp"
private "_fnc_logEntries";
-
_fnc_logEntries = {
- private ["_p", "_t", "_e", "_a", "_i"];
+ params ["_c", "_d"];
- PARAMS_2(_c,_d);
+ private ["_p", "_t", "_e", "_a", "_i"];
_p = inheritsFrom _c;
diff --git a/addons/common/functions/fnc_filter.sqf b/addons/common/functions/fnc_filter.sqf
index 8d4146faa5..0b30e59cf9 100644
--- a/addons/common/functions/fnc_filter.sqf
+++ b/addons/common/functions/fnc_filter.sqf
@@ -1,6 +1,5 @@
/*
* Author: KoffeinFlummi, commy2
- *
* Filters array and removes every element not fitting the condition
*
* Arguments:
@@ -12,22 +11,21 @@
*
* Usage:
* [[0,1,2,3,4], {_this > 2}] call FUNC(filter) ==> [3,4]
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_newArray", "_index"];
+params ["_array", "_code"];
-PARAMS_2(_array,_code);
+private "_result";
+_result = [];
-if (isNil "_array") exitWith {
- diag_log text format ["[ACE] ERROR: No array for function filter in %1", _fnc_scriptNameParent];
- []
-};
-
-_newArray = [];
-for "_index" from 0 to (count _array - 1) do {
- if ((_array select _index) call _code) then {
- _newArray pushBack (_array select _index);
+{
+ if (_x call _code) then {
+ _result pushBack _x;
};
-};
-_newArray
+ false
+} count _array;
+
+_result
diff --git a/addons/common/functions/fnc_fixCollision.sqf b/addons/common/functions/fnc_fixCollision.sqf
index 6b43cec469..1d55eb1454 100644
--- a/addons/common/functions/fnc_fixCollision.sqf
+++ b/addons/common/functions/fnc_fixCollision.sqf
@@ -1,13 +1,14 @@
/*
* Author: commy2
- * Attempt to fix physx collisions causing unreasonable impact forces and damage.
+ * Attempt to fix PhysX collisions causing unreasonable impact forces and damage.
*
* Arguments:
- * 0: Object
+ * Object
*
* Return Value:
- * Nothing
+ * None
*
+ * Public: No
*/
#include "script_component.hpp"
diff --git a/addons/common/functions/fnc_fixCrateContent.sqf b/addons/common/functions/fnc_fixCrateContent.sqf
index ad3ed8e528..a067c29c63 100644
--- a/addons/common/functions/fnc_fixCrateContent.sqf
+++ b/addons/common/functions/fnc_fixCrateContent.sqf
@@ -1,9 +1,20 @@
-// by commy2
+/*
+ * Author: commy2
+ * Fixes zeus placed crates containing buged mine detectors and ace items.
+ *
+ * Arguments:
+ * 0: Crate
+ *
+ * Return Value:
+ * None
+ *
+ * Public: No
+ */
#include "script_component.hpp"
-private ["_weapons", "_items"];
+params ["_crate"];
-PARAMS_1(_crate);
+private ["_weapons", "_items"];
// get all weapons inside the crate
_weapons = weaponCargo _crate;
diff --git a/addons/common/functions/fnc_fixFloating.sqf b/addons/common/functions/fnc_fixFloating.sqf
index 6f08af1482..24084d2c11 100644
--- a/addons/common/functions/fnc_fixFloating.sqf
+++ b/addons/common/functions/fnc_fixFloating.sqf
@@ -3,30 +3,33 @@
* Attempt to fix floating physx with disabled damage after setPosXXX commands.
*
* Arguments:
- * Physx object (Object)
+ * PhysX object
*
* Return Value:
- * Nothing
+ * None
*
+ * Public: No
*/
#include "script_component.hpp"
private "_object";
-
_object = _this;
// setHitPointDamage requires local object
if (!local _object) exitWith {};
// save and restore hitpoints, see below why
-private ["_hitPoints", "_hitPointDamages"];
+private "_hitPointDamages";
+_hitPointDamages = getAllHitPointsDamage _object;
-_hitPoints = [_object] call FUNC(getHitpoints);
-_hitPointDamages = [_hitPoints, {_object getHitPointDamage _this}] call FUNC(map);
+// get correct format for objects without hitpoints
+if (_hitPointDamages isEqualTo []) then {
+ _hitPointDamages = [[],[],[]];
+};
// this prevents physx objects from floating when near other physx objects with allowDamage false
_object setDamage damage _object;
{
- _object setHitPointDamage [_x, _hitPointDamages select _forEachIndex];
-} forEach _hitPoints;
+ _object setHitIndex [_forEachIndex, _x];
+} forEach (_hitPointDamages select 2);
diff --git a/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf b/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf
index f39f85cc94..9e230b00ad 100644
--- a/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf
+++ b/addons/common/functions/fnc_fixLoweredRifleAnimation.sqf
@@ -15,8 +15,8 @@
*/
#include "script_component.hpp"
-PARAMS_1(_unit);
+params ["_unit"];
-if (currentWeapon _unit != "" && {currentWeapon _unit == primaryWeapon _unit} && {weaponLowered _unit} && {stance _unit == "STAND"} && {(vehicle _unit) == _unit}) then {
+if (currentWeapon _unit != "" && {currentWeapon _unit == primaryWeapon _unit} && {weaponLowered _unit} && {stance _unit == "STAND"} && {vehicle _unit == _unit}) then {
[_unit, "amovpercmstpsraswrfldnon", 0] call FUNC(doAnimation);
};
diff --git a/addons/common/functions/fnc_fixPosition.sqf b/addons/common/functions/fnc_fixPosition.sqf
index 32cde87e52..54d0cdfbf6 100644
--- a/addons/common/functions/fnc_fixPosition.sqf
+++ b/addons/common/functions/fnc_fixPosition.sqf
@@ -4,10 +4,12 @@
* Fixes position of an object. E.g. moves object above ground and adjusts to terrain slope. Requires local object.
*
* Argument:
- * Object (Object)
+ * Object
*
- * Return value:
- * NONE
+ * Return Value:
+ * None
+ *
+ * Public: No
*/
#include "script_component.hpp"
diff --git a/addons/common/functions/fnc_getAllDefinedSetVariables.sqf b/addons/common/functions/fnc_getAllDefinedSetVariables.sqf
index 2163accae2..18c8a18c72 100644
--- a/addons/common/functions/fnc_getAllDefinedSetVariables.sqf
+++ b/addons/common/functions/fnc_getAllDefinedSetVariables.sqf
@@ -1,30 +1,40 @@
-/**
- * fn_getAllSetVariables.sqf
- * @Descr: Returns an 2d array of all variables that have been set on the object
- * @Author: Glowbal
+/*
+ * Author: Glowbal
+ * Returns an 2d array of all variables that have been set on the object
*
- * @Arguments: [unit OBJECT, category STRING (Optional. Only get the variables from the specified category. Default is "" == all)]
- * @Return: ARRAY REturns an array with the format [ [name STRING, typeName STRING, value ANY, publicFlag BOOL, peristentFlag BOOL] ]
- * @PublicAPI: true
+ * Arguments:
+ * 0: Unit
+ * 1: Limiting Category (default: "")
+ *
+ * Return Value:
+ * Variable Data
+ * 0: Name
+ * 1: typeName
+ * 2: value
+ * 3: publicFlag
+ * 4: peristentFlag
+ *
+ * Public: Yes
*/
-
#include "script_component.hpp"
-private ["_return", "_val", "_category"];
-PARAMS_1(_object);
-_category = if (count _this > 1) then { _this select 1 } else { "" };
+params ["_object", ["_category", ""]];
-if (isnil QGVAR(OBJECT_VARIABLES_STORAGE)) exitwith {
- [];
-};
+if (isNil QGVAR(OBJECT_VARIABLES_STORAGE)) exitwith {[]};
+
+private ["_return", "_val"];
_return = [];
+
{
_val = _object getvariable (_x select 0);
- if (!isnil "_val") then {
+
+ if (!isNil "_val") then {
if (_category == "" || _category == _x select 3) then {
- _return pushback [_x select 0, typeName _val, _val, _x select 2, _x select 5];
+ _return pushBack [_x select 0, typeName _val, _val, _x select 2, _x select 5];
};
};
-}foreach GVAR(OBJECT_VARIABLES_STORAGE);
-_return
\ No newline at end of file
+ false
+} count GVAR(OBJECT_VARIABLES_STORAGE);
+
+_return
diff --git a/addons/common/functions/fnc_getAllGear.sqf b/addons/common/functions/fnc_getAllGear.sqf
index 33c23c98a3..715966b176 100644
--- a/addons/common/functions/fnc_getAllGear.sqf
+++ b/addons/common/functions/fnc_getAllGear.sqf
@@ -1,29 +1,39 @@
/*
* Author: bux578, commy2
- *
* Returns an array containing all items of a given unit
*
- * Argument:
- * 0: Unit (Object)
+ * Arguments:
+ * 0: Unit
*
- * Return value:
- * Array with all the gear, format:
- * 0: headgear (String)
- * 1: goggles (String)
- * 2,3: uniform (String, Array)
- * 4,5: vest (String, Array)
- * 6,7: backpack (String, Array)
- * 8-10: rifle (String, Array, Array)
- * 11-13: launcher (String, Array, Array)
- * 14-16: pistol (String, Array, Array)
- * 17: map, compass, watch, etc. (Array)
- * 18: binocluar (String)
- * 19: active weapon, active muzzle, active weaponMode (Array)
+ * Return Value:
+ * 0: Headgear
+ * 1: Goggles
+ * 2: Uniform
+ * 3: Uniform Items
+ * 4: Vest
+ * 5: Vest Items
+ * 6: Backback
+ * 7: Backpack Items
+ * 8: Rifle
+ * 9: Rifle Items
+ * 10: Rifle Magazines
+ * 11: Launcher
+ * 12: Launcher Items
+ * 13: Launcher Magazines
+ * 14: Handgun
+ * 15: Handgun Items
+ * 16: Handgun Magazines
+ * 17: Assigned Items (map, compass, watch, etc.)
+ * 18: Binoculars
+ * 19: Binocular Magazine (E.g. Laserbatteries)
*
+ * Public: Yes
+ *
+ * Note: Element 17 includes the Head Mounted Display (HMD)
*/
#include "script_component.hpp"
-PARAMS_1(_unit);
+params ["_unit"];
if (isNull _unit) exitWith {[
"",
@@ -36,7 +46,7 @@ if (isNull _unit) exitWith {[
"", ["","","",""], [],
[],
"",
- ["","",""]
+ ""
]};
[
@@ -50,5 +60,5 @@ if (isNull _unit) exitWith {[
handgunWeapon _unit, handgunItems _unit, handgunMagazine _unit,
assignedItems _unit,
binocular _unit,
- [currentWeapon _unit, currentMuzzle _unit, currentWeaponMode _unit]
+ [_unit] call FUNC(binocularMagazine)
]
diff --git a/addons/common/functions/fnc_getCaptivityStatus.sqf b/addons/common/functions/fnc_getCaptivityStatus.sqf
index 50aeeced3a..36bf0ff183 100644
--- a/addons/common/functions/fnc_getCaptivityStatus.sqf
+++ b/addons/common/functions/fnc_getCaptivityStatus.sqf
@@ -1,25 +1,27 @@
/*
* Author: commy2
- *
* Return the captivity status of an unit.
*
- * Argument:
- * 0: Unit (Object)
+ * Arguments:
+ * 0: Unit
*
- * Return value:
- * Reasons, why the unit is a captive. An empty array is returned if the unit is not a captive (Array of Strings)
+ * Return Value:
+ * Captivity Reasons, empty if not captive
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"];
+params ["_unit"];
-PARAMS_1(_unit);
+private ["_captivityReasons", "_unitCaptivityStatus", "_unitCaptivityReasons"];
_captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []];
_unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber);
_unitCaptivityReasons = [];
+
{
if (_unitCaptivityStatus select _forEachIndex) then {
_unitCaptivityReasons pushBack _x;
diff --git a/addons/common/functions/fnc_getChildren.sqf b/addons/common/functions/fnc_getChildren.sqf
index d28ba7cb70..d5212dd9a5 100644
--- a/addons/common/functions/fnc_getChildren.sqf
+++ b/addons/common/functions/fnc_getChildren.sqf
@@ -1,10 +1,20 @@
-// by commy2
+/*
+ * Author: commy2
+ * Obtain children of a config entry
+ *
+ * Arguments:
+ * 0: Unit
+ *
+ * Return Value:
+ * Parent Entry Class Children
+ *
+ * Public: Yes
+ */
#include "script_component.hpp"
-private ["_classes"];
-
-PARAMS_2(_name,_cfgClass);
+params ["_name", "_cfgClass"];
+private "_classes";
_classes = format ["configName inheritsFrom _x == '%1'", _name] configClasses (configFile >> _cfgClass);
-_classes = [_classes, {configName _this}] call FUNC(map);
-_classes
+
+[_classes, {configName _this}] call FUNC(map) // return
diff --git a/addons/common/functions/fnc_getConfigCommander.sqf b/addons/common/functions/fnc_getConfigCommander.sqf
index 44f02cbeb1..bfa5fbc379 100644
--- a/addons/common/functions/fnc_getConfigCommander.sqf
+++ b/addons/common/functions/fnc_getConfigCommander.sqf
@@ -1,21 +1,22 @@
/*
* Author: commy2
- *
* Get the commander config of a vehicles turret.
*
- * Argument:
- * 0: vehicle (Object)
+ * Arguments:
+ * 0: vehicle
*
- * Return value:
- * Commander config (Config)
+ * Return Value:
+ * Commander config
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_config", "_turret"];
+params ["_vehicle"];
-PARAMS_1(_vehicle);
+private ["_config", "_turret"];
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_turret = [_vehicle] call FUNC(getTurretCommander);
-[_config, _turret] call FUNC(getTurretConfigPath)
+[_config, _turret] call FUNC(getTurretConfigPath) // return
diff --git a/addons/common/functions/fnc_getConfigGunner.sqf b/addons/common/functions/fnc_getConfigGunner.sqf
index a28491bfff..bc3131d798 100644
--- a/addons/common/functions/fnc_getConfigGunner.sqf
+++ b/addons/common/functions/fnc_getConfigGunner.sqf
@@ -1,21 +1,22 @@
/*
* Author: commy2
- *
* Get the gunner config of a vehicles turret.
*
- * Argument:
- * 0: vehicle (Object)
+ * Arguments:
+ * 0: vehicle
*
- * Return value:
- * Gunner config (Config)
+ * Return Value:
+ * Gunner config
+ *
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_config", "_turret"];
+params ["_vehicle"];
-PARAMS_1(_vehicle);
+private ["_config", "_turret"];
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_turret = [_vehicle] call FUNC(getTurretGunner);
-[_config, _turret] call FUNC(getTurretConfigPath)
+[_config, _turret] call FUNC(getTurretConfigPath) // return
diff --git a/addons/common/functions/fnc_getConfigType.sqf b/addons/common/functions/fnc_getConfigType.sqf
index b2d601c121..1496cfa2b9 100644
--- a/addons/common/functions/fnc_getConfigType.sqf
+++ b/addons/common/functions/fnc_getConfigType.sqf
@@ -1,17 +1,18 @@
/*
* Author: commy2
+ * Determins type of item. Can be CfgMagaines, CfgWeapons or CfgGlasses.
*
- * What kind of Cfg is the item. Works for CfgMagaines, CfgWeapons and CfgGlasses
+ * Arguments:
+ * 0: Item Classname
*
- * Argument:
- * 0: A item's classname. (String)
+ * Return Value:
+ * Config category ("CfgWeapons", "CfgMagazines", "CfgGlasses", "")
*
- * Return value:
- * CfgWhatever (String)
+ * Public: Yes
*/
#include "script_component.hpp"
-PARAMS_1(_item);
+params ["_item"];
if (isClass (configFile >> "CfgWeapons" >> _item)) exitWith {"CfgWeapons"};
diff --git a/addons/common/functions/fnc_getConfigTypeObject.sqf b/addons/common/functions/fnc_getConfigTypeObject.sqf
index ef39ce22c7..6186ad6bff 100644
--- a/addons/common/functions/fnc_getConfigTypeObject.sqf
+++ b/addons/common/functions/fnc_getConfigTypeObject.sqf
@@ -1,17 +1,18 @@
/*
* Author: commy2
+ * Determins type of object. Can be CfgVehicles or CfgAmmo.
*
- * What kind of Cfg is the object. Works for CfgVehicles and CfgAmmo
+ * Arguments:
+ * 0: Object classname
*
- * Argument:
- * 0: An object's classname. (String)
+ * Return Value:
+ * Config category ("CfgWeapons", "Cfgmagazines", "CfgGlasses", "")
*
- * Return value:
- * CfgWhatever (String)
+ * Public: Yes
*/
#include "script_component.hpp"
-PARAMS_1(_object);
+params ["_object"];
if (isClass (configFile >> "CfgVehicles" >> _object)) exitWith {"CfgVehicles"};
diff --git a/addons/common/functions/fnc_getDeathAnim.sqf b/addons/common/functions/fnc_getDeathAnim.sqf
index 539c8d2616..c88f89d35f 100644
--- a/addons/common/functions/fnc_getDeathAnim.sqf
+++ b/addons/common/functions/fnc_getDeathAnim.sqf
@@ -9,35 +9,38 @@
* animation
*
* Example:
- * [bob] call ace_common_fnc_getDeathAnim;
+ * [bob] call ace_common_fnc_getDeathAnim
*
* Public: No
*/
#include "script_component.hpp"
-PARAMS_1(_unit);
+params ["_unit"];
-private ["_returnAnimation", "_animationState", "_unitAnimationCfg", "_unitActionsCfg", "_interpolateArray", "_indexAnimation", "_index"];
+private ["_returnAnimation", "_animationState", "_unitAnimationCfg", "_unitActionsCfg", "_interpolateArray", "_indexAnimation"];
_returnAnimation = "";
-_animationState = (animationState _unit);
-_unitAnimationCfg = (configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState);
-//If we're already in a terminal animation just return current
-if ((getNumber (_unitAnimationCfg >> "terminal")) == 1) exitWith {_animationState};
+_animationState = animationState _unit;
+_unitAnimationCfg = configFile >> "CfgMovesMaleSdr" >> "States" >> _animationState;
-_unitActionsCfg = (configFile >> "CfgMovesBasic" >> "Actions" >> (getText (_unitAnimationCfg >> "actions")));
+//If we're already in a terminal animation just return current
+if (getNumber (_unitAnimationCfg >> "terminal") == 1) exitWith {_animationState};
+
+_unitActionsCfg = configFile >> "CfgMovesBasic" >> "Actions" >> getText (_unitAnimationCfg >> "actions");
TRACE_2("Animation/Action", configName _unitAnimationCfg, configName _unitActionsCfg);
-if ((vehicle _unit) != _unit) then {
+if (vehicle _unit != _unit) then {
_interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo");
+
for "_index" from 0 to (count _interpolateArray - 1) step 2 do {
_indexAnimation = _interpolateArray select _index;
+
//No guarentee that first animation will be right so scan for the first "terminal" animation
//E.G.: interpolateTo[] = {"passenger_apc_generic04still",1,"KIA_passenger_apc_generic04",1};
- if ((getNumber ((configFile >> "CfgMovesMaleSdr" >> "States" >> _indexAnimation) >> "terminal")) == 1) exitWith {
+ if (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> _indexAnimation >> "terminal") == 1) exitWith {
_returnAnimation = _indexAnimation;
};
};
diff --git a/addons/common/functions/fnc_getDefaultAnim.sqf b/addons/common/functions/fnc_getDefaultAnim.sqf
index fbcca2712e..372a2424eb 100644
--- a/addons/common/functions/fnc_getDefaultAnim.sqf
+++ b/addons/common/functions/fnc_getDefaultAnim.sqf
@@ -1,29 +1,47 @@
-// by commy2
+/*
+ * Author: commy2
+ * Get the Defualt animation for the unit
+ *
+ * Arguments:
+ * 0: unit
+ *
+ * Return Value:
+ * animation
+ *
+ * Example:
+ * [bob] call ace_common_fnc_getDefaultAnim;
+ *
+ * Public: No
+ */
#include "script_component.hpp"
+params ["_unit"];
+
private ["_anim", "_stance"];
-PARAMS_1(_unit);
-_anim = toLower (animationState _unit);
+_anim = toLower animationState _unit;
// stance is broken for some animations.
_stance = stance _unit;
+
if (_anim find "ppne" == 4) then {
- _stance = "PRONE";
+ _stance = "PRONE";
};
+
if (_anim find "pknl" == 4) then {
- _stance = "CROUCH";
+ _stance = "CROUCH";
};
+
if (_anim find "perc" == 4) then {
- _stance = "STAND";
+ _stance = "STAND";
};
_anim = format ["AmovP%1M%2S%3W%4D%5",
- ["erc", "knl", "pne"] select (["STAND", "CROUCH", "PRONE"] find _stance) max 0,
- ["stp", "run"] select (vectorMagnitude velocity _unit > 1),
- [["ras", "low"] select weaponLowered _unit, "non"] select (currentWeapon _unit == ""),
- ["non", "rfl", "lnr", "pst", "bin"] select (["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] find currentWeapon _unit) max 0,
- ["non", _anim select [count _anim - 1, 1]] select (_anim select [count _anim - 2, 2] in ["df", "db", "dl", "dr"])
+ ["erc", "knl", "pne"] select (["STAND", "CROUCH", "PRONE"] find _stance) max 0,
+ ["stp", "run"] select (vectorMagnitude velocity _unit > 1),
+ [["ras", "low"] select weaponLowered _unit, "non"] select (currentWeapon _unit == ""),
+ ["non", "rfl", "lnr", "pst", "bin"] select (["", primaryWeapon _unit, secondaryWeapon _unit, handgunWeapon _unit, binocular _unit] find currentWeapon _unit) max 0,
+ ["non", _anim select [count _anim - 1, 1]] select (_anim select [count _anim - 2, 2] in ["df", "db", "dl", "dr"])
];
["", _anim] select isClass (configFile >> "CfgMovesMaleSdr" >> "States" >> _anim)
diff --git a/addons/common/functions/fnc_getDefinedVariable.sqf b/addons/common/functions/fnc_getDefinedVariable.sqf
index 6c10c4f682..c0d7ce8d83 100644
--- a/addons/common/functions/fnc_getDefinedVariable.sqf
+++ b/addons/common/functions/fnc_getDefinedVariable.sqf
@@ -1,33 +1,38 @@
-/**
- * fn_getVariable.sqf
- * @Descr: Grabs a variable. If variable has not been set, attempts to use default defined value
- * @Author: Glowbal
+/*
+ * Author: Glowbal
+ * Grabs a variable. If variable has not been set, attempts to use default defined value
*
- * @Arguments: [unit OBJECT, variableName STRING]
- * @Return: ANY
- * @PublicAPI: true
+ * Arguments:
+ * 0: unit
+ * 1: Variable Name
+ *
+ * Return Value:
+ * Value of variable or default value, if the variable is undefined
+ *
+ * Public: No
*/
-
#include "script_component.hpp"
-#define UNIT (_this select 0)
-#define VARIABLE (_this select 1)
+params ["_unit", "_variable", "_defaultValue"];
private "_value";
+_value = _unit getvariable _variable;
-_value = UNIT getvariable VARIABLE;
-if (isnil "_value") then {
- if (count _this >2) then {
- _value = _this select 2;
+if (isNil "_value") then {
+ if (!isNil "_defaultValue") then {
+ _value = _defaultValue;
} else {
private "_definedVariable";
- _definedVariable = ([VARIABLE] call FUNC(getDefinedVariableInfo));
+ _definedVariable = [_variable] call FUNC(getDefinedVariableInfo);
+
if (count _definedVariable > 1) then {
_value = _definedVariable select 1;
};
};
- if (isnil "_value") then {
+
+ if (isNil "_value") then {
_value = 0;
};
};
-_value
\ No newline at end of file
+
+_value
diff --git a/addons/common/functions/fnc_getDefinedVariableDefault.sqf b/addons/common/functions/fnc_getDefinedVariableDefault.sqf
index cd4e4f08f2..4bb4b12253 100644
--- a/addons/common/functions/fnc_getDefinedVariableDefault.sqf
+++ b/addons/common/functions/fnc_getDefinedVariableDefault.sqf
@@ -1,19 +1,24 @@
-/**
- * fn_getvariableDefault.sqf
- * @Descr: Get the variable default value
- * @Author: Glowbal
+/*
+ * Author: Glowbal
+ * Get the variable default value
*
- * @Arguments: [variableName STRING]
- * @Return: ANY
- * @PublicAPI: true
+ * Arguments:
+ * 0: Variable Name
+ *
+ * Return Value:
+ * Default value of variable
+ *
+ * Public: Yes
*/
-
#include "script_component.hpp"
+params ["_varName"];
+
private "_variableDefinition";
-_variableDefinition = ([_this select 0] call FUNC(getDefinedVariableInfo));
-if (count _variableDefinition > 0) exitwith {
+_variableDefinition = [_varName] call FUNC(getDefinedVariableInfo);
+
+if !(_variableDefinition isEqualTo []) exitwith {
_variableDefinition select 1;
};
-nil;
\ No newline at end of file
+nil
diff --git a/addons/common/functions/fnc_getDefinedVariableInfo.sqf b/addons/common/functions/fnc_getDefinedVariableInfo.sqf
index 03b50b0649..adcb70c6ee 100644
--- a/addons/common/functions/fnc_getDefinedVariableInfo.sqf
+++ b/addons/common/functions/fnc_getDefinedVariableInfo.sqf
@@ -1,12 +1,17 @@
-/**
- * fn_getvariableInfo.sqf
- * @Descr: N/A
- * @Author: Glowbal
+/*
+ * Author: Glowbal
+ * Get the variable Informations
*
- * @Arguments: []
- * @Return:
- * @PublicAPI: false
+ * Arguments:
+ * 0: Variable Name
+ *
+ * Return Value:
+ * Variable Metadata
+ *
+ * Public: No
*/
-
#include "script_component.hpp"
-+(missionNamespace getvariable [QGVAR(OBJECT_VARIABLES_STORAGE_) + (_this select 0),[]])
+
+params ["_varName"];
+
++ (missionNamespace getVariable [format [QGVAR(OBJECT_VARIABLES_STORAGE_%1), _varName], []])
diff --git a/addons/common/functions/fnc_getDisplayConfigName.sqf b/addons/common/functions/fnc_getDisplayConfigName.sqf
index 92b6700238..7a0d9ffa95 100644
--- a/addons/common/functions/fnc_getDisplayConfigName.sqf
+++ b/addons/common/functions/fnc_getDisplayConfigName.sqf
@@ -1,15 +1,31 @@
-// by commy2
+/*
+ * Author: commy2
+ * Get display classnames from config with given idd.
+ *
+ * Arguments:
+ * 0: Display ID (idd)
+ *
+ * Return Value:
+ * Display Classnames
+ *
+ * Public: Yes
+ *
+ * Note: Really slow due to iteration through whole config. Meant for debugging.
+ */
#include "script_component.hpp"
-private ["_configName", "_index", "_config"];
+params ["_idd"];
-_configName = "";
+private ["_configNames", "_config"];
+
+_configNames = [];
for "_index" from 0 to (count configFile - 1) do {
_config = configFile select _index;
- if (isClass _config && {isNumber (_config >> "idd")} && {getNumber (_config >> "idd") == _this}) exitWith {
- _configName = configName _config;
+
+ if (isClass _config && {isNumber (_config >> "idd")} && {getNumber (_config >> "idd") == _idd}) then {
+ _configNames pushBack configName _config;
};
};
-_configName
+_configNames
diff --git a/addons/common/functions/fnc_getDoorTurrets.sqf b/addons/common/functions/fnc_getDoorTurrets.sqf
index f304c1714c..cab259a214 100644
--- a/addons/common/functions/fnc_getDoorTurrets.sqf
+++ b/addons/common/functions/fnc_getDoorTurrets.sqf
@@ -1,19 +1,20 @@
/*
* Author: bux578
+ * Returns all turret indecies of door gunners.
*
- * Gets the turret index of door gunners
+ * Arguments:
+ * 0: Vehicle
*
- * Argument:
- * 0: Vehicle (Object)
+ * Return Value:
+ * All turret indecies of the Vehicle
*
- * Return value:
- * Turret indexes of the door gunner. Empty array means no gunner position. (Array)
+ * Public: Yes
*/
#include "script_component.hpp"
-private ["_turrets", "_doorTurrets", "_config"];
+params ["_vehicle"];
-PARAMS_1(_vehicle);
+private ["_turrets", "_doorTurrets", "_config"];
_turrets = allTurrets [_vehicle, true];
@@ -21,11 +22,13 @@ _doorTurrets = [];
{
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
+
_config = [_config, _x] call FUNC(getTurretConfigPath);
- if ((getNumber (_config >> "isCopilot") == 0) && count (getArray (_config >> "weapons")) > 0 ) then {
+ if (getNumber (_config >> "isCopilot" == 0) && {count getArray (_config >> "weapons") > 0}) then {
_doorTurrets pushBack _x;
};
-} forEach _turrets;
+ false
+} count _turrets;
_doorTurrets
diff --git a/addons/common/functions/fnc_getFirstObjectIntersection.sqf b/addons/common/functions/fnc_getFirstObjectIntersection.sqf
index 3a99f244ed..1111094ed0 100644
--- a/addons/common/functions/fnc_getFirstObjectIntersection.sqf
+++ b/addons/common/functions/fnc_getFirstObjectIntersection.sqf
@@ -1,23 +1,31 @@
-/**
- * fn_getFirstIntersection.sqf
- * @Descr: Returns the the first intersection with an object between two positions
- * @Author: Ruthberg
+/*
+ * Author: Ruthberg
+ * Returns the the first intersection with terrain between two positions. @todo rewrite using lineIntersectsSurfaces?
*
- * @Arguments: [position PositionASL, position PositionASL, accuracy FLOAT]
- * @Return: [intersects BOOL, intersection PositionASL]
- * @PublicAPI: true
+ * Arguments:
+ * 0: PositionASL
+ * 1: PositionATL
+ * 2: Accuracy
+ *
+ * Return Value:
+ * 0: Intersects
+ * 1: Intersection Position ASL
+ *
+ * Public: Yes
*/
- #include "script_component.hpp"
+#include "script_component.hpp"
-private ["_distance", "_lower", "_upper", "_mid", "_intersections", "_result", "_dir"];
+params ["_source", "_destination", "_accuracy"];
-PARAMS_3(_source,_destination,_accuracy);
+private ["_result", "_distance"];
_result = [false, [0, 0, 0]];
_distance = _source vectorDistance _destination;
-if (count (lineIntersectsWith [_source, _destination]) > 0) then {
+if !(lineIntersectsWith [_source, _destination] isEqualTo []) then {
+ private ["_lower", "_upper", "_mid", "_dir"];
+
_lower = 0;
_upper = 1;
_mid = 0.5;
@@ -27,9 +35,7 @@ if (count (lineIntersectsWith [_source, _destination]) > 0) then {
while {(_upper - _lower) * _distance > _accuracy} do {
_mid = _lower + (_upper - _lower) / 2;
- _intersections = count (lineIntersectsWith [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))]);
-
- if (_intersections > 0) then {
+ if !(lineIntersectsWith [_source, _source vectorAdd (_dir vectorMultiply (_mid * _distance))] isEqualTo []) then {
_upper = _mid;
} else {
_lower = _mid;
diff --git a/addons/common/functions/fnc_getFirstTerrainIntersection.sqf b/addons/common/functions/fnc_getFirstTerrainIntersection.sqf
index 2fe8242c15..a5065413d9 100644
--- a/addons/common/functions/fnc_getFirstTerrainIntersection.sqf
+++ b/addons/common/functions/fnc_getFirstTerrainIntersection.sqf
@@ -1,23 +1,31 @@
-/**
- * fn_getFirstIntersection.sqf
- * @Descr: Returns the the first intersection with an object between two positions
- * @Author: Ruthberg
+/*
+ * Author: Ruthberg
+ * Returns the the first intersection with an object between two positions. @todo rewrite using lineIntersectsSurfaces?
*
- * @Arguments: [position PositionASL, position PositionASL, accuracy FLOAT]
- * @Return: [intersects BOOL, intersection PositionASL]
- * @PublicAPI: true
+ * Arguments:
+ * 0: PositionASL
+ * 1: PositionATL
+ * 2: Accuracy
+ *
+ * Return Value:
+ * 0: Intersects
+ * 1: Intersection Position ASL