diff --git a/AUTHORS.txt b/AUTHORS.txt index 5eee93a7f6..b812ed0ae7 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -53,6 +53,7 @@ Coren Crusty Dharma Bellamkonda Dimaslg +dixon13 Drill Dudakov aka [OMCB]Kaban Dslyecxi @@ -63,11 +64,13 @@ Falke75 Ferenczi Ferenzi Filip Basara +fr89k FreeZbe geraldbolso1899 Ghost Gianmarco Varriale (TeamNuke) GieNkoV +GitHawk gpgpgpgp Grzegorz Hamburger SV @@ -103,6 +106,7 @@ Robert Boklahánics ruPaladin simon84 Sniperwolf572 +System98 SzwedzikPL Tachi Toaster @@ -113,3 +117,4 @@ voiper VyMajoris(W-Cephei) Winter zGuba +Grey-Soldierman diff --git a/README.md b/README.md index d95c152904..54849217ab 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- +

diff --git a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf index 1f7e2ecde7..5ad6cb111e 100644 --- a/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf +++ b/addons/advanced_ballistics/functions/fnc_displayProtractor.sqf @@ -28,7 +28,7 @@ if (currentWeapon ACE_player != primaryWeapon ACE_player) exitWith { false }; 2 cutText ["", "PLAIN"]; EGVAR(weather,WindInfo) = false; -0 cutText ["", "PLAIN"]; +(["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; GVAR(Protractor) = true; [{ diff --git a/addons/advanced_ballistics/script_component.hpp b/addons/advanced_ballistics/script_component.hpp index 757330a5d0..47af939863 100644 --- a/addons/advanced_ballistics/script_component.hpp +++ b/addons/advanced_ballistics/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT advanced_ballistics #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_ADVANCEDBALLISTICS #define DEBUG_MODE_FULL #endif diff --git a/addons/advanced_ballistics/stringtable.xml b/addons/advanced_ballistics/stringtable.xml index 5ea26cd906..bfe0718d90 100644 --- a/addons/advanced_ballistics/stringtable.xml +++ b/addons/advanced_ballistics/stringtable.xml @@ -10,7 +10,7 @@ Mostrar información del viento Windinformationen anzeigen Széladatok mutatása - Zobrazit informace o větru + Zobrazit údaje o větru Mostrar Informação do Vento @@ -74,7 +74,7 @@ Activa la balística avanzada para francotiradores no locales (cuando se usa una mira telescópica) Aktywuje zaawansowaną balistykę dla nielokalnych snajperów (kiedy używają optyki) 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) + Aktivuje pokročilou balistiku pro nelokální odstřelovače (při použití optiky) 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) @@ -118,7 +118,7 @@ Activada la balística avanzada para todos los jugadores no locales (activarlo puede degradar el rendimiento durante grandes tiroteos en multijugador). Aktywuje zaawansowaną balistykę dla wszystkich nielokalnych graczy (aktywacja tej opcji może spodowować spory spadek wydajności podczas ciężkiej wymiany ognia) 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) + Aktivuje pokročilou balistiku pro všechny nelokální hráče (aktivace této možnosti způsobuje pokles FPS během velké 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) @@ -289,4 +289,4 @@ 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/ai/script_component.hpp b/addons/ai/script_component.hpp index 7add51c06c..0910bf6472 100644 --- a/addons/ai/script_component.hpp +++ b/addons/ai/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT ai #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_AI #define DEBUG_MODE_FULL #endif diff --git a/addons/aircraft/script_component.hpp b/addons/aircraft/script_component.hpp index f6662ce075..baa8e7ee21 100644 --- a/addons/aircraft/script_component.hpp +++ b/addons/aircraft/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT aircraft #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_AIRCRAFT #define DEBUG_MODE_FULL #endif diff --git a/addons/apl/ace_entrchtool.p3d b/addons/apl/ace_entrchtool.p3d new file mode 100644 index 0000000000..78fbf9e6c9 Binary files /dev/null and b/addons/apl/ace_entrchtool.p3d differ diff --git a/addons/apl/ace_envelope_big.p3d b/addons/apl/ace_envelope_big.p3d new file mode 100644 index 0000000000..3aef6368ca Binary files /dev/null and b/addons/apl/ace_envelope_big.p3d differ diff --git a/addons/apl/ace_envelope_big4.p3d b/addons/apl/ace_envelope_big4.p3d new file mode 100644 index 0000000000..45a23be11b Binary files /dev/null and b/addons/apl/ace_envelope_big4.p3d differ diff --git a/addons/apl/ace_envelope_big4_nogeo.p3d b/addons/apl/ace_envelope_big4_nogeo.p3d new file mode 100644 index 0000000000..66e20e5810 Binary files /dev/null and b/addons/apl/ace_envelope_big4_nogeo.p3d differ diff --git a/addons/apl/ace_envelope_small.p3d b/addons/apl/ace_envelope_small.p3d new file mode 100644 index 0000000000..9bc35d7b4a Binary files /dev/null and b/addons/apl/ace_envelope_small.p3d differ diff --git a/addons/apl/ace_envelope_small4.p3d b/addons/apl/ace_envelope_small4.p3d new file mode 100644 index 0000000000..d139f6bbca Binary files /dev/null and b/addons/apl/ace_envelope_small4.p3d differ diff --git a/addons/apl/ace_envelope_small4_nogeo.p3d b/addons/apl/ace_envelope_small4_nogeo.p3d new file mode 100644 index 0000000000..a39195505c Binary files /dev/null and b/addons/apl/ace_envelope_small4_nogeo.p3d differ diff --git a/addons/apl/data/entrchtool.rvmat b/addons/apl/data/entrchtool.rvmat new file mode 100644 index 0000000000..3f7c3f8f9f --- /dev/null +++ b/addons/apl/data/entrchtool.rvmat @@ -0,0 +1,75 @@ +ambient[]={1,1,1,1}; +diffuse[]={2,2,2,0}; +forcedDiffuse[]={0,0,0,0}; +emmisive[]={0,0,0,1}; +specular[]={0.054000214,0.054000214,0.058000047,0}; +specularPower=50.700001; +PixelShaderID="Super"; +VertexShaderID="Super"; +class Stage1 +{ + texture="z\ace\addons\apl\data\entrchtool_nohq.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage2 +{ + texture="#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; + uvSource="tex"; + class uvTransform + { + aside[]={4,0,0}; + up[]={0,6,0}; + dir[]={0,0,2}; + pos[]={0,0,0}; + }; + Filter="Anizotropic"; +}; +class Stage3 +{ + texture="#(argb,8,8,3)color(0,0,0,0,MC)"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; + Filter="Anizotropic"; +}; +class Stage4 +{ + texture="z\ace\addons\apl\data\entrchtool_as.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage5 +{ + texture="z\ace\addons\apl\data\entrchtool_smdi.paa"; + uvSource="tex"; + class uvTransform + { + aside[]={1,0,0}; + up[]={0,1,0}; + dir[]={0,0,0}; + pos[]={0,0,0}; + }; +}; +class Stage6 +{ + texture="a3\data_f\env_co.paa"; + uvSource="none"; +}; diff --git a/addons/apl/data/entrchtool_as.paa b/addons/apl/data/entrchtool_as.paa new file mode 100644 index 0000000000..5facd40186 Binary files /dev/null and b/addons/apl/data/entrchtool_as.paa differ diff --git a/addons/apl/data/entrchtool_co.paa b/addons/apl/data/entrchtool_co.paa new file mode 100644 index 0000000000..ad6dc41e5c Binary files /dev/null and b/addons/apl/data/entrchtool_co.paa differ diff --git a/addons/apl/data/entrchtool_nohq.paa b/addons/apl/data/entrchtool_nohq.paa new file mode 100644 index 0000000000..477e912367 Binary files /dev/null and b/addons/apl/data/entrchtool_nohq.paa differ diff --git a/addons/apl/data/entrchtool_smdi.paa b/addons/apl/data/entrchtool_smdi.paa new file mode 100644 index 0000000000..1011a99ca6 Binary files /dev/null and b/addons/apl/data/entrchtool_smdi.paa differ diff --git a/addons/apl/data/zr_plevel_co.paa b/addons/apl/data/zr_plevel_co.paa new file mode 100644 index 0000000000..723a8ca572 Binary files /dev/null and b/addons/apl/data/zr_plevel_co.paa differ diff --git a/addons/apl/script_component.hpp b/addons/apl/script_component.hpp index ac20a25e21..f2ae3d53f1 100644 --- a/addons/apl/script_component.hpp +++ b/addons/apl/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT APL #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_APL #define DEBUG_MODE_FULL #endif diff --git a/addons/atragmx/script_component.hpp b/addons/atragmx/script_component.hpp index 8154ffa04b..ca6a5d24a0 100644 --- a/addons/atragmx/script_component.hpp +++ b/addons/atragmx/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT atragmx #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_ATRAGMX #define DEBUG_MODE_FULL #endif diff --git a/addons/attach/functions/fnc_attach.sqf b/addons/attach/functions/fnc_attach.sqf index 6362edb33c..305c3c0960 100644 --- a/addons/attach/functions/fnc_attach.sqf +++ b/addons/attach/functions/fnc_attach.sqf @@ -49,7 +49,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment } else { GVAR(placeAction) = PLACE_WAITING; - [_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus); + [_unit, "forceWalk", "ACE_Attach", true] call EFUNC(common,statusEffect_set); [{[localize LSTRING(PlaceAction), ""] call EFUNC(interaction,showMouseHint)}, []] call EFUNC(common,execNextFrame); _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; @@ -88,7 +88,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment {!([_attachToVehicle, _unit, _itemClassname] call FUNC(canAttach))}) then { [_idPFH] call CBA_fnc_removePerFrameHandler; - [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + [_unit, "forceWalk", "ACE_Attach", false] call EFUNC(common,statusEffect_set); [] call EFUNC(interaction,hideMouseHint); [_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler); _unit removeAction _actionID; diff --git a/addons/attach/script_component.hpp b/addons/attach/script_component.hpp index 604a47fcb4..68300f47cd 100644 --- a/addons/attach/script_component.hpp +++ b/addons/attach/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT attach #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_ATTACH #define DEBUG_MODE_FULL #endif diff --git a/addons/attach/stringtable.xml b/addons/attach/stringtable.xml index cc09e8f45d..4ef82229fd 100644 --- a/addons/attach/stringtable.xml +++ b/addons/attach/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -7,7 +7,7 @@ Acoplar objeto >> Przyczep >> Attacher l'objet >> - Připnout předmět >> + Připnout >> Fixar item >> Attacca l'oggetto >> Tárgy hozzácsatolása >> @@ -115,7 +115,7 @@ Sin espacio en inventario Brak miejsca w ekwipunku Pas de place dans l'inventaire - Není místo v inventáři + Nedostatek místa v inventáři Sem espaço no inventário Non hai più spazio Nincs több hely @@ -175,7 +175,7 @@ Befestigen fehlgeschlagen Не удалось присоединить Error al acoplar - Připnutí selhalo + Připnout přesmět se nezdařilo Erro ao fixar Przyczepianie nie powiodło się Hozzácsatolás sikertelen @@ -187,7 +187,7 @@ %1<br/>acoplada Przyczepiono<br/>%1 %1<br/>attachée - %1<br/>Připnutý + %1<br/>Připnuto %1<br/>Fixada %1<br/>attaccata %1<br/>hozzácsatolva @@ -199,7 +199,7 @@ %1<br/>quitada Odczepiono<br/>%1 %1<br/>détachée - %1<br/>Odepnutý + %1<br/>Odepnuto %1<br/>Separada %1<br/>staccata %1<br/>lecsatolva diff --git a/addons/backpacks/script_component.hpp b/addons/backpacks/script_component.hpp index 2837367bfb..653e8ac684 100644 --- a/addons/backpacks/script_component.hpp +++ b/addons/backpacks/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT backpacks #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_BACKPACKS #define DEBUG_MODE_FULL #endif diff --git a/addons/ballistics/script_component.hpp b/addons/ballistics/script_component.hpp index 3a0f60e191..b648c74e76 100644 --- a/addons/ballistics/script_component.hpp +++ b/addons/ballistics/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT ballistics #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_BALLISTICS #define DEBUG_MODE_FULL #endif diff --git a/addons/ballistics/stringtable.xml b/addons/ballistics/stringtable.xml index 0cc8c0be6b..d473a5763f 100644 --- a/addons/ballistics/stringtable.xml +++ b/addons/ballistics/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -33,7 +33,7 @@ Calibre: 6,5x39mm Trazadoras IR-DIM<br />Balas: 30<br />Se usa en: MX/C/M/SW/3GL Calibre: 6,5x39mm Traçantes IR-DIM<br />Cartouches: 30<br />Utilisé avec: MX/C/M/SW/3GL Kaliber: 6,5x39mm Smugacz IR-DIM<br />Pociski: 30<br />Używane w: MX/C/M/SW/3GL - Ráže: 6.5x39mm Svítící IR-DIM<br />Munice: 30<br />Použití: MX/C/M/SW/3GL + Ráže: 6.5x39mm Svítící IR-DIM<br />Nábojů: 30<br />Použití u: MX Calibre: 6,5x39mm Traçante IR-DIM<br />Projéteis: 30<br />Usado em: MX/C/M/SW/3GL Calibro: 6.5x39mm Traccianti IR-DIM <br />Munizioni: 30<br />In uso su: MX/C/M/SW/3GL Калибр: 6,5x39 мм ИК-трассирующие<br />Патронов: 30<br />Используются с: MX/C/M/SW/3GL @@ -69,7 +69,7 @@ Calibre: 6,5x39mm SD<br />Balas: 30<br />Se usa en: MX/C/M/SW/3GL Calibre: 6,5x39mm SD<br />Cartouches: 30<br />Utilisé avec: MX/C/M/SW/3GL Kaliber: 6,5x39mm SD<br />Pociski: 30<br />Używane w: MX/C/M/SW/3GL - Ráže: 6.5x39mm SD<br />Munice: 30<br />Použití: MX/C/M/SW/3GL + Ráže: 6.5x39mm SD<br />Nábojů: 30<br />Použití u: MX Calibre: 6,5x39mm SD<br />Projéteis: 30<br />Usado em: MX/C/M/SW/3GL Calibro: 6.5x39mm Sil.<br />Munizioni: 30<br />In uso su: MX/C/M/SW/3GL Калибр: 6,5x39 мм дозвуковые<br />Патронов: 30<br />Используются с: MX/C/M/SW/3GL @@ -105,7 +105,7 @@ Calibre: 6,5x39mm AP<br />Balas: 30<br />Se usa en: MX/C/M/SW/3GL Calibre: 6,5x39mm AP<br />Cartouches: 30<br />Utilisé avec: MX/C/M/SW/3GL Kaliber: 6,5x39mm AP<br />Pociski: 30<br />Używane w: MX/C/M/SW/3GL - Ráže: 6.5x39mm AP<br />Munice: 30<br />Použití: MX/C/M/SW/3GL + Ráže: 6.5x39mm AP<br />Nábojů: 30<br />Použití u: MX Calibre: 6,5x39mm AP<br />Projéteis: 30<br />Usado em: MX/C/M/SW/3GL Calibro: 6.5x39mm AP<br />Munizioni: 30<br />In uso su: MX/C/M/SW/3GL Калибр: 6,5x39 мм бронебойные<br />Патронов: 30<br />Используются с: MX/C/M/SW/3GL @@ -142,7 +142,7 @@ Calibre: 6,5x39mm Trazadoras IR-DIM<br />Balas: 30<br />Se usa en: Katiba Calibre: 6,5x39mm Traçantes IR-DIM<br />Cartouches: 30<br />Utilisé avec: Katiba Kaliber: 6,5x39mm Smugacz IR-DIM<br />Pociski: 30<br />Używane w: Katiba - Ráže: 6.5x39mm Svítící IR-DIM<br />Munice: 30<br />Použití: Katiba + Ráže: 6.5x39mm Svítící IR-DIM<br />Nábojů: 30<br />Použití u: KH 2002 Sama Calibre: 6,5x39mm Traçante IR-DIM<br />Projéteis: 30<br />Usado em: Katiba Calibro: 6.5x39mm Tracciant IR-DIM<br />Munizioni: 30<br />In uso su: Katiba Калибр: 6,5x39 мм ИК-трассирующие<br />Патронов: 30<br />Используются с: Katiba @@ -178,7 +178,7 @@ Calibre: 6,5x39mm SD<br />Balas: 30<br />Se usa en: Katiba Calibre: 6,5x39mm SD<br />Cartouches: 30<br />Utilisé avec: Katiba Kaliber: 6,5x39mm SD<br />Naboje: 30<br />Używane w: Katiba - Ráže: 6.5x39mm SD<br />Munice: 30<br />Použití: Katiba + Ráže: 6.5x39mm SD<br />Nábojů: 30<br />Použití u: KH 2002 Sama Calibre: 6,5x39mm SD<br />Projéteis: 30<br />Usado em: Katiba Calibro: 6.5x39mm Sil.<br />Munizioni: 30<br />In uso su: Katiba Калибр: 6,5x39 мм дозвуковые<br />Патронов: 30<br />Используются с: Katiba @@ -214,7 +214,7 @@ Calibre: 6,5x39mm AP<br />Balas: 30<br />Se usa en: Katiba Calibre: 6,5x39mm AP<br />Cartouches: 30<br />Utilisé avec: Katiba Kaliber: 6,5x39mm AP<br />Pociski: 30<br />Używane w: Katiba - Ráže: 6.5x39mm AP<br />Munice: 30<br />Použití: Katiba + Ráže: 6.5x39mm AP<br />Nábojů: 30<br />Použití u: KH 2002 Sama Calibre: 6,5x39mm AP<br />Projéteis: 30<br />Usado em: Katiba Calibro: 6.5x39mm AP<br />Munizioni: 30<br />In uso su: Katiba Калибр: 6,5x39 мм бронебойные<br />Патронов: 30<br />Используются с: Katiba @@ -251,7 +251,7 @@ Calibre: 5,56x45mm Trazadoras IR-DIM<br />Balas: 30<br />Se usa en: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR Calibre: 5,56x45mm Traçantes IR-DIM<br />Cartouches: 30<br />Utilisé avec: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR Kaliber: 5,56x45mm Smugacz IR-DIM<br />Pociski: 30<br />Używane w: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR - Ráže: 5.56x45mm Svítící IR-DIM<br />Munice: 30<br />Použití: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR + Ráže: 5.56x45mm Svítící IR-DIM<br />Nábojů: 30<br />Použití u: CTAR-21, TAR-21, F2000, RFB SDAR Calibre: 5,56x45mm Traçante IR-DIM<br />Projéteis: 30<br />Usado em: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR Calibro: 5.56x45mm Traccianti IR-DIM<br />Munizioni: 30<br />In uso su: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR Калибр: 5,56x45 мм ИК-трассирующие<br />Патронов: 30<br />Используются с: TRG-20, TRG-21/EGLM, Mk20/C/EGLM, SDAR @@ -288,7 +288,7 @@ Calibre: 7,62x51mm Trazadora<br />Balas: 20<br />Se usa en: Mk18 ABR Calibre: 7,62x51mm Traçantes<br />Cartouches: 20<br />Utilisé avec: EBR Kaliber: 7,62x51mm Smugacz<br />Pociski: 20<br />Używane w: Mk18 ABR - Ráže: 7.62x51mm Svítící<br />Munice: 20<br />Použití: Mk18 ABR + Ráže: 7.62x51mm Svítící<br />Nábojů: 20<br />Použití u: Mk14 Mod 1 EBR Calibre: 7,62x51mm Traçante<br />Projéteis: 20<br />Usado em: Mk18 ABR Calibro: 7.62x51mm Traccianti<br />Munizioni: 20<br />In uso su: Mk18 ABR Калибр: 7,62x51 мм трассирующие<br />Патронов: 20<br />Используются с: Mk18 ABR @@ -324,7 +324,7 @@ Calibre: 7,62x51mm Trazadoras IR-DIM<br />Balas: 20<br />Se usa en: Mk18 ABR Calibre: 7,62x51mm Traçantes IR-DIM<br />Cartouches: 20<br />Utilisé avec: EBR Kaliber: 7,62x51mm Smugacz IR-DIM<br />Pociski: 20<br />Używane w: Mk18 ABR - Ráže: 7.62x51mm Svítící IR-DIM<br />Munice: 20<br />Použití: Mk18 ABR + Ráže: 7.62x51mm Svítící IR-DIM<br />Nábojů: 20<br />Použití u: Mk14 Mod 1 EBR Calibre: 7,62x51mm Traçante IR-DIM<br />Projéteis: 20<br />Usado em: Mk18 ABR Calibro: 7.62x51mm Traccianti IR-DIM<br />Munizioni: 20<br />In uso su: Mk18 ABR Калибр: 7,62x51 мм ИК-трассирующие<br />Патронов: 20<br />Используются с: Mk18 ABR @@ -360,7 +360,7 @@ Calibre: 7,62x51mm SD<br />Balas: 20<br />Se usa en: Mk18 ABR Calibre: 7,62x51mm SD<br />Cartouches: 20<br />Utilisé avec: EBR Kaliber: 7,62x51mm SD<br />Pociski: 20<br />Używane w: Mk18 ABR - Ráže: 7.62x51mm SD<br />Munice: 20<br />Použití: Mk18 ABR + Ráže: 7.62x51mm SD<br />Nábojů: 20<br />Použití u: Mk14 Mod 1 EBR Calibre: 7,62x51mm SD<br />Projéteis: 20<br />Usado em: Mk18 ABR Calibro: 7.62x51mm Sil.<br />Munizioni: 20<br />In uso su: Mk18 ABR Калибр: 7,62x51 мм дозвуковые<br />Патронов: 20<br />Используются с: Mk18 ABR @@ -398,7 +398,7 @@ Calibre: .338 Norma Magnum trazadora<br />Balas: 130<br />Se usa en: SPMG Калибр: .338 Norma Magnum трассирующие<br />Патронов: 130<br />Используются в: SPMG Calibro: .338 Norma Magnum Tracciante<br />Munizioni: 130<br />In uso su: SPMG - Ráže: .338 Noma Magnum Svítící<br />Munice: 130<br />Použití: SPMG + Ráže: .338 Noma Magnum Svítící<br />Nábojů: 130<br />Použití u: LWMMG Calibre: .338 Norma Magnum Traçante<br />Cartuchos: 130<br />Usado em: SPMG Kaliber: .338 Norma Magnum nyomkövető<br />Lövedékek: 130<br />Használható: SPMG @@ -434,7 +434,7 @@ Calibre: .338 Norma Magnum trazadora IR-DIM<br />Balas: 130<br />Se usa en: SPMG Калибр: .338 Norma Magnum ИК-трассирующие<br />Патронов: 130<br />Используются с: SPMG Calibro: .338 Norma Magnum Tracciante IR-DIM<br />Munizioni: 130<br />In uso su: SPMG - Ráže: .338 Noma Magnum Svítící IR-DIM<br />Munice: 130<br />Použití: SPMG + Ráže: .338 Noma Magnum Svítící IR-DIM<br />Nábojů: 130<br />Použití u: LWMMG Calibre: .338 Norma Magnum Traçante IR-DIM<br />Cartuchos: 130<br />Usado em: SPMG Kaliber: .338 Norma Magnum infravörös nyomkövető<br />Lövedékek: 130<br />Használható: SPMG @@ -470,7 +470,7 @@ Calibre: .338 Norma Magnum AP<br />Balas: 130<br />Se usa en: SPMG Калибр: .338 Norma Magnum бронебойные<br />Патронов: 130<br />Используются с: SPMG Calibro: .338 Norma Magnum AP<br />Munizioni: 130<br />In uso su: SPMG - Ráže: .338 Noma Magnum AP<br />Munice: 130<br />Použití: SPMG + Ráže: .338 Noma Magnum AP<br />Nábojů: 130<br />Použití u: LWMMG Calibre: .338 Norma Magnum AP<br />Cartuchos: 130<br />Usado em: SPMG Kaliber: .338 Norma Magnum páncéltörő<br />Lövedékek: 130<br />Használható: SPMG @@ -507,7 +507,7 @@ Calibre: 9.3x64mm trazadora<br />Balas: 10<br />Se usa en: Cyrus Калибр: 9,3x64 мм трассирующие<br />Патронов: 10<br />Используются с: Cyrus Calibro: 9.3x64mm Tracer<br />Munizioni: 10<br />In uso su: Cyrus - Ráže: 9.3x64mm Svítící<br />Munice: 10<br />Použití: Cyrus + Ráže: 9.3x64mm Svítící<br />Nábojů: 10<br />Použití u: Cyrus Calibre: 9.3x64mm Traçante<br />Cartuchos: 10<br />Usado em: Cyrus Kaliber: 9,3x64mm nyomkövető<br />Lövedékek: 10<br />Használható: Cyrus @@ -543,7 +543,7 @@ Calibre: 9.3x64mm trazadora IR-DIM<br />Balas: 10<br />Se usa en: Cyrus Калибр: 9,3x64 мм ИК-трассирующие<br />Патронов: 10<br />Используются с: Cyrus Calibro: 9.3x64mm Tracciante IR-DIM<br />Munizioni: 10<br />In uso su: Cyrus - Ráže: 9.3x64mm Svítící IR-DIM<br />Munice: 10<br />Použití: Cyrus + Ráže: 9.3x64mm Svítící IR-DIM<br />Nábojů: 10<br />Použití u: Cyrus Calibre: 9.3x64mm Traçante IR-DIM<br />Cartuchos: 10<br />Usado em: Cyrus Kaliber: 9,3x64mm infravörös nyomkövető<br />Lövedékek: 10<br /> Használható: Cyrus @@ -580,7 +580,7 @@ Calibre: 9.3x64mm trazadora<br />Balas: 150<br />Se usa en: Navid Калибр: 9,3x64 мм трассирующие<br />Патронов: 150<br />Используются с: Навид Calibro: 9.3x64mm Tracciante<br />Munizioni: 150<br />In uso su: Navid - Ráže: 9.3x64mm Svítící<br />Munice: 150<br />Použití: Navid + Ráže: 9.3x64mm Svítící<br />Nábojů: 150<br />Použití u: HK121 Calibre: 9.3x64mm Traçante<br />Cartuchos: 150<br />Usado em: Navid Kaliber: 9,3x64mm nyomkövető<br />Lövedékek: 150<br />Használható: Navid @@ -616,7 +616,7 @@ Calibre: 9.3x64mm trazadora IR-DIM<br />Balas: 150<br />Se usa en: Navid Калибр: 9,3x64 мм ИК-трассирующие<br />Патронов: 150<br />Используются с: Навид Calibro: 9.3x64mm Tracciante IR-DIM<br />Munizioni: 150<br />In uso su: Navid - Ráže: 9.3x64mm Svítící IR-DIM<br />Munice: 150<br />Použití: Navid + Ráže: 9.3x64mm Svítící IR-DIM<br />Nábojů: 150<br />Použití u: HK121 Calibre: 9.3x64mm Traçante IR-DIM<br />Cartuchos: 150<br />Usado em: Navid Kaliber: 9,3x64mm infravörös nyomkövető<br />Lövedékek: 150<br />Használható: Navid @@ -652,7 +652,7 @@ Calibre: 9.3x64mm AP<br />Balas: 150<br />Se usa en: Navid Калибр: 9,3x64 мм бронебойные<br />Патронов: 150<br />Используются с: Навид Calibro: 9.3x64mm AP<br />Munizioni: 150<br />In uso su: Navid - Ráže: 9.3x64mm AP<br />Munice: 150<br />Použití: Navid + Ráže: 9.3x64mm AP<br />Nábojů: 150<br />Použití u: HK121 Calibre: 9.3x64mm AP<br />Cartuchos: 150<br />Usado em: Navid Kaliber: 9,3x64mm páncéltörő<br />Lövedékek: 150<br />Használható: Navid @@ -796,7 +796,7 @@ Магазин из 100 6,5 мм ИК-трассирующих 6,5mm 100-Patronen-Magazin IR-DIM Leuchtspur<br />Patronen: 100<br />Eingesetzt von: MXLSW 6.5mm 100Rnd Tracer IR-DIM Mag<br />Munizioni: 100<br />In uso su: MX LSW - 6.5mm 100náb. Svítící IR-DIM Zásobník<br />Munice: 100<br />Použití: MX LSW + 6.5mm 100náb. Svítící IR-DIM Zásobník<br />Nábojů: 100<br />Použití u: MX LSW Carregador 6.5mm 100 Cartuchos Traçantes IR-DIM<br />Cartuchos: 100<br />Usado em: MX LSW 6.5mm 100-lövedékes infravörös nyomkövető tár<br />Lövedékek: 100<br />Használható: MX LSW @@ -832,7 +832,7 @@ Магазин из 200-т 6,5 мм ИК-трассирующих 6,5mm 200-Patronen-Gurt IR-DIM Leuchtspur<br />Patronen: 200<br />Eingesetzt von: Stoner 99 LMG 6.5mm 200Rnd Tracer IR-DIM Belt<br />Munizioni: 200<br />In uso su: Stoner 99 LMG - 6.5mm 200náb. Svítící IR-DIM Pás<br />Munice: 200<br />Použití: Stoner 99 LMG + 6.5mm 200náb. Svítící IR-DIM Pás<br />Nábojů: 200<br />Použití u: Stoner 99 LMG Cinto de munição traçante 6.5mm IR-DIM com 200 cartuchos<br />Cartuchos: 200<br />Usado em: Stoner 99 LMG 6.5mm 200-lövedékes infravörös nyomkövető heveder<br />Lövedékek: 200<br />Használható: Stoner 99 LMG @@ -868,7 +868,7 @@ Калибр: 5,56x45 мм NATO (Mk262)<br />Патронов: 30 Kaliber: 5,56x45mm NATO (Mk262)<br />Patronen: 30 Calibro: 5.56x45 mm NATO (Mk262)<br />Munizioni: 30 - Ráže: 5.56x45mm NATO (Mk262)<br />Munice: 30 + Ráže: 5.56x45mm NATO (Mk262)<br />Nábojů: 30 Calibre: 5.56x45mm NATO (Mk262)<br/>Cartuchos: 30 Kaliber: 5,56x45mm NATO (Mk262)<br />Lövedékek: 30 @@ -904,7 +904,7 @@ Калибр: 5,56x45 мм NATO (Mk318)<br />Патронов: 30 Kaliber: 5,56x45mm NATO (Mk318)<br />Patronen: 30 Calibro: 5.56x45 mm NATO (Mk318)<br />Munizioni: 30 - Ráže: 5.56x45mm NATO (Mk318)<br />Munice: 30 + Ráže: 5.56x45mm NATO (Mk318)<br />Nábojů: 30 Calibre: 5.56x45mm NATO (Mk318)<br/>Cartuchos: 30 Kaliber: 5,56x45mm NATO (Mk318)<br />Lövedékek: 30 @@ -940,7 +940,7 @@ Калибр: 5,56x45 мм NATO (M995 бронебойные)<br />Патронов: 30 Kaliber: 5,56x45mm NATO (M995 AP)<br />Patronen: 30 Calibro: 5.56x45 mm NATO (M995 AP)<br />Munizioni: 30 - Ráže: 5.56x45mm NATO (M995 AP)<br />Munice: 30 + Ráže: 5.56x45mm NATO (M995 AP)<br />Nábojů: 30 Calibre: 5.56x45mm NATO (M995 AP)<br/>Cartuchos: 30 Kaliber: 5,56x45mm NATO (M995 páncéltörő)<br />Lövedékek: 30 @@ -976,7 +976,7 @@ Калибр: 7,62x51 мм NATO (M118LR)<br />Патронов: 10 Kaliber: 7,62x51mm NATO (M118LR)<br />Patronen: 10 Calibro: 7.62x51 mm NATO (M118LR)<br />Munizioni: 10 - Ráže: 7.62x51mm NATO (M118LR)<br />Munice: 10 + Ráže: 7.62x51mm NATO (M118LR)<br />Nábojů: 10 Calibre: 7.26x51mm NATO (M118LR)<br/>Cartuchos: 10 Kaliber: 7,62x51mm NATO (M118LR)<br />Lövedékek: 10 @@ -1012,7 +1012,7 @@ Калибр: 7,62x51 мм NATO (M118LR)<br />Патронов: 20 Kaliber: 7,62x51mm NATO (M118LR)<br />Patronen: 20 Calibro: 7.62x51 mm NATO (M118LR)<br />Munizioni: 20 - Ráže: 7.62x51mm NATO (M118LR)<br />Munice: 20 + Ráže: 7.62x51mm NATO (M118LR)<br />Nábojů: 20 Calibre: 7.26x51mm NATO (M118LR)<br/>Cartuchos: 20 Kaliber: 7,62x51mm NATO (M118LR)<br />Lövedékek: 20 @@ -1048,7 +1048,7 @@ Калибр: 7,62x51 мм NATO (Mk316 Mod 0)<br />Патронов: 10 Kaliber: 7,62x51mm NATO (Mk316 Mod 0)<br />Patronen: 10 Calibro: 7.62x51 mm NATO (Mk316 Mod 0)<br />Munizioni: 10 - Ráže: 7.62x51mm NATO (Mk316 Mod 0)<br />Munice: 10 + Ráže: 7.62x51mm NATO (Mk316 Mod 0)<br />Nábojů: 10 Calibre: 7.26x51mm NATO (Mk316 Mod 0)<br/>Cartuchos: 10 Kaliber: 7,62x51mm NATO (Mk316 Mod 0)<br />Lövedékek: 10 @@ -1084,7 +1084,7 @@ Калибр: 7,62x51 мм NATO (Mk316 Mod 0)<br />Патронов: 20 Kaliber: 7,62x51mm NATO (Mk316 Mod 0)<br />Patronen: 20 Calibro: 7.62x51 mm NATO (Mk316 Mod 0)<br />Munizioni: 20 - Ráže: 7.62x51mm NATO (Mk316 Mod 0)<br />Munice: 20 + Ráže: 7.62x51mm NATO (Mk316 Mod 0)<br />Nábojů: 20 Calibre: 7.26x51mm NATO (Mk316 Mod 0)<br/>Cartuchos: 20 Kaliber: 7,62x51mm NATO (Mk316 Mod 0)<br />Lövedékek: 20 @@ -1120,7 +1120,7 @@ Калибр: 7,62x51 мм NATO (Mk319 Mod 0)<br />Патронов: 10 Kaliber: 7,62x51mm NATO (Mk319 Mod 0)<br />Patronen: 10 Calibro: 7.62x51 mm NATO (Mk319 Mod 0)<br />Munizioni: 10 - Ráže: 7.62x51mm NATO (Mk319 Mod 0)<br />Munice: 10 + Ráže: 7.62x51mm NATO (Mk319 Mod 0)<br />Nábojů: 10 Calibre: 7.26x51mm NATO (Mk319 Mod 0)<br/>Cartuchos: 10 Kaliber: 7,62x51mm NATO (Mk319 Mod 0)<br />Lövedékek: 10 @@ -1156,7 +1156,7 @@ Калибр: 7,62x51 мм NATO (Mk319 Mod 0)<br />Патронов: 20 Kaliber: 7,62x51mm NATO (Mk319 Mod 0)<br />Patronen: 20 Calibro: 7.62x51 mm NATO (Mk319 Mod 0)<br />Munizioni: 20 - Ráže: 7.62x51mm NATO (Mk319 Mod 0)<br />Munice: 20 + Ráže: 7.62x51mm NATO (Mk319 Mod 0)<br />Nábojů: 20 Calibre: 7.26x51mm NATO (Mk319 Mod 0)<br/>Cartuchos: 20 Kaliber: 7,62x51mm NATO (Mk319 Mod 0)<br />Lövedékek: 20 @@ -1192,7 +1192,7 @@ Калибр: 7,62x51 мм NATO (M993 бронебойные)<br />Патронов: 10 Kaliber: 7,62x51mm NATO (M993 AP)<br />Patronen: 10 Calibro: 7.62x51 mm NATO (M993 AP)<br />Munizioni: 10 - Ráže: 7.62x51mm NATO (M993 AP)<br />Munice: 10 + Ráže: 7.62x51mm NATO (M993 AP)<br />Nábojů: 10 Calibre: 7.26x51mm NATO (M993 AP)<br/>Cartuchos: 10 Kaliber: 7,62x51mm NATO (M993 páncéltörő)<br />Lövedékek: 10 @@ -1228,7 +1228,7 @@ Kaliber: 7,62x51mm NATO (M993 AP)<br />Patronen: 20 Calibro: 7.62x51 mm NATO (M993 AP)<br />Munizioni: 20 Calibre: 7.62x51 mm NATO (M993 AP)<br />Balas: 20 - Ráže: 7.62x51mm NATO (M993 AP)<br />Munice: 20 + Ráže: 7.62x51mm NATO (M993 AP)<br />Nábojů: 20 Calibre: 7.26x51mm NATO (M993 AP)<br/>Cartuchos: 20 Kaliber: 7,62x51mm NATO (M993 páncéltörő)<br />Lövedékek: 20 @@ -1264,7 +1264,7 @@ Калибр: 7,62x67 мм NATO (Mk248 Mod 0)<br />Патронов: 20 Kaliber: 7,62x51mm NATO (Mk248 Mod 0)<br />Patronen: 20 Calibro: 7.62x67 mm NATO (Mk248 Mod 0)<br />Munizioni: 20 - Ráže: 7.62x67mm NATO (Mk248 Mod 0)<br />Munice: 20 + Ráže: 7.62x67mm NATO (Mk248 Mod 0)<br />Nábojů: 20 Calibre: 7.26x67mm NATO (Mk248 Mod 0)<br/>Cartuchos: 20 Kaliber: 7,62x51mm NATO (Mk248 Mod 0)<br />Lövedékek: 20 @@ -1300,7 +1300,7 @@ Калибр: 7,62x67 мм NATO (Mk248 Mod 1)<br />Патронов: 20 Kaliber: 7,62x51mm NATO (Mk248 Mod 1)<br />Patronen: 20 Calibro: 7.62x67 mm NATO (Mk248 Mod 1)<br />Munizioni: 20 - Ráže: 7.62x67mm NATO (Mk248 Mod 1)<br />Munice: 20 + Ráže: 7.62x67mm NATO (Mk248 Mod 1)<br />Nábojů: 20 Calibre: 7.26x67mm NATO (Mk248 Mod 1)<br/>Cartuchos: 20 Kaliber: 7,62x51mm NATO (Mk248 Mod 1)<br />Lövedékek: 20 @@ -1336,7 +1336,7 @@ Калибр: 7,62x67 мм NATO (Berger Hybrid OTM)<br />Патронов: 20 Kaliber: 7,62x67mm NATO (Berger Hybrid OTM)<br />Patronen: 20 Calibro: 7.62x67 mm NATO (Berger Hybrid OTM)<br />Munizioni: 20 - Ráže: 7.62x67mm NATO (Berger Hybrid OTM)<br />Munice: 20 + Ráže: 7.62x67mm NATO (Berger Hybrid OTM)<br />Nábojů: 20 Calibre: 7.26x67mm NATO (Berger Hybrid OTM)<br/>Cartuchos: 20 Kaliber: 7,62x67mm NATO (Berger Hybrid OTM)<br />Lövedékek: 20 @@ -1372,7 +1372,7 @@ Калибр: 6,5x47 мм (экспансивные Scenar)<br />Патронов: 30<br />Используются с: MXM Kaliber: 6,5x47mm (HPBT Scenar)<br />Patronen: 30<br />Eingesetzt von: MXM Calibro: 6.5x47mm (HPBT Scenar)<br />Munizioni: 30<br />In uso su: MXM - Ráže: 6.5x47mm (HPBT Scenar)<br />Munice: 30<br />Použití: MXM + Ráže: 6.5x47mm (HPBT Scenar)<br />Nábojů: 30<br />Použití u: MXM Calibre: 6.5x47mm (HPBT Scenar)<br/>Cartuchos: 30<br/>Usado em: MXM Kaliber: 6,5x47mm (HPBT Scenar)<br />Lövedékek: 30<br />Használható: MXM @@ -1408,7 +1408,7 @@ Calibro: 6.5mm Creedmor<br />Munizioni: 30<br />In uso su: MXM Calibre: 6.5mm Creedmor<br />Balas: 30<br />Se usa en: MXM Калибр: 6,5x47мм Creedmor<br />Патронов: 30<br />Используются c: MXM - Ráže: 6.5x47mm Creedmor<br />Munice: 30<br />Použití: MXM + Ráže: 6.5x47mm Creedmor<br />Nábojů: 30<br />Použití u: MXM Calibre: 6.5x47mm Creedmor<br/>Cartuchos: 30<br/>Usado em: MXM Kaliber: 6,5x47mm Creedmor<br />Lövedékek: 30<br />Használható: MXM @@ -1444,7 +1444,7 @@ Калибр: 8,6x70mm (300 гран Sierra MatchKing экспансивные)<br />Патронов: 10 Kaliber: 8,6x70mm (300gr Sierra MatchKing HPBT)<br />Patronen: 10 Calibro: 8.6x70mm (300gr Sierra MatchKing HPBT)<br />Munizioni: 10 - Ráže: 8.6x70mm (300gr Sierra MatchKing HPBT)<br />Munice: 10 + Ráže: 8.6x70mm (300gr Sierra MatchKing HPBT)<br />Nábojů: 10 Calibre: 8.6x70mm (300gr Sierra MatchKing HPBT)<br/>Cartuchos: 10 Kaliber: 8,6x70mm (300gr Sierra MatchKing HPBT)<br />Lövedékek: 10 @@ -1480,7 +1480,7 @@ Калибр: 8,6x70 мм (API526)<br />Патронов: 10 Kaliber: 8,6x70mm (API526)<br />Patronen: 10 Calibro: 8.6x70mm (API526)<br />Munizioni: 10 - Ráže: 8.6x70mm (API526)<br />Munice: 10 + Ráže: 8.6x70mm (API526)<br />Nábojů: 10 Calibre: 8.6x70mm (API526)<br/>Cartuchos: 10 Kaliber: 8,6x70mm (API526)<br />Lövedékek: 10 @@ -1516,7 +1516,7 @@ Калибр: 12,7x99 мм<br />Патронов: 5 Kaliber: 12,7x99mm<br />Patronen: 5 Calibro: 12.7x99mm<br />Munizioni: 5 - Ráže: 12.7x99mm<br />Munice: 5 + Ráže: 12.7x99mm<br />Nábojů: 5 Calibre: 12.7x99mm<br/>Cartuchos: 5 Kaliber: 12,7x99mm<br />Lövedékek: 5 @@ -1552,7 +1552,7 @@ Калибр: 12,7x99 мм бронебойно-зажигательные<br />Патронов: 5 Kaliber:12,7x99mm API<br />Patronen: 5 Calibro: 12.7x99mm API<br />Munizioni: 5 - Ráže: 12.7x99mm API<br />Munice: 5 + Ráže: 12.7x99mm API<br />Nábojů: 5 Calibre: 12.7x99mm API<br/>Cartuchos: 5 Kaliber: 12,7x99mm API<br />Lövedékek: 5 @@ -1588,7 +1588,7 @@ Калибр: 12,7x99 мм (A-MAX)<br />Патронов: 5 Calibro: 12.7x99mm (AMAX)<br />Munizioni: 5 Kaliber:12,7x99mm (AMAX)<br />Patronen: 5 - Ráže: 12.7x99mm (AMAX)<br />Munice: 5 + Ráže: 12.7x99mm (AMAX)<br />Nábojů: 5 Calibre: 12.7x99mm (AMAX)<br/>Cartuchos: 5 Kaliber: 12,7x99mm (AMAX)<br />Lövedékek: 5 @@ -1604,4 +1604,4 @@ [ACE] Ящик с боеприпасами - + \ No newline at end of file diff --git a/addons/captives/functions/fnc_handleRespawn.sqf b/addons/captives/functions/fnc_handleRespawn.sqf index 7e97501576..bdd4915d68 100644 --- a/addons/captives/functions/fnc_handleRespawn.sqf +++ b/addons/captives/functions/fnc_handleRespawn.sqf @@ -40,12 +40,12 @@ if (_respawn > 3) then { if (_unit getVariable [QGVAR(isHandcuffed), false]) then { [_unit, false] call FUNC(setHandcuffed); }; - [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(Handcuffed), false] call EFUNC(common,statusEffect_set); if (_unit getVariable [QGVAR(isSurrendering), false]) then { [_unit, false] call FUNC(setSurrendered); }; - [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(Surrendered), false] call EFUNC(common,statusEffect_set); 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 1e686ea849..0a17e0378c 100644 --- a/addons/captives/functions/fnc_setHandcuffed.sqf +++ b/addons/captives/functions/fnc_setHandcuffed.sqf @@ -28,7 +28,7 @@ if ((_unit getVariable [QGVAR(isHandcuffed), false]) isEqualTo _state) exitWith if (_state) then { _unit setVariable [QGVAR(isHandcuffed), true, true]; - [_unit, QGVAR(Handcuffed), true] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(Handcuffed), true] call EFUNC(common,statusEffect_set); if (_unit getVariable [QGVAR(isSurrendering), false]) then { //If surrendering, stop [_unit, false] call FUNC(setSurrendered); @@ -89,7 +89,7 @@ if (_state) then { }, [_unit], 0.01] call EFUNC(common,waitAndExecute); } else { _unit setVariable [QGVAR(isHandcuffed), false, true]; - [_unit, QGVAR(Handcuffed), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(Handcuffed), false] call EFUNC(common,statusEffect_set); //remove AnimChanged EH private _animChangedEHID = _unit getVariable [QGVAR(handcuffAnimEHID), -1]; diff --git a/addons/captives/functions/fnc_setSurrendered.sqf b/addons/captives/functions/fnc_setSurrendered.sqf index aa65c1273d..e65bd86bd0 100644 --- a/addons/captives/functions/fnc_setSurrendered.sqf +++ b/addons/captives/functions/fnc_setSurrendered.sqf @@ -33,7 +33,7 @@ if (_state) then { _unit setVariable [QGVAR(isSurrendering), true, true]; - [_unit, QGVAR(Surrendered), true] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(Surrendered), true] call EFUNC(common,statusEffect_set); if (_unit == ACE_player) then { ["captive", [false, false, false, false, false, false, false, false]] call EFUNC(common,showHud); @@ -65,7 +65,7 @@ if (_state) then { }, [_unit], 0.01] call EFUNC(common,waitAndExecute); } else { _unit setVariable [QGVAR(isSurrendering), false, true]; - [_unit, QGVAR(Surrendered), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(Surrendered), false] call EFUNC(common,statusEffect_set); //remove AnimChanged EH private _animChangedEHID = _unit getVariable [QGVAR(surrenderAnimEHID), -1]; diff --git a/addons/captives/script_component.hpp b/addons/captives/script_component.hpp index 375c956129..95a842f15f 100644 --- a/addons/captives/script_component.hpp +++ b/addons/captives/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_CAPTIVES #define DEBUG_MODE_FULL diff --git a/addons/captives/stringtable.xml b/addons/captives/stringtable.xml index 17b44bc8fe..9391cb7da3 100644 --- a/addons/captives/stringtable.xml +++ b/addons/captives/stringtable.xml @@ -7,7 +7,7 @@ Tomar prisionero Capturer le prisonnier Aresztuj - Zajmout Osobu + Zajmout osobu Arresta il prigioniero Tomar Prisioneiro Foglyul ejtés @@ -19,7 +19,7 @@ Liberar prisionero Wypuść więźnia Libérer le prisonnier - Osvobodit Zajatce + Osvobodit zajatce Libera il prigioniero Libertar Prisioneiro Fogoly szabadon engedése @@ -31,7 +31,7 @@ Escoltar prisionero Eskortuj więźnia Escorter le prisonnier - Eskortovat Zajatce + Eskortovat zajatce Scorta il Prigioniero Escoltar Prisioneiro Fogoly kísérése @@ -43,7 +43,7 @@ Soltar prisionero Anuluj eskortowanie Relâcher le prisonnier - Uvolnit Zajatce + Uvolnit zajatce Rilascia il Prigioniero Largar Prisioneiro Fogoly elengedése @@ -91,7 +91,7 @@ Opaska zaciskowa Precinto Serflex - Stahovací Pásek + Stahovací pásek Algema Plástica Fascietta Gyorskötöző @@ -296,4 +296,4 @@ Vzdávání nebo beze zbraně - + \ No newline at end of file diff --git a/addons/cargo/CfgEventHandlers.hpp b/addons/cargo/CfgEventHandlers.hpp index 5dadfb322c..f5c1803b91 100644 --- a/addons/cargo/CfgEventHandlers.hpp +++ b/addons/cargo/CfgEventHandlers.hpp @@ -12,7 +12,9 @@ class Extended_PostInit_EventHandlers { class Extended_Killed_EventHandlers { class All { - init = QUOTE(call FUNC(handleDestroyed)); + class ADDON { + serverKilled = QUOTE(call FUNC(handleDestroyed)); + }; }; }; diff --git a/addons/cargo/CfgVehicles.hpp b/addons/cargo/CfgVehicles.hpp index 6565b7f4c5..42b46c7a9f 100644 --- a/addons/cargo/CfgVehicles.hpp +++ b/addons/cargo/CfgVehicles.hpp @@ -1,5 +1,9 @@ class CfgVehicles { - class ACE_Module; + class Logic; + class Module_F: Logic { + class ModuleDescription; + }; + class ACE_Module: Module_F {}; class ACE_moduleCargoSettings: ACE_Module { scope = 2; displayName = CSTRING(SettingsModule_DisplayName); @@ -26,6 +30,33 @@ class CfgVehicles { sync[] = {}; }; }; + class GVAR(makeLoadable): ACE_Module { + scope = 2; + displayName = CSTRING(makeLoadable_displayName); + icon = QUOTE(PATHTOF(UI\Icon_Module_makeLoadable_ca.paa)); + category = "ACE_Logistics"; + function = QFUNC(moduleMakeLoadable); + isGlobal = 1; + isTriggerActivated = 0; + author = ECSTRING(common,ACETeam); + class Arguments { + class canLoad { + displayName = CSTRING(makeLoadable_displayName); + description = CSTRING(MakeLoadable_description); + typeName = "BOOL"; + defaultValue = 1; + }; + class setSize { + displayName = CSTRING(makeLoadable_setSize_displayName); + typeName = "NUMBER"; + defaultValue = 1; + }; + }; + class ModuleDescription: ModuleDescription { + description = CSTRING(module_MakeLoadable_description); + sync[] = {"AnyStaticObject"}; + }; + }; class LandVehicle; class Car: LandVehicle { @@ -178,7 +209,7 @@ class CfgVehicles { GVAR(space) = 0; GVAR(hasCargo) = 0; }; - + // boats class Ship; class Ship_F: Ship { @@ -245,7 +276,7 @@ class CfgVehicles { class RoadBarrier_F: RoadCone_F { GVAR(size) = 2; }; - + class Scrapyard_base_F; class Land_PaperBox_closed_F: Scrapyard_base_F { diff --git a/addons/cargo/UI/Icon_Module_makeLoadable_ca.paa b/addons/cargo/UI/Icon_Module_makeLoadable_ca.paa new file mode 100644 index 0000000000..1577116a66 Binary files /dev/null and b/addons/cargo/UI/Icon_Module_makeLoadable_ca.paa differ diff --git a/addons/cargo/XEH_postInit.sqf b/addons/cargo/XEH_postInit.sqf index 064c941d37..c51090f8ad 100644 --- a/addons/cargo/XEH_postInit.sqf +++ b/addons/cargo/XEH_postInit.sqf @@ -4,14 +4,14 @@ ["LoadCargo", { (_this select 0) params ["_item","_vehicle"]; - private ["_loaded", "_hint", "_itemName", "_vehicleName"]; + TRACE_2("LoadCargo EH",_item,_vehicle); - _loaded = [_item, _vehicle] call FUNC(loadItem); + private _loaded = [_item, _vehicle] call FUNC(loadItem); // Show hint as feedback - _hint = [LSTRING(LoadingFailed), LSTRING(LoadedItem)] select _loaded; - _itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName"); - _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); + private _hint = [LSTRING(LoadingFailed), LSTRING(LoadedItem)] select _loaded; + private _itemName = getText (configFile >> "CfgVehicles" >> typeOf _item >> "displayName"); + private _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); ["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent); @@ -22,17 +22,17 @@ }] call EFUNC(common,addEventHandler); ["UnloadCargo", { - (_this select 0) params ["_item","_vehicle"]; - private ["_unloaded", "_itemClass", "_hint", "_itemName", "_vehicleName"]; + (_this select 0) params ["_item","_vehicle", ["_unloader", objNull]]; + TRACE_3("UnloadCargo EH",_item,_vehicle,_unloader); + + private _unloaded = [_item, _vehicle, _unloader] call FUNC(unloadItem); //returns true if sucessful - _unloaded = [_item, _vehicle] call FUNC(unloadItem); - - _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; + private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; // Show hint as feedback - _hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded; - _itemName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName"); - _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); + private _hint = [LSTRING(UnloadingFailed), LSTRING(UnloadedItem)] select _unloaded; + private _itemName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName"); + private _vehicleName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName"); ["displayTextStructured", [[_hint, _itemName, _vehicleName], 3.0]] call EFUNC(common,localEvent); diff --git a/addons/cargo/XEH_preInit.sqf b/addons/cargo/XEH_preInit.sqf index 8924cacfd5..1f2be9894b 100644 --- a/addons/cargo/XEH_preInit.sqf +++ b/addons/cargo/XEH_preInit.sqf @@ -13,6 +13,8 @@ PREP(handleDestroyed); PREP(initObject); PREP(initVehicle); PREP(loadItem); +PREP(makeLoadable); +PREP(moduleMakeLoadable); PREP(moduleSettings); PREP(onMenuOpen); PREP(startLoadIn); @@ -21,5 +23,6 @@ PREP(unloadItem); PREP(validateCargoSpace); GVAR(initializedItemClasses) = []; +GVAR(initializedVehicleClasses) = []; ADDON = true; diff --git a/addons/cargo/functions/fnc_addCargoItem.sqf b/addons/cargo/functions/fnc_addCargoItem.sqf index a44cd0ebcf..5e01214934 100644 --- a/addons/cargo/functions/fnc_addCargoItem.sqf +++ b/addons/cargo/functions/fnc_addCargoItem.sqf @@ -18,7 +18,7 @@ */ #include "script_component.hpp" -params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]] ]; +params ["_itemClass", "_vehicle", ["_amount", 1], ["_showHint", false, [false]]]; TRACE_3("params",_itemClass,_vehicle,_amount); for "_i" from 1 to _amount do { diff --git a/addons/cargo/functions/fnc_canLoad.sqf b/addons/cargo/functions/fnc_canLoad.sqf index f18ceb5835..bf1098dbf1 100644 --- a/addons/cargo/functions/fnc_canLoad.sqf +++ b/addons/cargo/functions/fnc_canLoad.sqf @@ -17,11 +17,11 @@ #include "script_component.hpp" params ["_player", "_object"]; +TRACE_2("params",_player,_object); if (!([_player, _object, []] call EFUNC(common,canInteractWith))) exitWith {false}; -private ["_nearestVehicle"]; -_nearestVehicle = [_player] call FUNC(findNearestVehicle); +private _nearestVehicle = [_player] call FUNC(findNearestVehicle); if (_nearestVehicle isKindOf "Cargo_Base_F" || isNull _nearestVehicle) then { { diff --git a/addons/cargo/functions/fnc_canLoadItemIn.sqf b/addons/cargo/functions/fnc_canLoadItemIn.sqf index b446c4b589..d6092c2a2d 100644 --- a/addons/cargo/functions/fnc_canLoadItemIn.sqf +++ b/addons/cargo/functions/fnc_canLoadItemIn.sqf @@ -18,11 +18,10 @@ params [["_item", "", [objNull,""]], "_vehicle"]; -if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitWith {false}; - -private ["_itemSize", "_validItem"]; -_itemSize = [_item] call FUNC(getSizeItem); +if (speed _vehicle > 1 || {((getPos _vehicle) select 2) > 3}) exitWith {TRACE_1("vehicle not stable",_vehicle); false}; +private _itemSize = [_item] call FUNC(getSizeItem); +private _validItem = false; if (_item isEqualType "") then { _validItem = isClass (configFile >> "CfgVehicles" >> _item) && diff --git a/addons/cargo/functions/fnc_canUnloadItem.sqf b/addons/cargo/functions/fnc_canUnloadItem.sqf index 5c6acc44cc..ea6cb7a6eb 100644 --- a/addons/cargo/functions/fnc_canUnloadItem.sqf +++ b/addons/cargo/functions/fnc_canUnloadItem.sqf @@ -5,6 +5,7 @@ * Arguments: * 0: loaded Object * 1: Object + * 2: Unloader (player) * * Return value: * Can be unloaded @@ -16,30 +17,14 @@ */ #include "script_component.hpp" -params ["_item", "_vehicle"]; -private ["_loaded", "_itemClass", "_validVehiclestate", "_emptyPos"]; +params ["_item", "_vehicle", ["_unloader", objNull]]; +TRACE_2("params",_item,_vehicle); -_loaded = _vehicle getVariable [QGVAR(loaded), []]; +private _loaded = _vehicle getVariable [QGVAR(loaded), []]; if !(_item in _loaded) exitWith {false}; -_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; +private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; -_validVehiclestate = true; -_emptyPos = []; -if (_vehicle isKindOf "Ship" ) then { - if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; - _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]); // TODO: if spot is underwater pick another spot. -} else { - if (_vehicle isKindOf "Air" ) then { - if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false}; - _emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition); - _emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ]; - } else { - if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; - _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]); - }; -}; +private _emptyPos = [_vehicle, _itemClass, _unloader] call EFUNC(common,findUnloadPosition); -if (!_validVehiclestate) exitWith {false}; - -(count _emptyPos != 0) +(count _emptyPos) == 3 diff --git a/addons/cargo/functions/fnc_findNearestVehicle.sqf b/addons/cargo/functions/fnc_findNearestVehicle.sqf index c0ec154d47..b5b441df92 100644 --- a/addons/cargo/functions/fnc_findNearestVehicle.sqf +++ b/addons/cargo/functions/fnc_findNearestVehicle.sqf @@ -15,23 +15,21 @@ */ #include "script_component.hpp" -private ["_loadCar", "_loadHelicopter", "_loadTank", "_loadShip", "_loadContainer"]; - params ["_unit"]; -_loadCar = nearestObject [_unit, "car"]; +private _loadCar = nearestObject [_unit, "car"]; if (_unit distance _loadCar <= MAX_LOAD_DISTANCE) exitWith {_loadCar}; -_loadHelicopter = nearestObject [_unit, "air"]; +private _loadHelicopter = nearestObject [_unit, "air"]; if (_unit distance _loadHelicopter <= MAX_LOAD_DISTANCE) exitWith {_loadHelicopter}; -_loadTank = nearestObject [_unit, "tank"]; +private _loadTank = nearestObject [_unit, "tank"]; if (_unit distance _loadTank <= MAX_LOAD_DISTANCE) exitWith {_loadTank}; -_loadShip = nearestObject [_unit, "ship"]; +private _loadShip = nearestObject [_unit, "ship"]; if (_unit distance _loadShip <= MAX_LOAD_DISTANCE) exitWith {_loadShip}; -_loadContainer = nearestObject [_unit,"Cargo_base_F"]; +private _loadContainer = nearestObject [_unit,"Cargo_base_F"]; if (_unit distance _loadContainer <= MAX_LOAD_DISTANCE) exitWith {_loadContainer}; objNull diff --git a/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf b/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf index b858ebfddc..7d94570749 100644 --- a/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf +++ b/addons/cargo/functions/fnc_getCargoSpaceLeft.sqf @@ -16,5 +16,6 @@ #include "script_component.hpp" params ["_object"]; +// TRACE_1("params",_object); _object getVariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(space))] diff --git a/addons/cargo/functions/fnc_getSizeItem.sqf b/addons/cargo/functions/fnc_getSizeItem.sqf index bf5e76dcdb..775bdefd10 100644 --- a/addons/cargo/functions/fnc_getSizeItem.sqf +++ b/addons/cargo/functions/fnc_getSizeItem.sqf @@ -16,22 +16,23 @@ #include "script_component.hpp" params ["_item"]; -private ["_isVirtual","_itemClass","_config"]; + scopeName "return"; -_isVirtual = (_item isEqualType ""); -_itemClass = if (_isVirtual) then {_item} else {typeOf _item}; -_config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size)); +private _isVirtual = (_item isEqualType ""); +private _itemClass = if (_isVirtual) then {_item} else {typeOf _item}; +private _config = (configFile >> "CfgVehicles" >> _itemClass >> QGVAR(size)); if (_isVirtual) then { if (isNumber _config) then { (getNumber _config) breakOut "return"; }; } else { - _config = (configFile >> "CfgVehicles" >> typeOf _item >> QGVAR(size)); - + if (!isNil {_item getVariable QGVAR(size)}) then { + (_item getVariable QGVAR(size)) breakOut "return"; + }; if (isNumber _config) then { - (_item getVariable [QGVAR(size), getNumber _config]) breakOut "return"; + (getNumber _config) breakOut "return"; }; }; diff --git a/addons/cargo/functions/fnc_handleDestroyed.sqf b/addons/cargo/functions/fnc_handleDestroyed.sqf index 8ddf59b21b..d50ea488d6 100644 --- a/addons/cargo/functions/fnc_handleDestroyed.sqf +++ b/addons/cargo/functions/fnc_handleDestroyed.sqf @@ -1,6 +1,6 @@ /* * Author: Glowbal - * Handle object being destroyed. + * Handle object being destroyed. Only runs on server. * * Arguments: * 0: Object @@ -16,10 +16,9 @@ #include "script_component.hpp" params ["_vehicle"]; +TRACE_1("params",_vehicle); -private["_loaded"]; - -_loaded = _vehicle getVariable [QGVAR(loaded), []]; +private _loaded = _vehicle getVariable [QGVAR(loaded), []]; if (_loaded isEqualTo []) exitWith {}; { @@ -27,6 +26,7 @@ if (_loaded isEqualTo []) exitWith {}; if (_x isEqualType objNull) then { deleteVehicle _x; }; + nil } count _loaded; [_vehicle] call FUNC(validateCargoSpace); diff --git a/addons/cargo/functions/fnc_initObject.sqf b/addons/cargo/functions/fnc_initObject.sqf index f9b48b19e1..dc8db802e5 100644 --- a/addons/cargo/functions/fnc_initObject.sqf +++ b/addons/cargo/functions/fnc_initObject.sqf @@ -16,15 +16,31 @@ #include "script_component.hpp" params ["_object"]; +private _type = typeOf _object; +TRACE_2("params",_object,_type); -if (getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(canLoad)) != 1) exitWith {}; - -private ["_type", "_action"]; -_type = typeOf _object; +if ((_object getVariable [QGVAR(canLoad), getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(canLoad))]) != 1) exitWith {}; // do nothing if the class is already initialized if (_type in GVAR(initializedItemClasses)) exitWith {}; GVAR(initializedItemClasses) pushBack _type; -_action = [QGVAR(load), localize LSTRING(loadObject), QUOTE(PATHTOF(UI\Icon_load.paa)), {[_player, _target] call FUNC(startLoadIn)}, {GVAR(enable) && {[_player, _target] call FUNC(canLoad)}}] call EFUNC(interact_menu,createAction); +TRACE_1("Adding load cargo action to class", _type); + +private _condition = { + GVAR(enable) && + {(_target getVariable [QGVAR(canLoad), getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(canLoad))]) == 1} && + {locked _target < 2} && + {alive _target} && + {[_player, _target, []] call EFUNC(common,canInteractWith)} +}; +private _statement = { + params ["_target", "_player"]; + [_player, _target] call FUNC(startLoadIn); +}; +private _text = localize LSTRING(loadObject); +private _icon = QUOTE(PATHTOF(UI\Icon_load.paa)); + +private _action = [QGVAR(load), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction); [_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass); + diff --git a/addons/cargo/functions/fnc_initVehicle.sqf b/addons/cargo/functions/fnc_initVehicle.sqf index 8857030cb7..c0b312146b 100644 --- a/addons/cargo/functions/fnc_initVehicle.sqf +++ b/addons/cargo/functions/fnc_initVehicle.sqf @@ -18,9 +18,7 @@ params ["_vehicle"]; TRACE_1("params", _vehicle); -private ["_type", "_initializedClasses"]; -_type = typeOf _vehicle; -_initializedClasses = GETMVAR(GVAR(initializedClasses),[]); +private _type = typeOf _vehicle; if (isServer) then { { @@ -35,21 +33,24 @@ if (isServer) then { }; // do nothing if the class is already initialized -if (_type in _initializedClasses) exitWith {}; +if (_type in GVAR(initializedVehicleClasses)) exitWith {}; // set class as initialized -_initializedClasses pushBack _type; -SETMVAR(GVAR(initializedClasses),_initializedClasses); +GVAR(initializedVehicleClasses) pushBack _type; +if (!hasInterface) exitWith {}; if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) exitWith {}; -private ["_text", "_condition", "_statement", "_icon", "_action"]; -_condition = { - params ["_target", "_player"]; - GVAR(enable) && {locked _target < 2} && {alive _target} && {[_player, _target, []] call EFUNC(common,canInteractWith)} -}; -_text = localize LSTRING(openMenu); -_statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);}; -_icon = ""; +TRACE_1("Adding unload cargo action to class", _type); -_action = [QGVAR(openMenu), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction); +private _condition = { + GVAR(enable) && {locked _target < 2} && {alive _target} && {[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} +}; +private _statement = { + GVAR(interactionVehicle) = _target; + createDialog QGVAR(menu); +}; +private _text = localize LSTRING(openMenu); +private _icon = ""; + +private _action = [QGVAR(openMenu), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction); [_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf index 22c78c4304..443143ece0 100644 --- a/addons/cargo/functions/fnc_loadItem.sqf +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -6,7 +6,6 @@ * Arguments: * 0: Item * 1: Vehicle - * 2: Show Hint (default: true) * * Return value: * Object loaded @@ -19,18 +18,18 @@ #include "script_component.hpp" params [["_item","",[objNull,""]], ["_vehicle",objNull,[objNull]]]; -private ["_loaded", "_space", "_itemSize"]; +TRACE_2("params",_item,_vehicle); -if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false}; +if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {TRACE_2("cannot load",_item,_vehicle); false}; -_loaded = _vehicle getVariable [QGVAR(loaded), []]; +private _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); +private _space = [_vehicle] call FUNC(getCargoSpaceLeft); +private _itemSize = [_item] call FUNC(getSizeItem); _vehicle setVariable [QGVAR(space), _space - _itemSize, true]; if (_item isEqualType objNull) then { diff --git a/addons/cargo/functions/fnc_makeLoadable.sqf b/addons/cargo/functions/fnc_makeLoadable.sqf new file mode 100644 index 0000000000..ceb1dc1acd --- /dev/null +++ b/addons/cargo/functions/fnc_makeLoadable.sqf @@ -0,0 +1,47 @@ +/* + * Author: PabstMirror + * Makes any object loadable. Needs to be called on all machines. + * + * Arguments: + * 0: Object + * 1: Set as loadable (default: true) + * 2: Size. (default: 1) + * + * Return value: + * None + * + * Example: + * [cursorTarget, true, 1] call ace_cargo_fnc_makeLoadable + * + * Public: Yes + */ +#include "script_component.hpp" + +params [["_object", objNull, [objNull]], ["_canLoad", true, [false, 0]], ["_setSize", 1, [0]]]; +TRACE_3("params",_object,_canLoad,_setSize); + +if (isNull _object) exitWith {TRACE_1("null",_object);}; +private _type = typeOf _object; +private _cfgCanLoad = getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(canLoad)); +private _curSize = [_object] call FUNC(getSizeItem); + +_canLoad = [0, 1] select _canLoad; //convert true/false to scalar + +if ((_canLoad == 1) && {_setSize <= 0}) exitWith { + ACE_LOGERROR("ace_cargo_fnc_makeLoadable (size <= 0) when making loadable"); +}; + +TRACE_2("setVar if different from config",_canLoad,_cfgCanLoad); +if (_canLoad != _cfgCanLoad) then { + _object setVariable [QGVAR(canLoad), _canLoad]; +}; + +TRACE_2("setVar if different from config",_setSize,_curSize); +if (_setSize != _curSize) then { + _object setVariable [QGVAR(size), _setSize]; +}; + +//Add the load actions to the object class if not already added +[_object] call FUNC(initObject); + +nil diff --git a/addons/cargo/functions/fnc_moduleMakeLoadable.sqf b/addons/cargo/functions/fnc_moduleMakeLoadable.sqf new file mode 100644 index 0000000000..bcc6307863 --- /dev/null +++ b/addons/cargo/functions/fnc_moduleMakeLoadable.sqf @@ -0,0 +1,34 @@ +/* + * Author: PabstMirror + * Module to make an object loadable. + * + * Arguments: + * 0: The module logic + * 1: Synchronized units + * 2: Activated + * + * Return Value: + * None + * + * Example: + * [logic, [box], true] call ace_cargo_fnc_moduleMakeLoadable + * + * Public: No + */ +#include "script_component.hpp" + +params ["_logic", "_objects", "_activated"]; +TRACE_3("params",_logic,_objects,_activated); + +if ((isNull _logic) || {!_activated}) exitWith {}; +if (_objects isEqualTo []) exitWith { + ACE_LOGWARNING_1("ace_cargo_fnc_moduleMakeLoadable has no synced objects [%1]", _logic); +}; + +private _canLoad = _logic getVariable ["canLoad", true]; +private _setSize = _logic getVariable ["setSize", 1]; +TRACE_2("settings",_canLoad,_setSize); + +{ + [_x, _canLoad, _setSize] call FUNC(makeLoadable); +} forEach _objects; diff --git a/addons/cargo/functions/fnc_moduleSettings.sqf b/addons/cargo/functions/fnc_moduleSettings.sqf index 2027fb4bbb..c4b6baea3d 100644 --- a/addons/cargo/functions/fnc_moduleSettings.sqf +++ b/addons/cargo/functions/fnc_moduleSettings.sqf @@ -19,7 +19,7 @@ if (!isServer) exitWith {}; -params ["_logic", "_units", "_activated"]; +params ["_logic", "", "_activated"]; if (!_activated) exitWith {}; diff --git a/addons/cargo/functions/fnc_onMenuOpen.sqf b/addons/cargo/functions/fnc_onMenuOpen.sqf index f2abf79100..a045862e36 100644 --- a/addons/cargo/functions/fnc_onMenuOpen.sqf +++ b/addons/cargo/functions/fnc_onMenuOpen.sqf @@ -22,25 +22,24 @@ params ["_display"]; uiNamespace setVariable [QGVAR(menuDisplay), _display]; [{ - private ["_display","_loaded", "_ctrl", "_class", "_label"]; disableSerialization; - _display = uiNamespace getVariable QGVAR(menuDisplay); + private _display = uiNamespace getVariable QGVAR(menuDisplay); if (isnil "_display") exitWith { [_this select 1] call CBA_fnc_removePerFrameHandler; }; - if (isNull GVAR(interactionVehicle) || ACE_player distance GVAR(interactionVehicle) >= 10) exitWith { + if (isNull GVAR(interactionVehicle) || {ACE_player distance GVAR(interactionVehicle) >= 10}) exitWith { closeDialog 0; [_this select 1] call CBA_fnc_removePerFrameHandler; }; - _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []]; - _ctrl = _display displayCtrl 100; - _label = _display displayCtrl 2; + private _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []]; + private _ctrl = _display displayCtrl 100; + private _label = _display displayCtrl 2; lbClear _ctrl; { - _class = if (_x isEqualType "") then {_x} else {typeOf _x}; + private _class = if (_x isEqualType "") then {_x} else {typeOf _x}; _ctrl lbAdd (getText(configfile >> "CfgVehicles" >> _class >> "displayName")); true } count _loaded; diff --git a/addons/cargo/functions/fnc_startLoadIn.sqf b/addons/cargo/functions/fnc_startLoadIn.sqf index 091c817f1e..4e1785a6d7 100644 --- a/addons/cargo/functions/fnc_startLoadIn.sqf +++ b/addons/cargo/functions/fnc_startLoadIn.sqf @@ -3,38 +3,46 @@ * Start load item. * * Arguments: - * 0: Object + * 0: Player + * 1: Object * * Return value: - * Object loaded + * Load ProgressBar Started * * Example: - * [object] call ace_cargo_fnc_starLoadIn + * [player, cursorTarget] call ace_cargo_fnc_startLoadIn * * Public: No */ #include "script_component.hpp" params ["_player", "_object"]; -private ["_vehicle", "_size", "_displayName"]; +TRACE_2("params",_player,_object); -_vehicle = [_player] call FUNC(findNearestVehicle); +private _vehicle = [_player] call FUNC(findNearestVehicle); -if (isNull _vehicle || _vehicle isKindOf "Cargo_Base_F") then { +if ((isNull _vehicle) || {_vehicle isKindOf "Cargo_Base_F"}) then { { if ([_object, _x] call FUNC(canLoadItemIn)) exitWith {_vehicle = _x}; } forEach (nearestObjects [_player, ["Cargo_base_F", "Land_PaperBox_closed_F"], MAX_LOAD_DISTANCE]); }; -if (isNull _vehicle) exitWith {false}; +if (isNull _vehicle) exitWith { + TRACE_3("Could not find vehicle",_player,_object,_vehicle); + false +}; +private _return = false; // Start progress bar if ([_object, _vehicle] call FUNC(canLoadItemIn)) then { - _size = [_object] call FUNC(getSizeItem); + private _size = [_object] call FUNC(getSizeItem); [5 * _size, [_object,_vehicle], "LoadCargo", {}, localize LSTRING(LoadingItem)] call EFUNC(common,progressBar); + _return = true; } else { - _displayName = getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName"); + private _displayName = getText (configFile >> "CfgVehicles" >> typeOf _object >> "displayName"); ["displayTextStructured", [[LSTRING(LoadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent); }; + +_return diff --git a/addons/cargo/functions/fnc_startUnload.sqf b/addons/cargo/functions/fnc_startUnload.sqf index dc49e9d34b..dc97ed2157 100644 --- a/addons/cargo/functions/fnc_startUnload.sqf +++ b/addons/cargo/functions/fnc_startUnload.sqf @@ -15,34 +15,29 @@ */ #include "script_component.hpp" -private ["_display", "_loaded", "_ctrl", "_selected", "_item"]; - disableSerialization; -_display = uiNamespace getVariable QGVAR(menuDisplay); +private _display = uiNamespace getVariable QGVAR(menuDisplay); if (isNil "_display") exitWith {}; -_loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []]; -if (count _loaded == 0) exitWith {}; +private _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []]; +if (_loaded isEqualTo []) exitWith {}; -_ctrl = _display displayCtrl 100; +private _ctrl = _display displayCtrl 100; -_selected = (lbCurSel _ctrl) max 0; +private _selected = (lbCurSel _ctrl) max 0; if (count _loaded <= _selected) exitWith {}; -_item = _loaded select _selected; - +private _item = _loaded select _selected; //This can be an object or a classname string // Start progress bar -private ["_size", "_itemClass", "_displayName"]; +if ([_item, GVAR(interactionVehicle), ACE_player] call FUNC(canUnloadItem)) then { + private _size = [_item] call FUNC(getSizeItem); -if ([_item, GVAR(interactionVehicle)] call FUNC(canUnloadItem)) then { - _size = [_item] call FUNC(getSizeItem); - - [5 * _size, [_item, GVAR(interactionVehicle)], "UnloadCargo", {}, localize LSTRING(UnloadingItem)] call EFUNC(common,progressBar); + [5 * _size, [_item, GVAR(interactionVehicle), ACE_player], "UnloadCargo", {}, localize LSTRING(UnloadingItem), {true}, ["isNotSwimming"]] call EFUNC(common,progressBar); } else { - _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; - _displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName"); + private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; + private _displayName = getText (configFile >> "CfgVehicles" >> _itemClass >> "displayName"); ["displayTextStructured", [[LSTRING(UnloadingFailed), _displayName], 3.0]] call EFUNC(common,localEvent); }; diff --git a/addons/cargo/functions/fnc_unloadItem.sqf b/addons/cargo/functions/fnc_unloadItem.sqf index d9e8bf34be..ac125b2dce 100644 --- a/addons/cargo/functions/fnc_unloadItem.sqf +++ b/addons/cargo/functions/fnc_unloadItem.sqf @@ -16,53 +16,45 @@ */ #include "script_component.hpp" -params ["_item", "_vehicle"]; -private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"]; +params ["_item", "_vehicle", ["_unloader", objNull]]; +TRACE_3("params",_item,_vehicle,_unloader); -if !([_item, _vehicle] call FUNC(canUnloadItem)) exitWith { +private _itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; + +//This covers testing vehicle stability and finding a safe position +private _emptyPosAGL = [_vehicle, _itemClass, _unloader] call EFUNC(common,findUnloadPosition); +TRACE_1("findUnloadPosition",_emptyPosAGL); + +if ((count _emptyPosAGL) != 3) exitWith { + TRACE_4("Could not find unload pos",_vehicle,getPosASL _vehicle,isTouchingGround _vehicle,speed _vehicle); + if ((!isNull _unloader) && {_unloader == ACE_player}) then { + //display text saying there are no safe places to exit the vehicle + ["displayTextStructured", [localize ELSTRING(common,NoRoomToUnload)]] call EFUNC(common,localEvent); + }; false }; -_itemClass = if (_item isEqualType "") then {_item} else {typeOf _item}; +private _loaded = _vehicle getVariable [QGVAR(loaded), []]; -_validVehiclestate = true; -_emptyPos = []; -if (_vehicle isKindOf "Ship" ) then { - if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; - TRACE_1("SHIP Ground Check", getPosATL _vehicle ); - _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, _itemClass]); // TODO: if spot is underwater pick another spot. -} else { - if (_vehicle isKindOf "Air" ) then { - if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false}; - TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); - _emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition); - _emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ]; - } else { - if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false}; - TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); - _emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, _itemClass]); - }; +if !(_item in _loaded) exitWith { + ACE_LOGERROR_3("Tried to unload item [%1] not in vehicle[%2] cargo[%3]", _item, _vehicle, _loaded); + false }; -TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle); -if (!_validVehiclestate) exitWith {false}; - -if (count _emptyPos == 0) exitWith {false}; - -_loaded = _vehicle getVariable [QGVAR(loaded), []]; _loaded deleteAt (_loaded find _item); _vehicle setVariable [QGVAR(loaded), _loaded, true]; -_space = [_vehicle] call FUNC(getCargoSpaceLeft); -_itemSize = [_item] call FUNC(getSizeItem); +private _space = [_vehicle] call FUNC(getCargoSpaceLeft); +private _itemSize = [_item] call FUNC(getSizeItem); _vehicle setVariable [QGVAR(space), (_space + _itemSize), true]; if (_item isEqualType objNull) then { detach _item; - _item setPosASL (_emptyPos call EFUNC(common,PositiontoASL)); + _item setPosASL (AGLtoASL _emptyPosAGL); ["hideObjectGlobal", [_item, false]] call EFUNC(common,serverEvent); } else { - createVehicle [_item, _emptyPos, [], 0, ""]; + private _newItem = createVehicle [_item, _emptyPosAGL, [], 0, ""]; + _newItem setPosASL (AGLtoASL _emptyPosAGL); }; true diff --git a/addons/cargo/functions/fnc_validateCargoSpace.sqf b/addons/cargo/functions/fnc_validateCargoSpace.sqf index d5781067d1..ecb011aed3 100644 --- a/addons/cargo/functions/fnc_validateCargoSpace.sqf +++ b/addons/cargo/functions/fnc_validateCargoSpace.sqf @@ -15,14 +15,13 @@ */ #include "script_component.hpp" -private ["_loaded", "_newLoaded", "_totalSpaceOccupied"]; - params ["_vehicle"]; +TRACE_1("params",_vehicle); -_loaded = _vehicle getVariable [QGVAR(loaded), []]; +private _loaded = _vehicle getVariable [QGVAR(loaded), []]; -_newLoaded = []; -_totalSpaceOccupied = 0; +private _newLoaded = []; +private _totalSpaceOccupied = 0; { if ((_x isEqualType "") || {!isNull _x}) then { _newLoaded pushback _x; diff --git a/addons/cargo/script_component.hpp b/addons/cargo/script_component.hpp index 3f4d6c5d51..55079a16c2 100644 --- a/addons/cargo/script_component.hpp +++ b/addons/cargo/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_CARGO #define DEBUG_MODE_FULL diff --git a/addons/cargo/stringtable.xml b/addons/cargo/stringtable.xml index 65c0ceb433..bfa67edfa3 100644 --- a/addons/cargo/stringtable.xml +++ b/addons/cargo/stringtable.xml @@ -43,7 +43,7 @@ Pozostałe miejsce: %1 Espaço de carga restante: %1 Осталось мест: %1 - Volný prostor: %1 + Zbývající prostor: %1 Espacio de carga restante: %1 @@ -62,6 +62,7 @@ Ativar o módulo de carregamento de carga Включает модуль погрузки и перевозки грузов Habilitar la carga en el módulo de carga + Umožňuje naložit předměty do nákladového prostoru vozidla Cargo Settings @@ -133,5 +134,14 @@ %1<br/>nemůže být vyloženo %1<br/>не может быть выгружен + + Make Object Loadable + + + Sets the synced object as loadable by the cargo system. + + + Object's Size + \ No newline at end of file diff --git a/addons/common/CfgEventHandlers.hpp b/addons/common/CfgEventHandlers.hpp index bea7b6e7bc..55a1df4c7c 100644 --- a/addons/common/CfgEventHandlers.hpp +++ b/addons/common/CfgEventHandlers.hpp @@ -23,9 +23,6 @@ class Extended_InitPost_EventHandlers { class GVAR(setName) { init = QUOTE(if (local (_this select 0)) then {_this call FUNC(setName)};); }; - class GVAR(forceWalk) { - init = QUOTE(_this call FUNC(applyForceWalkStatus)); - }; class GVAR(muteUnit) { init = QUOTE(_this call FUNC(muteUnitHandleInitPost)); }; @@ -43,6 +40,9 @@ class Extended_Respawn_EventHandlers { class GVAR(RESETDefaults) { respawn = QUOTE(_this call FUNC(resetAllDefaults)); }; + class GVAR(statusEffect) { + respawn = QUOTE(_this call FUNC(statusEffect_respawnEH)); + }; }; class CAManBase { class GVAR(muteUnit) { @@ -50,3 +50,12 @@ class Extended_Respawn_EventHandlers { }; }; }; + +class Extended_Local_EventHandlers { + class All { + class GVAR(statusEffect) { + local = QUOTE(_this call FUNC(statusEffect_localEH)); + }; + }; +}; + diff --git a/addons/common/CfgLocationTypes.hpp b/addons/common/CfgLocationTypes.hpp new file mode 100644 index 0000000000..8ff7ba8674 --- /dev/null +++ b/addons/common/CfgLocationTypes.hpp @@ -0,0 +1,16 @@ +//Create a location type that won't be drawn on the map +//Ref: https://community.bistudio.com/wiki/Location + +class CfgLocationTypes { + class ACE_HashLocation { + color[] = {0,0,0,0}; + drawStyle = "bananas"; + font = "PuristaMedium"; + importance = 5; + name = "HashLocation"; + shadow = 0; + size = 0; + textSize = 0.0; + texture = ""; + }; +}; diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 22cf7a944e..65b9804da5 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -1,5 +1,6 @@ // ACE - Common // #define ENABLE_PERFORMANCE_COUNTERS +// #define DEBUG_MODE_FULL #include "script_component.hpp" @@ -57,6 +58,39 @@ // Eventhandlers ////////////////////////////////////////////////// +//Status Effect EHs: +["setStatusEffect", {_this call FUNC(statusEffect_set)}] call FUNC(addEventHandler); +["forceWalk", false, ["ACE_SwitchUnits", "ACE_Attach", "ACE_dragging", "ACE_Explosives", "ACE_Ladder", "ACE_Sandbag", "ACE_refuel", "ACE_rearm", "ACE_dragging"]] call FUNC(statusEffect_addType); +["blockSprint", false, []] call FUNC(statusEffect_addType); +["setCaptive", true, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered), QEGVAR(medical,unconscious)]] call FUNC(statusEffect_addType); +["blockDamage", false, ["fixCollision"]] call FUNC(statusEffect_addType); + +["forceWalk", { + params ["_object", "_set"]; + TRACE_2("forceWalk EH",_object,_set); + _object forceWalk (_set > 0); +}] call FUNC(addEventHandler); +["blockSprint", { //Name reversed from `allowSprint` because we want NOR logic + params ["_object", "_set"]; + TRACE_2("blockSprint EH",_object,_set); + _object allowSprint (_set == 0); +}] call FUNC(addEventHandler); +["setCaptive", { + params ["_object", "_set"]; + TRACE_2("setCaptive EH",_object,_set); + _object setCaptive (_set > 0); +}] call FUNC(addEventHandler); +["blockDamage", { //Name reversed from `allowDamage` because we want NOR logic + params ["_object", "_set"]; + if ((_object isKindOf "CAManBase") && {(["ace_medical"] call FUNC(isModLoaded))}) then { + TRACE_2("blockDamage EH (using medical)",_object,_set); + _object setvariable [QEGVAR(medical,allowDamage), (_set == 0), true]; + } else { + TRACE_2("blockDamage EH (using allowDamage)",_object,_set); + _object allowDamage (_set == 0); + }; +}] call FUNC(addEventHandler); + //Add a fix for BIS's zeus remoteControl module not reseting variables on DC when RC a unit //This variable is used for isPlayer checks if (isServer) then { @@ -431,9 +465,6 @@ if (!isNil QGVAR(PreInit_playerChanged_PFHID)) then { // Eventhandlers for player controlled machines ////////////////////////////////////////////////// -// @todo still needed? -[QGVAR(StateArrested), false, true, QUOTE(ADDON)] call FUNC(defineVariable); - ["displayTextStructured", {_this call FUNC(displayTextStructured)}] call FUNC(addEventhandler); ["displayTextPicture", {_this call FUNC(displayTextPicture)}] call FUNC(addEventhandler); diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 1b7bdc624c..ea5157c2e6 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -10,7 +10,6 @@ PREP(addToInventory); PREP(assignedItemFix); PREP(assignObjectsInList); PREP(ambientBrightness); -PREP(applyForceWalkStatus); PREP(ASLToPosition); PREP(binarizeNumber); PREP(blurScreen); @@ -47,14 +46,15 @@ PREP(execPersistentFnc); PREP(execRemoteFnc); PREP(executePersistent); PREP(filter); +PREP(findUnloadPosition); PREP(fixCollision); PREP(fixFloating); PREP(fixLoweredRifleAnimation); PREP(fixPosition); PREP(getAllDefinedSetVariables); PREP(getAllGear); -PREP(getCaptivityStatus); PREP(getDeathAnim); +PREP(getCaptivityStatus); PREP(getDefaultAnim); PREP(getDefinedVariable); PREP(getDefinedVariableDefault); @@ -154,6 +154,7 @@ PREP(selectWeaponMode); PREP(sendRequest); PREP(serverLog); PREP(setAllGear); +PREP(setApproximateVariablePublic); PREP(setCaptivityStatus); PREP(setDefinedVariable); PREP(setDisableUserInputStatus); @@ -170,6 +171,13 @@ PREP(setVariablePublic); PREP(setVolume); PREP(sortAlphabeticallyBy); PREP(showHud); +PREP(statusEffect_addType); +PREP(statusEffect_get); +PREP(statusEffect_localEH); +PREP(statusEffect_resetVariables); +PREP(statusEffect_respawnEH); +PREP(statusEffect_sendEffects); +PREP(statusEffect_set); PREP(stringCompare); PREP(stringToColoredText); PREP(stringRemoveWhiteSpace); @@ -316,6 +324,8 @@ if (isServer) then { call FUNC(loadSettingsOnServer); }; +GVAR(statusEffect_Names) = []; +GVAR(statusEffect_isGlobal) = []; ////////////////////////////////////////////////// // Set up PlayerChanged eventhandler for pre init diff --git a/addons/common/config.cpp b/addons/common/config.cpp index c38c3fd3e7..f78e19d063 100644 --- a/addons/common/config.cpp +++ b/addons/common/config.cpp @@ -14,6 +14,7 @@ class CfgPatches { #include "CfgEventHandlers.hpp" +#include "CfgLocationTypes.hpp" #include "CfgSounds.hpp" #include "CfgVehicles.hpp" #include "CfgWeapons.hpp" diff --git a/addons/common/functions/fnc__handleSyncedEvent.sqf b/addons/common/functions/fnc__handleSyncedEvent.sqf index 41f7ed429c..f8fe21d760 100644 --- a/addons/common/functions/fnc__handleSyncedEvent.sqf +++ b/addons/common/functions/fnc__handleSyncedEvent.sqf @@ -5,7 +5,7 @@ * Arguments [Client] : * 0: eventName * 1: arguments - * 2: ttl + * 2: ttl * * Return Value: * Boolean of success diff --git a/addons/common/functions/fnc_applyForceWalkStatus.sqf b/addons/common/functions/fnc_applyForceWalkStatus.sqf deleted file mode 100644 index 656e4a6d25..0000000000 --- a/addons/common/functions/fnc_applyForceWalkStatus.sqf +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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" - -params ["_unit"]; - -private _forceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0]; - -_unit forceWalk (_forceWalkNumber > 0); diff --git a/addons/common/functions/fnc_findUnloadPosition.sqf b/addons/common/functions/fnc_findUnloadPosition.sqf new file mode 100644 index 0000000000..f7155fd87b --- /dev/null +++ b/addons/common/functions/fnc_findUnloadPosition.sqf @@ -0,0 +1,117 @@ +/* + * Author: PabstMirror, ViperMaul + * Find a safe place near a vehicle to unload something + * Handles Normal Terrain, In Water or On Buildings (Pier, StaticShip) + * + * Arguments: + * 0: Source Vehicle + * 1: Cargo Classname + * 2: Unloader (player) + * 3: Max Distance (meters) + * 4: Check Vehicle is Stable + * + * Return Value: + * Unload PositionAGL (Can Be [] if no valid pos found) + * + * Example: + * [theCar, "CAManBase", player, 10, true] call ace_common_fnc_findUnloadPosition; + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +//Number of tests run (effects performance in worst case scenarior where nothing is found VERSUES reliably finding a pos): +#define MAX_TESTS 75 + +//Manual collision tests (count and radius): +#define COL_TEST_COUNT 12 + +params ["_vehicle", "_typeOfCargo", ["_theUnloader", objNull], ["_maxDistance", 10], ["_checkVehicleIsStable", true]]; +TRACE_5("params",_vehicle,_typeOfCargo,_theUnloader,_maxDistance,_checkVehicleIsStable); + +scopeName "main"; + +if (_checkVehicleIsStable) then { + if (((vectorMagnitude (velocity _vehicle)) > 1.5) || {(!(_vehicle isKindOf "Ship")) && {(!isTouchingGround _vehicle) && {((getPos _vehicle) select 2) > 1.5}}}) then { + TRACE_4("bad vehicle state",_vehicle,velocity _vehicle,isTouchingGround _vehicle,getPos _vehicle); + [] breakOut "main"; + }; +}; + +private _radiusOfItem = 1; +if (_typeOfCargo isKindOf "CAManBase") then { + _radiusOfItem = 1.1; +} else { + //`sizeOf` is unreliable, and does not work with object types that don't exist on map, so estimate size based on cargo size + if (isNumber (configFile >> "CfgVehicles" >> _typeOfCargo >> QEGVAR(cargo,size))) then { + _radiusOfItem = (((getNumber (configFile >> "CfgVehicles" >> _typeOfCargo >> QEGVAR(cargo,size))) ^ 0.35) max 0.75); + }; +}; + +if (isNull _theUnloader) then {_theUnloader = _vehicle;}; + +//Ideal unload pos is halfway between unloader and vehicle (at the unloader's height) +private _originASL = ((getPosASL _theUnloader) vectorAdd (getPosASL _vehicle)) vectorMultiply 0.5; +_originASL set [2, (getPosASL _theUnloader) select 2]; +private _originAGL = ASLtoAGL _originASL; + +//Do a manual search for empty pos (handles underwater, buildings or piers) +TRACE_2("Checking for unload",_originAGL,_radiusOfItem); +private _rangeToCheck = 0; +while {_rangeToCheck < _maxDistance} do { + private _roundDistance = random _rangeToCheck; + private _roundAngle = random 360; + private _roundAGL = _originAGL vectorAdd [(cos _roundAngle) * _roundDistance, (sin _roundAngle) * _roundDistance, 0]; + + private _roundPointIsValid = false; + if (((AGLtoASL _roundAGL) select 2) > 0) then { + //Shoot a ray down, and make sure we hit something solid like a building or the ground: + private _belowRoundArray = lineIntersectsSurfaces [(AGLtoASL _roundAGL) vectorAdd [0,0,0.5], (AGLtoASL _roundAGL) vectorAdd [0,0,-1]]; + TRACE_4("Testing for solid",_roundDistance,_roundAngle,_roundAGL,_belowRoundArray); + if (!(_belowRoundArray isEqualTo [])) then { + private _aboveBuilding = (_belowRoundArray select 0) select 2; + //Point is above something: Terrain(null) or Building + if ((isNull _aboveBuilding) || {_aboveBuilding isKindOf "Building"}) then { + //Get the real intersection point: + _roundAGL = ASLtoAGL ((_belowRoundArray select 0) select 0); + _roundPointIsValid = true; + }; + }; + } else { + //Underwater, just unload anywhere + TRACE_3("Under the sea",_roundDistance,_roundAngle,_roundAGL); + _roundPointIsValid = true; + }; + + //Make sure point is valid and do a fast check for people in the way (which sometimes aren't caught by line scaning) + if (_roundPointIsValid && {(_roundAGL nearEntities ["Man", _radiusOfItem]) isEqualTo []}) then { + for "_index" from 0 to (COL_TEST_COUNT -1) do { + //Scan for colisions with objects with lineIntersectsSurfaces + private _angle = _index * (360 / COL_TEST_COUNT); + private _point1ASL = (AGLtoASL _roundAGL) vectorAdd [_radiusOfItem * cos _angle, _radiusOfItem * sin _angle, 0.1]; + private _point2ASL = (AGLtoASL _roundAGL) vectorAdd [-_radiusOfItem * cos _angle, -_radiusOfItem * sin _angle, (_radiusOfItem + 0.5)]; + private _testIntersections = lineIntersectsSurfaces [_point1ASL, _point2ASL]; + if (!(_testIntersections isEqualTo [])) exitWith { + TRACE_2("collision low/high",_roundAGL,_testIntersections); + _roundPointIsValid = false; + }; + _point1ASL = (AGLtoASL _roundAGL) vectorAdd [_radiusOfItem * cos _angle, _radiusOfItem * sin _angle, 0.5]; + _point2ASL = (AGLtoASL _roundAGL) vectorAdd [-_radiusOfItem * cos _angle, -_radiusOfItem * sin _angle, 1]; + _testIntersections = lineIntersectsSurfaces [_point1ASL, _point2ASL]; + if (!(_testIntersections isEqualTo [])) exitWith { + TRACE_2("collision mid",_roundAGL,_testIntersections); + _roundPointIsValid = false; + }; + }; + if (_roundPointIsValid) then { + TRACE_3("Valid point found", _rangeToCheck,_roundAGL, (_originAGL distance _roundAGL)); + //Raise it slightly so we don't sink through the floor: + (_roundAGL vectorAdd [0,0,0.05]) breakOut "main"; + }; + }; + _rangeToCheck = _rangeToCheck + (_maxDistance / MAX_TESTS); +}; + +TRACE_1("no valid spots found",_rangeToCheck); +[] //return empty array diff --git a/addons/common/functions/fnc_fixCollision.sqf b/addons/common/functions/fnc_fixCollision.sqf index 1d55eb1454..c0cf7b93e7 100644 --- a/addons/common/functions/fnc_fixCollision.sqf +++ b/addons/common/functions/fnc_fixCollision.sqf @@ -15,8 +15,8 @@ // allowDamage requires local object if (!local _this) exitWith {}; -// prevent collision damage, @todo allowDamage API -_this allowDamage false; +// prevent collision damage +[_this, "blockDamage", "fixCollision", true] call FUNC(statusEffect_set); // re-allow damage after 2 seconds -[{_this allowDamage true}, _this, 2, 0] call EFUNC(common,waitAndExecute); +[{[_this, "blockDamage", "fixCollision", false] call FUNC(statusEffect_set);}, _this, 2] call EFUNC(common,waitAndExecute); diff --git a/addons/common/functions/fnc_fixFloating.sqf b/addons/common/functions/fnc_fixFloating.sqf index 5391402ca4..1d8da1c8a4 100644 --- a/addons/common/functions/fnc_fixFloating.sqf +++ b/addons/common/functions/fnc_fixFloating.sqf @@ -1,6 +1,7 @@ /* * Author: commy2 * Attempt to fix floating physx with disabled damage after setPosXXX commands. + * Handles the "fixFloating" event * * Arguments: * PhysX object @@ -16,6 +17,11 @@ params ["_object"]; // setHitPointDamage requires local object if (!local _object) exitWith {}; +//Ignore mans +if (_object isKindOf "CAManBase") exitWith {}; + +//We need to manually set allowDamage to true for setHitIndex to function +["blockDamage", [_object, 0]] call FUNC(localEvent); // save and restore hitpoints, see below why private _hitPointDamages = getAllHitPointsDamage _object; @@ -31,3 +37,8 @@ _object setDamage damage _object; { _object setHitIndex [_forEachIndex, _x]; } forEach (_hitPointDamages select 2); + +//manually re-enable allowDamage to previous setting (ref statusEffect_funcs) +private _effectVarName = format [QGVAR(effect_%1), "blockDamage"]; +private _effectNumber = _object getVariable [_effectVarName, 0]; +["blockDamage", [_object, _effectNumber]] call FUNC(localEvent); diff --git a/addons/common/functions/fnc_getCaptivityStatus.sqf b/addons/common/functions/fnc_getCaptivityStatus.sqf index e2663a892e..ab4c27956e 100644 --- a/addons/common/functions/fnc_getCaptivityStatus.sqf +++ b/addons/common/functions/fnc_getCaptivityStatus.sqf @@ -14,15 +14,7 @@ params ["_unit"]; -private _captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []]; -private _unitCaptivityStatus = [captiveNum _unit, count _captivityReasons] call FUNC(binarizeNumber); +//Now just a wrapper for FUNC(statusEffect_get) [No longer used in ace as of 3.5] +ACE_DEPRECATED("ace_common_fnc_getCaptivityStatus","3.7.0","ace_common_fnc_statusEffect_get"); -private _unitCaptivityReasons = []; - -{ - if (_unitCaptivityStatus select _forEachIndex) then { - _unitCaptivityReasons pushBack _x; - }; -} forEach _captivityReasons; - -_unitCaptivityReasons +([_unit, "setCaptive"] call FUNC(statusEffect_get)) select 1 diff --git a/addons/common/functions/fnc_getForceWalkStatus.sqf b/addons/common/functions/fnc_getForceWalkStatus.sqf index 16eca5ccc7..89042b19dd 100644 --- a/addons/common/functions/fnc_getForceWalkStatus.sqf +++ b/addons/common/functions/fnc_getForceWalkStatus.sqf @@ -17,16 +17,7 @@ params ["_unit"]; -private _forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []]; -private _unitForceWalkNumber = _unit getVariable ["ACE_forceWalkStatusNumber", 0]; -private _unitForceWalkStatus = [_unitForceWalkNumber, count _forceWalkReasons] call FUNC(binarizeNumber); +//Now just a wrapper for FUNC(statusEffect_get) [No longer used in ace as of 3.5] +ACE_DEPRECATED("ace_common_fnc_getForceWalkStatus","3.7.0","ace_common_fnc_statusEffect_get"); -private _unitForceWalkReasons = []; - -{ - if (_unitForceWalkStatus select _forEachIndex) then { - _unitForceWalkReasons pushBack _x; - }; -} forEach _forceWalkReasons; - -_unitForceWalkReasons +([_unit, "forceWalk"] call FUNC(statusEffect_get)) select 1 diff --git a/addons/common/functions/fnc_getTargetDistance.sqf b/addons/common/functions/fnc_getTargetDistance.sqf index 4bd050a2c5..000f0ae31d 100644 --- a/addons/common/functions/fnc_getTargetDistance.sqf +++ b/addons/common/functions/fnc_getTargetDistance.sqf @@ -1,11 +1,11 @@ /* - * Author: commy2 + * Author: VKing * Get the distance to the next object the player is looking at. Used for laser distance measurements. * * Arguments: - * 0: Messurement Accuracy - * 1: Maximal messure distance - * 2: Minimal messure distance (default: nil) + * 0: Measurement Accuracy (default: 1) + * 1: Maximum measure distance (default: 5000) + * 2: Minimum measure distance (default: 0) * * Return Value: * Distance in meters @@ -14,33 +14,23 @@ */ #include "script_component.hpp" -params ["_interval", "_maxDistance", "_minDistance"]; +params [["_accuracy",1], ["_maxDistance",5000], ["_minDistance",0]]; -private _position = ATLToASL positionCameraToWorld [0, 0, 0]; -_position set [2, (_position select 2) - (getTerrainHeightASL _position min 0)]; +private _camPosition = AGLToASL positionCameraToWorld [0, 0, 0]; +private _aimLinePos = AGLToASL positionCameraToWorld [0, 0, _maxDistance]; -private _laser = + _position; -private _line = [_position, _laser]; +private _LIS = lineIntersectsSurfaces [_camPosition, _aimLinePos]; -private _distance = _maxDistance; -private _iteration = _distance; - -while { - _iteration > _interval / 2 -} do { - _iteration = _iteration / 2; - - _laser = ATLToASL positionCameraToWorld [0, 0, _distance]; - _laser set [2, (_laser select 2) - (getTerrainHeightASL _laser min 0)]; - _line set [1, _laser]; - - _distance = _distance + (([1, -1] select (lineIntersects (_line + [vehicle ACE_player]) || {terrainIntersectASL _line})) * _iteration); +private _distance = 0; +if (count _LIS > 0) then { + _distance = _camPosition vectorDistance ((_LIS select 0) select 0); +} else { + _distance = _maxDistance; }; -_distance = _interval * round (_distance / _interval); +_distance = _distance max _minDistance; -_distance = _distance min _maxDistance; - -if (!isNil "_minDistance") then {_distance = _distance max _minDistance}; +_accuracy = _accuracy max 1; +_distance = (round (_distance/_accuracy)) * _accuracy; _distance diff --git a/addons/common/functions/fnc_resetAllDefaults.sqf b/addons/common/functions/fnc_resetAllDefaults.sqf index d9850ffd5b..6432f3759e 100644 --- a/addons/common/functions/fnc_resetAllDefaults.sqf +++ b/addons/common/functions/fnc_resetAllDefaults.sqf @@ -19,11 +19,6 @@ _unit setVariable ["ACE_isUnconscious", nil, true]; if (isPlayer _unit) then { [true] call FUNC(setVolume); - // [false] call FUNC(disableKeyInput); //func does not exist - - if (["ace_medical"] call FUNC(isModLoaded)) then { - // [false] call EFUNC(medical,effectBlackOut); //func does not exist - }; if !(isNil QGVAR(DISABLE_USER_INPUT_COLLECTION)) then { // clear all disable user input @@ -40,5 +35,3 @@ if (isPlayer _unit) then { }; false } count ([_unit] call FUNC(getAllDefinedSetVariables)); - -_unit setVariable ["ACE_forceWalkStatusNumber", 0, true]; diff --git a/addons/common/functions/fnc_setAllGear.sqf b/addons/common/functions/fnc_setAllGear.sqf index 2b5a2a9cc7..152eb4fd60 100644 --- a/addons/common/functions/fnc_setAllGear.sqf +++ b/addons/common/functions/fnc_setAllGear.sqf @@ -1,6 +1,6 @@ /* * Author: bux578, commy2 - * Applies gear to unit. + * Applies gear to unit. It must be called in the machine in which the unit is local. * * Arguments: * 0: Unit @@ -20,6 +20,10 @@ params ["_unit", "_allGear", ["_clearAttachments", false], ["_clearBackpack", false]]; +if (!local _unit) exitWith { + ACE_LOGWARNING_1("setAllGear - %1 has to be local.",_unit); +}; + // remove all starting gear of a player removeAllWeapons _unit; removeGoggles _unit; diff --git a/addons/common/functions/fnc_setApproximateVariablePublic.sqf b/addons/common/functions/fnc_setApproximateVariablePublic.sqf new file mode 100644 index 0000000000..5131f99058 --- /dev/null +++ b/addons/common/functions/fnc_setApproximateVariablePublic.sqf @@ -0,0 +1,42 @@ +/* + * Author: esteldunedain + * Publish a variable if it's different enough from the previously published value. + * + * Argument: + * 0: Object the variable should be assigned to + * 1: Name of the variable + * 2: Value of the variable + * 3: Absolute tolerance + * + * Return value: + * Nothing. + * + * Example: + * [player, "balls", 2, 0.1] call ace_common_fnc_setApproximateVariablePublic; + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params ["_object", "_varName", "_value", "_tolerance"]; +TRACE_4("params",_object,_varName,_value,_tolerance); + +// Set exact new value locally +_object setVariable [_varName, _value]; + +// Exit if in SP - "duh" +if (!isMultiplayer) exitWith {}; + +// If new value is not different +private _oldVarName = format ["ACE_oldValue_%1", _varName]; +private _oldValue = _object getVariable [_oldVarName, -100000]; + +// Exit if new value is not different enough from the old onedifferent +if (abs(_value - _oldValue) < _tolerance) exitWith {}; + +// Publish the new value: +_object setVariable [_varName, _value, true]; +_object setVariable [_oldVarName, _value]; + +TRACE_2("Published variable:", _varName, _value); diff --git a/addons/common/functions/fnc_setCaptivityStatus.sqf b/addons/common/functions/fnc_setCaptivityStatus.sqf index 3e84c1753d..062c126f81 100644 --- a/addons/common/functions/fnc_setCaptivityStatus.sqf +++ b/addons/common/functions/fnc_setCaptivityStatus.sqf @@ -16,28 +16,7 @@ params ["_unit", "_reason", "_status"]; -private _captivityReasons = missionNamespace getVariable ["ACE_captivityReasons", []]; +//Now just a wrapper for FUNC(statusEffect_set) [No longer used in ace as of 3.5] +ACE_DEPRECATED("ace_common_fnc_setCaptivityStatus","3.7.0","ace_common_fnc_statusEffect_set"); -// register new reason (these reasons are shared publicly, since units can change ownership, but keep their captivity status) -if !(_reason in _captivityReasons) then { - _captivityReasons pushBack _reason; - - ACE_captivityReasons = _captivityReasons; - publicVariable "ACE_captivityReasons"; -}; - -// get reasons why the unit is captive already and update to the new status -private _unitCaptivityReasons = _unit call FUNC(getCaptivityStatus); - -private _captivityReasonsBooleans = []; - -{ - _captivityReasonsBooleans set [_forEachIndex, (_captivityReasons select _forEachIndex) in _unitCaptivityReasons]; -} forEach _captivityReasons; - -_captivityReasonsBooleans set [_captivityReasons find _reason, _status]; - -private _bitmask = _captivityReasonsBooleans call FUNC(toBitmask); - -// actually apply the setCaptive command globaly -[[_unit, _bitmask], "{(_this select 0) setCaptive (_this select 1)}", _unit] call FUNC(execRemoteFnc); +[_unit, "setCaptive", _reason, _status] call FUNC(statusEffect_set); diff --git a/addons/common/functions/fnc_setForceWalkStatus.sqf b/addons/common/functions/fnc_setForceWalkStatus.sqf index 3842457395..800040d978 100644 --- a/addons/common/functions/fnc_setForceWalkStatus.sqf +++ b/addons/common/functions/fnc_setForceWalkStatus.sqf @@ -20,29 +20,7 @@ params ["_unit", "_reason", "_status"]; -private _forceWalkReasons = missionNamespace getVariable ["ACE_forceWalkReasons", []]; +//Now just a wrapper for FUNC(statusEffect_set) [No longer used in ace as of 3.5] +ACE_DEPRECATED("ace_common_fnc_setForceWalkStatus","3.7.0","ace_common_fnc_statusEffect_set"); -// register new reason (these reasons are shared publicly, since units can change ownership, but keep their forceWalk status) -if !(_reason in _forceWalkReasons) then { - _forceWalkReasons pushBack _reason; - ACE_forceWalkReasons = _forceWalkReasons; - publicVariable "ACE_forceWalkReasons"; -}; - -// get reasons why the unit is forceWalking already and update to the new status -private _unitForceWalkReasons = [_unit] call FUNC(getForceWalkStatus); - -private _forceWalkReasonsBooleans = []; - -{ - _forceWalkReasonsBooleans set [_forEachIndex, (_forceWalkReasons select _forEachIndex) in _unitForceWalkReasons]; -} forEach _forceWalkReasons; - -_forceWalkReasonsBooleans set [_forceWalkReasons find _reason, _status]; - -private _bitmaskNumber = _forceWalkReasonsBooleans call FUNC(toBitmask); - -_unit setVariable ["ACE_forceWalkStatusNumber", _bitmaskNumber, true]; - -// actually apply the forceWalk command globaly -[[_unit], QFUNC(applyForceWalkStatus), 2] call FUNC(execRemoteFnc); +[_unit, "forceWalk", _reason, _status] call FUNC(statusEffect_set); diff --git a/addons/common/functions/fnc_setVariablePublic.sqf b/addons/common/functions/fnc_setVariablePublic.sqf index 31d1d23014..bf6b35a862 100644 --- a/addons/common/functions/fnc_setVariablePublic.sqf +++ b/addons/common/functions/fnc_setVariablePublic.sqf @@ -1,54 +1,53 @@ /* - * Author: commy2 and joko // Jonas - * Sets a public variable, but wait a certain amount of time to transfer the value over the network. Changing the value by calling this function again resets the windup timer. + * Author: commy2 and CAA-Picard and joko and PabstMirror + * Publish a variable, but wait a certain amount of time before allowing it to be published it again. * - * Arguments: + * Argument: * 0: Object the variable should be assigned to * 1: Name of the variable * 2: Value of the variable - * 3: Windup time (default: 1) + * 3: Embargo delay (Optional. Default: 1) * - * Return Value: - * None + * Return value: + * Nothing. + * + * Example: + * [player, "balls", 2, 1] call ace_common_fnc_setVariablePublic; * * Public: No */ +// #define DEBUG_MODE_FULL #include "script_component.hpp" -params ["_object", "_varName", "_value", ["_sync", 1]]; +params ["_object", "_varName", "_value", ["_delay", 1]]; +TRACE_4("params",_object,_varName,_value,_delay); // set value locally _object setVariable [_varName, _value]; -// Exit if in SP +// Exit if in SP - "duh" if (!isMultiplayer) exitWith {}; -private _idName = format ["ACE_setVariablePublic_%1", _varName]; +// If we are on embargo, exit +if (_object isEqualTo (_object getVariable [format ["ACE_onEmbargo_%1", _varName], objNull])) exitWith {}; -if (_idName in GVAR(setVariableNames)) exitWith {}; +// Publish Now and set last update time: +_object setVariable [_varName, _value, true]; +_object setVariable [format ["ACE_onEmbargo_%1", _varName], _object]; -private _syncTime = ACE_diagTime + _sync; +TRACE_2("Starting Embargo", _varName, _delay); -GVAR(setVariableNames) pushBack _idName; +[{ + params ["_object", "_varName", "_value"]; + if (isNull _object) exitWith {TRACE_1("objNull",_this);}; -GVAR(setVariablePublicArray) pushBack [_object, _varName, _syncTime, _idName]; + _object setVariable [format ["ACE_onEmbargo_%1", _varName], nil]; //Remove Embargo + private _curValue = _object getVariable _varName; -if (isNil QGVAR(setVariablePublicPFH)) exitWith {}; + TRACE_4("End of embargo", _object, _varName, _value, _curValue); -GVAR(setVariablePublicPFH) = [{ - { - _x params ["_object", "_varName", "_syncTime", "_idName"]; - if (ACE_diagTime > _syncTime) then { - // set value public - _object setVariable [_varName, _object getVariable _varName, true]; - GVAR(setVariablePublicArray) deleteAt (GVAR(setVariablePublicArray) find _x); - GVAR(setVariableNames) deleteAt (GVAR(setVariableNames) find _x); - }; - nil - } count +GVAR(setVariablePublicArray); - - if (GVAR(setVariablePublicArray) isEqualTo []) then { - [GVAR(setVariablePublicPFH)] call CBA_fnc_removePerFrameHandler; - GVAR(setVariablePublicPFH) = nil; + //If value at start of embargo doesn't equal current, then broadcast and start new embargo + if (!(_value isEqualTo _curValue)) then { + _this call FUNC(setVariablePublic); }; -}, 0, []] call CBA_fnc_addPerFrameHandler; +}, _this, _delay] call FUNC(waitAndExecute); diff --git a/addons/common/functions/fnc_statusEffect_addType.sqf b/addons/common/functions/fnc_statusEffect_addType.sqf new file mode 100644 index 0000000000..afd7ff7be7 --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_addType.sqf @@ -0,0 +1,37 @@ +/* + * Author: PabstMirror + * Adds a status effect that will be handled. + * + * Arguments: + * 0: Status Effect Name, this should match a corisponding event name + * 1: Send event globaly + * 2: Common Effect Reaons to pre-seed durring init + * + * Return Value: + * Nothing + * + * Example: + * ["setCaptive", true, []] call ace_common_fnc_statusEffect_addType + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params [["_name", "", [""]], ["_isGlobal", false, [false]], ["_commonReasonsArray", [], [[]]]]; +TRACE_3("params",_name,_isGlobal,_commonReasonsArray); + +if (_name == "") exitWith {ACE_LOGERROR_1("addStatusEffect - Bad Name %1", _this)}; +if (_name in GVAR(statusEffect_Names)) exitWith {ACE_LOGWARNING_1("addStatusEffect - Effect Already Added (note, will not update global bit) %1", _this)}; + +GVAR(statusEffect_Names) pushBack _name; +GVAR(statusEffect_isGlobal) pushBack _isGlobal; + +//We add reasons at any time, but more efficenet to add all common ones at one time during init +if (isServer && {!(_commonReasonsArray isEqualTo [])}) then { + //Switch case to lower: + { + _commonReasonsArray set [_forEachIndex, toLower _x]; + } forEach _commonReasonsArray; + missionNamespace setVariable [(format [QGVAR(statusEffects_%1), _name]), _commonReasonsArray, true]; +}; diff --git a/addons/common/functions/fnc_statusEffect_get.sqf b/addons/common/functions/fnc_statusEffect_get.sqf new file mode 100644 index 0000000000..2d7e17e0ec --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_get.sqf @@ -0,0 +1,63 @@ +/* + * Author: PabstMirror + * Retrives list of current status effects + * + * Arguments: + * 0: vehicle that it will be attached to (player or vehicle) + * 1: Effect Name + * + * Return Value: + * Effect status + * 0: is activly set (if false, the effect is ignored and never modified) + * 1: reasons why it is set true (list of strings, count of 0 = false, 1+ = true) + * + * Example: + * [player, "forceWalk"] call ace_common_fnc_statusEffect_get + * + * Public: Yes + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params [["_object", objNull, [objNull]], ["_effectName", "", [""]]]; +TRACE_2("params",_object,_effectName); + +if (isNull _object) exitWith { + TRACE_1("null",_object); + [false, []] +}; + +[_object, false] call FUNC(statusEffect_resetVariables); //Check for mismatch + +//List of reasons +private _statusReasons = missionNamespace getVariable [(format [QGVAR(statusEffects_%1), _effectName]), []]; +if (_statusReasons isEqualTo []) exitWith { + TRACE_1("no reasons - bad effect?",_statusReasons); + [false, []] +}; + +//Get Effect Number +private _effectVarName = format [QGVAR(effect_%1), _effectName]; +private _effectNumber = _object getVariable [_effectVarName, -1]; +TRACE_2("current",_effectVarName,_effectNumber); + +if (_effectNumber == -1) exitWith { //Nil array - no effect + [false, []] +}; +if (_effectNumber == 0) exitWith { //empty array - false effect + [true, []] +}; + +//if no change: skip sending publicVar and events +private _effectBoolArray = [_effectNumber, count _statusReasons] call FUNC(binarizeNumber); +TRACE_2("bitArray",_statusIndex,_effectBoolArray); + +private _activeEffects = []; +{ + if (_x) then { + _activeEffects pushBack (_statusReasons select _forEachIndex); + }; +} forEach _effectBoolArray; + +//non-empty array - true effect +[true, _activeEffects] diff --git a/addons/common/functions/fnc_statusEffect_localEH.sqf b/addons/common/functions/fnc_statusEffect_localEH.sqf new file mode 100644 index 0000000000..5490029a3b --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_localEH.sqf @@ -0,0 +1,36 @@ +/* + * Author: PabstMirror + * Handles locality switch, runs a respawn check and then reapplies all effect events. + * + * Arguments: + * 0: vehicle that it will be attached to (player or vehicle) + * + * Return Value: + * Nothing + * + * Example: + * [player, true] call ace_common_fnc_statusEffect_localEH + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params ["_object", "_isLocal"]; +TRACE_2("params",_object,_isLocal); + +//Only run this after the settings are initialized +//Need to wait for all EH to be installed (local event will happen between pre and post init) +if !(GVAR(settingsInitFinished)) exitWith { + TRACE_1("pushing to runAtSettingsInitialized", _this); + GVAR(runAtSettingsInitialized) pushBack [FUNC(statusEffect_localEH), _this]; +}; + +if (!_isLocal) exitWith {TRACE_1("object no longer local", _this)}; +if (isNull _object) exitWith {TRACE_1("object null", _this)}; + + //Reset any variables because of respawn +[_object, false] call FUNC(statusEffect_resetVariables); + +//Send all Variables to client +[_object, ""] call FUNC(statusEffect_sendEffects); diff --git a/addons/common/functions/fnc_statusEffect_resetVariables.sqf b/addons/common/functions/fnc_statusEffect_resetVariables.sqf new file mode 100644 index 0000000000..2a307c84e5 --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_resetVariables.sqf @@ -0,0 +1,45 @@ +/* + * Author: PabstMirror + * Resets all effect numbers to 0 when an object respawns (but does not apply the effect event). + * + * Arguments: + * 0: vehicle that it will be attached to (player or vehicle) + * + * Return Value: + * Nothing + * + * Example: + * [player, true] call ace_common_fnc_statusEffect_resetVariables + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params [["_object", objNull, [objNull]], ["_setObjectRef", false, [false]]]; +TRACE_2("params",_object,_setObjectRef); + +if (isNull _object) exitWith {}; + +private _objectRef = _object getVariable QGVAR(statusEffect_object); +TRACE_2("testing",_object,_objectRef); + +// If nothing was ever set, or objects match, exit (always true unless respawned) +if (isNil "_objectRef") exitWith { + if (_setObjectRef) then { + _object setVariable [QGVAR(statusEffect_object), _object, true]; //explicitly set new object ref + }; +}; +if (_object == _objectRef) exitWith {}; + +//Mismatch, so if effect has ever been defined, reset to 0 +{ + private _effectVarName = format [QGVAR(effect_%1), _x]; + private _effectNumber = _object getVariable [_effectVarName, -1]; + if (_effectNumber != -1) then { + TRACE_2("forced reset defined array on object mismatch",_x,_effectNumber); + _object setVariable [_effectVarName, 0, true]; //This always resets to 0 (not -1/nil)! + }; +} forEach GVAR(statusEffect_Names); + +_object setVariable [QGVAR(statusEffect_object), _object, true]; diff --git a/addons/common/functions/fnc_statusEffect_respawnEH.sqf b/addons/common/functions/fnc_statusEffect_respawnEH.sqf new file mode 100644 index 0000000000..92717b68c7 --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_respawnEH.sqf @@ -0,0 +1,36 @@ +/* + * Author: PabstMirror + * Handles the Respawn Event Handler to reset effects. + * + * Arguments: + * 0: vehicle that it will be attached to (player or vehicle) + * + * Return Value: + * Nothing + * + * Example: + * [player, objNull] call ace_common_fnc_statusEffect_respawnEH + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params ["_object"]; +TRACE_1("params",_object); + +//Only run this after the settings are initialized +//Need to wait for all EH to be installed (local event will happen between pre and post init) +if !(GVAR(settingsInitFinished)) exitWith { + TRACE_1("pushing to runAtSettingsInitialized", _this); + GVAR(runAtSettingsInitialized) pushBack [FUNC(statusEffect_respawnEH), _this]; +}; + +if (!local _object) exitWith {TRACE_1("object no longer local", _this)}; +if (isNull _object) exitWith {TRACE_1("object null", _this)}; + + //Reset any variables on "real" respawn +[_object, false] call FUNC(statusEffect_resetVariables); + +//Send all Variables to client +[_object, ""] call FUNC(statusEffect_sendEffects); diff --git a/addons/common/functions/fnc_statusEffect_sendEffects.sqf b/addons/common/functions/fnc_statusEffect_sendEffects.sqf new file mode 100644 index 0000000000..4291de1ad8 --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_sendEffects.sqf @@ -0,0 +1,48 @@ +/* + * Author: PabstMirror + * Sends all status effects for an object (can be run on non-local objects) + * + * Arguments: + * 0: Object + * 1: Effect name (or "" or send all) + * + * Return Value: + * Nothing + * + * Example: + * [player, ""] call ace_common_fnc_statusEffect_sendEffects + * + * Public: No + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params [["_object", objNull, [objNull]], ["_effectName", "", [""]]]; +TRACE_2("params",_object,_effectName); + +if (isNull _object) exitWith {}; + +{ + if ((_effectName == "") || {_effectName == _x}) then { + private _effectVarName = format [QGVAR(effect_%1), _x]; + private _effectNumber = _object getVariable [_effectVarName, -1]; + + //We only do anything if the effect has been defined at some point in the game for this unit + TRACE_2("checking if event is nil",_x,_effectNumber); + if (_effectNumber != -1) then { + if (GVAR(statusEffect_isGlobal) select _forEachIndex) then { + TRACE_2("Sending Global Event", _object, _effectNumber); + [_x, [_object, _effectNumber]] call FUNC(globalEvent); + } else { + if (local _object) then { + //If local, send directly to bypass network delay of targetEvent call + TRACE_2("Sending Target Local Event", _object, _effectNumber); + [_x, [_object, _effectNumber]] call FUNC(localEvent); + } else { + TRACE_2("Sending Target Non-Local Event", _object, _effectNumber); + [_x, [_object], [_object, _effectNumber]] call FUNC(targetEvent); + }; + }; + }; + }; +} forEach GVAR(statusEffect_Names); diff --git a/addons/common/functions/fnc_statusEffect_set.sqf b/addons/common/functions/fnc_statusEffect_set.sqf new file mode 100644 index 0000000000..a0be8d8719 --- /dev/null +++ b/addons/common/functions/fnc_statusEffect_set.sqf @@ -0,0 +1,70 @@ +/* + * Author: PabstMirror + * Adds or removes an id to a status effect and will send an event to apply. + * + * Arguments: + * 0: vehicle that it will be attached to (player or vehicle) + * 1: Effect Name + * 2: Unique Reason ID + * 3: Is Set (true adds/false removes) + * + * Return Value: + * Nothing + * + * Example: + * [player, "setCaptive", "reason1", true] call ace_common_fnc_statusEffect_set + * + * Public: Yes + */ +// #define DEBUG_MODE_FULL +#include "script_component.hpp" + +params [["_object", objNull, [objNull]], ["_effectName", "", [""]], ["_ID", "", [""]], ["_set", true, [false]]]; +TRACE_4("params",_object,_effectName,_ID,_set); + +//Only run this after the settings are initialized +if !(GVAR(settingsInitFinished)) exitWith { + TRACE_1("pushing to runAtSettingsInitialized", _this); + GVAR(runAtSettingsInitialized) pushBack [FUNC(statusEffect_set), _this]; +}; + +if (isNull _object) exitWith {TRACE_1("null",_object);}; + +[_object, true] call FUNC(statusEffect_resetVariables); //Check for mismatch, and set object ref + +//check ID case and set globaly if not already set: +_ID = toLower _ID; +private _statusReasons = missionNamespace getVariable [(format [QGVAR(statusEffects_%1), _effectName]), []]; +private _statusIndex = _statusReasons find _ID; +if (_statusIndex == -1) then { + TRACE_2("ID not in global reasons, adding",_statusReasons,_ID); + _statusIndex = _statusReasons pushBack _ID; + missionNamespace setVariable [(format [QGVAR(statusEffects_%1), _effectName]), _statusReasons, true]; +}; + +private _effectVarName = format [QGVAR(effect_%1), _effectName]; +private _effectNumber = _object getVariable [_effectVarName, -1]; +TRACE_2("current",_effectVarName,_effectNumber); + +if ((_effectNumber == -1) && {!_set}) exitWith { + //Optimization for modules that always set an ID to false even if never set true + TRACE_2("Set False on nil array, exiting",_set,_effectNumber); +}; + +if (_effectNumber == -1) then {_effectNumber = 0}; //reset (-1/nil) to 0 + +//if no change: skip sending publicVar and events +private _effectBoolArray = [_effectNumber, count _statusReasons] call FUNC(binarizeNumber); +TRACE_2("bitArray",_statusIndex,_effectBoolArray); +if (_set isEqualTo (_effectBoolArray select _statusIndex)) exitWith { + TRACE_2("No Change, exiting",_set,_effectBoolArray select _statusIndex); +}; + +TRACE_2("Setting to new value",_set,_effectBoolArray select _statusIndex); +_effectBoolArray set [_statusIndex, _set]; +_effectNumber = _effectBoolArray call FUNC(toBitmask); //Convert array back to number + +TRACE_2("Saving globaly",_effectVarName,_effectNumber); +_object setVariable [_effectVarName, _effectNumber, true]; + +[_object, _effectName] call FUNC(statusEffect_sendEffects); diff --git a/addons/common/functions/fnc_unloadPerson.sqf b/addons/common/functions/fnc_unloadPerson.sqf index 0c1b53bc61..72816f2c3f 100644 --- a/addons/common/functions/fnc_unloadPerson.sqf +++ b/addons/common/functions/fnc_unloadPerson.sqf @@ -8,6 +8,9 @@ * Return Value: * Returns true if succesfully unloaded person * + * Example: + * [hurtGuy] call ace_common_fnc_unloadPerson + * * Public: No */ #include "script_component.hpp" @@ -20,14 +23,10 @@ private _vehicle = vehicle _unit; if (_vehicle == _unit) exitWith {false}; -if (speed _vehicle > 1 || getPos _vehicle select 2 > 2) exitWith {false}; - -private _emptyPos = (getPos _vehicle) findEmptyPosition [0, 10, typeOf _unit]; // @todo to small? - -if (count _emptyPos == 0) exitWith {false}; +if (speed _vehicle > 1 || {((getPos _vehicle) select 2) > 2}) exitWith {false}; if (!isNull _vehicle) then { - [[_unit], QUOTE(FUNC(unloadPersonLocal)), _unit, false] call FUNC(execRemoteFnc); + ["unloadPersonEvent", [_unit], [_unit, _vehicle]] call EFUNC(common,targetEvent); }; true diff --git a/addons/common/functions/fnc_unloadPersonLocal.sqf b/addons/common/functions/fnc_unloadPersonLocal.sqf index 5e8300c139..ff5813434a 100644 --- a/addons/common/functions/fnc_unloadPersonLocal.sqf +++ b/addons/common/functions/fnc_unloadPersonLocal.sqf @@ -3,7 +3,9 @@ * Unload a person from a vehicle, local * * Arguments: - * 0: unit + * 0: unit to unload + * 1: Vehicle + * 2: Unloader (player) * * Return Value: * Returns true if succesfully unloaded person @@ -14,53 +16,22 @@ #define GROUP_SWITCH_ID QUOTE(FUNC(loadPerson)) -params ["_unit", "_vehicle"]; -TRACE_2("params",_unit,_vehicle); +params ["_unit", "_vehicle", ["_unloader", objNull]]; +TRACE_3("params",_unit,_vehicle,_unloader); -private _validVehiclestate = true; -private _emptyPos = []; +//This covers testing vehicle stability and finding a safe position +private _emptyPos = [_vehicle, (typeOf _unit), _unloader] call EFUNC(common,findUnloadPosition); +TRACE_1("findUnloadPosition",_emptyPos); -if (_vehicle isKindOf "Ship") then { - if (speed _vehicle > 1 || {getPos _vehicle select 2 > 2}) then { - _validVehiclestate = false; +if (count _emptyPos != 3) exitwith { + ACE_LOGWARNING_4("Could not find unload pos %1-ASL: %2 isTouchingGround: %3 Speed: %4",_vehicle, getPosASL _vehicle, isTouchingGround _vehicle, speed _vehicle); + if ((!isNull _unloader) && {[_unloader] call FUNC(isPlayer)}) then { + //display text saying there are no safe places to exit the vehicle + ["displayTextStructured", [_unloader], [localize LSTRING(NoRoomToUnload)]] call FUNC(targetEvent); }; - - TRACE_1("SHIP Ground Check",getPos _vehicle); - - _emptyPos = (ASLToAGL getPosASL _vehicle) findEmptyPosition [0, 13, typeOf _unit]; // TODO: if spot is underwater pick another spot. -} else { - if (_vehicle isKindOf "Air") then { - if (speed _vehicle > 1 || {!isTouchingGround _vehicle}) then { - _validVehiclestate = false; - }; - - TRACE_1("Vehicle Ground Check",isTouchingGround _vehicle); - - _emptyPos = ASLToAGL getPosASL _vehicle; - _emptyPos = _emptyPos vectorAdd [random 10 - 5, random 10 - 5, 0]; - } else { - if (speed _vehicle > 1 || {getPos _vehicle select 2 > 2}) then { - _validVehiclestate = false; - }; - - TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle); - - _emptyPos = (ASLToAGL getPosASL _vehicle) findEmptyPosition [0, 13, typeOf _unit]; - }; -}; - -TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle); - -if !(_validVehiclestate) exitWith { - ACE_LOGWARNING_4("Unable to unload patient because invalid (%1) vehicle state. Either moving or Not close enough on the ground. position: %2 isTouchingGround: %3 Speed: %4",_vehicle,getPos _vehicle,isTouchingGround _vehicle,speed _vehicle); false }; -if (count _emptyPos == 0) exitWith { - ACE_LOGWARNING_1("No safe empty spots to unload patient. %1",_emptyPos); - false -}; //consider displaying text saying there are no safe places to exit the vehicle - unassignVehicle _unit; [_unit] orderGetIn false; @@ -87,16 +58,16 @@ _unit action ["Eject", vehicle _unit]; if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then { [_unit, _anim, 2, true] call FUNC(doAnimation); }; - }, [_unit, _anim], 0.5, 0] call FUNC(waitAndExecute); + }, [_unit, _anim], 0.5] call FUNC(waitAndExecute); }; }; -}, [_unit, _emptyPos], 0.5, 0] call FUNC(waitAndExecute); +}, [_unit, _emptyPos], 0.5] call FUNC(waitAndExecute); [_unit, false, GROUP_SWITCH_ID, side group _unit] call FUNC(switchToGroupSide); -private _loaded = _vehicle getVariable [QGVAR(loaded_persons),[]]; +private _loaded = _vehicle getvariable [QGVAR(loaded_persons),[]]; _loaded deleteAt (_loaded find _unit); -_vehicle setVariable [QGVAR(loaded_persons), _loaded, true]; +_vehicle setvariable [QGVAR(loaded_persons), _loaded, true]; true diff --git a/addons/common/script_component.hpp b/addons/common/script_component.hpp index 7c266c169d..aa023e7c9f 100644 --- a/addons/common/script_component.hpp +++ b/addons/common/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_COMMON #define DEBUG_MODE_FULL diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index 111300e87c..17f9e6a918 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -418,7 +418,7 @@ Цвет фона всплывающих подсказок АСЕ. Kolor tła dla powiadomień ACE Notification ACE: couleur de l'arrière plan - Barva pozadí ACE nápověd. + Barva pozadí ACE nápovědy. Az ACE-súgók hátterének színe. A cor de fundo das hints do ACE. @@ -430,7 +430,7 @@ Цвет шрифта всплывающих подсказок Kolor tekstu powiadomień Notification: couleur du texte - Barva fontu nápověd. + Barva fontu nápovědy. Súgószöveg betűinek színe Cor do do texto da hint @@ -475,7 +475,7 @@ Sprawdzaj PBO Comprobar PBOs Überprüfe PBOs - Zkontrolovat PBO + Zkontrolovat soubory PBO Verificar PBOs Vérifier les PBOs PBO-k ellenőrzése @@ -658,7 +658,7 @@ Enabled - Zapnuto + Povoleno Oui Aktiviert Attivato @@ -762,5 +762,8 @@ ACE3 Vozidla ACE3 Vehículos + + No Room to unload + - + \ No newline at end of file diff --git a/addons/concertina_wire/script_component.hpp b/addons/concertina_wire/script_component.hpp index 3512643b81..cdde4d05be 100644 --- a/addons/concertina_wire/script_component.hpp +++ b/addons/concertina_wire/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_CONCERTINA_WIRE #define DEBUG_MODE_FULL diff --git a/addons/concertina_wire/stringtable.xml b/addons/concertina_wire/stringtable.xml index 26216b7c0e..9c171b4d02 100644 --- a/addons/concertina_wire/stringtable.xml +++ b/addons/concertina_wire/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -20,7 +20,7 @@ Zwój koncentriny Bobina de alambre de espino Bobine de fil barbelé - Smyčka ostnatého drátu + Svitek ostnatého drátu Concertina wire coil Concertina wire coil Bobina de arame farpado diff --git a/addons/dagr/script_component.hpp b/addons/dagr/script_component.hpp index f7a723e533..792ef7f119 100644 --- a/addons/dagr/script_component.hpp +++ b/addons/dagr/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT dagr #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_DAGR #define DEBUG_MODE_FULL #endif diff --git a/addons/difficulties/script_component.hpp b/addons/difficulties/script_component.hpp index bac2935aa7..b6f387b02f 100644 --- a/addons/difficulties/script_component.hpp +++ b/addons/difficulties/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT difficulties #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_DIFFICULTIES #define DEBUG_MODE_FULL #endif diff --git a/addons/disarming/script_component.hpp b/addons/disarming/script_component.hpp index 9a1ef9156b..af0ede134c 100644 --- a/addons/disarming/script_component.hpp +++ b/addons/disarming/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT disarming #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_DISARMING #define DEBUG_MODE_FULL #endif diff --git a/addons/disposable/script_component.hpp b/addons/disposable/script_component.hpp index 12a05ea60d..cd15715601 100644 --- a/addons/disposable/script_component.hpp +++ b/addons/disposable/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_ATTACH #define DEBUG_MODE_FULL diff --git a/addons/disposable/stringtable.xml b/addons/disposable/stringtable.xml index 2c6f0b0afd..ac2b76ee7f 100644 --- a/addons/disposable/stringtable.xml +++ b/addons/disposable/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -29,7 +29,7 @@ Preloaded Missile Dummy Vorgeladene Racketennachbildung Missile préchargé - Přednabitá dummy střela + Přednabitá maketa rakety Wstępnie załadowana atrapa pocisku Precargado misil inerte Előtöltött műrakéta @@ -38,4 +38,4 @@ Míssel inerte pré-carregado - + \ No newline at end of file diff --git a/addons/dragging/functions/fnc_canCarry.sqf b/addons/dragging/functions/fnc_canCarry.sqf index 1f5e9f68aa..381940a9df 100644 --- a/addons/dragging/functions/fnc_canCarry.sqf +++ b/addons/dragging/functions/fnc_canCarry.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Check if unit can carry the object. Doesn't check weight. * * Arguments: @@ -10,6 +9,9 @@ * Return Value: * Can the unit carry the object? * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_canCarry; + * * Public: No */ #include "script_component.hpp" @@ -18,6 +20,10 @@ params ["_unit", "_target"]; if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; +//#2644 - Units with injured legs cannot bear the extra weight of carrying an object +//The fireman carry animation does not slow down for injured legs, so you could carry and run +if ((_unit getHitPointDamage "HitLegs") >= 0.5) exitWith {false}; + // a static weapon has to be empty for dragging (ignore UAV AI) if (((typeOf _target) isKindOf "StaticWeapon") && {{(getText (configFile >> "CfgVehicles" >> (typeOf _x) >> "simulation")) != "UAVPilot"} count crew _target > 0}) exitWith {false}; diff --git a/addons/dragging/functions/fnc_canDrag.sqf b/addons/dragging/functions/fnc_canDrag.sqf index d96c0dd5da..b45a7d1d14 100644 --- a/addons/dragging/functions/fnc_canDrag.sqf +++ b/addons/dragging/functions/fnc_canDrag.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Check if unit can drag the object. Doesn't check weight. * * Arguments: @@ -10,14 +9,14 @@ * Return Value: * Can the unit drag the object? * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_canDrag; + * * Public: No */ #include "script_component.hpp" -private ["_unit", "_target"]; - -_unit = _this select 0; -_target = _this select 1; +params ["_unit", "_target"]; if !([_unit, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; diff --git a/addons/dragging/functions/fnc_canDrop.sqf b/addons/dragging/functions/fnc_canDrop.sqf index 58c02cab07..b9a6170bf2 100644 --- a/addons/dragging/functions/fnc_canDrop.sqf +++ b/addons/dragging/functions/fnc_canDrop.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Check if unit can drop the object. * * Arguments: @@ -10,6 +9,9 @@ * Return Value: * Can the unit drop the object? * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_canDrop; + * * Public: No */ #include "script_component.hpp" diff --git a/addons/dragging/functions/fnc_canDrop_carry.sqf b/addons/dragging/functions/fnc_canDrop_carry.sqf index 430b12c642..3d3732f62d 100644 --- a/addons/dragging/functions/fnc_canDrop_carry.sqf +++ b/addons/dragging/functions/fnc_canDrop_carry.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Check if unit can drop the carried object. * * Arguments: @@ -10,6 +9,9 @@ * Return Value: * Can the unit drop the object? * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_canDrop_carry; + * * Public: No */ #include "script_component.hpp" diff --git a/addons/dragging/functions/fnc_carryObject.sqf b/addons/dragging/functions/fnc_carryObject.sqf index 8bea72b907..ec00693825 100644 --- a/addons/dragging/functions/fnc_carryObject.sqf +++ b/addons/dragging/functions/fnc_carryObject.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Carry an object. * * Arguments: @@ -10,17 +9,20 @@ * Return Value: * None * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_carryObject; + * * Public: No */ #include "script_component.hpp" params ["_unit", "_target"]; +TRACE_2("params",_unit,_target); // get attachTo offset and direction. -private ["_position", "_direction", "_UAVCrew"]; -_position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]]; -_direction = _target getVariable [QGVAR(carryDirection), 0]; +private _position = _target getVariable [QGVAR(carryPosition), [0, 0, 0]]; +private _direction = _target getVariable [QGVAR(carryDirection), 0]; // handle objects vs persons if (_target isKindOf "CAManBase") then { @@ -34,8 +36,7 @@ if (_target isKindOf "CAManBase") then { } else { // add height offset of model - private "_offset"; - _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2); + private _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2); _position = _position vectorAdd [0, 0, _offset]; @@ -56,16 +57,20 @@ _unit setVariable [QGVAR(ReleaseActionID), [ ] call EFUNC(common,addActionEventHandler)]; // show mouse hint -[localize LSTRING(Drop), "", localize LSTRING(LowerRaise)] call EFUNC(interaction,showMouseHint); +if (_target isKindOf "CAManBase") then { + [localize LSTRING(Drop), "", ""] call EFUNC(interaction,showMouseHint); +} else { + [localize LSTRING(Drop), "", localize LSTRING(LowerRaise)] call EFUNC(interaction,showMouseHint); +}; // check everything -[FUNC(carryObjectPFH), 0.5, [_unit, _target]] call CBA_fnc_addPerFrameHandler; +[FUNC(carryObjectPFH), 0.5, [_unit, _target, ACE_time]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; // prevent UAVs from firing -_UAVCrew = _target call EFUNC(common,getVehicleUAVCrew); +private _UAVCrew = _target call EFUNC(common,getVehicleUAVCrew); if !(_UAVCrew isEqualTo []) then { {_target deleteVehicleCrew _x} count _UAVCrew; diff --git a/addons/dragging/functions/fnc_carryObjectPFH.sqf b/addons/dragging/functions/fnc_carryObjectPFH.sqf index b50383707a..948af15891 100644 --- a/addons/dragging/functions/fnc_carryObjectPFH.sqf +++ b/addons/dragging/functions/fnc_carryObjectPFH.sqf @@ -1,14 +1,20 @@ /* * Author: commy2 - * * PFH for Carry Object * * Arguments: - * ? + * 0: ARGS + * 0: Unit + * 1: Target + * 2: Start time + * 1: PFEH Id * * Return Value: * None * + * Example: + * [[player, target], 20] call ace_dragging_fnc_carryObjectPFH; + * * Public: No */ #include "script_component.hpp" @@ -18,14 +24,21 @@ #endif params ["_args", "_idPFH"]; -_args params ["_unit","_target"]; +_args params ["_unit","_target", "_startTime"]; if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { + TRACE_2("carry false",_unit,_target); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { + TRACE_2("dead/distance",_unit,_target); + if ((_unit distance _target > 10) && {(ACE_time - _startTime) < 1}) exitWith { + //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, + //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) + TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,ACE_time); + }; [_unit, _target] call FUNC(dropObject_carry); [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/dragging/functions/fnc_dragObject.sqf b/addons/dragging/functions/fnc_dragObject.sqf index 17fbc60c06..3237ddbb07 100644 --- a/addons/dragging/functions/fnc_dragObject.sqf +++ b/addons/dragging/functions/fnc_dragObject.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Drag an object. Called from ace_dragging_fnc_startDrag * * Arguments: @@ -10,24 +9,29 @@ * Return Value: * None * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_dragObject; + * * Public: No */ #include "script_component.hpp" params ["_unit", "_target"]; - -private ["_position", "_direction", "_offset", "_UAVCrew"]; +TRACE_2("params",_unit,_target); // get attachTo offset and direction. -_position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]]; -_direction = _target getVariable [QGVAR(dragDirection), 0]; +private _position = _target getVariable [QGVAR(dragPosition), [0, 0, 0]]; +private _direction = _target getVariable [QGVAR(dragDirection), 0]; // add height offset of model -_offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2); - +private _offset = (_target modelToWorldVisual [0, 0, 0] select 2) - (_unit modelToWorldVisual [0, 0, 0] select 2); +if (_target isKindOf "CAManBase") then { + _offset = 0; +}; _position = _position vectorAdd [0, 0, _offset]; // attach object +TRACE_3("attaching",_position,_offset,_direction); _target attachTo [_unit, _position]; ["setDir", _target, [_target, _direction]] call EFUNC(common,targetEvent); @@ -49,13 +53,13 @@ _unit setVariable [QGVAR(ReleaseActionID), [ [localize LSTRING(Drop), ""] call EFUNC(interaction,showMouseHint); // check everything -[FUNC(dragObjectPFH), 0.5, [_unit, _target]] call CBA_fnc_addPerFrameHandler; +[FUNC(dragObjectPFH), 0.5, [_unit, _target, ACE_time]] call CBA_fnc_addPerFrameHandler; // reset current dragging height. GVAR(currentHeightChange) = 0; // prevent UAVs from firing -_UAVCrew = _target call EFUNC(common,getVehicleUAVCrew); +private _UAVCrew = _target call EFUNC(common,getVehicleUAVCrew); if !(_UAVCrew isEqualTo []) then { {_target deleteVehicleCrew _x} count _UAVCrew; diff --git a/addons/dragging/functions/fnc_dragObjectPFH.sqf b/addons/dragging/functions/fnc_dragObjectPFH.sqf index f6ff252886..ab117e90fd 100644 --- a/addons/dragging/functions/fnc_dragObjectPFH.sqf +++ b/addons/dragging/functions/fnc_dragObjectPFH.sqf @@ -1,14 +1,20 @@ /* * Author: commy2 - * * PFH for Drag Object * * Arguments: - * ? + * 0: ARGS + * 0: Unit + * 1: Target + * 2: Start time + * 1: PFEH Id * * Return Value: * None * + * Example: + * [[player, target], 20] call ace_dragging_fnc_dragObjectPFH; + * * Public: No */ #include "script_component.hpp" @@ -18,14 +24,21 @@ #endif params ["_args", "_idPFH"]; -_args params ["_unit", "_target"]; +_args params ["_unit","_target", "_startTime"]; if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { + TRACE_2("drag false",_unit,_target); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // drop if the crate is destroyed OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { + TRACE_2("dead/distance",_unit,_target); + if ((_unit distance _target > 10) && {(ACE_time - _startTime) < 1}) exitWith { + //attachTo seems to have some kind of network delay and target can return an odd position durring the first few frames, + //so wait a full second to exit if out of range (this is critical as we would otherwise detach and set it's pos to weird pos) + TRACE_3("ignoring bad distance at start",_unit distance _target,_startTime,ACE_time); + }; [_unit, _target] call FUNC(dropObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/dragging/functions/fnc_dropObject.sqf b/addons/dragging/functions/fnc_dropObject.sqf index 5e5687db8a..604f6c25b7 100644 --- a/addons/dragging/functions/fnc_dropObject.sqf +++ b/addons/dragging/functions/fnc_dropObject.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Drop a dragged object. * * Arguments: @@ -10,17 +9,20 @@ * Return Value: * None * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_dropObject; + * * Public: No */ #include "script_component.hpp" params ["_unit", "_target"]; +TRACE_2("params",_unit,_target); // remove drop action [_unit, "DefaultAction", _unit getVariable [QGVAR(ReleaseActionID), -1]] call EFUNC(common,removeActionEventHandler); -private "_inBuilding"; -_inBuilding = [_unit] call FUNC(isObjectOnObject); +private _inBuilding = [_unit] call FUNC(isObjectOnObject); if !(_unit getVariable ["ACE_isUnconscious", false]) then { // play release animation @@ -47,6 +49,7 @@ _unit removeWeapon "ACE_FakePrimaryWeapon"; // prevent object from flipping inside buildings if (_inBuilding) then { _target setPosASL (getPosASL _target vectorAdd [0, 0, 0.05]); + TRACE_2("setPos",getPosASL _unit,getPosASL _target); }; // hide mouse hint diff --git a/addons/dragging/functions/fnc_dropObject_carry.sqf b/addons/dragging/functions/fnc_dropObject_carry.sqf index c9c34c82a0..2002142e2e 100644 --- a/addons/dragging/functions/fnc_dropObject_carry.sqf +++ b/addons/dragging/functions/fnc_dropObject_carry.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Drop a carried object. * * Arguments: @@ -10,17 +9,20 @@ * Return Value: * None * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_dropObject_carry; + * * Public: No */ #include "script_component.hpp" params ["_unit", "_target"]; +TRACE_2("params",_unit,_target); // remove drop action [_unit, "DefaultAction", _unit getVariable [QGVAR(ReleaseActionID), -1]] call EFUNC(common,removeActionEventHandler); -private "_inBuilding"; -_inBuilding = [_unit] call FUNC(isObjectOnObject); +private _inBuilding = [_unit] call FUNC(isObjectOnObject); // prevent collision damage ["fixCollision", _unit] call EFUNC(common,localEvent); @@ -48,7 +50,7 @@ _unit removeWeapon "ACE_FakePrimaryWeapon"; // reselect weapon and re-enable sprint _unit selectWeapon primaryWeapon _unit; -[_unit, "isDragging", false] call EFUNC(common,setforceWalkStatus); +[_unit, "forceWalk", "ACE_dragging", false] call EFUNC(common,statusEffect_set); // prevent object from flipping inside buildings if (_inBuilding) then { diff --git a/addons/dragging/functions/fnc_getWeight.sqf b/addons/dragging/functions/fnc_getWeight.sqf index 0fbee19d41..ac2db86ad0 100644 --- a/addons/dragging/functions/fnc_getWeight.sqf +++ b/addons/dragging/functions/fnc_getWeight.sqf @@ -1,6 +1,5 @@ /* * Author: L-H, edited by commy2, rewritten by joko // Jonas - * * Returns the weight of a crate. * * Arguments: @@ -10,20 +9,20 @@ * Total Weight * * Example: - * _weight = Crate1 call ace_dragging_fnc_getweight; + * [Crate1] call ace_dragging_fnc_getweight; * * Public: No */ #include "script_component.hpp" -private "_totalWeight"; params ["_object"]; + // Initialize the total weight. -_totalWeight = 0; +private _totalWeight = 0; // Cycle through all item types with their assigned config paths. { - _x params["_items","_getConfigCode"]; + _x params ["_items", "_getConfigCode"]; _items params ["_item", "_count"]; // Cycle through all items and read their mass out of the config. { diff --git a/addons/dragging/functions/fnc_handleAnimChanged.sqf b/addons/dragging/functions/fnc_handleAnimChanged.sqf index 0694687ca4..e186370e55 100644 --- a/addons/dragging/functions/fnc_handleAnimChanged.sqf +++ b/addons/dragging/functions/fnc_handleAnimChanged.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Handle the animaion for a Unit for Dragging Module * * Arguments: @@ -17,35 +16,28 @@ */ #include "script_component.hpp" -private ["_unit", "_anim"]; - -_unit = _this select 0; -_anim = _this select 1; +params ["_unit", "_anim"]; if (_unit getVariable [QGVAR(isDragging), false]) then { // drop dragged object when not in valid animation if !(_anim in DRAG_ANIMATIONS) then { - private "_draggedObject"; - _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; + private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; if (!isNull _draggedObject) then { [_unit, _draggedObject] call FUNC(dropObject); }; }; - }; if (_unit getVariable [QGVAR(isCarrying), false]) then { // drop carried object when not standing; also some exceptions when picking up crate if (stance _unit != "STAND" && {_anim != "amovpercmstpsnonwnondnon"}) then { - private "_carriedObject"; - _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; + private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; if (!isNull _carriedObject) then { [_unit, _carriedObject] call FUNC(dropObject_carry); }; }; - }; diff --git a/addons/dragging/functions/fnc_handleKilled.sqf b/addons/dragging/functions/fnc_handleKilled.sqf index 2d0923d624..36bda60b78 100644 --- a/addons/dragging/functions/fnc_handleKilled.sqf +++ b/addons/dragging/functions/fnc_handleKilled.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Handle death of the dragger * * Arguments: @@ -17,17 +16,16 @@ #include "script_component.hpp" params ["_unit"]; +TRACE_1("params",_unit); if (_unit getVariable [QGVAR(isDragging), false]) then { - private "_draggedObject"; - _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; + private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; [_unit, _draggedObject] call FUNC(dropObject); }; if (_unit getVariable [QGVAR(isCarrying), false]) then { - private "_carriedObject"; - _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; + private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; [_unit, _carriedObject] call FUNC(dropObject_carry); }; diff --git a/addons/dragging/functions/fnc_handlePlayerChanged.sqf b/addons/dragging/functions/fnc_handlePlayerChanged.sqf index 41c9091c72..a0d9e63449 100644 --- a/addons/dragging/functions/fnc_handlePlayerChanged.sqf +++ b/addons/dragging/functions/fnc_handlePlayerChanged.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Handle player changes. * * Arguments: @@ -11,13 +10,14 @@ * None * * Example: - * [_unitNew, _unitOld] call ace_dragging_fnc_handlePlayerChanged; + * [_newPlayer, _oldPlayer] call ace_dragging_fnc_handlePlayerChanged; * * Public: No */ #include "script_component.hpp" params ["_newPlayer", "_oldPlayer"]; +TRACE_2("params",_newPlayer,_oldPlayer); { if (_x getVariable [QGVAR(isDragging), false]) then { diff --git a/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf b/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf index e0f1b2a8e4..a8df6b5b7d 100644 --- a/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf +++ b/addons/dragging/functions/fnc_handlePlayerWeaponChanged.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Handle the Weapon Changed Event * * Arguments: @@ -11,20 +10,20 @@ * None * * Example: - * [_unit, _currentWeapon] call ace_dragging_fnc_handlePlayerWeaponChanged; + * [_unit, "gun"] call ace_dragging_fnc_handlePlayerWeaponChanged; * * Public: No */ #include "script_component.hpp" params ["_unit", "_weapon"]; +TRACE_2("params",_unit,_weapon); if (_unit getVariable [QGVAR(isDragging), false]) then { // drop dragged object when selecting a non-primary weapon if (_weapon != primaryWeapon _unit) then { - private "_draggedObject"; - _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; + private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; [_unit, _draggedObject] call FUNC(dropObject); }; @@ -33,8 +32,7 @@ if (_unit getVariable [QGVAR(isDragging), false]) then { if (_unit getVariable [QGVAR(isCarrying), false]) then { - private "_carriedObject"; - _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; + private _carriedObject = _unit getVariable [QGVAR(carriedObject), objNull]; if (_carriedObject isKindOf "CAManBase") then { diff --git a/addons/dragging/functions/fnc_handleScrollWheel.sqf b/addons/dragging/functions/fnc_handleScrollWheel.sqf index 73c42c2810..e3547ca63a 100644 --- a/addons/dragging/functions/fnc_handleScrollWheel.sqf +++ b/addons/dragging/functions/fnc_handleScrollWheel.sqf @@ -1,6 +1,5 @@ /* * Author: L-H, commy2 - * * Handles raising and lowering the dragged weapon to be able to place it on top of objects. * * Arguments: @@ -9,15 +8,16 @@ * Return Value: * Handled or not. * + * Example: + * [0.1] call ace_dragging_fnc_handleScrollWheel; + * * Public: No */ #include "script_component.hpp" params ["_scrollAmount"]; -private ["_unit", "_carriedItem", "_position", "_maxHeight"]; - -_unit = ACE_player; +private _unit = ACE_player; // EH is always assigned. Exit and don't overwrite input if not carrying if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {false}; @@ -25,13 +25,13 @@ if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith {false}; // move carried item 15 cm per scroll interval _scrollAmount = _scrollAmount * 0.15; -_carriedItem = _unit getVariable [QGVAR(carriedObject), objNull]; +private _carriedItem = _unit getVariable [QGVAR(carriedObject), objNull]; //disabled for persons if (_carriedItem isKindOf "CAManBase") exitWith {false}; -_position = getPosATL _carriedItem; -_maxHeight = (_unit modelToWorldVisual [0,0,0]) select 2; +private _position = getPosATL _carriedItem; +private _maxHeight = (_unit modelToWorldVisual [0,0,0]) select 2; _position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight]; diff --git a/addons/dragging/functions/fnc_handleUnconscious.sqf b/addons/dragging/functions/fnc_handleUnconscious.sqf index b87e36b92d..2e891b01c6 100644 --- a/addons/dragging/functions/fnc_handleUnconscious.sqf +++ b/addons/dragging/functions/fnc_handleUnconscious.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Handle the Unconscious of a Unit while Dragging * * Arguments: @@ -16,15 +15,13 @@ */ #include "script_component.hpp" -private ["_player", "_draggedObject", "_carriedObject"]; - params ["_unit"]; -_player = ACE_player; +private _player = ACE_player; if (_player getVariable [QGVAR(isDragging), false]) then { - _draggedObject = _player getVariable [QGVAR(draggedObject), objNull]; + private _draggedObject = _player getVariable [QGVAR(draggedObject), objNull]; // handle falling unconscious if (_unit == _player) then { @@ -40,7 +37,7 @@ if (_player getVariable [QGVAR(isDragging), false]) then { if (_player getVariable [QGVAR(isCarrying), false]) then { - _carriedObject = _player getVariable [QGVAR(carriedObject), objNull]; + private _carriedObject = _player getVariable [QGVAR(carriedObject), objNull]; // handle falling unconscious if (_unit == _player) then { diff --git a/addons/dragging/functions/fnc_initObject.sqf b/addons/dragging/functions/fnc_initObject.sqf index 0dd36568bc..b9f623395e 100644 --- a/addons/dragging/functions/fnc_initObject.sqf +++ b/addons/dragging/functions/fnc_initObject.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Initialize variables for drag or carryable objects. Called from init EH. * * Argument: @@ -9,26 +8,27 @@ * Return Value: * None * + * Example: + * [box] call ace_dragging_fnc_initObject; + * * Public: No */ #include "script_component.hpp" -private ["_position", "_direction", "_config"]; - params ["_object"]; -_config = configFile >> "CfgVehicles" >> typeOf _object; +private _config = configFile >> "CfgVehicles" >> typeOf _object; if (getNumber (_config >> QGVAR(canDrag)) == 1) then { - _position = getArray (_config >> QGVAR(dragPosition)); - _direction = getNumber (_config >> QGVAR(dragDirection)); + private _position = getArray (_config >> QGVAR(dragPosition)); + private _direction = getNumber (_config >> QGVAR(dragDirection)); [_object, true, _position, _direction] call FUNC(setDraggable); }; if (getNumber (_config >> QGVAR(canCarry)) == 1) then { - _position = getArray (_config >> QGVAR(carryPosition)); - _direction = getNumber (_config >> QGVAR(carryDirection)); + private _position = getArray (_config >> QGVAR(carryPosition)); + private _direction = getNumber (_config >> QGVAR(carryDirection)); [_object, true, _position, _direction] call FUNC(setCarryable); }; diff --git a/addons/dragging/functions/fnc_initPerson.sqf b/addons/dragging/functions/fnc_initPerson.sqf index c0a951771c..9e4aefeead 100644 --- a/addons/dragging/functions/fnc_initPerson.sqf +++ b/addons/dragging/functions/fnc_initPerson.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Initialize variables for drag or carryable persons. Called from init EH. * * Argument: @@ -9,6 +8,9 @@ * Return value: * None * + * Example: + * [player] call ace_dragging_fnc_initPerson; + * * Public: No */ #include "script_component.hpp" diff --git a/addons/dragging/functions/fnc_isObjectOnObject.sqf b/addons/dragging/functions/fnc_isObjectOnObject.sqf index e8ab5f307a..c113688322 100644 --- a/addons/dragging/functions/fnc_isObjectOnObject.sqf +++ b/addons/dragging/functions/fnc_isObjectOnObject.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Check if Object is Overlapping * * Argument: @@ -9,6 +8,9 @@ * Return value: * * + * Example; + * [player] call ace_dragging_fnc_isObjectOnObject + * * Public: No */ params ["_object"]; diff --git a/addons/dragging/functions/fnc_setCarryable.sqf b/addons/dragging/functions/fnc_setCarryable.sqf index 6bf05e5fde..9e15e42446 100644 --- a/addons/dragging/functions/fnc_setCarryable.sqf +++ b/addons/dragging/functions/fnc_setCarryable.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Enable the object to be carried. * * Argument: @@ -12,12 +11,13 @@ * Return Value: * None * + * Example: + * [object, true, [0,1,1], 0] call ace_dragging_fnc_setCarryable; + * * Public: Yes */ #include "script_component.hpp" -private ["_carryAction", "_dropAction", "_type", "_initializedClasses"]; - params ["_object", "_enableCarry", "_position", "_direction"]; if (isNil "_position") then { @@ -34,8 +34,8 @@ _object setVariable [QGVAR(carryPosition), _position]; _object setVariable [QGVAR(carryDirection), _direction]; // add action to class if it is not already present -_type = typeOf _object; -_initializedClasses = GETGVAR(initializedClasses_carry,[]); +private _type = typeOf _object; +private _initializedClasses = GETGVAR(initializedClasses_carry,[]); // do nothing if the class is already initialized if (_type in _initializedClasses) exitWith {}; @@ -43,8 +43,8 @@ if (_type in _initializedClasses) exitWith {}; _initializedClasses pushBack _type; GVAR(initializedClasses_carry) = _initializedClasses; -_carryAction = [QGVAR(carry), localize LSTRING(Carry), "", {[_player, _target] call FUNC(startCarry)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction); -_dropAction = [QGVAR(drop_carry), localize LSTRING(Drop), "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction); +private _carryAction = [QGVAR(carry), localize LSTRING(Carry), "", {[_player, _target] call FUNC(startCarry)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction); +private _dropAction = [QGVAR(drop_carry), localize LSTRING(Drop), "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction); [_type, 0, ["ACE_MainActions"], _carryAction] call EFUNC(interact_menu,addActionToClass); [_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/dragging/functions/fnc_setDraggable.sqf b/addons/dragging/functions/fnc_setDraggable.sqf index bbfca9d868..0adcb624d8 100644 --- a/addons/dragging/functions/fnc_setDraggable.sqf +++ b/addons/dragging/functions/fnc_setDraggable.sqf @@ -1,22 +1,23 @@ /* * Author: commy2 - * * Enable the object to be dragged. * * Argument: - * 0: Any object (Object) - * 1: true to enable dragging, false to disable (Bool) + * 0: Any object + * 1: true to enable dragging, false to disable * 2: Position offset for attachTo command (Array, optinal; default: [0,0,0]) * 3: Direction in degree to rotate the object after attachTo (Number, optional; default: 0) * * Return value: * None * + * Example: + * [object, true, [0,0,0], 0] call ace_dragging_fnc_setDraggable; + * * Public: Yes */ #include "script_component.hpp" -private ["_dragAction", "_dropAction", "_type", "_initializedClasses"]; //IGNORE_PRIVATE_WARNING("_player", "_target"); params ["_object", "_enableDrag", "_position", "_direction"]; @@ -34,8 +35,8 @@ _object setVariable [QGVAR(dragPosition), _position]; _object setVariable [QGVAR(dragDirection), _direction]; // add action to class if it is not already present -_type = typeOf _object; -_initializedClasses = GETGVAR(initializedClasses,[]); +private _type = typeOf _object; +private _initializedClasses = GETGVAR(initializedClasses,[]); // do nothing if the class is already initialized if (_type in _initializedClasses) exitWith {}; @@ -43,8 +44,8 @@ if (_type in _initializedClasses) exitWith {}; _initializedClasses pushBack _type; GVAR(initializedClasses) = _initializedClasses; -_dragAction = [QGVAR(drag), localize LSTRING(Drag), "", {[_player, _target] call FUNC(startDrag)}, {[_player, _target] call FUNC(canDrag)}] call EFUNC(interact_menu,createAction); -_dropAction = [QGVAR(drop), localize LSTRING(Drop), "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}] call EFUNC(interact_menu,createAction); +private _dragAction = [QGVAR(drag), localize LSTRING(Drag), "", {[_player, _target] call FUNC(startDrag)}, {[_player, _target] call FUNC(canDrag)}] call EFUNC(interact_menu,createAction); +private _dropAction = [QGVAR(drop), localize LSTRING(Drop), "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}] call EFUNC(interact_menu,createAction); [_type, 0, ["ACE_MainActions"], _dragAction] call EFUNC(interact_menu,addActionToClass); [_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/dragging/functions/fnc_startCarry.sqf b/addons/dragging/functions/fnc_startCarry.sqf index 3b08de2c9d..fd528b0104 100644 --- a/addons/dragging/functions/fnc_startCarry.sqf +++ b/addons/dragging/functions/fnc_startCarry.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Start the carrying process. * * Arguments: @@ -10,22 +9,24 @@ * Return Value: * None * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_startCarry; + * * Public: No */ #include "script_component.hpp" -private ["_weight", "_timer"]; - params ["_unit", "_target"]; +TRACE_2("params",_unit,_target); // check weight -_weight = [_target] call FUNC(getWeight); +private _weight = [_target] call FUNC(getWeight); if (_weight > missionNamespace getVariable ["ACE_maxWeightCarry", 1E11]) exitWith { [localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured); }; -_timer = ACE_time + 5; +private _timer = ACE_time + 5; // handle objects vs persons if (_target isKindOf "CAManBase") then { @@ -53,7 +54,7 @@ if (_target isKindOf "CAManBase") then { _unit action ["SwitchWeapon", _unit, _unit, 99]; [_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation); - [_unit, "isDragging", true] call EFUNC(common,setforceWalkStatus); + [_unit, "forceWalk", "ACE_dragging", true] call EFUNC(common,statusEffect_set); }; diff --git a/addons/dragging/functions/fnc_startCarryPFH.sqf b/addons/dragging/functions/fnc_startCarryPFH.sqf index eafc9b8e01..4d39672a9e 100644 --- a/addons/dragging/functions/fnc_startCarryPFH.sqf +++ b/addons/dragging/functions/fnc_startCarryPFH.sqf @@ -1,14 +1,20 @@ /* * Author: commy2 - * * Carry PFH * * Arguments: - * ? + * 0: ARGS + * 0: Unit + * 1: Target + * 2: Timeout + * 1: PFEH Id * * Return Value: * None * + * Example: + * [[player, target, 100], 20] call ace_dragging_fnc_startCarryPFH; + * * Public: No */ #include "script_component.hpp" @@ -22,11 +28,13 @@ _args params ["_unit", "_target", "_timeOut"]; // handle aborting carry if !(_unit getVariable [QGVAR(isCarrying), false]) exitWith { + TRACE_4("carry false",_unit,_target,_timeOut,ACE_time); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { + TRACE_4("dead/distance",_unit,_target,_timeOut,ACE_time); [_unit, _target] call FUNC(dropObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; @@ -34,25 +42,26 @@ if (!alive _target || {_unit distance _target > 10}) then { // handle persons vs objects if (_target isKindOf "CAManBase") then { if (ACE_time > _timeOut) exitWith { + TRACE_4("Start carry person",_unit,_target,_timeOut,ACE_time); [_unit, _target] call FUNC(carryObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; } else { if (ACE_time > _timeOut) exitWith { + TRACE_4("timeout",_unit,_target,_timeOut,ACE_time); [_idPFH] call CBA_fnc_removePerFrameHandler; // drop if in timeout - private "_draggedObject"; - _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; + private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; [_unit, _draggedObject] call FUNC(dropObject); }; // wait for the unit to stand up if (stance _unit == "STAND") exitWith { + TRACE_4("Start carry object",_unit,_target,_timeOut,ACE_time); [_unit, _target] call FUNC(carryObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; - }; diff --git a/addons/dragging/functions/fnc_startDrag.sqf b/addons/dragging/functions/fnc_startDrag.sqf index 6ad315ce00..24a279e7a7 100644 --- a/addons/dragging/functions/fnc_startDrag.sqf +++ b/addons/dragging/functions/fnc_startDrag.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 - * * Start the dragging process. * * Argument: @@ -9,14 +8,19 @@ * * Return value: * None + * + * Example: + * [player, cursorTarget] call ace_dragging_fnc_startDrag; + * + * Public: No */ #include "script_component.hpp" params ["_unit", "_target"]; +TRACE_2("params",_unit,_target); // check weight -private "_weight"; -_weight = [_target] call FUNC(getWeight); +private _weight = [_target] call FUNC(getWeight); if (_weight > missionNamespace getVariable ["ACE_maxWeightDrag", 1E11]) exitWith { [localize LSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured); diff --git a/addons/dragging/functions/fnc_startDragPFH.sqf b/addons/dragging/functions/fnc_startDragPFH.sqf index 14af1575a6..cfa84fe279 100644 --- a/addons/dragging/functions/fnc_startDragPFH.sqf +++ b/addons/dragging/functions/fnc_startDragPFH.sqf @@ -1,14 +1,20 @@ /* * Author: commy2 - * * Drag PFH * * Arguments: - * ? + * 0: ARGS + * 0: Unit + * 1: Target + * 2: Timeout + * 1: PFEH Id * * Return Value: * None * + * Example: + * [[player, target, 100], 20] call ace_dragging_fnc_startDragPFH; + * * Public: No */ #include "script_component.hpp" @@ -22,27 +28,30 @@ _args params ["_unit", "_target", "_timeOut"]; // handle aborting drag if !(_unit getVariable [QGVAR(isDragging), false]) exitWith { + TRACE_4("drag false",_unit,_target,_timeOut,ACE_time); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // same as dragObjectPFH, checks if object is deleted or dead OR (target moved away from carrier (weapon disasembled)) if (!alive _target || {_unit distance _target > 10}) then { + TRACE_4("dead/distance",_unit,_target,_timeOut,ACE_time); [_unit, _target] call FUNC(dropObject); [_idPFH] call CBA_fnc_removePerFrameHandler; }; // timeout. Do nothing. Quit. ACE_time, because anim length is linked to ingame time. if (ACE_time > _timeOut) exitWith { + TRACE_4("timeout",_unit,_target,_timeOut,ACE_time); [_idPFH] call CBA_fnc_removePerFrameHandler; // drop if in timeout - private "_draggedObject"; - _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; + private _draggedObject = _unit getVariable [QGVAR(draggedObject), objNull]; [_unit, _draggedObject] call FUNC(dropObject); }; // unit is ready to start dragging if (animationState _unit in DRAG_ANIMATIONS) exitWith { + TRACE_4("Start Dragging",_unit,_target,_timeOut,ACE_time); [_unit, _target] call FUNC(dragObject); [_idPFH] call CBA_fnc_removePerFrameHandler; diff --git a/addons/dragging/script_component.hpp b/addons/dragging/script_component.hpp index 2427f89739..b4acb948c9 100644 --- a/addons/dragging/script_component.hpp +++ b/addons/dragging/script_component.hpp @@ -2,6 +2,10 @@ #include "\z\ace\addons\main\script_mod.hpp" //#define DEBUG_ENABLED_DRAGGING +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_DRAGGING #define DEBUG_MODE_FULL diff --git a/addons/dragging/stringtable.xml b/addons/dragging/stringtable.xml index 0e105f60ce..2d9fd656bf 100644 --- a/addons/dragging/stringtable.xml +++ b/addons/dragging/stringtable.xml @@ -34,7 +34,7 @@ Objeto muito pesado L'oggetto pesa troppo Предмет слишком тяжёлый - Moc težké + Předmět je moc těžký Az objektum túl nehéz diff --git a/addons/explosives/ACE_Triggers.hpp b/addons/explosives/ACE_Triggers.hpp index 952f360f22..280906432f 100644 --- a/addons/explosives/ACE_Triggers.hpp +++ b/addons/explosives/ACE_Triggers.hpp @@ -15,19 +15,19 @@ onSetup parameters: onPlace = QUOTE(_this call FUNC(AddClacker);false); requires[] = {"ACE_Clacker"}; }; - class MK16_Transmitter:Command { + class MK16_Transmitter: Command { isAttachable = 1; - displayName = CSTRING(MK16_displayName); + displayName = CSTRING(M152_displayName); picture = PATHTOF(Data\UI\MK16_Reciever_ca.paa); requires[] = {"ACE_M26_Clacker"}; }; - class DeadManSwitch:Command { + class DeadManSwitch: Command { isAttachable = 1; displayName = CSTRING(DeadManSwitch_displayName); picture = PATHTOF(Data\UI\DeadmanSwitch.paa); requires[] = {"ACE_DeadManSwitch"}; }; - class Cellphone:Command { + class Cellphone: Command { isAttachable = 1; displayName = CSTRING(cellphone_displayName); picture = PATHTOF(Data\UI\Cellphone_UI.paa); diff --git a/addons/explosives/CfgAmmo.hpp b/addons/explosives/CfgAmmo.hpp index 843ecdb8e3..977e01e3af 100644 --- a/addons/explosives/CfgAmmo.hpp +++ b/addons/explosives/CfgAmmo.hpp @@ -3,7 +3,7 @@ class CfgAmmo { class Default; class TimeBombCore: Default { - ACE_DefuseTime = 5; + GVAR(DefuseTime) = 5; }; /* class BoundingMineCore: TimeBombCore; @@ -29,12 +29,13 @@ class CfgAmmo { */ class DirectionalBombBase; class ClaymoreDirectionalMine_Remote_Ammo: DirectionalBombBase { - ACE_Explosive = "ClaymoreDirectionalMine_Remote_Ammo_Scripted"; + GVAR(magazine) = "ClaymoreDirectionalMine_Remote_Mag"; + GVAR(Explosive) = "ClaymoreDirectionalMine_Remote_Ammo_Scripted"; GVAR(defuseObjectPosition[]) = {0, 0, 0.038}; soundActivation[] = {"", 0, 0, 0}; soundDeactivation[] = {"", 0, 0, 0}; }; - //class ClaymoreDirectionalMine_Remote_Ammo_Scripted: ClaymoreDirectionalMine_Remote_Ammo; + // class ClaymoreDirectionalMine_Remote_Ammo_Scripted: ClaymoreDirectionalMine_Remote_Ammo {}; class APERSTripMine_Wire_Ammo: DirectionalBombBase { GVAR(defuseObjectPosition[]) = {-1.415, 0, 0.12}; @@ -42,23 +43,29 @@ class CfgAmmo { class SLAMDirectionalMine_Wire_Ammo: DirectionalBombBase { indirectHitRange = 20; - ACE_explodeOnDefuse = 1; + GVAR(explodeOnDefuseChance) = 1; + GVAR(magazine) = "SLAMDirectionalMine_Wire_Mag"; }; - class SLAMDirectionalMine_Command_Ammo: SLAMDirectionalMine_Wire_Ammo { + class ACE_SLAMDirectionalMine_Command_Ammo: SLAMDirectionalMine_Wire_Ammo { mineTrigger = "RemoteTrigger"; - ACE_explodeOnDefuse = 0; + GVAR(explodeOnDefuseChance) = 0; }; - class SLAMDirectionalMine_Timer_Ammo: SLAMDirectionalMine_Wire_Ammo { + class ACE_SLAMDirectionalMine_Timer_Ammo: SLAMDirectionalMine_Wire_Ammo { mineTrigger = "TimeTrigger"; - ACE_explodeOnDefuse = 0; }; - class SLAMDirectionalMine_Magnetic_Ammo: SLAMDirectionalMine_Wire_Ammo { - mineTrigger = "MagneticTrigger"; + class ACE_SLAMDirectionalMine_Magnetic_Ammo: SLAMDirectionalMine_Wire_Ammo { + mineTrigger = "ACE_MagneticTrigger"; + GVAR(explodeOnDefuseChance) = 0; + explosionAngle = 360; + indirectHitRange = 1; + mineInconspicuousness = 25; + icon = "iconExplosiveGP"; }; class PipeBombBase; class DemoCharge_Remote_Ammo: PipeBombBase { - ACE_Explosive = "DemoCharge_Remote_Ammo_Scripted"; + GVAR(magazine) = "DemoCharge_Remote_Mag"; + GVAR(Explosive) = "DemoCharge_Remote_Ammo_Scripted"; GVAR(defuseObjectPosition[]) = {0.07, 0, 0.055}; soundActivation[] = {"", 0, 0, 0}; soundDeactivation[] = {"", 0, 0, 0}; @@ -67,60 +74,64 @@ class CfgAmmo { indirectHitRange = 7; }; class SatchelCharge_Remote_Ammo: PipeBombBase { - ACE_Explosive = "SatchelCharge_Remote_Ammo_Scripted"; + GVAR(magazine) = "SatchelCharge_Remote_Mag"; + GVAR(Explosive) = "SatchelCharge_Remote_Ammo_Scripted"; GVAR(defuseObjectPosition[]) = {0.1, 0.1, 0.05}; soundActivation[] = {"", 0, 0, 0}; soundDeactivation[] = {"", 0, 0, 0}; }; - - /*class DemoCharge_Remote_Ammo_Scripted: DemoCharge_Remote_Ammo; - class SatchelCharge_Remote_Ammo_Scripted: SatchelCharge_Remote_Ammo;*/ + // class DemoCharge_Remote_Ammo_Scripted: DemoCharge_Remote_Ammo {}; + // class SatchelCharge_Remote_Ammo_Scripted: SatchelCharge_Remote_Ammo {}; class IEDUrbanBig_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; - ACE_explodeOnDefuse = 0.02; + GVAR(explodeOnDefuseChance) = 0.02; + GVAR(magazine) = "IEDUrbanBig_Remote_Mag"; soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; - class IEDUrbanBig_Command_Ammo: IEDUrbanBig_Remote_Ammo { + class ACE_IEDUrbanBig_Command_Ammo: IEDUrbanBig_Remote_Ammo { mineTrigger = "RemoteTrigger"; }; - class IEDUrbanBig_Range_Ammo: IEDUrbanBig_Remote_Ammo { + class ACE_IEDUrbanBig_Range_Ammo: IEDUrbanBig_Remote_Ammo { mineTrigger = "RangeTrigger"; }; class IEDUrbanSmall_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; - ACE_explodeOnDefuse = 0.02; + GVAR(explodeOnDefuseChance) = 0.02; + GVAR(magazine) = "IEDUrbanSmall_Remote_Mag"; soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; - class IEDUrbanSmall_Command_Ammo: IEDUrbanSmall_Remote_Ammo { + class ACE_IEDUrbanSmall_Command_Ammo: IEDUrbanSmall_Remote_Ammo { mineTrigger = "RemoteTrigger"; }; - class IEDUrbanSmall_Range_Ammo: IEDUrbanSmall_Remote_Ammo { - mineTrigger = "RangeTrigger"; + class ACE_IEDUrbanSmall_Range_Ammo: IEDUrbanSmall_Remote_Ammo { + mineTrigger = "RangeTriggerShort"; }; class IEDLandBig_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; - ACE_explodeOnDefuse = 0.02; + GVAR(explodeOnDefuseChance) = 0.02; + GVAR(magazine) = "IEDLandBig_Remote_Mag"; soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; - class IEDLandBig_Command_Ammo: IEDLandBig_Remote_Ammo { + class ACE_IEDLandBig_Command_Ammo: IEDLandBig_Remote_Ammo { mineTrigger = "RemoteTrigger"; }; - class IEDLandBig_Range_Ammo: IEDLandBig_Remote_Ammo { + class ACE_IEDLandBig_Range_Ammo: IEDLandBig_Remote_Ammo { mineTrigger = "RangeTrigger"; }; class IEDLandSmall_Remote_Ammo: PipeBombBase { triggerWhenDestroyed = 1; - ACE_explodeOnDefuse = 0.02; + GVAR(explodeOnDefuseChance) = 0.02; + GVAR(magazine) = "IEDLandSmall_Remote_Mag"; soundTrigger[] = {"A3\Sounds_F\weapons\mines\mech_trigger_1", 0.8, 1, 40}; }; - class IEDLandSmall_Command_Ammo: IEDLandSmall_Remote_Ammo { + class ACE_IEDLandSmall_Command_Ammo: IEDLandSmall_Remote_Ammo { mineTrigger = "RemoteTrigger"; }; - class IEDLandSmall_Range_Ammo: IEDLandSmall_Remote_Ammo { - mineTrigger = "RangeTrigger"; + class ACE_IEDLandSmall_Range_Ammo: IEDLandBig_Remote_Ammo { + mineTrigger = "RangeTriggerShort"; }; }; diff --git a/addons/explosives/CfgMagazines.hpp b/addons/explosives/CfgMagazines.hpp index 686dd83ee8..eec0dadfa3 100644 --- a/addons/explosives/CfgMagazines.hpp +++ b/addons/explosives/CfgMagazines.hpp @@ -1,10 +1,10 @@ class CfgMagazines { class CA_Magazine; class ATMine_Range_Mag: CA_Magazine { - ACE_Placeable = 1; + GVAR(Placeable) = 1; useAction = 0; - ACE_SetupObject = "ACE_Explosives_Place_ATMine"; // CfgVehicle class for setup object. - ACE_DelayTime = 2.5; + GVAR(SetupObject) = "ACE_Explosives_Place_ATMine"; // CfgVehicle class for setup object. + GVAR(DelayTime) = 2.5; class ACE_Triggers { SupportedTriggers[] = {"PressurePlate"}; class PressurePlate { @@ -13,7 +13,7 @@ class CfgMagazines { }; }; class APERSBoundingMine_Range_Mag: ATMine_Range_Mag { - ACE_SetupObject = "ACE_Explosives_Place_APERSBoundingMine"; + GVAR(SetupObject) = "ACE_Explosives_Place_APERSBoundingMine"; class ACE_Triggers { SupportedTriggers[] = {"PressurePlate"}; class PressurePlate { @@ -22,7 +22,7 @@ class CfgMagazines { }; }; class APERSMine_Range_Mag: ATMine_Range_Mag { - ACE_SetupObject = "ACE_Explosives_Place_APERSMine"; + GVAR(SetupObject) = "ACE_Explosives_Place_APERSMine"; class ACE_Triggers { SupportedTriggers[] = {"PressurePlate"}; class PressurePlate { @@ -31,7 +31,7 @@ class CfgMagazines { }; }; class APERSTripMine_Wire_Mag: ATMine_Range_Mag { - ACE_SetupObject = "ACE_Explosives_Place_APERSTripwireMine"; + GVAR(SetupObject) = "ACE_Explosives_Place_APERSTripwireMine"; class ACE_Triggers { SupportedTriggers[] = {"Tripwire"}; class Tripwire; @@ -39,10 +39,10 @@ class CfgMagazines { }; class ClaymoreDirectionalMine_Remote_Mag: CA_Magazine { - ACE_Placeable = 1; + GVAR(Placeable) = 1; useAction = 0; - ACE_SetupObject = "ACE_Explosives_Place_Claymore"; - ACE_DelayTime = 1.5; + GVAR(SetupObject) = "ACE_Explosives_Place_Claymore"; + GVAR(DelayTime) = 1.5; class ACE_Triggers { SupportedTriggers[] = {"Command", "MK16_Transmitter"}; class Command { @@ -53,12 +53,12 @@ class CfgMagazines { }; class SatchelCharge_Remote_Mag: CA_Magazine { - ACE_Placeable = 1; + GVAR(Placeable) = 1; useAction = 0; - ACE_SetupObject = "ACE_Explosives_Place_SatchelCharge"; - ACE_DelayTime = 1; + GVAR(SetupObject) = "ACE_Explosives_Place_SatchelCharge"; + GVAR(DelayTime) = 1; class ACE_Triggers { - SupportedTriggers[] = {"Timer","Command", "MK16_Transmitter", "DeadmanSwitch"}; + SupportedTriggers[] = {"Timer", "Command", "MK16_Transmitter", "DeadmanSwitch"}; class Timer { FuseTime = 0.5; }; @@ -70,89 +70,95 @@ class CfgMagazines { }; }; class DemoCharge_Remote_Mag: SatchelCharge_Remote_Mag { - ACE_SetupObject = "ACE_Explosives_Place_DemoCharge"; + GVAR(SetupObject) = "ACE_Explosives_Place_DemoCharge"; model = "\A3\Weapons_F\explosives\c4_charge_small_d"; }; class SLAMDirectionalMine_Wire_Mag: ATMine_Range_Mag { - ACE_SetupObject = "ACE_Explosives_Place_SLAM"; + GVAR(SetupObject) = "ACE_Explosives_Place_SLAM"; class ACE_Triggers { - SupportedTriggers[] = {"IRSensor","PressurePlate","Timer","Command"}; + SupportedTriggers[] = {"IRSensor", "PressurePlate", "Timer", "Command", "MK16_Transmitter"}; class PressurePlate{ displayName = CSTRING(SLAME_Magnetic); digDistance = 0; - ammo = "SLAMDirectionalMine_Magnetic_Ammo"; + ammo = "ACE_SLAMDirectionalMine_Magnetic_Ammo"; pitch = 90; }; class IRSensor{ displayName = CSTRING(SLAME_IRSensor); }; class Timer { - ammo = "SLAMDirectionalMine_Timer_Ammo"; + ammo = "ACE_SLAMDirectionalMine_Timer_Ammo"; }; class Command { - ammo = "SLAMDirectionalMine_Command_Ammo"; + ammo = "ACE_SLAMDirectionalMine_Command_Ammo"; fuseTime = 0.5; }; + class MK16_Transmitter: Command {}; }; }; class IEDUrbanBig_Remote_Mag: DemoCharge_Remote_Mag { - ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanBig"; + GVAR(SetupObject) = "ACE_Explosives_Place_IEDUrbanBig"; class ACE_Triggers { SupportedTriggers[] = {"Command", "DeadmanSwitch", "Cellphone", "PressurePlate"}; class Command { FuseTime = 0.5; - ammo = "IEDUrbanBig_Command_Ammo"; - }; - class DeadmanSwitch:Command {}; - class Cellphone:Command {}; - class PressurePlate { - displayName = CSTRING(PressurePlate); - digDistance = 0; - ammo = "IEDUrbanBig_Range_Ammo"; - pitch = 0; - }; - }; - }; - - class IEDLandBig_Remote_Mag: IEDUrbanBig_Remote_Mag { - ACE_SetupObject = "ACE_Explosives_Place_IEDLandBig"; - class ACE_Triggers: ACE_Triggers { - class Command: Command { - ammo = "IEDLandBig_Command_Ammo"; - }; - class PressurePlate: PressurePlate { - ammo = "IEDLandBig_Range_Ammo"; - }; - }; - }; - class IEDUrbanSmall_Remote_Mag: DemoCharge_Remote_Mag { - ACE_SetupObject = "ACE_Explosives_Place_IEDUrbanSmall"; - class ACE_Triggers { - SupportedTriggers[] = {"Command", "DeadmanSwitch", "Cellphone", "PressurePlate"}; - class Command { - FuseTime = 0.5; - ammo = "IEDUrbanSmall_Command_Ammo"; + ammo = "ACE_IEDUrbanBig_Command_Ammo"; }; class DeadmanSwitch: Command {}; class Cellphone: Command {}; class PressurePlate { displayName = CSTRING(PressurePlate); digDistance = 0; - ammo = "IEDUrbanSmall_Range_Ammo"; + ammo = "ACE_IEDUrbanBig_Range_Ammo"; + pitch = 0; + }; + }; + }; + class IEDLandBig_Remote_Mag: IEDUrbanBig_Remote_Mag { + GVAR(SetupObject) = "ACE_Explosives_Place_IEDLandBig"; + picture = "\A3\Weapons_F\Data\UI\gear_mine_AT_CA.paa"; // Fix inconsistent picture + class ACE_Triggers: ACE_Triggers { + class Command: Command { + ammo = "ACE_IEDLandBig_Command_Ammo"; + }; + class DeadmanSwitch: Command {}; + class Cellphone: Command {}; + class PressurePlate: PressurePlate { + ammo = "ACE_IEDLandBig_Range_Ammo"; + }; + }; + }; + class IEDUrbanSmall_Remote_Mag: DemoCharge_Remote_Mag { + GVAR(SetupObject) = "ACE_Explosives_Place_IEDUrbanSmall"; + picture = "\A3\Weapons_F\Data\UI\gear_mine_AP_bouncing_CA.paa"; // Fix inconsistent picture + class ACE_Triggers { + SupportedTriggers[] = {"Command", "DeadmanSwitch", "Cellphone", "PressurePlate"}; + class Command { + FuseTime = 0.5; + ammo = "ACE_IEDUrbanSmall_Command_Ammo"; + }; + class DeadmanSwitch: Command {}; + class Cellphone: Command {}; + class PressurePlate { + displayName = CSTRING(PressurePlate); + digDistance = 0; + ammo = "ACE_IEDUrbanSmall_Range_Ammo"; pitch = 0; }; }; }; class IEDLandSmall_Remote_Mag: IEDUrbanSmall_Remote_Mag { - ACE_SetupObject = "ACE_Explosives_Place_IEDLandSmall"; + GVAR(SetupObject) = "ACE_Explosives_Place_IEDLandSmall"; class ACE_Triggers: ACE_Triggers { class Command: Command { - ammo = "IEDLandSmall_Command_Ammo"; + ammo = "ACE_IEDLandSmall_Command_Ammo"; }; + class DeadmanSwitch: Command {}; + class Cellphone: Command {}; class PressurePlate: PressurePlate { - ammo = "IEDLandSmall_Range_Ammo"; + ammo = "ACE_IEDLandSmall_Range_Ammo"; }; }; }; diff --git a/addons/explosives/CfgVehicles.hpp b/addons/explosives/CfgVehicles.hpp index 24de2f5a44..9be3a936e5 100644 --- a/addons/explosives/CfgVehicles.hpp +++ b/addons/explosives/CfgVehicles.hpp @@ -10,17 +10,8 @@ class CfgVehicles { showDisabled = 1; priority = 4; icon = PATHTOF(UI\Explosives_Menu_ca.paa); + insertChildren = QUOTE([_player] call FUNC(addTransmitterActions);); //Sub-menu items - class ACE_Detonate { - displayName = CSTRING(Detonate); - condition = QUOTE([_player] call FUNC(canDetonate)); - statement = ""; - insertChildren = QUOTE([_player] call FUNC(addTransmitterActions);); - exceptions[] = {"isNotSwimming", "isNotInside", "isNotSitting"}; - showDisabled = 1; - icon = PATHTOF(UI\Explosives_Menu_ca.paa); - priority = 2; - }; class ACE_Place { displayName = CSTRING(Place); condition = QUOTE((vehicle _player == _player) and {[_player] call FUNC(hasExplosives)}); @@ -117,7 +108,7 @@ class CfgVehicles { }; }; - class ACE_Explosives_Place_DemoCharge:ACE_Explosives_Place { + class ACE_Explosives_Place_DemoCharge: ACE_Explosives_Place { displayName = "Demo Charge"; model = "\A3\Weapons_F\explosives\c4_charge_small_d"; class ACE_Actions: ACE_Actions { @@ -126,15 +117,15 @@ class CfgVehicles { }; }; }; - class ACE_Explosives_Place_APERSBoundingMine:ACE_Explosives_Place { + class ACE_Explosives_Place_APERSBoundingMine: ACE_Explosives_Place { displayName = "APERS Bounding Mine"; model = "\A3\Weapons_F\explosives\mine_AP_bouncing"; }; - class ACE_Explosives_Place_APERSMine:ACE_Explosives_Place { + class ACE_Explosives_Place_APERSMine: ACE_Explosives_Place { displayName = "APERS Mine"; model = "\A3\Weapons_F\explosives\mine_ap"; }; - class ACE_Explosives_Place_APERSTripwireMine:ACE_Explosives_Place { + class ACE_Explosives_Place_APERSTripwireMine: ACE_Explosives_Place { displayName = "APERS Tripwire Mine"; model = "\A3\Weapons_F\explosives\mine_AP_tripwire"; class ACE_Actions: ACE_Actions { @@ -144,12 +135,12 @@ class CfgVehicles { }; }; - class ACE_Explosives_Place_ATMine:ACE_Explosives_Place { + class ACE_Explosives_Place_ATMine: ACE_Explosives_Place { displayName = "AT Mine"; model = "\A3\Weapons_f\Explosives\mine_at"; }; - class ACE_Explosives_Place_Claymore:ACE_Explosives_Place { + class ACE_Explosives_Place_Claymore: ACE_Explosives_Place { displayName = "Claymore"; model = "\A3\Weapons_F\explosives\mine_AP_miniclaymore"; class ACE_Actions: ACE_Actions { @@ -159,7 +150,7 @@ class CfgVehicles { }; }; - class ACE_Explosives_Place_SatchelCharge:ACE_Explosives_Place { + class ACE_Explosives_Place_SatchelCharge: ACE_Explosives_Place { displayName = "Satchel Charge"; model = "\A3\Weapons_F\Explosives\satchel"; class ACE_Actions: ACE_Actions { @@ -169,28 +160,28 @@ class CfgVehicles { }; }; - class ACE_Explosives_Place_SLAM:ACE_Explosives_Place { + class ACE_Explosives_Place_SLAM: ACE_Explosives_Place { displayName = "SLAM"; model = "\A3\Weapons_F\Explosives\mine_SLAM_directional"; }; // IEDs - class ACE_Explosives_Place_IEDUrbanBig:ACE_Explosives_Place { + class ACE_Explosives_Place_IEDUrbanBig: ACE_Explosives_Place { displayName = "IED Urban Big"; model = "\A3\Weapons_F\Explosives\IED_urban_big"; }; - class ACE_Explosives_Place_IEDLandBig:ACE_Explosives_Place { + class ACE_Explosives_Place_IEDLandBig: ACE_Explosives_Place { displayName = "IED Land Big"; model = "\A3\Weapons_F\Explosives\IED_land_big"; }; - class ACE_Explosives_Place_IEDUrbanSmall:ACE_Explosives_Place { + class ACE_Explosives_Place_IEDUrbanSmall: ACE_Explosives_Place { displayName = "IED Urban Small"; model = "\A3\Weapons_F\Explosives\IED_urban_small"; }; - class ACE_Explosives_Place_IEDLandSmall:ACE_Explosives_Place { + class ACE_Explosives_Place_IEDLandSmall: ACE_Explosives_Place { displayName = "IED Land Small"; model = "\A3\Weapons_F\Explosives\IED_land_small"; }; @@ -338,4 +329,77 @@ class CfgVehicles { class O_Soldier_sniper_base_F; class O_sniper_F: O_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; class O_spotter_F: O_Soldier_sniper_base_F {MACRO_ADDCLAYMOREKIT}; + + // Editor placed mines + class MineBase; + class SLAMDirectionalMine: MineBase { + displayName = CSTRING(Module_SLAMSideAttack_DisplayName); + }; + class ACE_SLAMBottomMine: SLAMDirectionalMine { + author = ECSTRING(common,aceteam); + ammo = "ACE_SLAMDirectionalMine_Magnetic_Ammo"; + displayName = CSTRING(Module_SLAMBottomAttack_DisplayName); + // TODO: Find a way to place the mine laying down instead of standing up + }; + + class IEDUrbanBig_F; + class ACE_IEDUrbanBig_Range: IEDUrbanBig_F { + author = ECSTRING(common,aceteam); + ammo = "ACE_IEDUrbanBig_Range_Ammo"; + displayName = CSTRING(Module_IEDUrbanBig_Range_DisplayName); + }; + class IEDLandBig_F; + class ACE_IEDLandBig_Range: IEDLandBig_F { + author = ECSTRING(common,aceteam); + ammo = "ACE_IEDLandBig_Range_Ammo"; + displayName = CSTRING(Module_IEDLandBig_Range_DisplayName); + }; + class IEDUrbanSmall_F; + class ACE_IEDUrbanSmall_Range: IEDUrbanSmall_F { + author = ECSTRING(common,aceteam); + ammo = "ACE_IEDUrbanSmall_Range_Ammo"; + displayName = CSTRING(Module_IEDUrbanSmall_Range_DisplayName); + }; + class IEDLandSmall_F; + class ACE_IEDLandSmall_Range: IEDLandSmall_F { + author = ECSTRING(common,aceteam); + ammo = "ACE_IEDLandSmall_Range_Ammo"; + displayName = CSTRING(Module_IEDLandSmall_Range_DisplayName); + }; + + // Zeus placed mines + class ModuleMine_F; + class ModuleMine_SLAMDirectionalMine_F: ModuleMine_F { + displayName = CSTRING(Module_SLAMSideAttack_DisplayName); + }; + class ACE_ModuleMine_SLAMBottomMine: ModuleMine_SLAMDirectionalMine_F { + author = ECSTRING(common,aceteam); + displayName = CSTRING(Module_SLAMBottomAttack_DisplayName); + explosive = "ACE_SLAMDirectionalMine_Magnetic_Ammo"; + icon = "iconExplosiveGP"; + }; + class ModuleExplosive_IEDUrbanBig_F; + class ACE_ModuleExplosive_IEDUrbanBig_Range: ModuleExplosive_IEDUrbanBig_F { + author = ECSTRING(common,aceteam); + displayName = CSTRING(Module_IEDUrbanBig_Range_DisplayName); + explosive = "ACE_IEDUrbanBig_Range_Ammo"; + }; + class ModuleExplosive_IEDLandBig_F; + class ACE_ModuleExplosive_IEDLandBig_Range: ModuleExplosive_IEDLandBig_F { + author = ECSTRING(common,aceteam); + displayName = CSTRING(Module_IEDLandBig_Range_DisplayName); + explosive = "ACE_IEDLandBig_Range_Ammo"; + }; + class ModuleExplosive_IEDUrbanSmall_F; + class ACE_ModuleExplosive_IEDUrbanSmall_Range: ModuleExplosive_IEDUrbanSmall_F { + author = ECSTRING(common,aceteam); + displayName = CSTRING(Module_IEDUrbanSmall_Range_DisplayName); + explosive = "ACE_IEDUrbanSmall_Range_Ammo"; + }; + class ModuleExplosive_IEDLandSmall_F; + class ACE_ModuleExplosive_IEDLandSmall_Range: ModuleExplosive_IEDLandSmall_F { + author = ECSTRING(common,aceteam); + displayName = CSTRING(Module_IEDLandSmall_Range_DisplayName); + explosive = "ACE_IEDLandSmall_Range_Ammo"; + }; }; diff --git a/addons/explosives/CfgWeapons.hpp b/addons/explosives/CfgWeapons.hpp index f6ee8ec65e..cd900b2da3 100644 --- a/addons/explosives/CfgWeapons.hpp +++ b/addons/explosives/CfgWeapons.hpp @@ -13,8 +13,9 @@ class CfgWeapons { descriptionShort = CSTRING(clacker_description); picture = PATHTOF(Data\UI\Clacker.paa); model = QUOTE(PATHTOF(data\ace_m57.p3d)); - ACE_Range = 250; - ACE_Detonator = 1; + GVAR(Range) = 250; + GVAR(Detonator) = 1; + GVAR(triggerType) = "Command"; class ItemInfo: ACE_ExplosiveItem { mass = 3; @@ -22,9 +23,10 @@ class CfgWeapons { }; }; class ACE_M26_Clacker: ACE_Clacker { - displayName = CSTRING(M26_displayName); + displayName = CSTRING(M152_Clacker_displayName); picture = PATHTOF(Data\UI\MK26_Transmitter_ca.paa); - ACE_Range = 5000; + GVAR(Range) = 5000; + GVAR(triggerType) = "MK16_Transmitter"; }; class ACE_DefusalKit: ACE_ItemCore { scope = 2; @@ -44,8 +46,9 @@ class CfgWeapons { descriptionShort = CSTRING(DeadManSwitch_description); picture = PATHTOF(Data\UI\DeadmanSwitch.paa); model = "\A3\weapons_F\ammo\mag_univ.p3d"; - ACE_Range = 100; - ACE_Detonator = 1; + GVAR(Range) = 100; + GVAR(Detonator) = 1; + GVAR(triggerType) = "DeadManSwitch"; class ItemInfo: ACE_ExplosiveItem { mass = 2; @@ -58,8 +61,9 @@ class CfgWeapons { descriptionShort = CSTRING(cellphone_description); picture = PATHTOF(Data\UI\Cellphone_UI.paa); model = "\A3\weapons_F\ammo\mag_univ.p3d"; - ACE_Range = 15000; - ACE_Detonator = 1; + GVAR(Range) = 15000; + GVAR(Detonator) = 1; + GVAR(triggerType) = "Cellphone"; class ItemInfo: ACE_ExplosiveItem { mass = 2; diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index af105b5879..651f704a6a 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -36,6 +36,16 @@ GVAR(Setup) = objNull; GVAR(pfeh_running) = false; GVAR(CurrentSpeedDial) = 0; +// Properly angle preplaced bottom-attack SLAMs +{ + if (local _x) then { + switch (typeOf _x) do { + case ("ACE_SLAMDirectionalMine_Magnetic_Ammo"): { + [_x, getDir _x, 90] call FUNC(setPosition); + }; + }; + }; +} forEach allMines; ["interactMenuOpened", { //Cancel placement if interact menu opened diff --git a/addons/explosives/XEH_preInit.sqf b/addons/explosives/XEH_preInit.sqf index fec63776ff..1facffccb3 100644 --- a/addons/explosives/XEH_preInit.sqf +++ b/addons/explosives/XEH_preInit.sqf @@ -26,6 +26,7 @@ PREP(addTransmitterActions); PREP(addTriggerActions); PREP(canDefuse); PREP(canDetonate); +PREP(connectExplosive); PREP(defuseExplosive); PREP(detonateExplosive); PREP(detonateExplosiveAll); @@ -53,6 +54,7 @@ PREP(openTimerSetUI); PREP(placeExplosive); PREP(removeFromSpeedDial); +PREP(scriptedExplosive); PREP(selectTrigger); PREP(setupExplosive); PREP(setPosition); diff --git a/addons/explosives/config.cpp b/addons/explosives/config.cpp index 99544213d3..3fc047fa6a 100644 --- a/addons/explosives/config.cpp +++ b/addons/explosives/config.cpp @@ -2,7 +2,7 @@ class CfgPatches { class ADDON { - units[] = {}; + units[] = {"ACE_ModuleMine_SLAMBottomMine", "ACE_ModuleExplosive_IEDUrbanBig_Range", "ACE_ModuleExplosive_IEDLandBig_Range", "ACE_ModuleExplosive_IEDUrbanSmall_Range", "ACE_ModuleExplosive_IEDLandSmall_Range"}; weapons[] = {"ACE_Clacker", "ACE_DefusalKit", "ACE_M26_Clacker", "ACE_DeadManSwitch", "ACE_Cellphone"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interaction"}; @@ -37,7 +37,7 @@ class CfgActions { class CfgMineTriggers { class RangeTrigger; - class MagneticTrigger: RangeTrigger { + class ACE_MagneticTrigger: RangeTrigger { mineMagnetic = 1; mineTriggerRange = 1; }; diff --git a/addons/explosives/functions/fnc_addDetonateActions.sqf b/addons/explosives/functions/fnc_addDetonateActions.sqf index 2af4d6e772..0d09284d52 100644 --- a/addons/explosives/functions/fnc_addDetonateActions.sqf +++ b/addons/explosives/functions/fnc_addDetonateActions.sqf @@ -21,7 +21,7 @@ TRACE_2("params",_unit,_detonator); private ["_result", "_item", "_children", "_range", "_required","_explosivesList"]; -_range = getNumber (ConfigFile >> "CfgWeapons" >> _detonator >> "ACE_Range"); +_range = getNumber (ConfigFile >> "CfgWeapons" >> _detonator >> QGVAR(Range)); _result = [_unit] call FUNC(getPlacedExplosives); _children = []; diff --git a/addons/explosives/functions/fnc_addExplosiveActions.sqf b/addons/explosives/functions/fnc_addExplosiveActions.sqf index fa00fdd207..e744af6bce 100644 --- a/addons/explosives/functions/fnc_addExplosiveActions.sqf +++ b/addons/explosives/functions/fnc_addExplosiveActions.sqf @@ -22,7 +22,7 @@ _list = []; _itemCount = []; { _item = ConfigFile >> "CfgMagazines" >> _x; - if (getNumber(_item >> "ACE_Placeable") == 1) then { + if (getNumber(_item >> QGVAR(Placeable)) == 1) then { _index = _list find _item; if (_index != -1) then { _itemCount set [_index, (_itemCount select _index) + 1]; diff --git a/addons/explosives/functions/fnc_connectExplosive.sqf b/addons/explosives/functions/fnc_connectExplosive.sqf new file mode 100644 index 0000000000..aab7ca2c4d --- /dev/null +++ b/addons/explosives/functions/fnc_connectExplosive.sqf @@ -0,0 +1,27 @@ +/* + * Author: VKing + * Add preplaced explosives to a unit's detonator. + * + * Arguments: + * 0: Unit + * 1: Explosive object + * 2: Detonator type + * + * Return Value: + * None + * + * Example: + * [player, claymore1, "ACE_Clacker"] call ace_explosives_fnc_connectExplosive + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_unit", "_object", "_detonator"]; +TRACE_3("Params",_unit,_object,_detonator); + +private _detonatorConfig = getText (configFile >> "CfgWeapons" >> _detonator >> QGVAR(triggerType)); + +private _magazineClass = getText (configFile >> "CfgAmmo" >> typeOf _object >> QGVAR(magazine)); + +[_unit, _object, _magazineClass, [configFile >> "ACE_Triggers" >> _detonatorConfig]] call FUNC(addClacker); diff --git a/addons/explosives/functions/fnc_defuseExplosive.sqf b/addons/explosives/functions/fnc_defuseExplosive.sqf index 0af28788b3..147d722987 100644 --- a/addons/explosives/functions/fnc_defuseExplosive.sqf +++ b/addons/explosives/functions/fnc_defuseExplosive.sqf @@ -19,9 +19,11 @@ params ["_unit", "_explosive"]; TRACE_2("params",_unit,_explosive); -if (GVAR(ExplodeOnDefuse) && {(random 1.0) < (getNumber (ConfigFile >> "CfgAmmo" >> typeOf _explosive >> "ACE_explodeOnDefuse"))}) exitWith { +if (GVAR(ExplodeOnDefuse) && {(random 1.0) < (getNumber (ConfigFile >> "CfgAmmo" >> typeOf _explosive >> QGVAR(explodeOnDefuseChance)))}) exitWith { TRACE_1("exploding on defuse",_explosive); [_unit, -1, [_explosive, 1], true] call FUNC(detonateExplosive); + [QGVAR(explodeOnDefuse), [_explosive, _unit]] call EFUNC(common,globalEvent); }; _unit action ["Deactivate", _unit, _explosive]; +[QGVAR(defuse), [_explosive, _unit]] call EFUNC(common,globalEvent); diff --git a/addons/explosives/functions/fnc_detonateExplosive.sqf b/addons/explosives/functions/fnc_detonateExplosive.sqf index d204ad7bad..a01f181635 100644 --- a/addons/explosives/functions/fnc_detonateExplosive.sqf +++ b/addons/explosives/functions/fnc_detonateExplosive.sqf @@ -33,7 +33,7 @@ if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {TRA if (getNumber (ConfigFile >> "CfgAmmo" >> typeOf (_item select 0) >> "TriggerWhenDestroyed") == 0) then { private ["_exp", "_previousExp"]; _previousExp = _item select 0; - _exp = getText (ConfigFile >> "CfgAmmo" >> typeOf (_previousExp) >> "ACE_Explosive"); + _exp = getText (ConfigFile >> "CfgAmmo" >> typeOf (_previousExp) >> QGVAR(Explosive)); if (_exp != "") then { _exp = createVehicle [_exp, [0,0,15001], [], 0, "NONE"]; _exp setDir (getDir _previousExp); diff --git a/addons/explosives/functions/fnc_getDetonators.sqf b/addons/explosives/functions/fnc_getDetonators.sqf index 54c942e9de..22360c875e 100644 --- a/addons/explosives/functions/fnc_getDetonators.sqf +++ b/addons/explosives/functions/fnc_getDetonators.sqf @@ -26,7 +26,7 @@ _result = []; { _config = ConfigFile >> "CfgWeapons" >> _x; - if (getNumber (_config >> "ACE_Detonator") == 1 && {!(_x in _result)}) then { + if (getNumber (_config >> QGVAR(Detonator)) == 1 && {!(_x in _result)}) then { _result pushBack _x; }; } forEach _items; diff --git a/addons/explosives/functions/fnc_hasExplosives.sqf b/addons/explosives/functions/fnc_hasExplosives.sqf index 4a626e9c63..c9da5e59d1 100644 --- a/addons/explosives/functions/fnc_hasExplosives.sqf +++ b/addons/explosives/functions/fnc_hasExplosives.sqf @@ -23,7 +23,7 @@ private ["_result", "_magazines"]; _result = false; _magazines = magazines _unit; { - if (getNumber (ConfigFile >> "CfgMagazines" >> _x >> "ACE_Placeable") == 1) exitWith { + if (getNumber (ConfigFile >> "CfgMagazines" >> _x >> QGVAR(Placeable)) == 1) exitWith { _result = true; }; } count _magazines; diff --git a/addons/explosives/functions/fnc_onInventoryChanged.sqf b/addons/explosives/functions/fnc_onInventoryChanged.sqf index 127cd8c105..889e9e2186 100644 --- a/addons/explosives/functions/fnc_onInventoryChanged.sqf +++ b/addons/explosives/functions/fnc_onInventoryChanged.sqf @@ -26,7 +26,7 @@ private ["_config", "_detonators"]; if (_receiver != ace_player) exitWith {}; _config = ConfigFile >> "CfgWeapons" >> _item; -if (isClass _config && {getNumber(_config >> "ACE_Detonator") == 1}) then { +if (isClass _config && {getNumber(_config >> QGVAR(Detonator)) == 1}) then { private ["_clackerItems"]; _clackerItems = _giver getVariable [QGVAR(Clackers), []]; _receiver setVariable [QGVAR(Clackers), (_receiver getVariable [QGVAR(Clackers), []]) + _clackerItems, true]; diff --git a/addons/explosives/functions/fnc_placeExplosive.sqf b/addons/explosives/functions/fnc_placeExplosive.sqf index e1cdbcd80c..83cdb2fef8 100644 --- a/addons/explosives/functions/fnc_placeExplosive.sqf +++ b/addons/explosives/functions/fnc_placeExplosive.sqf @@ -94,7 +94,7 @@ if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_tr _pitch = getNumber (_magazineTrigger >> "pitch"); -//Globaly set the position angle: -[QGVAR(place), [_explosive, _dir, _pitch]] call EFUNC(common,globalEvent); +//Globaly set the position and angle: +[QGVAR(place), [_explosive, _dir, _pitch, _unit]] call EFUNC(common,globalEvent); _explosive diff --git a/addons/explosives/functions/fnc_scriptedExplosive.sqf b/addons/explosives/functions/fnc_scriptedExplosive.sqf new file mode 100644 index 0000000000..b4abb204b3 --- /dev/null +++ b/addons/explosives/functions/fnc_scriptedExplosive.sqf @@ -0,0 +1,27 @@ +/* + * Author: VKing + * Detonate explosives via script, for use in triggers or mission scripts to + * detonate editor-placed explosives. + * + * Arguments: + * 0: Explosives objects to detonate + * 1: Fuze delay (for each explosive; use negative number for random time up to value) + * + * Return Value: + * None + * + * Example: + * [[charge1, charge2, charge3], -1] call ACE_Explosives_fnc_scriptedExplosive; + * [[claymore1, claymore2]] call ACE_Explosives_fnc_scriptedExplosive; + * + * Public: Yes + */ +#include "script_component.hpp" + +params ["_explosiveArr",["_fuzeTime",0]]; + +private _detTime; +{ + _detTime = if (_fuzeTime < 0) then {random abs _fuzeTime} else {_fuzeTime}; + [objNull, -1, [_x, _detTime]] call FUNC(detonateExplosive); +} forEach _explosiveArr; diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index b104761fac..b1fdf7216b 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -27,12 +27,12 @@ TRACE_3("params",_vehicle,_unit,_magClassname); private["_isAttachable", "_setupObjectClass", "_supportedTriggers", "_p3dModel"]; //Get setup object vehicle and model: -_setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> "ACE_SetupObject"); +_setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> QGVAR(SetupObject)); if (!isClass (configFile >> "CfgVehicles" >> _setupObjectClass)) exitWith {ERROR("Bad Vehicle");}; _p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model"); if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game! -[_unit, "ACE_Explosives", true] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Explosives", true] call EFUNC(common,statusEffect_set); //Show mouse buttons: [localize LSTRING(PlaceAction), localize LSTRING(CancelAction), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint); @@ -152,7 +152,7 @@ GVAR(TweakedAngle) = 0; [_pfID] call CBA_fnc_removePerFrameHandler; GVAR(pfeh_running) = false; - [_unit, "ACE_Explosives", false] call EFUNC(common,setForceWalkStatus); + [_unit, "forceWalk", "ACE_Explosives", false] call EFUNC(common,statusEffect_set); [] call EFUNC(interaction,hideMouseHint); [_unit, "DefaultAction", (_unit getVariable [QGVAR(placeActionEH), -1])] call EFUNC(common,removeActionEventHandler); [_unit, "zoomtemp", (_unit getVariable [QGVAR(cancelActionEH), -1])] call EFUNC(common,removeActionEventHandler); diff --git a/addons/explosives/functions/fnc_startDefuse.sqf b/addons/explosives/functions/fnc_startDefuse.sqf index 2c394a997a..84d7274069 100644 --- a/addons/explosives/functions/fnc_startDefuse.sqf +++ b/addons/explosives/functions/fnc_startDefuse.sqf @@ -28,8 +28,8 @@ _fnc_DefuseTime = { TRACE_2("defuseTime",_specialist,_target); private ["_defuseTime"]; _defuseTime = 5; - if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime")) then { - _defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> "ACE_DefuseTime"); + if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> QGVAR(DefuseTime))) then { + _defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> QGVAR(DefuseTime)); }; if (!_specialist && {GVAR(PunishNonSpecialists)}) then { _defuseTime = _defuseTime * 1.5; diff --git a/addons/explosives/script_component.hpp b/addons/explosives/script_component.hpp index 17de3516a5..86eefd72b6 100644 --- a/addons/explosives/script_component.hpp +++ b/addons/explosives/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_EXPLOSIVES #define DEBUG_MODE_FULL diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index 166428f3d4..83af057d7c 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -14,34 +14,35 @@ Взрывчатка - Place >> - Platzieren >> - Colocar >> - Umieść >> - Placer >> - Položit >> - Piazza >> - Elhelyezés >> - Colocar >> - Установить >> + Place + Platzieren + Colocar + Umieść + Placer + Položit + Piazza + Elhelyezés + Colocar + Установить - Detonate >> - Zünden >> - Detonar >> - Detonuj >> - Mise à feu >> - Odpálit >> - Detona >> - Robbantás >> - Detonar >> - Подрыв >> + Detonate + Zünden + Detonar + Detonuj + Mise à feu + Odpálit + Detona + Robbantás + Detonar + Подрыв Detonate All Zünden Alles Detonar Todo Подрыв всех + Odpálit VŠE Explosive code: %1 @@ -183,19 +184,19 @@ Usado para acionar explosivos remotamente Используется для удаленной детонации зарядов - - M26 Firing Device - M26 Zündvorrichtung - Dispositivo de detonación MK26 - Zapalnik M26 - Dispositif de mise à feu M26 - Odpalovací zařízení M26 - Detonatore M26 - M26 Gyújtóeszköz - M26 Dispositivo de Detonação - Взрыватель M26 + + M152 Firing Device + M152 Zündvorrichtung + Dispositivo de detonación M152 + Zapalnik M152 + Dispositif de mise à feu M152 + Odpalovací zařízení M152 + Detonatore M152 + M152 Gyújtóeszköz + M152 Dispositivo de Detonação + Взрыватель M152 - + M152 RAMS M152 RAMS M152 RAMS @@ -309,7 +310,7 @@ Menú de detonación Menu detonacji Menu de mise à feux - Menu Detonace + Menu detonace Menù di detonazione Robbantási menü Menu de detonação @@ -321,7 +322,7 @@ Menú de colocación Menu umieszczania Menu de placement - Menu Umístění + Menu umístění Menù di collocamento Elhelyezési menü Menu de posicionamento @@ -381,7 +382,7 @@ Configurar tiempo Ustaw czas Régler minuteur - Nastavit Čas + Nastavit čas Modifica il conto alla rovescia Idő beállítása Configurar Tempo @@ -393,7 +394,7 @@ Seleccionar un detonador Wybierz zapalnik Sélectionner une mise à feu - Zvolit Detonátor + Zvolit detonátor Seleziona un attivatore Gyújtóeszköz kiválasztása Selecionar um Gatilho @@ -619,5 +620,71 @@ Этот модуль управляет настройками, связанными со взрывными устройствами Este módulo ajusta las configuraciones relacionadas con explosivos. + + M6 SLAM Mine (Bottom Attack) + + + + + + + + + + + M6 SLAM Mine (Side Attack) + + + + + + + + + + + Large IED (Urban, Pressure Plate) + + + + + + + + + + + Large IED (Dug-in, Pressure Plate) + + + + + + + + + + + Small IED (Urban, Pressure Plate) + + + + + + + + + + + Small IED (Dug-in, Pressure Plate) + + + + + + + + + - + \ No newline at end of file diff --git a/addons/fcs/CfgVehicles.hpp b/addons/fcs/CfgVehicles.hpp index f1b896c612..45051c912d 100644 --- a/addons/fcs/CfgVehicles.hpp +++ b/addons/fcs/CfgVehicles.hpp @@ -8,7 +8,7 @@ class CfgVehicles { class NewTurret { GVAR(Enabled) = 0; GVAR(MinDistance) = 200; - GVAR(MaxDistance) = 9990; + GVAR(MaxDistance) = 5500; GVAR(DistanceInterval) = 5; class Turrets; }; @@ -86,9 +86,14 @@ class CfgVehicles { class MRAP_01_base_F: Car_F {}; class MRAP_01_gmg_base_F: MRAP_01_base_F { - /*class Turrets: Turrets { - class MainTurret: MainTurret {}; - };*/ + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; }; class MRAP_01_hmg_base_F: MRAP_01_gmg_base_F { @@ -104,9 +109,14 @@ class CfgVehicles { class MRAP_02_base_F: Car_F {}; class MRAP_02_hmg_base_F: MRAP_02_base_F { - /*class Turrets: Turrets { - class MainTurret: MainTurret {}; - };*/ + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; }; class MRAP_02_gmg_base_F: MRAP_02_hmg_base_F { @@ -120,16 +130,24 @@ class CfgVehicles { }; class MRAP_03_base_F: Car_F { - /*class Turrets: Turrets { - class CommanderTurret: MainTurret {}; - };*/ + class Turrets: Turrets { + class CommanderTurret: MainTurret { + GVAR(Enabled) = 0; + }; + }; }; class MRAP_03_hmg_base_F: MRAP_03_base_F { - /*class Turrets: Turrets { - class MainTurret: MainTurret {}; - class CommanderTurret: CommanderTurret {}; - };*/ + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0;}; + class CommanderTurret: CommanderTurret { + GVAR(Enabled) = 0; + }; + }; }; class MRAP_03_gmg_base_F: MRAP_03_hmg_base_F { @@ -162,13 +180,16 @@ class CfgVehicles { }; class APC_Wheeled_02_base_F: Wheeled_APC_F { - /*class Turrets: Turrets { + class Turrets: Turrets { class MainTurret: MainTurret { - class Turrets; + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; }; - class CommanderOptics: CommanderOptics {}; - };*/ + // class CommanderOptics: CommanderOptics {}; + }; }; class APC_Wheeled_03_base_F: Wheeled_APC_F { @@ -210,7 +231,10 @@ class CfgVehicles { class B_APC_Tracked_01_rcws_F: B_APC_Tracked_01_base_F { class Turrets: Turrets { class MainTurret: MainTurret { - GVAR(Enabled) = 0; + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; }; class CommanderOptics: CommanderOptics {}; }; @@ -294,14 +318,36 @@ class CfgVehicles { class B_MBT_01_cannon_F: B_MBT_01_base_F {}; + class B_MBT_01_TUSK_F: B_MBT_01_cannon_F { + class Turrets: Turrets { + class MainTurret: MainTurret { + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + + class Turrets: Turrets { + class CommanderOptics: CommanderOptics { + GVAR(Enabled) = 1; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; + }; + }; + }; + class MBT_01_arty_base_F: MBT_01_base_F { class Turrets: Turrets { class MainTurret: MainTurret { GVAR(Enabled) = 0; - /*class Turrets: Turrets { - class CommanderOptics: CommanderOptics {}; - };*/ + class Turrets: Turrets { + class CommanderOptics: CommanderOptics { + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; }; }; }; @@ -337,9 +383,14 @@ class CfgVehicles { class MainTurret: MainTurret { GVAR(Enabled) = 0; - /*class Turrets: Turrets { - class CommanderOptics: CommanderOptics {}; - };*/ + class Turrets: Turrets { + class CommanderOptics: CommanderOptics { + GVAR(Enabled) = 1; + GVAR(MaxDistance) = 2000; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; }; }; }; @@ -361,25 +412,8 @@ class CfgVehicles { }; }; - class B_MBT_01_TUSK_F: B_MBT_01_cannon_F { - class Turrets: Turrets { - class MainTurret: MainTurret { - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - - class Turrets: Turrets { - class CommanderOptics: CommanderOptics { - GVAR(Enabled) = 1; - discreteDistance[] = {}; - discreteDistanceInitIndex = 0; - }; - }; - }; - }; - }; - // SHIPS - /*class Ship: AllVehicles { + class Ship: AllVehicles { class Turrets { class MainTurret; }; @@ -391,17 +425,20 @@ class CfgVehicles { class Boat_Armed_01_base_F: Boat_F { class Turrets: Turrets { - class FrontTurret; - class RearTurret: FrontTurret {}; + class FrontTurret: NewTurret { + GVAR(enabled) = 1; + GVAR(minDistance) = 100; + GVAR(maxDistance) = 2000; + GVAR(distanceInterval) = 5; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + class RearTurret: FrontTurret { + discreteDistance[] = {100,200,300,400,600,800,1000,1200}; // Originally inherited from FrontTurret + discreteDistanceInitIndex = 4; + }; }; - };*/ - - /*class Boat_Armed_01_minigun_base_F: Boat_Armed_01_base_F { - class Turrets: Turrets { - class FrontTurret: FrontTurret {}; - class RearTurret: RearTurret {}; - }; - };*/ + }; // AIR VEHICLES class Air: AllVehicles {}; @@ -529,8 +566,24 @@ class CfgVehicles { class Turrets: Turrets { class MainTurret: MainTurret { GVAR(Enabled) = 1; - GVAR(MinDistance) = 100; - GVAR(MaxDistance) = 1500; + GVAR(MinDistance) = 200; + GVAR(MaxDistance) = 2000; + GVAR(DistanceInterval) = 5; + discreteDistance[] = {}; + discreteDistanceInitIndex = 0; + }; + }; + }; + + class StaticGrenadeLauncher: StaticWeapon {}; + class GMG_TriPod: StaticGrenadeLauncher {}; + + class GMG_01_base_F: GMG_TriPod { + class Turrets: Turrets { + class MainTurret: MainTurret { + GVAR(Enabled) = 1; + GVAR(MinDistance) = 200; + GVAR(MaxDistance) = 2000; GVAR(DistanceInterval) = 5; discreteDistance[] = {}; discreteDistanceInitIndex = 0; diff --git a/addons/fcs/XEH_postInit.sqf b/addons/fcs/XEH_postInit.sqf index 8a8b379318..a4f8020a9f 100644 --- a/addons/fcs/XEH_postInit.sqf +++ b/addons/fcs/XEH_postInit.sqf @@ -16,4 +16,4 @@ if (!hasInterface) exitWith {}; }] call EFUNC(common,addEventHandler); // Register event for global updates -[QGVAR(forceUpdate), {ACE_player call FUNC(onForceUpdate)}] call EFUNC(common,addEventHandler); +[QGVAR(forceUpdate), {[ACE_player] call FUNC(onForceUpdate)}] call EFUNC(common,addEventHandler); diff --git a/addons/fcs/XEH_preInit.sqf b/addons/fcs/XEH_preInit.sqf index 2bcda4f464..c3fa171adf 100644 --- a/addons/fcs/XEH_preInit.sqf +++ b/addons/fcs/XEH_preInit.sqf @@ -3,6 +3,7 @@ ADDON = false; PREP(adjustRange); +PREP(calculateSolution); PREP(canResetFCS); PREP(canUseFCS); PREP(canUseRangefinder); diff --git a/addons/fcs/functions/fnc_calculateSolution.sqf b/addons/fcs/functions/fnc_calculateSolution.sqf new file mode 100644 index 0000000000..f59b4f6fbc --- /dev/null +++ b/addons/fcs/functions/fnc_calculateSolution.sqf @@ -0,0 +1,77 @@ +/* + * Author: VKing + * Calculate FCS solution + * + * Arguments: + * 0: Vehicle + * 1: Turret + * 2: Target distance + * 3: Azimuth offset + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp" +params ["_vehicle","_turret","_distance","_angleTarget"]; + +private _FCSMagazines = []; +private _FCSElevation = []; +private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); + +{ + private _magazine = _x; + private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); + + private _bulletSimulation = getText (configFile >> "CfgAmmo" >> _ammo >> "simulation"); + if !(_bulletSimulation == "shotMissile") then { + private _maxElev = getNumber (_turretConfig >> "maxElev"); + private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); + private _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction"); + + { + private _weapon = _x; + private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); + private _weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); + + { + if (_x != "this") then { + _weaponMagazines append getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); + }; + false + } count _muzzles; + + // Fix the `in` operator being case sensitive and BI fucking up the spelling of their own classnames + private _weaponMagazinesCheck = []; + { + _weaponMagazinesCheck pushBack (toLower _x); + } forEach _weaponMagazines; + + // Another BIS fix: ShotBullet simulation uses weapon initSpeed, others ignore it + if (toLower _magazine in _weaponMagazinesCheck && {_bulletSimulation == "shotBullet"}) exitWith { + private _initSpeedCoef = getNumber(configFile >> "CfgWeapons" >> _weapon >> "initSpeed"); + + if (_initSpeedCoef < 0) then { + _initSpeed = _initSpeed * -_initSpeedCoef; + }; + + if (_initSpeedCoef > 0) then { + _initSpeed = _initSpeedCoef; + }; + }; + false + } count (_vehicle weaponsTurret _turret); + + private _offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance]; + _offset = parseNumber _offset; + + _FCSMagazines pushBack _magazine; + _FCSElevation pushBack _offset; + }; + false +} count (_vehicle magazinesTurret _turret); + +[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines] call EFUNC(common,setVariablePublic); +[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic); diff --git a/addons/fcs/functions/fnc_getRange.sqf b/addons/fcs/functions/fnc_getRange.sqf index 51cdf564df..64619241c4 100644 --- a/addons/fcs/functions/fnc_getRange.sqf +++ b/addons/fcs/functions/fnc_getRange.sqf @@ -3,7 +3,10 @@ * Read laser distance measurement from engine. * * Argument: - * None + * 0: Measurement Accuracy (default: 1) + * 1: Maximum measure distance (default: 5000) + * 2: Minimum measure distance (default: 0) + * 3: Blank display on range error (default: false) * * Return value: * Measured distance @@ -12,7 +15,34 @@ */ #include "script_component.hpp" +params [["_accuracy",1], ["_maxDistance",5000], ["_minDistance",0], ["_blank",false]]; + disableSerialization; private _dlgRangefinder = uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]; -parseNumber ctrlText (_dlgRangefinder displayCtrl 151); +private _distance = parseNumber ctrlText (_dlgRangefinder displayCtrl 151); + +if (_distance == 0) then { + _distance = _this call EFUNC(common,getTargetDistance); +} else { + // Is distance out of bound? + _distance = _distance min _maxDistance; + _distance = _distance max _minDistance; + + // If don't let accuracy be less than 1 + _accuracy = _accuracy max 1; + _distance = (round (_distance/_accuracy)) * _accuracy; +}; + +// Change the display if the range is out of bounds +if (_distance >= _maxDistance || _distance <= _minDistance) then { + if (_blank) then { + (_dlgRangefinder displayCtrl 1713151) ctrlSetText "----"; + } else { + (_dlgRangefinder displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber) + "*"; + }; +} else { + (_dlgRangefinder displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber); +}; + +_distance diff --git a/addons/fcs/functions/fnc_keyDown.sqf b/addons/fcs/functions/fnc_keyDown.sqf index a34233bc91..e61baed136 100644 --- a/addons/fcs/functions/fnc_keyDown.sqf +++ b/addons/fcs/functions/fnc_keyDown.sqf @@ -15,17 +15,22 @@ params ["_vehicle", "_turret"]; -private _distance = call FUNC(getRange); -call (updateRangeHUD); +private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); + +// Update display for infantry rangefinders +if (_vehicle == ACE_player) exitWith {[5,5500,25,true] call FUNC(getRange)}; + +private _distance = [ + getNumber (_turretConfig >> QGVAR(DistanceInterval)), + getNumber (_turretConfig >> QGVAR(MaxDistance)), + getNumber (_turretConfig >> QGVAR(MinDistance)) +] call FUNC(getRange); if !(!GVAR(enabled) && FUNC(canUseFCS)) exitWith {}; GVAR(Enabled) = true; GVAR(time) = ACE_time; -if (_distance == 0) then { - _distance = [5, 5000, 0] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision -}; private _weaponDirection = _vehicle weaponDirection (_vehicle currentWeaponTurret _turret); // @todo doesn't work for sub turrets @@ -38,3 +43,5 @@ if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turr }; GVAR(Position) = (getPosASL _vehicle) vectorAdd (_weaponDirection vectorMultiply _distance); + +[_vehicle,_turret,_distance,0] call FUNC(calculateSolution); diff --git a/addons/fcs/functions/fnc_keyUp.sqf b/addons/fcs/functions/fnc_keyUp.sqf index ebbd6e3a06..919ac3a58e 100644 --- a/addons/fcs/functions/fnc_keyUp.sqf +++ b/addons/fcs/functions/fnc_keyUp.sqf @@ -17,20 +17,15 @@ params ["_vehicle", "_turret", "_distance", ["_showHint", false], ["_playSound", private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath); -call (updateRangeHUD); - if (isNil "_distance") then { - _distance = call FUNC(getRange); - - if (_distance == 0) then { - _distance = [ - getNumber (_turretConfig >> QGVAR(DistanceInterval)), - getNumber (_turretConfig >> QGVAR(MaxDistance)), - getNumber (_turretConfig >> QGVAR(MinDistance)) - ] call EFUNC(common,getTargetDistance); // maximum distance: 5000m, 5m precision - }; + _distance = [ + getNumber (_turretConfig >> QGVAR(DistanceInterval)), + getNumber (_turretConfig >> QGVAR(MaxDistance)), + getNumber (_turretConfig >> QGVAR(MinDistance)) + ] call FUNC(getRange); }; +// MOVING TARGETS private _weapon = _vehicle currentWeaponTurret _turret; private _weaponDirection = _vehicle weaponDirection _weapon; // @todo doesn't work for sub turrets @@ -44,7 +39,6 @@ if (_weaponDirection isEqualTo [0,0,0]) then { // dummy value for non main turr private _angleTarget = asin (_weaponDirection select 2); -// MOVING TARGETS private _movingAzimuth = 0; if (ACE_time - GVAR(time) > 1 && GVAR(time) != -1 && isNil {_this select 2}) then { @@ -60,13 +54,17 @@ if (ACE_time - GVAR(time) > 1 && GVAR(time) != -1 && isNil {_this select 2}) the private _timeToLive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "timeToLive"); private _simulationStep = getNumber (configFile >> "CfgAmmo" >> _ammo >> "simulationStep"); private _initSpeedCoef = getNumber (configFile >> "CfgWeapons" >> _weapon >> "initSpeed"); + private _simulationType = getText (configFile >> "CfgAmmo" >> _ammo >> "simulation"); - if (_initSpeedCoef < 0) then { - _initSpeed = _initSpeed * - _initSpeedCoef; - }; + // More BIS fix + if (_simulationType == "shotBullet") then { + if (_initSpeedCoef < 0) then { + _initSpeed = _initSpeed * - _initSpeedCoef; + }; - if (_initSpeedCoef > 0) then { - _initSpeed = _initSpeedCoef; + if (_initSpeedCoef > 0) then { + _initSpeed = _initSpeedCoef; + }; }; if (_simulationStep != 0) then { @@ -109,61 +107,11 @@ if (_viewDiff != 0) then { _FCSAzimuth = (atan (_distance / _viewDiff) - (abs _viewDiff / _viewDiff) * 90) + _movingAzimuth; }; -// CALCULATE OFFSET -private _FCSMagazines = []; -private _FCSElevation = []; - -{ - private _magazine = _x; - private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo"); - - if !(getText (configFile >> "CfgAmmo" >> _ammo >> "simulation") == "shotMissile") then { - private _maxElev = getNumber (_turretConfig >> "maxElev"); - private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); - private _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction"); - - { - private ["_weapon", "_muzzles", "_weaponMagazines", "_muzzleMagazines"]; - _weapon = _x; - _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); - _weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); - - { - if (_x != "this") then { - _muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); - _weaponMagazines append _muzzleMagazines; - }; - false - } count _muzzles; - - if (_magazine in _weaponMagazines) exitWith { - _initSpeedCoef = getNumber(configFile >> "CfgWeapons" >> _weapon >> "initSpeed"); - - if (_initSpeedCoef < 0) then { - _initSpeed = _initSpeed * -_initSpeedCoef; - }; - - if (_initSpeedCoef > 0) then { - _initSpeed = _initSpeedCoef; - }; - }; - false - } count (_vehicle weaponsTurret _turret); - - private _offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance]; - _offset = parseNumber _offset; - - _FCSMagazines pushBack _magazine; - _FCSElevation pushBack _offset; - }; - false -} count (_vehicle magazinesTurret _turret); - -[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic); -[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines] call EFUNC(common,setVariablePublic); -[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic); [_vehicle, format ["%1_%2", QGVAR(Azimuth), _turret], _FCSAzimuth] call EFUNC(common,setVariablePublic); +// CALCULATE SOLUTION +[_vehicle,_turret,_distance,_angleTarget] call FUNC(calculateSolution); + if (_playSound) then { playSound "ACE_Sound_Click"; }; @@ -171,11 +119,3 @@ if (_playSound) then { if (_showHint) then { [format ["%1: %2", localize LSTRING(ZeroedTo), _distance]] call EFUNC(common,displayTextStructured); }; - -//Update the hud's distance display to the new value or "----" if out of range -//(10m fudge because of EFUNC(common,getTargetDistance)) -if (_distance + 10 >= getNumber (_turretConfig >> QGVAR(MaxDistance))) then { - ((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText "----"; -} else { - ((uiNamespace getVariable ["ACE_dlgRangefinder", displayNull]) displayCtrl 1713151) ctrlSetText ([_distance, 4, 0] call CBA_fnc_formatNumber); -}; diff --git a/addons/fcs/functions/fnc_onForceUpdate.sqf b/addons/fcs/functions/fnc_onForceUpdate.sqf index 005a0d7801..1bf1f0d701 100644 --- a/addons/fcs/functions/fnc_onForceUpdate.sqf +++ b/addons/fcs/functions/fnc_onForceUpdate.sqf @@ -7,7 +7,7 @@ private _vehicle = vehicle _unit; if !([_unit, _vehicle, []] call EFUNC(common,canInteractWith)) exitWith {false}; if !((!GVAR(enabled) && FUNC(canUseFCS)) || FUNC(canUseRangefinder)) exitWith {false}; -private _turret = _unit call EFUNC(common,getTurretIndex); +private _turret = [_unit] call EFUNC(common,getTurretIndex); -[_vehicle, _turret, -1, false] call FUNC(keyDown); -[_vehicle, _turret, -1, false, false] call FUNC(keyUp); +[_vehicle, _turret] call FUNC(keyDown); +[_vehicle, _turret] call FUNC(keyUp); diff --git a/addons/fcs/script_component.hpp b/addons/fcs/script_component.hpp index 8ada0f7a71..e3f9181526 100644 --- a/addons/fcs/script_component.hpp +++ b/addons/fcs/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT fcs #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_FCS #define DEBUG_MODE_FULL #endif diff --git a/addons/fcs/stringtable.xml b/addons/fcs/stringtable.xml index 4970f9b10e..8750d2a4e3 100644 --- a/addons/fcs/stringtable.xml +++ b/addons/fcs/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -30,7 +30,7 @@ Entfernung des FLS erhöhen Zwiększ zasięg SKO Ajustar distancia del FCS (arriba) - Nastavit FCS Náměr (nahoru) + Nastavit FCS Náměr (Nahoru) Augmenter la distance du SCT FCS tartomány állítása (Fel) Ajustar distância do FCS (Acima) @@ -42,7 +42,7 @@ Entfernung des FLS verringern Zmniejsz zasięg SKO Ajustar distancia del FCS (abajo) - Nastavit FCS Náměr (dolů) + Nastavit FCS Náměr (Dolů) Réduire la distance du SCT FCS tartomány állítása (Le) Ajustar distância do FCS (Abaixo) @@ -74,4 +74,4 @@ СУО обнулен. - + \ No newline at end of file diff --git a/addons/finger/script_component.hpp b/addons/finger/script_component.hpp index ae96943943..edaf93a942 100644 --- a/addons/finger/script_component.hpp +++ b/addons/finger/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT finger #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_FINGER #define DEBUG_MODE_FULL #endif diff --git a/addons/finger/stringtable.xml b/addons/finger/stringtable.xml index 1a11bf246a..a528da3a23 100644 --- a/addons/finger/stringtable.xml +++ b/addons/finger/stringtable.xml @@ -9,6 +9,7 @@ Saját mutatási indikátor megjelenítése Mostrar indicador para si mesmo Mostrar el indicador de señalado a uno mismo + Zobrazit ukázání směru pro sebe Render the indicator for the pointing player. This option doesn't affect whether the other players would see the indicator @@ -18,6 +19,7 @@ Az indikátor megjelenítése a mutató játékosnak. Ez a beállítás nem változtat azon, hogy más játékosok látják-e az indikátort. Renderizar o indicador para o jogador que está apontando. Esta opção não afeta se os outros jogadores verão ou não o indicador Muestra el indicador para el jugador que apunta. Esta opción no afecta si los otros jugadores verían el indicador + Zobrazit infikátor, když ukážete prstem. Tato volba nemá vliv, zda ostatní hráči uvidí indikátor nebo ne. Pointing indicator @@ -27,6 +29,7 @@ Ujj-indikátor Indicador de apontamento Indicador de señalado + Ukazování směru Color of the pointing indicator circle @@ -36,6 +39,7 @@ Mutatási indikátor körének színe Cor do círculo de indicação Color del círculo indicador que señala + Barva kruhu pro ukázání směru Action "point a finger at" @@ -45,6 +49,7 @@ Cselekvés "ujj rámutatása" Ação "Apontar um dedo para" Acción "apuntar con el dedo a" + Akce "ukázat prstem na" Points, and shows a virtual marker of where you are looking to nearby units. Can be held down. @@ -54,6 +59,7 @@ Aponta e mostra um marcador virtual para onde você está olhando para unidades próximas. Pode ser utilizado para baixo. Показывает пальцем и рисует виртуальный маркер в направлении взгляда ближайшим игрокам. Можно удерживать. Señala y muestra un marcador virtual donde ustás apuntando para las unidades cercanas. Puede ser mantenido. + Ukazuje virtuální značku kruhu ve směru, kterým se díváte pro všechny blízké jednotky. Pointing Settings diff --git a/addons/flashlights/script_component.hpp b/addons/flashlights/script_component.hpp index ba740c22fc..90a91c3b72 100644 --- a/addons/flashlights/script_component.hpp +++ b/addons/flashlights/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT flashlights #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_FLASHLIGHTS #define DEBUG_MODE_FULL #endif diff --git a/addons/flashsuppressors/script_component.hpp b/addons/flashsuppressors/script_component.hpp index bb1a7c8f0c..cb61bb6007 100644 --- a/addons/flashsuppressors/script_component.hpp +++ b/addons/flashsuppressors/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT flashsuppressors #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_FLASHSUPPRESSORS #define DEBUG_MODE_FULL #endif diff --git a/addons/fonts/script_component.hpp b/addons/fonts/script_component.hpp index a8029b7105..3a7589b72a 100644 --- a/addons/fonts/script_component.hpp +++ b/addons/fonts/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT fonts #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_FONTS #define DEBUG_MODE_FULL #endif diff --git a/addons/frag/XEH_postInit.sqf b/addons/frag/XEH_postInit.sqf index af3464c2b6..f49e5d1e3e 100644 --- a/addons/frag/XEH_postInit.sqf +++ b/addons/frag/XEH_postInit.sqf @@ -9,4 +9,8 @@ if(isServer) then { [QGVAR(frag_eh), { _this call FUNC(frago); }] call EFUNC(common,addEventHandler); }; -[FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler; \ No newline at end of file +[FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler; + +//Cache for ammo type configs +GVAR(cacheRoundsTypesToTrack) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0]; +GVAR(cacheRoundsTypesToTrack) setText QGVAR(cacheRoundsTypesToTrack); diff --git a/addons/frag/functions/fnc_fired.sqf b/addons/frag/functions/fnc_fired.sqf index 693b85eb3d..3e82544430 100644 --- a/addons/frag/functions/fnc_fired.sqf +++ b/addons/frag/functions/fnc_fired.sqf @@ -1,8 +1,56 @@ +/* + * Author: nou, jaynus, PabstMirror + * Called from FiredBIS event on AllVehicles + * If spall is not enabled (default), then cache and only track those that will actually trigger fragmentation. + * + * Arguments: + * 0: gun - Object the event handler is assigned to + * 4: type - Ammo used + * 6: round - Object of the projectile that was shot + * + * Return Value: + * Nothing + * + * Example: + * [clientFiredBIS-XEH] call ace_frag_fnc_fired + * + * Public: No + */ +// #define DEBUG_ENABLED_FRAG #include "script_component.hpp" -private["_gun", "_type", "_round"]; -_gun = _this select 0; -_type = _this select 4; -_round = _this select 6; +params ["_gun", "", "", "", "_type", "", "_round"]; -[_gun, _type, _round] call FUNC(addPfhRound); +private _shouldAdd = GVAR(cacheRoundsTypesToTrack) getVariable _type; +if (isNil "_shouldAdd") then { + TRACE_1("no cache for round",_type); + + if (!EGVAR(common,settingsInitFinished)) exitWith { + //Just incase fired event happens before settings init, don't want to set cache wrong if spall setting changes + TRACE_1("Settings not init yet - exit without setting cache",_type); + _shouldAdd = false; + }; + + if (GVAR(SpallEnabled)) exitWith { + //Always want to run whenever spall is enabled? + _shouldAdd = true; + TRACE_2("SettingCache[spallEnabled]",_type,_shouldAdd); + GVAR(cacheRoundsTypesToTrack) setVariable [_type, _shouldAdd]; + }; + + //Read configs and test if it would actually cause a frag, using same logic as FUNC(pfhRound) + private _skip = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip)); + private _explosive = getNumber (configFile >> "CfgAmmo" >> _type >> "explosive"); + private _indirectRange = getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange"); + private _force = getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(force)); + private _fragPower = getNumber(configFile >> "CfgAmmo" >> _type >> "indirecthit")*(sqrt((getNumber (configFile >> "CfgAmmo" >> _type >> "indirectHitRange")))); + + _shouldAdd = (_skip == 0) && {(_force == 1) || {_explosive > 0.5 && {_indirectRange >= 4.5} && {_fragPower >= 35}}}; + TRACE_6("SettingCache[willFrag?]",_skip,_explosive,_indirectRange,_force,_fragPower,_shouldAdd); + GVAR(cacheRoundsTypesToTrack) setVariable [_type, _shouldAdd]; +}; + +if (_shouldAdd) then { + TRACE_3("Running Frag Tracking",_gun,_type,_round); + [_gun, _type, _round] call FUNC(addPfhRound); +}; diff --git a/addons/frag/script_component.hpp b/addons/frag/script_component.hpp index 78e13c7863..1faa440294 100644 --- a/addons/frag/script_component.hpp +++ b/addons/frag/script_component.hpp @@ -2,6 +2,10 @@ #include "\z\ace\addons\main\script_mod.hpp" //#define DEBUG_ENABLED_FRAG +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_FRAG #define DEBUG_MODE_FULL diff --git a/addons/frag/stringtable.xml b/addons/frag/stringtable.xml index bba8f1dae9..dbb76c682d 100644 --- a/addons/frag/stringtable.xml +++ b/addons/frag/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -6,7 +6,7 @@ Symulacja fragmentacji Simulación de fragmentación Splittersimulation - Simulace fragmentace + Simulace fragmentů Simulação de fragmentação Simulation de la fragmentation Repesz-szimuláció @@ -17,7 +17,7 @@ Activa la simulación de fragmentación ACE Aktywuje symulację fragmentacji ACE Aktiviere die ACE-Splittersimulation - Povolit ACE simulaci fragmentace + Povolit ACE simulaci fragmentů Ativa a simulação de fragmentação do ACE Active la simulation ACE de la fragmentation Az ACE repesz-szimuláció engedélyezése @@ -72,7 +72,7 @@ Máximos proyectiles por cuadro Maximale Anzahl an Projektilen pro Frame Maks. liczba pocisków na klatkę - Maximální počet projektilů ze jeden snímek + Maximální počet projektilů za jeden snímek Projéteis máximos por quadro Nombre maximal de projectile par image Maximum repesz/képkocka @@ -112,4 +112,4 @@ (Только для одиночной игры) Требует перезапуска миссии/редактора. Включает визуальные следы от осколков и обломков в режиме одиночной игры. - + \ No newline at end of file diff --git a/addons/gestures/script_component.hpp b/addons/gestures/script_component.hpp index 06650c6ba8..96ca2cf680 100644 --- a/addons/gestures/script_component.hpp +++ b/addons/gestures/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT Gestures #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_GESTURES #define DEBUG_MODE_FULL #endif diff --git a/addons/gestures/stringtable.xml b/addons/gestures/stringtable.xml index 0d21846d58..c3974ff144 100644 --- a/addons/gestures/stringtable.xml +++ b/addons/gestures/stringtable.xml @@ -117,6 +117,7 @@ Stop Стоп Parar + Stop @@ -139,6 +140,7 @@ Zbiórka Собраться Reagrupar + Přeskupit @@ -148,6 +150,7 @@ Naprzód Вперед Mover em frente + Kupředu @@ -156,6 +159,7 @@ Atak Открыть огонь Engajar + Útok @@ -165,6 +169,7 @@ Wskaż Показать направление Ponta + Ukázat @@ -174,6 +179,7 @@ Wstrzymać Ждать Esperar + Čekej @@ -183,6 +189,7 @@ Uwaga Внимание Aviso + Pozor Hi @@ -210,15 +217,19 @@ Show Gestures On Interaction Menu + Zobrazit posunky v interakčním menu Show gestures on the self interaction menu, or just use keybinds, or disable completely + Zobrazit posunky pro vlastní interakční menu, nebo prostě použít klávesové zkratky, nebo to zakázat úplně Just Keybinds + Pouze klávesové zkratky Keybinds + Interaction Menu + Klávesové zkratky + interakční menu \ No newline at end of file diff --git a/addons/gforces/XEH_postInit.sqf b/addons/gforces/XEH_postInit.sqf index a97822be8c..23abe8e826 100644 --- a/addons/gforces/XEH_postInit.sqf +++ b/addons/gforces/XEH_postInit.sqf @@ -12,4 +12,4 @@ GVAR(GForces_CC) ppEffectCommit 0.4; GVAR(lastUpdateTime) = 0; GVAR(oldVel) = [0,0,0]; -[FUNC(pfhUpdateGForces), 0, []] call CBA_fnc_addPerFrameHandler; +[DFUNC(pfhUpdateGForces), 0, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf index ee1bc8ca4a..dd569781e7 100644 --- a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf +++ b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf @@ -13,34 +13,18 @@ */ #include "script_component.hpp" -private ["_interval", "_player", "_newVel", "_accel", "_currentGForce", "_average", "_sum", "_classCoef", "_suitCoef", "_gBlackOut", "_gRedOut", "_g", "_gBO", "_coef", "_strength"]; - EXPLODE_2_PVT(_this,_params,_pfhId); -_interval = ACE_time - GVAR(lastUpdateTime); - -// Update the g-forces at constant game time intervals -if (_interval < INTERVAL) exitWith {}; - -if (isNull ACE_player) exitWith {}; - -if !(alive ACE_player) exitWith {}; - +// Update the g-forces at constant mission time intervals (taking accTime into account) +if ((ACE_time - GVAR(lastUpdateTime)) < INTERVAL) exitWith {}; GVAR(lastUpdateTime) = ACE_time; -/*if !(vehicle ACE_player isKindOf "Air") exitWith { - GVAR(GForces) = []; - GVAR(GForces_Index) = 0; - waitUntil {sleep 5; (vehicle _player isKindOf "Air") or ((getPos _player select 2) > 5)}; -};*/ - -_newVel = velocity (vehicle ACE_player); - -_accel = ((_newVel vectorDiff GVAR(oldVel)) vectorMultiply (1 / INTERVAL)) vectorAdd [0, 0, 9.8]; -_currentGForce = (_accel vectorDotProduct vectorUp (vehicle ACE_player)) / 9.8; +if (isNull ACE_player || !(alive ACE_player)) exitWith {}; +private _newVel = velocity (vehicle ACE_player); +private _accel = ((_newVel vectorDiff GVAR(oldVel)) vectorMultiply (1 / INTERVAL)) vectorAdd [0, 0, 9.8]; // Cap maximum G's to +- 10 to avoid g-effects when the update is low fps. -_currentGForce = (_currentGForce max -10) min 10; +private _currentGForce = (((_accel vectorDotProduct vectorUp (vehicle ACE_player)) / 9.8) max -10) min 10; GVAR(GForces) set [GVAR(GForces_Index), _currentGForce]; GVAR(GForces_Index) = (GVAR(GForces_Index) + 1) % round (AVERAGEDURATION / INTERVAL); @@ -63,31 +47,27 @@ GVAR(oldVel) = _newVel; * Effects and camera shake start 30% the limit value, and build gradually */ -_average = 0; -if (count GVAR(GForces) > 0) then { - _sum = 0; - { - _sum = _sum + _x; - } forEach GVAR(GForces); - _average = _sum / (count GVAR(GForces)); +private _average = 0; +private _count = { + _average = _average + _x; + true +} count GVAR(GForces); + +if (_count > 0) then { + _average = _average / _count; }; -_classCoef = ACE_player getVariable ["ACE_GForceCoef", - getNumber (configFile >> "CfgVehicles" >> (typeOf ACE_player) >> "ACE_GForceCoef")]; -_suitCoef = if ((uniform ACE_player) != "") then { - getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "ACE_GForceCoef") +private _classCoef = (ACE_player getVariable ["ACE_GForceCoef", + getNumber (configFile >> "CfgVehicles" >> (typeOf ACE_player) >> "ACE_GForceCoef")]) max 0.001; +private _suitCoef = if ((uniform ACE_player) != "") then { + (getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "ACE_GForceCoef")) max 0.001 } else { 1 }; -//Fix "Error Zero divisor" -if (_classCoef == 0) then {_classCoef = 0.001}; -if (_suitCoef == 0) then {_suitCoef = 0.001}; +private _gBlackOut = MAXVIRTUALG / _classCoef + MAXVIRTUALG / _suitCoef - MAXVIRTUALG; -_gBlackOut = MAXVIRTUALG / _classCoef + MAXVIRTUALG / _suitCoef - MAXVIRTUALG; -_gRedOut = MINVIRTUALG / _classCoef; - -// @todo: Sort the interaction with medical +// Unconsciousness if ((_average > _gBlackOut) and {isClass (configFile >> "CfgPatches" >> "ACE_Medical") and {!(ACE_player getVariable ["ACE_isUnconscious", false])}}) then { [ACE_player, true, (10 + floor(random 5))] call EFUNC(medical,setUnconscious); }; @@ -96,12 +76,14 @@ GVAR(GForces_CC) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[10,10,0,0, if !(ACE_player getVariable ["ACE_isUnconscious", false]) then { if (_average > 0.30 * _gBlackOut) then { - _strength = ((_average - 0.30 * _gBlackOut) / (0.70 * _gBlackOut)) max 0; + private _strength = ((_average - 0.30 * _gBlackOut) / (0.70 * _gBlackOut)) max 0; GVAR(GForces_CC) ppEffectAdjust [1,1,0,[0,0,0,1],[0,0,0,0],[1,1,1,1],[2*(1-_strength),2*(1-_strength),0,0,0,0.1,0.5]]; addCamShake [_strength, 1, 15]; } else { + private _gRedOut = MINVIRTUALG / _classCoef; + if (_average < -0.30 * _gRedOut) then { - _strength = ((abs _average - 0.30 * _gRedOut) / (0.70 * _gRedOut)) max 0; + private _strength = ((abs _average - 0.30 * _gRedOut) / (0.70 * _gRedOut)) max 0; GVAR(GForces_CC) ppEffectAdjust [1,1,0,[1,0.2,0.2,1],[0,0,0,0],[1,1,1,1],[2*(1-_strength),2*(1-_strength),0,0,0,0.1,0.5]]; addCamShake [_strength / 1.5, 1, 15]; }; diff --git a/addons/gforces/script_component.hpp b/addons/gforces/script_component.hpp index ab3289842d..c017eb4a62 100644 --- a/addons/gforces/script_component.hpp +++ b/addons/gforces/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT gforces #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_GFORCES #define DEBUG_MODE_FULL #endif diff --git a/addons/goggles/functions/fnc_externalCamera.sqf b/addons/goggles/functions/fnc_externalCamera.sqf index 85776fb0d6..06c6cec407 100644 --- a/addons/goggles/functions/fnc_externalCamera.sqf +++ b/addons/goggles/functions/fnc_externalCamera.sqf @@ -15,6 +15,9 @@ */ #include "script_component.hpp" +// Handle the ThreeDen Editor Camera +if ((!isNil {is3DEN}) && {is3DEN}) exitWith {true}; + if (GVAR(showInThirdPerson)) then { cameraView in ["GROUP"] || EFUNC(common,isFeatureCameraActive) } else { diff --git a/addons/goggles/script_component.hpp b/addons/goggles/script_component.hpp index 711a314160..23dc4f428f 100644 --- a/addons/goggles/script_component.hpp +++ b/addons/goggles/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT goggles #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_GOGGLES #define DEBUG_MODE_FULL #endif diff --git a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf index 06466c70d4..20f75e2714 100644 --- a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf +++ b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf @@ -3,28 +3,29 @@ * Creates the flashbang effect and knock out AI units. * * Arguments: - * 0: The grenade + * 0: The flashBang position ASL * * Return Value: * None * * Example: - * [theGrenade] call ace_grenades_fnc_flashbangExplosionEH + * [[0,0,0]] call ace_grenades_fnc_flashbangExplosionEH * * Public: No */ #include "script_component.hpp" -params ["_grenade"]; +params ["_grenadePosASL"]; +TRACE_1("params",_grenadePosASL); -private _affected = _grenade nearEntities ["CAManBase", 20]; +private _affected = (ASLtoAGL _grenadePosASL) nearEntities ["CAManBase", 20]; { if (local _x && {alive _x}) then { - private _strength = 1 - ((_x distance _grenade) min 15) / 15; + private _strength = 1 - (((getPosASL _x) vectorDistance _grenadePosASL) min 15) / 15; - TRACE_3("FlashBangEffect Start",_x,(_x distance _grenade),_strength); + TRACE_3("FlashBangEffect Start",_x,((getPosASL _x) vectorDistance _grenadePosASL),_strength); if (_x != ACE_player) then { //must be AI @@ -45,13 +46,12 @@ private _affected = _grenade nearEntities ["CAManBase", 20]; } else { //Do effects for player // is there line of sight to the grenade? - private _posGrenade = getPosASL _grenade; private _eyePos = eyePos ACE_player; //PositionASL _posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground //Check for line of sight (check 4 points in case grenade is stuck in an object or underground) private _losCount = { - !lineIntersects [_posGrenade vectorAdd _x, _eyePos, _grenade, ACE_player] + !lineIntersects [_grenadePosASL vectorAdd _x, _eyePos, ACE_player] } count [[0,0,0], [0,0,0.2], [0.1, 0.1, 0.1], [-0.1, -0.1, 0.1]]; TRACE_1("Line of sight count (out of 4)",_losCount); @@ -83,7 +83,8 @@ private _affected = _grenade nearEntities ["CAManBase", 20]; }; // create flash to illuminate environment - private _light = "#lightpoint" createVehicleLocal getPos _grenade; + private _light = "#lightpoint" createVehicleLocal _grenadePosASL; + _light setPosASL _grenadePosASL; _light setLightBrightness 200; _light setLightAmbient [1,1,1]; diff --git a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf index ef6224f8ce..9c92f84508 100644 --- a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf +++ b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf @@ -16,11 +16,13 @@ #include "script_component.hpp" params ["_projectile"]; +TRACE_1("params",_projectile); if (alive _projectile) then { playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400]; - private _affected = _projectile nearEntities ["CAManBase", 50]; + private _affected = _projectile nearEntities ["CAManBase", 20]; + TRACE_2("people hit",_affected,getPosASL _projectile); - ["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent); + ["flashbangExplosion", _affected, [getPosASL _projectile]] call EFUNC(common,targetEvent); }; diff --git a/addons/grenades/functions/fnc_throwGrenade.sqf b/addons/grenades/functions/fnc_throwGrenade.sqf index e66498a854..1d7d470b80 100644 --- a/addons/grenades/functions/fnc_throwGrenade.sqf +++ b/addons/grenades/functions/fnc_throwGrenade.sqf @@ -37,7 +37,7 @@ if (local _unit) then { if (getNumber (_config >> QGVAR(flashbang)) == 1) then { private _fuzeTime = getNumber (_config >> "explosionTime"); - [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime, 0] call EFUNC(common,waitAndExecute); + [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime] call EFUNC(common,waitAndExecute); }; }; diff --git a/addons/grenades/script_component.hpp b/addons/grenades/script_component.hpp index f3d89216ba..67a958b27e 100644 --- a/addons/grenades/script_component.hpp +++ b/addons/grenades/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_GRENADES #define DEBUG_MODE_FULL diff --git a/addons/headless/$PBOPREFIX$ b/addons/headless/$PBOPREFIX$ new file mode 100644 index 0000000000..553c595da0 --- /dev/null +++ b/addons/headless/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\headless diff --git a/addons/headless/ACE_Settings.hpp b/addons/headless/ACE_Settings.hpp new file mode 100644 index 0000000000..6c8246a06b --- /dev/null +++ b/addons/headless/ACE_Settings.hpp @@ -0,0 +1,20 @@ +class ACE_Settings { + class GVAR(Enabled) { + value = 0; + typeName = "BOOL"; + displayName = ECSTRING(common,Enabled); + description = CSTRING(EnabledDesc); + }; + class GVAR(Delay) { + value = DELAY_DEFAULT; + typeName = "SCALAR"; + displayName = CSTRING(Delay); + description = CSTRING(DelayDesc); + }; + class GVAR(Log) { + value = 0; + typeName = "BOOL"; + displayName = CSTRING(Log); + description = CSTRING(LogDesc); + }; +}; diff --git a/addons/headless/CfgEventHandlers.hpp b/addons/headless/CfgEventHandlers.hpp new file mode 100644 index 0000000000..864912227c --- /dev/null +++ b/addons/headless/CfgEventHandlers.hpp @@ -0,0 +1,19 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; + +class Extended_InitPost_EventHandlers { + class AllVehicles { + class ADDON { + serverInit = QUOTE(_this call FUNC(handleInitPost)); + }; + }; +}; diff --git a/addons/headless/CfgVehicles.hpp b/addons/headless/CfgVehicles.hpp new file mode 100644 index 0000000000..aa3837f6ae --- /dev/null +++ b/addons/headless/CfgVehicles.hpp @@ -0,0 +1,37 @@ +class CfgVehicles { + class ACE_Module; + class GVAR(module): ACE_Module { + author = ECSTRING(common,ACETeam); + category = "ACE_missionModules"; + displayName = CSTRING(Module); + function = QFUNC(moduleInit); + scope = 2; + isGlobal = 1; // Global + isTriggerActivated = 0; + isDisposable = 0; + icon = QUOTE(PATHTOF(UI\Icon_Module_Headless_ca.paa)); + class Arguments { + class Enabled { + displayName = ECSTRING(common,Enabled); + description = CSTRING(EnabledDesc); + typeName = "BOOL"; + defaultValue = 0; + }; + class Delay { + displayName = CSTRING(Delay); + description = CSTRING(DelayDesc); + typeName = "NUMBER"; + defaultValue = DELAY_DEFAULT; + }; + class Log { + displayName = CSTRING(Log); + description = CSTRING(LogDesc); + typeName = "BOOL"; + defaultValue = 0; + }; + }; + class ModuleDescription { + description = CSTRING(ModuleDesc); + }; + }; +}; diff --git a/addons/headless/README.md b/addons/headless/README.md new file mode 100644 index 0000000000..ab3d1ef403 --- /dev/null +++ b/addons/headless/README.md @@ -0,0 +1,16 @@ +ace_headless +============ + +Adds automatic passing of AI groups to (up to 3) Headless Clients. +- Automatic Headless Client recognition +- Event-based transferring (on unit spawn, Headless Client connect and disconnect) +- Round-robin transferring when more than 1 Headless Client is present +- Mission makers can use the following to prevent a group from transferring to a Headless Client: + `this setVariable ["ace_headless_blacklist", true, true];` + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Jonpas](http://github.com/jonpas) diff --git a/addons/headless/UI/Icon_Module_Headless_ca.paa b/addons/headless/UI/Icon_Module_Headless_ca.paa new file mode 100644 index 0000000000..a3e23a8537 Binary files /dev/null and b/addons/headless/UI/Icon_Module_Headless_ca.paa differ diff --git a/addons/headless/XEH_postInit.sqf b/addons/headless/XEH_postInit.sqf new file mode 100644 index 0000000000..7b8a4615dc --- /dev/null +++ b/addons/headless/XEH_postInit.sqf @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +// Exit on player clients that are not hosts +if (hasInterface && !isServer) exitWith {}; + +["SettingsInitialized", { + if (isServer) then { + // Add disconnect EH if HC transferring enabled + if (GVAR(Enabled)) then { + addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleDisconnect)}]; + }; + } else { + // Register HC (this part happens on HC only) + ["ACE_HeadlessClientJoined", [player]] call EFUNC(common,globalEvent); + }; +}] call EFUNC(common,addEventHandler); diff --git a/addons/headless/XEH_preInit.sqf b/addons/headless/XEH_preInit.sqf new file mode 100644 index 0000000000..23e1541c6c --- /dev/null +++ b/addons/headless/XEH_preInit.sqf @@ -0,0 +1,18 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(handleConnectHC); +PREP(handleDisconnect); +PREP(handleInitPost); +PREP(moduleInit); +PREP(rebalance); +PREP(transferGroups); + +if (isServer) then { + GVAR(headlessClients) = []; + GVAR(inRebalance) = false; + ["ACE_HeadlessClientJoined", FUNC(handleConnectHC)] call EFUNC(common,addEventHandler); +}; + +ADDON = true; diff --git a/addons/headless/config.cpp b/addons/headless/config.cpp new file mode 100644 index 0000000000..9c4c6b9120 --- /dev/null +++ b/addons/headless/config.cpp @@ -0,0 +1,17 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[]= {"Jonpas"}; + authorUrl = "https://github.com/jonpas"; + VERSION_CONFIG; + }; +}; + +#include "ACE_Settings.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/headless/functions/fnc_handleConnectHC.sqf b/addons/headless/functions/fnc_handleConnectHC.sqf new file mode 100644 index 0000000000..19293e9229 --- /dev/null +++ b/addons/headless/functions/fnc_handleConnectHC.sqf @@ -0,0 +1,36 @@ +/* + * Author: Jonpas + * Registers connected Headless Client for use. + * + * Arguments: + * 0: Headless Client + * + * Return Value: + * None + * + * Example: + * [headlessClient] call ace_headless_handleConnectHC; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_headlessClient"]; + +// Delay until settings are initialized (for checking if HC trasnferring is enabled) +if (!EGVAR(common,settingsInitFinished)) exitWith { + EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(handleConnectHC), _this]; +}; + +// Exit if HC transferring disabled or HC already registered +if (!GVAR(Enabled) || {_headlessClient in GVAR(headlessClients)}) exitWith {}; + +// Register for use +GVAR(headlessClients) pushBack _headlessClient; + +if (GVAR(Log)) then { + ACE_LOGINFO_1("Registered HC: %1",_headlessClient); +}; + +// Rebalance +[true] call FUNC(rebalance); diff --git a/addons/headless/functions/fnc_handleDisconnect.sqf b/addons/headless/functions/fnc_handleDisconnect.sqf new file mode 100644 index 0000000000..dc20379458 --- /dev/null +++ b/addons/headless/functions/fnc_handleDisconnect.sqf @@ -0,0 +1,34 @@ +/* + * Author: Jonpas + * Removes Headless Client from use. + * + * Arguments: + * 0: Object + * + * Return Value: + * Transfer To Server + * + * Example: + * [unit] call ace_headless_handleDisconnect; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_object"]; + +// Exit if not HC +if !(_object in GVAR(headlessClients)) exitWith {}; + +// Remove HC +GVAR(headlessClients) deleteAt (GVAR(headlessClients) find _object); + +if (GVAR(Log)) then { + ACE_LOGINFO_1("Removed HC: %1",_object); +}; + +// Rebalance +[true] call FUNC(rebalance); + +// Prevent transferring of HC to server +false diff --git a/addons/headless/functions/fnc_handleInitPost.sqf b/addons/headless/functions/fnc_handleInitPost.sqf new file mode 100644 index 0000000000..fd75367ce7 --- /dev/null +++ b/addons/headless/functions/fnc_handleInitPost.sqf @@ -0,0 +1,31 @@ +/* + * Author: Jonpas + * Request a rebalance. + * + * Arguments: + * 0: Object + * + * Return Value: + * None + * + * Example: + * [object] call ace_headless_handleInitPost; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_object"]; + +TRACE_1("InitPost",_object); + +// Delay until settings are initialized (for checking if HC trasnferring is enabled) +if (!EGVAR(common,settingsInitFinished)) exitWith { + EGVAR(common,runAtSettingsInitialized) pushBack [FUNC(handleInitPost), _this]; +}; + +// Exit if HC transferring disabled or object not a unit (including unit inside vehicle) or is player +if (!GVAR(Enabled) || {!(_object in allUnits)} || {isPlayer _object}) exitWith {}; + +// Rebalance +[false] call FUNC(rebalance); diff --git a/addons/headless/functions/fnc_moduleInit.sqf b/addons/headless/functions/fnc_moduleInit.sqf new file mode 100644 index 0000000000..dc06d95b3b --- /dev/null +++ b/addons/headless/functions/fnc_moduleInit.sqf @@ -0,0 +1,27 @@ +/* + * Author: Jonpas + * Initializes the Headless module. + * + * Arguments: + * 0: The module logic + * 1: Units (Unused) + * 2: Activated + * + * Return Value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +if (!isServer) exitWith {}; + +params ["_logic", "", "_activated"]; + +if (!_activated) exitWith {}; + +[_logic, QGVAR(Enabled), "Enabled"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(Delay), "Delay"] call EFUNC(common,readSettingFromModule); +[_logic, QGVAR(Log), "Log"] call EFUNC(common,readSettingFromModule); + +ACE_LOGINFO("Headless Module Initialized."); diff --git a/addons/headless/functions/fnc_rebalance.sqf b/addons/headless/functions/fnc_rebalance.sqf new file mode 100644 index 0000000000..1c792ff94a --- /dev/null +++ b/addons/headless/functions/fnc_rebalance.sqf @@ -0,0 +1,29 @@ +/* + * Author: Jonpas + * Rebalance AI groups accross HCs. + * + * Arguments: + * 0: Force + * + * Return Value: + * None + * + * Example: + * [false] call ace_headless_rebalance; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_force"]; + +TRACE_3("Rebalance",GVAR(inRebalance),GVAR(headlessClients),_force); + +// Exit if waiting for rebalance or no HCs present +if (GVAR(inRebalance) || {GVAR(headlessClients) isEqualTo []}) exitWith {}; + +// Transfer after rebalance delay +[FUNC(transferGroups), [_force], GVAR(Delay)] call EFUNC(common,waitAndExecute); + +// Currently in rebalance flag +GVAR(inRebalance) = true; diff --git a/addons/headless/functions/fnc_transferGroups.sqf b/addons/headless/functions/fnc_transferGroups.sqf new file mode 100644 index 0000000000..892e9b58ff --- /dev/null +++ b/addons/headless/functions/fnc_transferGroups.sqf @@ -0,0 +1,144 @@ +/* + * Author: Jonpas + * Transfers AI groups to Headess Client(s). + * + * Arguments: + * 0: Force + * + * Return Value: + * None + * + * Example: + * [false] call ace_headless_fnc_transferGroups; + * + * Public: No + */ +#include "script_component.hpp" + +params ["_force"]; + +GVAR(headlessClients) params [ + ["_HC1", objNull, [objNull] ], + ["_HC2", objNull, [objNull] ], + ["_HC3", objNull, [objNull] ] +]; + +if (GVAR(Log)) then { + ACE_LOGINFO_2("Present HCs: %1 - Full Rebalance: %2",GVAR(headlessClients),_force); +}; + + +// Enable round-robin load balancing if more than one HC is present +private _loadBalance = [false, true] select (count GVAR(headlessClients) > 1); + + +// Get IDs and determine first HC to start with +private _idHC1 = -1; +private _idHC2 = -1; +private _idHC3 = -1; +private _currentHC = 0; + +if (!local _HC1) then { + _idHC1 = owner _HC1; + _currentHC = 1; +}; + +if (!local _HC2) then { + _idHC2 = owner _HC2; + + if (_currentHC == 0) then { + _currentHC = 2; + }; +}; + +if (!local _HC3) then { + _idHC3 = owner _HC3; + + if (_currentHC == 0) then { + _currentHC = 3; + }; +}; + + +// Prepare statistics +private _numTransferredHC1 = 0; +private _numTransferredHC2 = 0; +private _numTransferredHC3 = 0; + + +// Transfer AI groups +{ + // No transfer if empty group + private _transfer = !(_x isEqualTo []); + + if (_transfer) then { + { + // No transfer if already transferred + if (!_force && {(owner _x) in [_idHC1, _idHC2, _idHC3]}) exitWith { + _transfer = false; + }; + + // No transfer if player in this group + if (isPlayer _x) exitWith { + _transfer = false; + }; + + // No transfer if any unit in group is blacklisted + if (_x getVariable [QGVAR(blacklist), false]) exitWith { + _transfer = false; + }; + + // No transfer if vehicle unit is in or crew in that vehicle is blacklisted + if (vehicle _x != _x && {(vehicle _x) getVariable [QGVAR(blacklist), false]}) exitWith { + _transfer = false; + }; + } forEach (units _x); + }; + + + // Round robin between HCs if load balance enabled, else pass all to one HC + if (_transfer) then { + switch (_currentHC) do { + case 1: { + private _transferred = _x setGroupOwner _idHC1; + if (_loadBalance) then { + _currentHC = [3, 2] select (!local _HC2); + }; + if (_transferred) then { + _numTransferredHC1 = _numTransferredHC1 + 1; + }; + }; + case 2: { + private _transferred = _x setGroupOwner _idHC2; + if (_loadBalance) then { + _currentHC = [1, 3] select (!local _HC3); + }; + if (_transferred) then { + _numTransferredHC2 = _numTransferredHC2 + 1; + }; + }; + case 3: { + private _transferred = _x setGroupOwner _idHC3; + if (_loadBalance) then { + _currentHC = [2, 1] select (!local _HC1); + }; + if (_transferred) then { + _numTransferredHC3 = _numTransferredHC3 + 1; + }; + }; + default { + TRACE_1("No Valid HC to transfer to",_currentHC); + }; + }; + }; +} forEach allGroups; + + +if (GVAR(Log)) then { + private _numTransferredTotal = _numTransferredHC1 + _numTransferredHC2 + _numTransferredHC3; + ACE_LOGINFO_4("Groups Transferred: Total: %1 - HC1: %2 - HC2: %3 - HC3: %4",_numTransferredTotal,_numTransferredHC1,_numTransferredHC2,_numTransferredHC3); +}; + + +// Allow rebalance flag +GVAR(inRebalance) = false; diff --git a/addons/headless/functions/script_component.hpp b/addons/headless/functions/script_component.hpp new file mode 100644 index 0000000000..a38efad3a9 --- /dev/null +++ b/addons/headless/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\headless\script_component.hpp" diff --git a/addons/headless/script_component.hpp b/addons/headless/script_component.hpp new file mode 100644 index 0000000000..c69bd780c9 --- /dev/null +++ b/addons/headless/script_component.hpp @@ -0,0 +1,15 @@ +#define COMPONENT headless +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_HEADLESS + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_HEADLESS + #define DEBUG_SETTINGS DEBUG_SETTINGS_HEADLESS +#endif + +#include "\z\ace\addons\main\script_macros.hpp" + + +#define DELAY_DEFAULT 15 diff --git a/addons/headless/stringtable.xml b/addons/headless/stringtable.xml new file mode 100644 index 0000000000..4bea985f9f --- /dev/null +++ b/addons/headless/stringtable.xml @@ -0,0 +1,33 @@ + + + + + Headless + Headless + + + This module allows you to setup automatic transferring of AI to Headless Clients. (Default: No) + Dieses Modul erlaubt es dir, die KI automatisch auf einen Headless Client zu transferieren. (Standard: Nein) + + + Enables transferring of AI to Headless Clients. + Aktiviert denTransfer der KI auf Headless Clients. + + + Delay + Verzögerung + + + Minimal delay between transfers, in seconds. (Default: 15) + Minimale Verzögerung zwischen Transfers in Sekunden. (Standard: 15) + + + Log + Protokolldatei anlegen + + + Log transfer statistics and Headless Client (dis)connections to RPT. (Default: No) + Zeichnet Transferstatistiken, Verbindungen und Verbindungsabbrüche in einer RPT-Datei auf. (Standard: Nein) + + + diff --git a/addons/hearing/CfgWeapons.hpp b/addons/hearing/CfgWeapons.hpp index 7e1c932f62..af7b7d4cb3 100644 --- a/addons/hearing/CfgWeapons.hpp +++ b/addons/hearing/CfgWeapons.hpp @@ -18,36 +18,27 @@ class CfgWeapons { GVAR(protection) = 1; GVAR(lowerVolume) = 0.80; }; - class H_HelmetCrew_0: H_HelmetCrew_B {}; - class H_HelmetCrew_I: H_HelmetCrew_B {}; class H_CrewHelmetHeli_B: H_HelmetB { GVAR(protection) = 0.85; GVAR(lowerVolume) = 0.75; }; - class H_CrewHelmetHeli_O: H_CrewHelmetHeli_B {}; - class H_CrewHelmetHeli_I: H_CrewHelmetHeli_B {}; class H_PilotHelmetHeli_B: H_HelmetB { GVAR(protection) = 0.85; GVAR(lowerVolume) = 0.75; }; - class H_PilotHelmetHeli_O: H_PilotHelmetHeli_B {}; - class H_PilotHelmetHeli_I: H_PilotHelmetHeli_B {}; class H_PilotHelmetFighter_B: H_HelmetB { GVAR(protection) = 1; GVAR(lowerVolume) = 0.80; }; - class H_PilotHelmetFighter_O: H_PilotHelmetFighter_B {}; - class H_PilotHelmetFighter_I: H_PilotHelmetFighter_B {}; class HelmetBase; class H_Cap_headphones: HelmetBase { GVAR(protection) = 0.5; GVAR(lowerVolume) = 0.60; }; - class H_Cap_marshal: H_Cap_headphones {}; class H_HelmetB_light: H_HelmetB { GVAR(protection) = 0.8; diff --git a/addons/hearing/XEH_postInit.sqf b/addons/hearing/XEH_postInit.sqf index b8745acaaa..4ff2f84b6c 100644 --- a/addons/hearing/XEH_postInit.sqf +++ b/addons/hearing/XEH_postInit.sqf @@ -2,6 +2,9 @@ if (!hasInterface) exitWith {}; +GVAR(cacheAmmoLoudness) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0]; +GVAR(cacheAmmoLoudness) setText QGVAR(cacheAmmoLoudness); + GVAR(deafnessDV) = 0; GVAR(deafnessPrior) = 0; GVAR(volume) = 1; diff --git a/addons/hearing/functions/fnc_earRinging.sqf b/addons/hearing/functions/fnc_earRinging.sqf index f4db19e6ea..cda5fa508e 100644 --- a/addons/hearing/functions/fnc_earRinging.sqf +++ b/addons/hearing/functions/fnc_earRinging.sqf @@ -28,11 +28,12 @@ if (_unit getVariable ["ACE_hasEarPlugsin", false]) then { //headgear hearing protection if(headgear _unit != "") then { - private ["_protection"]; - _protection = (getNumber (configFile >> "CfgWeapons" >> (headgear _unit) >> QGVAR(protection))) min 1; + private _protection = (getNumber (configFile >> "CfgWeapons" >> (headgear _unit) >> QGVAR(protection))) min 1; if(_protection > 0) then { _strength = _strength * (1 - _protection); }; }; +TRACE_2("adding",_strength,GVAR(deafnessDV)); + GVAR(deafnessDV) = GVAR(deafnessDV) + _strength; diff --git a/addons/hearing/functions/fnc_firedNear.sqf b/addons/hearing/functions/fnc_firedNear.sqf index 1ee84a2dc8..31f693bafd 100644 --- a/addons/hearing/functions/fnc_firedNear.sqf +++ b/addons/hearing/functions/fnc_firedNear.sqf @@ -32,31 +32,28 @@ if ((ACE_player != _object) && {(vehicle ACE_player) != _object}) exitWith {}; if (_weapon in ["Throw", "Put"]) exitWith {}; if (_distance > 50) exitWith {}; -private ["_silencer", "_audibleFireCoef", "_loudness", "_strength", "_vehAttenuation", "_magazine", "_muzzles", "_weaponMagazines", "_muzzleMagazines", "_ammoType", "_initSpeed", "_ammoConfig", "_caliber"]; +private _vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)}; +private _distance = 1 max _distance; -_vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)}; - -_distance = 1 max _distance; - -_silencer = switch (_weapon) do { +private _silencer = switch (_weapon) do { case (primaryWeapon _firer) : {(primaryWeaponItems _firer) select 0}; case (secondaryWeapon _firer) : {(secondaryWeaponItems _firer) select 0}; case (handgunWeapon _firer) : {(handgunItems _firer) select 0}; default {""}; }; -_audibleFireCoef = 1; +private _audibleFireCoef = 1; if (_silencer != "") then { _audibleFireCoef = getNumber (configFile >> "CfgWeapons" >> _silencer >> "ItemInfo" >> "AmmoCoef" >> "audibleFire"); }; -_weaponMagazines = missionNamespace getVariable [format[QEGVAR(common,weaponMagazines_%1),_weapon], []]; -if (count _weaponMagazines == 0) then { - _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); - _weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); +private _loudness = GVAR(cacheAmmoLoudness) getVariable (format ["%1%2",_weapon,_ammo]); +if (isNil "_loudness") then { + private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles"); + private _weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); { if (_x != "this") then { - _muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); + private _muzzleMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); _weaponMagazines append _muzzleMagazines; }; } count _muzzles; @@ -64,34 +61,39 @@ if (count _weaponMagazines == 0) then { _ammoType = getText(configFile >> "CfgMagazines" >> _x >> "ammo"); _weaponMagazines set [_forEachIndex, [_x, _ammoType]]; } forEach _weaponMagazines; - missionNamespace setVariable [format[QEGVAR(common,weaponMagazines_%1),_weapon], _weaponMagazines]; -}; -_magazine = ""; -{ - _x params ["_magazineType", "_ammoType"]; - if (_ammoType == _ammo) exitWith { - _magazine = _magazineType; + private _magazine = ""; + { + _x params ["_magazineType", "_ammoType"]; + if (_ammoType == _ammo) exitWith { + _magazine = _magazineType; + }; + } count _weaponMagazines; + + if (_magazine == "") then { + _loudness = 0; + TRACE_2("No mag for Weapon/Ammo??",_weapon,_ammo); + } else { + private _initSpeed = getNumber(configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); + private _caliber = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_caliber"); + _caliber = call { + if (_ammo isKindOf ["ShellBase", (configFile >> "CfgAmmo")]) exitWith { 80 }; + if (_ammo isKindOf ["RocketBase", (configFile >> "CfgAmmo")]) exitWith { 200 }; + if (_ammo isKindOf ["MissileBase", (configFile >> "CfgAmmo")]) exitWith { 600 }; + if (_ammo isKindOf ["SubmunitionBase", (configFile >> "CfgAmmo")]) exitWith { 80 }; + if (_caliber <= 0) then { 6.5 } else { _caliber }; + }; + + _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5; + TRACE_6("building cache",_weapon,_ammo,_magazine,_initSpeed,_caliber,_loudness); }; -} count _weaponMagazines; - -if (_magazine == "") exitWith {}; - -_initSpeed = getNumber(configFile >> "CfgMagazines" >> _magazine >> "initSpeed"); -_ammoConfig = (configFile >> "CfgAmmo" >> _ammo); -_caliber = getNumber(_ammoConfig >> "ACE_caliber"); -_caliber = call { - if (_ammo isKindOf ["ShellBase", (configFile >> "CfgAmmo")]) exitWith { 80 }; - if (_ammo isKindOf ["RocketBase", (configFile >> "CfgAmmo")]) exitWith { 200 }; - if (_ammo isKindOf ["MissileBase", (configFile >> "CfgAmmo")]) exitWith { 600 }; - if (_ammo isKindOf ["SubmunitionBase", (configFile >> "CfgAmmo")]) exitWith { 80 }; - if (_caliber <= 0) then { 6.5 } else { _caliber }; + GVAR(cacheAmmoLoudness) setVariable [(format ["%1%2",_weapon,_ammo]), _loudness]; }; -_loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) * _audibleFireCoef / 5; -_strength = _vehAttenuation * (_loudness - (_loudness / 50 * _distance)); // linear drop off -//systemChat format["%1 : %2", _strength, _initSpeed]; -//systemChat format["%1 : %2 : %3", _weapon, _magazine, _initSpeed]; +_loudness = _loudness * _audibleFireCoef; +private _strength = _vehAttenuation * (_loudness - (_loudness / 50 * _distance)); // linear drop off + +TRACE_1("result",_strength); if (_strength < 0.01) exitWith {}; diff --git a/addons/hearing/functions/fnc_handleRespawn.sqf b/addons/hearing/functions/fnc_handleRespawn.sqf index 527d5d6b16..5bad68761c 100644 --- a/addons/hearing/functions/fnc_handleRespawn.sqf +++ b/addons/hearing/functions/fnc_handleRespawn.sqf @@ -20,6 +20,9 @@ TRACE_2("params",_unit,typeOf _unit); if (!local _unit) exitWith {}; //XEH should only be called on local units +//Do not add or remove earplugs if gear should be preserved +if (missionNamespace getVariable [QEGVAR(respawn,SavePreDeathGear), false]) exitWith {}; + private _respawn = [0] call BIS_fnc_missionRespawnType; //if respawn is not Group or side: diff --git a/addons/hearing/functions/fnc_updateVolume.sqf b/addons/hearing/functions/fnc_updateVolume.sqf index e36151aea4..5492dcd080 100644 --- a/addons/hearing/functions/fnc_updateVolume.sqf +++ b/addons/hearing/functions/fnc_updateVolume.sqf @@ -1,6 +1,6 @@ /* * Author: commy2 and esteldunedain and Ruthberg - * Updates and applys the current deafness. Called every 0.1 sec from a PFEH. + * Updates and applys the current deafness. Called every 1 sec from a PFEH. * * Arguments: * 0: Args @@ -19,7 +19,6 @@ //Only run if deafness or ear ringing is enabled: if ((!GVAR(enableCombatDeafness)) && GVAR(DisableEarRinging)) exitWith {}; -private["_volume", "_soundTransitionTime"]; (_this select 0) params ["_justUpdateVolume"]; @@ -71,7 +70,7 @@ if (!_justUpdateVolume) then { if ((missionNameSpace getVariable [QGVAR(disableVolumeUpdate), false]) || {!GVAR(enableCombatDeafness)}) exitWith {}; -_volume = GVAR(volume); +private _volume = GVAR(volume); // Earplugs reduce hearing 50% if ([ACE_player] call FUNC(hasEarPlugsIn)) then { @@ -92,7 +91,7 @@ if (ACE_player getVariable ["ACE_isUnconscious", false]) then { _volume = _volume min GVAR(UnconsciousnessVolume); }; -_soundTransitionTime = if (_justUpdateVolume) then {0.1} else {1}; +private _soundTransitionTime = if (_justUpdateVolume) then {0.1} else {1}; _soundTransitionTime fadeSound _volume; _soundTransitionTime fadeSpeech _volume; diff --git a/addons/hearing/script_component.hpp b/addons/hearing/script_component.hpp index 194e150375..de1ff267e4 100644 --- a/addons/hearing/script_component.hpp +++ b/addons/hearing/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_HEARING #define DEBUG_MODE_FULL diff --git a/addons/hearing/stringtable.xml b/addons/hearing/stringtable.xml index 71767a0cb0..7dbf70f7ed 100644 --- a/addons/hearing/stringtable.xml +++ b/addons/hearing/stringtable.xml @@ -136,7 +136,7 @@ Możliwość chwilowej utraty słuchu przy głośnych wystrzałach i jednoczesnym braku włożonych stoperów Habilita la sordera de combate Aktiviere Taubheit im Gefecht? - Povolit ztrátu sluchu? + Snižuje schopnost sluchu pokud dojde k jeho poškození hlasitou a blízkou střelbou Ativar surdez em combate? Уменьшает возможность игрока слышать звуки при повреждении органов слуха @@ -158,7 +158,7 @@ Влияет на юнита Зевса Afeta Zeus CR Efecto Zeus RC - Ovlivnit Zeus RC + Vliv na Zeus RC Allow zeus remote controlled units to be able to take hearing damage. @@ -174,12 +174,14 @@ Dodaj stopery dla jednostek Добавлять юнитам беруши Adiciona protetores de ouvido as unidades + Přidat špunty jednotce Add the `ACE_EarPlugs` item to all units that have loud weapons. Can disable if using custom loadouts. Dodaje `ACE_EarPlugs` - stopery - do wszystkich jednostek, które posiadają głośną broń. Można wyłaczyć w przypadku korzystania z niestandardowych loadoutów. Добавляет предмет `ACE_EarPlugs` всем юнитам, которые имеют громкое оружие. Можно отключить при ручной настройке снаряжения. Adicionar o item `ACE_EarPlugs` a todas as unidades que tenham armas barulhentas. Pode ser desabilitado com carregamentos customizados. + Přidat `ACE_EarPlugs` všem jednotkám které mají zbraň. Můžete vypnout, pokud používáte vlastní výbavu. \ No newline at end of file diff --git a/addons/hitreactions/script_component.hpp b/addons/hitreactions/script_component.hpp index 011a3b6c31..f445ce3f8d 100644 --- a/addons/hitreactions/script_component.hpp +++ b/addons/hitreactions/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT hitreactions #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_HITREACTIONS #define DEBUG_MODE_FULL #endif diff --git a/addons/huntir/script_component.hpp b/addons/huntir/script_component.hpp index 385c0985ae..5c99e04d46 100644 --- a/addons/huntir/script_component.hpp +++ b/addons/huntir/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_HUNTIR #define DEBUG_MODE_FULL diff --git a/addons/huntir/stringtable.xml b/addons/huntir/stringtable.xml index 5cb9729dd7..bf249453d2 100644 --- a/addons/huntir/stringtable.xml +++ b/addons/huntir/stringtable.xml @@ -17,7 +17,7 @@ HuntIR Round HuntIR Granate Proyectil HuntIR - HuntIR Round + HuntIR náboj HuntIR снаряд HuntIR Round Nabój HuntIR @@ -101,7 +101,7 @@ Help Hilfe Ayuda - Pomoc + Nápověda Помощь Help Pomoc diff --git a/addons/interact_menu/XEH_clientInit.sqf b/addons/interact_menu/XEH_clientInit.sqf index f5e8a57db5..fe3b33feb5 100644 --- a/addons/interact_menu/XEH_clientInit.sqf +++ b/addons/interact_menu/XEH_clientInit.sqf @@ -79,8 +79,7 @@ GVAR(ParsedTextCached) = []; //Debug to help end users identify mods that break CBA's XEH [{ - private ["_badClassnames"]; - _badClassnames = []; + private _badClassnames = []; { //Only check Land objects (WeaponHolderSimulated show up in `vehicles` for some reason) if ((_x isKindOf "Land") && {(isNil (format [QGVAR(Act_%1), typeOf _x])) || {isNil (format [QGVAR(SelfAct_%1), typeOf _x])}}) then { diff --git a/addons/interact_menu/XEH_preInit.sqf b/addons/interact_menu/XEH_preInit.sqf index 73b543250e..92f6d61fde 100644 --- a/addons/interact_menu/XEH_preInit.sqf +++ b/addons/interact_menu/XEH_preInit.sqf @@ -74,11 +74,6 @@ GVAR(collectedActionPoints) = []; GVAR(foundActions) = []; GVAR(lastTimeSearchedActions) = -1000; - -// Init CAManBase menus -["CAManBase"] call FUNC(compileMenu); -["CAManBase"] call FUNC(compileMenuSelfAction); - // Init zeus menu [] call FUNC(compileMenuZeus); diff --git a/addons/interact_menu/functions/fnc_addActionToClass.sqf b/addons/interact_menu/functions/fnc_addActionToClass.sqf index f720903a6d..68efce4f2c 100644 --- a/addons/interact_menu/functions/fnc_addActionToClass.sqf +++ b/addons/interact_menu/functions/fnc_addActionToClass.sqf @@ -30,9 +30,8 @@ if (_typeNum == 0) then { [_objectType] call FUNC(compileMenuSelfAction); }; -private ["_varName","_actionTrees", "_parentNode"]; -_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType]; -_actionTrees = missionNamespace getVariable [_varName, []]; +private _varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType]; +private _actionTrees = missionNamespace getVariable [_varName, []]; if((count _actionTrees) == 0) then { missionNamespace setVariable [_varName, _actionTrees]; }; @@ -41,7 +40,7 @@ if (_parentPath isEqualTo ["ACE_MainActions"]) then { [_objectType, _typeNum] call FUNC(addMainAction); }; -_parentNode = [_actionTrees, _parentPath] call FUNC(findActionNode); +private _parentNode = [_actionTrees, _parentPath] call FUNC(findActionNode); if (isNil {_parentNode}) exitWith { ERROR("Failed to add action"); ACE_LOGERROR_4("action (%1) to parent %2 on object %3 [%4]",(_action select 0),_parentPath,_objectType,_typeNum); diff --git a/addons/interact_menu/functions/fnc_addActionToObject.sqf b/addons/interact_menu/functions/fnc_addActionToObject.sqf index 8cd2270d48..31e15ae7aa 100644 --- a/addons/interact_menu/functions/fnc_addActionToObject.sqf +++ b/addons/interact_menu/functions/fnc_addActionToObject.sqf @@ -23,10 +23,10 @@ if (!params [["_object", objNull, [objNull]], ["_typeNum", 0, [0]], ["_parentPat ERROR("Bad Params"); }; -private ["_varName","_actionList"]; -_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum; -_actionList = _object getVariable [_varName, []]; -if((count _actionList) == 0) then { +private _varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum; +private _actionList = _object getVariable [_varName, []]; + +if (_actionList isEqualTo []) then { _object setVariable [_varName, _actionList]; }; diff --git a/addons/interact_menu/functions/fnc_addMainAction.sqf b/addons/interact_menu/functions/fnc_addMainAction.sqf index cf2a3f51d4..161e12d6de 100644 --- a/addons/interact_menu/functions/fnc_addMainAction.sqf +++ b/addons/interact_menu/functions/fnc_addMainAction.sqf @@ -18,14 +18,12 @@ params ["_objectType", "_typeNum"]; -private["_actionTrees", "_mainAction", "_parentNode", "_varName"]; - -_varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType]; -_actionTrees = missionNamespace getVariable [_varName, []]; -_parentNode = [_actionTrees, ["ACE_MainActions"]] call FUNC(findActionNode); +private _varName = format [[QGVAR(Act_%1), QGVAR(SelfAct_%1)] select _typeNum, _objectType]; +private _actionTrees = missionNamespace getVariable [_varName, []]; +private _parentNode = [_actionTrees, ["ACE_MainActions"]] call FUNC(findActionNode); if (isNil {_parentNode}) then { TRACE_2("No Main Action on object", _objectType, _typeNum); - _mainAction = ["ACE_MainActions", localize ELSTRING(interaction,MainAction), "", {}, {true}] call FUNC(createAction); + private _mainAction = ["ACE_MainActions", localize ELSTRING(interaction,MainAction), "", {}, {true}] call FUNC(createAction); [_objectType, _typeNum, [], _mainAction] call EFUNC(interact_menu,addActionToClass); }; diff --git a/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf index 4da303f618..42fcf96cc7 100644 --- a/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf +++ b/addons/interact_menu/functions/fnc_collectActiveActionTree.sqf @@ -6,6 +6,7 @@ * 0: Object * 1: Original action tree * 2: Parent path + * 3: Distance to base point (will be 0 for self/zeus/in-vehicle) * * Return value: * Active children @@ -14,13 +15,11 @@ */ #include "script_component.hpp" -params ["_object", "_origAction", "_parentPath"]; +params ["_object", "_origAction", "_parentPath", "_distanceToBasePoint"]; _origAction params ["_origActionData", "_origActionChildren"]; -private ["_target","_player","_fullPath","_activeChildren","_dynamicChildren","_action","_actionData","_x"]; - -_target = _object; -_player = ACE_player; +private _target = _object; +private _player = ACE_player; // Check if the function should be modified first if !((_origActionData select 10) isEqualTo {}) then { @@ -29,54 +28,62 @@ if !((_origActionData select 10) isEqualTo {}) then { [_target, ACE_player, _origActionData select 6, _origActionData] call (_origActionData select 10); }; +_origActionData params ["_actionName", "", "", "_statementCode", "_conditionCode", "_insertChildrenCode", "_customParams", "", "_distance"]; + // Return nothing if the action itself is not active -if !([_target, ACE_player, _origActionData select 6] call (_origActionData select 4)) exitWith { +if !([_target, ACE_player, _customParams] call _conditionCode) exitWith { [] }; -_fullPath = +_parentPath; -_fullPath pushBack (_origActionData select 0); -_activeChildren = []; +// Return nothing if the action is to far (including checking sub actions) [DISABLED FOR NOW ref #2196] +// if (_distanceToBasePoint > _distance) exitWith { + // [] +// }; + +private _fullPath = +_parentPath; +_fullPath pushBack _actionName; +private _activeChildren = []; // If there's a statement to dynamically insert children then execute it -if !({} isEqualTo (_origActionData select 5)) then { - _dynamicChildren = [_target, ACE_player, _origActionData select 6] call (_origActionData select 5); +if !({} isEqualTo _insertChildrenCode) then { + private _dynamicChildren = [_target, ACE_player, _customParams] call _insertChildrenCode; // Collect dynamic children class actions { - _action = [_x select 2, _x, _fullPath] call FUNC(collectActiveActionTree); + private _action = [_x select 2, _x, _fullPath, _distanceToBasePoint] call FUNC(collectActiveActionTree); if ((count _action) > 0) then { _activeChildren pushBack _action; }; - } forEach _dynamicChildren; + nil + } count _dynamicChildren; }; // Collect children class actions { - _action = [_object, _x, _fullPath] call FUNC(collectActiveActionTree); + private _action = [_object, _x, _fullPath, _distanceToBasePoint] call FUNC(collectActiveActionTree); if ((count _action) > 0) then { _activeChildren pushBack _action; }; -} forEach _origActionChildren; + nil +} count _origActionChildren; // Collect children object actions { - EXPLODE_2_PVT(_x,_actionData,_pPath); + _x params ["_actionData", "_pPath"]; // Check if the action is children of the original action - if (count _pPath == count _fullPath && - {_pPath isEqualTo _fullPath}) then { - - _action = [_object, [_actionData,[]], _fullPath] call FUNC(collectActiveActionTree); + if (_pPath isEqualTo _fullPath) then { + private _action = [_object, [_actionData,[]], _fullPath, _distanceToBasePoint] call FUNC(collectActiveActionTree); if ((count _action) > 0) then { _activeChildren pushBack _action; }; }; -} forEach GVAR(objectActionList); + nil +} count GVAR(objectActionList); // If the original action has no statement, and no children, don't display it -if ((count _activeChildren) == 0 && ((_origActionData select 3) isEqualTo {})) exitWith { +if ((_activeChildren isEqualTo []) && {_statementCode isEqualTo {}}) exitWith { // @todo: Account for showDisabled? [] }; diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index d84130e21c..02941626d1 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -14,34 +14,31 @@ params ["_target"]; -private ["_objectType","_actionsVarName","_isMan"]; -_objectType = _target; -_isMan = false; +private _objectType = _target; if (_target isEqualType objNull) then { _objectType = typeOf _target; - _isMan = _target isKindOf "CAManBase"; }; -_actionsVarName = format [QGVAR(Act_%1), _objectType]; +private _actionsVarName = format [QGVAR(Act_%1), _objectType]; // Exit if the action menu is already compiled for this class if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {}; -private "_recurseFnc"; -_recurseFnc = { - private ["_actions", "_displayName", "_distance", "_icon", "_statement", "_position", "_condition", "_showDisabled", "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"]; - params ["_actionsCfg"]; - _actions = []; +private _recurseFnc = { + params ["_actionsCfg", "_parentDistance"]; + private _actions = []; { - _entryCfg = _x; + private _entryCfg = _x; if(isClass _entryCfg) then { - _displayName = getText (_entryCfg >> "displayName"); - _distance = getNumber (_entryCfg >> "distance"); - _icon = getText (_entryCfg >> "icon"); - _statement = compile (getText (_entryCfg >> "statement")); + private _displayName = getText (_entryCfg >> "displayName"); + private _distance = _parentDistance; + if (isNumber (_entryCfg >> "distance")) then {_distance = getNumber (_entryCfg >> "distance");}; + // if (_distance < _parentDistance) then {ACE_LOGWARNING_3("[%1] distance %2 less than parent %3", configName _entryCfg, _distance, _parentDistance);}; + private _icon = getText (_entryCfg >> "icon"); + private _statement = compile (getText (_entryCfg >> "statement")); // If the position entry is present, compile it - _position = getText (_entryCfg >> "position"); + private _position = getText (_entryCfg >> "position"); if (_position != "") then { _position = compile _position; } else { @@ -55,7 +52,7 @@ _recurseFnc = { }; }; - _condition = getText (_entryCfg >> "condition"); + private _condition = getText (_entryCfg >> "condition"); if (_condition == "") then {_condition = "true"}; // Add canInteract (including exceptions) and canInteractWith to condition @@ -63,13 +60,13 @@ _recurseFnc = { _condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; }; - _insertChildren = compile (getText (_entryCfg >> "insertChildren")); - _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); + private _insertChildren = compile (getText (_entryCfg >> "insertChildren")); + private _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); - _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; - _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; - _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; - _runOnHover = false; + private _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; + private _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; + private _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; + private _runOnHover = false; if (isText (_entryCfg >> "runOnHover")) then { _runOnHover = compile getText (_entryCfg >> "runOnHover"); } else { @@ -77,9 +74,9 @@ _recurseFnc = { }; _condition = compile _condition; - _children = [_entryCfg] call _recurseFnc; + private _children = [_entryCfg, _distance] call _recurseFnc; - _entry = [ + private _entry = [ [ configName _entryCfg, _displayName, @@ -97,19 +94,16 @@ _recurseFnc = { ]; _actions pushBack _entry; }; - } forEach (configProperties [_actionsCfg, "isClass _x", true]); + nil + } count (configProperties [_actionsCfg, "isClass _x", true]); _actions }; -private ["_actionsCfg","_actions"]; -_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions"; +private _actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_Actions"; + +TRACE_1("Building ACE_Actions",_objectType); +private _actions = [_actionsCfg, 0] call _recurseFnc; -// If the classname inherits from CAManBase, just copy it's menu without recompiling a new one -_actions = if (_isMan) then { - + (missionNamespace getVariable QGVAR(Act_CAManBase)) -} else { - [_actionsCfg] call _recurseFnc -}; missionNamespace setVariable [_actionsVarName, _actions]; /* @@ -125,7 +119,7 @@ missionNamespace setVariable [_actionsVarName, _actions]; [], {[0,0,0]}, 1, - [false,false,false] + [false,false,false,false,false] ], [children actions] ] diff --git a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf index 123f83110d..de1364ee84 100644 --- a/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuSelfAction.sqf @@ -14,46 +14,42 @@ params ["_target"]; -private ["_objectType","_actionsVarName","_isMan"]; -_objectType = _target; -_isMan = false; +private _objectType = _target; if (_target isEqualType objNull) then { _objectType = typeOf _target; - _isMan = _target isKindOf "CAManBase"; }; -_actionsVarName = format [QGVAR(SelfAct_%1), _objectType]; +private _actionsVarName = format [QGVAR(SelfAct_%1), _objectType]; // Exit if the action menu is already compiled for this class if !(isNil {missionNamespace getVariable [_actionsVarName, nil]}) exitWith {}; -private "_recurseFnc"; -_recurseFnc = { - private ["_actions", "_displayName", "_icon", "_statement", "_condition", "_showDisabled", - "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"]; + +private _recurseFnc = { params ["_actionsCfg"]; - _actions = []; + + private _actions = []; { - _entryCfg = _x; + private _entryCfg = _x; if(isClass _entryCfg) then { - _displayName = getText (_entryCfg >> "displayName"); + private _displayName = getText (_entryCfg >> "displayName"); - _icon = getText (_entryCfg >> "icon"); - _statement = compile (getText (_entryCfg >> "statement")); + private _icon = getText (_entryCfg >> "icon"); + private _statement = compile (getText (_entryCfg >> "statement")); - _condition = getText (_entryCfg >> "condition"); + private _condition = getText (_entryCfg >> "condition"); if (_condition == "") then {_condition = "true"}; // Add canInteract (including exceptions) and canInteractWith to condition _condition = _condition + format [QUOTE( && {[ARR_3(ACE_player, _target, %1)] call EFUNC(common,canInteractWith)} ), getArray (_entryCfg >> "exceptions")]; - _insertChildren = compile (getText (_entryCfg >> "insertChildren")); - _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); + private _insertChildren = compile (getText (_entryCfg >> "insertChildren")); + private _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); - _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; - _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; - _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; - _runOnHover = true; + private _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; + private _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; + private _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; + private _runOnHover = true; if (isText (_entryCfg >> "runOnHover")) then { _runOnHover = compile getText (_entryCfg >> "runOnHover"); } else { @@ -61,9 +57,9 @@ _recurseFnc = { }; _condition = compile _condition; - _children = [_entryCfg] call _recurseFnc; + private _children = [_entryCfg] call _recurseFnc; - _entry = [ + private _entry = [ [ configName _entryCfg, _displayName, @@ -81,16 +77,15 @@ _recurseFnc = { ]; _actions pushBack _entry; }; - } forEach (configProperties [_actionsCfg, "isClass _x", true]); + nil + } count (configProperties [_actionsCfg, "isClass _x", true]); _actions }; -private ["_actionsCfg","_actions"]; -_actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_SelfActions"; +private _actionsCfg = configFile >> "CfgVehicles" >> _objectType >> "ACE_SelfActions"; -private ["_baseDisplayName", "_baseIcon"]; -_baseDisplayName = ""; -_baseIcon = ""; +private _baseDisplayName = ""; +private _baseIcon = ""; if (_objectType isKindOf "CAManBase") then { _baseDisplayName = localize LSTRING(SelfActionsRoot); _baseIcon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa"; @@ -107,12 +102,9 @@ if (_objectType isKindOf "CAManBase") then { }; }; -// If the classname inherits from CAManBase, just copy it's menu without recompiling a new one -_actions = if (_isMan) then { - + (missionNamespace getVariable QGVAR(SelfAct_CAManBase)) -} else { - // Create a master action to base on self action - [ +TRACE_1("Building ACE_SelfActions",_objectType); +// Create a master action to base on self action +private _actions = [ [ [ "ACE_SelfActions", @@ -127,11 +119,10 @@ _actions = if (_isMan) then { {}, "Spine3", 10, - [false,true,false] + [false,true,false,false,false] ], [_actionsCfg] call _recurseFnc ] - ] -}; + ]; missionNamespace setVariable [_actionsVarName, _actions]; diff --git a/addons/interact_menu/functions/fnc_compileMenuZeus.sqf b/addons/interact_menu/functions/fnc_compileMenuZeus.sqf index ef7c36abc9..6026735154 100644 --- a/addons/interact_menu/functions/fnc_compileMenuZeus.sqf +++ b/addons/interact_menu/functions/fnc_compileMenuZeus.sqf @@ -15,41 +15,38 @@ // Exit if the action menu is already compiled for zeus if !(isNil {missionNamespace getVariable [QGVAR(ZeusActions), nil]}) exitWith {}; -private "_recurseFnc"; -_recurseFnc = { - private ["_actions", "_displayName", "_icon", "_statement", "_condition", "_showDisabled", - "_enableInside", "_canCollapse", "_runOnHover", "_children", "_entry", "_entryCfg", "_insertChildren", "_modifierFunction"]; +private _recurseFnc = { params ["_actionsCfg"]; - _actions = []; + private _actions = []; { - _entryCfg = _x; + private _entryCfg = _x; if(isClass _entryCfg) then { - _displayName = getText (_entryCfg >> "displayName"); + private _displayName = getText (_entryCfg >> "displayName"); - _icon = getText (_entryCfg >> "icon"); - _statement = compile (getText (_entryCfg >> "statement")); + private _icon = getText (_entryCfg >> "icon"); + private _statement = compile (getText (_entryCfg >> "statement")); - _condition = getText (_entryCfg >> "condition"); + private _condition = getText (_entryCfg >> "condition"); if (_condition == "") then {_condition = "true"}; - _insertChildren = compile (getText (_entryCfg >> "insertChildren")); - _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); + private _insertChildren = compile (getText (_entryCfg >> "insertChildren")); + private _modifierFunction = compile (getText (_entryCfg >> "modifierFunction")); - _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; - _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; - _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; - _runOnHover = true; + private _showDisabled = (getNumber (_entryCfg >> "showDisabled")) > 0; + private _enableInside = (getNumber (_entryCfg >> "enableInside")) > 0; + private _canCollapse = (getNumber (_entryCfg >> "canCollapse")) > 0; + private _runOnHover = true; if (isText (_entryCfg >> "runOnHover")) then { _runOnHover = compile getText (_entryCfg >> "runOnHover"); } else { _runOnHover = (getNumber (_entryCfg >> "runOnHover")) > 0; }; - _condition = compile _condition; - _children = [_entryCfg] call _recurseFnc; + private _condition = compile _condition; + private _children = [_entryCfg] call _recurseFnc; - _entry = [ + private _entry = [ [ configName _entryCfg, _displayName, @@ -60,7 +57,7 @@ _recurseFnc = { {}, [0,0,0], 10, //distace - [_showDisabled,_enableInside,_canCollapse,_runOnHover], + [_showDisabled,_enableInside,_canCollapse,_runOnHover,false], _modifierFunction ], _children @@ -71,8 +68,7 @@ _recurseFnc = { _actions }; -private ["_actionsCfg"]; -_actionsCfg = configFile >> "ACE_ZeusActions"; +private _actionsCfg = configFile >> "ACE_ZeusActions"; // Create a master action to base zeus actions on GVAR(ZeusActions) = [ @@ -87,7 +83,7 @@ GVAR(ZeusActions) = [ {}, {[0,0,0]}, 10, - [false,true,false] + [false,true,false,false,false] ], [_actionsCfg] call _recurseFnc ] diff --git a/addons/interact_menu/functions/fnc_createAction.sqf b/addons/interact_menu/functions/fnc_createAction.sqf index 0edef384d4..db31200c47 100644 --- a/addons/interact_menu/functions/fnc_createAction.sqf +++ b/addons/interact_menu/functions/fnc_createAction.sqf @@ -13,7 +13,7 @@ * 6: Action parameters (Optional) * 7: Position (Position array, Position code or Selection Name) , or (Optional) * 8: Distance (Optional) - * 9: Other parameters (Optional) + * 9: Other parameters [showDisabled,enableInside,canCollapse,runOnHover,doNotCheckLOS] (Optional) * 10: Modifier function (Optional) * * Return value: @@ -26,6 +26,8 @@ */ #include "script_component.hpp" +// IGNORE_PRIVATE_WARNING(_actionName,_displayName,_icon,_statement,_condition,_insertChildren,_customParams,_position,_distance,_params,_modifierFunction); + params [ "_actionName", "_displayName", @@ -41,16 +43,16 @@ params [ ]; _position = if (_position isEqualType "") then { - // If the action is set to a selection, create the suitable code - compile format ["_target selectionPosition '%1'", _position]; + // If the action is set to a selection, create the suitable code - IGNORE_PRIVATE_WARNING(_target); + compile format ["_target selectionPosition '%1'", _position]; +} else { + if (_position isEqualType []) then { + // If the action is set to a array position, create the suitable code + compile format ["%1", _position]; } else { - if (_position isEqualType []) then { - // If the action is set to a array position, create the suitable code - compile format ["%1", _position]; - } else { - _position; - }; + _position; }; +}; [ _actionName, @@ -58,7 +60,6 @@ _position = if (_position isEqualType "") then { _icon, _statement, _condition, - _insertChildren, _customParams, _position, diff --git a/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf b/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf index 334fc13f25..1c4e535d66 100644 --- a/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf +++ b/addons/interact_menu/functions/fnc_ctrlSetParsedTextCached.sqf @@ -1,11 +1,24 @@ -// by commy2 +/* + * Author: commy2 + * Sets the controls structured text if it isn't already set. + * + * Argument: + * 0: Structured Text Ctrl + * 1: Index + * 2: Text + * + * Return value: + * None + * + * Public: No + */ #include "script_component.hpp" params ["_ctrl", "_index", "_text"]; //systemChat str (_text != ARR_SELECT(GVAR(ParsedTextCached),_index,"-1")); -if (_text != ARR_SELECT(GVAR(ParsedTextCached),_index,"-1")) then { +if (_text != (GVAR(ParsedTextCached) param [_index,"-1"])) then { GVAR(ParsedTextCached) set [_index, _text]; _ctrl ctrlSetStructuredText parseText _text; }; diff --git a/addons/interact_menu/functions/fnc_findActionNode.sqf b/addons/interact_menu/functions/fnc_findActionNode.sqf index 41ab658a62..edd0cace04 100644 --- a/addons/interact_menu/functions/fnc_findActionNode.sqf +++ b/addons/interact_menu/functions/fnc_findActionNode.sqf @@ -11,7 +11,7 @@ * Action node or if not found * * Example: - * [_actionTree, ["ACE_TapShoulderRight","VulcanPinchAction"]] call ace_interact_menu_fnc_findActionNode; + * [actionTree, ["ACE_TapShoulderRight","VulcanPinchAction"]] call ace_interact_menu_fnc_findActionNode; * * Public: No */ @@ -19,18 +19,16 @@ params ["_actionTreeList", "_parentPath"]; -private ["_parentNode", "_foundParentNode", "_fnc_findFolder", "_actionTree"]; - // Hack to make this work on the root node too -if (count _parentPath == 0) exitWith { +if (_parentPath isEqualTo []) exitWith { [[],_actionTreeList] }; // Search the class action trees and find where to insert the entry -_parentNode = [[],_actionTreeList]; -_foundParentNode = false; +private _parentNode = [[],_actionTreeList]; +private _foundParentNode = false; -_fnc_findFolder = { +private _fnc_findFolder = { params ["_parentPath", "_level", "_actionNode"]; { diff --git a/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf b/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf index a0962d7883..d8ad91c434 100644 --- a/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf +++ b/addons/interact_menu/functions/fnc_handlePlayerChanged.sqf @@ -14,8 +14,7 @@ params ["_newUnit", "_oldUnit"]; // add to new unit -private "_ehid"; -_ehid = [_newUnit, "DefaultAction", {GVAR(openedMenuType) >= 0}, { +private _ehid = [_newUnit, "DefaultAction", {GVAR(openedMenuType) >= 0}, { if (!GVAR(actionOnKeyRelease) && GVAR(actionSelected)) then { [GVAR(openedMenuType),true] call FUNC(keyUp); }; diff --git a/addons/interact_menu/functions/fnc_isSubPath.sqf b/addons/interact_menu/functions/fnc_isSubPath.sqf index 0a02fe2ea7..53d88eb9d1 100644 --- a/addons/interact_menu/functions/fnc_isSubPath.sqf +++ b/addons/interact_menu/functions/fnc_isSubPath.sqf @@ -9,18 +9,20 @@ * Return value: * Bool * + * Example: + * [[["ACE_SelfActions", player],["ace_Gestures", player]], [["ACE_SelfActions", player]]] call ace_interact_menu_fnc_isSubPath + * * Public: No */ #include "script_component.hpp" params ["_longPath", "_shortPath"]; -private ["_isSubPath","_i"]; -_isSubPath = true; +private _isSubPath = true; if (count _shortPath > count _longPath) exitWith {false}; -for [{_i = 0},{_i < count _shortPath},{_i = _i + 1}] do { +for [{private _i = 0},{_i < count _shortPath},{_i = _i + 1}] do { if !((_longPath select _i) isEqualTo (_shortPath select _i)) exitWith { _isSubPath = false; }; diff --git a/addons/interact_menu/functions/fnc_keyDown.sqf b/addons/interact_menu/functions/fnc_keyDown.sqf index 56c0e6e19c..a8759a5007 100644 --- a/addons/interact_menu/functions/fnc_keyDown.sqf +++ b/addons/interact_menu/functions/fnc_keyDown.sqf @@ -65,7 +65,7 @@ if (GVAR(useCursorMenu)) then { // uiNamespace getVariable QGVAR(cursorMenuOpened); GVAR(cursorPos) = [0.5,0.5,0]; - _ctrl = (findDisplay 91919) ctrlCreate ["RscStructuredText", 9922]; + private _ctrl = (findDisplay 91919) ctrlCreate ["RscStructuredText", 9922]; _ctrl ctrlSetPosition [safeZoneX, safeZoneY, safeZoneW, safeZoneH]; _ctrl ctrlCommit 0; @@ -75,8 +75,7 @@ if (GVAR(useCursorMenu)) then { setMousePosition [0.5, 0.5]; }; -GVAR(selfMenuOffset) = ((positionCameraToWorld [0, 0, 2]) call EFUNC(common,positionToASL)) vectorDiff - ((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)); +GVAR(selfMenuOffset) = (AGLtoASL (positionCameraToWorld [0, 0, 2])) vectorDiff (AGLtoASL (positionCameraToWorld [0, 0, 0])); if (GVAR(menuAnimationSpeed) > 0) then { //Auto expand the first level when self, mounted vehicle or zeus (skips the first animation as there is only one choice) diff --git a/addons/interact_menu/functions/fnc_keyUp.sqf b/addons/interact_menu/functions/fnc_keyUp.sqf index 86580afa67..b6eae6f527 100644 --- a/addons/interact_menu/functions/fnc_keyUp.sqf +++ b/addons/interact_menu/functions/fnc_keyUp.sqf @@ -24,9 +24,8 @@ if (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]) then { if(GVAR(actionSelected)) then { this = GVAR(selectedTarget); - private ["_player","_target","_actionData"]; - _player = ACE_Player; - _target = GVAR(selectedTarget); + private _player = ACE_Player; + private _target = GVAR(selectedTarget); // Clear the conditions caches ["clearConditionCaches", []] call EFUNC(common,localEvent); @@ -35,7 +34,7 @@ if(GVAR(actionSelected)) then { if (!(GVAR(actionOnKeyRelease)) && !_calledByClicking) exitWith {}; // Check the action conditions - _actionData = GVAR(selectedAction) select 0; + private _actionData = GVAR(selectedAction) select 0; if ([_target, _player, _actionData select 6] call (_actionData select 4)) then { // Call the statement [_target, _player, _actionData select 6] call (_actionData select 3); diff --git a/addons/interact_menu/functions/fnc_render.sqf b/addons/interact_menu/functions/fnc_render.sqf index 1f7cf8140b..7ca243817c 100644 --- a/addons/interact_menu/functions/fnc_render.sqf +++ b/addons/interact_menu/functions/fnc_render.sqf @@ -8,8 +8,12 @@ * Return value: * None * + * Example: + * [] call ace_interact_menu_fnc_render + * * Public: No */ +// #define ENABLE_PERFORMANCE_COUNTERS #include "script_component.hpp" BEGIN_COUNTER(fnc_render); @@ -42,7 +46,7 @@ if (GVAR(openedMenuType) >= 0) then { }; } forEach GVAR(currentOptions); - if(_closestSelection == -1) exitWith {}; + if (_closestSelection == -1) exitWith {END_COUNTER(fnc_renderMenuOpen);}; private _closest = GVAR(currentOptions) select _closestSelection; _closest params ["_action", "_sPos", "_hoverPath"]; diff --git a/addons/interact_menu/functions/fnc_renderActionPoints.sqf b/addons/interact_menu/functions/fnc_renderActionPoints.sqf index c5b2c887ce..1d42f38c6c 100644 --- a/addons/interact_menu/functions/fnc_renderActionPoints.sqf +++ b/addons/interact_menu/functions/fnc_renderActionPoints.sqf @@ -14,56 +14,57 @@ GVAR(currentOptions) = []; -private ["_player","_numInteractObjects","_numInteractions","_actionsVarName","_classActions","_target","_player","_action","_cameraPos","_cameraDir", "_lambda", "_nearestObjects", "_pos", "_virtualPoint", "_wavesAtOrigin", "_wavesAtVirtualPoint"]; -_player = ACE_player; +private _player = ACE_player; -_cameraPos = (positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL); -_cameraDir = ((positionCameraToWorld [0, 0, 1]) call EFUNC(common,positionToASL)) vectorDiff _cameraPos; +private _cameraPosASL = AGLtoASL (positionCameraToWorld [0, 0, 0]); +private _cameraDir = (AGLtoASL (positionCameraToWorld [0, 0, 1])) vectorDiff _cameraPosASL; -_fnc_renderNearbyActions = { +private _fnc_renderNearbyActions = { // Render all nearby interaction menus #define MAXINTERACTOBJECTS 3 GVAR(foundActions) = []; GVAR(lastTimeSearchedActions) = ACE_diagTime; - _numInteractObjects = 0; - _nearestObjects = nearestObjects [ACE_player, ["All"], 13]; + private _numInteractObjects = 0; + private _nearestObjects = nearestObjects [ACE_player, ["All"], 13]; { - _target = _x; + private _target = _x; // Quick oclussion test. Skip objects more than 1 m behind the camera plane - _lambda = ((getPosASL _x) vectorDiff _cameraPos) vectorDotProduct _cameraDir; + private _lambda = ((getPosASL _x) vectorDiff _cameraPosASL) vectorDotProduct _cameraDir; if ((_lambda > -1) && {!isObjectHidden _target}) then { - _numInteractions = 0; + private _numInteractions = 0; // Prevent interacting with yourself or your own vehicle if (_target != ACE_player && {_target != vehicle ACE_player}) then { // Iterate through object actions, find base level actions and render them if appropiate - _actionsVarName = format [QGVAR(Act_%1), typeOf _target]; GVAR(objectActionList) = _target getVariable [QGVAR(actions), []]; { // Only render them directly if they are base level actions - if (count (_x select 1) == 0) then { + if ((_x select 1) isEqualTo []) then { // Try to render the menu - _action = _x; + private _action = _x; if ([_target, _action] call FUNC(renderBaseMenu)) then { _numInteractions = _numInteractions + 1; GVAR(foundActions) pushBack [_target, _action, GVAR(objectActionList)]; }; }; - } forEach GVAR(objectActionList); + nil + } count GVAR(objectActionList); // Iterate through base level class actions and render them if appropiate - _classActions = missionNamespace getVariable [_actionsVarName, []]; + private _actionsVarName = format [QGVAR(Act_%1), typeOf _target]; + private _classActions = missionNamespace getVariable [_actionsVarName, []]; { - _action = _x; + private _action = _x; // Try to render the menu if ([_target, _action] call FUNC(renderBaseMenu)) then { _numInteractions = _numInteractions + 1; GVAR(foundActions) pushBack [_target, _action, GVAR(objectActionList)]; }; - } forEach _classActions; + nil + } count _classActions; // Limit the amount of objects the player can interact with if (_numInteractions > 0) then { @@ -73,44 +74,33 @@ _fnc_renderNearbyActions = { }; if (_numInteractObjects >= MAXINTERACTOBJECTS) exitWith {}; - } forEach _nearestObjects; + nil + } count _nearestObjects; }; -_fnc_renderLastFrameActions = { +private _fnc_renderLastFrameActions = { { _x params ["_target", "_action", "_objectActionList"]; GVAR(objectActionList) = _objectActionList; [_target, _action] call FUNC(renderBaseMenu); - } forEach GVAR(foundActions); + nil + } count GVAR(foundActions); }; -_fnc_renderSelfActions = { - _target = _this; +private _fnc_renderSelfActions = { + private _target = _this; - // Iterate through object actions, find base level actions and render them if appropiate - _actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target]; + // Set object actions for collectActiveActionTree GVAR(objectActionList) = _target getVariable [QGVAR(selfActions), []]; - /* - { - _action = _x; - // Only render them directly if they are base level actions - if (count (_action select 7) == 1) then { - [_target, _action, 0, [180, 360]] call FUNC(renderMenu); - }; - } forEach GVAR(objectActionList); - */ // Iterate through base level class actions and render them if appropiate - _actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target]; - _classActions = missionNamespace getVariable [_actionsVarName, []]; + private _actionsVarName = format [QGVAR(SelfAct_%1), typeOf _target]; + private _classActions = missionNamespace getVariable [_actionsVarName, []]; - _pos = if !(GVAR(useCursorMenu)) then { - _virtualPoint = (((positionCameraToWorld [0, 0, 0]) call EFUNC(common,positionToASL)) vectorAdd GVAR(selfMenuOffset)) call EFUNC(common,ASLToPosition); - _wavesAtOrigin = [(positionCameraToWorld [0, 0, 0])] call EFUNC(common,waveHeightAt); - _wavesAtVirtualPoint = [_virtualPoint] call EFUNC(common,waveHeightAt); - _virtualPoint set [2, ((_virtualPoint select 2) - _wavesAtOrigin + _wavesAtVirtualPoint)]; - _virtualPoint + private _pos = if !(GVAR(useCursorMenu)) then { + //Convert to ASL, add offset and then convert back to AGL (handles waves when over water) + ASLtoAGL ((AGLtoASL (positionCameraToWorld [0, 0, 0])) vectorAdd GVAR(selfMenuOffset)); } else { [0.5, 0.5] }; @@ -118,14 +108,16 @@ _fnc_renderSelfActions = { { _action = _x; [_target, _action, _pos] call FUNC(renderBaseMenu); - } forEach _classActions; + nil + } count _classActions; }; -_fnc_renderZeusActions = { +private _fnc_renderZeusActions = { { - _action = _x; + private _action = _x; [_this, _action, [0.5, 0.5]] call FUNC(renderBaseMenu); - } forEach GVAR(ZeusActions); + nil + } count GVAR(ZeusActions); }; @@ -160,11 +152,10 @@ if (count GVAR(collectedActionPoints) > 1) then { // Order action points according to z GVAR(collectedActionPoints) sort true; - private ["_i","_j","_delta"]; - for [{_i = count GVAR(collectedActionPoints) - 1}, {_i > 0}, {_i = _i - 1}] do { - for [{_j = _i - 1}, {_j >= 0}, {_j = _j - 1}] do { + for [{private _i = count GVAR(collectedActionPoints) - 1}, {_i > 0}, {_i = _i - 1}] do { + for [{private _j = _i - 1}, {_j >= 0}, {_j = _j - 1}] do { // Check if action point _i is ocluded by _j - _delta = vectorNormalized ((GVAR(collectedActionPoints) select _i select 1) vectorDiff (GVAR(collectedActionPoints) select _j select 1)); + private _delta = vectorNormalized ((GVAR(collectedActionPoints) select _i select 1) vectorDiff (GVAR(collectedActionPoints) select _j select 1)); // If _i is inside a cone with 20º half angle with origin on _j if (_delta select 2 > 0.94) exitWith { @@ -178,4 +169,5 @@ if (count GVAR(collectedActionPoints) > 1) then { { _x params ["_z", "_sPos", "_activeActionTree"]; [[], _activeActionTree, _sPos, [180,360]] call FUNC(renderMenu); -} forEach GVAR(collectedActionPoints); + nil +} count GVAR(collectedActionPoints); diff --git a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf index a5ccabf3bf..2bb2808b28 100644 --- a/addons/interact_menu/functions/fnc_renderBaseMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderBaseMenu.sqf @@ -16,88 +16,83 @@ BEGIN_COUNTER(fnc_renderBaseMenu) -private ["_distance","_pos","_weaponDir","_ref","_sPos","_activeActionTree", "_line"]; - params ["_object", "_baseActionNode"]; _baseActionNode params ["_actionData"]; +_actionData params ["_actionName", "", "", "", "", "", "", "_positionCode", "_distance", "_params"]; -_distance = _actionData select 8; // Obtain a 3D position for the action -_pos = if((count _this) > 2) then { +private _pos = if((count _this) > 2) then { _this select 2 } else { // Setup scope variables for position code - private ["_target"]; - _target = _object; + private _target = _object; // Get action position - _object modelToWorldVisual (call (_actionData select 7)) + _object modelToWorldVisual (call _positionCode) }; // For non-self actions, exit if the action is too far away or ocluded -if (GVAR(openedMenuType) == 0 && (vehicle ACE_player == ACE_player) && (isNull curatorCamera) && +private _distanceToBasePoint = 0; //This will be 0 for self/zeus/in-vehicle (used later to check sub action distance) +if ((GVAR(openedMenuType) == 0) && {vehicle ACE_player == ACE_player} && {isNull curatorCamera} && { - private ["_headPos","_actualDistance"]; - _headPos = ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot"); - _actualDistance = _headPos distance _pos; + private _headPos = ACE_player modelToWorldVisual (ACE_player selectionPosition "pilot"); + _distanceToBasePoint = _headPos distance _pos; - if (_actualDistance > _distance) exitWith {true}; + if (_distanceToBasePoint > _distance) exitWith {true}; - if ((_actualDistance > 1.5) && {!((_actionData select 9) select 4)}) exitWith { - // If distance to action is greater than 1.5 m, check LOS - _line = [_headPos call EFUNC(common,positionToASL), _pos call EFUNC(common,positionToASL), _object, ACE_player]; - lineIntersects _line + if ((_distanceToBasePoint > 1.5) && {!(_params select 4)}) exitWith { + // If distance to action is greater than 1.5 m and check isn't disabled in params, check LOS + lineIntersects [AGLtoASL _headPos, AGLtoASL _pos, _object, ACE_player] }; false }) exitWith {false}; // Exit if the action is behind you -_sPos = if (count _pos != 2) then { +private _sPos = if (count _pos != 2) then { worldToScreen _pos } else { _pos }; -if(count _sPos == 0) exitWith {false}; +if (_sPos isEqualTo []) exitWith {false}; // Exit if the action is off screen -if ((_sPos select 0) < safeZoneXAbs || (_sPos select 0) > safeZoneXAbs + safeZoneWAbs) exitWith {false}; -if ((_sPos select 1) < safeZoneY || (_sPos select 1) > safeZoneY + safeZoneH) exitWith {false}; +if ((_sPos select 0) < safeZoneXAbs || {(_sPos select 0) > safeZoneXAbs + safeZoneWAbs}) exitWith {false}; +if ((_sPos select 1) < safeZoneY || {(_sPos select 1) > safeZoneY + safeZoneH}) exitWith {false}; BEGIN_COUNTER(fnc_collectActiveActionTree) // Collect active tree -private "_uid"; -_uid = format [QGVAR(ATCache_%1), _actionData select 0]; -_activeActionTree = [ - [_object, _baseActionNode, []], +private _uid = format [QGVAR(ATCache_%1), _actionName]; +private _activeActionTree = [ + [_object, _baseActionNode, [], _distanceToBasePoint], DFUNC(collectActiveActionTree), _object, _uid, 1.0, "interactMenuClosed" ] call EFUNC(common,cachedCall); END_COUNTER(fnc_collectActiveActionTree) -/* +#ifdef DEBUG_MODE_EXTRA diag_log "Printing: _activeActionTree"; -_fnc_print = { - EXPLODE_2_PVT(_this,_level,_node); - EXPLODE_3_PVT(_node,_actionData,_children,_object); +[0, _activeActionTree] call { + params ["_level", "_node"]; + _node params ["_actionData", "_children", "_object"]; diag_log text format ["Level %1 -> %2 on %3", _level, _actionData select 0, _object]; { [_level + 1, _x] call _fnc_print; } forEach _children; }; -[0, _activeActionTree] call _fnc_print; -*/ +#endif + // Check if there's something left for rendering -if (count _activeActionTree == 0) exitWith {false}; +if (_activeActionTree isEqualTo []) exitWith {false}; BEGIN_COUNTER(fnc_renderMenus); -// IGNORE_PRIVATE_WARNING(_cameraPos,_cameraDir); +// IGNORE_PRIVATE_WARNING(_cameraPosASL,_cameraDir); if (count _pos > 2) then { - _sPos pushBack (((_pos call EFUNC(common,positionToASL)) vectorDiff _cameraPos) vectorDotProduct _cameraDir); + _sPos pushBack (((AGLtoASL _pos) vectorDiff _cameraPosASL) vectorDotProduct _cameraDir); } else { _sPos pushBack 0; }; diff --git a/addons/interact_menu/functions/fnc_renderIcon.sqf b/addons/interact_menu/functions/fnc_renderIcon.sqf index ab909964de..9ead5c65cf 100644 --- a/addons/interact_menu/functions/fnc_renderIcon.sqf +++ b/addons/interact_menu/functions/fnc_renderIcon.sqf @@ -15,21 +15,20 @@ */ #include "script_component.hpp" #define DEFAULT_ICON QUOTE(\z\ace\addons\interaction\ui\dot_ca.paa) -private ["_ctrl", "_pos", "_displayNum"]; params ["_text", "_icon", "_sPos", "_textSettings"]; -//systemChat format ["Icon %1 - %2,%3", _text, _sPos select 0, _sPos select 1]; +TRACE_2("Icon",_text,_sPos); if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { - _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); + private _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]); if (GVAR(useCursorMenu)) then { ((finddisplay _displayNum) displayctrl (54021+GVAR(iconCount))) ctrlAddEventHandler ["MouseMoving", DFUNC(handleMouseMovement)]; ((finddisplay _displayNum) displayctrl (54021+GVAR(iconCount))) ctrlAddEventHandler ["MouseButtonDown", DFUNC(handleMouseButtonDown)]; }; }; -_ctrl = GVAR(iconCtrls) select GVAR(iconCount); +private _ctrl = GVAR(iconCtrls) select GVAR(iconCount); if(_icon == "") then { _icon = DEFAULT_ICON; @@ -41,11 +40,10 @@ _text = if (GVAR(UseListMenu)) then { format ["
%3", _icon, _textSettings, "ace_break_line" callExtension _text]; }; -//_ctrl ctrlSetStructuredText parseText _text; [_ctrl, GVAR(iconCount), _text] call FUNC(ctrlSetParsedTextCached); GVAR(iconCount) = GVAR(iconCount) + 1; -_pos = if (GVAR(UseListMenu)) then { +private _pos = if (GVAR(UseListMenu)) then { [(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW] } else { [(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW] diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index 573845c08a..6abb980620 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -15,22 +15,20 @@ */ #include "script_component.hpp" -private ["_menuInSelectedPath", "_path", "_menuDepth", "_x", "_offset", "_newPos", "_forEachIndex", "_player", "_pos", "_target", "_textSettings"]; - params ["_parentPath", "_action", "_sPos", "_angles"]; _action params ["_actionData", "_activeChildren", "_actionObject"]; _angles params ["_centerAngle", "_maxAngleSpan"]; -_menuDepth = (count GVAR(menuDepthPath)); +private _menuDepth = (count GVAR(menuDepthPath)); //BEGIN_COUNTER(constructing_paths); // Store path to action -_path = +_parentPath; +private _path = +_parentPath; _path pushBack [_actionData select 0,_actionObject]; // Check if the menu is on the selected path -_menuInSelectedPath = true; +private _menuInSelectedPath = true; { if (_forEachIndex >= (count GVAR(menuDepthPath))) exitWith { _menuInSelectedPath = false; @@ -44,7 +42,7 @@ _menuInSelectedPath = true; //BEGIN_COUNTER(constructing_colors); //Get text color settings string -_textSettings = GVAR(colorSelectedSettings); +private _textSettings = GVAR(colorSelectedSettings); if(!_menuInSelectedPath) then { _textSettings = (GVAR(textSettingsMatrix) select (count _path)) select _menuDepth; }; @@ -68,13 +66,12 @@ if !(_menuInSelectedPath) exitWith {true}; //BEGIN_COUNTER(children); -private ["_numChildren","_angleSpan","_angle","_angleInterval","_scaleX", "_scaleY", "_offset", "_textSize"]; -_numChildren = count _activeChildren; -_angleSpan = _maxAngleSpan min (55 * ((_numChildren) - 1)); +private _numChildren = count _activeChildren; +private _angleSpan = _maxAngleSpan min (55 * ((_numChildren) - 1)); if (_angleSpan >= 305) then { _angleSpan = 360; }; -_angleInterval = 55; +private _angleInterval = 55; if (_angleSpan < 360) then { if (_numChildren > 1) then { _angleInterval = _angleSpan / (_numChildren - 1); @@ -87,15 +84,15 @@ if (_numChildren == 1) then { }; // Scale menu based on the amount of children -_scaleX = 1; -_scaleY = 1; +private _scaleX = 1; +private _scaleY = 1; if (GVAR(UseListMenu)) then { - _textSize = [0.75, 0.875, 1, 1.2, 1.4] select GVAR(textSize); + private _textSize = [0.75, 0.875, 1, 1.2, 1.4] select GVAR(textSize); _scaleX = _textSize * 0.17 * 1.1; _scaleY = 0.17 * 0.30 * 4/3; } else { - _textSize = if (GVAR(textSize) > 2) then {1.3} else {1}; + private _textSize = if (GVAR(textSize) > 2) then {1.3} else {1}; _scaleX = _textSize * 0.17 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5); _scaleY = _textSize * 0.17 * 4/3 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5); }; @@ -106,15 +103,13 @@ if (_menuInSelectedPath && {_menuDepth == count _path}) then { _scaleY = _scaleY * (0.3 + 0.7 * (((ACE_diagTime - GVAR(expandedTime)) * linearConversion [0, 2, GVAR(menuAnimationSpeed), 8, 16]) min 1)); }; -_target = _actionObject; -_player = ACE_player; +private _target = _actionObject; +private _player = ACE_player; //END_COUNTER(children); -_angle = _centerAngle - _angleSpan / 2; +private _angle = _centerAngle - _angleSpan / 2; { - //BEGIN_COUNTER(children); - private ["_offset","_newPos"]; - _newPos = if (GVAR(UseListMenu)) then { + private _newPos = if (GVAR(UseListMenu)) then { [(_sPos select 0) + _scaleX, (_sPos select 1) + _scaleY * (_forEachIndex - _numChildren/2 + 0.5)]; } else { @@ -122,8 +117,6 @@ _angle = _centerAngle - _angleSpan / 2; (_sPos select 1) + _scaleY * (sin _angle)]; }; - //drawLine3D [_pos, _newPos, [1,0,0,0.8]]; - //END_COUNTER(children); [_path, _x, _newPos, [_angle, 150]] call FUNC(renderMenu); _angle = _angle + _angleInterval; diff --git a/addons/interact_menu/functions/fnc_renderSelector.sqf b/addons/interact_menu/functions/fnc_renderSelector.sqf index 17ded20903..69f8a81b95 100644 --- a/addons/interact_menu/functions/fnc_renderSelector.sqf +++ b/addons/interact_menu/functions/fnc_renderSelector.sqf @@ -15,10 +15,8 @@ params ["_sPos", "_icon"]; -private ["_displayNum", "_ctrl", "_pos"]; - if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { - _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); + private _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]); if (GVAR(useCursorMenu)) then { ((finddisplay _displayNum) displayctrl (54021+GVAR(iconCount))) ctrlAddEventHandler ["MouseMoving", DFUNC(handleMouseMovement)]; @@ -26,9 +24,9 @@ if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { }; }; -_ctrl = GVAR(iconCtrls) select GVAR(iconCount); +private _ctrl = GVAR(iconCtrls) select GVAR(iconCount); -_pos = if (GVAR(UseListMenu)) then { +private _pos = if (GVAR(UseListMenu)) then { [_ctrl, GVAR(iconCount), format ["", _icon]] call FUNC(ctrlSetParsedTextCached); [(_sPos select 0)-(0.014*SafeZoneW), (_sPos select 1)-(0.014*SafeZoneW), 0.05*SafeZoneW, 0.035*SafeZoneW] } else { diff --git a/addons/interact_menu/functions/fnc_setupTextColors.sqf b/addons/interact_menu/functions/fnc_setupTextColors.sqf index c23d68cfd3..cbdd56fb07 100644 --- a/addons/interact_menu/functions/fnc_setupTextColors.sqf +++ b/addons/interact_menu/functions/fnc_setupTextColors.sqf @@ -12,15 +12,13 @@ */ #include "script_component.hpp" -private ["_menuDepth", "_mixColor", "_pathCount", "_row", "_shadowColor", "_textColor", "_textSize", "_colorShadowMax", "_colorShadowMin", "_colorTextMax", "_colorTextMin", "_shadowSetting"]; - //Mixes 2 colors (number arrays) and makes a color string "#AARRGGBB" for structured text -_mixColor = { +private _mixColor = { params ["_color1", "_color2", "_ratio"]; - private ["_return", "_mix", "_index"]; - _return = ""; + + private _return = ""; for "_index" from 0 to 3 do { - _mix = linearConversion [0, 1, _ratio, (_color1 select _index), (_color2 select _index)]; + private _mix = linearConversion [0, 1, _ratio, (_color1 select _index), (_color2 select _index)]; if (_index != 3) then { _return = _return + ([255 * _mix] call EFUNC(common,toHex)); } else { @@ -30,15 +28,17 @@ _mixColor = { _return }; -_colorTextMin = missionNamespace getVariable [QGVAR(colorTextMin), [1,1,1,0.25]]; -_colorTextMax = missionNamespace getVariable [QGVAR(colorTextMax), [1,1,1,1]]; -_colorShadowMin = missionNamespace getVariable [QGVAR(colorShadowMin), [0,0,0,0.25]]; -_colorShadowMax = missionNamespace getVariable [QGVAR(colorShadowMax), [0,0,0,1]]; -_shadowSetting = missionNamespace getVariable [QGVAR(shadowSetting), 2]; -_textSize = missionNamespace getVariable [QGVAR(textSize), 2]; +private _colorTextMin = missionNamespace getVariable [QGVAR(colorTextMin), [1,1,1,0.25]]; +private _colorTextMax = missionNamespace getVariable [QGVAR(colorTextMax), [1,1,1,1]]; +private _colorShadowMin = missionNamespace getVariable [QGVAR(colorShadowMin), [0,0,0,0.25]]; +private _colorShadowMax = missionNamespace getVariable [QGVAR(colorShadowMax), [0,0,0,1]]; +private _shadowSetting = missionNamespace getVariable [QGVAR(shadowSetting), 2]; +private _textSize = missionNamespace getVariable [QGVAR(textSize), 2]; -_textColor = [_colorTextMin, _colorTextMax, 1] call _mixColor; -_shadowColor = [_colorShadowMin, _colorShadowMax, 1] call _mixColor; +TRACE_6("Building text matrix",_colorTextMin,_colorTextMax,_colorShadowMin,_colorShadowMax,_shadowSetting,_textSize); + +private _textColor = [_colorTextMin, _colorTextMax, 1] call _mixColor; +private _shadowColor = [_colorShadowMin, _colorShadowMax, 1] call _mixColor; _textSize = switch (_textSize) do { case (0): {0.4}; case (1): {0.6}; @@ -51,7 +51,7 @@ GVAR(colorSelectedSettings) = format ["color='%1' size='%2' shadow='%3' shadowCo GVAR(textSettingsMatrix) = []; for "_pathCount" from 0 to 15 do { - _row = []; + private _row = []; for "_menuDepth" from 0 to 15 do { if (_menuDepth > 0) then { _textColor = [_colorTextMin, _colorTextMax, (((_pathCount - 1) / _menuDepth) max 0.25)] call _mixColor; diff --git a/addons/interact_menu/functions/fnc_splitPath.sqf b/addons/interact_menu/functions/fnc_splitPath.sqf index 790ae83466..ba07dc1d9e 100644 --- a/addons/interact_menu/functions/fnc_splitPath.sqf +++ b/addons/interact_menu/functions/fnc_splitPath.sqf @@ -13,12 +13,11 @@ */ #include "script_component.hpp" -private ["_parentPath","_actionName", "_i"]; -_parentPath = []; -for [{_i = 0},{_i < (count _this) - 1},{_i = _i + 1}] do { +private _parentPath = []; +for [{private _i = 0},{_i < (count _this) - 1},{_i = _i + 1}] do { _parentPath pushBack (_this select _i); }; -_actionName = if (count _this > 0) then { +private _actionName = if (count _this > 0) then { _this select ((count _this) - 1); } else { "" diff --git a/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf b/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf index 98abfdccd1..a83ff46bba 100644 --- a/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf +++ b/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf @@ -1,7 +1,7 @@ /* * Author: PabstMirror * Scans for nearby "Static" objects (buildings) and adds the UserActions to them. - * Called when interact_menu starts rendering (from "interact_keyDown" event) + * Called when interact_menu starts rendering (from "interactMenuOpened" event) * * Arguments: * 0: Interact Menu Type (0 - world, 1 - self) @@ -10,9 +10,9 @@ * Nothing * * Example: - * [0] call ace_interact_menu_fnc_addHouseActions + * [0] call ace_interact_menu_fnc_userActions_addHouseActions * - * Public: Yes + * Public: No */ #include "script_component.hpp" @@ -26,7 +26,6 @@ if (_interactionType != 0) exitWith {}; if ((vehicle ACE_player) != ACE_player) exitWith {}; [{ - private ["_nearBuidlings", "_typeOfHouse", "_houseBeingScaned", "_actionSet", "_memPoints", "_memPointsActions", "_helperPos", "_helperObject"]; params ["_args", "_pfID"]; _args params ["_setPosition", "_addedHelpers", "_housesScaned", "_housesToScanForActions"]; @@ -54,33 +53,34 @@ if ((vehicle ACE_player) != ACE_player) exitWith {}; //If player moved >2 meters from last pos, then rescan if (((getPosASL ace_player) distance _setPosition) < 2) exitWith {}; - _nearBuidlings = nearestObjects [ace_player, ["Static"], 30]; + private _nearBuidlings = nearestObjects [ace_player, ["Static"], 30]; { - _typeOfHouse = typeOf _x; + private _typeOfHouse = typeOf _x; if (((count (configFile >> "CfgVehicles" >> _typeOfHouse >> "UserActions")) == 0) && {(count (getArray (configFile >> "CfgVehicles" >> _typeOfHouse >> "ladders"))) == 0}) then { _housesScaned pushBack _x; } else { _housesToScanForActions pushBack _x; }; - } forEach (_nearBuidlings - _housesScaned); + nil + } count (_nearBuidlings - _housesScaned); _args set [0, (getPosASL ace_player)]; } else { _houseBeingScaned = _housesToScanForActions deleteAt 0; - _typeOfHouse = typeOf _houseBeingScaned; + private _typeOfHouse = typeOf _houseBeingScaned; //Skip this house for now if we are outside of it's radius //(we have to scan far out for the big houses, but we don't want to waste time adding actions on every little shack) if ((_houseBeingScaned != cursorTarget) && {((ACE_player distance _houseBeingScaned) - ((sizeOf _typeOfHouse) / 2)) > 4}) exitWith {}; _housesScaned pushBack _houseBeingScaned; - _actionSet = [_typeOfHouse] call FUNC(userActions_getHouseActions); + private _actionSet = [_typeOfHouse] call FUNC(userActions_getHouseActions); _actionSet params ["_memPoints", "_memPointsActions"]; // systemChat format ["Add Actions for [%1] (count %2) @ %3", _typeOfHouse, (count _memPoints), diag_tickTime]; { - _helperPos = (_houseBeingScaned modelToWorld (_houseBeingScaned selectionPosition _x)) call EFUNC(common,positionToASL); - _helperObject = "ACE_LogicDummy" createVehicleLocal _helperPos; + private _helperPos = AGLtoASL (_houseBeingScaned modelToWorld (_houseBeingScaned selectionPosition _x)); + private _helperObject = "ACE_LogicDummy" createVehicleLocal _helperPos; _addedHelpers pushBack _helperObject; _helperObject setVariable [QGVAR(building), _houseBeingScaned]; _helperObject setPosASL _helperPos; @@ -88,7 +88,8 @@ if ((vehicle ACE_player) != ACE_player) exitWith {}; { [_helperObject, 0, [], _x] call EFUNC(interact_menu,addActionToObject); - } forEach (_memPointsActions select _forEachIndex); + nil + } count (_memPointsActions select _forEachIndex); } forEach _memPoints; }; diff --git a/addons/interact_menu/functions/fnc_userActions_getHouseActions.sqf b/addons/interact_menu/functions/fnc_userActions_getHouseActions.sqf index dee82fd939..c513805d10 100644 --- a/addons/interact_menu/functions/fnc_userActions_getHouseActions.sqf +++ b/addons/interact_menu/functions/fnc_userActions_getHouseActions.sqf @@ -8,22 +8,23 @@ * Return Value: * [[Array of MemPoints], [Array Of Actions]] * - * Public: Yes + * Example: + * ["Land_i_House_Big_01_V1_F"] call ace_interact_menu_fnc_userActions_getHouseActions + * + * Public: No */ #include "script_component.hpp" params ["_typeOfBuilding"]; -private["_action", "_actionDisplayName", "_actionDisplayNameDefault", "_actionMaxDistance", "_actionOffset", "_actionPath", "_actionPosition", "_building", "_configPath", "_endIndex", "_iconImage", "_index", "_ladders", "_memPointIndex", "_memPoints", "_memPointsActions", "_startIndex"]; - -_searchIndex = GVAR(cachedBuildingTypes) find _typeOfBuilding; +private _searchIndex = GVAR(cachedBuildingTypes) find _typeOfBuilding; if (_searchIndex != -1) exitWith {GVAR(cachedBuildingActionPairs) select _searchIndex}; -_memPoints = []; -_memPointsActions = []; +private _memPoints = []; +private _memPointsActions = []; //Get the offset for a memory point: -_fnc_getMemPointOffset = { +private _fnc_getMemPointOffset = { params ["_memoryPoint"]; _memPointIndex = _memPoints find _memoryPoint; _actionOffset = [0,0,0]; @@ -37,13 +38,13 @@ _fnc_getMemPointOffset = { }; // Add UserActions for the building: -_fnc_userAction_Statement = { +private _fnc_userAction_Statement = { params ["_target", "_player", "_variable"]; _variable params ["_actionStatement", "_actionCondition"]; this = _target getVariable [QGVAR(building), objNull]; call _actionStatement; }; -_fnc_userAction_Condition = { +private _fnc_userAction_Condition = { params ["_target", "_player", "_variable"]; _variable params ["_actionStatement", "_actionCondition"]; this = _target getVariable [QGVAR(building), objNull]; @@ -51,16 +52,16 @@ _fnc_userAction_Condition = { call _actionCondition; }; -_configPath = configFile >> "CfgVehicles" >> _typeOfBuilding >> "UserActions"; +private _configPath = configFile >> "CfgVehicles" >> _typeOfBuilding >> "UserActions"; for "_index" from 0 to ((count _configPath) - 1) do { - _actionPath = _configPath select _index; + private _actionPath = _configPath select _index; - _actionDisplayName = getText (_actionPath >> "displayName"); - _actionDisplayNameDefault = getText (_actionPath >> "displayNameDefault"); - _actionPosition = getText (_actionPath >> "position"); - _actionCondition = getText (_actionPath >> "condition"); - _actionStatement = getText (_actionPath >> "statement"); - _actionMaxDistance = getNumber (_actionPath >> "radius"); + private _actionDisplayName = getText (_actionPath >> "displayName"); + private _actionDisplayNameDefault = getText (_actionPath >> "displayNameDefault"); + private _actionPosition = getText (_actionPath >> "position"); + private _actionCondition = getText (_actionPath >> "condition"); + private _actionStatement = getText (_actionPath >> "statement"); + private _actionMaxDistance = getNumber (_actionPath >> "radius"); if (_actionDisplayName == "") then {_actionDisplayName = (configName _x);}; if (_actionPosition == "") then {ERROR("Bad Position");}; @@ -70,53 +71,52 @@ for "_index" from 0 to ((count _configPath) - 1) do { _actionStatement = compile _actionStatement; _actionCondition = compile _actionCondition; _actionMaxDistance = _actionMaxDistance + 0.1; //increase range slightly - _iconImage = ""; //extension ~4x as fast: - _iconImage = "ace_parse_imagepath" callExtension _actionDisplayNameDefault; + private _iconImage = "ace_parse_imagepath" callExtension _actionDisplayNameDefault; - _actionOffset = [_actionPosition] call _fnc_getMemPointOffset; - _memPointIndex = _memPoints find _actionPosition; + private _actionOffset = [_actionPosition] call _fnc_getMemPointOffset; + private _memPointIndex = _memPoints find _actionPosition; _action = [(configName _actionPath), _actionDisplayName, _iconImage, _fnc_userAction_Statement, _fnc_userAction_Condition, {}, [_actionStatement, _actionCondition], _actionOffset, _actionMaxDistance, [false,false,false,false,true]] call EFUNC(interact_menu,createAction); (_memPointsActions select _memPointIndex) pushBack _action; }; // Add Ladder Actions for the building: -_fnc_ladder_ladderUp = { +private _fnc_ladder_ladderUp = { params ["_target", "_player", "_variable"]; _variable params ["_ladderIndex"]; - _building = _target getVariable [QGVAR(building), objNull]; + private _building = _target getVariable [QGVAR(building), objNull]; TRACE_3("Ladder Action - UP",_player,_building,_ladderIndex); _player action ["LadderUp", _building, _ladderIndex, 0]; }; -_fnc_ladder_ladderDown = { +private _fnc_ladder_ladderDown = { params ["_target", "_player", "_variable"]; _variable params ["_ladderIndex"]; - _building = _target getVariable [QGVAR(building), objNull]; + private _building = _target getVariable [QGVAR(building), objNull]; TRACE_3("Ladder Action - Down",_player,_building,_ladderIndex); _player action ["LadderDown", _building, _ladderIndex, 1]; }; -_fnc_ladder_conditional = { +private _fnc_ladder_conditional = { params ["_target", "_player"]; //(Check distance < 2) and (Don't show actions if on a ladder) ((_target distance _player) < 2) && {((getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _player) >> "onLadder")) == 0)} }; -_ladders = getArray (configFile >> "CfgVehicles" >> _typeOfBuilding >> "ladders"); +private _ladders = getArray (configFile >> "CfgVehicles" >> _typeOfBuilding >> "ladders"); { _x params ["_ladderBottomMemPoint", "_ladderTopMemPoint"]; - _actionMaxDistance = 3; //interact_menu will check head -> target's offset; leave this high and do a precice distance check in condition + private _actionMaxDistance = 3; //interact_menu will check head -> target's offset; leave this high and do a precice distance check in condition - _actionDisplayName = localize "str_action_ladderup"; - _iconImage = "\A3\ui_f\data\igui\cfg\actions\ladderup_ca.paa"; + private _actionDisplayName = localize "str_action_ladderup"; + private _iconImage = "\A3\ui_f\data\igui\cfg\actions\ladderup_ca.paa"; //Ladder Up Action: - _actionOffset = [_ladderBottomMemPoint] call _fnc_getMemPointOffset; + private _actionOffset = [_ladderBottomMemPoint] call _fnc_getMemPointOffset; _actionOffset = _actionOffset vectorAdd [0,0,1]; - _memPointIndex = _memPoints find _ladderBottomMemPoint; - _action = [format ["LadderUp_%1", _forEachIndex], _actionDisplayName, _iconImage, _fnc_ladder_ladderUp, _fnc_ladder_conditional, {}, [_forEachIndex], _actionOffset, _actionMaxDistance, [false,false,false,false,true]] call EFUNC(interact_menu,createAction); + private _memPointIndex = _memPoints find _ladderBottomMemPoint; + private _action = [format ["LadderUp_%1", _forEachIndex], _actionDisplayName, _iconImage, _fnc_ladder_ladderUp, _fnc_ladder_conditional, {}, [_forEachIndex], _actionOffset, _actionMaxDistance, [false,false,false,false,true]] call EFUNC(interact_menu,createAction); (_memPointsActions select _memPointIndex) pushBack _action; _actionDisplayName = localize "str_action_ladderdown"; diff --git a/addons/interact_menu/script_component.hpp b/addons/interact_menu/script_component.hpp index 3117065ca2..6a2f4e86f3 100644 --- a/addons/interact_menu/script_component.hpp +++ b/addons/interact_menu/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_INTERACT_MENU #define DEBUG_MODE_FULL @@ -12,5 +15,3 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" - -#define ENABLE_PERFORMANCE_COUNTERS diff --git a/addons/interact_menu/stringtable.xml b/addons/interact_menu/stringtable.xml index 3f3ad122f2..e391fc681f 100644 --- a/addons/interact_menu/stringtable.xml +++ b/addons/interact_menu/stringtable.xml @@ -304,12 +304,14 @@ Szybkość animacji interakcji Скорость анимации меню взаимодействия Velocidade da animação de interação + Rychlost animace interakce Makes menu animations faster and decreases the time needed to hover to show sub actions Przyśpiesza animacje menu interakcji oraz czas wymagany do pokazania podmenu Ускоряет анимацию меню и уменьшает задержку при наведении мыши для раскрытия подменю Faz com que as animações do menu de interação sejam mais rápidas, dimiuindo a necessidade de esperar para mostrar as ações + Zrychlí animaci menu a sníží tak čas potřebný pro plné zobrazení podmenu \ No newline at end of file diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 494f1d109e..e1d4516587 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -141,6 +141,13 @@ class CfgVehicles { showDisabled = 0; priority = 2.5; }; + class ACE_GetOut { + displayName = CSTRING(GetOut); + condition = QUOTE(!(isNull objectParent _target) && [ARR_2(_player,_target)] call DFUNC(canInteractWithCivilian)); + statement = QUOTE([_target] call EFUNC(common,unloadPerson)); + showDisabled = 0; + priority = 2.6; + }; }; class ACE_Torso { diff --git a/addons/interaction/config.cpp b/addons/interaction/config.cpp index 9659565c3c..2413256bf4 100644 --- a/addons/interaction/config.cpp +++ b/addons/interaction/config.cpp @@ -6,7 +6,7 @@ class CfgPatches { weapons[] = {}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_interact_menu"}; - author[] = {"commy2", "KoffeinFlummi", "esteldunedain", "bux578"}; + author[] = {"commy2", "KoffeinFlummi", "esteldunedain", "bux578", "dixon13"}; authorUrl = "https://github.com/commy2/"; VERSION_CONFIG; }; diff --git a/addons/interaction/functions/fnc_canInteractWithCivilian.sqf b/addons/interaction/functions/fnc_canInteractWithCivilian.sqf index eb8374191b..add66740e5 100644 --- a/addons/interaction/functions/fnc_canInteractWithCivilian.sqf +++ b/addons/interaction/functions/fnc_canInteractWithCivilian.sqf @@ -18,5 +18,4 @@ #include "script_component.hpp" params ["_unit", "_target", ["_isCivilian", true]]; - alive _target && [side _target != side _unit, side group _target == civilian] select _isCivilian // return diff --git a/addons/interaction/script_component.hpp b/addons/interaction/script_component.hpp index d668387bb9..fd6ce8ce58 100644 --- a/addons/interaction/script_component.hpp +++ b/addons/interaction/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT interaction #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_INTERACTION #define DEBUG_MODE_FULL #endif diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index 4171789b22..aa0ee78773 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -222,7 +222,7 @@ TANZEN! BAILAR! TAŃCZ! - TANČIT! + TANCUJ! Danse! ТАНЦЕВАТЬ! TÁNC! @@ -349,6 +349,9 @@ Abaixe-se! A terra! + + Get Out + Team Management Gruppenverwaltung @@ -511,7 +514,7 @@ Te has unido al equipo %1 Tu as rejoint l'équipe %1 Dołączyłeś do %1 - Připojil ses do %1 týmu + Připojili jste se do %1 týmu Вы присоединились к группе %1 Você uniu-se à Equipe %1 Sei entrato nel team %1 @@ -535,7 +538,7 @@ Has dejado el equipo Tu as quitté l'équipe Opuściłeś drużynę - Opustil jsi tým + Opustili jste tým Вы покинули группу Você deixou a Equipe Hai lasciato il team @@ -563,7 +566,7 @@ Rolar Scorri Görgetés - Otáčení + Posunout Modifier Key @@ -607,7 +610,7 @@ Empujar Pousser Pchnij - Odstrčit + Tlačit Tolás Толкать Empurrar @@ -697,6 +700,7 @@ Podaj magazynek Передать магазин Passar carregador + Podat zásobník Primary magazine @@ -704,6 +708,7 @@ Magazynek karabinowy Основной магазин Carregador primário + Zásobník do primární zbraně Pistol magazine @@ -711,6 +716,7 @@ Magazynek pistoletowy Магазин к пистолету Carregador da pistola + Zásobník do pistole %1 passed you a %2 magazine. @@ -718,6 +724,7 @@ %1 podał Ci magazynek %2. %1 передал вам магазин %2. %1 passou a você um carregador %2. + %1 ti podal %2 zásobník. Show "pass magazine" interaction @@ -725,6 +732,7 @@ Pokaż interakcję "podaj magazynek" Показывать действие "передать магазин" Mostrar a interação "Passar carregador" + Zobrazit "interakci "podat zásobník" - \ No newline at end of file + diff --git a/addons/inventory/script_component.hpp b/addons/inventory/script_component.hpp index b013e08570..e95ad43b83 100644 --- a/addons/inventory/script_component.hpp +++ b/addons/inventory/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT inventory #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_INVENTORY #define DEBUG_MODE_FULL #endif diff --git a/addons/inventory/stringtable.xml b/addons/inventory/stringtable.xml index af21fe3ddf..f2170e62be 100644 --- a/addons/inventory/stringtable.xml +++ b/addons/inventory/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -28,30 +28,37 @@ Backpacks Rucksäcke + Batohy Headgear Kopfbedeckungen + Pokrývka hlavy Glasses Brillen + Brýle Uniforms Uniformen + Uniformy Vests Westen + Vesty Grenades Granaten + Granáty Medical Sanimaterial + Lékařské vybavení - + \ No newline at end of file diff --git a/addons/javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf index 8be68be5b5..f561806eaa 100644 --- a/addons/javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -65,6 +65,10 @@ _newTarget = objNull; // Bail on fast movement if ((velocity ACE_player) distance [0,0,0] > 0.5 && {cameraView == "GUNNER"} && {cameraOn == ACE_player}) exitWith { // keep it steady. ACE_player switchCamera "INTERNAL"; + if (player != ACE_player) then { + TRACE_2("Zeus, manually reseting RC after switchCamera",player,ACE_player); + player remoteControl ACE_player; + }; }; // Refresh the firemode diff --git a/addons/javelin/script_component.hpp b/addons/javelin/script_component.hpp index 984edc6988..e252ed1cbb 100644 --- a/addons/javelin/script_component.hpp +++ b/addons/javelin/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT javelin #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_JAVELIN #define DEBUG_MODE_FULL #endif diff --git a/addons/kestrel4500/script_component.hpp b/addons/kestrel4500/script_component.hpp index 90c338ebeb..87a0c0b594 100644 --- a/addons/kestrel4500/script_component.hpp +++ b/addons/kestrel4500/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT kestrel4500 #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_KESTREL4500 #define DEBUG_MODE_FULL #endif diff --git a/addons/laser/script_component.hpp b/addons/laser/script_component.hpp index 6620f63c4d..f3542f686f 100644 --- a/addons/laser/script_component.hpp +++ b/addons/laser/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT laser #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_LASER #define DEBUG_MODE_FULL #endif diff --git a/addons/laser_selfdesignate/script_component.hpp b/addons/laser_selfdesignate/script_component.hpp index d0e095924d..fc0d608e32 100644 --- a/addons/laser_selfdesignate/script_component.hpp +++ b/addons/laser_selfdesignate/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT laser_selfdesignate #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_LASER_SELFDESIGNATE #define DEBUG_MODE_FULL #endif diff --git a/addons/laserpointer/script_component.hpp b/addons/laserpointer/script_component.hpp index 34c689cbbf..cee00afdca 100644 --- a/addons/laserpointer/script_component.hpp +++ b/addons/laserpointer/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT laserpointer #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_LASERPOINTER #define DEBUG_MODE_FULL #endif diff --git a/addons/laserpointer/stringtable.xml b/addons/laserpointer/stringtable.xml index 1a4182bd8e..1e4b150c3d 100644 --- a/addons/laserpointer/stringtable.xml +++ b/addons/laserpointer/stringtable.xml @@ -6,7 +6,7 @@ Pointeur laser (rouge) Laserpointer (rot) Лазерный прицел (красный) - Laserové ukazovátko (červené) + Laserové ukazovátko (Červené) Wskaźnik laserowy (czerwony) Lézer-pointer (piros) Puntero láser (rojo) @@ -18,7 +18,7 @@ Pointeur laser (vert) Laserpointer (grün) Лазерный прицел (зелёный) - Laserové ukazovátko (zelené) + Laserové ukazovátko (Zelené) Wskaźnik laserowy (zielony) Lézer-pointer (zöld) Puntero láser (verde) @@ -86,4 +86,4 @@ Alternar entre Laser / Laser IV - + \ No newline at end of file diff --git a/addons/logistics_uavbattery/script_component.hpp b/addons/logistics_uavbattery/script_component.hpp index 01ea3608e7..836a39c415 100644 --- a/addons/logistics_uavbattery/script_component.hpp +++ b/addons/logistics_uavbattery/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT logistics_uavbattery #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_LOGISTICS_UAVBATTERY #define DEBUG_MODE_FULL #endif diff --git a/addons/logistics_wirecutter/script_component.hpp b/addons/logistics_wirecutter/script_component.hpp index a86ace1592..a66a7bba08 100644 --- a/addons/logistics_wirecutter/script_component.hpp +++ b/addons/logistics_wirecutter/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_LOGISTICS_WIRECUTTER #define DEBUG_MODE_FULL diff --git a/addons/magazinerepack/script_component.hpp b/addons/magazinerepack/script_component.hpp index 7b390f7126..947c8c1ca1 100644 --- a/addons/magazinerepack/script_component.hpp +++ b/addons/magazinerepack/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT magazinerepack #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MAGAZINEREPACK #define DEBUG_MODE_FULL #endif diff --git a/addons/magazinerepack/stringtable.xml b/addons/magazinerepack/stringtable.xml index c6879280da..68b1d16e2d 100644 --- a/addons/magazinerepack/stringtable.xml +++ b/addons/magazinerepack/stringtable.xml @@ -7,7 +7,7 @@ Reorganizar cargadores Réorganiser les chargeurs Przepakuj magazynki - Přepáskovat Zásobníky + Přepáskovat zásobníky Ricarica caricatori Reorganizar Carregadores Újratárazás @@ -19,7 +19,7 @@ Menú de selección de cargador Sélectionner menu des chargeurs Menu wyboru magazynków - Zvolit Menu zásobníků + Zvolit menu zásobníků Seleziona menù di ricarica Menu de Seleção de Carregador Fegyvertár menü kiválasztás @@ -31,7 +31,7 @@ Seleccionar cargador Sélectionner chargeur Wybierz magazynek - Zvolit zásobník + Vyber zásobník Seleziona caricatore Selecionar Carregador Tár kiválasztása @@ -43,7 +43,7 @@ Reorganizando cargadores ... Réorganisation des chargeurs ... Przepakowywanie magazynków ... - Páskuji zásobníky ... + Přepáskovávám zásobník ... Sto ricaricando le munizioni ... Reorganizando Carregadores ... Újratárazás ... diff --git a/addons/main/script_component.hpp b/addons/main/script_component.hpp index 3ac1d0b7aa..dd7f17429e 100644 --- a/addons/main/script_component.hpp +++ b/addons/main/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_MAIN #define DEBUG_MODE_FULL diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index fdb020c114..3d4bc31c99 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -84,7 +84,7 @@ #ifdef DISABLE_COMPILE_CACHE #define PREP(fncName) DFUNC(fncName) = compile preprocessFileLineNumbers QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf)) #else - #define PREP(fncName) DFUNC(fncName) = QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf)) call SLX_XEH_COMPILE + #define PREP(fncName) [QUOTE(PATHTOF(functions\DOUBLES(fnc,fncName).sqf)), QFUNC(fncName)] call SLX_XEH_COMPILE_NEW #endif #define PREP_MODULE(folder) [] call compile preprocessFileLineNumbers QUOTE(PATHTOF(folder\__PREP__.sqf)) diff --git a/addons/map/script_component.hpp b/addons/map/script_component.hpp index c62086b03a..c8767d76a0 100644 --- a/addons/map/script_component.hpp +++ b/addons/map/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT map #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MAP #define DEBUG_MODE_FULL #endif diff --git a/addons/map/stringtable.xml b/addons/map/stringtable.xml index a7eb5482e2..55d894c93c 100644 --- a/addons/map/stringtable.xml +++ b/addons/map/stringtable.xml @@ -27,10 +27,11 @@ Simulate map lighting based on ambient lighting and player's items? Simuliere Kartenbeleuchtung auf Basis des Umgebungslichts sowie der mitgeführten Gegenstände? Symuluj oświetlenie mapy bazujące na oświetleniu otoczenia oraz przedmiotach gracza? - Calcul la luminosité de la carte en fonction des conditions de lumière + Calcul la luminosité de la carte en fonction des conditions de lumière ? Симулировать освещение карты на основе окружающего света и приборов игрока? Simular a luz do mapa baseado em luz ambiente e itens do jogador? Simular iluminación de mapa basada en la iluminación ambiente y los elementos de los jugadores? + Simulovat nasvícení mapy v závisloti na okolí a předmětů hráče? Map flashlight glow? @@ -39,14 +40,17 @@ Свет фонаря на карте? Brilho de lanterna no mapa? Resplandor de linterna en el mapa? + Nasvícení mapy pomocí baterky? Add external glow to players who use flashlight on map? Kartenbeleuchtung mittels Taschenlampe durch Dritte erkennbar? Pokaż poświatę światła latarki na graczu, który używa latarki na widoku mapy? + Ajouter un effet de lumière sur un joueur utilisant une lampe torche sur la carte ? Добавить свет при использовании фонаря на карте? Adicionar brilho externo para jogadores que usam lanterna no mapa? Añadir resplandor externo a los jugadores que utilizan la linterna en el mapa? + Přidat externí záři hráči který používá baterku v mapě? Map shake? @@ -66,7 +70,7 @@ Kamerawackeln beim Gehen? Umožnit třesení mapy za pochodu? Tremer o mapa enquanto caminha? - La carte tremble lors d'un déplacement? + La carte tremble lors d'un déplacement ? Rázkódjon-e a térkép mozgáskor? Заставлять карту трястись при ходьбе? @@ -99,7 +103,7 @@ Zeige Mauszeiger-Koordinaten? Zobrazit souřadnice u kurzoru? Mostrar coordenadas no cursor? - Afficher les coordonnées sur le curseur? + Afficher les coordonnées sur le curseur ? Kurzor-koordináták mutatása? Показывать координаты курсора? @@ -110,7 +114,7 @@ Gitter-Koordinaten auf dem Mauszeiger anzeigen? Zobrazit souřadnice u kurzoru v mapě? Mostrar as coordenadas de grade no ponteiro do mouse? - Affiche les coordonnées à coté du curseur? + Affiche les coordonnées à coté du curseur ? Mutatva legyen-e a kurzornál található rész rácskoordinátája? Показывать координаты около курсора мыши? @@ -176,7 +180,7 @@ Wie oft sollen die Markierungen aktualisiert werden (in Sekunden) Jak často budou značky aktualizovány (v sekundách) Frequência em que os marcadores devem ser atualizados (em segundos) - Tout les combien de temps les marqueurs doivent être rafraichit? + Fréquence de rafraîchissement des marqueurs ? Milyen gyakran frissüljenek a jelölők (másodpercben) Как часто должны обновляться маркеры (в секундах) @@ -187,7 +191,7 @@ KI-Gruppen verstecken? Skrýt AI skupiny? Esconder grupos de IA? - Cacher les groupes IA? + Cacher les groupes IA ? AI csoportok elrejtése? Скрыть группы ботов? @@ -198,7 +202,7 @@ Verstecke Marker für "nur KI"-Gruppen? Skrýt značky pouze pro AI skupiny? Esconder marcadores que pertencem ao grupo de IA? - Cacher les marqueurs pour les groupes d'IA seulement? + Cacher les marqueurs pour les groupes d'IA seulement ? Jelölők elrejtése "csak AI" csoportoknál? Скрыть маркеры групп, которые состоят полностью из ботов? @@ -217,6 +221,7 @@ Flashlights Taschenlampen Latarki + Lampes de poche Lanternas Фонари Svítilny @@ -227,6 +232,7 @@ NSG Noktowizja Óculos de Visão Noturna + Lunettes de vision nocturne ПНВ NVG NVG @@ -236,6 +242,7 @@ Ein Włącz Ligado + Allumer Вкл. Zapnout Encendido @@ -245,6 +252,7 @@ Aus Wyłącz Desligado + Éteindre Выкл. Vypnout Apagado @@ -254,6 +262,7 @@ Erhöhe Helligkeit Zwiększ czułość Aumentar brilho + Augmenter la luminosité Увеличить яркость Zvýšit jas Aumentar brillo @@ -263,6 +272,7 @@ Veringere Helligkeit Zmniejsz czułość Diminuir brilho + Diminuer la luminosité Уменьшить яркость Snížit jas Reducir brillo @@ -297,6 +307,7 @@ Ust. domyślny kanał Definir canal no início Установить канал на старте + Zvolit kanál po startu Change the starting marker channel at mission start @@ -304,6 +315,7 @@ Ustaw domyślny kanał dla markerów przy starcie misji Muda o canal do marcador no início da missão Изменить начальный канал для установки маркеров при запуске миссии + Nastavit kanál po startu mise diff --git a/addons/map_gestures/script_component.hpp b/addons/map_gestures/script_component.hpp index 1a5ecada12..2bc9b212d0 100644 --- a/addons/map_gestures/script_component.hpp +++ b/addons/map_gestures/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT map_gestures #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MAP_GESTURES #define DEBUG_MODE_FULL #endif diff --git a/addons/map_gestures/stringtable.xml b/addons/map_gestures/stringtable.xml index b53508e538..fd832ecb41 100644 --- a/addons/map_gestures/stringtable.xml +++ b/addons/map_gestures/stringtable.xml @@ -6,31 +6,35 @@ Gestos no mapa Gesty na mapie Жесты на карте + Ukazování v mapě Enabled Ativado Aktywne Включено - Povoleno + Povolit Map Gesture Max Range Distância para gestos no mapa Maks. zasięg gestów Макс. дистанция жестов на карте + Max. vzdálenost pro ukazování v mapě Max range between players to show the map gesture indicator [default: 7 meters] Distância max. entre os jogadores para mostrar o indicador de gesto no mapa [padrão: 7 metros] Maksymalny zasięg, w obrębie którego gesty będą widoczne dla graczy [domyślnie: 7 metrów] Макс. дистанция между игроками для отображения жестов на карте [по-умолчанию: 7 метров] + Maximální vzdálenost mezi hráči pro zobrazení indikátoru ukázání v mapě [výchozí: 7 metrů] Lead Default Color Cor padrão para o líder Domyślny kolor lidera Лид. цвет по-умолчанию + Výchozí barva velitele Fallback Color value for group leaders when there is no group setting. [Module: leave blank to not force on clients] @@ -43,6 +47,7 @@ Cor padrão Kolor domyślny Цвет по-умолчанию + Výchozí barva Fallback Color value when there is no group setting. [Module: leave blank to not force on clients] @@ -55,6 +60,7 @@ Cor do líder Kolor lidera Лид. цвет + Barva velitele Color value for group leaders of groups synced with this module. @@ -80,6 +86,7 @@ Gestos no mapa - Definições de Grupo Gesty na mapie - ustawienia grup Жесты на карте - настройки групп + Ukazování v mapě - nastavení skupiny Update Interval @@ -100,6 +107,7 @@ Configurações de cores de grupo Konf. koloru grup Конфигурация цвета групп + Konfigurace barvy pro skupinu Group color configuration containing arrays of color pairs ([leadColor, color]). @@ -124,12 +132,14 @@ Ativa os gestos no mapa Aktywuje gesty na mapie. Включает указания на карте. + Povolit ukazování v mapě Name Text Color Cor do texto do nome Kolor nazw Цвет текста имени + Barva textu pro jména Color of the name tag text besides the map gestures mark. @@ -142,6 +152,7 @@ Gestos no mapa Gesty na mapie Жесты на карте + Ukazovní v mapě - + \ No newline at end of file diff --git a/addons/maptools/script_component.hpp b/addons/maptools/script_component.hpp index 5d5c524419..497ee14dc1 100644 --- a/addons/maptools/script_component.hpp +++ b/addons/maptools/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT maptools #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MAPTOOLS #define DEBUG_MODE_FULL #endif diff --git a/addons/maptools/stringtable.xml b/addons/maptools/stringtable.xml index 07b2e5dc88..3db0d4d972 100644 --- a/addons/maptools/stringtable.xml +++ b/addons/maptools/stringtable.xml @@ -46,7 +46,7 @@ Ocultar Ferramenta de Mapa Térképészeti eszközök elrejtése Ukryj narzędzia nawigacyjne - Schovat pomůcku k mapě + Schovat pomůcky k mapě Скрыть инструменты @@ -58,7 +58,7 @@ Mostrar Ferramenta de Mapa Padrão Térképészeti eszköz megjelenítése (normál méret) Pokaż normalne narzędzia nawigacyjne - Zobrazit normální pomůcku k mapě + Zobrazit pomůcku k mapě (Velkou) Показать инструменты (средн. размер) @@ -70,7 +70,7 @@ Mostrar Ferramenta de Mapa Pequena Térképészeti eszköz megjelenítése (kicsinyített) Pokaż pomniejszone narzędzia nawigacyjne - Zobrazit malou pomůcku k mapě + Zobrazit pomůcku k mapě (Malou) Показать инструменты (малый размер) @@ -101,7 +101,7 @@ Show GPS on Map Zeige GPS auf der Karte Mostrar el GPS sobre el mapa - Ranger le GPS + Montrer le GPS Visualizza il GPS sulla mappa Mostrar GPS no Mapa GPS megjelenítése a térképen @@ -113,7 +113,7 @@ Hide GPS on Map Verstecke GPS auf der Karte Ocultar el GPS del mapa - Montrer le GPS + Ranger le GPS Nascondi il GPS sulla mappa Ocultar GPS no Mapa GPS elrejtése a térképről @@ -146,4 +146,4 @@ Direção: %1 - + \ No newline at end of file diff --git a/addons/markers/script_component.hpp b/addons/markers/script_component.hpp index 80ffa23b5b..1da213875a 100644 --- a/addons/markers/script_component.hpp +++ b/addons/markers/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT markers #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MARKERS #define DEBUG_MODE_FULL #endif diff --git a/addons/medical/XEH_postInit.sqf b/addons/medical/XEH_postInit.sqf index 95df32b8cd..26c12f6ddf 100644 --- a/addons/medical/XEH_postInit.sqf +++ b/addons/medical/XEH_postInit.sqf @@ -15,6 +15,10 @@ GVAR(heartBeatSounds_Slow) = ["ACE_heartbeat_slow_1", "ACE_heartbeat_slow_2"]; ["medical_woundUpdateRequest", FUNC(onWoundUpdateRequest)] call EFUNC(common,addEventHandler); ["interactMenuClosed", {[objNull, false] call FUNC(displayPatientInformation); }] call EFUNC(common,addEventHandler); +//Treatment EventHandlers: +["medical_advMedication", FUNC(treatmentAdvanced_medicationLocal)] call EFUNC(common,addEventHandler); + + ["medical_onUnconscious", { params ["_unit", "_status"]; if (local _unit) then { diff --git a/addons/medical/XEH_respawn.sqf b/addons/medical/XEH_respawn.sqf index 438e7396cc..7d48672972 100644 --- a/addons/medical/XEH_respawn.sqf +++ b/addons/medical/XEH_respawn.sqf @@ -7,7 +7,7 @@ params ["_unit"]; // Reset captive status for respawning unit if (!(_unit getVariable ["ACE_isUnconscious", false])) then { - [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(unconscious), false] call EFUNC(common,statusEffect_set); }; // Remove maximum unconsciousness time handler diff --git a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf index 81412f60c4..84df1acbd8 100644 --- a/addons/medical/functions/fnc_actionRemoveTourniquet.sqf +++ b/addons/medical/functions/fnc_actionRemoveTourniquet.sqf @@ -17,6 +17,7 @@ private ["_part", "_tourniquets", "_output"]; params ["_caller", "_target", "_selectionName"]; +TRACE_3("params",_caller,_target,_selectionName); // grab the required data _part = [_selectionName] call FUNC(selectionNameToNumber); @@ -34,3 +35,21 @@ _target setVariable [QGVAR(tourniquets), _tourniquets, true]; // Adding the tourniquet item to the caller _caller addItem "ACE_tourniquet"; + +//Handle all injected medications now that blood is flowing: +private _delayedMedications = _target getVariable [QGVAR(occludedMedications), []]; +private _updatedArray = false; +TRACE_2("meds",_part,_delayedMedications); +{ + _x params ["", "", "_medPartNum"]; + if (_part == _medPartNum) then { + TRACE_1("delayed medication call after tourniquet removeal",_x); + ["medical_advMedication", [_target], _x] call EFUNC(common,targetEvent); + _delayedMedications set [_forEachIndex, -1]; + _updatedArray = true; + }; +} forEach _delayedMedications; +if (_updatedArray) then { + _delayedMedications = _delayedMedications - [-1]; + _target setVariable [QGVAR(occludedMedications), _delayedMedications, true]; +}; diff --git a/addons/medical/functions/fnc_actionUnloadUnit.sqf b/addons/medical/functions/fnc_actionUnloadUnit.sqf index 3d6d1d964c..705eeb88f5 100644 --- a/addons/medical/functions/fnc_actionUnloadUnit.sqf +++ b/addons/medical/functions/fnc_actionUnloadUnit.sqf @@ -21,4 +21,4 @@ params ["_caller", "_target", ["_drag", false]]; if (vehicle _target == _target) exitWith {}; if (([_target] call EFUNC(common,isAwake))) exitWith {}; -["unloadPersonEvent", _target, [_target, vehicle _target]] call EFUNC(common,targetEvent) +["unloadPersonEvent", _target, [_target, vehicle _target, _caller]] call EFUNC(common,targetEvent); diff --git a/addons/medical/functions/fnc_init.sqf b/addons/medical/functions/fnc_init.sqf index ad58a0126e..868b07fbf4 100644 --- a/addons/medical/functions/fnc_init.sqf +++ b/addons/medical/functions/fnc_init.sqf @@ -24,6 +24,9 @@ _unit setVariable ["ACE_isUnconscious", false, true]; // tourniquets _unit setVariable [QGVAR(tourniquets), [0,0,0,0,0,0], true]; +//Delayed Medications (from tourniquets) +_unit setVariable [QGVAR(occludedMedications), nil, true]; + // wounds and injuries _unit setVariable [QGVAR(openWounds), [], true]; _unit setVariable [QGVAR(bandagedWounds), [], true]; diff --git a/addons/medical/functions/fnc_onMedicationUsage.sqf b/addons/medical/functions/fnc_onMedicationUsage.sqf index 8eb55b3d1b..fc7e8daa2d 100644 --- a/addons/medical/functions/fnc_onMedicationUsage.sqf +++ b/addons/medical/functions/fnc_onMedicationUsage.sqf @@ -20,6 +20,7 @@ private ["_foundEntry", "_allUsedMedication","_allMedsFromClassname", "_usedMeds", "_hasOverDosed", "_med", "_limit", "_decreaseAmount", "_viscosityAdjustment", "_medicationConfig", "_onOverDose"]; params ["_target", "_className", "_variable", "_maxDosage", "_timeInSystem", "_incompatabileMeds", "_viscosityChange", "_painReduce"]; +TRACE_8("params",_target,_className,_variable,_maxDosage,_timeInSystem,_incompatabileMeds,_viscosityChange,_painReduce); _foundEntry = false; _allUsedMedication = _target getVariable [QGVAR(allUsedMedication), []]; diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index 910745d7bb..7cfc6f55b4 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -95,7 +95,7 @@ if (GVAR(moveUnitsFromGroupOnUnconscious)) then { [_unit, true, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); }; -[_unit, QGVAR(unconscious), true] call EFUNC(common,setCaptivityStatus); +[_unit, "setCaptive", QGVAR(unconscious), true] call EFUNC(common,statusEffect_set); _anim = [_unit] call EFUNC(common,getDeathAnim); [_unit, _anim, 1, true] call EFUNC(common,doAnimation); [{ diff --git a/addons/medical/functions/fnc_translateSelections.sqf b/addons/medical/functions/fnc_translateSelections.sqf index b377b3004d..98a4cf8c51 100644 --- a/addons/medical/functions/fnc_translateSelections.sqf +++ b/addons/medical/functions/fnc_translateSelections.sqf @@ -6,7 +6,7 @@ * Arguments: * 0: Unit * 1: selection name - * 2: HitPoint Index/True to get hitpoint + * 2: HitPoint Index/True to get hitpoint * * Return Value: * translated selection/hitpoint name diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf index 5949f53780..c5643745d7 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medication.sqf @@ -7,7 +7,7 @@ * 1: The patient * 2: SelectionName * 3: Treatment classname - * + * 4: Items Used * * Return Value: * Succesful treatment started @@ -18,8 +18,11 @@ #include "script_component.hpp" params ["_caller", "_target", "_selectionName", "_className", "_items"]; +TRACE_5("params",_caller,_target,_selectionName,_className,_items); -[[_target, _className], QUOTE(DFUNC(treatmentAdvanced_medicationLocal)), _target] call EFUNC(common,execRemoteFnc); /* TODO Replace by event system */ +private _part = [_selectionName] call FUNC(selectionNameToNumber); + +["medical_advMedication", [_target], [_target, _className, _part]] call EFUNC(common,targetEvent); { if (_x != "") then { diff --git a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf index 952f245da9..2c3cf4cc41 100644 --- a/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf +++ b/addons/medical/functions/fnc_treatmentAdvanced_medicationLocal.sqf @@ -5,7 +5,7 @@ * Arguments: * 0: The patient * 1: Treatment classname - * + * 2: Injection Site Part Number * * Return Value: * Succesful treatment started @@ -16,7 +16,18 @@ #include "script_component.hpp" private ["_currentInSystem", "_medicationConfig", "_painReduce", "_hrIncreaseLow", "_hrIncreaseNorm", "_hrIncreaseHigh", "_maxDose", "_inCompatableMedication", "_timeInSystem", "_heartRate", "_pain", "_resistance", "_hrCallback", "_varName", "_viscosityChange"]; -params ["_target", "_className"]; + +params ["_target", "_className", "_partNumber"]; +TRACE_3("params",_target,_className,_partNumber); + +private _tourniquets = _target getVariable [QGVAR(tourniquets), [0,0,0,0,0,0]]; +if ((_tourniquets select _partNumber) > 0) exitWith { + TRACE_1("unit has tourniquets blocking blood flow on injection site",_tourniquets); + private _delayedMedications = _target getVariable [QGVAR(occludedMedications), []]; + _delayedMedications pushBack _this; + _target setVariable [QGVAR(occludedMedications), _delayedMedications, true]; + true +}; // We have added a new dose of this medication to our system, so let's increase it _varName = format[QGVAR(%1_inSystem), _className]; diff --git a/addons/medical/functions/fnc_unconsciousPFH.sqf b/addons/medical/functions/fnc_unconsciousPFH.sqf index 2922cae465..e78c80f3ec 100644 --- a/addons/medical/functions/fnc_unconsciousPFH.sqf +++ b/addons/medical/functions/fnc_unconsciousPFH.sqf @@ -33,7 +33,7 @@ if (!alive _unit) exitWith { if (GVAR(moveUnitsFromGroupOnUnconscious)) then { [_unit, false, "ACE_isUnconscious", side group _unit] call EFUNC(common,switchToGroupSide); }; - [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(unconscious), false] call EFUNC(common,statusEffect_set); [_unit, false] call EFUNC(common,disableAI); //_unit setUnitPos _originalPos; _unit setUnconscious false; @@ -102,7 +102,7 @@ if !(_unit getVariable ["ACE_isUnconscious",false]) exitWith { }; if (!_hasMovedOut) then { // Reset the unit back to the previous captive state. - [_unit, QGVAR(unconscious), false] call EFUNC(common,setCaptivityStatus); + [_unit, "setCaptive", QGVAR(unconscious), false] call EFUNC(common,statusEffect_set); // Swhich the unit back to its original group //Unconscious units shouldn't be put in another group #527: diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index 939a811a41..0af2736f50 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT medical #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MEDICAL #define DEBUG_MODE_FULL #endif diff --git a/addons/medical/stringtable.xml b/addons/medical/stringtable.xml index 5d8d5aa30c..d9338a2734 100644 --- a/addons/medical/stringtable.xml +++ b/addons/medical/stringtable.xml @@ -113,7 +113,7 @@ Transfuse Saline Salzlösungstransfusion Transfundir salino - Transfúze fyziologický roztoku + Transfúze fyziologického roztoku Przetocz sól fizjologiczną Transfuser de la solution saline Перелить физраствор @@ -269,7 +269,7 @@ Transfusing Saline ... Salzlösungtransfusion ... Transfusión de salino ... - Probíha transfúze fyziologický roztoku ... + Probíha transfúze fyziologického roztoku ... Przetaczanie soli fizjologicznej ... Transfusion de saline ... Переливание физраствора ... @@ -305,7 +305,7 @@ Applying Tourniquet ... Setze Tourniquet an ... Aplicando torniquete ... - Aplikuji škrtidlo + Aplikuji škrtidlo ... Zakładanie stazy ... Mise en place du Garrot ... Наложение жгута ... @@ -315,7 +315,7 @@ Medical - Zdravotní + Lékařské Médical Sanitäter Medico @@ -378,7 +378,7 @@ Puls überprüfen Comprobar pulso Проверить пульс - Zkontrolovat pulz + Zkontrolovat puls Sprawdź tętno Vérifier le pouls Pulzus ellenőrzése @@ -478,7 +478,7 @@ RKO RCP Újraélesztés - KPR + CPR SBV @@ -490,7 +490,7 @@ Przeprowadzanie RKO ... Realizando RCP ... Újraélesztés folyamatban... - Provádím KPR ... + Provádím CPR ... Realizando o SBV... @@ -776,7 +776,7 @@ Vendaje (Básico) Bandage (Standard) Bandaż (jałowy) - Obvaz (standartní) + Obvaz (Standartní) Kötszer (Általános) Bendaggio (base) Bandagem(Básico) @@ -2234,6 +2234,7 @@ Curar miembros totalmente vendados Исцелять полностью перебинтованные части тела Curar hitpoints totalmente enfaixados + Heal fully bandaged hitpoints Pain is only temporarily suppressed @@ -2840,9 +2841,11 @@ Locations boost training + Místa pro vylepšení zkušeností Boost medic rating in medical vehicles or near medical facilities [untrained becomes medic, medic becomes doctor] + Zlepšit zkušenosti zdravotníka v medickém vozidle nebo poblíž zdravotního zařízení [nezkušení se stane zdravotníkem, zdravotník se stane doktorem] Disable medics @@ -3334,7 +3337,7 @@ Wszędzie Donde sea Überall - Kdekoliv + Kdekoli Qualquer lugar PArtout Akárhol @@ -3467,6 +3470,7 @@ Curar puntos de vida Исцелять части тела Curar hitpoints + Léčit hitponty Heal fully bandaged hitpoints @@ -3475,6 +3479,7 @@ Curar miembros totalmente vendados Исцелять полностью перебинтованные части тела Curar totalmente hitpoints enfaixados + Heal fully bandaged hitpoints Pain suppression @@ -3735,7 +3740,7 @@ Jest pojazdem med. Es vehículo médico Ist medizinisches Fahrzeug - Je zdravotnické vozidlo + Zdravotnické vozidlo É um veículo médico Véhicule médical Orvosi jármű-e @@ -3779,7 +3784,7 @@ Jest budynkiem med. Es centro médico Ist eine medizinische Einrichtung - Je zdravotnické zařízení + Zdravotnické zařízení É uma instalação médica Est un équipement médical Orvosi létesítmény-e @@ -3831,7 +3836,7 @@ Anytime Jederzeit - Kdykoli + Kdykoliv Siempre Tout le temps Zawsze diff --git a/addons/medical_menu/script_component.hpp b/addons/medical_menu/script_component.hpp index 3119d48e19..afa50c04f3 100644 --- a/addons/medical_menu/script_component.hpp +++ b/addons/medical_menu/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT medical_menu #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MEDICAL_MENU #define DEBUG_MODE_FULL #endif diff --git a/addons/medical_menu/stringtable.xml b/addons/medical_menu/stringtable.xml index 619cfb8507..691ad5f10b 100644 --- a/addons/medical_menu/stringtable.xml +++ b/addons/medical_menu/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -44,6 +44,7 @@ Se permitido pelo servidor, ativa a opção de usar o menu médico por atalhos de teclas e menu de interação Если разрешено сервером, включает опцию использования медицинского меню с помощью горячих главиш или меню взаимодействия Si está permitido por el servidor, active la opción de utilizar el menú médico a través del menú de las teclas + Pokud je povoleno serverem, umožní použít zdravotnickou nabídku skrze kláv. zkratku a interakční menu Re-open Medical menu diff --git a/addons/microdagr/script_component.hpp b/addons/microdagr/script_component.hpp index 0710649aaa..c2f2b9b0a6 100644 --- a/addons/microdagr/script_component.hpp +++ b/addons/microdagr/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT microdagr #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MICRODAGR #define DEBUG_MODE_FULL #endif diff --git a/addons/missileguidance/script_component.hpp b/addons/missileguidance/script_component.hpp index e2ab97a51e..25e98bea60 100644 --- a/addons/missileguidance/script_component.hpp +++ b/addons/missileguidance/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT missileguidance #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MISSILEGUIDANCE #define DEBUG_MODE_FULL #endif diff --git a/addons/missionmodules/script_component.hpp b/addons/missionmodules/script_component.hpp index a567966c7b..8146b5cb8a 100644 --- a/addons/missionmodules/script_component.hpp +++ b/addons/missionmodules/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT missionModules #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MISSIONMODULES #define DEBUG_MODE_FULL #endif diff --git a/addons/mk6mortar/script_component.hpp b/addons/mk6mortar/script_component.hpp index b140a920cc..97e1c8b50a 100644 --- a/addons/mk6mortar/script_component.hpp +++ b/addons/mk6mortar/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT mk6mortar #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MK6MORTAR #define DEBUG_MODE_FULL #endif diff --git a/addons/mk6mortar/stringtable.xml b/addons/mk6mortar/stringtable.xml index f1bbef9228..b79d8022ef 100644 --- a/addons/mk6mortar/stringtable.xml +++ b/addons/mk6mortar/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -46,7 +46,7 @@ Carga Töltés Carregar - Nabít + Charge Carica @@ -136,4 +136,4 @@ Ce module permet de régler les options du mortier MK6 - + \ No newline at end of file diff --git a/addons/modules/script_component.hpp b/addons/modules/script_component.hpp index 807540960b..4e4e64e8e3 100644 --- a/addons/modules/script_component.hpp +++ b/addons/modules/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT modules #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MODULES #define DEBUG_MODE_FULL #endif diff --git a/addons/movement/CfgMoves.hpp b/addons/movement/CfgMoves.hpp index a828c5278c..622b04b269 100644 --- a/addons/movement/CfgMoves.hpp +++ b/addons/movement/CfgMoves.hpp @@ -31,7 +31,7 @@ class CfgMovesBasic { TurnRRelaxed = "AmovPpneMstpSrasWlnrDnon_turnr"; }; - // WEAPON RAISED - RUNNING + // jump animation - WEAPON RAISED - RUNNING class RifleStandActionsNoAdjust; class RifleStandActionsRunF: RifleStandActionsNoAdjust { getOver = "AovrPercMrunSrasWrflDf"; @@ -43,7 +43,7 @@ class CfgMovesBasic { getOver = "AovrPercMrunSrasWrflDf"; }; - // WEAPON RAISED - SPRINTING + // jump animation - WEAPON RAISED - SPRINTING class RifleStandEvasiveActionsF: RifleStandActionsNoAdjust { getOver = "AovrPercMrunSrasWrflDf"; }; @@ -54,7 +54,7 @@ class CfgMovesBasic { getOver = "AovrPercMrunSrasWrflDf"; }; - // WEAPON LOWERED - RUNNING + // jump animation - WEAPON LOWERED - RUNNING class RifleLowStandActionsNoAdjust; class RifleLowStandActionsRunF: RifleLowStandActionsNoAdjust { getOver = "AovrPercMrunSrasWrflDf"; @@ -71,49 +71,12 @@ class CfgMovesBasic { class CfgMovesMaleSdr: CfgMovesBasic { class StandBase; class States { - // better slow walk with lowered rifle animation + // replace link of vault with jump animation class AmovPercMstpSrasWrflDnon; class AmovPercMrunSrasWrflDf: AmovPercMstpSrasWrflDnon { InterpolateTo[] = {"AovrPercMrunSrasWrflDf",0.22,"AmovPercMrunSlowWrflDf",0.025,"AmovPercMwlkSrasWrflDf",0.025,"AmovPknlMrunSrasWrflDf",0.03,"AmovPercMrunSlowWrflDf_AmovPpneMstpSrasWrflDnon",0.02,"AmovPercMevaSrasWrflDf",0.025,"Unconscious",0.01,"AmovPercMtacSrasWrflDf",0.02,"AmovPercMrunSrasWrflDfl",0.02,"AmovPercMrunSrasWrflDfl_ldst",0.02,"AmovPercMrunSrasWrflDfr",0.02,"AmovPercMrunSrasWrflDfr_ldst",0.02,"AmovPercMstpSrasWrflDnon",0.02,"AmovPercMrunSrasWrflDl",0.02,"AmovPercMrunSrasWrflDbl",0.02,"AmovPercMrunSrasWrflDb",0.02,"AmovPercMrunSrasWrflDbr",0.02,"AmovPercMrunSrasWrflDr",0.02,"AmovPknlMstpSlowWrflDnon_relax",0.1,"AmovPercMrunSrasWrflDf_ldst",0.02,"AmovPercMrunSrasWrflDf",0.02}; }; - class AmovPercMstpSlowWrflDnon; - class AmovPercMwlkSlowWrflDf: AmovPercMstpSlowWrflDnon { - speed = 0.3; //0.206897; - file = "\A3\anims_f\Data\Anim\Sdr\Mov\Erc\Wlk\Low\Rfl\AmovPercMwlkSlowWrflDf_ver2"; - leftHandIKCurve[] = {1}; - }; - class AmovPercMwlkSlowWrflDfl: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDfr: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDb: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDbl: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDbr: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDl: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDr: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMwlkSlowWrflDf_v1: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AidlPercMwlkSrasWrflDf: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - class AmovPercMtacSlowWrflDf: AmovPercMwlkSlowWrflDf { - leftHandIKCurve[] = {}; - }; - // enable optics in prone down stance class AadjPpneMstpSrasWrflDup; class AadjPpneMstpSrasWrflDdown: AadjPpneMstpSrasWrflDup { diff --git a/addons/movement/script_component.hpp b/addons/movement/script_component.hpp index 9b8954bf62..14728cbcbb 100644 --- a/addons/movement/script_component.hpp +++ b/addons/movement/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT movement #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MOVEMENT #define DEBUG_MODE_FULL #endif diff --git a/addons/mx2a/script_component.hpp b/addons/mx2a/script_component.hpp index aabb74660a..9b36572497 100644 --- a/addons/mx2a/script_component.hpp +++ b/addons/mx2a/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT mx2a #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_MX2A #define DEBUG_MODE_FULL #endif diff --git a/addons/nametags/script_component.hpp b/addons/nametags/script_component.hpp index 7bf0acbc4a..5b777aee71 100644 --- a/addons/nametags/script_component.hpp +++ b/addons/nametags/script_component.hpp @@ -1,12 +1,17 @@ #define COMPONENT nametags #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_NAMETAGS -#define DEBUG_MODE_FULL + #define DEBUG_MODE_FULL #endif #ifdef DEBUG_SETTINGS_NAMETAGS -#define DEBUG_SETTINGS DEBUG_SETTINGS_NAMETAGS + #define DEBUG_SETTINGS DEBUG_SETTINGS_NAMETAGS #endif #include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/nightvision/functions/fnc_changeNVGBrightness.sqf b/addons/nightvision/functions/fnc_changeNVGBrightness.sqf index 116ab9b5a5..9f02323787 100644 --- a/addons/nightvision/functions/fnc_changeNVGBrightness.sqf +++ b/addons/nightvision/functions/fnc_changeNVGBrightness.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: The Unit - * 1: Change in brightness (1 or -1) + * 1: Change in brightness (1 or -1) * * Return Value: * Nothing diff --git a/addons/nightvision/script_component.hpp b/addons/nightvision/script_component.hpp index 9afeeb5d8d..ffe3ba3ff5 100644 --- a/addons/nightvision/script_component.hpp +++ b/addons/nightvision/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_NIGHTVISION #define DEBUG_MODE_FULL diff --git a/addons/nightvision/stringtable.xml b/addons/nightvision/stringtable.xml index 2a38b86c54..6478b2d847 100644 --- a/addons/nightvision/stringtable.xml +++ b/addons/nightvision/stringtable.xml @@ -138,24 +138,28 @@ Nachtsicht Ночное виденье Visão Noturna + Noční vidění Settings for night vision. Einstellungen für Nachtsichtgeräte. Настройки ночного виденья Ajustes para visão noturna. + Nastavení nočního vidění Disable NVGs in scope Deakt. NVGs mit Visier Убирать ПНВ при прицеливании Desabilitar visão noturna nas lunetas + Zakázat NVG v zaměřovači Blocks the usage of night vision goggles whilst aiming down the sight. Blockiert das Benutzen von Nachtsichtbrillen beim Benutzen des Visiers. Блокирует использование головного ПНВ при прицеливании через прицел. Bloqueia o uso de visão noturna ao utilizar a mira. + Zabraňuje používání nokovizoru v režimu zaměřovače. \ No newline at end of file diff --git a/addons/noidle/script_component.hpp b/addons/noidle/script_component.hpp index 5a7623b0ba..bf20a9a420 100644 --- a/addons/noidle/script_component.hpp +++ b/addons/noidle/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT noidle #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_NOIDLE #define DEBUG_MODE_FULL #endif diff --git a/addons/noradio/script_component.hpp b/addons/noradio/script_component.hpp index 16b7e9b549..0a60edb063 100644 --- a/addons/noradio/script_component.hpp +++ b/addons/noradio/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_NORADIO #define DEBUG_MODE_FULL diff --git a/addons/norearm/script_component.hpp b/addons/norearm/script_component.hpp index d2e95ee569..3f09149587 100644 --- a/addons/norearm/script_component.hpp +++ b/addons/norearm/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT norearm #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_NOREARM #define DEBUG_MODE_FULL #endif diff --git a/addons/optics/script_component.hpp b/addons/optics/script_component.hpp index 58b2d4756a..ca0176360c 100644 --- a/addons/optics/script_component.hpp +++ b/addons/optics/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT optics #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_OPTICS #define DEBUG_MODE_FULL #endif diff --git a/addons/optionsmenu/script_component.hpp b/addons/optionsmenu/script_component.hpp index d25caa2c42..b257b0a5ba 100644 --- a/addons/optionsmenu/script_component.hpp +++ b/addons/optionsmenu/script_component.hpp @@ -1,6 +1,9 @@ #define COMPONENT optionsmenu // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #include "\z\ace\addons\main\script_mod.hpp" diff --git a/addons/overheating/ACE_Settings.hpp b/addons/overheating/ACE_Settings.hpp index 2d63614a40..c5a514e5e2 100644 --- a/addons/overheating/ACE_Settings.hpp +++ b/addons/overheating/ACE_Settings.hpp @@ -3,7 +3,27 @@ class ACE_Settings { typeName = "BOOL"; isClientSettable = 1; value = 1; - displayName = CSTRING(SettingDisplayTextName); - description = CSTRING(SettingDisplayTextDesc); + displayName = CSTRING(DisplayTextOnJam_displayName); + description = CSTRING(DisplayTextOnJam_description); + }; + class GVAR(showParticleEffects) { + typeName = "BOOL"; + isClientSettable = 1; + value = 1; + displayName = CSTRING(showParticleEffects_displayName); + description = CSTRING(showParticleEffects_description); + }; + class GVAR(showParticleEffectsForEveryone) { + typeName = "BOOL"; + isClientSettable = 1; + value = 0; + displayName = CSTRING(showParticleEffectsForEveryone_displayName); + description = CSTRING(showParticleEffectsForEveryone_description); + }; + class GVAR(overheatingDispersion) { + typeName = "BOOL"; + value = 1; + displayName = CSTRING(overheatingDispersion_displayName); + description = CSTRING(overheatingDispersion_description); }; }; diff --git a/addons/overheating/CfgEventHandlers.hpp b/addons/overheating/CfgEventHandlers.hpp index f06e95788e..7e4e0b35c7 100644 --- a/addons/overheating/CfgEventHandlers.hpp +++ b/addons/overheating/CfgEventHandlers.hpp @@ -1,7 +1,7 @@ class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE( call COMPILE_FILE(XEH_preInit) ); - }; + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + }; }; class Extended_PostInit_EventHandlers { @@ -13,7 +13,7 @@ class Extended_PostInit_EventHandlers { class Extended_FiredBIS_EventHandlers { class CAManBase { class GVAR(Overheat) { - clientFiredBIS = QUOTE( if (_this select 0 == ACE_player) then {_this call FUNC(overheat)}; ); + clientFiredBIS = QUOTE(_this call FUNC(firedEH)); }; }; }; @@ -21,7 +21,7 @@ class Extended_FiredBIS_EventHandlers { class Extended_Take_EventHandlers { class CAManBase { class GVAR(UnjamReload) { - clientTake = QUOTE( if (_this select 0 == ACE_player && {(_this select 1) in [ARR_3(uniformContainer (_this select 0), vestContainer (_this select 0), backpackContainer (_this select 0))]} && {_this select 2 == currentMagazine (_this select 0)}) then {_vehicle = vehicle (_this select 0); [ARR_3(_vehicle, currentWeapon _vehicle, true)] call FUNC(clearJam)}; ); + clientTake = QUOTE( _this call FUNC(handleTakeEH) ); }; }; }; diff --git a/addons/overheating/CfgWeapons.hpp b/addons/overheating/CfgWeapons.hpp index 5c9717dbcf..f59c4d7911 100644 --- a/addons/overheating/CfgWeapons.hpp +++ b/addons/overheating/CfgWeapons.hpp @@ -13,133 +13,43 @@ class CfgWeapons { }; }; - class Rifle; - class Rifle_Base_F : Rifle { - // Dispersion, SlowdownFactor and JamChance arrays have 4 values for different temperatures, which are interpolated between. - // These values correspond to temperatures Converted to real life values: 0: 0°C, 1: 333°C, 2: 666°C, 3: 1000°C. + class RifleCore; + class Rifle: RifleCore { + //Mean Rounds Between Stoppages (this will be scaled based on the barrel temp) + GVAR(mrbs) = 3000; - // Dispersion in radians. First value is for temp. 0, second for temp. 1 and so on. Values inbetween get interpolated. Negative values get ignored and can be used to move the starting point to hotter temperatures. - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - // How much the projectile gets slowed down before leaving the barrel. 0.9 means the bullet will lose 10% velocity. Values inbetween get interpolated. Numbers greater 1 increase the velocity, smaller 1 decrease it. - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - // Chance to jam the weapon. 0.0003 means 3 malfunctions on 10,000 rounds fired at this temperature. Values inbetween get interpolated. Negative values get ignored and can be used to move the starting point to hotter temperatures. - // When no reliable data exists for temperature vs. jam chance except MRBS, the following uniform criteria was adopted: [0, 1/MRBS, 5/MRBS, 25/MRBS]. - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + //Dispersion Factor (this will be scaled based on the barrel temp) + GVAR(dispersion) = 1; + + //Slowdown Factor (this will be scaled based on the barrel temp) + GVAR(slowdownFactor) = 1; }; - + class Rifle_Base_F : Rifle {}; class Rifle_Long_Base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + GVAR(dispersion) = 0.75; }; class arifle_MX_Base_F : Rifle_Base_F { - ACE_clearJamAction = "GestureReloadMX"; // Custom jam clearing action. Default uses reload animation. - ACE_checkTemperatureAction = "Gear"; // Custom check temperature action. Default uses gear animation. - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + // Custom jam clearing action. Default uses reload animation. + ACE_clearJamAction = "GestureReloadMX"; }; - - class MMG_02_base_F: Rifle_Long_Base_F { - ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class MMG_01_base_F: Rifle_Long_Base_F { - ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - class arifle_MX_SW_F : arifle_MX_Base_F { - ACE_clearJamAction = ""; // Custom jam clearing action. Use empty string to undefine. - ACE_Overheating_allowSwapBarrel = 1; // 1 to enable barrel swap. 0 to disable. Meant for machine guns where you can easily swap the barrel without dismantling the whole weapon. - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + // Custom jam clearing action. Use empty string to undefine. + ACE_clearJamAction = ""; + // 1 to enable barrel swap. 0 to disable. Meant for machine guns where you can easily swap the barrel without dismantling the whole weapon. + GVAR(allowSwapBarrel) = 1; + GVAR(dispersion) = 0.75; }; - - class arifle_Katiba_Base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + class MMG_01_base_F: Rifle_Long_Base_F { + GVAR(allowSwapBarrel) = 1; }; - - class mk20_base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + class MMG_02_base_F: Rifle_Long_Base_F { + GVAR(allowSwapBarrel) = 1; }; - - class Tavor_base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class SDAR_base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class EBR_base_F : Rifle_Long_Base_F { - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class DMR_01_base_F : Rifle_Long_Base_F { - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class GM6_base_F : Rifle_Long_Base_F { - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class LRR_base_F : Rifle_Long_Base_F { - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class LMG_Mk200_F : Rifle_Long_Base_F { - ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - class LMG_Zafir_F : Rifle_Long_Base_F { - ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + GVAR(allowSwapBarrel) = 1; }; - - class SMG_01_Base : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class SMG_02_base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; - }; - - class pdw2000_base_F : Rifle_Base_F { - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + class LMG_Mk200_F : Rifle_Long_Base_F { + GVAR(allowSwapBarrel) = 1; }; }; diff --git a/addons/overheating/XEH_postInit.sqf b/addons/overheating/XEH_postInit.sqf index c1212af0e8..76cdb090bb 100644 --- a/addons/overheating/XEH_postInit.sqf +++ b/addons/overheating/XEH_postInit.sqf @@ -1,7 +1,20 @@ // by esteldunedain #include "script_component.hpp" -if (!hasInterface) exitWith {}; +if (isServer) then { + GVAR(pseudoRandomList) = []; + // Construct a list of pseudo random 2D vectors + for "_i" from 0 to 30 do { + GVAR(pseudoRandomList) pushBack [-1 + random 2, -1 + random 2]; + }; + publicVariable QGVAR(pseudoRandomList); +}; + + +if !(hasInterface) exitWith {}; + +GVAR(cacheWeaponData) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0]; +GVAR(cacheWeaponData) setText QGVAR(cacheWeaponData); // Add keybinds ["ACE3 Weapons", QGVAR(unjamWeapon), localize LSTRING(UnjamWeapon), @@ -18,4 +31,8 @@ if (!hasInterface) exitWith {}; true }, {false}, -[19, [true, false, false]], false] call CBA_fnc_addKeybind; //R Key +[19, [true, false, false]], false] call CBA_fnc_addKeybind; //SHIFT + R Key + + +// Schedule cool down calculation of player weapons at (infrequent) regular intervals +[] call FUNC(updateTemperatureThread); diff --git a/addons/overheating/XEH_preInit.sqf b/addons/overheating/XEH_preInit.sqf index 2bd256087b..be9936f214 100644 --- a/addons/overheating/XEH_preInit.sqf +++ b/addons/overheating/XEH_preInit.sqf @@ -4,11 +4,15 @@ ADDON = false; PREP(checkTemperature); PREP(clearJam); -PREP(cooldown); PREP(displayTemperature); +PREP(firedEH); +PREP(getWeaponData); +PREP(handleTakeEH); PREP(jamWeapon); PREP(overheat); PREP(swapBarrel); PREP(swapBarrelCallback); +PREP(updateTemperature); +PREP(updateTemperatureThread); ADDON = true; diff --git a/addons/overheating/config.cpp b/addons/overheating/config.cpp index 0e899e1b25..c57e55913d 100644 --- a/addons/overheating/config.cpp +++ b/addons/overheating/config.cpp @@ -22,3 +22,29 @@ class CfgPatches { #include "ACE_Settings.hpp" +class CfgMovesBasic { + class ManActions { + GVAR(GestureMountMuzzle) = QGVAR(GestureMountMuzzle); + GVAR(GestureDismountMuzzle) = QGVAR(GestureDismountMuzzle); + }; + + class Actions { + class NoActions: ManActions { + GVAR(GestureMountMuzzle)[] = {QGVAR(GestureMountMuzzle), "Gesture"}; + GVAR(GestureDismountMuzzle)[] = {QGVAR(GestureDismountMuzzle), "Gesture"}; + }; + }; +}; + +class CfgGesturesMale { + class States { + class GestureMountMuzzle; + class GVAR(GestureMountMuzzle): GestureMountMuzzle { + speed = 0.3; + }; + class GestureDismountMuzzle; + class GVAR(GestureDismountMuzzle): GestureDismountMuzzle { + speed = 0.3; + }; + }; +}; \ No newline at end of file diff --git a/addons/overheating/functions/fnc_checkTemperature.sqf b/addons/overheating/functions/fnc_checkTemperature.sqf index 0b811f9792..f720665620 100644 --- a/addons/overheating/functions/fnc_checkTemperature.sqf +++ b/addons/overheating/functions/fnc_checkTemperature.sqf @@ -10,24 +10,23 @@ * None * * Example: - * None + * [player, currentWeapon player] call ace_overheating_fnc_checkTemperature * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_weapon); - -private ["_action"]; +params ["_player", "_weapon"]; +TRACE_2("params",_player,_weapon); // Play animation and report temperature -_action = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_checkTemperatureAction"); +private _action = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_checkTemperatureAction"); if (_action == "") then { - _action = "Gear"; + _action = "Gear"; }; _player playActionNow _action; -// Launch a PFH that waits a sec before displaying the temperature -[FUNC(displayTemperature), [_player, _weapon], 1.0, 0] call EFUNC(common,waitAndExecute); \ No newline at end of file +// Waits a sec before displaying the temperature +[FUNC(displayTemperature), [_player, _weapon], 1.0] call EFUNC(common,waitAndExecute); diff --git a/addons/overheating/functions/fnc_clearJam.sqf b/addons/overheating/functions/fnc_clearJam.sqf index 1c7e959a98..33039328e4 100644 --- a/addons/overheating/functions/fnc_clearJam.sqf +++ b/addons/overheating/functions/fnc_clearJam.sqf @@ -10,48 +10,48 @@ * Return Value: * None * + * Example: + * [player, currentWeapon player, false] call ace_overheating_fnc_clearJam + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_3_PVT(_this,_unit,_weapon,_skipAnim); +params ["_unit", "_weapon", "_skipAnim"]; +TRACE_3("params",_unit,_weapon,_skipAnim); -private ["_jammedWeapons"]; -_jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; +private _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; if (_weapon in _jammedWeapons) then { - _jammedWeapons = _jammedWeapons - [_weapon]; + _jammedWeapons = _jammedWeapons - [_weapon]; - _unit setVariable [QGVAR(jammedWeapons), _jammedWeapons]; + _unit setVariable [QGVAR(jammedWeapons), _jammedWeapons]; - if (count _jammedWeapons == 0) then { - private "_id"; - - _id = _unit getVariable [QGVAR(JammingActionID), -1]; - [_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler); - _unit setVariable [QGVAR(JammingActionID), -1]; - }; - - if !(_skipAnim) then { - private "_clearJamAction"; - - _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_clearJamAction"); - - if (_clearJamAction == "") then { - _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); + if (_jammedWeapons isEqualTo []) then { + private _id = _unit getVariable [QGVAR(JammingActionID), -1]; + [_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler); + _unit setVariable [QGVAR(JammingActionID), -1]; }; - _unit playActionNow _clearJamAction; - if (_weapon == primaryWeapon _unit) then { - playSound QGVAR(fixing_rifle); - } else { - if (_weapon == secondaryWeapon _unit) then { - playSound QGVAR(fixing_pistol); - }; - }; - }; + if !(_skipAnim) then { - if (GVAR(DisplayTextOnJam)) then { - [localize LSTRING(WeaponUnjammed)] call EFUNC(common,displayTextStructured); - }; + private _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_clearJamAction"); + + if (_clearJamAction == "") then { + _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "reloadAction"); + }; + + _unit playActionNow _clearJamAction; + if (_weapon == primaryWeapon _unit) then { + playSound QGVAR(fixing_rifle); + } else { + if (_weapon == secondaryWeapon _unit) then { + playSound QGVAR(fixing_pistol); + }; + }; + }; + + if (GVAR(DisplayTextOnJam)) then { + [localize LSTRING(WeaponUnjammed)] call EFUNC(common,displayTextStructured); + }; }; diff --git a/addons/overheating/functions/fnc_cooldown.sqf b/addons/overheating/functions/fnc_cooldown.sqf deleted file mode 100644 index 52052c7251..0000000000 --- a/addons/overheating/functions/fnc_cooldown.sqf +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Author: esteldunedain - * Calculate cooling down of the weapon. - * - * Argument: - * 0: Last temperature - * 1: Barrel mass - * 2: Time - * - * Return value: - * New temperature - * - * Public: No - */ -#include "\z\ace\addons\overheating\script_component.hpp" - -EXPLODE_3_PVT(_this,_temperature,_barrelMass,_totalTime); - -// If a long time passed since the last shot, there's no need to calculate anything; the weapon should be cool -if (_totalTime > 1800) exitWith {0}; - -private ["_barrelSurface", "_time", "_deltaTime"]; -_barrelSurface = _barrelMass / 7850 / 0.003; - -_time = 0; -while {true} do { - _deltaTime = (_totalTime - _time) min 20; - - _temperature = _temperature - ( - // Convective cooling - 25 * _barrelSurface * _temperature - // Radiative cooling - + 0.4 * 5.67e-8 * _barrelSurface * - ( (_temperature + 273.15)*(_temperature + 273.15) - * (_temperature + 273.15)*(_temperature + 273.15) - - 273.15 * 273.15 * 273.15 *273.15 ) - ) * _deltaTime / (_barrelMass * 466); - - if (_temperature < 1) exitWith {0}; - - if (isNil "_temperature") exitWith { - ACE_LOGERROR_3("_totalTime = %1; _time = %2; _deltaTime = %3;",_totalTime,_time,_deltaTime); - 0 - }; - - _time = _time + _deltaTime; - if (_time >= _totalTime) exitWith { _temperature max 0 }; -}; diff --git a/addons/overheating/functions/fnc_displayTemperature.sqf b/addons/overheating/functions/fnc_displayTemperature.sqf index 73c790119d..b2b8d2b4c0 100644 --- a/addons/overheating/functions/fnc_displayTemperature.sqf +++ b/addons/overheating/functions/fnc_displayTemperature.sqf @@ -9,57 +9,40 @@ * Return Values: * None * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_displayTemperature + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_weapon); +params ["_player", "_weapon"]; +TRACE_2("params",_player,_weapon); // Calculate cool down of weapon since last shot -private ["_string", "_overheat", "_temperature", "_time", "_barrelMass", "_a"]; -_string = format [QGVAR(%1), _weapon]; -_overheat = _player getVariable [_string, [0, 0]]; -_temperature = _overheat select 0; -_time = _overheat select 1; +private _temperature = [_player, _weapon, 0] call FUNC(updateTemperature); +private _scaledTemperature = (_temperature / 1000) min 1; -// Get physical parameters -_barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; - -// Calculate cooling -_temperature = [_temperature, _barrelMass, ACE_time - _time] call FUNC(cooldown); - -// Store new temperature -_time = ACE_time; -_player setVariable [_string, [_temperature, _time], false]; - - - -private ["_scaledTemperature", "_action", "_color", "_count", "_string", "_text", "_picture"]; -_scaledTemperature = (_temperature / 1000) min 1; - -_color = [ - 2 * _scaledTemperature min 1, - 2 * (1 - _scaledTemperature) min 1, - 00 +private _color = [ + 2 * (_scaledTemperature * 2 min 1) min 1, + 2 * (1 - (_scaledTemperature * 2 min 1)) min 1, + 00 ]; -_count = round (12 * _scaledTemperature); -_string = ""; +private _count = round (12 * _scaledTemperature); +private _string = ""; for "_a" from 1 to _count do { - _string = _string + "|"; + _string = _string + "|"; }; -_text = [_string, _color] call EFUNC(common,stringToColoredText); +private _text = [_string, _color] call EFUNC(common,stringToColoredText); _string = ""; for "_a" from (_count + 1) to 12 do { - _string = _string + "|"; + _string = _string + "|"; }; -_text = composeText [ - _text, - [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText) -]; +_text = composeText [_text, [_string, [0.5, 0.5, 0.5]] call EFUNC(common,stringToColoredText)]; -_picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); +private _picture = getText (configFile >> "CfgWeapons" >> _weapon >> "picture"); [_text, _picture] call EFUNC(common,displayTextPicture); diff --git a/addons/overheating/functions/fnc_firedEH.sqf b/addons/overheating/functions/fnc_firedEH.sqf new file mode 100644 index 0000000000..b37e87c66d --- /dev/null +++ b/addons/overheating/functions/fnc_firedEH.sqf @@ -0,0 +1,121 @@ +/* + * Author: Commy2 and esteldunedain + * Handle weapon fire + * + * Argument: + * 0: unit - Object the event handler is assigned to + * 1: weapon - Fired weapon + * 2: muzzle - Muzzle that was used + * 3: mode - Current mode of the fired weapon + * 4: ammo - Ammo used + * 5: magazine - magazine name which was used + * 6: projectile - Object of the projectile that was shot + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +BEGIN_COUNTER(firedEH); + +params ["_unit", "_weapon", "_muzzle", "", "_ammo", "", "_projectile"]; +TRACE_5("params",_unit,_weapon,_muzzle,_ammo,_projectile); + +if (((!GVAR(overheatingDispersion)) && {_unit != ACE_player}) //If no dispersion, only run when local + || {!([_unit] call EFUNC(common,isPlayer))} //Ignore AI + || {(_unit distance ACE_player) > 3000} //Ignore far away shots + || {(_muzzle != (primaryWeapon _unit)) && {_muzzle != (handgunWeapon _unit)}}) exitWith { // Only rifle or pistol muzzles (ignore grenades / GLs) + END_COUNTER(firedEH); +}; + +// Compute new temperature if the unit is the local player +if (_unit == ACE_player) then { + _this call FUNC(overheat); +}; + +// Get current temperature from the unit variable +private _temperature = _unit getVariable [format [QGVAR(%1_temp), _weapon], 0]; +private _scaledTemperature = linearConversion [0, 1000, _temperature, 0, 1, true]; + +TRACE_2("Unit fired with temp:",_unit,_temperature); + +//Get weapon data from cache: +([_weapon] call FUNC(getWeaponData)) params ["_dispersion", "_slowdownFactor", "_jamChance"]; +TRACE_4("weapon data from cache",_weapon,_dispersion,_slowdownFactor,_jamChance); + +// Dispersion and bullet slow down +if (GVAR(overheatingDispersion)) then { + // Exit if GVAR(pseudoRandomList) isn't synced yet + if (isNil QGVAR(pseudoRandomList)) exitWith {ACE_LOGERROR("No pseudoRandomList sync");}; + + //Dispersion: 0 mils @ 0°C, 0.5 mils @ 333°C, 2.2 mils @ 666°C, 5 mils at 1000°C + _dispersion = _dispersion * 0.28125 * (_scaledTemperature^2); + + _slowdownFactor = _slowdownFactor * linearConversion [0.666, 1, _scaledTemperature, 0, -0.1, true]; + + // Get the pseudo random values for dispersion from the remaining ammo count + (GVAR(pseudoRandomList) select ((_unit ammo _weapon) mod (count GVAR(pseudoRandomList)))) params ["_dispersionX", "_dispersionY"]; + + TRACE_4("change",_dispersion,_slowdownFactor,_dispersionX,_dispersionY); + + TRACE_PROJECTILE_INFO(_projectile); + [_projectile, _dispersionX * _dispersion, _dispersionY * _dispersion, _slowdownFactor * vectorMagnitude (velocity _projectile)] call EFUNC(common,changeProjectileDirection); + TRACE_PROJECTILE_INFO(_projectile); +}; + + +// ------ LOCAL AND NEARBY PLAYERS DEPENDING ON SETTINGS ------------ +// Particle effects only apply to the local player and, depending on settings, to other nearby players +if (_unit != ACE_player && (!GVAR(showParticleEffectsForEveryone) || {_unit distance ACE_player > 20})) exitWith { + END_COUNTER(firedEH); +}; + +//Particle Effects: +if (GVAR(showParticleEffects) && {(ACE_time > ((_unit getVariable [QGVAR(lastDrop), -1000]) + 0.40)) && {_scaledTemperature > 0.1}}) then { + _unit setVariable [QGVAR(lastDrop), ACE_time]; + + private _direction = (_unit weaponDirection _weapon) vectorMultiply 0.25; + private _position = (position _projectile) vectorAdd (_direction vectorMultiply (4*(random 0.30))); + + // Refract SFX, beginning at temp 100°C and maxs out at 500°C + private _intensity = linearConversion [0.1, 0.5, _scaledTemperature, 0, 1, true]; + TRACE_3("refract",_direction,_position,_intensity); + if (_intensity > 0) then { + drop [ + "\A3\data_f\ParticleEffects\Universal\Refract", "", "Billboard", 10, 2, _position, _direction, 0, 1.2, 1.0, + 0.1, [0.10,0.25], [[0.6,0.6,0.6,0.3*_intensity],[0.2,0.2,0.2,0.05*_intensity]], [0,1], 0.1, 0.05, "", "", ""]; + }; + // Smoke SFX, beginning at temp 150°C + private _intensity = linearConversion [0.15, 1, _scaledTemperature, 0, 1, true]; + TRACE_3("smoke",_direction,_position,_intensity); + if (_intensity > 0) then { + drop [ + ["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 1, 16], "", "Billboard", 10, 1.2, _position, + [0,0,0.15], 100 + random 80, 1.275, 1, 0.025, [0.15,0.43], [[0.6,0.6,0.6,0.5*_intensity],[0.2,0.2,0.2,0.15*_intensity]], + [0,1], 1, 0.04, "", "", ""]; + }; +}; + +// ------ LOCAL PLAYER ONLY ------------ +// Only compute jamming for the local player +if (_unit != ACE_player) exitWith {END_COUNTER(firedEH);}; + +_jamChance = _jamChance * ([[0.5, 1.5, 7.5, 37.5], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray)); + +// increase jam chance on dusty grounds if prone (and at ground level) +if ((stance _unit == "PRONE") && {((getPosATL _unit) select 2) < 1}) then { + private _surface = configFile >> "CfgSurfaces" >> ((surfaceType getPosASL _unit) select [1]); + if (isClass _surface) then { + TRACE_1("dust",getNumber (_surface >> "dust")); + _jamChance = _jamChance + (getNumber (_surface >> "dust")) * _jamChance; + }; +}; + +TRACE_3("check for random jam",_unit,_weapon,_jamChance); +if ((random 1) < _jamChance) then { + [_unit, _weapon] call FUNC(jamWeapon); +}; + +END_COUNTER(firedEH); diff --git a/addons/overheating/functions/fnc_getWeaponData.sqf b/addons/overheating/functions/fnc_getWeaponData.sqf new file mode 100644 index 0000000000..e7da350e91 --- /dev/null +++ b/addons/overheating/functions/fnc_getWeaponData.sqf @@ -0,0 +1,68 @@ +/* + * Author: PabstMirror and esteldunedain + * Get weapon data with caching + * + * Argument: + * 0: weapon type + * + * Return value: + * 0: dispresion + * 1: slowdownFactor + * 2: jamChance + * + * Public: No + */ +#include "script_component.hpp" + +// Look in the cache first +private _weaponData = GVAR(cacheWeaponData) getVariable _weapon; +if (!isNil "_weaponData") exitWith {_weaponData}; + +// Search the config +// The old and new properties have the same name for dispersion, so read whichever is closer to the children +private _property = configFile >> "CfgWeapons" >> _weapon >> QGVAR(dispersion); +private _dispersion = if (isNumber _property) then { + getNumber _property; +} else { + if (isArray _property) then { + // Map old array property to new number property + ((getArray _property) select 3) / 0.004; + } else { + 1; + }; +}; + +// The old and new properties have the same name for slowdownFactor, so read whichever is closer to the children +_property = configFile >> "CfgWeapons" >> _weapon >> QGVAR(slowdownFactor); +private _slowdownFactor = if (isNumber _property) then { + getNumber _property; +} else { + if (isArray _property) then { + // Map old array property to new number property + ((getArray _property) select 3) / 0.9; + } else { + 1; + }; +}; + +// For jam chance, try reading the legacy property first (ace_overheating_jamChance). +private _jamChance = 1 / 3000; +_property = configFile >> "CfgWeapons" >> _weapon >> QGVAR(JamChance); +// If it exists read it, as the weapon is probably third party and not updated to the new properties +if (isArray _property) then { + // Map old array property to new number property + _jamChance = (getArray _property) select 1; +} else { + // No legacy property was found, look for the new one + _property = configFile >> "CfgWeapons" >> _weapon >> QGVAR(mrbs); + if (isNumber _property) then { + _jamChance = 1 / getNumber _property; + }; +}; + +// Cache the values +_weaponData = [_dispersion, _slowdownFactor, _jamChance]; +TRACE_2("building cache",_weapon,_weaponData); +GVAR(cacheWeaponData) setVariable [_weapon, _weaponData]; + +_weaponData diff --git a/addons/overheating/functions/fnc_handleTakeEH.sqf b/addons/overheating/functions/fnc_handleTakeEH.sqf new file mode 100644 index 0000000000..05139119e5 --- /dev/null +++ b/addons/overheating/functions/fnc_handleTakeEH.sqf @@ -0,0 +1,28 @@ +/* + * Author: Commy2 + * Handle "take" event + * I think it fixs jams when manually dragging a new magazine in from player's inventory + * + * Argument: + * 0: unit - Object the event handler is assigned to + * 1: container + * 2: item + * + * Return value: + * None + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_container", "_item"]; +TRACE_3("params",_unit,_container,_item); + +if ((_unit == ACE_player) + && {_container in [uniformContainer _unit, vestContainer _unit, backpackContainer _unit]} + && {_item == currentMagazine _unit}) then { //Todo: should this be any valid magazine for any jammed gun? + + TRACE_1("clearing jam",currentWeapon _unit); + [_unit, currentWeapon _unit, true] call FUNC(clearJam) + +}; diff --git a/addons/overheating/functions/fnc_jamWeapon.sqf b/addons/overheating/functions/fnc_jamWeapon.sqf index 000cd44021..1580ac240e 100644 --- a/addons/overheating/functions/fnc_jamWeapon.sqf +++ b/addons/overheating/functions/fnc_jamWeapon.sqf @@ -9,74 +9,58 @@ * Return value: * None * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_jamWeapon + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_unit,_weapon); +params ["_unit", "_weapon"]; +TRACE_2("params",_unit,_weapon); // don't jam a weapon with no rounds left -if (_unit ammo _weapon == 0) exitWith {}; +private _ammo = _unit ammo _weapon; +if (_ammo == 0) exitWith {}; -private ["_jammedWeapons"]; -_jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; +private _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []]; _jammedWeapons pushBack _weapon; _unit setVariable [QGVAR(jammedWeapons), _jammedWeapons]; -// this is to re-activate the 'DefaultAction', so you can jam a weapon while full auto shooting -_fnc_stopCurrentBurst = { - EXPLODE_2_PVT(_this,_params,_pfhId); - EXPLODE_4_PVT(_params,_unit,_weapon,_ammo,_startFrame); - - // Skip the first execution of the PFH - if (diag_frameno == _startFrame) exitWith {}; - - // Remove the PFH on the second execution - [_pfhId] call CBA_fnc_removePerFrameHandler; - - _unit setAmmo [_weapon, _ammo]; -}; // Stop current burst -_ammo = _unit ammo _weapon; if (_ammo > 0) then { _unit setAmmo [_weapon, 0]; - [_fnc_stopCurrentBurst, 0, [_unit, _weapon, _ammo, diag_frameno]] call CBA_fnc_addPerFrameHandler; + // this is to re-activate the 'DefaultAction', so you can jam a weapon while full auto shootin + [{ + params ["_unit", "_weapon", "_ammo"]; + _unit setAmmo [_weapon, _ammo]; + }, [_unit, _weapon, _ammo]] call EFUNC(common,execNextFrame); }; // only display the hint once, after you try to shoot an already jammed weapon GVAR(knowAboutJam) = false; if (_unit getVariable [QGVAR(JammingActionID), -1] == -1) then { - private ["_condition", "_statement", "_condition2", "_statement2", "_id"]; - _condition = { - [_this select 1] call EFUNC(common,canUseWeapon) - && {currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(jammedWeapons), []])} - && {!(currentMuzzle (_this select 1) in ((_this select 1) getVariable [QEGVAR(safemode,safedWeapons), []]))} - }; - - _statement = { - playSound3D ["a3\sounds_f\weapons\Other\dry9.wss", _this select 0]; - - if (!(missionNamespace getVariable [QGVAR(knowAboutJam), false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0} && {GVAR(DisplayTextOnJam)}) then { - [localize LSTRING(WeaponJammed)] call EFUNC(common,displayTextStructured); - GVAR(knowAboutJam) = true; + private _condition = { + [_this select 1] call EFUNC(common,canUseWeapon) + && {currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(jammedWeapons), []])} + && {!(currentMuzzle (_this select 1) in ((_this select 1) getVariable [QEGVAR(safemode,safedWeapons), []]))} }; - }; - _condition2 = { - currentWeapon (_this select 1) in ((_this select 1) getVariable [QGVAR(jammedWeapons), []]) - }; + private _statement = { + playSound3D ["a3\sounds_f\weapons\Other\dry9.wss", _this select 0]; - _statement2 = { - [_this select 1, currentWeapon (_this select 1), false] call FUNC(clearJam); - }; + if (!(missionNamespace getVariable [QGVAR(knowAboutJam), false]) && {(_this select 1) ammo currentWeapon (_this select 1) > 0} && {GVAR(DisplayTextOnJam)}) then { + [localize LSTRING(WeaponJammed)] call EFUNC(common,displayTextStructured); + GVAR(knowAboutJam) = true; + }; + }; - //_id = [_unit, format ["%1", localize LSTRING(UnjamWeapon)], "DefaultAction", _condition, _statement, _condition2, _statement2, 10] call EFUNC(common,addActionMenuEventHandler); - _id = [_unit, "DefaultAction", _condition, _statement] call EFUNC(common,addActionEventHandler); + private _id = [_unit, "DefaultAction", _condition, _statement] call EFUNC(common,addActionEventHandler); - _unit setVariable [QGVAR(JammingActionID), _id]; + _unit setVariable [QGVAR(JammingActionID), _id]; }; diff --git a/addons/overheating/functions/fnc_overheat.sqf b/addons/overheating/functions/fnc_overheat.sqf index 6680b759c4..8c934e80ad 100644 --- a/addons/overheating/functions/fnc_overheat.sqf +++ b/addons/overheating/functions/fnc_overheat.sqf @@ -15,156 +15,29 @@ * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -private ["_unit", "_weapon", "_ammo", "_projectile", "_velocity", "_variableName", "_overheat", "_temperature", "_time", "_bulletMass", "_energyIncrement", "_barrelMass", "_scaledTemperature", "_intensity", "_position", "_direction", "_dispersion", "_count", "_slowdownFactor", "_jamChance", "_surface"]; +params ["_unit", "_weapon", "", "", "_ammo", "", "_projectile"]; +TRACE_4("params",_unit,_weapon,_ammo,_projectile); -_unit = _this select 0; -_weapon = _this select 1; -_ammo = _this select 4; -_projectile = _this select 6; +//Only do heat calculations every 3 bullets +if (((_unit ammo _weapon) % 3) != 0) exitWith {}; -_velocity = velocity _projectile; - -// each weapon has it's own variable. Can't store the temperature in the weapon since they are not objects unfortunately. -_variableName = format [QGVAR(%1), _weapon]; - -// get old values -_overheat = _unit getVariable [_variableName, [0, 0]]; -_temperature = _overheat select 0; -_time = _overheat select 1; +BEGIN_COUNTER(overheat); // Get physical parameters -_bulletMass = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_BulletMass"); +private _bulletMass = getNumber (configFile >> "CfgAmmo" >> _ammo >> "ACE_BulletMass"); if (_bulletMass == 0) then { - // If the bullet mass is not configured, estimate it directly in grams - _bulletMass = 3.4334 + 0.5171 * (getNumber (configFile >> "CfgAmmo" >> _ammo >> "hit") + getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber")); + // If the bullet mass is not configured, estimate it + _bulletMass = 3.4334 + 0.5171 * (getNumber (configFile >> "CfgAmmo" >> _ammo >> "hit") + getNumber (configFile >> "CfgAmmo" >> _ammo >> "caliber")); }; -_energyIncrement = 0.75 * 0.0005 * _bulletMass * (vectorMagnitudeSqr _velocity); -_barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; +//https://en.wikipedia.org/wiki/Physics_of_firearms - Projectile motion is roughly equal to Barrel heat +//Muzzle Engergy = 1/2 * m * v^2 (1/2 * 0.001 g/kg * bulletMass (grams) * v^2) +//Multiple by 3 becase we only calc every 3rd bullet: (3 * 1/2 * 0.001) = 0.0015 +private _energyIncrement = 0.0015 * _bulletMass * (vectorMagnitudeSqr velocity _projectile); -// Calculate cooling -_temperature = [_temperature, _barrelMass, ACE_time - _time] call FUNC(cooldown); -// Calculate heating -_temperature = _temperature + _energyIncrement / (_barrelMass * 466); // Steel Heat Capacity = 466 J/(Kg.K) +TRACE_2("heat",_bulletMass,_energyIncrement); -// set updated values -_time = ACE_time; -_unit setVariable [_variableName, [_temperature, _time], false]; -_scaledTemperature = (_temperature / 1000) min 1 max 0; +[_unit, _weapon, _energyIncrement] call FUNC(updateTemperature); -// Smoke SFX, beginning at TEMP 0.15 -private "_intensity"; - -_intensity = (_scaledTemperature - 0.2) * 1.25; -if (_intensity > 0) then { - private ["_position", "_direction"]; - - _position = position _projectile; - _direction = (_unit weaponDirection _weapon) vectorMultiply 0.25; - - drop [ - "\A3\data_f\ParticleEffects\Universal\Refract", - "", - "Billboard", - 1.1, - 2, - _position, - _direction, - 1, - 1.2, - 1.0, - 0.1, - [0.1,0.15], - [[0.06,0.06,0.06,0.32*_scaledTemperature], [0.3,0.3,0.3,0.28*_scaledTemperature], [0.3,0.3,0.3,0.25*_scaledTemperature], [0.3,0.3,0.3,0.22*_scaledTemperature], [0.3,0.3,0.3,0.1*_scaledTemperature]], - [1,0], - 0.1, - 0.05, - "", - "", - "" - ]; - - _intensity = (_scaledTemperature - 0.5) * 2; - if (_intensity > 0) then { - drop [ - ["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 1, 16], - "", - "Billboard", - 1, - 1.2, - _position, - [0,0,0.25], - 0, - 1.275, - 1, - 0.025, - [0.28,0.33,0.37], - [[0.6,0.6,0.6,0.3*_intensity]], - [0.2], - 1, - 0.04, - "", - "", - "" - ]; - }; -}; - - -// dispersion and bullet slow down -private ["_dispersion", "_slowdownFactor", "_count"]; - -_dispersion = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_Dispersion"); - -_count = count _dispersion; -if (_count > 0) then { - _dispersion = ([_dispersion, (_count - 1) * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0; -} else { - _dispersion = 0; -}; - -_slowdownFactor = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_slowdownFactor"); - -_count = count _slowdownFactor; -if (_count > 0) then { - _slowdownFactor = ([_slowdownFactor, (_count - 1) * _scaledTemperature] call EFUNC(common,interpolateFromArray)) max 0; -} else { - _slowdownFactor = 1; -}; - -[_projectile, _dispersion - 2 * random _dispersion, _dispersion - 2 * random _dispersion, (_slowdownFactor - 1) * vectorMagnitude _velocity] call EFUNC(common,changeProjectileDirection); - - -// jamming -private "_jamChance"; - -_jamChance = getArray (configFile >> "CfgWeapons" >> _weapon >> "ACE_Overheating_jamChance"); - -_count = count _jamChance; -if (_count == 0) then { - _jamChance = [0]; - _count = 1; -}; - -_jamChance = [_jamChance, (_count - 1) * _scaledTemperature] call EFUNC(common,interpolateFromArray); - -// increase jam chance on dusty grounds if prone -if (stance _unit == "PRONE") then { - private "_surface"; - _surface = toArray (surfaceType getPosASL _unit); - _surface deleteAt 0; - - _surface = configFile >> "CfgSurfaces" >> toString _surface; - if (isClass _surface) then { - _jamChance = _jamChance + (getNumber (_surface >> "dust")) * _jamChance; - }; -}; - -if ("Jam" in (missionNamespace getVariable ["ACE_Debug", []])) then { - _jamChance = 0.5; -}; - -if (random 1 < _jamChance) then { - [_unit, _weapon] call FUNC(jamWeapon); -}; +END_COUNTER(overheat); diff --git a/addons/overheating/functions/fnc_swapBarrel.sqf b/addons/overheating/functions/fnc_swapBarrel.sqf index 4bd0f734b9..bbdab91705 100644 --- a/addons/overheating/functions/fnc_swapBarrel.sqf +++ b/addons/overheating/functions/fnc_swapBarrel.sqf @@ -9,17 +9,23 @@ * Return value: * None * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_swapBarrel + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_weapon); +params ["_player", "_weapon"]; +TRACE_2("params",_player,_weapon); +// Make the standing player kneel down if (stance _player != "PRONE") then { - [_player, "amovpknlmstpsraswrfldnon", 1] call EFUNC(common,doAnimation); + [_player, "amovpknlmstpsraswrfldnon", 1] call EFUNC(common,doAnimation); }; -_player playActionNow "GestureDismountMuzzle"; -_player playAction "GestureMountMuzzle"; + +// Barrel dismount gesture +_player playActionNow QGVAR(GestureDismountMuzzle); playSound "ACE_BarrelSwap"; -[10, [_player, _weapon], {(_this select 0) call FUNC(swapBarrelCallback)}, {}, (localize LSTRING(SwappingBarrel))] call EFUNC(common,progressBar); +[5, [_player, _weapon], {(_this select 0) call FUNC(swapBarrelCallback)}, {}, (localize LSTRING(SwappingBarrel))] call EFUNC(common,progressBar); diff --git a/addons/overheating/functions/fnc_swapBarrelCallback.sqf b/addons/overheating/functions/fnc_swapBarrelCallback.sqf index 5947e381c7..9c62e77f21 100644 --- a/addons/overheating/functions/fnc_swapBarrelCallback.sqf +++ b/addons/overheating/functions/fnc_swapBarrelCallback.sqf @@ -9,13 +9,24 @@ * Return value: * None * + * Example: + * [player, currentWeapon player] call ace_overheating_fnc_swapBarrelCallback + * * Public: No */ -#include "\z\ace\addons\overheating\script_component.hpp" +#include "script_component.hpp" -EXPLODE_2_PVT(_this,_player,_weapon); +params ["_player", "_weapon"]; +TRACE_2("params",_player,_weapon); + +// Barrel mount gesture +_player playAction QGVAR(GestureMountMuzzle); +playSound "ACE_BarrelSwap"; // don't consume the barrel, but rotate through them. [localize LSTRING(SwappedBarrel), QUOTE(PATHTOF(UI\spare_barrel_ca.paa))] call EFUNC(common,displayTextPicture); -_player setVariable [format [QGVAR(%1), _weapon], [0, 0], false]; +// Publish the temperature variable +_player setVariable [format [QGVAR(%1_temp), _weapon], 0, true]; +// Store the update time +_player setVariable [format [QGVAR(%1_time), _weapon], ACE_time]; diff --git a/addons/overheating/functions/fnc_updateTemperature.sqf b/addons/overheating/functions/fnc_updateTemperature.sqf new file mode 100644 index 0000000000..89d5975024 --- /dev/null +++ b/addons/overheating/functions/fnc_updateTemperature.sqf @@ -0,0 +1,86 @@ +/* + * Author: esteldunedain + * Update temperature of a weapon. + * + * Argument: + * 0: Unit + * 1: Weapon + * 2: Heat increment (J) + * + * Return value: + * Current temperature + * + * Example: + * [player, currentWeapon player, 2000] call ace_overheating_fnc_updateTemperature + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit", "_weapon", "_heatIncrement"]; +TRACE_3("params",_unit,_weapon,_heatIncrement); + +// get old values +// each weapon has it's own variable. Can't store the temperature in the weapon since they are not objects unfortunately. +private _tempVarName = format [QGVAR(%1_temp), _weapon]; +private _timeVarName = format [QGVAR(%1_time), _weapon]; +private _temperature = _unit getVariable [_tempVarName, 0]; +private _lastTime = _unit getVariable [_timeVarName, 0]; + +private _barrelMass = 0.50 * (getNumber (configFile >> "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> "mass") / 22.0) max 1.0; + +_fnc_cooling = { + params ["_temperature", "_barrelMass", "_totalTime"]; + + // If a long time passed since the last shot, there's no need to calculate anything; the weapon should be cool + if (_totalTime > 1800) exitWith {0}; + + //AR-15 (0.00570m bullet diameter) (barrel diameter usually 0.75" or 0.008255m radius) + //Steel Denisty = 7850 m^3 / kg + //Area of a cylinder (2/r)*(Pi * r^3 + V) - for a 0.008255m radius barrel -> Area = 210(1/meters) * Volume + //Adjusted volume for being hollowed out is ~1.1x + //So Area = 210 * 1.1 * (mass / 7850) = mass * 0.029427 (for steel near that diameter) + + private _barrelSurface = _barrelMass * 0.029427; + + TRACE_4("cooling",_temperature,_totalTime,_barrelMass,_barrelSurface); + + private _time = 0; + while {true} do { + private _deltaTime = (_totalTime - _time) min 20; + + _temperature = _temperature - ( + // Convective cooling + 25 * _barrelSurface * _temperature + // Radiative cooling + + 0.4 * 5.67e-8 * _barrelSurface * + ( (_temperature + 273.15)*(_temperature + 273.15) + * (_temperature + 273.15)*(_temperature + 273.15) + - 273.15 * 273.15 * 273.15 *273.15 ) + ) * _deltaTime / (_barrelMass * 466); + + if (_temperature < 1) exitWith {0}; + + if (isNil "_temperature") exitWith { + diag_log text format ["[ACE] ERROR: _totalTime = %1; _time = %2; _deltaTime = %3;", _totalTime, _time, _deltaTime]; + 0 + }; + + _time = _time + _deltaTime; + if (_time >= _totalTime) exitWith { _temperature max 0 }; + }; +}; + +// Calculate cooling +_temperature = [_temperature, _barrelMass, ACE_time - _lastTime] call _fnc_cooling; +TRACE_1("cooledTo",_temperature); +// Calculate heating +// Steel Heat Capacity = 466 J/(Kg.K) +_temperature = _temperature + _heatIncrement / (_barrelMass * 466); + +// Publish the temperature variable +[_unit, _tempVarName, _temperature, TEMP_TOLERANCE] call EFUNC(common,setApproximateVariablePublic); +// Store the update time locally +_unit setVariable [_timeVarName, ACE_time]; + +_temperature diff --git a/addons/overheating/functions/fnc_updateTemperatureThread.sqf b/addons/overheating/functions/fnc_updateTemperatureThread.sqf new file mode 100644 index 0000000000..76a332e480 --- /dev/null +++ b/addons/overheating/functions/fnc_updateTemperatureThread.sqf @@ -0,0 +1,25 @@ +/* + * Author: esteldunedain + * Update cooldown calculation of all player weapons at regular intervals. + * + * Argument: + * None + * + * Return value: + * None + * + * Example: + * [] call ace_overheating_fnc_updateTemperatureThread + * + * Public: No + */ + +#include "script_component.hpp" + +private _currentWeapon = currentWeapon ACE_player; +if ((_currentWeapon != "") && {_currentWeapon == primaryWeapon ACE_player || {_currentWeapon == handgunWeapon ACE_player}}) then { + [ACE_player, _currentWeapon, 0] call FUNC(updateTemperature); +}; + +// Schedule for execution again after 5 seconds +[DFUNC(updateTemperatureThread), [], 5] call EFUNC(common,waitAndExecute); diff --git a/addons/overheating/functions/script_component.hpp b/addons/overheating/functions/script_component.hpp new file mode 100644 index 0000000000..a8668e5b4f --- /dev/null +++ b/addons/overheating/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\overheating\script_component.hpp" \ No newline at end of file diff --git a/addons/overheating/script_component.hpp b/addons/overheating/script_component.hpp index ff124851ad..262accc43b 100644 --- a/addons/overheating/script_component.hpp +++ b/addons/overheating/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT overheating #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_OVERHEATING #define DEBUG_MODE_FULL #endif @@ -9,4 +14,12 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_OVERHEATING #endif -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\main\script_macros.hpp" + +#define TEMP_TOLERANCE 50 + +#ifdef DEBUG_MODE_FULL + #define TRACE_PROJECTILE_INFO(BULLET) _vdir = vectorNormalized velocity BULLET; _dir = (_vdir select 0) atan2 (_vdir select 1); _up = asin (_vdir select 2); _mv = vectorMagnitude velocity BULLET; TRACE_3("adjusted projectile",_dir,_up,_mv); +#else + #define TRACE_PROJECTILE_INFO(BULLET) /* noDebug */ +#endif diff --git a/addons/overheating/stringtable.xml b/addons/overheating/stringtable.xml index 28dc8b95c7..646a24fb88 100644 --- a/addons/overheating/stringtable.xml +++ b/addons/overheating/stringtable.xml @@ -1,7 +1,7 @@  - + Display text on jam Zeige Text bei Ladehemmung Mostrar texto al encasquillarse @@ -13,7 +13,7 @@ Mostrar texto quando trava acontecer Visualizza testo in caso di inceppamento - + Display a notification whenever your weapon gets jammed Zeige einen Hinweis, wenn die Waffe eine Ladehemmung hat. Mostrar notificación cada vez que el arma se encasquille @@ -25,6 +25,24 @@ Mostra uma notificação quando sua arma sofre um travamento. Visualizza una notifica in caso la tua arma si inceppasse + + Overheating Particle Effects + + + Show particle effects when weapon overheats + + + Overheating Particle Effects for everyone + + + Show particle effects when other players weapon overheats + + + Overheating Dispersion + + + Overheated weapons will be less accurate and have decreased muzzle velocity. Applys for all players. + Spare barrel Ersatzlauf diff --git a/addons/overpressure/CfgEventHandlers.hpp b/addons/overpressure/CfgEventHandlers.hpp index 6f8dba89bd..472c253f7d 100644 --- a/addons/overpressure/CfgEventHandlers.hpp +++ b/addons/overpressure/CfgEventHandlers.hpp @@ -14,7 +14,7 @@ class Extended_PostInit_EventHandlers { class Extended_FiredBIS_EventHandlers { class CAManBase { class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHBB);};); + clientFiredBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHBB);};); }; }; diff --git a/addons/overpressure/CfgWeapons.hpp b/addons/overpressure/CfgWeapons.hpp index a88fa90894..1f0814a487 100644 --- a/addons/overpressure/CfgWeapons.hpp +++ b/addons/overpressure/CfgWeapons.hpp @@ -49,6 +49,20 @@ class CfgWeapons { GVAR(damage) = 0.85; }; + class cannon_125mm: CannonCore { + GVAR(priority) = 1; + GVAR(angle) = 90; + GVAR(range) = 50; + GVAR(damage) = 0.85; + }; + + class cannon_105mm: CannonCore { + GVAR(priority) = 1; + GVAR(angle) = 90; + GVAR(range) = 50; + GVAR(damage) = 0.85; + }; + class mortar_155mm_AMOS: CannonCore { GVAR(priority) = 1; GVAR(angle) = 90; diff --git a/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf b/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf index 8de8af6375..273843ce8f 100644 --- a/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf +++ b/addons/overpressure/functions/fnc_cacheOverPressureValues.sqf @@ -1,7 +1,7 @@ /* * Author: joko // Jonas - * - * Handle fire of local launchers + * Cache the shot data for a given weapon/mag/ammo combination. + * Will use the config that has the highest priority. * * Argument: * 0: Weapon @@ -9,68 +9,49 @@ * 2: Ammo * * Return value: - * Array: + * Shot Config : * 0: Angle * 1: Range * 2: Damage * + * Example: + * ["cannon_125mm","Sh_125mm_APFSDS_T_Green","24Rnd_125mm_APFSDS_T_Green"] call ace_overpressure_fnc_cacheOverPressureValues + * + * Public: No */ - #include "script_component.hpp" +#include "script_component.hpp" params ["_weapon", "_ammo", "_magazine"]; TRACE_3("Parameter",_weapon,_magazine,_ammo); -private ["_array", "_type", "_return", "_config" /*, "_priority"*/]; - // get Priority Array from Config -_array = [ +private _array = [ getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(priority)), getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(priority)), getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(priority)) ]; -TRACE_1("Proiroity Array",_array); +(_array call CBA_fnc_findMax) params ["", ["_indexOfMaxPriority", 0, [0]]]; -/* for CBA Upadte 2.1 -_priority = _array call CBA_fnc_findMax; -_type = if (isNil "_priority") then { - 0 -} else { - _priority select 1 -}; -*/ +TRACE_2("Priority Array",_array,_indexOfMaxPriority); -// obsolete as CBA Update 2.1 start -_array params ["_max"]; - -// set Default type -_type = 0; -// get Highest Entry out the the Priority Array -{ - if (_max < _x) then { - _max = _x; - _type = _forEachIndex; - }; -} forEach _array; -// obsolete end - -TRACE_2("Highest Value",_max,_type); // create the Config entry Point -_config = [ +private _config = [ (configFile >> "CfgWeapons" >> _weapon), (configFile >> "CfgMagazines" >> _magazine), (configFile >> "CfgAmmo" >> _ammo) -] select _type; +] select _indexOfMaxPriority; TRACE_1("ConfigPath",_config); // get the Variables out of the Configes and create a array with then -_return = [ +private _return = [ (getNumber (_config >> QGVAR(angle))), (getNumber (_config >> QGVAR(range))), (getNumber (_config >> QGVAR(damage))) ]; -TRACE_1("Return",_return); -_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; -missionNameSpace setVariable [format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine], _return]; + +private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +missionNameSpace setVariable [_varName, _return]; +TRACE_2("Return",_varName,_return); _return diff --git a/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf index 4641e36eb8..3b6691fb81 100644 --- a/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf +++ b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf @@ -1,7 +1,7 @@ /* * Author: commy2 and esteldunedain - * * Handle fire of local launchers + * Called from firedEHBB, only for ace_player with shot that will cause damage * * Arguments: * 0: Unit that fired @@ -14,51 +14,46 @@ * * Return value: * None + * + * Example: + * [player, "launch_RPG32_F", "launch_RPG32_F", "Single", "R_PG32V_F", "RPG32_F", projectile] call ace_overpressure_fnc_fireLauncherBackblast; + * + * Public: No */ - #include "script_component.hpp" -params ["_firer", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; +params ["_firer", "_weapon", "_muzzle", "", "_ammo", "_magazine", "_projectile"]; +TRACE_6("params",_firer,_weapon,_muzzle,_ammo,_magazine,_projectile); -// Prevent AI from causing backblast damage -if !([_firer] call EFUNC(common,isPlayer)) exitWith {}; +private _position = getPosASL _projectile; +private _direction = [0, 0, 0] vectorDiff (vectorDir _projectile); -private ["_position", "_direction"]; - -_position = getPosASL _projectile; -_direction = [0, 0, 0] vectorDiff (vectorDir _projectile); - -private ["_var","_varName","_backblastAngle", "_backblastRange", "_backblastDamage"]; // Bake variable name and check if the variable exists, call the caching function otherwise -_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; -_var = if (isNil _varName) then { +private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +private _var = if (isNil _varName) then { [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); } else { missionNameSpace getVariable _varName; }; _var params["_backblastAngle","_backblastRange","_backblastDamage"]; - +TRACE_3("cache",_backblastAngle,_backblastRange,_backblastDamage); // Damage to others -private "_affected"; -_affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange]; +private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange]; // Let each client handle their own affected units ["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); // Damage to the firer -private "_distance"; -_distance = 2 * ([_position, _direction, _backblastRange, _firer] call FUNC(getDistance)); +private _distance = 2 * ([_position, _direction, _backblastRange, _firer] call FUNC(getDistance)); TRACE_1("Distance",_distance); if (_distance < _backblastRange) then { - private ["_alpha", "_beta", "_damage"]; + private _alpha = sqrt (1 - _distance / _backblastRange); + private _beta = sqrt 0.5; - _alpha = sqrt (1 - _distance / _backblastRange); - _beta = sqrt 0.5; - - _damage = _alpha * _beta * _backblastDamage; + private _damage = _alpha * _beta * _backblastDamage; [_damage * 100] call BIS_fnc_bloodEffect; if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_firer] call EFUNC(medical,hasMedicalEnabled))}) then { @@ -75,8 +70,7 @@ if (_distance < _backblastRange) then { [1,1,0,1] ] call EFUNC(common,addLineToDebugDraw); - private "_ref"; - _ref = _direction call EFUNC(common,createOrthonormalReference); + private _ref = _direction call EFUNC(common,createOrthonormalReference); [ _position, _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), [1,1,0,1] diff --git a/addons/overpressure/functions/fnc_fireOverpressureZone.sqf b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf index 02de0eb311..f254151307 100644 --- a/addons/overpressure/functions/fnc_fireOverpressureZone.sqf +++ b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf @@ -1,10 +1,10 @@ /* * Author: commy2 and esteldunedain - * * Handle fire of local vehicle weapons creating overpressure zones + * Called from firedEHOP, only for local vehicles * * Arguments: - * 0: Unit that fired + * 0: Vehicle that fired * 1: Weapon fired * 2: Muzzle * 3: Mode @@ -14,33 +14,35 @@ * * Return value: * None + * + * Example: + * [tank, "cannon_125mm", "cannon_125mm", "player", "Sh_125mm_APFSDS_T_Green", "24Rnd_125mm_APFSDS_T_Green", projectile] call ace_overpressure_fnc_fireOverpressureZone + * + * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -params ["_firer", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; -// Prevent AI from causing overpressure damage -if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; //@todo non-maingun turrets? +params ["_firer", "_weapon", "_muzzle", "", "_ammo", "_magazine", "_projectile"]; +TRACE_6("params",_firer,_weapon,_muzzle,_ammo,_magazine,_projectile); -private ["_position", "_direction"]; +// Prevent AI from causing overpressure damage (NOTE: Vehicle is local, but turret gunner may not be) +if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; -_position = getPosASL _projectile; -_direction = vectorDir _projectile; - -private ["_var", "_varName", "_dangerZoneAngle", "_dangerZoneRange", "_dangerZoneDamage"]; +private _position = getPosASL _projectile; +private _direction = vectorDir _projectile; // Bake variable name and check if the variable exists, call the caching function otherwise -_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; -_var = if (isNil _varName) then { +private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +private _var = if (isNil _varName) then { [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); } else { missionNameSpace getVariable _varName; }; _var params["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"]; +TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage); // Damage to others -private "_affected"; -_affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange]; +private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange]; // Let each client handle their own affected units ["overpressure", _affected, [_firer, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); @@ -52,8 +54,7 @@ _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange]; [1,0,0,1] ] call EFUNC(common,addLineToDebugDraw); - private "_ref"; - _ref = _direction call EFUNC(common,createOrthonormalReference); + private _ref = _direction call EFUNC(common,createOrthonormalReference); [ _position, _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), [1,1,0,1] diff --git a/addons/overpressure/functions/fnc_firedEHBB.sqf b/addons/overpressure/functions/fnc_firedEHBB.sqf index cf2ac31561..6327cc67c9 100644 --- a/addons/overpressure/functions/fnc_firedEHBB.sqf +++ b/addons/overpressure/functions/fnc_firedEHBB.sqf @@ -1,6 +1,5 @@ /* * Author: joko // Jonas - * * Handle fire of local launchers * * Arguments: @@ -14,14 +13,22 @@ * * Return value: * None + * + * Example: + * [player, "launch_RPG32_F", "launch_RPG32_F", "Single", "R_PG32V_F", "RPG32_F", projectile] call ace_overpressure_fnc_firedEHBB; + * + * Public: No */ #include "script_component.hpp" -private ["_damage","_varName"]; -params ["", "_weapon", "", "", "_ammo", "_magazine", ""]; + +params ["_firer", "_weapon", "", "", "_ammo", "_magazine", ""]; + +// Prevent AI from causing backblast damage (fast exit to only run for local players) +if (_firer != ACE_player) exitWith {}; // Bake variable name and check if the variable exists, call the caching function otherwise -_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; -_damage = if (isNil _varName) then { +private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +private _damage = if (isNil _varName) then { ([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues)) select 2; } else { (missionNameSpace getVariable _varName) select 2; diff --git a/addons/overpressure/functions/fnc_firedEHOP.sqf b/addons/overpressure/functions/fnc_firedEHOP.sqf index 6cec770deb..fbcb034279 100644 --- a/addons/overpressure/functions/fnc_firedEHOP.sqf +++ b/addons/overpressure/functions/fnc_firedEHOP.sqf @@ -1,10 +1,9 @@ /* * Author: joko // Jonas - * - * Handle fire of Other Weapons + * Handle fire of Vehicle Weapons * * Arguments: - * 0: Unit that fired + * 0: Vehicle that fired (XEH will filter only local) * 1: Weapon fired * 2: Muzzle * 3: Mode @@ -14,14 +13,19 @@ * * Return value: * None + * + * Example: + * [tank, "cannon_125mm", "cannon_125mm", "player", "Sh_125mm_APFSDS_T_Green", "24Rnd_125mm_APFSDS_T_Green", projectile] call ace_overpressure_fnc_firedEHOP + * + * Public: No */ #include "script_component.hpp" -private ["_damage","_varName"]; + params ["", "_weapon", "", "", "_ammo", "_magazine", ""]; // Bake variable name and check if the variable exists, call the caching function otherwise -_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; -_damage = if (isNil _varName) then { +private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +private _damage = if (isNil _varName) then { ([_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues)) select 2; } else { (missionNameSpace getVariable _varName) select 2; diff --git a/addons/overpressure/functions/fnc_getDistance.sqf b/addons/overpressure/functions/fnc_getDistance.sqf index cabdd267fa..341da388ca 100644 --- a/addons/overpressure/functions/fnc_getDistance.sqf +++ b/addons/overpressure/functions/fnc_getDistance.sqf @@ -1,6 +1,5 @@ /* * Author: commy2 and esteldunedain - * * Calculate the distance to the first intersection of a line * * Arguments: @@ -15,11 +14,12 @@ * Example: * [[1823.41,5729.05,6.66627], [-0.953255,0.109689,-0.281554], 15, ace_player] call ace_overpressure_fnc_getDistance * + * Public: No */ #include "script_component.hpp" params ["_posASL", "_direction", "_maxDistance", "_shooter"]; -TRACE_3("params",_posASL,_direction,_maxDistance); +TRACE_4("params",_posASL,_direction,_maxDistance, _shooter); private _intersections = lineIntersectsSurfaces [_posASL, _posASL vectorAdd (_direction vectorMultiply _maxDistance), _shooter, objNull, true, 99]; @@ -29,9 +29,10 @@ private _distance = 999; { _x params ["_intersectPosASL", "_surfaceNormal", "_intersectObject"]; - - //Hit something solid that can reflect - (Static covers Building) - if ((isNull _intersectObject) || {(_intersectObject isKindOf "Static") || {_intersectObject isKindOf "AllVehicles"}}) exitWith { + TRACE_3("Intersect",_intersectPosASL,_surfaceNormal,_intersectObject); + + //Hit something solid that can reflect - (Static covers Building) [Need to manually filter out _shoot for FFV shots] + if ((isNull _intersectObject) || {(_intersectObject != _shooter) && {(_intersectObject isKindOf "Static") || {_intersectObject isKindOf "AllVehicles"}}}) exitWith { _distance = _posASL vectorDistance _intersectPosASL; TRACE_3("hit solid object",_distance,_intersectObject,typeOf _intersectObject); diff --git a/addons/overpressure/functions/fnc_overpressureDamage.sqf b/addons/overpressure/functions/fnc_overpressureDamage.sqf index b1c8a5c574..3b8d4ea6f2 100644 --- a/addons/overpressure/functions/fnc_overpressureDamage.sqf +++ b/addons/overpressure/functions/fnc_overpressureDamage.sqf @@ -1,56 +1,56 @@ /* * Author: commy2 and esteldunedain - * * Calculate and apply backblast damage to potentially affected local units + * Handles the "overpressure" event. * * Argument: * 0: Unit that fired * 1: Pos ASL of the projectile - * 2: Direction of the projectile + * 2: Direction of the projectile (reversed for launcher backblast) * 3: Weapon fired * 4: Magazine * 5: Ammo * * Return value: * None + * + * Example: + * [tank, [1727.57,5786.15,7.24899], [-0.982474,-0.185998,-0.0122501], "cannon_125mm", "24Rnd_125mm_APFSDS_T_Green", "Sh_125mm_APFSDS_T_Green"] call ace_overpressure_fnc_overpressureDamage + * + * Public: No */ #include "script_component.hpp" -private ["_var","_overpressureAngle", "_overpressureRange", "_overpressureDamage"]; params ["_firer", "_posASL", "_direction", "_weapon", "_magazine", "_ammo"]; // Bake variable name and check if the variable exists, call the caching function otherwise -_varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; -_var = if (isNil _varName) then { +private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine]; +private _var = if (isNil _varName) then { [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); } else { missionNameSpace getVariable _varName; }; _var params["_overpressureAngle","_overpressureRange","_overpressureDamage"]; - -TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage,_weapon); +TRACE_3("cache",_overpressureAngle,_overpressureRange,_overpressureDamage); { if (local _x && {_x != _firer} && {vehicle _x == _x}) then { - private ["_targetPositionASL", "_relativePosition", "_axisDistance", "_distance", "_angle", "_line", "_line2"]; + private _targetPositionASL = eyePos _x; + private _relativePosition = _targetPositionASL vectorDiff _posASL; + private _axisDistance = _relativePosition vectorDotProduct _direction; + private _distance = vectorMagnitude _relativePosition; + private _angle = acos (_axisDistance / _distance); - _targetPositionASL = eyePos _x; - _relativePosition = _targetPositionASL vectorDiff _posASL; - _axisDistance = _relativePosition vectorDotProduct _direction; - _distance = vectorMagnitude _relativePosition; - _angle = acos (_axisDistance / _distance); - - _line = [_posASL, _targetPositionASL, _firer, _x]; - _line2 = [_posASL, _targetPositionASL]; + private _line = [_posASL, _targetPositionASL, _firer, _x]; + private _line2 = [_posASL, _targetPositionASL]; TRACE_4("Affected:",_x,_axisDistance,_distance,_angle); if (_angle < _overpressureAngle && {_distance < _overpressureRange} && {!lineIntersects _line} && {!terrainIntersectASL _line2}) then { - private ["_alpha", "_beta", "_damage"]; - _alpha = sqrt (1 - _distance / _overpressureRange); - _beta = sqrt (1 - _angle / _overpressureAngle); + private _alpha = sqrt (1 - _distance / _overpressureRange); + private _beta = sqrt (1 - _angle / _overpressureAngle); - _damage = _alpha * _beta * _overpressureDamage; + private _damage = _alpha * _beta * _overpressureDamage; // If the target is the ACE_player if (_x == ACE_player) then {[_damage * 100] call BIS_fnc_bloodEffect}; @@ -60,6 +60,14 @@ TRACE_4("Parameters:",_overpressureAngle,_overpressureRange,_overpressureDamage, } else { _x setDamage (damage _x + _damage); }; + + #ifdef DEBUG_MODE_FULL + //Shows damage lines in green + [ _posASL, + _targetPositionASL, + [0,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + #endif }; }; } forEach ((ASLtoAGL _posASL) nearEntities ["CAManBase", _overpressureRange]); diff --git a/addons/overpressure/script_component.hpp b/addons/overpressure/script_component.hpp index fbe7cd1238..5f4005374b 100644 --- a/addons/overpressure/script_component.hpp +++ b/addons/overpressure/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT overpressure #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_OVERPRESSURE #define DEBUG_MODE_FULL #endif diff --git a/addons/parachute/script_component.hpp b/addons/parachute/script_component.hpp index 5668220421..d86d153f22 100644 --- a/addons/parachute/script_component.hpp +++ b/addons/parachute/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT parachute #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_PARACHUTE #define DEBUG_MODE_FULL #endif diff --git a/addons/parachute/stringtable.xml b/addons/parachute/stringtable.xml index ebedda7405..3a12f38c8f 100644 --- a/addons/parachute/stringtable.xml +++ b/addons/parachute/stringtable.xml @@ -43,7 +43,7 @@ Paracaídas no dirigible Parachute non manœuvrable Niesterowalny spadochron - Neříditelný Padák + Neříditelný padák Irányíthatatlan ejtőernyő Неуправляемый парашют Paracadute non manovrabile @@ -57,7 +57,7 @@ Ejtőernyő elvágása Cortar para-quedas Обрезать стропы - Odžíznout Padák + Odžíznout padák Cortar paracaídas @@ -68,8 +68,8 @@ Tartalék ejtőernyő Para-quedas de reserva Запасной парашют - Záložní Padák + Záložní padák Paracaídas de reserva - + \ No newline at end of file diff --git a/addons/ragdolls/script_component.hpp b/addons/ragdolls/script_component.hpp index a0de706e10..e433e8d098 100644 --- a/addons/ragdolls/script_component.hpp +++ b/addons/ragdolls/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT ragdolls #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_RAGDOLLS #define DEBUG_MODE_FULL #endif diff --git a/addons/rangecard/script_component.hpp b/addons/rangecard/script_component.hpp index 8281f77eb3..251fb7263f 100644 --- a/addons/rangecard/script_component.hpp +++ b/addons/rangecard/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT rangecard #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_RANGECARD #define DEBUG_MODE_FULL #endif diff --git a/addons/realisticnames/CfgMagazines.hpp b/addons/realisticnames/CfgMagazines.hpp index 69d6cfa579..a6a64a4a15 100644 --- a/addons/realisticnames/CfgMagazines.hpp +++ b/addons/realisticnames/CfgMagazines.hpp @@ -394,6 +394,7 @@ class CfgMagazines { // hand grenades class HandGrenade: CA_Magazine { displayName = CSTRING(HandGrenade_Name); + displayNameShort = "M67"; }; class SmokeShell: HandGrenade { displayName = CSTRING(SmokeShell_Name); diff --git a/addons/realisticnames/script_component.hpp b/addons/realisticnames/script_component.hpp index 0dd8e679a7..33cd56777a 100644 --- a/addons/realisticnames/script_component.hpp +++ b/addons/realisticnames/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT realisticnames #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_REALISTICNAMES #define DEBUG_MODE_FULL #endif diff --git a/addons/realisticnames/stringtable.xml b/addons/realisticnames/stringtable.xml index 4865186563..b02d2a2822 100644 --- a/addons/realisticnames/stringtable.xml +++ b/addons/realisticnames/stringtable.xml @@ -426,7 +426,7 @@ KamAZ Transport KamAZ de transporte KamAZ transportowy - KamAZ-5350 (valník) + KamAZ (valník) KamAZ Transport КамАЗ Транспортный KamAZ Transporte @@ -438,7 +438,7 @@ KamAZ Transport (bedeckt) KamAZ de transporte (cubierto) KamAZ Transportowy (zakryty) - KamAZ-5350 (valník-krytý) + KamAZ (valník-krytý) KamAZ Transport (bâché) КамАЗ Транспортный (крытый) KamAZ Transporte (coberto) @@ -450,7 +450,7 @@ KamAZ Munition KamAZ de munición KamAZ Amunicyjny - KamAZ-5350 (muniční) + KamAZ (muniční) KamAZ Munitions КамАЗ Боеприпасы KamAZ Munições @@ -462,7 +462,7 @@ KamAZ Treibstoff KamAZ de combustible KamAZ cysterna - KamAZ-5350 (cisterna) + KamAZ (cisterna) KamAZ Citerne КамАЗ Заправщик KamAZ Combustível @@ -474,7 +474,7 @@ KamAZ Instandsetzung KamAZ de reparación KamAZ Naprawczy - KamAZ-5350 (opravárenský) + KamAZ (opravárenský) KamAZ Réparation КамАЗ Ремонтный KamAZ Reparador @@ -486,7 +486,7 @@ KamAZ Sanitäter KamAZ médico KamAZ Medyczny - KamAZ-5350 (zdravotnický) + KamAZ (zdravotnický) KamAZ Médical КамАЗ Медицинский KamAZ Médico @@ -594,7 +594,7 @@ Typhoon Transport Typhoon de transporte Typhoon Transportowy - KamAZ-63968 Typhoon (valník) + KamAZ Typhoon (valník) Typhoon Transport Тайфун Транспортный Typhoon Transporte @@ -606,7 +606,7 @@ Typhoon Transport (bedeckt) Typhoon de transporte (cubierto) Typhoon Transportowy (przykryty) - KamAZ-63968 Typhoon (valník-krytý) + KamAZ Typhoon (valník-krytý) Typhoon Transport (bâché) Тайфун Транспортный (крытый) Typhoon Transporte (coberto) @@ -618,7 +618,7 @@ Typhoon Gerät Typhoon con dispositivo Typhoon Urządzenie - KamAZ-63968 Typhoon (zařízení) + KamAZ Typhoon (zařízení) Typhoon Dispositif Тайфун Устройство Typhoon Dispositivo @@ -630,7 +630,7 @@ Typhoon Munition Typhoon de munición Typhoon Amunicyjny - KamAZ-63968 Typhoon (muniční) + KamAZ Typhoon (muniční) Typhoon Munitions Тайфун Боеприпасы Typhoon Munições @@ -642,7 +642,7 @@ Typhoon Treibstoff Typhoon de combustible Typhoon Cysterna - KamAZ-63968 Typhoon (cisterna) + KamAZ Typhoon (cisterna) Typhoon Citerne Тайфун Заправщик Typhoon Combustível @@ -654,7 +654,7 @@ Typhoon Instandsetzung Typhoon de reparación Typhoon Naprawczy - KamAZ-63968 Typhoon (opravárenský) + KamAZ Typhoon (opravárenský) Typhoon Réparation Тайфун Ремонтный Typhoon Reparador @@ -666,7 +666,7 @@ Typhoon Sanitäter Typhoon médico Typhoon Medyczny - KamAZ-63968 Typhoon (zdravotnický) + KamAZ Typhoon (zdravotnický) Typhoon Médical Тайфун Медицинский Typhoon Médico @@ -1730,7 +1730,7 @@ ASP-1 Kir (Black) - ASP-1 Kir (Čená) + ASP-1 Kir (Černá) ASP-1 Kir (Noir) ASP-1 Kir (Negro) ASP-1 Kir (Чёрный) diff --git a/addons/rearm/functions/fnc_dropAmmo.sqf b/addons/rearm/functions/fnc_dropAmmo.sqf index 8fc9ba4945..dff8463e27 100644 --- a/addons/rearm/functions/fnc_dropAmmo.sqf +++ b/addons/rearm/functions/fnc_dropAmmo.sqf @@ -36,7 +36,7 @@ if (_actionID != -1) then { _unit removeAction _actionID; _unit setVariable [QGVAR(ReleaseActionID), nil]; }; -[_unit, QGVAR(vehRearm), false] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", QGVAR(vehRearm), false] call EFUNC(common,statusEffect_set); if (_unholster) then { REARM_UNHOLSTER_WEAPON diff --git a/addons/rearm/functions/fnc_grabAmmo.sqf b/addons/rearm/functions/fnc_grabAmmo.sqf index 9b09d1282d..0b62cb69d5 100644 --- a/addons/rearm/functions/fnc_grabAmmo.sqf +++ b/addons/rearm/functions/fnc_grabAmmo.sqf @@ -19,7 +19,7 @@ params ["_dummy", "_unit"]; REARM_HOLSTER_WEAPON -[_unit, QGVAR(vehRearm), true] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", QGVAR(vehRearm), true] call EFUNC(common,statusEffect_set); [ 5, diff --git a/addons/rearm/functions/fnc_takeSuccess.sqf b/addons/rearm/functions/fnc_takeSuccess.sqf index 952cfdee08..3ced9a729a 100644 --- a/addons/rearm/functions/fnc_takeSuccess.sqf +++ b/addons/rearm/functions/fnc_takeSuccess.sqf @@ -22,7 +22,7 @@ private ["_ammo", "_dummyName", "_dummy", "_actionID"]; params ["_args"]; _args params ["_unit", "_magazineClass", "_target"]; // _target is for future possible finite ammo -[_unit, QGVAR(vehRearm), true] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", QGVAR(vehRearm), true] call EFUNC(common,statusEffect_set); _dummy = [_unit, _magazineClass] call FUNC(createDummy); [_dummy, _unit] call FUNC(pickUpAmmo); diff --git a/addons/rearm/script_component.hpp b/addons/rearm/script_component.hpp index e90e87a422..dad20ed535 100644 --- a/addons/rearm/script_component.hpp +++ b/addons/rearm/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT rearm #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_REARM #define DEBUG_MODE_FULL #endif diff --git a/addons/rearm/stringtable.xml b/addons/rearm/stringtable.xml index bbc7c36302..26faace503 100644 --- a/addons/rearm/stringtable.xml +++ b/addons/rearm/stringtable.xml @@ -7,6 +7,7 @@ Ustawienia przezbrajania Настройки перевооружения Ajustes de rearme + Nastavení přezbrojení This module allows you to tweak rearm system settings. @@ -14,6 +15,7 @@ Ten moduł pozwala dostosować ustawienia przezbrajania. Этот модуль позволяет изменить настройки системы перевооружения. Este módulo permite que você ajuste o sistema de rearme. + Tento modul umožňuje upravovat systém přezbrojení. Rearm Amount @@ -21,6 +23,7 @@ Szybkość przezbrajania Количество вооружения Quantidade de rearme + Rychlost přezbrojení How fast should a vehicle be rearmed? @@ -28,6 +31,7 @@ Jak szybko pojazd zostanie przezbrojony? Как быстро техника должна перевооружаться? Quão rápido o veículo deve ser rearmado? + Jak rychle bude vozidlo přezbrojeno? Entire Vehicle @@ -35,6 +39,7 @@ Cały pojazd Полностью техника Todo o veículo + Celé vozidlo Entire Magazine @@ -42,6 +47,7 @@ Cały magazynek Полный магазин Todo o carregador + Celý zásobník Amount based on caliber @@ -49,6 +55,7 @@ Ilość zależna od kalibru Количество зависит от калибра Quantidade baseada no calibre + Rychlost závisí na ráži Rearm @@ -56,6 +63,7 @@ Przezbrój Перевооружить Rearmar + Přezbrojit Rearming %1 with %2 ... @@ -63,6 +71,7 @@ Przezbrajanie %1 przy pomocy %2 ... Перевооружается %1 снарядами %2 ... Rearmando %1 com %2 ... + Přezbrojuji %1 za pomoci %2 ... Rearming %1 ... @@ -70,6 +79,7 @@ Przezbrajanie %1 ... Перевооружается %1 ... Rearmando %1 ... + Přezbrojuji %1 ... Taking %1 for %2 ... @@ -77,6 +87,7 @@ Pobieranie %1 dla %2 ... Забираем %1 для %2 ... Pegando %1 para %2 ... + Beru %1 pro %2 ... Take ammo @@ -84,6 +95,7 @@ Pobierz amunicję Взять боекомплект Tomar munição + Vít munici Pick up ammo @@ -91,6 +103,7 @@ Podnieś amunicję Поднять боекомплект Pegar munição + Sebrat munici Store ammo @@ -98,6 +111,7 @@ Przechowaj amunicję Сохранить боекомплект Guardar munição + Uskladnit munici Storing %1 in %2 ... @@ -105,6 +119,7 @@ Przechowywanie %1 w %2 ... Сохраняется %1 в %2 ... Guardando %1 em %2 ... + Ukládám %1 v %2 ... Picking up ammo ... @@ -119,6 +134,7 @@ Przezbrojono %1 pocisków %2 na %3 Перевооружено %1 снарядов %2 на %3 Rearmando %1 cartuchos de %2 em %3 + Přezbrojeno % nábojů z %2 u %3 Smoke Screen @@ -148,6 +164,7 @@ 30mm HEI 30мм ОФЗ 30mm HEI + 30mm HEI 30mm HEI-T @@ -155,6 +172,7 @@ 30mm HEI-T 30мм ОФЗТ 30mm HEI-T + 30mm HEI-T AIM-9 Sidewinder @@ -162,6 +180,7 @@ AIM-9 Sidewinder AIM-9 Sidewinder AIM-9 Sidewinder + AIM-9 Sidewinder Wympel R-73 @@ -169,6 +188,7 @@ Wympel R-73 Р-73 (Вымпел) Wympel R-73 + Wympel R-73 AGM-65 Maverick @@ -176,6 +196,7 @@ AGM-65 Maverick AGM-65 Maverick AGM-65 Maverick + AGM-65 Maverick Kh-25MTP @@ -183,6 +204,7 @@ Ch-25MTP Х-25МТП Ch-25MTP + Kh-25MTP Hydra 70 HE @@ -190,6 +212,7 @@ Hydra 70 HE Hydra 70 HE Hydra 70 HE + Hydra 70 HE S-8 HE @@ -197,6 +220,7 @@ S-8 HE С-8 ОФ S-8 HE + S-8 HE Hydra 70 AP @@ -204,6 +228,7 @@ Hydra 70 AP Hydra 70 AP Hydra 70 AP + Hydra 70 AP S-8 AP @@ -211,6 +236,7 @@ S-8 AP С-8КОМ S-8 AP + S-8 AP GBU-12 @@ -218,6 +244,7 @@ GBU-12 GBU-12 GBU-12 + GBU-12 FAB-250M-54 @@ -225,6 +252,7 @@ FAB-250M-54 ФАБ-250М-54 FAB-250M-54 + FAB-250M-54 - + \ No newline at end of file diff --git a/addons/recoil/script_component.hpp b/addons/recoil/script_component.hpp index b5a74ec8dd..aa80910be1 100644 --- a/addons/recoil/script_component.hpp +++ b/addons/recoil/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT recoil #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_RECOIL #define DEBUG_MODE_FULL #endif diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index ff91205434..5b6d9f483b 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -113,7 +113,7 @@ class CfgVehicles { class ACE_Module; - class ACE_moduleRefuelSettings : ACE_Module { + class ACE_moduleRefuelSettings: ACE_Module { scope = 2; displayName = CSTRING(RefuelSettings_Module_DisplayName); icon = QUOTE(PATHTOF(ui\icon_module_refuel.paa)); @@ -134,30 +134,30 @@ class CfgVehicles { }; class ThingX; - class ACE_refuel_fuelNozzle : ThingX { + class ACE_refuel_fuelNozzle: ThingX { XEH_ENABLED; MACRO_NOZZLE_ACTIONS displayName = QGVAR(fuelNozzle); scope = 1; scopeCurator = 1; - model = "\A3\Structures_F_Heli\VR\Helpers\Sign_sphere10cm_F.p3d"; + model = PATHTOF(data\nozzle.p3d); }; class All; - class Static : All {}; + class Static: All {}; - class Building : Static {}; + class Building: Static {}; - class NonStrategic : Building {}; + class NonStrategic: Building {}; class HouseBase: NonStrategic {}; class House: HouseBase {}; - class House_F : House {}; + class House_F: House {}; - class House_Small_F : House_F { + class House_Small_F: House_F { class ACE_Actions { class ACE_MainActions { displayName = ECSTRING(interaction,MainAction); @@ -168,80 +168,80 @@ class CfgVehicles { }; }; - class AllVehicles : All { + class AllVehicles: All { GVAR(flowRate) = 1; }; - class Land : AllVehicles {}; - class LandVehicle : Land {}; - class Car : LandVehicle { + class Land: AllVehicles {}; + class LandVehicle: Land {}; + class Car: LandVehicle { MACRO_CONNECT_ACTIONS }; - class Tank : LandVehicle { + class Tank: LandVehicle { MACRO_CONNECT_ACTIONS GVAR(flowRate) = 4; }; - class StaticWeapon : LandVehicle { + class StaticWeapon: LandVehicle { MACRO_CONNECT_ACTIONS }; - class Air : AllVehicles { + class Air: AllVehicles { GVAR(flowRate) = 8; }; - class Helicopter : Air { + class Helicopter: Air { MACRO_CONNECT_ACTIONS GVAR(fuelCapacity) = 1500; }; - class Helicopter_Base_F : Helicopter {}; + class Helicopter_Base_F: Helicopter {}; - class Helicopter_Base_H : Helicopter_Base_F { + class Helicopter_Base_H: Helicopter_Base_F { GVAR(fuelCapacity) = 3000; }; - class Plane : Air { + class Plane: Air { MACRO_CONNECT_ACTIONS GVAR(fuelCapacity) = 2000; GVAR(flowRate) = 16; }; - class Plane_Base_F : Plane {}; + class Plane_Base_F: Plane {}; - class Ship : AllVehicles {}; + class Ship: AllVehicles {}; - class Ship_F : Ship { + class Ship_F: Ship { MACRO_CONNECT_ACTIONS GVAR(fuelCapacity) = 2000; GVAR(flowRate) = 4; }; - class Boat_Civil_01_base_F : Ship_F { + class Boat_Civil_01_base_F: Ship_F { GVAR(fuelCapacity) = 200; }; - class Boat_F : Ship_F { + class Boat_F: Ship_F { GVAR(flowRate) = 1; }; - class Boat_Armed_01_base_F : Boat_F { + class Boat_Armed_01_base_F: Boat_F { GVAR(fuelCapacity) = 300; }; - class Rubber_duck_base_F : Boat_F { + class Rubber_duck_base_F: Boat_F { GVAR(fuelCapacity) = 30; }; - class SDV_01_base_F : Boat_F { + class SDV_01_base_F: Boat_F { // SDV is using electrical propulsion GVAR(fuelCapacity) = 0; }; - class Car_F : Car { + class Car_F: Car { // Assuming large vehicle tank GVAR(fuelCapacity) = 60; }; - class Kart_01_Base_F : Car_F { + class Kart_01_Base_F: Car_F { GVAR(fuelCapacity) = 8; }; @@ -257,7 +257,7 @@ class CfgVehicles { GVAR(fuelCapacity) = 50; }; - class Quadbike_01_base_F : Car_F { + class Quadbike_01_base_F: Car_F { // Assuming usual Yamaha quad GVAR(fuelCapacity) = 10; }; @@ -284,7 +284,7 @@ class CfgVehicles { GVAR(fuelCapacity) = 269; }; - class Truck_F : Car_F { + class Truck_F: Car_F { GVAR(fuelCapacity) = 400; GVAR(flowRate) = 2; }; @@ -294,7 +294,7 @@ class CfgVehicles { GVAR(fuelCapacity) = 583; }; - class B_Truck_01_transport_F : Truck_01_base_F {}; + class B_Truck_01_transport_F: Truck_01_base_F {}; class B_Truck_01_mover_F: B_Truck_01_transport_F {}; @@ -310,7 +310,7 @@ class CfgVehicles { GVAR(fuelCapacity) = 600; }; - class Van_01_base_F : Truck_F { + class Van_01_base_F: Truck_F { // Small Truck // Assuming 80L as in Ford Transit GVAR(fuelCapacity) = 80; @@ -319,7 +319,7 @@ class CfgVehicles { class Van_01_fuel_base_F: Van_01_base_F { transportFuel = 0; //1k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0.38,-3.17,-.7},{-0.41,-3.17,-.7}}; + GVAR(hooks)[] = {{0.38,-3.17,-.7},{-0.41,-3.17,-.7}}; GVAR(fuelCargo) = 2000; }; @@ -338,11 +338,11 @@ class CfgVehicles { class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{-1.08,-4.81,-.8}}; + GVAR(hooks)[] = {{-1.08,-4.81,-.8}}; GVAR(fuelCargo) = 1000; }; - class APC_Tracked_02_base_F : Tank_F { + class APC_Tracked_02_base_F: Tank_F { // BM-2T // Assuming 1 L/km GVAR(fuelCapacity) = 1000; @@ -370,111 +370,111 @@ class CfgVehicles { GVAR(fuelCapacity) = 1160; }; - class MBT_01_arty_base_F : MBT_01_base_F { + class MBT_01_arty_base_F: MBT_01_base_F { // Assuming similar 2S3 GVAR(fuelCapacity) = 830; }; - class MBT_02_arty_base_F : MBT_02_base_F { + class MBT_02_arty_base_F: MBT_02_base_F { // Assuming similar 2S3 GVAR(fuelCapacity) = 830; }; - class Heli_Attack_01_base_F : Helicopter_Base_F { + class Heli_Attack_01_base_F: Helicopter_Base_F { // Commanche }; - class Heli_Attack_02_base_F : Helicopter_Base_F { + class Heli_Attack_02_base_F: Helicopter_Base_F { // Mi-48 Kajman }; - class Heli_Light_01_base_F : Helicopter_Base_H { + class Heli_Light_01_base_F: Helicopter_Base_H { // MH-6 GVAR(fuelCapacity) = 242; }; - class Heli_Light_02_base_F : Helicopter_Base_H { + class Heli_Light_02_base_F: Helicopter_Base_H { // Ka-60 Kasatka GVAR(fuelCapacity) = 1450; }; - class Heli_light_03_base_F : Helicopter_Base_F { + class Heli_light_03_base_F: Helicopter_Base_F { // AW159 GVAR(fuelCapacity) = 1004; }; - class Heli_Transport_01_base_F : Helicopter_Base_H { + class Heli_Transport_01_base_F: Helicopter_Base_H { // Ghost Hawk // Assuming similar UH60 GVAR(fuelCapacity) = 1360; }; - class Heli_Transport_02_base_F : Helicopter_Base_H { + class Heli_Transport_02_base_F: Helicopter_Base_H { // AW101 GVAR(fuelCapacity) = 3222; }; - class Heli_Transport_03_base_F : Helicopter_Base_H { + class Heli_Transport_03_base_F: Helicopter_Base_H { // Chinook 47I GVAR(fuelCapacity) = 3914; }; - class Heli_Transport_04_base_F : Helicopter_Base_H { + class Heli_Transport_04_base_F: Helicopter_Base_H { // Mi-290 Taru GVAR(fuelCapacity) = 3914; }; - class Plane_CAS_01_base_F : Plane_Base_F { + class Plane_CAS_01_base_F: Plane_Base_F { // Assuming similar to A10 GVAR(fuelCapacity) = 6223; }; - class Plane_CAS_02_base_F : Plane_Base_F { + class Plane_CAS_02_base_F: Plane_Base_F { // Yak-130 GVAR(fuelCapacity) = 2099; }; - class UAV_01_base_F : Helicopter_Base_F { + class UAV_01_base_F: Helicopter_Base_F { // Darter is electrical GVAR(fuelCapacity) = 0; }; - class UAV : Plane {}; + class UAV: Plane {}; - class UAV_02_base_F : UAV { + class UAV_02_base_F: UAV { // Assuming similar YAHBON-R2 GVAR(fuelCapacity) = 270; }; - class UGV_01_base_F : Car_F { + class UGV_01_base_F: Car_F { // Stomper GVAR(fuelCapacity) = 100; }; - class Plane_Fighter_03_base_F : Plane_Base_F { + class Plane_Fighter_03_base_F: Plane_Base_F { // L-159 ALCA GVAR(fuelCapacity) = 1914; }; // Vanilla fuel vehicles - class Truck_02_fuel_base_F : Truck_02_base_F { + class Truck_02_fuel_base_F: Truck_02_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0.99,-3.47,-0.67},{-1.04,-3.47,-0.67}}; + GVAR(hooks)[] = {{0.99,-3.47,-0.67},{-1.04,-3.47,-0.67}}; GVAR(fuelCargo) = 10000; }; - class B_Truck_01_fuel_F : B_Truck_01_mover_F { + class B_Truck_01_fuel_F: B_Truck_01_mover_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{.28,-4.99,-.3},{-.25,-4.99,-.3}}; + GVAR(hooks)[] = {{.28,-4.99,-.3},{-.25,-4.99,-.3}}; GVAR(fuelCargo) = 10000; }; - class O_Truck_03_fuel_F : Truck_03_base_F { + class O_Truck_03_fuel_F: Truck_03_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{1.3,-1.59,-.62},{-1.16,-1.59,-.62}}; + GVAR(hooks)[] = {{1.3,-1.59,-.62},{-1.16,-1.59,-.62}}; GVAR(fuelCargo) = 10000; }; @@ -490,18 +490,18 @@ class CfgVehicles { }; }; - class B_Slingload_01_Fuel_F : Slingload_01_Base_F { + class B_Slingload_01_Fuel_F: Slingload_01_Base_F { XEH_ENABLED; transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0.55,3.02,-0.5},{-0.52,3.02,-0.5}}; + GVAR(hooks)[] = {{0.55,3.02,-0.5},{-0.52,3.02,-0.5}}; GVAR(fuelCargo) = 10000; }; - class O_Heli_Transport_04_fuel_F : Heli_Transport_04_base_F { + class O_Heli_Transport_04_fuel_F: Heli_Transport_04_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{-1.52,1.14,-1.18}}; + GVAR(hooks)[] = {{-1.52,1.14,-1.18}}; GVAR(fuelCargo) = 10000; }; @@ -509,39 +509,57 @@ class CfgVehicles { class Land_Pod_Heli_Transport_04_fuel_F: Pod_Heli_Transport_04_base_F { transportFuel = 0; //3k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{-1.49,1.41,-.3}}; + GVAR(hooks)[] = {{-1.49,1.41,-.3}}; GVAR(fuelCargo) = 10000; }; + class StorageBladder_base_F: NonStrategic { + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + position = "[-3.35,2.45,0.17]"; + distance = 4; + condition = "true"; + }; + }; + }; + class Land_StorageBladder_01_F: StorageBladder_base_F { + XEH_ENABLED; + MACRO_REFUEL_ACTIONS + transportFuel = 0; //60k + GVAR(hooks)[] = {{-3.35,2.45,0.17}}; + GVAR(fuelCargo) = 60000; + }; + // Vanilla buildings - class Land_Fuelstation_Feed_F : House_Small_F { + class Land_Fuelstation_Feed_F: House_Small_F { XEH_ENABLED; transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{0,0,-0.5}}; + GVAR(hooks)[] = {{0,0,-0.5}}; GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; }; - class Land_fs_feed_F : House_Small_F { + class Land_fs_feed_F: House_Small_F { XEH_ENABLED; transportFuel = 0; //50k MACRO_REFUEL_ACTIONS - GVAR(hooks[]) = {{-0.4,0.022,-.23}}; + GVAR(hooks)[] = {{-0.4,0.022,-.23}}; GVAR(fuelCargo) = REFUEL_INFINITE_FUEL; }; /* // Barrels found in config \ - BarrelHelper : Misc_thing 100 - BarrelBase : BarrelHelper 100 - Barrels : BarrelBase 400 - Barrel1 : BarrelBase 100 - Barrel2 : BarrelBase 100 - Barrel3 : BarrelBase 100 - Barrel4 : BarrelBase 100 - Barrel5 : BarrelBase 100 - Barrel6 : BarrelBase 100 - Wooden_barrel : BarrelBase 100 - Wooden_barrels : Wooden_barrel 400 + BarrelHelper: Misc_thing 100 + BarrelBase: BarrelHelper 100 + Barrels: BarrelBase 400 + Barrel1: BarrelBase 100 + Barrel2: BarrelBase 100 + Barrel3: BarrelBase 100 + Barrel4: BarrelBase 100 + Barrel5: BarrelBase 100 + Barrel6: BarrelBase 100 + Wooden_barrel: BarrelBase 100 + Wooden_barrels: Wooden_barrel 400 */ // Trucks diff --git a/addons/refuel/XEH_respawn.sqf b/addons/refuel/XEH_respawn.sqf index 39225f2521..87b8db3514 100644 --- a/addons/refuel/XEH_respawn.sqf +++ b/addons/refuel/XEH_respawn.sqf @@ -6,6 +6,6 @@ _unit = _this select 0; if !(local _unit) exitWith {}; -[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; _unit setVariable [QGVAR(isRefueling), false]; diff --git a/addons/refuel/data/nozzle.p3d b/addons/refuel/data/nozzle.p3d new file mode 100644 index 0000000000..1ce9583028 Binary files /dev/null and b/addons/refuel/data/nozzle.p3d differ diff --git a/addons/refuel/data/nozzle.rvmat b/addons/refuel/data/nozzle.rvmat new file mode 100644 index 0000000000..8386d34613 --- /dev/null +++ b/addons/refuel/data/nozzle.rvmat @@ -0,0 +1,73 @@ +ambient[] = {1,1,1,1}; +diffuse[] = {1,1,1,1}; +forcedDiffuse[] = {0,0,0,0}; +emmisive[] = {0,0,0,1}; +specular[] = {0.16,0.16,0.16,0}; +specularPower = 100; +PixelShaderID = "Super"; +VertexShaderID = "Super"; +class Stage1 { + texture = "z\ace\addons\refuel\data\nozzle_nohq.paa"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; +}; +class Stage2 { + texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; +}; +class Stage3 { + texture = "#(argb,8,8,3)color(0,0,0,0,MC)"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; +}; +class Stage4 { + texture = "z\ace\addons\refuel\data\nozzle_as.paa"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; +}; +class Stage5 { + texture = "z\ace\addons\refuel\data\nozzle_smdi.paa"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; +}; +class Stage6 { + texture = "#(ai,64,64,1)fresnel(1,0.7)"; + uvSource = "none"; +}; +class Stage7 { + texture = "a3\data_f\env_co.paa"; + useWorldEnvMap = "true"; + uvSource = "tex"; + class uvTransform { + aside[] = {1,0,0}; + up[] = {0,1,0}; + dir[] = {0,0,0}; + pos[] = {0,0,0}; + }; +}; diff --git a/addons/refuel/data/nozzle_as.paa b/addons/refuel/data/nozzle_as.paa new file mode 100644 index 0000000000..8fdf7e90c6 Binary files /dev/null and b/addons/refuel/data/nozzle_as.paa differ diff --git a/addons/refuel/data/nozzle_co.paa b/addons/refuel/data/nozzle_co.paa new file mode 100644 index 0000000000..3593767dc7 Binary files /dev/null and b/addons/refuel/data/nozzle_co.paa differ diff --git a/addons/refuel/data/nozzle_nohq.paa b/addons/refuel/data/nozzle_nohq.paa new file mode 100644 index 0000000000..8192abe3ed Binary files /dev/null and b/addons/refuel/data/nozzle_nohq.paa differ diff --git a/addons/refuel/data/nozzle_smdi.paa b/addons/refuel/data/nozzle_smdi.paa new file mode 100644 index 0000000000..82e8695557 Binary files /dev/null and b/addons/refuel/data/nozzle_smdi.paa differ diff --git a/addons/refuel/functions/fnc_canCheckFuel.sqf b/addons/refuel/functions/fnc_canCheckFuel.sqf index a1584ea333..e0046dea3d 100644 --- a/addons/refuel/functions/fnc_canCheckFuel.sqf +++ b/addons/refuel/functions/fnc_canCheckFuel.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; !(isNull _unit || {!(_unit isKindOf "CAManBase")} || diff --git a/addons/refuel/functions/fnc_canConnectNozzle.sqf b/addons/refuel/functions/fnc_canConnectNozzle.sqf index 812234818e..28ce8f5d12 100644 --- a/addons/refuel/functions/fnc_canConnectNozzle.sqf +++ b/addons/refuel/functions/fnc_canConnectNozzle.sqf @@ -16,10 +16,9 @@ */ #include "script_component.hpp" -private ["_nozzle"]; -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; -_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +private _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; !(isNull _nozzle || {(_target distance _unit) > REFUEL_ACTION_DISTANCE} || diff --git a/addons/refuel/functions/fnc_canDisconnect.sqf b/addons/refuel/functions/fnc_canDisconnect.sqf index 50d22702a0..8bb24a8df2 100644 --- a/addons/refuel/functions/fnc_canDisconnect.sqf +++ b/addons/refuel/functions/fnc_canDisconnect.sqf @@ -16,8 +16,7 @@ */ #include "script_component.hpp" -private ["_sink"]; -params ["_unit", "_nozzle"]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; if (isNull _unit || {isNull _nozzle} || @@ -25,5 +24,5 @@ if (isNull _unit || {!local _unit} || {(_nozzle distance _unit) > REFUEL_ACTION_DISTANCE}) exitWith {false}; -_sink = _nozzle getVariable [QGVAR(sink), objNull]; +private _sink = _nozzle getVariable [QGVAR(sink), objNull]; !((isNull _sink) || {_nozzle getVariable [QGVAR(isRefueling), false]}) diff --git a/addons/refuel/functions/fnc_canReturnNozzle.sqf b/addons/refuel/functions/fnc_canReturnNozzle.sqf index 139c921d34..4f3abe1d30 100644 --- a/addons/refuel/functions/fnc_canReturnNozzle.sqf +++ b/addons/refuel/functions/fnc_canReturnNozzle.sqf @@ -16,9 +16,8 @@ */ #include "script_component.hpp" -private ["_nozzle"]; -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; -_nozzle = _unit getVariable QGVAR(nozzle); +private _nozzle = _unit getVariable QGVAR(nozzle); (_this call FUNC(canConnectNozzle)) && {_target == (_nozzle getVariable [QGVAR(source), objNull])} diff --git a/addons/refuel/functions/fnc_canTakeNozzle.sqf b/addons/refuel/functions/fnc_canTakeNozzle.sqf index 85f5b815a5..0ed998993b 100644 --- a/addons/refuel/functions/fnc_canTakeNozzle.sqf +++ b/addons/refuel/functions/fnc_canTakeNozzle.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; if (isNull _unit || {!(_unit isKindOf "CAManBase")} || diff --git a/addons/refuel/functions/fnc_canTurnOff.sqf b/addons/refuel/functions/fnc_canTurnOff.sqf index 7d2d3652e0..e44e1fc669 100644 --- a/addons/refuel/functions/fnc_canTurnOff.sqf +++ b/addons/refuel/functions/fnc_canTurnOff.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_unit", "_nozzle"]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; if (isNull _unit || {isNull _nozzle} || diff --git a/addons/refuel/functions/fnc_canTurnOn.sqf b/addons/refuel/functions/fnc_canTurnOn.sqf index 3053e699a2..98173e0fa4 100644 --- a/addons/refuel/functions/fnc_canTurnOn.sqf +++ b/addons/refuel/functions/fnc_canTurnOn.sqf @@ -16,7 +16,7 @@ */ #include "script_component.hpp" -params ["_unit", "_nozzle"]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; if (isNull _unit || {isNull _nozzle} || diff --git a/addons/refuel/functions/fnc_checkFuel.sqf b/addons/refuel/functions/fnc_checkFuel.sqf index b50e9a8171..6ba7a4928e 100644 --- a/addons/refuel/functions/fnc_checkFuel.sqf +++ b/addons/refuel/functions/fnc_checkFuel.sqf @@ -15,17 +15,17 @@ * Public: No */ #include "script_component.hpp" -private ["_fuel"]; -params ["_unit", "_target"]; -_fuel = [_target] call FUNC(getFuel); +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; + +private _fuel = [_target] call FUNC(getFuel); [ 5, [_unit, _target, _fuel], { params ["_args"]; - _args params ["_unit", "_target", "_fuel"]; + _args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_fuel", 0, [0]]]; if (_fuel > 0 ) then { ["displayTextStructured", [_unit], [[LSTRING(Hint_RemainingFuel), _fuel], 2, _unit]] call EFUNC(common,targetEvent); } else { diff --git a/addons/refuel/functions/fnc_connectNozzle.sqf b/addons/refuel/functions/fnc_connectNozzle.sqf index f5d8d35759..d6b599b771 100644 --- a/addons/refuel/functions/fnc_connectNozzle.sqf +++ b/addons/refuel/functions/fnc_connectNozzle.sqf @@ -21,10 +21,9 @@ #define PLACE_CANCEL 0 #define PLACE_APPROVE 1 -private ["_nozzle", "_actionID"]; -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; -_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +private _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if (isNull _nozzle) exitWith {}; GVAR(placeAction) = PLACE_WAITING; @@ -32,19 +31,18 @@ GVAR(placeAction) = PLACE_WAITING; [{[localize LSTRING(Connect_Action), ""] call EFUNC(interaction,showMouseHint)}, []] call EFUNC(common,execNextFrame); _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; -_actionID = _unit addAction [format ["%1", localize LSTRING(Cancel)], {GVAR(placeAction) = PLACE_CANCEL;}]; +private _actionID = _unit addAction [format ["%1", localize LSTRING(Cancel)], {GVAR(placeAction) = PLACE_CANCEL;}]; [{ - private["_virtualPos", "_virtualPosASL", "_lineInterection"]; params ["_args","_pfID"]; - _args params ["_unit", "_target", "_nozzle", "_actionID"]; + _args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_actionID", -1, [0]]]; - _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]); + private _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]); if (cameraView == "EXTERNAL") then { _virtualPosASL = _virtualPosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0])); }; - _virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition); - _lineInterection = lineIntersects [eyePos ace_player, _virtualPosASL, ace_player]; + private _virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition); + private _lineInterection = lineIntersects [eyePos ace_player, _virtualPosASL, ace_player]; //Don't allow placing in a bad position: if (_lineInterection && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;}; diff --git a/addons/refuel/functions/fnc_connectNozzleAction.sqf b/addons/refuel/functions/fnc_connectNozzleAction.sqf index 42190aacc6..a4509ae4af 100644 --- a/addons/refuel/functions/fnc_connectNozzleAction.sqf +++ b/addons/refuel/functions/fnc_connectNozzleAction.sqf @@ -18,31 +18,31 @@ * Public: No */ #include "script_component.hpp" -private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_endASL", "_rate", "_maxFuel"]; +private ["_closeInDistance", "_endPosTestOffset"]; -params ["_unit", "_target", "_startingPosition", "_nozzle"]; -_startingOffset = _target worldToModel _startingPosition; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_startingPosition", [0,0,0], [[]], 3], ["_nozzle", objNull, [objNull]]]; +private _startingOffset = _target worldToModel _startingPosition; -_startDistanceFromCenter = vectorMagnitude _startingOffset; -_closeInUnitVector = vectorNormalized (_startingOffset vectorFromTo [0,0,0]); +private _startDistanceFromCenter = vectorMagnitude _startingOffset; +private _closeInUnitVector = vectorNormalized (_startingOffset vectorFromTo [0,0,0]); -_closeInMax = _startDistanceFromCenter; -_closeInMin = 0; +private _closeInMax = _startDistanceFromCenter; +private _closeInMin = 0; while {(_closeInMax - _closeInMin) > 0.01} do { _closeInDistance = (_closeInMax + _closeInMin) / 2; _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); _endPosTestOffset set [2, (_startingOffset select 2)]; - _endPosTest = _target modelToWorldVisual _endPosTestOffset; + private _endPosTest = _target modelToWorldVisual _endPosTestOffset; - _doesIntersect = false; + private _doesIntersect = false; { if (_doesIntersect) exitWith {}; - _startingPosShifted = _startingPosition vectorAdd _x; + private _startingPosShifted = _startingPosition vectorAdd _x; _startASL = if (surfaceIsWater _startingPosShifted) then {_startingPosShifted} else {ATLtoASL _startingPosShifted}; { _endPosShifted = _endPosTest vectorAdd _x; - _endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted}; + private _endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted}; //Uncomment to see the lazor show, and see how the scanning works: // drawLine3D [_startingPosShifted, _endPosShifted, [1,0,0,1]]; @@ -66,7 +66,7 @@ if (((_startDistanceFromCenter - _closeInDistance) < 0.1) || {!([_target, _unit, }; //Move it out slightly, for visibility sake (better to look a little funny than be embedded//sunk in the hull and be useless) -_closeInDistance = (_closeInDistance - 0.0085); +_closeInDistance = (_closeInDistance - 0.05); _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); _endPosTestOffset set [2, (_startingOffset select 2)]; @@ -75,14 +75,13 @@ _endPosTestOffset set [2, (_startingOffset select 2)]; 2, [_unit, _nozzle, _target, _endPosTestOffset], { - private "_actionID"; params ["_args"]; - _args params ["_unit", "_nozzle", "_target", "_endPosTestOffset"]; + _args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_target", objNull, [objNull]], ["_endPosTestOffset", [0,0,0], [[]], 3]]; _unit setVariable [QGVAR(nozzle), nil]; _unit setVariable [QGVAR(isRefueling), false]; - [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + [_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); REFUEL_UNHOLSTER_WEAPON - _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; if (_actionID != -1) then { _unit removeAction _actionID; _unit setVariable [QGVAR(ReleaseActionID), nil]; @@ -90,6 +89,37 @@ _endPosTestOffset set [2, (_startingOffset select 2)]; detach _nozzle; _nozzle attachTo [_target, _endPosTestOffset]; + _endPosTestOffset params ["_x", "_y"]; + private _bb = boundingBoxReal _target; + _bb params ["_ll", "_rr"]; + _ll set [2, 0]; + _rr set [2, 0]; + _ll params ["_x1", "_y1"]; + _rr params ["_x2", "_y2"]; + private _c1 = _ll vectorCos _endPosTestOffset; + private _c2 = _ll vectorCos [_x1, _y2, 0]; + private _cn = (_ll vectorCrossProduct [0, 0, 1]) vectorCos _endPosTestOffset; + private _dirAndUp = [[1, 0, 0],[0, 0, 1]]; + if (_c1 > _c2 && (_cn > 0)) then { + _dirAndUp = [[1, 0, 0.8],[0, 0, 1]]; + } else { + _c1 = [_x1, _y2, 0] vectorCos _endPosTestOffset; + _c2 = [_x1, _y2, 0] vectorCos _rr; + _cn = ([_x1, _y2, 0] vectorCrossProduct [0, 0, 1]) vectorCos _endPosTestOffset; + if (_c1 > _c2 && (_cn > 0)) then { + _dirAndUp = [[0, -1, 0.8],[0, 0, 1]]; + } else { + _c1 = _rr vectorCos _endPosTestOffset; + _c2 = _rr vectorCos [_x2, _y1, 0]; + _cn = (_rr vectorCrossProduct [0, 0, 1]) vectorCos _endPosTestOffset; + if (_c1 > _c2 && (_cn > 0)) then { + _dirAndUp = [[-1, 0, 0.8],[0, 0, 1]]; + } else { + _dirAndUp = [[0, 1, 0.8],[0, 0, 1]]; + }; + }; + }; + [[_nozzle, _dirAndUp], "{(_this select 0) setVectorDirAndUp (_this select 1)}", 2] call EFUNC(common,execRemoteFnc); _nozzle setVariable [QGVAR(sink), _target, true]; _nozzle setVariable [QGVAR(isConnected), true, true]; _target setVariable [QGVAR(nozzle), _nozzle, true]; diff --git a/addons/refuel/functions/fnc_disconnect.sqf b/addons/refuel/functions/fnc_disconnect.sqf index e007ddf05f..41fde6d365 100644 --- a/addons/refuel/functions/fnc_disconnect.sqf +++ b/addons/refuel/functions/fnc_disconnect.sqf @@ -16,10 +16,9 @@ */ #include "script_component.hpp" -private ["_sink"]; -params ["_unit", "_nozzle"]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; -_sink = _nozzle getVariable [QGVAR(sink), objNull]; +private _sink = _nozzle getVariable [QGVAR(sink), objNull]; if (isNull _sink) exitWith {}; _sink setVariable [QGVAR(nozzle), objNull, true]; diff --git a/addons/refuel/functions/fnc_dropNozzle.sqf b/addons/refuel/functions/fnc_dropNozzle.sqf index c44c20c059..575d318068 100644 --- a/addons/refuel/functions/fnc_dropNozzle.sqf +++ b/addons/refuel/functions/fnc_dropNozzle.sqf @@ -18,7 +18,7 @@ */ #include "script_component.hpp" -params ["_unit", "_nozzle", ["_disconnectOnly", false]]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_disconnectOnly", false, [false]]]; detach _nozzle; _nozzle setVariable [QGVAR(isRefueling), false, true]; diff --git a/addons/refuel/functions/fnc_getFuel.sqf b/addons/refuel/functions/fnc_getFuel.sqf index 9bbb4987be..47c9992788 100644 --- a/addons/refuel/functions/fnc_getFuel.sqf +++ b/addons/refuel/functions/fnc_getFuel.sqf @@ -15,10 +15,9 @@ */ #include "script_component.hpp" -private ["_fuel"]; -params ["_target"]; +params [["_target", objNull, [objNull]]]; -_fuel = _target getVariable QGVAR(currentFuelCargo); +private _fuel = _target getVariable QGVAR(currentFuelCargo); if (isNil "_fuel") then { _fuel = getNumber (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(fuelCargo)); diff --git a/addons/refuel/functions/fnc_handleKilled.sqf b/addons/refuel/functions/fnc_handleKilled.sqf index 897337c062..045bf47028 100644 --- a/addons/refuel/functions/fnc_handleKilled.sqf +++ b/addons/refuel/functions/fnc_handleKilled.sqf @@ -15,12 +15,12 @@ */ #include "script_component.hpp" -params ["_unit"]; +params [["_unit", objNull, [objNull]]]; if (!local _unit) exitWith {}; _unit setVariable [QGVAR(selectedWeaponOnRefuel), nil]; -_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +private _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if !(isNull _nozzle) then { [_unit, _nozzle] call FUNC(dropNozzle); }; diff --git a/addons/refuel/functions/fnc_handleUnconscious.sqf b/addons/refuel/functions/fnc_handleUnconscious.sqf index 6a6e561230..bfcdcb3776 100644 --- a/addons/refuel/functions/fnc_handleUnconscious.sqf +++ b/addons/refuel/functions/fnc_handleUnconscious.sqf @@ -16,14 +16,12 @@ */ #include "script_component.hpp" -params ["_unit", "_isUnconscious"]; +params [["_unit", objNull, [objNull]], ["_isUnconscious", false, [false]]]; if (!local _unit || {!_isUnconscious}) exitWith {}; -private "_nozzle"; - -[_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); -_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +[_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); +private _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; if !(isNull _nozzle) then { [_unit, _nozzle] call FUNC(dropNozzle); }; diff --git a/addons/refuel/functions/fnc_makeJerryCan.sqf b/addons/refuel/functions/fnc_makeJerryCan.sqf index 96bb058265..23bf5395a4 100644 --- a/addons/refuel/functions/fnc_makeJerryCan.sqf +++ b/addons/refuel/functions/fnc_makeJerryCan.sqf @@ -16,8 +16,7 @@ */ #include "script_component.hpp" -private ["_actions", "_action"]; -params ["_target", ["_fuelAmount", 20]]; +params [["_target", objNull, [objNull]], ["_fuelAmount", 20, [0]]]; if (isNull _target || {_target isKindOf "AllVehicles"} || @@ -28,7 +27,7 @@ _target setVariable [QGVAR(jerryCan), true, true]; _target setVariable [QGVAR(source), _target, true]; // Main Action -_action = [QGVAR(Refuel), +private _action = [QGVAR(Refuel), localize LSTRING(Refuel), QUOTE(PATHTOF(ui\icon_refuel_interact.paa)), {}, diff --git a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf index 6cdc78b9f7..4d8f89425e 100644 --- a/addons/refuel/functions/fnc_moduleRefuelSettings.sqf +++ b/addons/refuel/functions/fnc_moduleRefuelSettings.sqf @@ -15,7 +15,7 @@ #include "script_component.hpp" -params ["_logic", "_units", "_activated"]; +params ["_logic", "", ["_activated", false, [false]]]; if !(_activated) exitWith {}; diff --git a/addons/refuel/functions/fnc_readFuelCounter.sqf b/addons/refuel/functions/fnc_readFuelCounter.sqf index af95c044e3..ac7a84f97a 100644 --- a/addons/refuel/functions/fnc_readFuelCounter.sqf +++ b/addons/refuel/functions/fnc_readFuelCounter.sqf @@ -16,18 +16,17 @@ */ #include "script_component.hpp" -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; [ 2, [_unit, _target], { - private ["_currentFuel", "_fuelCounter"]; params ["_args"]; - _args params ["_unit", "_target"]; + _args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; - _currentFuel = [_target] call FUNC(getFuel); - _fuelCounter = 0.01 * round (100 * ((_target getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel)); + private _currentFuel = [_target] call FUNC(getFuel); + private _fuelCounter = 0.01 * round (100 * ((_target getVariable [QGVAR(fuelCounter), _currentFuel]) - _currentFuel)); [[LSTRING(Hint_FuelCounter), _fuelCounter], 1.5, _unit] call EFUNC(common,displayTextStructured); }, "", diff --git a/addons/refuel/functions/fnc_refuel.sqf b/addons/refuel/functions/fnc_refuel.sqf index 74697212b1..ed986f8025 100644 --- a/addons/refuel/functions/fnc_refuel.sqf +++ b/addons/refuel/functions/fnc_refuel.sqf @@ -6,7 +6,7 @@ * 0: Unit * 1: Target * 2: Nozzle - * 3: Connection Point + * 3: Connection Point * * Return Value: * None @@ -18,16 +18,18 @@ #define PFH_STEPSIZE 0.1 -private ["_rate", "_maxFuel"]; -params ["_unit", "_target", "_nozzle", "_connectToPoint"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_connectToPoint", [0,0,0], [[]], 3]]; -_rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate) * PFH_STEPSIZE; -_maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity)); +private _rate = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(flowRate)) * GVAR(rate) * PFH_STEPSIZE; +private _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(fuelCapacity)); [{ - private ["_source", "_tooFar", "_fuelInSource", "_fuelInSink", "_finished", "_fueling"]; params ["_args", "_pfID"]; - _args params ["_source", "_sink", "_unit", "_nozzle", "_rate", "_startFuel", "_maxFuel", "_connectFromPoint", "_connectToPoint"]; + _args params [["_source", objNull, [objNull]], ["_sink", objNull, [objNull]], ["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_rate", 1, [0]], ["_startFuel", 0, [0]], ["_maxFuel", 0, [0]], ["_connectFromPoint", [0,0,0], [[]], 3], ["_connectToPoint", [0,0,0], [[]], 3]]; + + if !(_nozzle getVariable [QGVAR(isConnected), false]) exitWith { + [_pfID] call CBA_fnc_removePerFrameHandler; + }; if (!alive _source || {!alive _sink}) exitWith { [objNull, _nozzle] call FUNC(dropNozzle); @@ -36,7 +38,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f _sink setVariable [QGVAR(nozzle), objNull, true]; [_pfID] call cba_fnc_removePerFrameHandler; }; - _tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > (REFUEL_HOSE_LENGTH - 2); + private _tooFar = ((_sink modelToWorld _connectToPoint) distance (_source modelToWorld _connectFromPoint)) > (REFUEL_HOSE_LENGTH - 2); if (_tooFar && {!(_nozzle getVariable [QGVAR(jerryCan), false])}) exitWith { [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); @@ -47,10 +49,10 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f [_pfID] call cba_fnc_removePerFrameHandler; }; - _finished = false; - _fueling = _nozzle getVariable [QGVAR(isRefueling), false]; + private _finished = false; + private _fueling = _nozzle getVariable [QGVAR(isRefueling), false]; if (_fueling) then { - _fuelInSource = [_source] call FUNC(getFuel); + private _fuelInSource = [_source] call FUNC(getFuel); if (_fuelInSource == 0) exitWith { [LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); _nozzle setVariable [QGVAR(isRefueling), false, true]; @@ -64,7 +66,7 @@ _maxFuel = getNumber (configFile >> "CfgVehicles" >> (typeOf _target) >> QGVAR(f [LSTRING(Hint_SourceEmpty), 2, _unit] call EFUNC(common,displayTextStructured); }; - _fuelInSink = (_unit getVariable [QGVAR(tempFuel), _startFuel]) + ( _rate / _maxFuel); + private _fuelInSink = (_unit getVariable [QGVAR(tempFuel), _startFuel]) + ( _rate / _maxFuel); if (_fuelInSink > 1) then { _fuelInSink = 1; _finished = true; diff --git a/addons/refuel/functions/fnc_reset.sqf b/addons/refuel/functions/fnc_reset.sqf index f235180b0e..dee28e4301 100644 --- a/addons/refuel/functions/fnc_reset.sqf +++ b/addons/refuel/functions/fnc_reset.sqf @@ -15,8 +15,7 @@ */ #include "script_component.hpp" -private ["_nozzle", "_nozzleTarget", "_rope"]; -params ["_target"]; +params [["_target", objNull, [objNull]]]; if (local _target) then { _target setHitPointDamage ["HitEngine", _target getVariable [QGVAR(engineHit), 0]]; @@ -26,14 +25,14 @@ if (local _target) then { _target setVariable [QGVAR(engineHit), nil, true]; _target setVariable [QGVAR(isConnected), false, true]; -_nozzle = _target getVariable [QGVAR(ownedNozzle), nil]; +private _nozzle = _target getVariable [QGVAR(ownedNozzle), nil]; if !(isNil "_nozzle") then { - _nozzleTarget = _nozzle getVariable [QGVAR(sink), nil]; + private _nozzleTarget = _nozzle getVariable [QGVAR(sink), nil]; if !(isNil "_nozzleTarget") then { _nozzleTarget setVariable [QGVAR(nozzle), nil, true]; }; - _rope = _nozzle getVariable [QGVAR(rope), nil]; + private _rope = _nozzle getVariable [QGVAR(rope), nil]; if !(isNil "_rope") then { ropeDestroy _rope; }; diff --git a/addons/refuel/functions/fnc_resetLocal.sqf b/addons/refuel/functions/fnc_resetLocal.sqf index a8b0c184cc..599ee61344 100644 --- a/addons/refuel/functions/fnc_resetLocal.sqf +++ b/addons/refuel/functions/fnc_resetLocal.sqf @@ -15,20 +15,19 @@ */ #include "script_component.hpp" -params ["_unit", "_nozzle"]; - +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; if (isNull _unit || {isNull _nozzle} || {!(_unit isKindOf "CAManBase")} || {!local _unit}) exitWith {}; -private ["_attachedNozzle", "_actionID"]; -_attachedNozzle = _unit getVariable [QGVAR(nozzle), nil]; + +private _attachedNozzle = _unit getVariable [QGVAR(nozzle), nil]; if (isNil "_attachedNozzle") exitWith {}; if (_nozzle != _attachedNozzle) exitWith {}; -_actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; +private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; if (_actionID != -1) then { _unit removeAction _actionID; _unit setVariable [QGVAR(isRefueling), false, true]; diff --git a/addons/refuel/functions/fnc_returnNozzle.sqf b/addons/refuel/functions/fnc_returnNozzle.sqf index d3fca33021..d56b7b731a 100644 --- a/addons/refuel/functions/fnc_returnNozzle.sqf +++ b/addons/refuel/functions/fnc_returnNozzle.sqf @@ -16,11 +16,10 @@ */ #include "script_component.hpp" -private ["_nozzle", "_dummy", "_actionID"]; -params ["_unit", "_target"]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]]]; -_nozzle = _unit getVariable [QGVAR(nozzle), objNull]; -_source = _nozzle getVariable QGVAR(source); +private _nozzle = _unit getVariable [QGVAR(nozzle), objNull]; +private _source = _nozzle getVariable QGVAR(source); if (isNull _nozzle || {_source != _target}) exitWith {false}; @@ -28,15 +27,14 @@ if (isNull _nozzle || {_source != _target}) exitWith {false}; 2, [_unit, _nozzle, _target], { - private "_actionID"; params ["_args"]; - _args params ["_unit", "_nozzle", "_target"]; + _args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]], ["_target", objNull, [objNull]]]; _unit setVariable [QGVAR(nozzle), nil]; detach _nozzle; - [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + [_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); REFUEL_UNHOLSTER_WEAPON _unit setVariable [QGVAR(isRefueling), false]; - _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; if (_actionID != -1) then { _unit removeAction _actionID; _unit setVariable [QGVAR(ReleaseActionID), nil]; diff --git a/addons/refuel/functions/fnc_setFuel.sqf b/addons/refuel/functions/fnc_setFuel.sqf index a182d463ae..b5276454fa 100644 --- a/addons/refuel/functions/fnc_setFuel.sqf +++ b/addons/refuel/functions/fnc_setFuel.sqf @@ -15,8 +15,8 @@ * Public: No */ #include "script_component.hpp" -private ["_maxFuel"]; -params ["_target", "_fuel"]; + +params [["_target", objNull, [objNull]], ["_fuel", nil, [0]]]; if (isNull _target || {isNil "_fuel"}) exitWith {}; diff --git a/addons/refuel/functions/fnc_takeNozzle.sqf b/addons/refuel/functions/fnc_takeNozzle.sqf index 3c52748efc..96ac5249bb 100644 --- a/addons/refuel/functions/fnc_takeNozzle.sqf +++ b/addons/refuel/functions/fnc_takeNozzle.sqf @@ -18,14 +18,13 @@ */ #include "script_component.hpp" -private ["_endPosOffset"], -params ["_unit", "_target", ["_nozzle", objNull]]; +params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; -[_unit, QGVAR(vehAttach), true] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_refuel", true] call EFUNC(common,statusEffect_set); REFUEL_HOLSTER_WEAPON -_endPosOffset = [0, 0, 0]; +private _endPosOffset = [0, 0, 0]; if (isNull _nozzle) then { // func is called on fuel truck _target setVariable [QGVAR(engineHit), _target getHitPointDamage "HitEngine", true]; if !(local _target) then { @@ -35,7 +34,7 @@ if (isNull _nozzle) then { // func is called on fuel truck }; _target setVariable [QGVAR(isConnected), true, true]; - _endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> "ace_refuel_hooks"); + _endPosOffset = getArray (configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(hooks)); if (count _endPosOffset == 2) then { if (_unit distance (_target modelToWorld (_endPosOffset select 0)) < _unit distance (_target modelToWorld (_endPosOffset select 1))) then { _endPosOffset = _endPosOffset select 0; @@ -49,28 +48,27 @@ if (isNull _nozzle) then { // func is called on fuel truck 2, [_unit, _target, _endPosOffset], { - private ["_newNozzle", "_rope", "_actionID"]; params ["_args"]; - _args params ["_unit", "_target", "_endPosOffset"]; + _args params [["_unit", objNull, [objNull]], ["_target", objNull, [objNull]], ["_endPosOffset", [0,0,0], [[]], 3]]; - _newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit; - _newNozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model + private _newNozzle = "ACE_refuel_fuelNozzle" createVehicle position _unit; + _newNozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"]; _unit setVariable [QGVAR(nozzle), _newNozzle]; - _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, 0, 0], REFUEL_HOSE_LENGTH]; + private _rope = ropeCreate [_target, _endPosOffset, _newNozzle, [0, -0.20, 0.12], REFUEL_HOSE_LENGTH]; _newNozzle setVariable [QGVAR(attachPos), _endPosOffset, true]; _newNozzle setVariable [QGVAR(source), _target, true]; _newNozzle setVariable [QGVAR(rope), _rope, true]; _target setVariable [QGVAR(ownedNozzle), _newNozzle, true]; _unit setVariable [QGVAR(isRefueling), true]; - _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; if (_actionID != -1) then { _unit removeAction _actionID; }; _actionID = _unit addAction [ format ["%1", localize ELSTRING(dragging,Drop)], - '_unit = _this select 0; _nozzle = _unit getVariable QGVAR(nozzle); [_unit, _nozzle] call FUNC(dropNozzle); [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); REFUEL_UNHOLSTER_WEAPON', + '_unit = _this select 0; _nozzle = _unit getVariable QGVAR(nozzle); [_unit, _nozzle] call FUNC(dropNozzle); [_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); REFUEL_UNHOLSTER_WEAPON', nil, 20, false, @@ -90,24 +88,23 @@ if (isNull _nozzle) then { // func is called on fuel truck 2, [_unit, _nozzle], { - private ["_actionID"]; params ["_args"]; - _args params ["_unit", "_nozzle"]; + _args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; if (_nozzle getVariable [QGVAR(jerryCan), false]) then { _nozzle attachTo [_unit, [0,1,0], "pelvis"]; } else { - _nozzle attachTo [_unit, [-0.02,-0.05,0], "righthandmiddle1"]; // TODO replace with right coordinates for real model + _nozzle attachTo [_unit, [-0.02,0.05,-0.12], "righthandmiddle1"]; }; _unit setVariable [QGVAR(nozzle), _nozzle]; _unit setVariable [QGVAR(isRefueling), true]; - _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; + private _actionID = _unit getVariable [QGVAR(ReleaseActionID), -1]; if (_actionID != -1) then { _unit removeAction _actionID; }; _actionID = _unit addAction [ format ["%1", localize ELSTRING(dragging,Drop)], - '_unit = _this select 0; _nozzle = _unit getVariable QGVAR(nozzle); [_unit, _nozzle] call FUNC(dropNozzle); [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); REFUEL_UNHOLSTER_WEAPON', + '_unit = _this select 0; _nozzle = _unit getVariable QGVAR(nozzle); [_unit, _nozzle] call FUNC(dropNozzle); [_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); REFUEL_UNHOLSTER_WEAPON', nil, 20, false, @@ -138,7 +135,7 @@ if !(_nozzle getVariable [QGVAR(jerryCan), false]) then { [_unit, _nozzle] call FUNC(dropNozzle); REFUEL_UNHOLSTER_WEAPON - [_unit, QGVAR(vehAttach), false] call EFUNC(common,setForceWalkStatus); + [_unit, "forceWalk", "ACE_refuel", false] call EFUNC(common,statusEffect_set); [LSTRING(Hint_TooFar), 2, _unit] call EFUNC(common,displayTextStructured); }; [_pfID] call cba_fnc_removePerFrameHandler; diff --git a/addons/refuel/functions/fnc_turnOff.sqf b/addons/refuel/functions/fnc_turnOff.sqf index 115c1eabe2..4b82e19486 100644 --- a/addons/refuel/functions/fnc_turnOff.sqf +++ b/addons/refuel/functions/fnc_turnOff.sqf @@ -16,14 +16,14 @@ */ #include "script_component.hpp" -params ["_unit", "_nozzle"]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; [ 2, [_unit, _nozzle], { params ["_args"]; - _args params ["_unit", "_nozzle"]; + _args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; _nozzle setVariable [QGVAR(isRefueling), false, true]; [LSTRING(Hint_Stopped), 1.5, _unit] call EFUNC(common,displayTextStructured); }, diff --git a/addons/refuel/functions/fnc_turnOn.sqf b/addons/refuel/functions/fnc_turnOn.sqf index 017a8ee021..b18d1b57ca 100644 --- a/addons/refuel/functions/fnc_turnOn.sqf +++ b/addons/refuel/functions/fnc_turnOn.sqf @@ -16,15 +16,14 @@ */ #include "script_component.hpp" -params ["_unit", "_nozzle"]; +params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; [ 2, [_unit, _nozzle], { - private "_source"; params ["_args"]; - _args params ["_unit", "_nozzle"]; + _args params [["_unit", objNull, [objNull]], ["_nozzle", objNull, [objNull]]]; _nozzle setVariable [QGVAR(isRefueling), true, true]; [LSTRING(Hint_Started), 1.5, _unit] call EFUNC(common,displayTextStructured); }, diff --git a/addons/refuel/script_component.hpp b/addons/refuel/script_component.hpp index e8c7514651..0c24c3915b 100644 --- a/addons/refuel/script_component.hpp +++ b/addons/refuel/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT refuel #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_REFUEL #define DEBUG_MODE_FULL #endif diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index b0fb6ec0c6..f9fc52267f 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -7,6 +7,7 @@ Ustawienia tankowania Настройки дозаправки Ajustes de reabastecimento + Nastavení tankování Flow Rate @@ -14,6 +15,7 @@ Szybkość przepływu Скорость заправки Velocidade da vazão + Rychlost tankování How fast should a vehicle be refueled? @@ -21,6 +23,7 @@ Jak szybko pojazd powinien zostać zatankowany? Как быстро техника должна быть заправлена? Quão rápido deve ser o veículo reabastecido? + Jak rychle bude vozidlo natankováno? Refuel @@ -28,6 +31,7 @@ Zatankuj Дозаправка Reabastecimento + Natankovat Take fuel nozzle @@ -35,6 +39,7 @@ Weź nalewak Взять топливный шланг Pegar o bocal de combustível + Vzít výdejní pistoli Taking fuel nozzle ... @@ -42,6 +47,7 @@ Pobieranie nalewaka ... Берем топливный шланг ... Pegando o bocal de combustível... + Beru výdejní pistoli ... Connect fuel nozzle @@ -49,6 +55,7 @@ Podłącz nalewak Присоединить топливный шланг Conectar o bocal de combustível + Připojit výdejní pistoli Connecting fuel nozzle ... @@ -56,6 +63,7 @@ Podłączanie nalewaka ... Присоединяем топливный шланг ... Conectando o bocal de combustível... + Připojuji výdejní pistoli ... Disconnect fuel nozzle @@ -63,6 +71,7 @@ Odepnij nalewak Отсоединить топливный шланг Desconectar o bocal de combustível + Odpojit výdejní pistoli Connect @@ -70,6 +79,7 @@ Podłącz Присоединить Conectar + Připojit Check remaining fuel @@ -77,6 +87,7 @@ Sprawdź ilość paliwa Проверить остаток топлива Verificar combustível restante + Zkontrolovat zůstatek paliva Checking remaining fuel ... @@ -84,6 +95,7 @@ Sprawdzanie ilości paliwa ... Проверяем остаток топлива ... Verificando combustível restante... + Kontroluji zůstatek paliva ... There are %1 liters left. @@ -91,6 +103,7 @@ Zostało %1 litrów. Осталось %1 л. Há %1 litros restantes. + Zbývá ještě %1 litrů. There is no fuel left. @@ -98,6 +111,7 @@ W zbiorniku nie ma paliwa. Топлива нет. Não há combustível + Bez paliva. Cancel @@ -105,6 +119,7 @@ Anuluj Отменить Cancelar + Zrušit Failed @@ -112,6 +127,7 @@ Porażka Не удалось Falhou + Neúspěšný Stop fueling @@ -119,6 +135,7 @@ Zatrzymaj tankowanie Остановить заправку Parar reabastecimento + Zastavit tankování Stopping fueling ... @@ -126,6 +143,7 @@ Zatrzymywanie tankowania ... Останавливаем заправку ... Parando reabastecimento... + Zastavuji tankování ... Start fueling @@ -133,6 +151,7 @@ Rozpocznij tankowanie Начать заправку Começar reabastecimento + Začít tankovat Starting fueling ... @@ -140,6 +159,7 @@ Rozpoczynanie tankowania ... Начинаем заправку ... Começando reabastecimento... + Spouštím tankování ... %1 Liters fueled @@ -147,6 +167,7 @@ Zatankowano %1 litrów %1 литров заправлено %1 litros abastecidos + %1 litrů natankováno The fuel source is empty. @@ -154,6 +175,7 @@ Źródło paliwa jest puste. Источник топлива пустой. A fonte de combustível está vazia. + Zdroj paliva je prázdný. Maximum fuel hose length reached. @@ -161,6 +183,7 @@ Osiągnięto maksymalną długość przewodu paliwowego. Достигнута максимальная длина шланга. Distância máxima da mangueira de combustível alcançada. + Dosažena maximální délka hadice Fueling completed @@ -168,6 +191,7 @@ Tankowanie ukończone Заправка завершена Reabastecimento completo + Tankování dokončeno Fueling stopped @@ -175,6 +199,7 @@ Tankowanie zatrzymane Заправка остановлена Reabastecimento parado + Tankování zastaveno Fueling started @@ -182,6 +207,7 @@ Tankowanie rozpoczęte Заправка начата Reabastecimento iniciado + Tankování zahájeno Return fuel nozzle @@ -189,6 +215,7 @@ Zwróć nalewak Вернуть топливный шланг Retornar bocal de combustível + Vrátit výdejní pistoli Returning fuel nozzle ... @@ -196,6 +223,7 @@ Zwracanie nalewaka ... Возвращаем топливный шланг ... Retornando bocal de combustível... + Vracím výdejní pistoli ... Check fuel counter @@ -203,6 +231,7 @@ Sprawdź wskaźnik paliwa Проверить счетчик топлива Verificar contador de combustível + Zkonrolovat palivoměr Checking fuel counter ... @@ -210,6 +239,7 @@ Sprawdzanie wskaźnika paliwa ... Проверяем счетчик топлива ... Verificando contador de combustível... + Konroluji palivoměr ... %1 liters have been fueled. @@ -217,6 +247,7 @@ %1 litrów zostało zatankowane. Было заправлено %1 л. %1 litros foram abastecidos. + %1 litrů bylo natankováno. \ No newline at end of file diff --git a/addons/reload/script_component.hpp b/addons/reload/script_component.hpp index 8a1c097ab0..09993faaa4 100644 --- a/addons/reload/script_component.hpp +++ b/addons/reload/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT reload #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_RELOAD #define DEBUG_MODE_FULL #endif diff --git a/addons/reloadlaunchers/script_component.hpp b/addons/reloadlaunchers/script_component.hpp index bc6b7f6e6c..fc78723f2a 100644 --- a/addons/reloadlaunchers/script_component.hpp +++ b/addons/reloadlaunchers/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT reloadlaunchers #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_RELOADLAUNCHERS #define DEBUG_MODE_FULL #endif diff --git a/addons/repair/functions/fnc_getClaimObjects.sqf b/addons/repair/functions/fnc_getClaimObjects.sqf index bc15975d1c..c2311a467f 100644 --- a/addons/repair/functions/fnc_getClaimObjects.sqf +++ b/addons/repair/functions/fnc_getClaimObjects.sqf @@ -4,7 +4,7 @@ * * Arguments: * 0: Unit that does the repairing - * 1: Max range to seach from unit (meters) + * 1: Max range to seach from unit (meters) * 2: Array of arrays of classnames * * Return Value: diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp index ff5d40a6ae..adae522925 100644 --- a/addons/repair/script_component.hpp +++ b/addons/repair/script_component.hpp @@ -2,6 +2,9 @@ #include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_REPAIR #define DEBUG_MODE_FULL diff --git a/addons/repair/stringtable.xml b/addons/repair/stringtable.xml index 64fecd5de8..b79f25bd65 100644 --- a/addons/repair/stringtable.xml +++ b/addons/repair/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -684,6 +684,7 @@ ERA + ERA Repair Settings @@ -1136,4 +1137,4 @@ Položka vyžaduje odstraněná/vyměněná kola - + \ No newline at end of file diff --git a/addons/respawn/script_component.hpp b/addons/respawn/script_component.hpp index 0ecb27b1d4..ee681d1d98 100644 --- a/addons/respawn/script_component.hpp +++ b/addons/respawn/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT respawn #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_RESPAWN #define DEBUG_MODE_FULL #endif diff --git a/addons/safemode/script_component.hpp b/addons/safemode/script_component.hpp index 04f10ed105..8afc534fa2 100644 --- a/addons/safemode/script_component.hpp +++ b/addons/safemode/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT safemode #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SAFEMODE #define DEBUG_MODE_FULL #endif diff --git a/addons/safemode/stringtable.xml b/addons/safemode/stringtable.xml index 80097580cd..9717ba4dae 100644 --- a/addons/safemode/stringtable.xml +++ b/addons/safemode/stringtable.xml @@ -30,7 +30,7 @@ Waffe gesichert Seguro puesto Zabezpieczono broń - Přepnout pojistku + Zbraň zajistěna Biztonsági kapcsoló helyretolása Поставить на предохранитель Sécurité mise @@ -42,7 +42,7 @@ Waffe entsichert Seguro quitado Odbezpieczono broń - Odstranit pojistku + Zbraň odjištěna Biztonságos mód megszüntetve Снят с предохранителя Sécurité enlevée diff --git a/addons/sandbag/CfgVehicles.hpp b/addons/sandbag/CfgVehicles.hpp index 71276b91d7..494ff355e7 100644 --- a/addons/sandbag/CfgVehicles.hpp +++ b/addons/sandbag/CfgVehicles.hpp @@ -46,10 +46,11 @@ class CfgVehicles { class ACE_SandbagObject: ThingX { author = ECSTRING(common,ACETeam); XEH_ENABLED; - scope = 1; + scope = 2; side = -1; model = PATHTOF(data\ace_sandbag_build.p3d); displayName = CSTRING(sandbag_displayName); + vehicleClass = "ACE_Logistics_Items"; typicalCargo[] = {}; armor = 12000; // Withstand 200 5.56 bullets before sandbag hull is cheese mapSize = 0.4; diff --git a/addons/sandbag/functions/fnc_deploy.sqf b/addons/sandbag/functions/fnc_deploy.sqf index de5bd9458e..1a539929ff 100644 --- a/addons/sandbag/functions/fnc_deploy.sqf +++ b/addons/sandbag/functions/fnc_deploy.sqf @@ -18,7 +18,7 @@ params ["_unit"]; // prevent the placing unit from running -[_unit, "ACE_Sandbag", true] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Sandbag", true] call EFUNC(common,statusEffect_set); // create the sandbag private "_sandBag"; diff --git a/addons/sandbag/functions/fnc_deployCancel.sqf b/addons/sandbag/functions/fnc_deployCancel.sqf index 9186ddbf57..bb9d691fa9 100644 --- a/addons/sandbag/functions/fnc_deployCancel.sqf +++ b/addons/sandbag/functions/fnc_deployCancel.sqf @@ -18,7 +18,7 @@ params ["_unit"]; // enable running again -[_unit, "ACE_Sandbag", false] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Sandbag", false] call EFUNC(common,statusEffect_set); // delete placement dummy deleteVehicle GVAR(sandBag); diff --git a/addons/sandbag/functions/fnc_deployConfirm.sqf b/addons/sandbag/functions/fnc_deployConfirm.sqf index 62848dd0cd..8c789fd124 100644 --- a/addons/sandbag/functions/fnc_deployConfirm.sqf +++ b/addons/sandbag/functions/fnc_deployConfirm.sqf @@ -18,7 +18,7 @@ params ["_unit"]; // enable running again -[_unit, "ACE_Sandbag", false] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Sandbag", false] call EFUNC(common,statusEffect_set); // remove sandbag from inventory _unit removeItem "ACE_Sandbag_empty"; diff --git a/addons/sandbag/script_component.hpp b/addons/sandbag/script_component.hpp index 8737beef07..422e1b203e 100644 --- a/addons/sandbag/script_component.hpp +++ b/addons/sandbag/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT sandbag #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SANDBAG #define DEBUG_MODE_FULL #endif diff --git a/addons/scopes/functions/fnc_adjustScope.sqf b/addons/scopes/functions/fnc_adjustScope.sqf index 42e0f17818..50ee1a4f71 100644 --- a/addons/scopes/functions/fnc_adjustScope.sqf +++ b/addons/scopes/functions/fnc_adjustScope.sqf @@ -44,7 +44,8 @@ _maxVertical = getArray (_opticConfig >> "ACE_ScopeAdjust_Vertical"); _maxHorizontal = getArray (_opticConfig >> "ACE_ScopeAdjust_Horizontal"); if ((count _maxHorizontal < 2) || (count _maxVertical < 2)) exitWith {false}; -if ((_verticalIncrement == 0) && (_horizontalIncrement == 0)) exitWith {false}; +if ((_verticalIncrement == 0) && (_turretAndDirection in [ELEVATION_UP, ELEVATION_DOWN])) exitWith {false}; +if ((_horizontalIncrement == 0) && (_turretAndDirection in [WINDAGE_UP, WINDAGE_DOWN])) exitWith {false}; _zeroing = _adjustment select _weaponIndex; _zeroing params ["_elevation", "_windage", "_zero"]; diff --git a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf index fbd3e1b636..7fdb671859 100644 --- a/addons/scopes/functions/fnc_applyScopeAdjustment.sqf +++ b/addons/scopes/functions/fnc_applyScopeAdjustment.sqf @@ -32,6 +32,7 @@ if (isNil "_adjustment") then { }; _adjustmentDifference = (_adjustment select _weaponIndex) vectorDiff [_elevation, _windage, _zero]; +if (_adjustmentDifference isEqualTo [0,0,0]) exitWith {false}; // Don't coninue if no adjustment is made _adjustment set [_weaponIndex, [_elevation, _windage, _zero]]; [_unit, QGVAR(Adjustment), _adjustment, 0.5] call EFUNC(common,setVariablePublic); diff --git a/addons/scopes/script_component.hpp b/addons/scopes/script_component.hpp index 5cdb74207d..0266705af2 100644 --- a/addons/scopes/script_component.hpp +++ b/addons/scopes/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT scopes #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #define ELEVATION_UP 0 #define ELEVATION_DOWN 1 #define WINDAGE_LEFT 2 diff --git a/addons/scopes/stringtable.xml b/addons/scopes/stringtable.xml index 226df258bd..81ae11dc3a 100644 --- a/addons/scopes/stringtable.xml +++ b/addons/scopes/stringtable.xml @@ -11,7 +11,7 @@ Kleine Korrektur nach oben Enyhe állítás fel Pequeno ajuste para cima - Korekce mírně nahoru + Korekce nahoru (mírně) Minor adjustment down @@ -23,7 +23,7 @@ Kleine Korrektur nach unten Enyhe állítás le Pequeno ajuste para baixo - Korekce mírně dolů + Korekce dolů (mírně) Minor adjustment right @@ -35,7 +35,7 @@ Kleine Korrektur nach rechts Enyhe állítás jobbra Pequeno ajuste para direita - Korekce mírně doprava + Korekce doprava (mírně) Minor adjustment left @@ -47,7 +47,7 @@ Kleine Korrektur nach links Enyhe állítás balra Pequeno ajuste para esquerda - Korekce mírně doleva + Korekce doleva (mírně) Major adjustment up @@ -110,4 +110,4 @@ Vynulovat korekci - + \ No newline at end of file diff --git a/addons/sitting/script_component.hpp b/addons/sitting/script_component.hpp index cbc8800cd2..40afbe8450 100644 --- a/addons/sitting/script_component.hpp +++ b/addons/sitting/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT sitting #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SITTING #define DEBUG_MODE_FULL #endif diff --git a/addons/slideshow/script_component.hpp b/addons/slideshow/script_component.hpp index 3acd23c0ee..cf4272325d 100644 --- a/addons/slideshow/script_component.hpp +++ b/addons/slideshow/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT slideshow #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SLIDESHOW #define DEBUG_MODE_FULL #endif diff --git a/addons/slideshow/stringtable.xml b/addons/slideshow/stringtable.xml index 599802c3c9..4b184cf2e3 100644 --- a/addons/slideshow/stringtable.xml +++ b/addons/slideshow/stringtable.xml @@ -21,6 +21,7 @@ Este módulo permite que você monte apresentações de slides em diferentes objetos. Um módulo por lista de imagem. Somente objetos com hiddenSelection 0 são suportados. Этот модуль позволяет вам устроить слайд-шоу на различных объектах. Один модуль на один список изображений. Поддерживаются только объекты с hiddenSelection 0. Este módulo permite configurar una presentación de diapositivas en diferentes objetos. Un módulo por lista de imágenes. Sólo son soportados objetos con hiddenSelection 0. + Tento modul umožňuje nastavit prezentaci na různé objekty. Jeden modul na seznam s obrázky. Podporované jsou pouze objekty s hiddenSelection 0. Objects @@ -42,6 +43,7 @@ Nomes dos objetos (também podem ser objetos sincronizados) em que a apresentação de slides será mostrada, separado por vírgulas se for mais de um. Referência INFO para suporte do objeto. Имена объектов (так же могут использоваться синхронизированные объекты), на которых будет отображаться слайд-шоу, разделенные запятыми. Посмотрите описание, чтобы понять, какие объекты поддерживаются. Los nombres de objetos (también pueden ser objetos sincronizados) de diapositivas se mostrarán en, separados por comas. Referencia INFO para el soporte del objeto. + Jména objektů (lze také použít synchronizované objekty) které se budou zobrazovat v prezentaci, oddělit čárkou pokud jich je více. Zkontrolujte POPIS abyste zjistili, zda je objekt podporován modulem. Controllers @@ -52,6 +54,7 @@ Controles Контроллеры Controladores + Kontrolor Controller object names, separated by commas if multiple. @@ -83,6 +86,7 @@ Lista das imagens que serão utilizadas na apresentação de slides, separadas por vírgula, com o caminho completo corretamente formatado (ex: imagens\imagem.paa). Список изображений, которые будут использованы для слайд-шоу, разделенные запятыми, с полными путями в правильном формате (например, images\image.paa). Lista de imágenes que se utilizarán para la presentación de diapositivas, separadas por comas, con la ruta completa en formato correcto (ej. imágenes\image.paa). + Seznam obrázků které budou použity v prezentaci, oddělené čárkami, s kompletní cestou ve správném formátu (např. image\image.paa). Interaction Names @@ -91,7 +95,7 @@ Interakciós nevek Nomes de Interação Интерактивные имена - Názvy Interakcí + Názvy interakcí Nombres de interacción @@ -121,6 +125,7 @@ Duração de cada slide. Padrão: 0 (Transição automática desabilitada) Длительность каждого слайда. По-умолчанию: 0 (автоматический переход отключен) Duración de cada diapositiva. Por defecto: 0 (Transiciones automáticas desactivadas) + Doba trvání každého snímku. Výchozí: 0 (Automatické posouvání je zakázáno) Slides diff --git a/addons/smallarms/script_component.hpp b/addons/smallarms/script_component.hpp index 589e59433f..63d516cee5 100644 --- a/addons/smallarms/script_component.hpp +++ b/addons/smallarms/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT smallarms #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SMALLARMS #define DEBUG_MODE_FULL #endif diff --git a/addons/spectator/functions/fnc_stageSpectator.sqf b/addons/spectator/functions/fnc_stageSpectator.sqf index 87b2faffa8..926ac008dc 100644 --- a/addons/spectator/functions/fnc_stageSpectator.sqf +++ b/addons/spectator/functions/fnc_stageSpectator.sqf @@ -66,3 +66,13 @@ if !(_set isEqualTo (GETVAR(_unit,GVAR(isStaged),false))) then { ["spectatorStaged",[_set]] call EFUNC(common,localEvent); }; + +//BandAid for #2677 - if player in unitList weird before being staged, weird things can happen +if ((player in GVAR(unitList)) || {ACE_player in GVAR(unitList)}) then { + [] call FUNC(updateUnits); //update list now + if (!(isNull (findDisplay 12249))) then {//If display is open now, close it and restart + ACE_LOGWARNING("Player in unitList, call ace_spectator_fnc_stageSpectator before ace_spectator_fnc_setSpectator"); + ["fixWeirdList", true] call FUNC(interrupt); + [{["fixWeirdList", false] call FUNC(interrupt);}, []] call EFUNC(common,execNextFrame); + }; +}; diff --git a/addons/spectator/script_component.hpp b/addons/spectator/script_component.hpp index de2ee22363..575765a01d 100644 --- a/addons/spectator/script_component.hpp +++ b/addons/spectator/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT spectator #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SPECTATOR #define DEBUG_MODE_FULL #endif diff --git a/addons/spectator/stringtable.xml b/addons/spectator/stringtable.xml index bca0e36c59..25822e630a 100644 --- a/addons/spectator/stringtable.xml +++ b/addons/spectator/stringtable.xml @@ -150,7 +150,7 @@ Tylko wewnętrzna Somente interna Только внутренняя - Pouze vnitřní + Pouze pohled z první osoby Solo interna @@ -158,7 +158,7 @@ Tylko zewnętrzna Somente externa Только внешняя - Pouze vnější + Pouze pohled z třetí osoby Solo externa @@ -166,7 +166,7 @@ Wewnętrzna i zewnętrzna Interna e externa Внутренняя и внешняя - Vnitřní a vnější + Pohled z první a třetí osoby Interna y externa @@ -175,6 +175,7 @@ Modos de visão Режимы видения Modos de visión + Módy zobrazení Vision modes that can be used. @@ -182,6 +183,7 @@ Modos de visão que podem ser utilizados Режимы видения, которые могут быть использованы Modos de visión que pueden ser utilizados. + Módy zobrazení které mohou být použity. Night vision @@ -214,7 +216,7 @@ Controle do espectador Управление спектатором Controles de espectador - Ovládací prvky pozorovatele + Ovládání pozorovatele Free @@ -229,7 +231,7 @@ Wewnętrzna Interna Внутренняя - Vnitřní + Pohled z první osoby Interna @@ -237,7 +239,7 @@ Zewnętrzna Externa Внешняя - Vnější + Pohled z třetí osoby Externa @@ -278,7 +280,7 @@ Kamera naprzód Câmera para frente Камера вперед - Kamera Vpřed + Vpřed (Kamera) Cámara delantera @@ -286,7 +288,7 @@ Kamera w tył Câmera para trás Камера назад - Kamera Zpět + Zpět (Kamera) Cámara trasera @@ -294,7 +296,7 @@ Kamera w lewo Câmera para esquerda Камера влево - Kamera Doleva + Doleva (Kamera) Cámara izquierda @@ -302,7 +304,7 @@ Kamera w prawo Câmera para direita Камера вправо - Kamera Doprava + Doprava (Kamera) Cámara derecha @@ -310,7 +312,7 @@ Kamera w górę Câmera para cima Камера вверх - Kamera Nahoru + Nahoru (Kamera) Cámara arriba @@ -318,7 +320,7 @@ Kamera w dół Câmera para baixo Камера вниз - Kamera Dolů + Dolů (Kamera) Cámara abajo @@ -327,6 +329,7 @@ Câmera panorâmica Панорамирование Cámara panorámica + Otáčet kameru Dolly Camera @@ -334,6 +337,7 @@ Câmera dolly Рельсовая камера Cámara dolly + Posouvat kameru Lock Camera to Target @@ -364,7 +368,7 @@ Przełącz interfejs Alternar interface Переключить интерфейс - Přepnout rozhraní + Zobrazit/skrýt rozhraní Conmutar @@ -372,7 +376,7 @@ Przełącz ikony jednostek Alternar ícone de unidades Вкл./выкл. иконки юнитов - Přepnout ikony jednotek + Zobrazit/skrýt ikony jednotek Conmutar iconos de unidad @@ -380,7 +384,7 @@ Przełącz listę jednostek Alternar lista de unidades Вкл./выкл. список юнитов - Přepnout seznam jednotek + Zobrazit/skrýt seznam jednotek Conmutar lista de unidades @@ -389,14 +393,14 @@ Alternar barra de ferramentas Вкл./выкл. тулбар Conmutar barra de herramientas - Přepnout panel nátrojů + Zobrazit/skrýt spodní panel Toggle Compass Przełącz kompas Alternar bússola Вкл./выкл. компас - Přepnout kompas + Zobrazit/skrýt kompas Conmutar brújula @@ -404,7 +408,7 @@ Przełącz mapę Alternar mapa Вкл./выкл. карту - Přepnout mapu + Zobrazit/skrýt mapu Conmutar map @@ -412,7 +416,7 @@ Przełącz pomoc Alternar ajuda Вкл./выкл. помощь - Přepnout nápovědu + Zobrazit/skrýt ovládání Conmutar ayuda @@ -421,6 +425,7 @@ Atributos de câmera Атрибуты камеры Atributos de cámara + Atributy kamery Next Camera @@ -460,6 +465,7 @@ Próximo modo de visão Следующий режим видения Siguiente modo de visión + Následující mód zobrazení Previous Vision Mode @@ -467,6 +473,7 @@ Modo de visão anterior Предыдущий режим видения Anterior modo de visión + Předchozí mód zobrazení Adjust Zoom @@ -490,6 +497,7 @@ Incrementar zoom Увеличить зум Incrementar aumento + Regulovat přiblížení (pomalu) Increment Speed @@ -497,6 +505,7 @@ Incrementar velocidade Увеличить скорость Incrementar velocidad + Regulovat rychlost (pomalu) Reset Zoom @@ -515,4 +524,4 @@ Reiniciar velocidad - + \ No newline at end of file diff --git a/addons/spottingscope/script_component.hpp b/addons/spottingscope/script_component.hpp index 11bd94a6e5..48f14b7398 100644 --- a/addons/spottingscope/script_component.hpp +++ b/addons/spottingscope/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT spottingscope #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SPOTTINGSCOPE #define DEBUG_MODE_FULL #endif diff --git a/addons/spottingscope/stringtable.xml b/addons/spottingscope/stringtable.xml index e20f0635ea..3a0b89b857 100644 --- a/addons/spottingscope/stringtable.xml +++ b/addons/spottingscope/stringtable.xml @@ -8,7 +8,7 @@ Teleskop Telescopio Téléscope de visée - Zaměřovací Dalekohled + Zaměřovací dalekohled Spotting Scope Megfigyelő távcső Luneta de observador @@ -20,7 +20,7 @@ Zabierz teleskop Coger telescopio Prendre téléscope de visée - Zvednout Zaměřovací dalekohled + Zvednout zaměřovací dalekohled Raccogli spottingscope Mefgigy. távcső felvétele Pegar luneta de observador @@ -32,7 +32,7 @@ Ustaw teleskop Colocar telescopio Placer téléscope de visée - Položit Zaměřovací dalekohled + Položit zaměřovací dalekohled Posiziona spottingscope Megfigy. távcső elhelyezése Colocar luneta de observador diff --git a/addons/switchunits/CfgVehicles.hpp b/addons/switchunits/CfgVehicles.hpp index 7951a6cd59..f0549cb00e 100644 --- a/addons/switchunits/CfgVehicles.hpp +++ b/addons/switchunits/CfgVehicles.hpp @@ -1,53 +1,53 @@ class CfgVehicles { - class ACE_Module; - class ACE_ModuleSwitchUnits: ACE_Module { - author = ECSTRING(common,ACETeam); - category = "ACE"; - displayName = CSTRING(Module_DisplayName); - function = FUNC(module); - scope = 2; - isGlobal = 1; - icon = QUOTE(PATHTOF(UI\Icon_Module_SwitchUnits_ca.paa)); - class Arguments { - class SwitchToWest { - displayName = CSTRING(SwitchToWest_DisplayName); - description = CSTRING(SwitchToWest_Description); - typeName = "BOOL"; - defaultValue = 0; - }; - class SwitchToEast { - displayName = CSTRING(SwitchToEast_DisplayName); - description = CSTRING(SwitchToEast_Description); - typeName = "BOOL"; - defaultValue = 0; - }; - class SwitchToIndependent { - displayName = CSTRING(SwitchToIndependent_DisplayName); - description = CSTRING(SwitchToIndependent_Description); - typeName = "BOOL"; - defaultValue = 0; - }; - class SwitchToCivilian { - displayName = CSTRING(SwitchToCivilian_DisplayName); - description = CSTRING(SwitchToCivilian_Description); - typeName = "BOOL"; - defaultValue = 0; - }; - class EnableSafeZone { - displayName = CSTRING(EnableSafeZone_DisplayName); - description = CSTRING(EnableSafeZone_Description); - typeName = "BOOL"; - defaultValue = 1; - }; - class SafeZoneRadius { - displayName = CSTRING(SafeZoneRadius_DisplayName); - description = CSTRING(SafeZoneRadius_Description); - typeName = "NUMBER"; - defaultValue = 100; - }; + class ACE_Module; + class ACE_ModuleSwitchUnits: ACE_Module { + author = ECSTRING(common,ACETeam); + category = "ACE"; + displayName = CSTRING(Module_DisplayName); + function = FUNC(module); + scope = 2; + isGlobal = 1; + icon = QUOTE(PATHTOF(UI\Icon_Module_SwitchUnits_ca.paa)); + class Arguments { + class SwitchToWest { + displayName = CSTRING(SwitchToWest_DisplayName); + description = CSTRING(SwitchToWest_Description); + typeName = "BOOL"; + defaultValue = 0; + }; + class SwitchToEast { + displayName = CSTRING(SwitchToEast_DisplayName); + description = CSTRING(SwitchToEast_Description); + typeName = "BOOL"; + defaultValue = 0; + }; + class SwitchToIndependent { + displayName = CSTRING(SwitchToIndependent_DisplayName); + description = CSTRING(SwitchToIndependent_Description); + typeName = "BOOL"; + defaultValue = 0; + }; + class SwitchToCivilian { + displayName = CSTRING(SwitchToCivilian_DisplayName); + description = CSTRING(SwitchToCivilian_Description); + typeName = "BOOL"; + defaultValue = 0; + }; + class EnableSafeZone { + displayName = CSTRING(EnableSafeZone_DisplayName); + description = CSTRING(EnableSafeZone_Description); + typeName = "BOOL"; + defaultValue = 1; + }; + class SafeZoneRadius { + displayName = CSTRING(SafeZoneRadius_DisplayName); + description = CSTRING(SafeZoneRadius_Description); + typeName = "NUMBER"; + defaultValue = 100; + }; + }; + class ModuleDescription { + description = CSTRING(Module_Description); + }; }; - class ModuleDescription { - description = CSTRING(Module_Description); - }; - }; }; diff --git a/addons/switchunits/config.cpp b/addons/switchunits/config.cpp index 3b1d11f460..22a4924709 100644 --- a/addons/switchunits/config.cpp +++ b/addons/switchunits/config.cpp @@ -1,15 +1,15 @@ #include "script_component.hpp" class CfgPatches { - class ADDON { - units[] = {}; - weapons[] = {}; - requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"ace_common"}; - author[] = {"bux578"}; - authorUrl = "https://github.com/bux578/"; - VERSION_CONFIG; - }; + class ADDON { + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_common"}; + author[] = {"bux578"}; + authorUrl = "https://github.com/bux578/"; + VERSION_CONFIG; + }; }; #include "CfgEventHandlers.hpp" diff --git a/addons/switchunits/functions/fnc_handleMapClick.sqf b/addons/switchunits/functions/fnc_handleMapClick.sqf index 03a94f81af..b0984631d7 100644 --- a/addons/switchunits/functions/fnc_handleMapClick.sqf +++ b/addons/switchunits/functions/fnc_handleMapClick.sqf @@ -18,12 +18,10 @@ */ #include "script_component.hpp" -private ["_sideNearest"]; - params ["_faction", "_pos"]; _faction params ["", "_sides"]; -_sideNearest = []; +private _sideNearest = []; { if ([_x] call FUNC(isValidAi) && (side group _x in _sides)) then { diff --git a/addons/switchunits/functions/fnc_initPlayer.sqf b/addons/switchunits/functions/fnc_initPlayer.sqf index 80388a9d2b..7b0c8f2603 100644 --- a/addons/switchunits/functions/fnc_initPlayer.sqf +++ b/addons/switchunits/functions/fnc_initPlayer.sqf @@ -21,7 +21,7 @@ params ["_playerUnit", "_sides"]; if (vehicle _playerUnit == _playerUnit) then { [_sides] call FUNC(markAiOnMap); - _playerUnit setVariable [QGVAR(IsPlayerUnit), true]; + _playerUnit setVariable [QGVAR(IsPlayerUnit), true, true]; _playerUnit allowDamage false; GVAR(OriginalUnit) = _playerUnit; @@ -39,7 +39,7 @@ if (vehicle _playerUnit == _playerUnit) then { _playerUnit linkItem "ItemMap"; removeUniform _playerUnit; - [_playerUnit, "ACE_SwitchUnits", true] call EFUNC(common,setForceWalkStatus); + [_playerUnit, "forceWalk", "ACE_SwitchUnits", true] call EFUNC(common,statusEffect_set); [_playerUnit, _sides] call FUNC(addMapFunction); }; diff --git a/addons/switchunits/functions/fnc_markAiOnMap.sqf b/addons/switchunits/functions/fnc_markAiOnMap.sqf index db43c58f43..d29e75b6a4 100644 --- a/addons/switchunits/functions/fnc_markAiOnMap.sqf +++ b/addons/switchunits/functions/fnc_markAiOnMap.sqf @@ -37,18 +37,17 @@ GVAR(AllMarkerNames) = []; // create markers { if (([_x] call FUNC(isValidAi) && (side group _x in _sides)) || (_x getVariable [QGVAR(IsPlayerControlled), false])) then { - private ["_markerName", "_marker", "_markerColor"]; + + private _markerName = str _x; - _markerName = str _x; - - _marker = createMarkerLocal [_markerName, position _x]; + private _marker = createMarkerLocal [_markerName, position _x]; _markerName setMarkerTypeLocal "mil_triangle"; _markerName setMarkerShapeLocal "ICON"; _markerName setMarkerSizeLocal [0.5, 0.7]; _markerName setMarkerDirLocal getDir _x; // commy's one liner magic - _markerColor = format ["Color%1", side group _x]; + private _markerColor = format ["Color%1", side group _x]; if ((_x getVariable [QGVAR(IsPlayerControlled), false])) then { _markerName setMarkerColorLocal "ColorOrange"; diff --git a/addons/switchunits/functions/fnc_module.sqf b/addons/switchunits/functions/fnc_module.sqf index 3b8cea4037..9da63a9510 100644 --- a/addons/switchunits/functions/fnc_module.sqf +++ b/addons/switchunits/functions/fnc_module.sqf @@ -35,4 +35,4 @@ GVAR(Module) = true; [QGVAR(EnableSwitchUnits), true, false, true] call EFUNC(common,setSetting); -ACE_LOGINFO("Switch Unit Module Initialized."); +ACE_LOGINFO("SwitchUnits Module Initialized."); diff --git a/addons/switchunits/functions/fnc_nearestPlayers.sqf b/addons/switchunits/functions/fnc_nearestPlayers.sqf index 64e347d7da..f20d5fcf02 100644 --- a/addons/switchunits/functions/fnc_nearestPlayers.sqf +++ b/addons/switchunits/functions/fnc_nearestPlayers.sqf @@ -16,11 +16,9 @@ */ #include "script_component.hpp" -private ["_nearestPlayers"]; - params ["_position", "_radius"]; -_nearestPlayers = []; +private _nearestPlayers = []; { if ([_x] call EFUNC(common,isPlayer) && {alive _x}) then { diff --git a/addons/switchunits/functions/fnc_startSwitchUnits.sqf b/addons/switchunits/functions/fnc_startSwitchUnits.sqf index 481b04d2cd..8d4707f040 100644 --- a/addons/switchunits/functions/fnc_startSwitchUnits.sqf +++ b/addons/switchunits/functions/fnc_startSwitchUnits.sqf @@ -19,8 +19,7 @@ params ["_player"]; if (GVAR(EnableSwitchUnits)) then { - private "_sides"; - _sides = []; + private _sides = []; if(GVAR(SwitchToWest)) then {_sides pushBack west;}; if(GVAR(SwitchToEast)) then {_sides pushBack east;}; diff --git a/addons/switchunits/functions/fnc_switchBack.sqf b/addons/switchunits/functions/fnc_switchBack.sqf index 5aab2c9aee..4c3d05ae54 100644 --- a/addons/switchunits/functions/fnc_switchBack.sqf +++ b/addons/switchunits/functions/fnc_switchBack.sqf @@ -26,11 +26,11 @@ params ["_originalPlayerUnit"]; if (local _originalPlayerUnit) exitWith { selectPlayer _originalPlayerUnit; - deleteVehicle _currentUnit; - private "_layer"; - _layer = "BIS_fnc_respawnCounter" call bis_fnc_rscLayer; - _layer cuttext ["","plain"]; + // deleteVehicle _currentUnit; + + // private _layer = "BIS_fnc_respawnCounter" call bis_fnc_rscLayer; + // _layer cuttext ["","plain"]; [_pfhId] call CBA_fnc_removePerFrameHandler; }; diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index 49c3e97e42..903207652c 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -15,19 +15,17 @@ */ #include "script_component.hpp" -private ["_nearestEnemyPlayers", "_allNearestPlayers", "_oldUnit", "_leave"]; - params ["_unit"]; // don't switch to original player units if (!([_unit] call FUNC(isValidAi))) exitWith {}; // exit var -_leave = false; +private _leave = false; if (GVAR(EnableSafeZone)) then { - _allNearestPlayers = [position _unit, GVAR(SafeZoneRadius)] call FUNC(nearestPlayers); - _nearestEnemyPlayers = [_allNearestPlayers, {((side GVAR(OriginalGroup)) getFriend (side _this) < 0.6) && !(_this getVariable [QGVAR(IsPlayerControlled), false])}] call EFUNC(common,filter); + private _allNearestPlayers = [position _unit, GVAR(SafeZoneRadius)] call FUNC(nearestPlayers); + private _nearestEnemyPlayers = [_allNearestPlayers, {((side GVAR(OriginalGroup)) getFriend (side _this) < 0.6) && !(_this getVariable [QGVAR(IsPlayerControlled), false])}] call EFUNC(common,filter); if (count _nearestEnemyPlayers > 0) exitWith { _leave = true; @@ -42,20 +40,28 @@ if (_leave) exitWith { // should switch locality // This doesn't work anymore, because one's now able to switch to units from a different side //[_unit] joinSilent group player; -[[_unit, player], QUOTE({(_this select 0) setVariable [ARR_3(QUOTE(QGVAR(OriginalOwner)), owner (_this select 0), true)]; (_this select 0) setOwner owner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); +[ + [_unit, player], + QUOTE({ + (_this select 0) setVariable [ARR_3(QUOTE(QGVAR(OriginalOwner)), owner (_this select 0), true)]; + (_this select 0) setOwner owner (_this select 1) + }), + 1 +] call EFUNC(common,execRemoteFnc); [{ - private ["_respawnEhId", "_oldOwner"]; params ["_args", "_pfhId"]; _args params ["_unit", "_oldUnit"]; + [localize LSTRING(TryingToSwitch)] call EFUNC(common,displayTextStructured); + if (local _unit) exitWith { _oldUnit setVariable [QGVAR(IsPlayerControlled), false, true]; _oldUnit setVariable [QGVAR(PlayerControlledName), "", true]; - _respawnEhId = _unit getVariable [QGVAR(RespawnEhId), -1]; - if (_respawnEhId != -1) then { - _oldUnit removeEventHandler ["Respawn", _respawnEhId]; + private _killedEhId = _unit getVariable [QGVAR(KilledEhId), -1]; + if (_killedEhId != -1) then { + _oldUnit removeEventHandler ["Killed", _killedEhId]; }; selectPlayer _unit; @@ -63,15 +69,22 @@ if (_leave) exitWith { _unit setVariable [QGVAR(IsPlayerControlled), true, true]; _unit setVariable [QGVAR(PlayerControlledName), GVAR(OriginalName), true]; - _respawnEhId = _unit addEventHandler ["Respawn", { + + _killedEhId = _unit addEventHandler ["Killed", { [GVAR(OriginalUnit), _this select 0] call FUNC(switchBack); }]; - _unit setVariable [QGVAR(RespawnEhId), _respawnEhId, true]; + _unit setVariable [QGVAR(KilledEhId), _killedEhId, true]; + // set owner back to original owner - _oldOwner = _oldUnit getVariable[QGVAR(OriginalOwner), -1]; + private _oldOwner = _oldUnit getVariable[QGVAR(OriginalOwner), -1]; if (_oldOwner > -1) then { - [[_oldUnit, _oldOwner], QUOTE({(_this select 0) setOwner (_this select 1)}), 1] call EFUNC(common,execRemoteFnc); + [ + [_oldUnit, _oldOwner], + QUOTE({ + (_this select 0) setOwner (_this select 1) + }), 1 + ] call EFUNC(common,execRemoteFnc); }; [localize LSTRING(SwitchedUnit)] call EFUNC(common,displayTextStructured); diff --git a/addons/switchunits/functions/script_component.hpp b/addons/switchunits/functions/script_component.hpp index df5c7a0d96..d03116f2f8 100644 --- a/addons/switchunits/functions/script_component.hpp +++ b/addons/switchunits/functions/script_component.hpp @@ -1 +1 @@ -#include "\z\ace\addons\switchunits\script_component.hpp" \ No newline at end of file +#include "\z\ace\addons\switchunits\script_component.hpp" diff --git a/addons/switchunits/script_component.hpp b/addons/switchunits/script_component.hpp index 5955e1220f..938d34d9a8 100644 --- a/addons/switchunits/script_component.hpp +++ b/addons/switchunits/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT switchunits #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_SWITCHUNITS #define DEBUG_MODE_FULL #endif diff --git a/addons/switchunits/stringtable.xml b/addons/switchunits/stringtable.xml index d38175b1da..8403c5c726 100644 --- a/addons/switchunits/stringtable.xml +++ b/addons/switchunits/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -13,6 +13,11 @@ Cambia unità Trocado de unidade + + Trying to switch + Versuche zu Wechseln + Snažím se přehodit + This unit is too close to the enemy. Diese Einheit ist zu nah am Feind. @@ -177,4 +182,4 @@ Ce module permet le changement de faction des joueurs - + \ No newline at end of file diff --git a/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf b/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf index c134df31d1..940b2b612a 100644 --- a/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf +++ b/addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf @@ -21,7 +21,7 @@ params ["_unit", "_ladder"]; // enable running again -[_unit, "ACE_Ladder", false] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Ladder", false] call EFUNC(common,statusEffect_set); detach _ladder; diff --git a/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf b/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf index 0094e460dc..9d5783b327 100644 --- a/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf +++ b/addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf @@ -19,7 +19,7 @@ params ["_unit", "_ladder"]; // enable running again -[_unit, "ACE_Ladder", false] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Ladder", false] call EFUNC(common,statusEffect_set); private ["_pos1", "_pos2"]; diff --git a/addons/tacticalladder/functions/fnc_positionTL.sqf b/addons/tacticalladder/functions/fnc_positionTL.sqf index 1e7f0db209..629159db75 100644 --- a/addons/tacticalladder/functions/fnc_positionTL.sqf +++ b/addons/tacticalladder/functions/fnc_positionTL.sqf @@ -21,7 +21,7 @@ params ["_unit", "_ladder"]; // prevent the placing unit from running -[_unit, "ACE_Ladder", true] call EFUNC(common,setForceWalkStatus); +[_unit, "forceWalk", "ACE_Ladder", true] call EFUNC(common,statusEffect_set); { _ladder animate [_x, 0]; diff --git a/addons/tacticalladder/script_component.hpp b/addons/tacticalladder/script_component.hpp index 9905216ae7..1341795f37 100644 --- a/addons/tacticalladder/script_component.hpp +++ b/addons/tacticalladder/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT tacticalladder #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_TACTICALLADDER #define DEBUG_MODE_FULL #endif diff --git a/addons/testmissions/script_component.hpp b/addons/testmissions/script_component.hpp index d1674fb35c..718356494d 100644 --- a/addons/testmissions/script_component.hpp +++ b/addons/testmissions/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT testmissions #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_TESTMISSIONS #define DEBUG_MODE_FULL #endif diff --git a/addons/thermals/script_component.hpp b/addons/thermals/script_component.hpp index 97d7630b50..bd829f035e 100644 --- a/addons/thermals/script_component.hpp +++ b/addons/thermals/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT thermals #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_THERMALS #define DEBUG_MODE_FULL #endif diff --git a/addons/trenches/$PBOPREFIX$ b/addons/trenches/$PBOPREFIX$ new file mode 100644 index 0000000000..dab2e4cdda --- /dev/null +++ b/addons/trenches/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\trenches \ No newline at end of file diff --git a/addons/trenches/CfgEventHandlers.hpp b/addons/trenches/CfgEventHandlers.hpp new file mode 100644 index 0000000000..dca07992b9 --- /dev/null +++ b/addons/trenches/CfgEventHandlers.hpp @@ -0,0 +1,20 @@ + +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_preInit)); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_FILE(XEH_postInit)); + }; +}; + +class Extended_Killed_EventHandlers { + class CAManBase { + class ADDON { + killed = QUOTE(_this call FUNC(handleKilled)); + }; + }; +}; diff --git a/addons/trenches/CfgVehicles.hpp b/addons/trenches/CfgVehicles.hpp new file mode 100644 index 0000000000..81880a4265 --- /dev/null +++ b/addons/trenches/CfgVehicles.hpp @@ -0,0 +1,64 @@ +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(digEnvelopeSmall) { + displayName = CSTRING(DigEnvelopeSmall); + condition = QUOTE([ARR_2(_this select 0,'ace_trenches_trenchSmall')] call FUNC(canDigTrench)); + //wait a frame to handle "Do When releasing action menu key" option + statement = QUOTE([ARR_2({_this call FUNC(placeTrench)},[ARR_2(_this select 0,'ace_trenches_trenchSmall')])] call EFUNC(common,execNextFrame)); + exceptions[] = {}; + showDisabled = 0; + priority = 4; + //icon = PATHTOF(UI\icon_sandbag_ca.paa); + }; + class GVAR(digEnvelopeBig) { + displayName = CSTRING(DigEnvelopeBig); + condition = QUOTE([ARR_2(_this select 0,'ace_trenches_trenchBig')] call FUNC(canDigTrench)); + //wait a frame to handle "Do When releasing action menu key" option + statement = QUOTE([ARR_2({_this call FUNC(placeTrench)},[ARR_2(_this select 0,'ace_trenches_trenchBig')])] call EFUNC(common,execNextFrame)); + exceptions[] = {}; + showDisabled = 0; + priority = 4; + //icon = PATHTOF(UI\icon_sandbag_ca.paa); + }; + }; + }; + }; + + class BagFence_base_F; + class ACE_envelope_small: BagFence_base_F { + author = ECSTRING(common,ACETeam); + displayName = CSTRING(EnvelopeSmallName); + descriptionShort = CSTRING(EnevlopeSmallDescription); + model = QUOTE(PATHTOEF(apl,ace_envelope_small4.p3d)); + scope = 2; + }; + class ACE_envelope_big: BagFence_base_F { + author = ECSTRING(common,ACETeam); + displayName = CSTRING(EnvelopeBigName); + descriptionShort = CSTRING(EnevlopeBigDescription); + model = QUOTE(PATHTOEF(apl,ace_envelope_big4.p3d)); + scope = 2; + }; + + + class ACE_envelope_small_NoGeo: ACE_envelope_small { + scope = 1; + //@todo: replace by a no geo model + model = QUOTE(PATHTOEF(apl,ace_envelope_small4_nogeo.p3d)); + }; + class ACE_envelope_big_NoGeo: ACE_envelope_big { + scope = 1; + //@todo: replace by a no geo model + model = QUOTE(PATHTOEF(apl,ace_envelope_big4_nogeo.p3d)); + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_EntrenchingTool,50); + }; + }; +}; diff --git a/addons/trenches/CfgWeapons.hpp b/addons/trenches/CfgWeapons.hpp new file mode 100644 index 0000000000..5b20e9e4c1 --- /dev/null +++ b/addons/trenches/CfgWeapons.hpp @@ -0,0 +1,16 @@ +class CfgWeapons { + class InventoryItem_Base_F; + class ACE_ItemCore; + + class ACE_EntrenchingTool: ACE_ItemCore { + author = ECSTRING(common,ACETeam); + displayName = CSTRING(EntrenchingToolName); + descriptionShort = CSTRING(EntrenchingToolDescription); + model = QUOTE(PATHTOEF(apl,ace_entrchtool.p3d)); + picture = QUOTE(PATHTOF(ui\w_entrchtool_ca.paa)); + scope = 2; + class ItemInfo: InventoryItem_Base_F { + mass = 10; + }; + }; +}; diff --git a/addons/trenches/README.md b/addons/trenches/README.md new file mode 100644 index 0000000000..7ebfbe238b --- /dev/null +++ b/addons/trenches/README.md @@ -0,0 +1,12 @@ +ace_trenches +================= + +Adds item 'ACE_entrenchingtool' +Adds 2 trenches; Envelope - Small & Envelop - Big + + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Grey](https://github.com/Grey-Soldierman) diff --git a/addons/trenches/UI/w_entrchtool_ca.paa b/addons/trenches/UI/w_entrchtool_ca.paa new file mode 100644 index 0000000000..dceb288dc0 Binary files /dev/null and b/addons/trenches/UI/w_entrchtool_ca.paa differ diff --git a/addons/trenches/XEH_postInit.sqf b/addons/trenches/XEH_postInit.sqf new file mode 100644 index 0000000000..d0e8775f05 --- /dev/null +++ b/addons/trenches/XEH_postInit.sqf @@ -0,0 +1,28 @@ +#include "script_component.hpp" + +if (isServer) then { + // Cancel dig on hard disconnection. Function is identical to killed + addMissionEventHandler ["HandleDisconnect", {_this call FUNC(handleKilled)}]; +}; + +if (!hasInterface) exitWith {}; + +GVAR(trenchId) = 0; +GVAR(trench) = objNull; +GVAR(digPFH) = -1; +GVAR(digDirection) = 0; + +[{_this call FUNC(handleScrollWheel)}] call EFUNC(common,addScrollWheelEventHandler); + +// Cancel dig sandbag if interact menu opened +["interactMenuOpened", {[ACE_player] call FUNC(handleInteractMenuOpened)}] call EFUNC(common,addEventHandler); + +// Cancel dig on player change. This does work when returning to lobby, but not when hard disconnecting. +["playerChanged", {_this call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); +["playerInventoryChanged", {_this call FUNC(handlePlayerInventoryChanged)}] call EFUNC(common,addEventhandler); +["playerVehicleChanged", {[ACE_player, objNull] call FUNC(handlePlayerChanged)}] call EFUNC(common,addEventhandler); + +// handle waking up dragged unit and falling unconscious while dragging +["medical_onUnconscious", {_this call FUNC(handleUnconscious)}] call EFUNC(common,addEventhandler); + +//@todo Captivity? diff --git a/addons/trenches/XEH_preInit.sqf b/addons/trenches/XEH_preInit.sqf new file mode 100644 index 0000000000..55dc19e9b1 --- /dev/null +++ b/addons/trenches/XEH_preInit.sqf @@ -0,0 +1,22 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(canDigTrench); +PREP(handleInteractMenuOpened); +PREP(handleKilled); +PREP(handlePlayerChanged); +PREP(handlePlayerInventoryChanged); +PREP(handleScrollWheel); +PREP(handleUnconscious); +PREP(placeCancel); +PREP(placeConfirm); +PREP(placeTrench); + +// Trench types +// Name of the object, name of th dummy no geo object, dx, dy +GVAR(trenchSmall) = ["ACE_envelope_small", "ACE_envelope_small_NoGeo", 2, 3, 0.35]; +GVAR(trenchBig) = ["ACE_envelope_big", "ACE_envelope_big_NoGeo", 6, 1.1, 0.20]; +GVAR(trenchType) = GVAR(trenchSmall); + +ADDON = true; diff --git a/addons/trenches/config.cpp b/addons/trenches/config.cpp new file mode 100644 index 0000000000..e2f2b5b4fe --- /dev/null +++ b/addons/trenches/config.cpp @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {"ACE_envelope_small","ACE_envelope_big"}; + weapons[] = {"ACE_EntrenchingTool"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"Grey", "esteldunedain"}; + authorUrl = ""; + VERSION_CONFIG; + }; +}; +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/trenches/functions/fnc_canDigTrench.sqf b/addons/trenches/functions/fnc_canDigTrench.sqf new file mode 100644 index 0000000000..9dc5e29017 --- /dev/null +++ b/addons/trenches/functions/fnc_canDigTrench.sqf @@ -0,0 +1,34 @@ +/* + * Author: Ruthberg, commy2, esteldunedain + * Checks if a unit can dig a trench + * + * Arguments: + * 0: Unit + * 1: Trench type + * + * Return Value: + * Can dig + * + * Example: + * [ACE_player] call ace_trenches_fnc_canDigTrench + * + * Public: No + */ +#include "script_component.hpp" + +#define SURFACE_BLACKLIST ["water", "concrete", "tarmac", "wood", "metal", "roof_tin", "roof_tiles", "wood_int", "concrete_int", "tiles_int", "metal_int", "stony", "rock", "int_concrete", "int_tiles", "int_wood", "tiling", "wavymetal", "int_metal"] + +params ["_unit","_trenchTypeName"]; + +if !("ACE_EntrenchingTool" in items _unit) exitWith {false}; + +// Can't dig trench if above ground level +if ((getPosATL _unit) select 2 > 0.05) exitWith {false}; + +private ["_surfaceClass", "_surfaceType"]; + +_surfaceClass = (surfaceType getPosASL _unit) select [1]; +_surfaceType = getText (configFile >> "CfgSurfaces" >> _surfaceClass >> "soundEnviron"); +TRACE_1("",_surfaceType); + +!(_surfaceType in SURFACE_BLACKLIST) diff --git a/addons/trenches/functions/fnc_handleInteractMenuOpened.sqf b/addons/trenches/functions/fnc_handleInteractMenuOpened.sqf new file mode 100644 index 0000000000..91d6b0140b --- /dev/null +++ b/addons/trenches/functions/fnc_handleInteractMenuOpened.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle opening of interaction menu. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(isPlacing), false]) then { + [_unit] call FUNC(placeCancel); +}; diff --git a/addons/trenches/functions/fnc_handleKilled.sqf b/addons/trenches/functions/fnc_handleKilled.sqf new file mode 100644 index 0000000000..e9f0353cb1 --- /dev/null +++ b/addons/trenches/functions/fnc_handleKilled.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle death. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(isPlacing), false]) then { + [_unit] call FUNC(placeCancel); +}; diff --git a/addons/trenches/functions/fnc_handlePlayerChanged.sqf b/addons/trenches/functions/fnc_handlePlayerChanged.sqf new file mode 100644 index 0000000000..684ccc22ce --- /dev/null +++ b/addons/trenches/functions/fnc_handlePlayerChanged.sqf @@ -0,0 +1,24 @@ +/* + * Author: commy2 + * Handle player changes. + * + * Arguments: + * 0: New Player Unit + * 1: Old Player Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_newPlayer", "_oldPlayer"]; + +if (_newPlayer getVariable [QGVAR(isPlacing), false]) then { + [_newPlayer] call FUNC(placeCancel); +}; + +if (_oldPlayer getVariable [QGVAR(isPlacing), false]) then { + [_oldPlayer] call FUNC(placeCancel); +}; diff --git a/addons/trenches/functions/fnc_handlePlayerInventoryChanged.sqf b/addons/trenches/functions/fnc_handlePlayerInventoryChanged.sqf new file mode 100644 index 0000000000..cbae02d07a --- /dev/null +++ b/addons/trenches/functions/fnc_handlePlayerInventoryChanged.sqf @@ -0,0 +1,22 @@ +/* + * Author: commy2 + * Handle the InventoryChanged event. + * + * Arguments: + * 0: Unit + * 1: Weapon + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(isPlacing), false]) then { + if !("ACE_EntrenchingTool" in items _unit) then { + [_unit] call FUNC(placeCancel); + }; +}; diff --git a/addons/trenches/functions/fnc_handleScrollWheel.sqf b/addons/trenches/functions/fnc_handleScrollWheel.sqf new file mode 100644 index 0000000000..783463dd25 --- /dev/null +++ b/addons/trenches/functions/fnc_handleScrollWheel.sqf @@ -0,0 +1,24 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg + * Handles sandbag rotation + * + * Arguments: + * 0: scroll amount + * + * Return Value: + * handled + * + * Example: + * [1.2] call ace_sandbag_fnc_handleScrollWheel + * + * Public: No + */ +#include "script_component.hpp" + +params ["_scroll"]; + +if (GETMVAR(ACE_Modifier,0) == 0 || GVAR(digPFH) == -1) exitWith { false }; + +GVAR(digDirection) = GVAR(digDirection) + (_scroll * 5); + +true diff --git a/addons/trenches/functions/fnc_handleUnconscious.sqf b/addons/trenches/functions/fnc_handleUnconscious.sqf new file mode 100644 index 0000000000..e4fc2814b2 --- /dev/null +++ b/addons/trenches/functions/fnc_handleUnconscious.sqf @@ -0,0 +1,19 @@ +/* + * Author: commy2 + * Handle unconsciousness. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Public: No +*/ +#include "script_component.hpp" + +params ["_unit"]; + +if (_unit getVariable [QGVAR(isPlacing), false]) then { + [_unit] call FUNC(placeCancel); +}; diff --git a/addons/trenches/functions/fnc_placeCancel.sqf b/addons/trenches/functions/fnc_placeCancel.sqf new file mode 100644 index 0000000000..a48d6e3f5b --- /dev/null +++ b/addons/trenches/functions/fnc_placeCancel.sqf @@ -0,0 +1,36 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support + * Cancels trench dig + * + * Arguments: + * 0: unit + * + * Return Value: + * None + * + * Example: + * [ACE_player] call ace_sandbag_fnc_placeCancel + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +// enable running again +[_unit, "forceWalk", "ACE_Trenches", false] call EFUNC(common,statusEffect_set); + +// delete placement dummy +deleteVehicle GVAR(trench); + +// remove digment pfh +[GVAR(digPFH)] call CBA_fnc_removePerFrameHandler; +GVAR(digPFH) = -1; + +// remove mouse button actions +call EFUNC(interaction,hideMouseHint); + +[_unit, "DefaultAction", _unit getVariable [QGVAR(Dig), -1]] call EFUNC(common,removeActionEventHandler); +[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(common,removeActionEventHandler); + +_unit setVariable [QGVAR(isPlacing), false, true]; diff --git a/addons/trenches/functions/fnc_placeConfirm.sqf b/addons/trenches/functions/fnc_placeConfirm.sqf new file mode 100644 index 0000000000..797499a63f --- /dev/null +++ b/addons/trenches/functions/fnc_placeConfirm.sqf @@ -0,0 +1,115 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support and esteldunedain + * Confirms trench dig + * + * Arguments: + * 0: unit + * + * Return Value: + * None + * + * Example: + * [ACE_player] call ace_trenches_fnc_placeConfirm + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit"]; + +// enable running again +[_unit, "forceWalk", "ACE_Trenches", false] call EFUNC(common,statusEffect_set); + +// remove dig pfh +[GVAR(digPFH)] call CBA_fnc_removePerFrameHandler; +GVAR(digPFH) = -1; + +// remove mouse button actions +call EFUNC(interaction,hideMouseHint); + +[_unit, "DefaultAction", _unit getVariable [QGVAR(Dig), -1]] call EFUNC(common,removeActionEventHandler); +[_unit, "zoomtemp", _unit getVariable [QGVAR(Cancel), -1]] call EFUNC(common,removeActionEventHandler); + +_unit setVariable [QGVAR(isPlacing), false, true]; + +// Delete placement dummy and create real trench +params ["_unit"]; +if (isNull GVAR(trench)) exitWith {}; + +deleteVehicle GVAR(trench); +private _trench = createVehicle [GVAR(trenchType) select 0, [0, 0, 0], [], 0, "NONE"]; + +GVAR(trenchType) params ["", "", "_dx", "_dy", "_offset"]; +private _basePos = GVAR(trenchPos); +private _angle = (GVAR(digDirection) + getDir _unit); + +// _v1 forward from the player, _v2 to the right, _v3 points away from the ground +private _v3 = surfaceNormal _basePos; +private _v2 = [sin _angle, +cos _angle, 0] vectorCrossProduct _v3; +private _v1 = _v3 vectorCrossProduct _v2; + +// Stick the trench to the ground +_basePos set [2, getTerrainHeightASL _basePos]; +private _minzoffset = 0; +private ["_ix","_iy"]; +for [{_ix = -_dx/2},{_ix <= _dx/2},{_ix = _ix + _dx/3}] do { + for [{_iy = -_dy/2},{_iy <= _dy/2},{_iy = _iy + _dy/3}] do { + private _pos = _basePos vectorAdd (_v2 vectorMultiply _ix) + vectorAdd (_v1 vectorMultiply _iy); + _minzoffset = _minzoffset min ((getTerrainHeightASL _pos) - (_pos select 2)); + #ifdef DEBUG_MODE_FULL + _pos set [2, getTerrainHeightASL _pos]; + _pos2 = +_pos; + _pos2 set [2, getTerrainHeightASL _pos + 1]; + drawLine3D [ASLtoAGL _pos, ASLtoAGL _pos2, [1,1,0,1]]; + #endif + }; +}; +_basePos set [2, (_basePos select 2) + _minzoffset + _offset]; +private _vecDirAndUp = [_v1, _v3]; + +GVAR(trench) = objNull; + +// Mark the unit as digging +private _trenchId = GVAR(trenchId); +_unit setVariable [QGVAR(isDiggingId), _trenchId, true]; +GVAR(trenchId) = GVAR(trenchId) + 1; + +// Create progress bar +private _fnc_onFinish = { + (_this select 0) params ["_unit"]; + _unit setVariable [QGVAR(isDiggingId), -1, true]; +}; +private _fnc_onFailure = { + (_this select 0) params ["_unit"]; + _unit setVariable [QGVAR(isDiggingId), -1, true]; +}; +[12.5, [_unit], _fnc_onFinish, _fnc_onFailure, localize LSTRING(DiggingTrench)] call EFUNC(common,progressBar); + +// Schedule progressive raising of the trench +private _fnc_setPlacing = { + params ["_unit", "_trench", "_trenchId", "_pos", "_vecDirAndUp"]; + + // If the progress bar was cancelled, cancel elevation + // We use an uid to avoid any chance of an older trench being raised when a new one is built + if (_unit getVariable [QGVAR(isDiggingId), -1] != _trenchId) exitWith {}; + + _trench setPosASL _pos; + _trench setVectorDirAndUp _vecDirAndUp; +}; + +// For loops are for wimps +[_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 1.0], _vecDirAndUp] call _fnc_setPlacing; +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.9], _vecDirAndUp], 3.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.8], _vecDirAndUp], 4.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.7], _vecDirAndUp], 5.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.6], _vecDirAndUp], 6.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.5], _vecDirAndUp], 7.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.4], _vecDirAndUp], 8.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.3], _vecDirAndUp], 9.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.2], _vecDirAndUp],10.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.1], _vecDirAndUp],11.0] call EFUNC(common,waitAndExecute); +[_fnc_setPlacing, [_unit, _trench, _trenchId, _basePos vectorDiff [0, 0, 0.0], _vecDirAndUp],12.0] call EFUNC(common,waitAndExecute); + +// Play animation +[_unit, "AinvPknlMstpSnonWnonDnon_medic4"] call EFUNC(common,doAnimation); diff --git a/addons/trenches/functions/fnc_placeTrench.sqf b/addons/trenches/functions/fnc_placeTrench.sqf new file mode 100644 index 0000000000..21c4d92bb9 --- /dev/null +++ b/addons/trenches/functions/fnc_placeTrench.sqf @@ -0,0 +1,104 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg, edited by commy2 for better MP and eventual AI support, esteldunedain + * Starts the place process for trench. + * + * Arguments: + * 0: unit + * 1: Trench type + * + * Return Value: + * None + * + * Example: + * [ACE_player] call ace_trenches_fnc_placeTrench + * + * Public: No + */ +#include "script_component.hpp" + +params ["_unit","_trenchTypeName"]; + +GVAR(trenchType) = missionNamespace getVariable _trenchTypeName; + +TRACE_2("",_trenchTypeName,GVAR(trenchType)); +// prevent the placing unit from running +[_unit, "forceWalk", "ACE_Trenches", true] call EFUNC(common,statusEffect_set); + +// create the trench +private "_trench"; +_trench = createVehicle [GVAR(trenchType) select 1, [0, 0, 0], [], 0, "NONE"]; + +GVAR(trench) = _trench; + +// prevent collisions with trench +["enableSimulationGlobal", [_trench, false]] call EFUNC(common,serverEvent); + +GVAR(digDirection) = 0; + +// pfh that runs while the dig is in progress +GVAR(digPFH) = [{ + (_this select 0) params ["_unit", "_trench"]; + GVAR(trenchType) params ["", "", "_dx", "_dy", "_offset"]; + + // Cancel if the helper object is gone + if (isNull _trench) exitWith { + [_unit] call FUNC(placeCancel); + }; + + // Cancel if the place is no longer suitable + if !([_unit, GVAR(trenchType)] call FUNC(canDigTrench)) exitWith { + [_unit] call FUNC(placeCancel); + }; + + // Update trench position + GVAR(trenchType) params ["", "", "_dx", "_dy", "_offset"]; + private _basePos = eyePos _unit vectorAdd ([sin getDir _unit, +cos getDir _unit, 0] vectorMultiply 1.0); + + private _angle = (GVAR(digDirection) + getDir _unit); + + // _v1 forward from the player, _v2 to the right, _v3 points away from the ground + private _v3 = surfaceNormal _basePos; + private _v2 = [sin _angle, +cos _angle, 0] vectorCrossProduct _v3; + private _v1 = _v3 vectorCrossProduct _v2; + + // Stick the trench to the ground + _basePos set [2, getTerrainHeightASL _basePos]; + private _minzoffset = 0; + private ["_ix","_iy"]; + for [{_ix = -_dx/2},{_ix <= _dx/2},{_ix = _ix + _dx/3}] do { + for [{_iy = -_dy/2},{_iy <= _dy/2},{_iy = _iy + _dy/3}] do { + private _pos = _basePos vectorAdd (_v2 vectorMultiply _ix) + vectorAdd (_v1 vectorMultiply _iy); + _minzoffset = _minzoffset min ((getTerrainHeightASL _pos) - (_pos select 2)); + #ifdef DEBUG_MODE_FULL + _pos set [2, getTerrainHeightASL _pos]; + _pos2 = +_pos; + _pos2 set [2, getTerrainHeightASL _pos + 1]; + drawLine3D [ASLtoAGL _pos, ASLtoAGL _pos2, [1,1,0,1]]; + #endif + }; + }; + _basePos set [2, (_basePos select 2) + _minzoffset + _offset]; + TRACE_2("",_minzoffset,_offset); + _trench setPosASL _basePos; + _trench setVectorDirAndUp [_v1, _v3]; + GVAR(trenchPos) = _basePos; + +}, 0, [_unit, _trench]] call CBA_fnc_addPerFrameHandler; + +// add mouse button action and hint +[localize LSTRING(ConfirmDig), localize LSTRING(CancelDig), localize LSTRING(ScrollAction)] call EFUNC(interaction,showMouseHint); + +_unit setVariable [QGVAR(Dig), [ + _unit, "DefaultAction", + {GVAR(digPFH) != -1}, + {[_this select 0] call FUNC(placeConfirm)} +] call EFUNC(common,addActionEventHandler)]; + +_unit setVariable [QGVAR(Cancel), [ + _unit, "zoomtemp", + {GVAR(digPFH) != -1}, + {[_this select 0] call FUNC(placeCancel)} +] call EFUNC(common,addActionEventHandler)]; + +_unit setVariable [QGVAR(isPlacing), true, true]; diff --git a/addons/trenches/functions/script_component.hpp b/addons/trenches/functions/script_component.hpp new file mode 100644 index 0000000000..3747e01219 --- /dev/null +++ b/addons/trenches/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\trenches\script_component.hpp" \ No newline at end of file diff --git a/addons/trenches/script_component.hpp b/addons/trenches/script_component.hpp new file mode 100644 index 0000000000..3bb65ab0a6 --- /dev/null +++ b/addons/trenches/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT trenches +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_TRENCHES + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_TRENCHES + #define DEBUG_SETTINGS DEBUG_SETTINGS_TRENCHES +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/trenches/stringtable.xml b/addons/trenches/stringtable.xml new file mode 100644 index 0000000000..f4e88c2bb2 --- /dev/null +++ b/addons/trenches/stringtable.xml @@ -0,0 +1,43 @@ + + + + + Entrenching Tool + Saperka + + + Entrenching Tool + Saperka, używana do budowy okopów + + + Envelope - Small + + + Small Personal Trench + + + Dig Small Trench + + + Envelope - Big + + + Large Personal Trench + + + Dig Big Trench + + + Confirm Dig + + + Cancel Dig + + + +Ctrl rotate + + + Digging Trench + + + diff --git a/addons/tripod/script_component.hpp b/addons/tripod/script_component.hpp index b160a14742..95d11d3a65 100644 --- a/addons/tripod/script_component.hpp +++ b/addons/tripod/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT tripod #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_TRIPOD #define DEBUG_MODE_FULL #endif diff --git a/addons/ui/script_component.hpp b/addons/ui/script_component.hpp index a0fa713f9f..2c669b78e5 100644 --- a/addons/ui/script_component.hpp +++ b/addons/ui/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT ui #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_UI #define DEBUG_MODE_FULL #endif diff --git a/addons/vector/script_component.hpp b/addons/vector/script_component.hpp index 9814c95eb2..3a84d60fc4 100644 --- a/addons/vector/script_component.hpp +++ b/addons/vector/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT vector #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_VECTOR #define DEBUG_MODE_FULL #endif diff --git a/addons/vehiclelock/CfgWeapons.hpp b/addons/vehiclelock/CfgWeapons.hpp index ee000e218e..0895988737 100644 --- a/addons/vehiclelock/CfgWeapons.hpp +++ b/addons/vehiclelock/CfgWeapons.hpp @@ -3,6 +3,7 @@ class CfgWeapons { class ACE_ItemCore; class ACE_key_master: ACE_ItemCore { + scopeArsenal = 0; author = ECSTRING(common,ACETeam); displayName = "Vehicle Key: Master"; descriptionShort = CSTRING(Item_Master_Description); diff --git a/addons/vehiclelock/functions/fnc_onOpenInventory.sqf b/addons/vehiclelock/functions/fnc_onOpenInventory.sqf index 5db2cbebe0..17682c72de 100644 --- a/addons/vehiclelock/functions/fnc_onOpenInventory.sqf +++ b/addons/vehiclelock/functions/fnc_onOpenInventory.sqf @@ -35,8 +35,13 @@ if (GVAR(LockVehicleInventory) && //if setting not enabled playSound "ACE_Sound_Click"; //don't open the vehicles inventory _handeled = true; - //Just opens a dummy groundContainer (so the player can still see their own inventory) - ACE_player action ["Gear", objNull]; + + // As of 1.54 the action needs to be delayed a frame to work, which used not to be the case + [{ + TRACE_1("delaying a frame", ace_player); + //Just opens a dummy groundContainer (so the player can still see their own inventory) + ACE_player action ["Gear", objNull]; + }, []] call EFUNC(common,execNextFrame); }; _handeled diff --git a/addons/vehiclelock/script_component.hpp b/addons/vehiclelock/script_component.hpp index 43d49a8028..23b0ea9795 100644 --- a/addons/vehiclelock/script_component.hpp +++ b/addons/vehiclelock/script_component.hpp @@ -1,8 +1,10 @@ #define COMPONENT vehiclelock +#include "\z\ace\addons\main\script_mod.hpp" // #define DEBUG_MODE_FULL - -#include "\z\ace\addons\main\script_mod.hpp" +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS #ifdef DEBUG_ENABLED_VEHICLELOCK #define DEBUG_MODE_FULL diff --git a/addons/vehicles/script_component.hpp b/addons/vehicles/script_component.hpp index af3015ab73..1f1b678acf 100644 --- a/addons/vehicles/script_component.hpp +++ b/addons/vehicles/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT vehicles #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_VEHICLES #define DEBUG_MODE_FULL #endif diff --git a/addons/vehicles/stringtable.xml b/addons/vehicles/stringtable.xml index a912701b27..005bba53a3 100644 --- a/addons/vehicles/stringtable.xml +++ b/addons/vehicles/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -6,7 +6,7 @@ Begrenzer an Limitador de velocidad activado Ogranicznik prędkości włączony - Omezovač rychlosti zapnout + Omezovač rychlosti zapnut Limiteur de vitesse Activé Ограничение скорости включено Sebességkorlátozó bekapcsolva @@ -18,7 +18,7 @@ Begrenzer aus Limitador de velocidad desactivado Ogranicznik prędkości wyłączony - Omezovač rychlosti vypnout + Omezovač rychlosti vypnut Limiteur de vitesse Désactivé Ограничение скорости выключено Sebességkorlátozó kikapcsolva @@ -38,4 +38,4 @@ Limitatore di Velocità - + \ No newline at end of file diff --git a/addons/viewdistance/functions/fnc_changeViewDistance.sqf b/addons/viewdistance/functions/fnc_changeViewDistance.sqf index 1e887e9538..28bba29b67 100644 --- a/addons/viewdistance/functions/fnc_changeViewDistance.sqf +++ b/addons/viewdistance/functions/fnc_changeViewDistance.sqf @@ -3,7 +3,7 @@ * Sets the player's current view distance according to allowed values. * * Arguments: - * 0: View Distance setting INDEX + * 0: View Distance setting INDEX * 1: Show Prompt * * Return Value: diff --git a/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf b/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf index e9838a0c8d..90c70b810c 100644 --- a/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf +++ b/addons/viewdistance/functions/fnc_returnObjectCoeff.sqf @@ -3,10 +3,10 @@ * Returns the object view distance coefficient according to the given index * * Arguments: - * 0: Object View Distance setting Index + * 0: Object View Distance setting Index * * Return Value: - * Object View Distance + * Object View Distance * * Example: * [2] call ace_viewdistance_fnc_returnObjectCoeff; diff --git a/addons/viewdistance/functions/fnc_returnValue.sqf b/addons/viewdistance/functions/fnc_returnValue.sqf index 2e4263fa08..7224292fa4 100644 --- a/addons/viewdistance/functions/fnc_returnValue.sqf +++ b/addons/viewdistance/functions/fnc_returnValue.sqf @@ -3,10 +3,10 @@ * Returns the view distance value according to the given index. * * Arguments: - * 0: View Distance Index + * 0: View Distance Index * * Return Value: - * View Distance + * View Distance * * Example: * [2] call ace_viewdistance_fnc_returnViewDistanceValue diff --git a/addons/viewdistance/script_component.hpp b/addons/viewdistance/script_component.hpp index 53c4d76390..dfd04bbf9d 100644 --- a/addons/viewdistance/script_component.hpp +++ b/addons/viewdistance/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT viewdistance #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_VIEWDISTANCE #define DEBUG_MODE_FULL #endif diff --git a/addons/viewdistance/stringtable.xml b/addons/viewdistance/stringtable.xml index 673f09783d..622f94d8ab 100644 --- a/addons/viewdistance/stringtable.xml +++ b/addons/viewdistance/stringtable.xml @@ -236,6 +236,7 @@ FoV Based Зависит от зума Baseado em FoV + Založeno na FoV View Distance: diff --git a/addons/weaponselect/script_component.hpp b/addons/weaponselect/script_component.hpp index eec47cc4b1..7ab95f9887 100644 --- a/addons/weaponselect/script_component.hpp +++ b/addons/weaponselect/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT weaponselect #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_WEAPONSELECT #define DEBUG_MODE_FULL #endif diff --git a/addons/weather/CfgVehicles.hpp b/addons/weather/CfgVehicles.hpp index f37a62449a..f98a1e50f5 100644 --- a/addons/weather/CfgVehicles.hpp +++ b/addons/weather/CfgVehicles.hpp @@ -53,4 +53,4 @@ class CfgVehicles { description = CSTRING(Module_Description); }; }; -}; \ No newline at end of file +}; diff --git a/addons/weather/CfgWorlds.hpp b/addons/weather/CfgWorlds.hpp index 1391468fd9..dd0a616272 100644 --- a/addons/weather/CfgWorlds.hpp +++ b/addons/weather/CfgWorlds.hpp @@ -48,4 +48,4 @@ class CfgWorlds { {0.08, 0.38, 0.06, 0.04, 0.19, 0.03, 0.02, 0.02}, // November {0.06, 0.37, 0.05, 0.03, 0.18, 0.04, 0.02, 0.02}};// December }; -}; \ No newline at end of file +}; diff --git a/addons/weather/RscTitles.hpp b/addons/weather/RscTitles.hpp index aedebdabfc..d89c8d0671 100644 --- a/addons/weather/RscTitles.hpp +++ b/addons/weather/RscTitles.hpp @@ -1,17 +1,13 @@ -class RscTitles -{ - class RscWindIntuitive - { +class RscTitles { + class RscWindIntuitive { idd=-1; onLoad="with uiNameSpace do { RscWindIntuitive = _this select 0 };"; movingEnable=0; duration=60; fadeIn="false"; fadeOut="false"; - class controls - { - class RscWindIntuitive - { + class controls { + class RscWindIntuitive { idc=132948; type=0; style=48; @@ -28,4 +24,4 @@ class RscTitles }; }; }; -}; \ No newline at end of file +}; diff --git a/addons/weather/UI/wind0.paa b/addons/weather/UI/wind0.paa deleted file mode 100644 index c049caf47e..0000000000 Binary files a/addons/weather/UI/wind0.paa and /dev/null differ diff --git a/addons/weather/UI/wind1.paa b/addons/weather/UI/wind1.paa deleted file mode 100644 index 47d996fe67..0000000000 Binary files a/addons/weather/UI/wind1.paa and /dev/null differ diff --git a/addons/weather/UI/wind10.paa b/addons/weather/UI/wind10.paa deleted file mode 100644 index a9bcd49c1b..0000000000 Binary files a/addons/weather/UI/wind10.paa and /dev/null differ diff --git a/addons/weather/UI/wind11.paa b/addons/weather/UI/wind11.paa deleted file mode 100644 index 469cdedada..0000000000 Binary files a/addons/weather/UI/wind11.paa and /dev/null differ diff --git a/addons/weather/UI/wind2.paa b/addons/weather/UI/wind2.paa deleted file mode 100644 index 585944af45..0000000000 Binary files a/addons/weather/UI/wind2.paa and /dev/null differ diff --git a/addons/weather/UI/wind3.paa b/addons/weather/UI/wind3.paa deleted file mode 100644 index 16b823a9f3..0000000000 Binary files a/addons/weather/UI/wind3.paa and /dev/null differ diff --git a/addons/weather/UI/wind4.paa b/addons/weather/UI/wind4.paa deleted file mode 100644 index a5bd119889..0000000000 Binary files a/addons/weather/UI/wind4.paa and /dev/null differ diff --git a/addons/weather/UI/wind5.paa b/addons/weather/UI/wind5.paa deleted file mode 100644 index 43398e2960..0000000000 Binary files a/addons/weather/UI/wind5.paa and /dev/null differ diff --git a/addons/weather/UI/wind6.paa b/addons/weather/UI/wind6.paa deleted file mode 100644 index 3bd9a9c676..0000000000 Binary files a/addons/weather/UI/wind6.paa and /dev/null differ diff --git a/addons/weather/UI/wind7.paa b/addons/weather/UI/wind7.paa deleted file mode 100644 index a7bb1d5942..0000000000 Binary files a/addons/weather/UI/wind7.paa and /dev/null differ diff --git a/addons/weather/UI/wind8.paa b/addons/weather/UI/wind8.paa deleted file mode 100644 index e51ad530c5..0000000000 Binary files a/addons/weather/UI/wind8.paa and /dev/null differ diff --git a/addons/weather/UI/wind9.paa b/addons/weather/UI/wind9.paa deleted file mode 100644 index 016ca49f7c..0000000000 Binary files a/addons/weather/UI/wind9.paa and /dev/null differ diff --git a/addons/weather/UI/wind_arrow_ca.paa b/addons/weather/UI/wind_arrow_ca.paa new file mode 100644 index 0000000000..7554936ba1 Binary files /dev/null and b/addons/weather/UI/wind_arrow_ca.paa differ diff --git a/addons/weather/UI/wind_dot_ca.paa b/addons/weather/UI/wind_dot_ca.paa new file mode 100644 index 0000000000..8286ffab2d Binary files /dev/null and b/addons/weather/UI/wind_dot_ca.paa differ diff --git a/addons/weather/UI/wind12.paa b/addons/weather/UI/wind_noneCircle_ca.paa similarity index 100% rename from addons/weather/UI/wind12.paa rename to addons/weather/UI/wind_noneCircle_ca.paa diff --git a/addons/weather/XEH_postInit.sqf b/addons/weather/XEH_postInit.sqf index c6f779358f..a19e000332 100644 --- a/addons/weather/XEH_postInit.sqf +++ b/addons/weather/XEH_postInit.sqf @@ -14,6 +14,7 @@ GVAR(ACE_rain) = rain; "ACE_RAIN_PARAMS" addPublicVariableEventHandler { GVAR(rain_period_start_time) = ACE_time; }; "ACE_MISC_PARAMS" addPublicVariableEventHandler { if (!isServer) then { + TRACE_1("MISC PARAMS PVEH",ACE_MISC_PARAMS); if (GVAR(syncMisc)) then { 30 setLightnings (ACE_MISC_PARAMS select 0); 30 setRainbow (ACE_MISC_PARAMS select 1); @@ -27,10 +28,11 @@ GVAR(ACE_rain) = rain; }; }; +GVAR(WindInfo) = false; ["ACE3 Common", QGVAR(WindInfoKey), localize LSTRING(WindInfoKey), { // Conditions: canInteract - if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {false}; + if !([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith)) exitWith {false}; // Statement [] call FUNC(displayWindInfo); @@ -40,12 +42,40 @@ GVAR(ACE_rain) = rain; simulWeatherSync; -[FUNC(updateTemperature), 20, []] call CBA_fnc_addPerFrameHandler; -[FUNC(updateHumidity), 20, []] call CBA_fnc_addPerFrameHandler; -[FUNC(updateWind), 1, []] call CBA_fnc_addPerFrameHandler; -[FUNC(updateRain), 2, []] call CBA_fnc_addPerFrameHandler; -[{ + + + +["SettingsInitialized",{ + TRACE_1("SettingsInitialized",GVAR(syncRain)); + + //Create a 0 sec delay PFEH to update rain every frame: if (GVAR(syncRain)) then { - 0 setRain GVAR(ACE_rain); + [{ + 0 setRain GVAR(ACE_rain); + }, 0, []] call CBA_fnc_addPerFrameHandler; }; -}, 0, []] call CBA_fnc_addPerFrameHandler; \ No newline at end of file + + //Create a 1 sec delay PFEH to update wind/rain/temp/humidity: + + //If we don't sync rain, set next time to infinity + GVAR(nextUpdateRain) = if (GVAR(syncRain)) then {0} else {1e99}; + GVAR(nextUpdateTempAndHumidity) = 0; + [{ + BEGIN_COUNTER(weatherPFEH); + + [] call FUNC(updateWind); //Every 1 second + + if (ACE_time >= GVAR(nextUpdateRain)) then { + [] call FUNC(updateRain); //Every 2 seconds + GVAR(nextUpdateRain) = 2 + ACE_time; + }; + if (ACE_time >= GVAR(nextUpdateTempAndHumidity)) then { + [] call FUNC(updateTemperature); //Every 20 seconds + [] call FUNC(updateHumidity); //Every 20 seconds + GVAR(nextUpdateTempAndHumidity) = 20 + ACE_time; + }; + + END_COUNTER(weatherPFEH); + }, 1, []] call CBA_fnc_addPerFrameHandler; + +}] call EFUNC(common,addEventHandler); diff --git a/addons/weather/XEH_postServerInit.sqf b/addons/weather/XEH_postServerInit.sqf index aa733afa5d..f7b830b11d 100644 --- a/addons/weather/XEH_postServerInit.sqf +++ b/addons/weather/XEH_postServerInit.sqf @@ -9,4 +9,10 @@ GVAR(rain_current_range) = -1+(random 2); // Wind call FUNC(initWind); -[FUNC(serverController), GVAR(serverUpdateInterval)] call CBA_fnc_addPerFrameHandler; +["SettingsInitialized", { + TRACE_2("SettingsInitialized",GVAR(enableServerController),GVAR(serverUpdateInterval)); + + if (GVAR(enableServerController)) then { + [FUNC(serverController), GVAR(serverUpdateInterval)] call CBA_fnc_addPerFrameHandler; + }; +}] call EFUNC(common,addEventHandler); diff --git a/addons/weather/functions/fnc_calculateAirDensity.sqf b/addons/weather/functions/fnc_calculateAirDensity.sqf index f3de65f99d..bda8410ddd 100644 --- a/addons/weather/functions/fnc_calculateAirDensity.sqf +++ b/addons/weather/functions/fnc_calculateAirDensity.sqf @@ -1,18 +1,19 @@ /* * Author: Ruthberg - * * Calculates the air density * * Arguments: - * 0: temperature - degrees celcius + * 0: temperature - degrees celsius * 1: pressure - hPa * 2: relativeHumidity - value between 0.0 and 1.0 * * Return Value: * density of air - kg * m^(-3) * - * Return value: - * None + * Example: + * [0, 1020, 0.5] call ace_weather_fnc_calculateAirDensity + * + * Public: No */ #include "script_component.hpp" @@ -21,11 +22,10 @@ params ["_temperature", "_pressure", "_relativeHumidity"]; _pressure = _pressure * 100; // hPa to Pa if (_relativeHumidity > 0) then { - private ["_pSat", "_vaporPressure", "_partialPressure"]; // Saturation vapor pressure calculated according to: http://wahiduddin.net/calc/density_algorithms.htm - _pSat = 6.1078 * 10 ^ ((7.5 * _temperature) / (_temperature + 237.3)); - _vaporPressure = _relativeHumidity * _pSat; - _partialPressure = _pressure - _vaporPressure; + private _pSat = 6.1078 * 10 ^ ((7.5 * _temperature) / (_temperature + 237.3)); + private _vaporPressure = _relativeHumidity * _pSat; + private _partialPressure = _pressure - _vaporPressure; (_partialPressure * DRY_AIR_MOLAR_MASS + _vaporPressure * WATER_VAPOR_MOLAR_MASS) / (UNIVERSAL_GAS_CONSTANT * KELVIN(_temperature)) } else { diff --git a/addons/weather/functions/fnc_calculateBarometricPressure.sqf b/addons/weather/functions/fnc_calculateBarometricPressure.sqf index 134a741127..29b8fa7877 100644 --- a/addons/weather/functions/fnc_calculateBarometricPressure.sqf +++ b/addons/weather/functions/fnc_calculateBarometricPressure.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Calculates the barometric pressure based on altitude and weather * * Arguments: @@ -9,8 +8,10 @@ * Return Value: * barometric pressure - hPA * - * Return value: - * None + * Example: + * 0 call ace_weather_fnc_calculateBarometricPressure + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/weather/functions/fnc_calculateDensityAltitude.sqf b/addons/weather/functions/fnc_calculateDensityAltitude.sqf index 97889e2499..8dea9849b1 100644 --- a/addons/weather/functions/fnc_calculateDensityAltitude.sqf +++ b/addons/weather/functions/fnc_calculateDensityAltitude.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Calculates density altitude for a given air density * * Arguments: @@ -9,8 +8,10 @@ * Return Value: * density altitude - m * - * Return value: - * None + * Example: + * 1.225 call ace_weather_fnc_calculateDensityAltitude + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/weather/functions/fnc_calculateDewPoint.sqf b/addons/weather/functions/fnc_calculateDewPoint.sqf index cbfc606054..81db9565dc 100644 --- a/addons/weather/functions/fnc_calculateDewPoint.sqf +++ b/addons/weather/functions/fnc_calculateDewPoint.sqf @@ -1,17 +1,18 @@ /* * Author: Ruthberg - * * Calculates dew point based on temperature and relative humidity * * Arguments: - * 0: temperature - degrees celcius - * 2: relativeHumidity - value between 0.0 and 1.0 + * 0: temperature - degrees celsius + * 1: relativeHumidity - value between 0.0 and 1.0 * * Return Value: * dew point * - * Return value: - * None + * Example: + * [32, 0.4] call ace_weather_fnc_calculateDewPoint + * + * Public: No */ #include "script_component.hpp" @@ -24,7 +25,6 @@ if (_rh == 0) exitWith { CELSIUS(0) }; // Source: https://en.wikipedia.org/wiki/Dew_point -private ["_gamma"]; -_gamma = ln(_rh) + (__b * _t) / (__c + _t); +private _gamma = ln(_rh) + (__b * _t) / (__c + _t); (__c * _gamma) / (__b - _gamma) diff --git a/addons/weather/functions/fnc_calculateHeatIndex.sqf b/addons/weather/functions/fnc_calculateHeatIndex.sqf index 057c13d7ad..a4626128de 100644 --- a/addons/weather/functions/fnc_calculateHeatIndex.sqf +++ b/addons/weather/functions/fnc_calculateHeatIndex.sqf @@ -1,17 +1,18 @@ /* * Author: Ruthberg - * * Calculates heat index based on temperature and relative humidity * * Arguments: - * 0: temperature - degrees celcius + * 0: temperature - degrees celsius * 1: relativeHumidity - value between 0.0 and 1.0 * * Return Value: * heat index * - * Return value: - * None + * Example: + * [36, 0.75] call ace_weather_fnc_calculateHeatIndex + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/weather/functions/fnc_calculateRoughnessLength.sqf b/addons/weather/functions/fnc_calculateRoughnessLength.sqf index 4fd0d18fb3..423f3fc3d6 100644 --- a/addons/weather/functions/fnc_calculateRoughnessLength.sqf +++ b/addons/weather/functions/fnc_calculateRoughnessLength.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Calculates the terrain roughness length at a given world position * * Arguments: @@ -9,19 +8,20 @@ * Return Value: * roughness length * + * Example: + * (getPosASL player) call ace_weather_fnc_calculateRoughnessLength + * * Public: No */ #include "script_component.hpp" -private ["_roughness_lengths", "_windSource", "_nearBuildings", "_isWater"]; - // Source: http://es.ucsc.edu/~jnoble/wind/extrap/index.html -_roughness_lengths = [0.0002, 0.0005, 0.0024, 0.03, 0.055, 0.1, 0.2, 0.4, 0.8, 1.6]; +#define ROUGHNESS_LENGTHS [0.0002, 0.0005, 0.0024, 0.03, 0.055, 0.1, 0.2, 0.4, 0.8, 1.6] -_windSource = _this vectorDiff ((vectorNormalized ACE_wind) vectorMultiply 25); +private _windSource = _this vectorDiff ((vectorNormalized ACE_wind) vectorMultiply 25); -_nearBuildings = count (_windSource nearObjects ["Building", 50]); -_isWater = surfaceIsWater _windSource; +private _nearBuildings = count (_windSource nearObjects ["Building", 50]); +private _isWater = surfaceIsWater _windSource; if (_nearBuildings == 0 && _isWater) exitWith { 0.0005 @@ -31,4 +31,4 @@ if (_nearBuildings >= 10) exitWith { 1.6 }; -_roughness_lengths select (2 + (_nearBuildings min 6)) +ROUGHNESS_LENGTHS select (2 + (_nearBuildings min 6)) diff --git a/addons/weather/functions/fnc_calculateSpeedOfSound.sqf b/addons/weather/functions/fnc_calculateSpeedOfSound.sqf index 322ba75ac5..f645ba2368 100644 --- a/addons/weather/functions/fnc_calculateSpeedOfSound.sqf +++ b/addons/weather/functions/fnc_calculateSpeedOfSound.sqf @@ -1,16 +1,17 @@ /* * Author: Ruthberg - * * Calculates the speed of sound for a given temperature * * Arguments: - * temperature - degrees celcius + * temperature - degrees celsius * * Return Value: * speed of sound - m/s * - * Return value: - * None + * Example: + * 0 call ace_weather_fnc_calculateSpeedOfSound + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/weather/functions/fnc_calculateTemperatureAtHeight.sqf b/addons/weather/functions/fnc_calculateTemperatureAtHeight.sqf index 5e02795d59..e33b8213eb 100644 --- a/addons/weather/functions/fnc_calculateTemperatureAtHeight.sqf +++ b/addons/weather/functions/fnc_calculateTemperatureAtHeight.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Calculates the temperature based on altitude and weather * * Arguments: @@ -9,8 +8,10 @@ * Return Value: * temperature - degrees celsius * - * Return value: - * None + * Example: + * 500 call ace_weather_fnc_calculateTemperatureAtHeight + * + * Public: No */ #include "script_component.hpp" diff --git a/addons/weather/functions/fnc_calculateWetBulb.sqf b/addons/weather/functions/fnc_calculateWetBulb.sqf index 94e96cd11b..a8a58b0dc3 100644 --- a/addons/weather/functions/fnc_calculateWetBulb.sqf +++ b/addons/weather/functions/fnc_calculateWetBulb.sqf @@ -1,36 +1,35 @@ /* * Author: Ruthberg - * * Calculates wet bulb based on temperature and relative humidity * * Arguments: - * 0: temperature - degrees celcius + * 0: temperature - degrees celsius * 1: pressure - hPa * 2: relativeHumidity - value between 0.0 and 1.0 * * Return Value: * wet bulb * - * Return value: - * None + * Example: + * [0, 1020, 0.5] call ace_weather_fnc_calculateWetBulb + * + * Public: No */ #include "script_component.hpp" -private ["_es", "_e", "_eDiff", "_eGuessPrev", "_cTempDelta", "_twGuess", "_eguess"]; - params ["_temperature", "_pressure", "_relativeHumidity"]; // Source: http://cosmoquest.org/forum/showthread.php?155366-Calculating-Wet-Bulb-Temperature-from-RH-amp-Dry-Bulb -_es = 6.112 * exp((17.67 * _temperature) / (_temperature + 243.5)); -_e = _es * _relativeHumidity; -_eDiff = _es - _e; -_eGuessPrev = _es; -_cTempDelta = 3.3145; -_twGuess = _temperature; +private _es = 6.112 * exp((17.67 * _temperature) / (_temperature + 243.5)); +private _e = _es * _relativeHumidity; +private _eDiff = _es - _e; +private _eGuessPrev = _es; +private _cTempDelta = 3.3145; +private _twGuess = _temperature; for "_j" from 1 to 50 do { _twGuess = _twGuess - _cTempDelta; - _eguess = 6.112 * exp((17.67 * _twGuess) / (_twGuess + 243.5)); + private _eguess = 6.112 * exp((17.67 * _twGuess) / (_twGuess + 243.5)); _eguess = _eguess - (_pressure * (_temperature - _twGuess) * 0.00066 * (1 + (0.00115 * _twGuess))); _eDiff = _eguess - _e; if (abs(_eDiff) <= 0.001) exitWith {}; diff --git a/addons/weather/functions/fnc_calculateWindChill.sqf b/addons/weather/functions/fnc_calculateWindChill.sqf index ee3a20283b..0e17d53377 100644 --- a/addons/weather/functions/fnc_calculateWindChill.sqf +++ b/addons/weather/functions/fnc_calculateWindChill.sqf @@ -1,15 +1,17 @@ /* * Author: Ruthberg - * * Calculates wind chill based on temperature and wind speed * * Arguments: - * 0: temperature - degrees celcius + * 0: temperature - degrees celsius * 1: wind speed - m/s * * Return Value: * wind chill * + * Example: + * [0, 10] call ace_weather_fnc_calculateWindChill + * * Public: No */ #include "script_component.hpp" diff --git a/addons/weather/functions/fnc_calculateWindSpeed.sqf b/addons/weather/functions/fnc_calculateWindSpeed.sqf index 87c6c49d42..206bc1d298 100644 --- a/addons/weather/functions/fnc_calculateWindSpeed.sqf +++ b/addons/weather/functions/fnc_calculateWindSpeed.sqf @@ -1,43 +1,42 @@ /* * Author: Ruthberg - * * Calculates the true wind speed at a given world position * * Arguments: * 0: world position - posASL - * 1: Account for wind gradient + * 1: Account for wind gradient (used in advanced ballistics) * 2: Account for terrain * 3: Account for obstacles * * Return Value: * wind speed - m/s * + * Example: + * [eyePos ACE_player, true, true, true] call ace_weather_fnc_calculateWindSpeed; + * * Public: No */ #include "script_component.hpp" -private ["_fnc_polar2vect", "_windSpeed", "_windDir", "_windDirAdjusted", "_height", "_newWindSpeed", "_windSource", "_roughnessLength"]; - params ["_position", "_windGradientEnabled", "_terrainEffectEnabled", "_obstacleEffectEnabled"]; -_fnc_polar2vect = { - private ["_mag2D"]; - params ["_x", "_y", "_z"]; - _mag2D = _x * cos(_z); - [_mag2D * sin(_y), _mag2D * cos(_y), _x * sin(_z)]; +private _fnc_polar2vect = { + params ["_mag","_dir","_elev"]; + private _mag2D = _mag * cos(_elev); + [_mag2D * sin(_dir), _mag2D * cos(_dir), _mag * sin(_elev)]; }; -_windSpeed = vectorMagnitude ACE_wind; -_windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); -_windDirAdjusted = _windDir + 180; +private _windSpeed = vectorMagnitude ACE_wind; +private _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); +private _windDirAdjusted = _windDir + 180; // Wind gradient if (_windGradientEnabled) then { if (_windSpeed > 0.05) then { - _height = (ASLToATL _position) select 2; + private _height = (ASLToATL _position) select 2; _height = 0 max _height min 20; if (_height < 20) then { - _roughnessLength = _position call FUNC(calculateRoughnessLength); + private _roughnessLength = _position call FUNC(calculateRoughnessLength); _windSpeed = _windSpeed * abs(ln(_height / _roughnessLength) / ln(20 / _roughnessLength)); }; }; @@ -46,9 +45,9 @@ if (_windGradientEnabled) then { // Terrain effect on wind if (_terrainEffectEnabled) then { if (_windSpeed > 0.05) then { - _newWindSpeed = 0; + private _newWindSpeed = 0; { - _windSource = [100, _windDirAdjusted, _x] call _fnc_polar2vect; + private _windSource = [100, _windDirAdjusted, _x] call _fnc_polar2vect; if (!(terrainIntersectASL [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 9) * _windSpeed; }; @@ -60,6 +59,7 @@ if (_terrainEffectEnabled) then { if (!(terrainIntersectASL [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 9) * _windSpeed; }; + nil } count [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; _windSpeed = _newWindSpeed; }; @@ -68,9 +68,9 @@ if (_terrainEffectEnabled) then { // Obstacle effect on wind if (_obstacleEffectEnabled) then { if (_windSpeed > 0.05) then { - _newWindSpeed = 0; + private _newWindSpeed = 0; { - _windSource = [20, _windDirAdjusted, _x] call _fnc_polar2vect; + private _windSource = [20, _windDirAdjusted, _x] call _fnc_polar2vect; if (!(lineIntersects [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 2) * _windSpeed; }; @@ -82,6 +82,7 @@ if (_obstacleEffectEnabled) then { if (!(lineIntersects [_position, _position vectorAdd _windSource])) exitWith { _newWindSpeed = cos(_x * 2) * _windSpeed; }; + nil } count [0, 5, 10, 15, 20, 25, 30, 35, 40, 45]; _windSpeed = _newWindSpeed; }; diff --git a/addons/weather/functions/fnc_displayWindInfo.sqf b/addons/weather/functions/fnc_displayWindInfo.sqf index 98d9026c1c..f81384c1b0 100644 --- a/addons/weather/functions/fnc_displayWindInfo.sqf +++ b/addons/weather/functions/fnc_displayWindInfo.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Displays a wind info (colored arrow) in the top left corner of the screen * * Argument: @@ -8,6 +7,11 @@ * * Return value: * None + * + * Example: + * [] call ace_weather_fnc_displayWindInfo + * + * Public: No */ #include "script_component.hpp" @@ -16,64 +20,87 @@ if (GVAR(WindInfo)) exitWith { GVAR(WindInfo) = false; - 0 cutText ["", "PLAIN"]; + (["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; true }; -if (underwater ACE_player) exitWith { false }; -if (vehicle ACE_player != ACE_player) exitWith { false }; -2 cutText ["", "PLAIN"]; EGVAR(advanced_ballistics,Protractor) = false; 1 cutText ["", "PLAIN"]; GVAR(WindInfo) = true; -[{ - private ["_windSpeed", "_windDir", "_playerDir", "_windIndex", "_windColor"]; - if !(GVAR(WindInfo) && !(underwater ACE_player) && vehicle ACE_player == ACE_player) exitWith { +TRACE_1("Starting Wind Info PFEH", GVAR(WindInfo)); + +[{ + disableSerialization; + params ["", "_pfID"]; + + if ((!GVAR(WindInfo)) || {!([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith))}) exitWith { + TRACE_1("Ending Wind Info PFEH", GVAR(WindInfo)); GVAR(WindInfo) = false; - 0 cutText ["", "PLAIN"]; - [_this select 1] call CBA_fnc_removePerFrameHandler; + (["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; + [_pfID] call CBA_fnc_removePerFrameHandler; }; - _windIndex = 12; - _windColor = [1, 1, 1, 1]; - _windSpeed = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { + //Keeps the display open: + (["RscWindIntuitive"] call BIS_fnc_rscLayer) cutRsc ["RscWindIntuitive", "PLAIN", 1, false]; + + private _windSpeed = if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { // With wind gradient [eyePos ACE_player, true, true, true] call FUNC(calculateWindSpeed); } else { // Without wind gradient [eyePos ACE_player, false, true, true] call FUNC(calculateWindSpeed); }; - - if (_windSpeed > 0.2) then { - _playerDir = (ACE_player call CBA_fnc_headDir) select 0; - _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); - _windIndex = round(((_playerDir - _windDir + 360) % 360) / 30); - _windIndex = _windIndex % 12; - }; + + + private _playerDir = (ACE_player call CBA_fnc_headDir) select 0; + private _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); + _windDir = 30 * (round(((_windDir - _playerDir + 360) % 360) / 30)); // Color Codes from https://en.wikipedia.org/wiki/Beaufort_scale#Modern_scale - if (_windSpeed > 0.3) then { _windColor = [0.796, 1, 1, 1]; }; - if (_windSpeed > 1.5) then { _windColor = [0.596, 0.996, 0.796, 1]; }; - if (_windSpeed > 3.3) then { _windColor = [0.596, 0.996, 0.596, 1]; }; - if (_windSpeed > 5.4) then { _windColor = [0.6, 0.996, 0.4, 1]; }; - if (_windSpeed > 7.9) then { _windColor = [0.6, 0.996, 0.047, 1]; }; - if (_windSpeed > 10.7) then { _windColor = [0.8, 0.996, 0.059, 1]; }; - if (_windSpeed > 13.8) then { _windColor = [1, 0.996, 0.067, 1]; }; - if (_windSpeed > 17.1) then { _windColor = [1, 0.796, 0.051, 1]; }; - if (_windSpeed > 20.7) then { _windColor = [1, 0.596, 0.039, 1]; }; - if (_windSpeed > 24.4) then { _windColor = [1, 0.404, 0.031, 1]; }; - if (_windSpeed > 28.4) then { _windColor = [1, 0.22, 0.027, 1]; }; - if (_windSpeed > 32.6) then { _windColor = [1, 0.078, 0.027, 1]; }; + private _beaufortNumber = 0; + private _windColor = [1, 1, 1, 1]; + if (_windSpeed > 0.3) then { _windColor = [0.796, 1, 1, 1]; _beaufortNumber = 1; }; + if (_windSpeed > 1.5) then { _windColor = [0.596, 0.996, 0.796, 1]; _beaufortNumber = 2; }; + if (_windSpeed > 3.3) then { _windColor = [0.596, 0.996, 0.596, 1]; _beaufortNumber = 3; }; + if (_windSpeed > 5.4) then { _windColor = [0.6, 0.996, 0.4, 1]; _beaufortNumber = 4; }; + if (_windSpeed > 7.9) then { _windColor = [0.6, 0.996, 0.047, 1]; _beaufortNumber = 5; }; + if (_windSpeed > 10.7) then { _windColor = [0.8, 0.996, 0.059, 1]; _beaufortNumber = 6; }; + if (_windSpeed > 13.8) then { _windColor = [1, 0.996, 0.067, 1]; _beaufortNumber = 7; }; + if (_windSpeed > 17.1) then { _windColor = [1, 0.796, 0.051, 1]; _beaufortNumber = 8; }; + if (_windSpeed > 20.7) then { _windColor = [1, 0.596, 0.039, 1]; _beaufortNumber = 9; }; + if (_windSpeed > 24.4) then { _windColor = [1, 0.404, 0.031, 1]; _beaufortNumber = 10; }; + if (_windSpeed > 28.4) then { _windColor = [1, 0.22, 0.027, 1]; _beaufortNumber = 11; }; + if (_windSpeed > 32.6) then { _windColor = [1, 0.078, 0.027, 1]; _beaufortNumber = 12; }; - 0 cutRsc ["RscWindIntuitive", "PLAIN", 1, false]; - __ctrl ctrlSetScale 0.75; + TRACE_3("update display",_beaufortNumber,_windDir,_windSpeed); + __ctrl ctrlSetTextColor _windColor; + if (_beaufortNumber > 0) then { + __ctrl ctrlSetText QUOTE(PATHTOF(UI\wind_arrow_ca.paa)); + __ctrl ctrlSetAngle [_windDir, 0.5, 0.5]; + } else { + __ctrl ctrlSetText QUOTE(PATHTOF(UI\wind_noneCircle_ca.paa)); + }; __ctrl ctrlCommit 0; - __ctrl ctrlSetText format[QUOTE(PATHTOF(UI\wind%1.paa)), _windIndex]; - __ctrl ctrlSetTextColor _windColor; + //Update the beaufort balls: + (ctrlPosition __ctrl) params ["_ctrlX", "_ctrlY", "_ctrlWidth", "_ctrlHeight"]; + private _centerX = _ctrlX + _ctrlWidth / 2; + private _centerY = _ctrlY + _ctrlHeight / 2; + private _ballHeight = _ctrlHeight / 17; + private _ballWidth = _ballHeight * 3/4; + + for "_index" from 0 to (_beaufortNumber - 1) do { + private _ball = __dsp ctrlCreate ["RscPicture", _index]; + _ball ctrlSetText QUOTE(PATHTOF(UI\wind_dot_ca.paa)); + _ball ctrlSetTextColor [1,1,1,1]; + private _ballCenterX = _centerX - (_ballWidth / 2) + ((sin _windDir) * 0.013333) * (_index - 4.9) + ((cos _windDir) * 0.0125); + private _ballCenterY = _centerY - (_ballHeight / 2) - ((1 * cos _windDir) * 4/3*0.013333) * (_index - 4.9) + ((sin _windDir) * 0.0125); + _ball ctrlSetPosition [_ballCenterX, _ballCenterY, _ballWidth, _ballHeight]; + _ball ctrlCommit 0; + }; }, 0.5, []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/weather/functions/fnc_getMapData.sqf b/addons/weather/functions/fnc_getMapData.sqf index 2e39f80764..b344ad2bdf 100644 --- a/addons/weather/functions/fnc_getMapData.sqf +++ b/addons/weather/functions/fnc_getMapData.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg, esteldunedain - * * Get the weather data for the current map * * Argument: @@ -8,6 +7,11 @@ * * Return value: * None + * + * Example: + * [] call ace_weather_fnc_getMapData + * + * Public: No */ #include "script_component.hpp" @@ -207,4 +211,4 @@ GVAR(TempNight) = [-4, -3, 0, 4, 9, 12, 14, 14, 10, 6, 2, -2]; GVAR(Humidity) = [82, 80, 78, 70, 71, 72, 70, 73, 78, 80, 83, 82]; GVAR(currentTemperature) = 20; -GVAR(currentHumidity) = 0.5; \ No newline at end of file +GVAR(currentHumidity) = 0.5; diff --git a/addons/weather/functions/fnc_getWind.sqf b/addons/weather/functions/fnc_getWind.sqf index 7e133896a6..c9ccd43ff9 100644 --- a/addons/weather/functions/fnc_getWind.sqf +++ b/addons/weather/functions/fnc_getWind.sqf @@ -1,6 +1,5 @@ /* * Author: ACE2 Team, Ruthberg - * * Calculate current wind locally from the data broadcasted by the server * * Argument: @@ -8,17 +7,21 @@ * * Return value: * Wind + * + * Example: + * [] call ace_weather_fnc_getWind + * + * Public: No */ #include "script_component.hpp" -private ["_periodPercent", "_periodPosition"]; - if (isNil "ACE_WIND_PARAMS") exitWith { [0, 0, 0] }; ACE_WIND_PARAMS params ["_dir", "_dirChange", "_spd", "_spdChange", "_period"]; +//Wind _dir is the "source" of the wind [eg: "northerly wind": _dir = 0 -> wind = [0,-1,0];] -_periodPosition = (ACE_time - GVAR(wind_period_start_time)) min _period; -_periodPercent = _periodPosition / _period; +private _periodPosition = (ACE_time - GVAR(wind_period_start_time)) min _period; +private _periodPercent = _periodPosition / _period; _spd = _spd + _spdChange * _periodPercent; _dir = _dir + _dirChange * _periodPercent; diff --git a/addons/weather/functions/fnc_initModuleSettings.sqf b/addons/weather/functions/fnc_initModuleSettings.sqf index 034612ab58..f1e9c1d6fc 100644 --- a/addons/weather/functions/fnc_initModuleSettings.sqf +++ b/addons/weather/functions/fnc_initModuleSettings.sqf @@ -10,6 +10,9 @@ * Return Value: * None * + * Example: + * [module, [], true] call ace_weather_fnc_initModuleSettings + * * Public: No */ diff --git a/addons/weather/functions/fnc_initWind.sqf b/addons/weather/functions/fnc_initWind.sqf index 10b22efa2a..4c88f59f95 100644 --- a/addons/weather/functions/fnc_initWind.sqf +++ b/addons/weather/functions/fnc_initWind.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Inits the wind variables on mission start * * Argument: @@ -8,28 +7,32 @@ * * Return value: * None + * + * Example: + * [] call ace_weather_fnc_initWind + * + * Public: No */ #include "script_component.hpp" -private ["_sum", "_rand", "_csum", "_index", "_month", "_windDirectionProbabilities"]; -_month = date select 1; -_windDirectionProbabilities = GVAR(WindDirectionProbabilities) select (_month - 1); +private _month = date select 1; +private _windDirectionProbabilities = GVAR(WindDirectionProbabilities) select (_month - 1); ACE_wind = [0, 0, 0]; GVAR(wind_direction_reference) = random 360; -_sum = 0; +private _sum = 0; for "_i" from 0 to 7 do { _sum = _sum + (_windDirectionProbabilities select _i); }; -_rand = random _sum; -_csum = [0, 0, 0, 0, 0, 0, 0, 0]; +private _rand = random _sum; +private _csum = [0, 0, 0, 0, 0, 0, 0, 0]; for "_i" from 0 to 7 do { for "_j" from 0 to _i do { _csum set [_i, (_csum select _i) + (_windDirectionProbabilities select _j)]; }; }; -_index = 0; +private _index = 0; for "_i" from 0 to 7 do { if (_rand > (_csum select _i)) then { _index = _index + 1; diff --git a/addons/weather/functions/fnc_serverController.sqf b/addons/weather/functions/fnc_serverController.sqf index 2cbdeb581e..9791049914 100644 --- a/addons/weather/functions/fnc_serverController.sqf +++ b/addons/weather/functions/fnc_serverController.sqf @@ -1,6 +1,5 @@ /* * Author: Ruthberg - * * Gather weather parameters and broadcast them to the clients * * Argument: @@ -8,11 +7,14 @@ * * Return value: * None + * + * Example: + * [] call ace_weather_fnc_serverController + * + * Public: No */ #include "script_component.hpp" -if (!GVAR(enableServerController)) exitWith {}; - if (GVAR(useACEWeather)) then { // Use location based real world weather data [] call FUNC(updateAceWeather); @@ -23,7 +25,9 @@ if (GVAR(useACEWeather)) then { publicVariable "ACE_RAIN_PARAMS"; }; if (GVAR(syncWind)) then { - ACE_WIND_PARAMS = [wind call CBA_fnc_vectDir, 0, vectorMagnitude wind, 0, GVAR(serverUpdateInterval)]; + //Wind _dir is the "source" of the wind [eg: "northerly wind": _dir = 0 -> wind = [0,-1,0];] + private _windDir = ((((wind select 0) atan2 (wind select 1)) + 180) % 360); + ACE_WIND_PARAMS = [_windDir, 0, vectorMagnitude wind, 0, GVAR(serverUpdateInterval)]; publicVariable "ACE_WIND_PARAMS"; }; if (GVAR(syncMisc)) then { diff --git a/addons/weather/functions/fnc_updateAceWeather.sqf b/addons/weather/functions/fnc_updateAceWeather.sqf index 029e1eb89b..2eb264d91b 100644 --- a/addons/weather/functions/fnc_updateAceWeather.sqf +++ b/addons/weather/functions/fnc_updateAceWeather.sqf @@ -1,6 +1,5 @@ /* * Author: ACE2 Team, esteldunedain, ruthberg - * * Updates the wind and rain evolution on the server. Broadcasts the current and next values to the clients * * Argument: @@ -8,40 +7,44 @@ * * Return value: * None + * + * Example: + * [] call ace_weather_fnc_updateAceWeather + * + * Public: No */ #include "script_component.hpp" -private ["_overcastMultiplier", "_lastRain", "_rainOverCast", "_transitionTime", "_windDirectionVariance", "_windSpeed", "_windSpeedChange", "_windMaxDiff", "_windMinDiff", "_windDirection", "_windDirectionChange", "_ratioMin", "_ratioMax"]; - -_overcastMultiplier = 1 max (2* overcast) min 2; // 0 (@ overcast 0), 2 (@ overcast 1) +private _overcastMultiplier = 1 max (2* overcast) min 2; // 0 (@ overcast 0), 2 (@ overcast 1) // Rain simulation -if (GVAR(syncRain) && GVAR(rain_period_count) > GVAR(rain_next_period)) then { +if (GVAR(syncRain) && {GVAR(rain_period_count) > GVAR(rain_next_period)}) then { GVAR(rain_next_period) = ceil((1 + (random 10)) / _overcastMultiplier); GVAR(rain_period_count) = 0; - - _lastRain = GVAR(current_rain); - + + private _lastRain = GVAR(current_rain); + private _rainOverCast = 0; + if (overcast >= 0.7) then { _rainOverCast = (overcast - 0.7) / 0.3; if (GVAR(current_rain) == 0) then { // Initialize rain with a random strength depending on the current overcast value GVAR(current_rain) = -0.25 + (random 0.75) + (random 0.5) * _rainOverCast; }; - + GVAR(current_rain) = GVAR(current_rain) + GVAR(current_rain) * ((_rainOverCast * _overcastMultiplier) / 8) * GVAR(rain_current_range); GVAR(current_rain) = 0 max GVAR(current_rain) min 1; - + GVAR(rain_current_range) = -1 + (random 2); } else { _rainOverCast = 1; - + GVAR(current_rain) = 0; }; - - _transitionTime = 1 + (_rainOverCast * 5) + (random (_rainOverCast * 20)); - + + private _transitionTime = 1 + (_rainOverCast * 5) + (random (_rainOverCast * 20)); + ACE_RAIN_PARAMS = [_lastRain, GVAR(current_rain), _transitionTime]; TRACE_4("",_lastRain,_rainOverCast,_transitionTime,overcast); @@ -50,47 +53,47 @@ if (GVAR(syncRain) && GVAR(rain_period_count) > GVAR(rain_next_period)) then { }; // Wind simulation -if (GVAR(syncWind) && GVAR(wind_period_count) > GVAR(wind_next_period)) then { - +if (GVAR(syncWind) && {GVAR(wind_period_count) > GVAR(wind_next_period)}) then { + GVAR(wind_next_period) = ceil((2 + (random 5)) / _overcastMultiplier); GVAR(wind_period_count) = 0; - - _windDirectionVariance = (90 - (random 180)) * (overcast ^ 2); - _windDirection = (360 + GVAR(wind_direction_reference) + _windDirectionVariance) % 360; - _windDirectionChange = _windDirection - GVAR(current_wind_direction); + + private _windDirectionVariance = (90 - (random 180)) * (overcast ^ 2); + private _windDirection = (360 + GVAR(wind_direction_reference) + _windDirectionVariance) % 360; + private _windDirectionChange = _windDirection - GVAR(current_wind_direction); if (_windDirectionChange > 180) then { _windDirectionChange = _windDirectionChange - 360; }; if (_windDirectionChange < -180) then { _windDirectionChange = 360 + _windDirectionChange; }; - - _windMaxDiff = GVAR(mean_wind_speed) - GVAR(max_wind_speed); - _windMinDiff = GVAR(min_wind_speed) - GVAR(mean_wind_speed); - - _ratioMax = (random 1) ^ 2; - _ratioMin = (random 1) ^ 2; - - _windSpeed = GVAR(current_wind_speed); - _windSpeedChange = 0; + + private _windMaxDiff = GVAR(mean_wind_speed) - GVAR(max_wind_speed); + private _windMinDiff = GVAR(min_wind_speed) - GVAR(mean_wind_speed); + + private _ratioMax = (random 1) ^ 2; + private _ratioMin = (random 1) ^ 2; + + private _windSpeed = GVAR(current_wind_speed); + private _windSpeedChange = 0; if ((random 1) < (0.3 max overcast)) then { _windSpeed = GVAR(mean_wind_speed) + _windMaxDiff * _ratioMax + _windMinDiff * _ratioMin; _windSpeedChange = _windSpeed - GVAR(current_wind_speed); }; - - _transitionTime = GVAR(wind_next_period) * GVAR(serverUpdateInterval); - + + private _transitionTime = GVAR(wind_next_period) * GVAR(serverUpdateInterval); + TRACE_5("dirCur/dirNew/spdCur/spdNew/period",GVAR(current_wind_direction),_windDirection,GVAR(current_wind_speed),_windSpeed,_transitionTime); - + ACE_WIND_PARAMS = [GVAR(current_wind_direction), - _windDirectionChange, - GVAR(current_wind_speed), - _windSpeedChange, - _transitionTime]; - + _windDirectionChange, + GVAR(current_wind_speed), + _windSpeedChange, + _transitionTime]; + GVAR(current_wind_direction) = _windDirection; GVAR(current_wind_speed) = _windSpeed; - + GVAR(wind_period_start_time) = ACE_time; publicVariable "ACE_WIND_PARAMS"; }; @@ -102,4 +105,4 @@ if (GVAR(syncMisc)) then { }; GVAR(rain_period_count) = GVAR(rain_period_count) + 1; -GVAR(wind_period_count) = GVAR(wind_period_count) + 1; \ No newline at end of file +GVAR(wind_period_count) = GVAR(wind_period_count) + 1; diff --git a/addons/weather/functions/fnc_updateHumidity.sqf b/addons/weather/functions/fnc_updateHumidity.sqf index df6e64df5d..3ea28d6a44 100644 --- a/addons/weather/functions/fnc_updateHumidity.sqf +++ b/addons/weather/functions/fnc_updateHumidity.sqf @@ -1,27 +1,30 @@ /* * Author: ACE2 Team - * - * Updates GVAR(currentHumidity) based on + * Updates GVAR(currentHumidity) * * Argument: * Nothing * * Return value: * Nothing + * + * Example: + * [] call ace_weather_fnc_updateHumidity + * + * Public: No */ #include "script_component.hpp" -private ["_month", "_avgTemperature", "_pS1", "_pS2"]; -_month = date select 1; +private _month = date select 1; GVAR(currentHumidity) = (GVAR(Humidity) select (_month - 1)) / 100; -if (rain > 0 && overcast > 0.7) then { +if ((rain > 0) && {overcast > 0.7}) then { GVAR(currentHumidity) = 1; } else { - _avgTemperature = ((GVAR(TempDay) select (_month - 1)) + (GVAR(TempNight) select (_month - 1))) / 2; - _pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature)); - _PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature))); + private _avgTemperature = ((GVAR(TempDay) select (_month - 1)) + (GVAR(TempNight) select (_month - 1))) / 2; + private _pS1 = 6.112 * exp((17.62 * _avgTemperature) / (243.12 + _avgTemperature)); + private _PS2 = 6.112 * exp((17.62 * GVAR(currentTemperature)) / (243.12 + GVAR(currentTemperature))); GVAR(currentHumidity) = GVAR(currentHumidity) * _PS1 / _PS2; GVAR(currentHumidity) = GVAR(currentHumidity) + GVAR(humidityShift); diff --git a/addons/weather/functions/fnc_updateRain.sqf b/addons/weather/functions/fnc_updateRain.sqf index 6c4c829747..8fa18500e8 100644 --- a/addons/weather/functions/fnc_updateRain.sqf +++ b/addons/weather/functions/fnc_updateRain.sqf @@ -1,6 +1,5 @@ /* * Author: ACE2 Team, Ruthberg - * * Updates rain based on ACE_RAIN_PARAMS * * Argument: @@ -8,17 +7,21 @@ * * Return value: * Nothing + * + * Example: + * [] call ace_weather_fnc_updateRain + * + * Public: No */ #include "script_component.hpp" -if (!GVAR(syncRain)) exitWith {}; - if (!isNil "ACE_RAIN_PARAMS") then { ACE_RAIN_PARAMS params ["_oldRain", "_newRain", "_period"]; - private ["_periodPosition", "_periodPercent"]; - _periodPosition = (ACE_time - GVAR(rain_period_start_time)) min _period; - _periodPercent = (_periodPosition / _period) min 1; + private _periodPosition = (ACE_time - GVAR(rain_period_start_time)) min _period; + private _periodPercent = (_periodPosition / _period) min 1; - GVAR(ACE_Rain) = (_oldRain + (_newRain - _oldRain) * _periodPercent); + GVAR(ACE_Rain) = linearConversion [GVAR(rain_period_start_time), (GVAR(rain_period_start_time) + _period), ACE_time, _oldRain, _newRain]; + + TRACE_3("Update Rain",rain,ACE_RAIN_PARAMS,GVAR(ACE_Rain)); }; diff --git a/addons/weather/functions/fnc_updateTemperature.sqf b/addons/weather/functions/fnc_updateTemperature.sqf index 82f126e33f..9ff11859f4 100644 --- a/addons/weather/functions/fnc_updateTemperature.sqf +++ b/addons/weather/functions/fnc_updateTemperature.sqf @@ -1,6 +1,5 @@ /* * Author: ACE2 Team - * * Updates GVAR(currentTemperature) based on the map data * * Argument: @@ -8,14 +7,18 @@ * * Return value: * Nothing + * + * Example: + * [] call ace_weather_fnc_updateTemperature + * + * Public: No */ #include "script_component.hpp" -private ["_time", "_month", "_timeRatio"]; -_time = daytime; -_month = date select 1; +private _time = daytime; +private _month = date select 1; -_timeRatio = abs(_time - 12) / 12; +private _timeRatio = abs(_time - 12) / 12; GVAR(currentTemperature) = (GVAR(TempDay) select (_month - 1)) * (1 - _timeRatio) + (GVAR(TempNight) select (_month - 1)) * _timeRatio; GVAR(currentTemperature) = GVAR(currentTemperature) + GVAR(temperatureShift) - GVAR(badWeatherShift) * overcast; diff --git a/addons/weather/functions/fnc_updateWind.sqf b/addons/weather/functions/fnc_updateWind.sqf index b362458fdb..75724e3674 100644 --- a/addons/weather/functions/fnc_updateWind.sqf +++ b/addons/weather/functions/fnc_updateWind.sqf @@ -1,6 +1,5 @@ /* * Author: ACE2 Team, Ruthberg - * * Updates wind, gusts and waves based on ACE_wind * * Argument: @@ -8,19 +7,22 @@ * * Return value: * Nothing + * + * Example: + * [] call ace_weather_fnc_updateWind + * + * Public: No */ #include "script_component.hpp" if (!GVAR(syncWind)) exitWith { ACE_wind = wind }; -private ["_newWaves"]; - ACE_wind = [] call FUNC(getWind); setWind [ACE_wind select 0, ACE_wind select 1, true]; 2 setGusts 0; // Set waves: 0 when no wind, 1 when wind >= 16 m/s -_newWaves = ((vectorMagnitude ACE_wind) / 16.0) min 1.0; +private _newWaves = ((vectorMagnitude ACE_wind) / 16.0) min 1.0; if (abs(_newWaves - waves) > 0.1) then { 1 setWaves _newWaves; }; diff --git a/addons/weather/script_component.hpp b/addons/weather/script_component.hpp index 2a6aeb0393..84d7e9987b 100644 --- a/addons/weather/script_component.hpp +++ b/addons/weather/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT weather #include "\z\ace\addons\main\script_mod.hpp" -//#define DEBUG_ENABLED_WEATHER + +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_WEATHER #define DEBUG_MODE_FULL #endif diff --git a/addons/weather/stringtable.xml b/addons/weather/stringtable.xml index d6129f67e5..584831064c 100644 --- a/addons/weather/stringtable.xml +++ b/addons/weather/stringtable.xml @@ -1,4 +1,4 @@ - + @@ -10,7 +10,7 @@ Mostra informazioni sul vento Zeige Windinformationen Széladatok mutatása - Zobrazit informace o větru + Zobrazit údaje o větru Mostrar informação do vento @@ -168,4 +168,4 @@ Определяет интервал (в секундах) между обновлениями погоды - + \ No newline at end of file diff --git a/addons/winddeflection/functions/script_component.hpp b/addons/winddeflection/functions/script_component.hpp index eb67fc3887..ea22ecb35c 100644 --- a/addons/winddeflection/functions/script_component.hpp +++ b/addons/winddeflection/functions/script_component.hpp @@ -1,12 +1 @@ -#define COMPONENT windDeflection -#include "\z\ace\addons\main\script_mod.hpp" - -#ifdef DEBUG_ENABLED_WINDDEFLECTION - #define DEBUG_MODE_FULL -#endif - -#ifdef DEBUG_SETTINGS_WINDDEFLECTION - #define DEBUG_SETTINGS DEBUG_SETTINGS_WINDDEFLECTION -#endif - -#include "\z\ace\addons\main\script_macros.hpp" \ No newline at end of file +#include "\z\ace\addons\winddeflection\script_component.hpp" diff --git a/addons/winddeflection/script_component.hpp b/addons/winddeflection/script_component.hpp index 4af43227de..e4cc1df840 100644 --- a/addons/winddeflection/script_component.hpp +++ b/addons/winddeflection/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT winddeflection #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_WINDDEFLECTION #define DEBUG_MODE_FULL #endif diff --git a/addons/yardage450/script_component.hpp b/addons/yardage450/script_component.hpp index abff262efc..d49c301359 100644 --- a/addons/yardage450/script_component.hpp +++ b/addons/yardage450/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT yardage450 #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_YARDAGE450 #define DEBUG_MODE_FULL #endif diff --git a/addons/zeus/CfgVehicles.hpp b/addons/zeus/CfgVehicles.hpp index f5144e60e6..c80fed4a5b 100644 --- a/addons/zeus/CfgVehicles.hpp +++ b/addons/zeus/CfgVehicles.hpp @@ -167,4 +167,23 @@ class CfgVehicles { sync[] = {}; }; }; + + class GVAR(moduleSetSuppression): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleSetSupp_DisplayName); + function = QFUNC(moduleSetSuppression); + class ModuleDescription { + description = "Set group of units to supressed."; + sync[] = {}; + }; + }; + class GVAR(moduleDisableSuppression): GVAR(moduleBase) { + curatorCanAttach = 1; + displayName = CSTRING(ModuleDisableSupp_DisplayName); + function = QFUNC(moduleDisableSuppression); + class ModuleDescription { + description = "Remove suppression for units in group"; + sync[] = {}; + }; + }; }; diff --git a/addons/zeus/script_component.hpp b/addons/zeus/script_component.hpp index 7211b28f7d..cb0fa29be3 100644 --- a/addons/zeus/script_component.hpp +++ b/addons/zeus/script_component.hpp @@ -1,6 +1,11 @@ #define COMPONENT zeus #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL +// #define DISABLE_COMPILE_CACHE +// #define CBA_DEBUG_SYNCHRONOUS +// #define ENABLE_PERFORMANCE_COUNTERS + #ifdef DEBUG_ENABLED_ZEUS #define DEBUG_MODE_FULL #endif diff --git a/extensions/parse_imagepath/ace_parse_imagepath.cpp b/extensions/parse_imagepath/ace_parse_imagepath.cpp index 56d503cbaf..fa1a8643e7 100644 --- a/extensions/parse_imagepath/ace_parse_imagepath.cpp +++ b/extensions/parse_imagepath/ace_parse_imagepath.cpp @@ -17,7 +17,7 @@ #include extern "C" { - __declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function); + EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function); } std::string getImagePathFromStructuredText(const std::string & input) { diff --git a/extras/assets/icons/Icon_Module_png/Icon_Module_Cargo_makeLoadable_ca.png b/extras/assets/icons/Icon_Module_png/Icon_Module_Cargo_makeLoadable_ca.png new file mode 100644 index 0000000000..a719c13aa7 Binary files /dev/null and b/extras/assets/icons/Icon_Module_png/Icon_Module_Cargo_makeLoadable_ca.png differ diff --git a/optionals/compat_rhs_afrf3/CfgWeapons.hpp b/optionals/compat_rhs_afrf3/CfgWeapons.hpp index 32c1f590c5..367045236f 100644 --- a/optionals/compat_rhs_afrf3/CfgWeapons.hpp +++ b/optionals/compat_rhs_afrf3/CfgWeapons.hpp @@ -51,7 +51,13 @@ class CfgWeapons { class rhs_acc_pso1m2: rhs_acc_sniper_base { ACE_ScopeAdjust_Vertical[] = { 0, 0 }; ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; - ACE_ScopeAdjust_VerticalIncrement = 0.0; + ACE_ScopeAdjust_VerticalIncrement = 0.5; + ACE_ScopeAdjust_HorizontalIncrement = 0.5; + }; + class rhs_acc_pso1m21: rhs_acc_sniper_base { + ACE_ScopeAdjust_Vertical[] = { 0, 0 }; + ACE_ScopeAdjust_Horizontal[] = { -10, 10 }; + ACE_ScopeAdjust_VerticalIncrement = 0.5; ACE_ScopeAdjust_HorizontalIncrement = 0.5; }; @@ -79,4 +85,4 @@ class CfgWeapons { ace_hearing_protection = 0.5; ace_hearing_lowerVolume = 0.60; }; -}; \ No newline at end of file +}; diff --git a/optionals/compat_rhs_usf3/CfgWeapons.hpp b/optionals/compat_rhs_usf3/CfgWeapons.hpp index becb91ada1..c49b9bc5e4 100644 --- a/optionals/compat_rhs_usf3/CfgWeapons.hpp +++ b/optionals/compat_rhs_usf3/CfgWeapons.hpp @@ -115,31 +115,31 @@ class CfgWeapons class rhs_weap_mk18: rhs_weap_m4a1 { ACE_barrelTwist = 177.8; ACE_barrelLength = 261.62; - ACE_Overheating_Dispersion[] = {0, 0.001, 0.002, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + ACE_Overheating_dispersion = 1; + ACE_Overheating_slowdownFactor = 1; + ACE_Overheating_mrbs = 3000; }; class rhs_weap_m16a4: rhs_weap_m4_Base { ACE_barrelTwist = 177.8; ACE_barrelLength = 508.0; }; - class rhs_weap_lmg_minimipara; + class rhs_weap_lmg_minimipara; class rhs_weap_lmg_minimi_railed : rhs_weap_lmg_minimipara { ACE_barrelLength = 465.0; ACE_barrelTwist = 177.8; ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.003}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + ACE_Overheating_dispersion = 0.75; + ACE_Overheating_slowdownFactor = 1; + ACE_Overheating_mrbs = 3000; }; class rhs_weap_m240_base; class rhs_weap_m240B: rhs_weap_m240_base { ACE_barrelTwist = 304.8; ACE_barrelLength = 629.92; ACE_Overheating_allowSwapBarrel = 1; - ACE_Overheating_Dispersion[] = {0, -0.001, 0.001, 0.004}; - ACE_Overheating_SlowdownFactor[] = {1, 1, 1, 0.9}; - ACE_Overheating_JamChance[] = {0, 0.0003, 0.0015, 0.0075}; + ACE_Overheating_dispersion = 1; + ACE_Overheating_slowdownFactor = 1; + ACE_Overheating_mrbs = 3000; }; class rhs_weap_m14ebrri: srifle_EBR_F { ACE_barrelTwist = 304.8; diff --git a/tools/config_validator.py b/tools/config_validator.py new file mode 100644 index 0000000000..790734101f --- /dev/null +++ b/tools/config_validator.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 + +#by PabstMirror - python script to verify all addons using MakePbo's lint checking and extFile Checking +#Arguments (eg: `config_validator.py full`): +#full dump full deRaped config of problem +#skipExt skips checking external file references + +import os +import sys +import subprocess +import timeit +import time + +######## GLOBALS ######### +MAINPREFIX = "Z" +PREFIX = "ACE" +########################## + +def Fract_Sec(s): + temp = float() + temp = float(s) / (60*60*24) + d = int(temp) + temp = (temp - d) * 24 + h = int(temp) + temp = (temp - h) * 60 + m = int(temp) + temp = (temp - m) * 60 + sec = temp + return d,h,m,sec + +def CheckPBO(p,makePboArgs,errors): + try: + subprocess.run([ + "makepbo", + makePboArgs, + "-@={}\\{}\\addons\\{}".format(MAINPREFIX,PREFIX.rstrip("_"),p), + p, + "{}_{}.pbo".format(PREFIX,p) + ], stdin=None, input=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True) + except subprocess.CalledProcessError as e: + print("!! Problem With {} ret {} !!".format(p, e.returncode)) + print(" stderr: {}".format(e.stderr)) + errors.append(p) + else: + print(" Checked ok {}".format(p)) + return + +def fullDump(p): + try: + subprocess.run([ + "makepbo", + "-PQGs", #Q Lint only - Gs Check external references and show deRap - P dont pause + "-@={}\\{}\\addons\\{}".format(MAINPREFIX,PREFIX.rstrip("_"),p), + p, + "{}_{}.pbo".format(PREFIX,p) + ], stdin=None, input=None, check=True) + except subprocess.CalledProcessError as e: + input("Press Enter to continue...") + return + +def main(argv): + print(""" + #################### + # ACE3 Config Check # + #################### +""") + + start_time = timeit.default_timer() + + addonspath = os.path.join("P:\\",MAINPREFIX,PREFIX,"addons") + + print("Switching to dir: {}".format(addonspath)) + try: + os.chdir(addonspath) + except: + raise Exception("Failed to switch to addon dir on P:") + + #Q Lint only - G Check external references - P dont pause (Gs) does full derap + makePboArgs = "-PQG" + if "skipExt" in argv: + print("Skipping External Files Check"); + makePboArgs = "-PQ" + + errors = [] + + for p in os.listdir(addonspath): + path = os.path.join(addonspath, p) + if not os.path.isdir(path): + continue + if p[0] == ".": + continue + CheckPBO(p,makePboArgs,errors) + + + d,h,m,s = Fract_Sec(timeit.default_timer() - start_time) + print("\n# Done with {0} errrors [took: {1:2}h {2:2}m {3:4.5f}s]".format(len(errors),h,m,s)) + + if (len(errors) > 0): + if "full" in argv: + input("Dumping Full DeRap: Press Enter to continue...") + for p in errors: + fullDump(p) + else: + print("use 'full' arg to show derap") + + ret = len(errors) + print("return {}".format(ret)) + return ret + +if __name__ == "__main__": + main(sys.argv) diff --git a/tools/make.py b/tools/make.py index 496a6bdf67..da14ea026e 100644 --- a/tools/make.py +++ b/tools/make.py @@ -73,8 +73,8 @@ dssignfile = "" prefix = "ace" pbo_name_prefix = "ace_" signature_blacklist = ["ace_server.pbo"] -importantFiles = ["mod.cpp", "README.md", "AUTHORS.txt", "LICENSE", "logo_ace3_ca.paa"] -versionFiles = ["README.md", "mod.cpp"] +importantFiles = ["mod.cpp", "README.md", "docs\\README_DE.md", "docs\\README_PL.md", "AUTHORS.txt", "LICENSE", "logo_ace3_ca.paa"] +versionFiles = ["README.md", "docs\\README_DE.md", "docs\\README_PL.md", "mod.cpp"] ############################################################################### # http://akiscode.com/articles/sha-1directoryhash.shtml @@ -330,15 +330,20 @@ def copy_important_files(source_dir,destination_dir): originalDir = os.getcwd() - #copy importantFiles + # Copy importantFiles try: print_blue("\nSearching for important files in {}".format(source_dir)) print("Source_dir: {}".format(source_dir)) print("Destination_dir: {}".format(destination_dir)) for file in importantFiles: + filePath = os.path.join(module_root_parent, file) + # Take only file name for destination path (to put it into root of release dir) + if "\\" in file: + count = file.count("\\") + file = file.split("\\", count)[-1] print_green("Copying file => {}".format(os.path.join(source_dir,file))) - shutil.copyfile(os.path.join(source_dir,file),os.path.join(destination_dir,file)) + shutil.copyfile(os.path.join(source_dir,filePath),os.path.join(destination_dir,file)) except: print_error("COPYING IMPORTANT FILES.") raise @@ -626,6 +631,10 @@ def stash_version_files_for_building(): try: for file in versionFiles: filePath = os.path.join(module_root_parent, file) + # Take only file name for stash location if in subfolder (otherwise it gets removed when removing folders from release dir) + if "\\" in file: + count = file.count("\\") + file = file.split("\\", count)[-1] stashPath = os.path.join(release_dir, file) print("Temporarily stashing {} => {}.bak for version update".format(filePath, stashPath)) shutil.copy(filePath, "{}.bak".format(stashPath)) @@ -642,6 +651,10 @@ def restore_version_files(): try: for file in versionFiles: filePath = os.path.join(module_root_parent, file) + # Take only file name for stash path if in subfolder (otherwise it gets removed when removing folders from release dir) + if "\\" in file: + count = file.count("\\") + file = file.split("\\", count)[-1] stashPath = os.path.join(release_dir, file) print("Restoring {}".format(filePath)) shutil.move("{}.bak".format(stashPath), filePath)