From a3e1e124f244479e5f49f1fffe299851b21dba03 Mon Sep 17 00:00:00 2001 From: licht-im-Norden87 Date: Mon, 14 Dec 2015 16:56:47 +0100 Subject: [PATCH 01/34] Update README_DE.md --- docs/README_DE.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/README_DE.md b/docs/README_DE.md index a51c562de8..4eda6546c7 100644 --- a/docs/README_DE.md +++ b/docs/README_DE.md @@ -1,21 +1,22 @@

+

- ACE3 Version + ACE3 Version - - ACE3 Download + + ACE3 Download - ACE3 Issues + ACE3        Fehlermeldungen BIF Thread - ACE3 License + ACE3 Lizenz ACE3 Slack @@ -24,7 +25,11 @@ ACE3 Build Status

-

Benötigt die aktuellste Version von CBA A3. Besucht uns auf Facebook | YouTube | Twitter | Reddit

+ +

+ Benötigt die aktuellste Version vonCBA A3.
+ Besucht uns auf Twitter | Facebook | YouTube | Reddit
+

**ACE3** ist ein Gemeinschaftsprojekt der sich zusammengeschlossenen Moddinggruppen von **ACE2**, **AGM** und **CSE** mit dem Ziel den Realismus und die Spieltiefe von Arma 3 zu steigern. From 999a6cd29d6b7ffcf8b404e85a0191b104dc4558 Mon Sep 17 00:00:00 2001 From: licht-im-Norden87 Date: Mon, 14 Dec 2015 16:58:00 +0100 Subject: [PATCH 02/34] Update README_DE.md --- docs/README_DE.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/README_DE.md b/docs/README_DE.md index 4eda6546c7..98e41d1ae0 100644 --- a/docs/README_DE.md +++ b/docs/README_DE.md @@ -10,7 +10,7 @@ ACE3 Download - ACE3        Fehlermeldungen + ACE3 Fehlermeldungen BIF Thread @@ -25,7 +25,6 @@ ACE3 Build Status

-

Benötigt die aktuellste Version vonCBA A3.
Besucht uns auf Twitter | Facebook | YouTube | Reddit
From 89354e25c86f478bb6bb2030db5d2b10315faf98 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 16:09:48 -0300 Subject: [PATCH 03/34] Unified fired event handler --- addons/common/CfgEventHandlers.hpp | 5 +++ addons/common/XEH_preInit.sqf | 1 + addons/common/functions/fnc_firedEH.sqf | 51 +++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 addons/common/functions/fnc_firedEH.sqf diff --git a/addons/common/CfgEventHandlers.hpp b/addons/common/CfgEventHandlers.hpp index 55a1df4c7c..1afbe16512 100644 --- a/addons/common/CfgEventHandlers.hpp +++ b/addons/common/CfgEventHandlers.hpp @@ -59,3 +59,8 @@ class Extended_Local_EventHandlers { }; }; +class Extended_FiredBIS_EventHandlers { + class All { + ADDON = QUOTE(_this call FUNC(firedEH)); + }; +}; diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index ea5157c2e6..f119b99468 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -47,6 +47,7 @@ PREP(execRemoteFnc); PREP(executePersistent); PREP(filter); PREP(findUnloadPosition); +PREP(firedEH); PREP(fixCollision); PREP(fixFloating); PREP(fixLoweredRifleAnimation); diff --git a/addons/common/functions/fnc_firedEH.sqf b/addons/common/functions/fnc_firedEH.sqf new file mode 100644 index 0000000000..c1bb1d77dc --- /dev/null +++ b/addons/common/functions/fnc_firedEH.sqf @@ -0,0 +1,51 @@ +/* + * Author: esteldunedain + * Unfied handling of 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 ["_firedEHUnit", "_firedEHWeapon", "_firedEHMuzzle", "_firedEHMode", "_firedEHAmmo", "_firedEHMagazine", "_firedEHProjectile"]; +TRACE_5("firedEH:",_firedEHUnit, _firedEHWeapon, _firedEHMuzzle, _firedEHMode, _firedEHAmmo, _firedEHMagazine, _firedEHProjectile); + +if (_firedEHUnit isKindOf "CAManBase") then { + // The unit it on foot + if (_firedEHUnit == ACE_player) then { + ["firedPlayer", this] call FUNC(localEvent); + } else { + if ([_firedEHUnit] call EFUNC(common,isPlayer)) then { + ["firedPlayerNonLocal", this] call FUNC(localEvent); + } else { + ["firedNonPlayer", this] call FUNC(localEvent); + }; + }; +} else { + // The unit is a vehicle + private _firedEHGunner = [_firedEHUnit, _firedEHWeapon] call EFUNC(common,getGunner); + if (_firedEHGunner == ACE_player) then { + ["firedPlayerVehicle", this] call FUNC(localEvent); + } else { + if ([_firedEHGunner] call EFUNC(common,isPlayer)) then { + ["firedPlayerVehicleNonLocal", this] call FUNC(localEvent); + } else { + ["firedNonPlayerVehicle", this] call FUNC(localEvent); + }; + }; +}; + +END_COUNTER(firedEH); From 588f76b3f13bd6622aa4bf752f5f3160cb465b25 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 16:12:18 -0300 Subject: [PATCH 04/34] Learning to count --- addons/common/functions/fnc_firedEH.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_firedEH.sqf b/addons/common/functions/fnc_firedEH.sqf index c1bb1d77dc..911e122214 100644 --- a/addons/common/functions/fnc_firedEH.sqf +++ b/addons/common/functions/fnc_firedEH.sqf @@ -21,7 +21,7 @@ BEGIN_COUNTER(firedEH); params ["_firedEHUnit", "_firedEHWeapon", "_firedEHMuzzle", "_firedEHMode", "_firedEHAmmo", "_firedEHMagazine", "_firedEHProjectile"]; -TRACE_5("firedEH:",_firedEHUnit, _firedEHWeapon, _firedEHMuzzle, _firedEHMode, _firedEHAmmo, _firedEHMagazine, _firedEHProjectile); +TRACE_7("firedEH:",_firedEHUnit, _firedEHWeapon, _firedEHMuzzle, _firedEHMode, _firedEHAmmo, _firedEHMagazine, _firedEHProjectile); if (_firedEHUnit isKindOf "CAManBase") then { // The unit it on foot From 72b262f634d7b64347787f3516e7f4eae7166c22 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 16:22:23 -0300 Subject: [PATCH 05/34] Simplified parameter names --- addons/common/functions/fnc_firedEH.sqf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/common/functions/fnc_firedEH.sqf b/addons/common/functions/fnc_firedEH.sqf index 911e122214..6a6b36116e 100644 --- a/addons/common/functions/fnc_firedEH.sqf +++ b/addons/common/functions/fnc_firedEH.sqf @@ -20,15 +20,15 @@ BEGIN_COUNTER(firedEH); -params ["_firedEHUnit", "_firedEHWeapon", "_firedEHMuzzle", "_firedEHMode", "_firedEHAmmo", "_firedEHMagazine", "_firedEHProjectile"]; -TRACE_7("firedEH:",_firedEHUnit, _firedEHWeapon, _firedEHMuzzle, _firedEHMode, _firedEHAmmo, _firedEHMagazine, _firedEHProjectile); +params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; +TRACE_7("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile); -if (_firedEHUnit isKindOf "CAManBase") then { +if (_unit isKindOf "CAManBase") then { // The unit it on foot - if (_firedEHUnit == ACE_player) then { + if (_unit == ACE_player) then { ["firedPlayer", this] call FUNC(localEvent); } else { - if ([_firedEHUnit] call EFUNC(common,isPlayer)) then { + if ([_unit] call EFUNC(common,isPlayer)) then { ["firedPlayerNonLocal", this] call FUNC(localEvent); } else { ["firedNonPlayer", this] call FUNC(localEvent); @@ -36,11 +36,11 @@ if (_firedEHUnit isKindOf "CAManBase") then { }; } else { // The unit is a vehicle - private _firedEHGunner = [_firedEHUnit, _firedEHWeapon] call EFUNC(common,getGunner); - if (_firedEHGunner == ACE_player) then { + private _Gunner = [_unit, _weapon] call EFUNC(common,getGunner); + if (_Gunner == ACE_player) then { ["firedPlayerVehicle", this] call FUNC(localEvent); } else { - if ([_firedEHGunner] call EFUNC(common,isPlayer)) then { + if ([_Gunner] call EFUNC(common,isPlayer)) then { ["firedPlayerVehicleNonLocal", this] call FUNC(localEvent); } else { ["firedNonPlayerVehicle", this] call FUNC(localEvent); From 6d9068e3068e84101804db01b6dfb1885a12d4a2 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 16:26:57 -0300 Subject: [PATCH 06/34] gunner to lowercase --- addons/common/functions/fnc_firedEH.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/common/functions/fnc_firedEH.sqf b/addons/common/functions/fnc_firedEH.sqf index 6a6b36116e..5e6e5bb833 100644 --- a/addons/common/functions/fnc_firedEH.sqf +++ b/addons/common/functions/fnc_firedEH.sqf @@ -36,11 +36,11 @@ if (_unit isKindOf "CAManBase") then { }; } else { // The unit is a vehicle - private _Gunner = [_unit, _weapon] call EFUNC(common,getGunner); - if (_Gunner == ACE_player) then { + private _gunner = [_unit, _weapon] call EFUNC(common,getGunner); + if (_gunner == ACE_player) then { ["firedPlayerVehicle", this] call FUNC(localEvent); } else { - if ([_Gunner] call EFUNC(common,isPlayer)) then { + if ([_gunner] call EFUNC(common,isPlayer)) then { ["firedPlayerVehicleNonLocal", this] call FUNC(localEvent); } else { ["firedNonPlayerVehicle", this] call FUNC(localEvent); From b2bd11ed77086dbcf9885ef5d0bf8377a8a6b2b4 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 16:29:58 -0300 Subject: [PATCH 07/34] Apply the ufeh to ACE_FCS --- addons/fcs/CfgEventHandlers.hpp | 33 ---------------------------- addons/fcs/XEH_postInit.sqf | 4 ++++ addons/fcs/functions/fnc_firedEH.sqf | 9 +++----- 3 files changed, 7 insertions(+), 39 deletions(-) diff --git a/addons/fcs/CfgEventHandlers.hpp b/addons/fcs/CfgEventHandlers.hpp index ab41fa904b..8c5b768ca9 100644 --- a/addons/fcs/CfgEventHandlers.hpp +++ b/addons/fcs/CfgEventHandlers.hpp @@ -76,36 +76,3 @@ class Extended_Respawn_EventHandlers { }; }; }; - -class Extended_FiredBIS_EventHandlers { - class Tank { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; - class Car { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; - class Helicopter { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; - class Plane { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; - class Ship_F { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; - class StaticWeapon { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; -}; diff --git a/addons/fcs/XEH_postInit.sqf b/addons/fcs/XEH_postInit.sqf index a4f8020a9f..25fd09ba8c 100644 --- a/addons/fcs/XEH_postInit.sqf +++ b/addons/fcs/XEH_postInit.sqf @@ -15,5 +15,9 @@ if (!hasInterface) exitWith {}; }; }] call EFUNC(common,addEventHandler); +// Register fire event handler +["firedPlayerVehicle", DFUNC(firedEH)] call EFUNC(common,addEventHandler); +["firedPlayerVehicleNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + // Register event for global updates [QGVAR(forceUpdate), {[ACE_player] call FUNC(onForceUpdate)}] call EFUNC(common,addEventHandler); diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index 237aed8ac1..e407b44293 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -1,9 +1,9 @@ /* * Author: KoffeinFlummi - * Adjusts the direction of a shell. + * Adjusts the direction of a shell. Only gets called if the gunner is a player * * Arguments: - * -> arguments of the FiredBIS EH + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None @@ -12,9 +12,6 @@ */ #include "script_component.hpp" -params ["_vehicle", "_weapon", "", "", "_ammo", "_magazine", "_projectile"]; - -private _gunner = [_vehicle, _weapon] call EFUNC(common,getGunner); private _turret = _gunner call EFUNC(common,getTurretIndex); // Exit if the unit isn't a player @@ -36,7 +33,7 @@ private _offset = 0; [_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection); -// Remove the platform velocity +// Remove the platform velocity if (vectorMagnitude velocity _vehicle > 2) then { private _sumVelocity = (velocity _projectile) vectorDiff (velocity _vehicle); From a084373574edc1d0b79635e304520df40dfedc0b Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 16:39:08 -0300 Subject: [PATCH 08/34] Apply the ufeh to ACE_Disposable --- addons/disposable/CfgEventHandlers.hpp | 8 -------- addons/disposable/XEH_postInit.sqf | 5 +++++ addons/disposable/functions/fnc_replaceATWeapon.sqf | 11 +---------- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/addons/disposable/CfgEventHandlers.hpp b/addons/disposable/CfgEventHandlers.hpp index 98fec255c2..c236fb6f57 100644 --- a/addons/disposable/CfgEventHandlers.hpp +++ b/addons/disposable/CfgEventHandlers.hpp @@ -10,14 +10,6 @@ class Extended_PostInit_EventHandlers { }; }; -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - firedBIS = QUOTE(_this call FUNC(replaceATWeapon)); - }; - }; -}; - // handle preloaded missile class Extended_InitPost_EventHandlers { class CAManBase { diff --git a/addons/disposable/XEH_postInit.sqf b/addons/disposable/XEH_postInit.sqf index 800d749d06..5c4ddafe95 100644 --- a/addons/disposable/XEH_postInit.sqf +++ b/addons/disposable/XEH_postInit.sqf @@ -12,3 +12,8 @@ if (!hasInterface) exitWith {}; [_unit] call FUNC(takeLoadedATWeapon); [_unit] call FUNC(updateInventoryDisplay); }] call EFUNC(common,addEventHandler); + +// Register fire event handler +// Only for the local player and for AI. Non-local players will handle it themselves +["firedPlayer", DFUNC(replaceATWeapon)] call EFUNC(common,addEventHandler); +["firedNonPlayer", DFUNC(replaceATWeapon)] call EFUNC(common,addEventHandler); diff --git a/addons/disposable/functions/fnc_replaceATWeapon.sqf b/addons/disposable/functions/fnc_replaceATWeapon.sqf index 88e27190ed..3e1b8afff8 100644 --- a/addons/disposable/functions/fnc_replaceATWeapon.sqf +++ b/addons/disposable/functions/fnc_replaceATWeapon.sqf @@ -3,13 +3,7 @@ * Replace the disposable launcher with the used dummy. * * Arguments: - * 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 + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * Nothing @@ -21,9 +15,6 @@ */ #include "script_component.hpp" -params ["_unit", "_weapon", "", "", "", "", "_projectile"]; -TRACE_3("params",_unit,_weapon,_projectile); - if (!local _unit || {_weapon != secondaryWeapon _unit}) exitWith {}; private _replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube"); From 59cbc6da10e91ceadf23181cecc3a12711190bf2 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 16:49:27 -0300 Subject: [PATCH 09/34] Remove unneeded test in FCS fireEH --- addons/fcs/functions/fnc_firedEH.sqf | 3 --- 1 file changed, 3 deletions(-) diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index e407b44293..4c101b9292 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -14,9 +14,6 @@ private _turret = _gunner call EFUNC(common,getTurretIndex); -// Exit if the unit isn't a player -if !([_gunner] call EFUNC(common,isPlayer)) exitWith {}; - private _FCSMagazines = _vehicle getVariable [format ["%1_%2", QGVAR(Magazines), _turret], []]; private _FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret]; From efbff8cc231db1d30bc2aeaf3fca2e8ac8dbdeaf Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 16:49:53 -0300 Subject: [PATCH 10/34] Pass the turret path too --- addons/common/functions/fnc_firedEH.sqf | 18 +++++++++++++++++- addons/fcs/functions/fnc_firedEH.sqf | 2 -- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/addons/common/functions/fnc_firedEH.sqf b/addons/common/functions/fnc_firedEH.sqf index 5e6e5bb833..ce16b6dc2c 100644 --- a/addons/common/functions/fnc_firedEH.sqf +++ b/addons/common/functions/fnc_firedEH.sqf @@ -36,7 +36,23 @@ if (_unit isKindOf "CAManBase") then { }; } else { // The unit is a vehicle - private _gunner = [_unit, _weapon] call EFUNC(common,getGunner); + + // Get the gunner and turret path. + // Code based on FUNC(getGunner), extracted for efficency. + private _gunner = objNull; + private _turret = []; + { + if (_weapon in (_unit weaponsTurret _x)) exitWith { + _gunner = _unit turretUnit _x; + _turret = _x; + }; + false + } count allTurrets [_unit, true]; + // Ensure that at least the pilot is returned if there is no gunner + if (isManualFire _unit && {isNull _gunner}) then { + _gunner = driver _unit; + }; + if (_gunner == ACE_player) then { ["firedPlayerVehicle", this] call FUNC(localEvent); } else { diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index 4c101b9292..29149eb19b 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -12,8 +12,6 @@ */ #include "script_component.hpp" -private _turret = _gunner call EFUNC(common,getTurretIndex); - private _FCSMagazines = _vehicle getVariable [format ["%1_%2", QGVAR(Magazines), _turret], []]; private _FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret]; From 37bc67c951e9272e6fa328185a11c4771122d876 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 16:55:36 -0300 Subject: [PATCH 11/34] Create a _vehicle variable --- addons/common/functions/fnc_firedEH.sqf | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/common/functions/fnc_firedEH.sqf b/addons/common/functions/fnc_firedEH.sqf index ce16b6dc2c..749364ee86 100644 --- a/addons/common/functions/fnc_firedEH.sqf +++ b/addons/common/functions/fnc_firedEH.sqf @@ -36,6 +36,7 @@ if (_unit isKindOf "CAManBase") then { }; } else { // The unit is a vehicle + private _vehicle = _unit; // Get the gunner and turret path. // Code based on FUNC(getGunner), extracted for efficency. From fe66d932758673c584904d5debe100f17360295b Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 17:07:05 -0300 Subject: [PATCH 12/34] Added ignore private warnings + trace --- addons/disposable/functions/fnc_replaceATWeapon.sqf | 5 ++++- addons/fcs/functions/fnc_firedEH.sqf | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/disposable/functions/fnc_replaceATWeapon.sqf b/addons/disposable/functions/fnc_replaceATWeapon.sqf index 3e1b8afff8..58c58a6056 100644 --- a/addons/disposable/functions/fnc_replaceATWeapon.sqf +++ b/addons/disposable/functions/fnc_replaceATWeapon.sqf @@ -1,6 +1,6 @@ /* * Author: bux, commy2 - * Replace the disposable launcher with the used dummy. + * Replace the disposable launcher with the used dummy. Called from the unified fired EH. * * Arguments: * None. Parameters inherited from EFUNC(common,firedEH) @@ -15,6 +15,9 @@ */ #include "script_component.hpp" +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); + if (!local _unit || {_weapon != secondaryWeapon _unit}) exitWith {}; private _replacementTube = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_UsedTube"); diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index 29149eb19b..a9f4975780 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -1,6 +1,6 @@ /* * Author: KoffeinFlummi - * Adjusts the direction of a shell. Only gets called if the gunner is a player + * Adjusts the direction of a shell. Called from the unified fired EH only if the gunner is a player. * * Arguments: * None. Parameters inherited from EFUNC(common,firedEH) @@ -12,6 +12,9 @@ */ #include "script_component.hpp" +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); + private _FCSMagazines = _vehicle getVariable [format ["%1_%2", QGVAR(Magazines), _turret], []]; private _FCSElevation = _vehicle getVariable format ["%1_%2", QGVAR(Elevation), _turret]; From b70ae9207c9ac6b14bce17023d1f38bce8ed19b4 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 17:12:28 -0300 Subject: [PATCH 13/34] Apply the ufeh to ACE_Frag --- addons/frag/CfgEventhandlers.hpp | 6 ----- addons/frag/XEH_postInit.sqf | 16 ++++++++++++- addons/frag/functions/fnc_fired.sqf | 35 ++++++++++++++--------------- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/addons/frag/CfgEventhandlers.hpp b/addons/frag/CfgEventhandlers.hpp index df7eaeacd1..3b3f4898e5 100644 --- a/addons/frag/CfgEventhandlers.hpp +++ b/addons/frag/CfgEventhandlers.hpp @@ -9,9 +9,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class AllVehicles { - ADDON = QUOTE(_this call FUNC(fired)); - }; -}; diff --git a/addons/frag/XEH_postInit.sqf b/addons/frag/XEH_postInit.sqf index f49e5d1e3e..46910c519d 100644 --- a/addons/frag/XEH_postInit.sqf +++ b/addons/frag/XEH_postInit.sqf @@ -9,7 +9,21 @@ if(isServer) then { [QGVAR(frag_eh), { _this call FUNC(frago); }] call EFUNC(common,addEventHandler); }; -[FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler; +["SettingsInitialized", { + //If not enabled, exit + if (!GVAR(enabled)) exitWith {}; + + // Register fire event handler + ["firedPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + ["firedPlayerNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + ["firedNonPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + ["firedPlayerVehicle", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + ["firedPlayerVehicleNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + ["firedNonPlayerVehicle", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + + [FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler; + +}] call EFUNC(common,addEventHandler); //Cache for ammo type configs GVAR(cacheRoundsTypesToTrack) = createLocation ["ACE_HashLocation", [-10000,-10000,-10000], 0, 0]; diff --git a/addons/frag/functions/fnc_fired.sqf b/addons/frag/functions/fnc_fired.sqf index 3e82544430..dbe1ab6347 100644 --- a/addons/frag/functions/fnc_fired.sqf +++ b/addons/frag/functions/fnc_fired.sqf @@ -1,12 +1,10 @@ /* * Author: nou, jaynus, PabstMirror - * Called from FiredBIS event on AllVehicles + * Called from the unified fired EH for all. * 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 + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * Nothing @@ -19,38 +17,39 @@ // #define DEBUG_ENABLED_FRAG #include "script_component.hpp" -params ["_gun", "", "", "", "_type", "", "_round"]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); -private _shouldAdd = GVAR(cacheRoundsTypesToTrack) getVariable _type; +private _shouldAdd = GVAR(cacheRoundsTypesToTrack) getVariable _ammo; if (isNil "_shouldAdd") then { - TRACE_1("no cache for round",_type); + TRACE_1("no cache for round",_ammo); 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); + TRACE_1("Settings not init yet - exit without setting cache",_ammo); _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]; + TRACE_2("SettingCache[spallEnabled]",_ammo,_shouldAdd); + GVAR(cacheRoundsTypesToTrack) setVariable [_ammo, _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")))); + private _skip = getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(skip)); + private _explosive = getNumber (configFile >> "CfgAmmo" >> _ammo >> "explosive"); + private _indirectRange = getNumber (configFile >> "CfgAmmo" >> _ammo >> "indirectHitRange"); + private _force = getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(force)); + private _fragPower = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirecthit")*(sqrt((getNumber (configFile >> "CfgAmmo" >> _ammo >> "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]; + GVAR(cacheRoundsTypesToTrack) setVariable [_ammo, _shouldAdd]; }; if (_shouldAdd) then { - TRACE_3("Running Frag Tracking",_gun,_type,_round); - [_gun, _type, _round] call FUNC(addPfhRound); + TRACE_3("Running Frag Tracking",_unit,_ammo,_projectile); + [_unit, _ammo, _projectile] call FUNC(addPfhRound); }; From ac3f75c8b450f403ddb89b894da879650c6c756f Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 17:16:10 -0300 Subject: [PATCH 14/34] Apply the ufeh to ACE_Goggles --- addons/goggles/CfgEventHandlers.hpp | 8 -------- addons/goggles/XEH_postInit.sqf | 3 +++ addons/goggles/functions/fnc_handleFired.sqf | 7 +++---- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/addons/goggles/CfgEventHandlers.hpp b/addons/goggles/CfgEventHandlers.hpp index 8c24b6d5ec..36bbadbb3e 100644 --- a/addons/goggles/CfgEventHandlers.hpp +++ b/addons/goggles/CfgEventHandlers.hpp @@ -19,14 +19,6 @@ class Extended_Killed_EventHandlers { }; }; -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - clientFiredBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(handleFired)}); - }; - }; -}; - class Extended_Explosion_EventHandlers { class CAManBase { class ADDON { diff --git a/addons/goggles/XEH_postInit.sqf b/addons/goggles/XEH_postInit.sqf index a4872f6a3f..832c961178 100644 --- a/addons/goggles/XEH_postInit.sqf +++ b/addons/goggles/XEH_postInit.sqf @@ -131,3 +131,6 @@ private _fnc_checkGoggles = { END_COUNTER(goggles); }, 0.5, []] call CBA_fnc_addPerFrameHandler; + +// Register fire event handler +["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); diff --git a/addons/goggles/functions/fnc_handleFired.sqf b/addons/goggles/functions/fnc_handleFired.sqf index 793849822f..23a1b66f48 100644 --- a/addons/goggles/functions/fnc_handleFired.sqf +++ b/addons/goggles/functions/fnc_handleFired.sqf @@ -1,6 +1,6 @@ /* * Author: Garth 'L-H' de Wet, commy2 - * Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements. + * Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements. Called from the unified fired EH only for the local player. * * Arguments: * 0: Unit @@ -13,9 +13,8 @@ */ #include "script_component.hpp" -params ["_unit", "_weapon"]; - -if (_unit != ACE_player) exitWith {true}; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); // no dust in rain if (rain > 0.1) exitWith {true}; From 0b9695ce70acff4abceb548d5a84148cf3f789fa Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 17:20:30 -0300 Subject: [PATCH 15/34] Apply the ufeh to ACE_Grenades --- addons/goggles/functions/fnc_handleFired.sqf | 3 +-- addons/grenades/CfgEventHandlers.hpp | 8 -------- addons/grenades/XEH_postInit.sqf | 6 ++++++ addons/grenades/functions/fnc_throwGrenade.sqf | 13 ++++--------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/addons/goggles/functions/fnc_handleFired.sqf b/addons/goggles/functions/fnc_handleFired.sqf index 23a1b66f48..dcfcc51bec 100644 --- a/addons/goggles/functions/fnc_handleFired.sqf +++ b/addons/goggles/functions/fnc_handleFired.sqf @@ -3,8 +3,7 @@ * Determines whether to place dust on the goggles, based on calibre of weapon fired and other requirements. Called from the unified fired EH only for the local player. * * Arguments: - * 0: Unit - * 1: Weapon + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * Function is handled? diff --git a/addons/grenades/CfgEventHandlers.hpp b/addons/grenades/CfgEventHandlers.hpp index d93f8469bc..0cd959a047 100644 --- a/addons/grenades/CfgEventHandlers.hpp +++ b/addons/grenades/CfgEventHandlers.hpp @@ -10,11 +10,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - firedBIS = QUOTE(_this call FUNC(throwGrenade)); - }; - }; -}; diff --git a/addons/grenades/XEH_postInit.sqf b/addons/grenades/XEH_postInit.sqf index 54c2b06e8b..38945ccc11 100644 --- a/addons/grenades/XEH_postInit.sqf +++ b/addons/grenades/XEH_postInit.sqf @@ -22,3 +22,9 @@ GVAR(flashbangPPEffectCC) ppEffectForceInNVG true; }, {false}, [9, [false, false, false]], false] call CBA_fnc_addKeybind; //8 Key + + +// Register fire event handler +["firedPlayer", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler); +["firedPlayerNonLocal", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler); +["firedNonPlayer", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler); diff --git a/addons/grenades/functions/fnc_throwGrenade.sqf b/addons/grenades/functions/fnc_throwGrenade.sqf index 1d7d470b80..284c573c2e 100644 --- a/addons/grenades/functions/fnc_throwGrenade.sqf +++ b/addons/grenades/functions/fnc_throwGrenade.sqf @@ -1,15 +1,9 @@ /* * Author: commy2 - * Adjust the grenades throwing direction and speed to the selected throwing mode. + * Adjust the grenades throwing direction and speed to the selected throwing mode. Called from the unified fired EH only for CAManBase * * Arguments: - * 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 + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None @@ -21,7 +15,8 @@ */ #include "script_component.hpp" -params ["_unit", "_weapon", "", "", "_ammo", "", "_projectile"]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); if (_weapon != "Throw") exitWith {}; From 7ace1738c006eb5e036c26e7704ab2e350314de3 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 17:29:05 -0300 Subject: [PATCH 16/34] Apply the ufeh to ACE_HuntIr --- addons/huntir/CfgEventhandlers.hpp | 8 -------- addons/huntir/XEH_postInit.sqf | 5 +++++ addons/huntir/functions/fnc_handleFired.sqf | 15 ++++++--------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/addons/huntir/CfgEventhandlers.hpp b/addons/huntir/CfgEventhandlers.hpp index 308df09c1b..44b6e8e6ff 100644 --- a/addons/huntir/CfgEventhandlers.hpp +++ b/addons/huntir/CfgEventhandlers.hpp @@ -9,11 +9,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - clientFiredBIS = QUOTE(_this call FUNC(handleFired)); - }; - }; -}; \ No newline at end of file diff --git a/addons/huntir/XEH_postInit.sqf b/addons/huntir/XEH_postInit.sqf index c5526500ac..0c518dfcea 100644 --- a/addons/huntir/XEH_postInit.sqf +++ b/addons/huntir/XEH_postInit.sqf @@ -7,3 +7,8 @@ GVAR(TI) = 0; GVAR(cur_cam) = 0; GVAR(ROTATE) = 0; GVAR(ELEVAT) = 0.01; + +// Register fire event handler +// Don't run for non players, as they are too dumb to launch huntirs anyway +["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); +["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); diff --git a/addons/huntir/functions/fnc_handleFired.sqf b/addons/huntir/functions/fnc_handleFired.sqf index 1919b4547c..551b9975b6 100644 --- a/addons/huntir/functions/fnc_handleFired.sqf +++ b/addons/huntir/functions/fnc_handleFired.sqf @@ -1,16 +1,10 @@ /* * Author: Norrin, Rocko, Ruthberg * - * Handles HuntIR projectiles + * Handles HuntIR projectiles. Called from the unified fired EH for all CAManBase. * * Arguments: - * 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 + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None @@ -19,10 +13,13 @@ */ #include "script_component.hpp" -params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); if (_ammo != "F_HuntIR") exitWith {}; +if (!hasInterface) exitWith {}; + [{ params ["_projectile"]; From 45b6b8467d5e65b3c7bb8ce80f6cf48649324dca Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 17:42:44 -0300 Subject: [PATCH 17/34] Apply the ufeh to ACE_Nightvision --- addons/nightvision/CfgEventHandlers.hpp | 8 -------- addons/nightvision/XEH_postInitClient.sqf | 4 ++++ addons/nightvision/functions/fnc_blending.sqf | 19 +++++-------------- 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/addons/nightvision/CfgEventHandlers.hpp b/addons/nightvision/CfgEventHandlers.hpp index 380f190f47..49b87fb4fd 100644 --- a/addons/nightvision/CfgEventHandlers.hpp +++ b/addons/nightvision/CfgEventHandlers.hpp @@ -9,11 +9,3 @@ class Extended_PostInit_EventHandlers { clientInit = QUOTE(call COMPILE_FILE(XEH_postInitClient) ); }; }; - -class Extended_FiredBIS_EventHandlers { - class AllVehicles { - class ADDON { - clientFiredBIS = QUOTE( _this call FUNC(blending) ); - }; - }; -}; diff --git a/addons/nightvision/XEH_postInitClient.sqf b/addons/nightvision/XEH_postInitClient.sqf index 0df7270317..1f73b12e93 100644 --- a/addons/nightvision/XEH_postInitClient.sqf +++ b/addons/nightvision/XEH_postInitClient.sqf @@ -70,3 +70,7 @@ GVAR(ppEffectMuzzleFlash) ppEffectCommit 0; }, {false}, [209, [false, false, true]], false] call CBA_fnc_addKeybind; //PageDown + ALT + +// Register fire event handler +["firedPlayer", DFUNC(blending)] call EFUNC(common,addEventHandler); +["firedPlayerVehicle", DFUNC(blending)] call EFUNC(common,addEventHandler); diff --git a/addons/nightvision/functions/fnc_blending.sqf b/addons/nightvision/functions/fnc_blending.sqf index 42d586248d..5c205fce5c 100644 --- a/addons/nightvision/functions/fnc_blending.sqf +++ b/addons/nightvision/functions/fnc_blending.sqf @@ -1,15 +1,9 @@ /* * Author: commy2 - * Change the blending when the player fires?? + * Change the blending when the player fires??. Called from the unified fired EH only for the local player and his vehicle. * * Arguments: - * 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 + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * Nothing @@ -21,17 +15,14 @@ */ #include "script_component.hpp" -if (!hasInterface) exitWith {}; - -params ["_vehicle", "_weapon", "", "", "_ammo", "_magazine"]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); private "_player"; _player = ACE_player; //If our vehicle didn't shoot, or we're not in NVG mode, exit -if ((_vehicle != (vehicle _player)) || {(currentVisionMode _player) != 1}) exitWith {}; -//If we are mounted, and it wasn't our weapon system that fired, exit -if (_player != _vehicle && {!(_weapon in (_vehicle weaponsTurret ([_player] call EFUNC(common,getTurretIndex))))}) exitWith {}; +if (currentVisionMode _player) != 1} exitWith {}; private["_darkness", "_nvgBrightnessCoef", "_silencer", "_visibleFire", "_visibleFireCoef", "_visibleFireTime", "_visibleFireTimeCoef"]; From 33bcd6d9f9b2dc817996a8c947697ce433528fb5 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 17:44:34 -0300 Subject: [PATCH 18/34] Fix --- addons/nightvision/functions/fnc_blending.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/nightvision/functions/fnc_blending.sqf b/addons/nightvision/functions/fnc_blending.sqf index 5c205fce5c..b34584a5d0 100644 --- a/addons/nightvision/functions/fnc_blending.sqf +++ b/addons/nightvision/functions/fnc_blending.sqf @@ -22,7 +22,7 @@ private "_player"; _player = ACE_player; //If our vehicle didn't shoot, or we're not in NVG mode, exit -if (currentVisionMode _player) != 1} exitWith {}; +if ((currentVisionMode _player) != 1) exitWith {}; private["_darkness", "_nvgBrightnessCoef", "_silencer", "_visibleFire", "_visibleFireCoef", "_visibleFireTime", "_visibleFireTimeCoef"]; From 5b3df2bcf7d621401453ae6795171ad6d407738e Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 17:50:35 -0300 Subject: [PATCH 19/34] Apply the ufeh to ACE_Optics --- addons/optics/CfgEventHandlers.hpp | 8 -------- addons/optics/XEH_postInit.sqf | 5 ++++- addons/optics/functions/fnc_handleFired.sqf | 16 ++++------------ 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/addons/optics/CfgEventHandlers.hpp b/addons/optics/CfgEventHandlers.hpp index 68962af2c4..e75956f440 100644 --- a/addons/optics/CfgEventHandlers.hpp +++ b/addons/optics/CfgEventHandlers.hpp @@ -9,11 +9,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class AGM_Optics { - clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call DFUNC(handleFired)};); - }; - }; -}; diff --git a/addons/optics/XEH_postInit.sqf b/addons/optics/XEH_postInit.sqf index 2048db76c6..c9667f3931 100644 --- a/addons/optics/XEH_postInit.sqf +++ b/addons/optics/XEH_postInit.sqf @@ -10,7 +10,7 @@ GVAR(camera) = objNull; if ((!isNil {is3DEN}) && {is3DEN}) exitWith { ACE_LOGINFO("Eden detected: disabling Optics PIP Camera"); }; - + waitUntil {!isNull ACE_player}; waitUntil {sleep 1; {_x != GVAR(camera)} count allMissionObjects "camera" == 0 && {isNull curatorCamera}}; @@ -50,3 +50,6 @@ GVAR(camera) = objNull; GVAR(camera) cameraEffect ["INTERNAL", "BACK", "ace_optics_rendertarget0"]; }; }] call EFUNC(common,addEventHandler); + +// Register fire event handler +["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); diff --git a/addons/optics/functions/fnc_handleFired.sqf b/addons/optics/functions/fnc_handleFired.sqf index f0399c37fc..299b2c30f4 100644 --- a/addons/optics/functions/fnc_handleFired.sqf +++ b/addons/optics/functions/fnc_handleFired.sqf @@ -2,26 +2,18 @@ * Original Author: Taosenai * Adapted By: KoffeinFlummi, commy2 * - * Animates the scope when firing. + * Animates the scope when firing. Called from the unified fired EH only for the local player. * * Arguments: - * 0: Unit (Object) - * 1: Weapon (String) - * 2: Muzzle (String) - * 3: Mode (String) - * 4: Ammo (Object) - * 5: Magazine (String) - * 6: Projectile (Object) + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None */ #include "script_component.hpp" -private ["_unit", "_weapon"]; - -_unit = _this select 0; -_weapon = _this select 1; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); // check if compatible scope is used private "_display"; From 5aa763f0c639ce5411114642fa950b0bc41d0f80 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 17:59:54 -0300 Subject: [PATCH 20/34] Apply the ufeh to ACE_Overheating --- addons/overheating/CfgEventHandlers.hpp | 8 ------- addons/overheating/XEH_postInit.sqf | 9 ++++++++ addons/overheating/functions/fnc_firedEH.sqf | 22 +++++++------------- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/addons/overheating/CfgEventHandlers.hpp b/addons/overheating/CfgEventHandlers.hpp index 7e4e0b35c7..7f43c8b903 100644 --- a/addons/overheating/CfgEventHandlers.hpp +++ b/addons/overheating/CfgEventHandlers.hpp @@ -10,14 +10,6 @@ class Extended_PostInit_EventHandlers { }; }; -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class GVAR(Overheat) { - clientFiredBIS = QUOTE(_this call FUNC(firedEH)); - }; - }; -}; - class Extended_Take_EventHandlers { class CAManBase { class GVAR(UnjamReload) { diff --git a/addons/overheating/XEH_postInit.sqf b/addons/overheating/XEH_postInit.sqf index 76cdb090bb..38c0298b0f 100644 --- a/addons/overheating/XEH_postInit.sqf +++ b/addons/overheating/XEH_postInit.sqf @@ -36,3 +36,12 @@ GVAR(cacheWeaponData) setText QGVAR(cacheWeaponData); // Schedule cool down calculation of player weapons at (infrequent) regular intervals [] call FUNC(updateTemperatureThread); + +["SettingsInitialized", { + // Register fire event handler + ["firedPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + // Only add eh to non local players if dispersion is enabled + if (GVAR(overheatingDispersion)) then { + ["firedPlayerNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + }; +}] call EFUNC(common,addEventHandler); diff --git a/addons/overheating/functions/fnc_firedEH.sqf b/addons/overheating/functions/fnc_firedEH.sqf index b37e87c66d..604a2bb31d 100644 --- a/addons/overheating/functions/fnc_firedEH.sqf +++ b/addons/overheating/functions/fnc_firedEH.sqf @@ -1,15 +1,9 @@ /* * Author: Commy2 and esteldunedain - * Handle weapon fire + * Handle weapon fire. Called from the unified fired EH 1- always for the local player 2- and for non local players if dispersion is simulated. * * 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 + * None. Parameters inherited from EFUNC(common,firedEH) * * Return value: * None @@ -18,15 +12,13 @@ */ #include "script_component.hpp" +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); + 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) +if ((_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); }; From 69dea087ca68756ed50546a48e2e8fc9d301ddd5 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 18:17:27 -0300 Subject: [PATCH 21/34] Apply the ufeh to ACE_Overpressure --- addons/overpressure/CfgEventHandlers.hpp | 39 -------- addons/overpressure/XEH_postInit.sqf | 4 + addons/overpressure/XEH_preInit.sqf | 2 - .../functions/fnc_fireLauncherBackblast.sqf | 95 ------------------- .../functions/fnc_fireOverpressureZone.sqf | 75 --------------- .../overpressure/functions/fnc_firedEHBB.sqf | 89 +++++++++++++---- .../overpressure/functions/fnc_firedEHOP.sqf | 64 ++++++++++--- 7 files changed, 123 insertions(+), 245 deletions(-) delete mode 100644 addons/overpressure/functions/fnc_fireLauncherBackblast.sqf delete mode 100644 addons/overpressure/functions/fnc_fireOverpressureZone.sqf diff --git a/addons/overpressure/CfgEventHandlers.hpp b/addons/overpressure/CfgEventHandlers.hpp index 472c253f7d..0cd959a047 100644 --- a/addons/overpressure/CfgEventHandlers.hpp +++ b/addons/overpressure/CfgEventHandlers.hpp @@ -10,42 +10,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - clientFiredBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHBB);};); - }; - }; - - class Tank { - class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); - }; - }; - class Car { - class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); - }; - }; - class Helicopter { - class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); - }; - }; - class Plane { - class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); - }; - }; - class Ship_F { - class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); - }; - }; - class StaticWeapon { - class ADDON { - firedBIS = QUOTE(if (local (_this select 0)) then {_this call FUNC(firedEHOP);};); - }; - }; -}; diff --git a/addons/overpressure/XEH_postInit.sqf b/addons/overpressure/XEH_postInit.sqf index 33c2e679c9..f7f0bc2ace 100644 --- a/addons/overpressure/XEH_postInit.sqf +++ b/addons/overpressure/XEH_postInit.sqf @@ -1,3 +1,7 @@ #include "script_component.hpp" ["overpressure", FUNC(overpressureDamage)] call EFUNC(common,addEventHandler); + +// Register fire event handler +["firedPlayer", DFUNC(firedEHBB)] call EFUNC(common,addEventHandler); +["firedPlayerVehicle", DFUNC(firedEHOP)] call EFUNC(common,addEventHandler); diff --git a/addons/overpressure/XEH_preInit.sqf b/addons/overpressure/XEH_preInit.sqf index d0ce7cbcf1..37f44a2e9a 100644 --- a/addons/overpressure/XEH_preInit.sqf +++ b/addons/overpressure/XEH_preInit.sqf @@ -2,8 +2,6 @@ ADDON = false; -PREP(fireLauncherBackblast); -PREP(fireOverpressureZone); PREP(getDistance); PREP(overpressureDamage); PREP(cacheOverPressureValues); diff --git a/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf b/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf deleted file mode 100644 index 3b6691fb81..0000000000 --- a/addons/overpressure/functions/fnc_fireLauncherBackblast.sqf +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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 - * 1: Weapon fired - * 2: Muzzle - * 3: Mode - * 4: Ammo - * 5: Magazine - * 6: Projectile - * - * 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", "", "_ammo", "_magazine", "_projectile"]; -TRACE_6("params",_firer,_weapon,_muzzle,_ammo,_magazine,_projectile); - -private _position = getPosASL _projectile; -private _direction = [0, 0, 0] vectorDiff (vectorDir _projectile); - -// Bake variable name and check if the variable exists, call the caching function otherwise -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 = (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 = 2 * ([_position, _direction, _backblastRange, _firer] call FUNC(getDistance)); - -TRACE_1("Distance",_distance); - -if (_distance < _backblastRange) then { - private _alpha = sqrt (1 - _distance / _backblastRange); - private _beta = sqrt 0.5; - - private _damage = _alpha * _beta * _backblastDamage; - [_damage * 100] call BIS_fnc_bloodEffect; - - if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_firer] call EFUNC(medical,hasMedicalEnabled))}) then { - [_firer, _damage, "body", "backblast"] call EFUNC(medical,addDamageToUnit); - } else { - _firer setDamage (damage _firer + _damage); - }; -}; - -// Draw debug lines -#ifdef DEBUG_MODE_FULL - [ _position, - _position vectorAdd (_direction vectorMultiply _backblastRange), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - - 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] - ] call EFUNC(common,addLineToDebugDraw); - [ _position, - _position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - [ _position, - _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - [ _position, - _position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - - [ _position, - _position vectorAdd (_direction vectorMultiply ((_distance/2) min _backblastRange)), - [1,0,0,1] - ] call EFUNC(common,addLineToDebugDraw); -#endif diff --git a/addons/overpressure/functions/fnc_fireOverpressureZone.sqf b/addons/overpressure/functions/fnc_fireOverpressureZone.sqf deleted file mode 100644 index f254151307..0000000000 --- a/addons/overpressure/functions/fnc_fireOverpressureZone.sqf +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Author: commy2 and esteldunedain - * Handle fire of local vehicle weapons creating overpressure zones - * Called from firedEHOP, only for local vehicles - * - * Arguments: - * 0: Vehicle that fired - * 1: Weapon fired - * 2: Muzzle - * 3: Mode - * 4: Ammo - * 5: Magazine - * 6: Projectile - * - * 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 - */ -#include "script_component.hpp" - -params ["_firer", "_weapon", "_muzzle", "", "_ammo", "_magazine", "_projectile"]; -TRACE_6("params",_firer,_weapon,_muzzle,_ammo,_magazine,_projectile); - -// Prevent AI from causing overpressure damage (NOTE: Vehicle is local, but turret gunner may not be) -if !([gunner _firer] call EFUNC(common,isPlayer)) exitWith {}; - -private _position = getPosASL _projectile; -private _direction = vectorDir _projectile; - -// Bake variable name and check if the variable exists, call the caching function otherwise -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 = (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); - -// Draw debug lines -#ifdef DEBUG_MODE_FULL - [ _position, - _position vectorAdd (_direction vectorMultiply _dangerZoneRange), - [1,0,0,1] - ] call EFUNC(common,addLineToDebugDraw); - - 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] - ] call EFUNC(common,addLineToDebugDraw); - [ _position, - _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - [ _position, - _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - [ _position, - _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), - [1,1,0,1] - ] call EFUNC(common,addLineToDebugDraw); - -#endif diff --git a/addons/overpressure/functions/fnc_firedEHBB.sqf b/addons/overpressure/functions/fnc_firedEHBB.sqf index 6327cc67c9..8dc15e0f0a 100644 --- a/addons/overpressure/functions/fnc_firedEHBB.sqf +++ b/addons/overpressure/functions/fnc_firedEHBB.sqf @@ -1,39 +1,90 @@ /* * Author: joko // Jonas - * Handle fire of local launchers + * Handle fire of local launchers. Called from the unified fired EH only for the local player. * * Arguments: - * 0: Unit that fired - * 1: Weapon fired - * 2: Muzzle - * 3: Mode - * 4: Ammo - * 5: Magazine - * 6: Projectile + * None. Parameters inherited from EFUNC(common,firedEH) * * Return value: * None * - * Example: + * 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" -params ["_firer", "_weapon", "", "", "_ammo", "_magazine", ""]; - -// Prevent AI from causing backblast damage (fast exit to only run for local players) -if (_firer != ACE_player) exitWith {}; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); // Bake variable name and check if the variable exists, call the caching function otherwise 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; +private _var = if (isNil _varName) then { + [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); } else { - (missionNameSpace getVariable _varName) select 2; + missionNameSpace getVariable _varName; +}; +_var params["_backblastAngle","_backblastRange","_backblastDamage"]; +TRACE_3("cache",_backblastAngle,_backblastRange,_backblastDamage); + +if (_backblastDamage <= 0) exitWith {}; + +private _position = getPosASL _projectile; +private _direction = [0, 0, 0] vectorDiff (vectorDir _projectile); + +// Damage to others +private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _backblastRange]; + +// Let each client handle their own affected units +["overpressure", _affected, [_unit, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); + +// Damage to the firer +private _distance = 2 * ([_position, _direction, _backblastRange, _unit] call FUNC(getDistance)); + +TRACE_1("Distance",_distance); + +if (_distance < _backblastRange) then { + private _alpha = sqrt (1 - _distance / _backblastRange); + private _beta = sqrt 0.5; + + private _damage = _alpha * _beta * _backblastDamage; + [_damage * 100] call BIS_fnc_bloodEffect; + + if (isClass (configFile >> "CfgPatches" >> "ACE_Medical") && {([_unit] call EFUNC(medical,hasMedicalEnabled))}) then { + [_unit, _damage, "body", "backblast"] call EFUNC(medical,addDamageToUnit); + } else { + _unit setDamage (damage _unit + _damage); + }; }; -if (_damage > 0) then { - _this call DFUNC(fireLauncherBackblast) -}; +// Draw debug lines +#ifdef DEBUG_MODE_FULL + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + + 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] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 1) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorAdd ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _backblastRange) vectorDiff ((_ref select 2) vectorMultiply _backblastRange * tan _backblastAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + + [ _position, + _position vectorAdd (_direction vectorMultiply ((_distance/2) min _backblastRange)), + [1,0,0,1] + ] call EFUNC(common,addLineToDebugDraw); +#endif diff --git a/addons/overpressure/functions/fnc_firedEHOP.sqf b/addons/overpressure/functions/fnc_firedEHOP.sqf index fbcb034279..dff9215a52 100644 --- a/addons/overpressure/functions/fnc_firedEHOP.sqf +++ b/addons/overpressure/functions/fnc_firedEHOP.sqf @@ -1,15 +1,9 @@ /* * Author: joko // Jonas - * Handle fire of Vehicle Weapons + * Handle fire of Vehicle Weapons. Called from the unified fired EH only for the local player vehicle. * * Arguments: - * 0: Vehicle that fired (XEH will filter only local) - * 1: Weapon fired - * 2: Muzzle - * 3: Mode - * 4: Ammo - * 5: Magazine - * 6: Projectile + * None. Parameters inherited from EFUNC(common,firedEH) * * Return value: * None @@ -21,16 +15,56 @@ */ #include "script_component.hpp" -params ["", "_weapon", "", "", "_ammo", "_magazine", ""]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); // Bake variable name and check if the variable exists, call the caching function otherwise 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; +private _var = if (isNil _varName) then { + [_weapon, _ammo, _magazine] call FUNC(cacheOverPressureValues); } else { - (missionNameSpace getVariable _varName) select 2; + missionNameSpace getVariable _varName; }; +_var params["_dangerZoneAngle","_dangerZoneRange","_dangerZoneDamage"]; +TRACE_3("cache",_dangerZoneAngle,_dangerZoneRange,_dangerZoneDamage); -if (_damage > 0) then { - _this call DFUNC(fireOverpressureZone) -}; +if (_dangerZoneDamage <= 0) exitWith {}; + + + +// The weapon produces overpressure, calculate +private _position = getPosASL _projectile; +private _direction = vectorDir _projectile; + +// Damage to others +private _affected = (ASLtoAGL _position) nearEntities ["CAManBase", _dangerZoneRange]; + +// Let each client handle their own affected units +["overpressure", _affected, [_unit, _position, _direction, _weapon, _magazine, _ammo]] call EFUNC(common,targetEvent); + +// Draw debug lines +#ifdef DEBUG_MODE_FULL + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange), + [1,0,0,1] + ] call EFUNC(common,addLineToDebugDraw); + + 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] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 1) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorAdd ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + [ _position, + _position vectorAdd (_direction vectorMultiply _dangerZoneRange) vectorDiff ((_ref select 2) vectorMultiply _dangerZoneRange * tan _dangerZoneAngle), + [1,1,0,1] + ] call EFUNC(common,addLineToDebugDraw); + +#endif From 12d7a171e5edf140ef15199112b41ba86caf09c3 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 18:21:43 -0300 Subject: [PATCH 22/34] Apply the ufeh to ACE_Recoil --- addons/recoil/CfgEventHandlers.hpp | 9 +++------ addons/recoil/XEH_postInit.sqf | 4 ++++ addons/recoil/functions/fnc_camshake.sqf | 11 +++++------ 3 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 addons/recoil/XEH_postInit.sqf diff --git a/addons/recoil/CfgEventHandlers.hpp b/addons/recoil/CfgEventHandlers.hpp index 60fc3892fc..76963cf182 100644 --- a/addons/recoil/CfgEventHandlers.hpp +++ b/addons/recoil/CfgEventHandlers.hpp @@ -1,14 +1,11 @@ - class Extended_PreInit_EventHandlers { class ADDON { init = QUOTE(call COMPILE_FILE(XEH_preInit)); }; }; -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(camshake)};); - }; +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; }; diff --git a/addons/recoil/XEH_postInit.sqf b/addons/recoil/XEH_postInit.sqf new file mode 100644 index 0000000000..e6b694646f --- /dev/null +++ b/addons/recoil/XEH_postInit.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" + +// Register fire event handler +["firedPlayer", DFUNC(camShake)] call EFUNC(common,addEventHandler); diff --git a/addons/recoil/functions/fnc_camshake.sqf b/addons/recoil/functions/fnc_camshake.sqf index a8e1af75d9..deb454df71 100644 --- a/addons/recoil/functions/fnc_camshake.sqf +++ b/addons/recoil/functions/fnc_camshake.sqf @@ -1,12 +1,10 @@ /* * Author: Orginal by Ryan Schultz, edited by KoffeinFlummi, commy2 - * Adds camera shake when firing + * Adds camera shake when firing. Called from the unified fired EH only for the local player. * From TMR: Small Arms * * Arguments: - * 0: Unit - * 1: Weapon - * 3: Muzzle + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * Nothing @@ -18,13 +16,14 @@ */ #include "script_component.hpp" +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); + #define BASE_POWER 0.40 #define BASE_TIME 0.19 #define BASE_FREQ 13 #define RECOIL_COEF 40 -params ["_unit", "_weapon", "_muzzle"]; - if (toLower _weapon in ["throw", "put"]) exitWith {}; private _powerMod = ([0, -0.1, -0.1, 0, -0.2] select (["STAND", "CROUCH", "PRONE", "UNDEFINED", ""] find stance _unit)) + ([0, -1, 0, -1] select (["INTERNAL", "EXTERNAL", "GUNNER", "GROUP"] find cameraView)); From cdfdfffff62c7eab0eb003af30342de7626145ad Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 18:24:48 -0300 Subject: [PATCH 23/34] Apply the ufeh to ACE_Scopes --- addons/scopes/CfgEventHandlers.hpp | 8 -------- addons/scopes/XEH_postInit.sqf | 5 +++++ addons/scopes/functions/fnc_firedEH.sqf | 17 +++++------------ 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/addons/scopes/CfgEventHandlers.hpp b/addons/scopes/CfgEventHandlers.hpp index 5c23e0c462..e75956f440 100644 --- a/addons/scopes/CfgEventHandlers.hpp +++ b/addons/scopes/CfgEventHandlers.hpp @@ -9,11 +9,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - firedBIS = QUOTE(_this call FUNC(firedEH);); - }; - }; -}; diff --git a/addons/scopes/XEH_postInit.sqf b/addons/scopes/XEH_postInit.sqf index 41e7d53e17..8f2adeb0b7 100644 --- a/addons/scopes/XEH_postInit.sqf +++ b/addons/scopes/XEH_postInit.sqf @@ -136,3 +136,8 @@ if (!hasInterface) exitWith {}; }, {false}, [201, [true, true, false]], true] call CBA_fnc_addKeybind; + + +// Register fire event handler +["firedPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler); +["firedPlayerNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index bb9c37a1af..d28c0dee7e 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -1,15 +1,9 @@ /* * Author: KoffeinFlummi, esteldunedain - * Adjusts the flight path of the bullet according to the zeroing + * Adjusts the flight path of the bullet according to the zeroing. Called from the unified fired EH only for local and non-local players on foot. * * 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 + * None. Parameters inherited from EFUNC(common,firedEH) * * Return value: * None @@ -18,12 +12,11 @@ */ #include "script_component.hpp" +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); + private ["_adjustment", "_weaponIndex", "_zeroing", "_adjustment"]; -params ["_unit", "", "", "", "", "", "_projectile"]; - -if (!([_unit] call EFUNC(common,isPlayer))) exitWith {}; - _adjustment = _unit getVariable [QGVAR(Adjustment), []]; if (_adjustment isEqualTo []) exitWith {}; From 25b767a16bd1513ae5b9d1566d02f4e46087580a Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 18:27:43 -0300 Subject: [PATCH 24/34] Apply the ufeh to ACE_WeaponSelect --- addons/weaponselect/CfgEventHandlers.hpp | 8 -------- addons/weaponselect/XEH_postInit.sqf | 4 ++++ addons/weaponselect/functions/fnc_throwGrenade.sqf | 13 ++++--------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/addons/weaponselect/CfgEventHandlers.hpp b/addons/weaponselect/CfgEventHandlers.hpp index fd928fde2a..0cd959a047 100644 --- a/addons/weaponselect/CfgEventHandlers.hpp +++ b/addons/weaponselect/CfgEventHandlers.hpp @@ -10,11 +10,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class GVAR(throwGrenade) { - clientFiredBIS = QUOTE(if (_this select 0 == ACE_player) then {_this call FUNC(throwGrenade)}); - }; - }; -}; diff --git a/addons/weaponselect/XEH_postInit.sqf b/addons/weaponselect/XEH_postInit.sqf index 450086aa91..87084ddf28 100644 --- a/addons/weaponselect/XEH_postInit.sqf +++ b/addons/weaponselect/XEH_postInit.sqf @@ -195,3 +195,7 @@ if (!hasInterface) exitWith {}; }, {false}, [10, [false, false, false]], false] call CBA_fnc_addKeybind; //9 Key + + +// Register fire event handler +["firedPlayer", DFUNC(throwGrenade)] call EFUNC(common,addEventHandler); diff --git a/addons/weaponselect/functions/fnc_throwGrenade.sqf b/addons/weaponselect/functions/fnc_throwGrenade.sqf index a99b06879b..3f55e02f51 100644 --- a/addons/weaponselect/functions/fnc_throwGrenade.sqf +++ b/addons/weaponselect/functions/fnc_throwGrenade.sqf @@ -1,15 +1,9 @@ /* * Author: commy2 - * Display Grenade information on grenade throw. + * Display Grenade information on grenade throw. Called from the unified fired EH only for the local player. * * Arguments: - * 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 + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None @@ -21,7 +15,8 @@ */ #include "script_component.hpp" -params ["_unit", "_weapon", "", "", "", "_magazine"]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); if (_weapon != "Throw") exitWith {}; From 94ef0c5659d23dad96a38b61ea4e9ccdb80f94de Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 18:36:20 -0300 Subject: [PATCH 25/34] Apply the ufeh to ACE_WindDeflection --- addons/winddeflection/CfgEventHandlers.hpp | 7 ------- addons/winddeflection/XEH_postInit.sqf | 9 +++++++++ .../functions/fnc_handleFired.sqf | 19 ++++--------------- 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/addons/winddeflection/CfgEventHandlers.hpp b/addons/winddeflection/CfgEventHandlers.hpp index a835fd0e88..917a0acbd7 100644 --- a/addons/winddeflection/CfgEventHandlers.hpp +++ b/addons/winddeflection/CfgEventHandlers.hpp @@ -8,10 +8,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_FILE(XEH_postInit)); }; }; -class Extended_FiredBIS_EventHandlers { - class AllVehicles { - class ADDON { - firedBIS = QUOTE(_this call FUNC(handleFired)); - }; - }; -}; diff --git a/addons/winddeflection/XEH_postInit.sqf b/addons/winddeflection/XEH_postInit.sqf index ff9e2427f4..14b4db1def 100644 --- a/addons/winddeflection/XEH_postInit.sqf +++ b/addons/winddeflection/XEH_postInit.sqf @@ -8,6 +8,15 @@ GVAR(trackedBullets) = []; //If not enabled, dont't add PFEH if (!GVAR(enabled)) exitWith {}; + // Register fire event handler + ["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + ["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + + if (GVAR(vehicleEnabled)) then { + ["firedPlayerVehicle", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + ["firedPlayerVehicleNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + }; + [] call FUNC(updateTrajectoryPFH); }] call EFUNC(common,addEventHandler); diff --git a/addons/winddeflection/functions/fnc_handleFired.sqf b/addons/winddeflection/functions/fnc_handleFired.sqf index a3c51054ee..6910d4e830 100644 --- a/addons/winddeflection/functions/fnc_handleFired.sqf +++ b/addons/winddeflection/functions/fnc_handleFired.sqf @@ -1,15 +1,9 @@ /* * Author: Glowbal, Ruthberg - * Handles wind deflection for projectiles. + * Handles wind deflection for projectiles. Called from the unified fired EH only for players on foot and their vehicles if required by settings. * * Arguments: - * 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 + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * Nothing @@ -21,17 +15,12 @@ */ #include "script_component.hpp" -params ["_unit", "", "", "", "_ammo", "", "_bullet"]; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && (_bullet isKindOf "BulletBase") && (_unit isKindOf "Man")) exitWith {false}; -if (!hasInterface) exitWith {false}; -if (!(GVAR(enabled))) exitWith {false}; -if (!(GVAR(vehicleEnabled)) && !(_unit isKindOf "Man")) exitWith {false}; if (!((_bullet isKindOf "BulletBase") || (_bullet isKindOf "GrenadeBase"))) exitWith {false}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {false}; -if (!([_unit] call EFUNC(common,isPlayer))) exitWith {false}; GVAR(trackedBullets) pushBack [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; - -true; \ No newline at end of file From b7d94f53630fe397b1e02f0c2d84a6ba32840136 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 18:48:26 -0300 Subject: [PATCH 26/34] Apply the ufeh to ACE_Advanced_Ballistics --- .../advanced_ballistics/CfgEventHandlers.hpp | 8 ----- addons/advanced_ballistics/XEH_postInit.sqf | 14 ++++++++ .../functions/fnc_handleFired.sqf | 32 +++++++------------ 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/addons/advanced_ballistics/CfgEventHandlers.hpp b/addons/advanced_ballistics/CfgEventHandlers.hpp index cc1414eb8f..44b6e8e6ff 100644 --- a/addons/advanced_ballistics/CfgEventHandlers.hpp +++ b/addons/advanced_ballistics/CfgEventHandlers.hpp @@ -9,11 +9,3 @@ class Extended_PostInit_EventHandlers { init = QUOTE( call COMPILE_FILE(XEH_postInit) ); }; }; - -class Extended_FiredBIS_EventHandlers { - class CAManBase { - class ADDON { - firedBIS = QUOTE(_this call FUNC(handleFired)); - }; - }; -}; \ No newline at end of file diff --git a/addons/advanced_ballistics/XEH_postInit.sqf b/addons/advanced_ballistics/XEH_postInit.sqf index 1f9002e606..20c0622eac 100644 --- a/addons/advanced_ballistics/XEH_postInit.sqf +++ b/addons/advanced_ballistics/XEH_postInit.sqf @@ -22,3 +22,17 @@ if (!GVAR(extensionAvailable)) exitWith { }; */ [] call FUNC(initializeTerrainExtension); + +if (!hasInterface) exitWith {}; + +["SettingsInitialized", { + //If not enabled, dont't add PFEH + if (!GVAR(enabled)) exitWith {}; + + // Register fire event handler + ["firedPlayer", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + ["firedPlayerNonLocal", DFUNC(handleFired)] call EFUNC(common,addEventHandler); + + [] call FUNC(updateTrajectoryPFH); + +}] call EFUNC(common,addEventHandler); diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index 90eacf2928..9646f065d4 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -1,16 +1,10 @@ /* * Author: Glowbal, Ruthberg * - * Handles advanced ballistics for (BulletBase) projectiles + * Handles advanced ballistics for (BulletBase) projectiles. Called from the unified fired EH only for players. * * Arguments: - * 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 + * None. Parameters inherited from EFUNC(common,firedEH) * * Return Value: * None @@ -19,20 +13,16 @@ */ #include "script_component.hpp" -// Early Quiting -if (!hasInterface) exitWith {}; -if (!GVAR(enabled)) exitWith {}; +//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; +TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); // Parameterization private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletLength", "_barrelTwist", "_stabilityFactor", "_aceTimeSecond", "_barrelVelocityShift", "_ammoTemperatureVelocityShift"]; -params ["_unit", "_weapon", "", "_mode", "_ammo", "_magazine", "_bullet"]; - _abort = false; if (!(_ammo isKindOf "BulletBase")) exitWith {}; -if (!alive _bullet) exitWith {}; -if (!([_unit] call EFUNC(common,isPlayer))) exitWith {}; +if (!alive _projectile) exitWith {}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {}; if (underwater _unit) exitWith {}; if (!GVAR(simulateForEveryone) && !(local _unit)) then { @@ -54,7 +44,7 @@ if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _wea if (_abort || !(GVAR(extensionAvailable))) exitWith { if (missionNamespace getVariable [QEGVAR(windDeflection,enabled), false]) then { - EGVAR(windDeflection,trackedBullets) pushBack [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; + EGVAR(windDeflection,trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; }; }; @@ -72,7 +62,7 @@ _AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMas _WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"]; -_bulletVelocity = velocity _bullet; +_bulletVelocity = velocity _projectile; _muzzleVelocity = vectorMagnitude _bulletVelocity; _barrelVelocityShift = 0; @@ -92,7 +82,7 @@ if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then { if (_muzzleVelocityShift != 0) then { _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; _bulletVelocity = _bulletVelocity vectorAdd ((vectorNormalized _bulletVelocity) vectorMultiply (_muzzleVelocityShift)); - _bullet setVelocity _bulletVelocity; + _projectile setVelocity _bulletVelocity; }; }; @@ -114,16 +104,16 @@ if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) th if (isNil "_temperature") then { _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); }; - _barometricPressure = ((getPosASL _bullet) select 2) call EFUNC(weather,calculateBarometricPressure); + _barometricPressure = ((getPosASL _projectile) select 2) call EFUNC(weather,calculateBarometricPressure); _stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor); }; GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; _aceTimeSecond = floor ACE_time; -"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _bullet, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond]; +"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _projectile, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, _aceTimeSecond, ACE_time - _aceTimeSecond]; -GVAR(allBullets) pushBack [_bullet, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]; +GVAR(allBullets) pushBack [_projectile, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]; if (isNil QGVAR(BulletPFH)) then { GVAR(BulletPFH) = [FUNC(handleFirePFH), GVAR(simulationInterval), []] call CBA_fnc_addPerFrameHandler; From a51372a6b3751e9a7ddce442bc884b4580e6c7d6 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 20:28:16 -0300 Subject: [PATCH 27/34] Add the TRACE_10 macro --- addons/main/script_macros.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index 3d4bc31c99..544cff6842 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -198,4 +198,13 @@ #define ACE_DEPRECATED(arg1,arg2,arg3) ACE_LOGWARNING_3("%1 is deprecated. Support will be dropped in version %2. Replaced by: %3",arg1,arg2,arg3) +#define PFORMAT_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) \ + format ['%1: A=%2, B=%3, C=%4, D=%5, E=%6, F=%7, G=%8, H=%9, I=%10 J=%11', MESSAGE, RETNIL(A), RETNIL(B), RETNIL(C), RETNIL(D), RETNIL(E), RETNIL(F), RETNIL(G), RETNIL(H), RETNIL(I), RETNIL(J)] +#ifdef DEBUG_MODE_FULL +#define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) \ + [THIS_FILE_, __LINE__, PFORMAT_10(MESSAGE,A,B,C,D,E,F,G,H,I,J)] call CBA_fnc_log +#else + #define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) /* disabled */ +#endif + #include "script_debug.hpp" From 8fbb6cd72e9a2aa077f287bf2852108a6133c68e Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 20:49:18 -0300 Subject: [PATCH 28/34] Fixed event parameters --- addons/common/functions/fnc_firedEH.sqf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/common/functions/fnc_firedEH.sqf b/addons/common/functions/fnc_firedEH.sqf index 749364ee86..c11f6d990f 100644 --- a/addons/common/functions/fnc_firedEH.sqf +++ b/addons/common/functions/fnc_firedEH.sqf @@ -26,12 +26,12 @@ TRACE_7("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile if (_unit isKindOf "CAManBase") then { // The unit it on foot if (_unit == ACE_player) then { - ["firedPlayer", this] call FUNC(localEvent); + ["firedPlayer", _this] call FUNC(localEvent); } else { if ([_unit] call EFUNC(common,isPlayer)) then { - ["firedPlayerNonLocal", this] call FUNC(localEvent); + ["firedPlayerNonLocal", _this] call FUNC(localEvent); } else { - ["firedNonPlayer", this] call FUNC(localEvent); + ["firedNonPlayer", _this] call FUNC(localEvent); }; }; } else { @@ -55,12 +55,12 @@ if (_unit isKindOf "CAManBase") then { }; if (_gunner == ACE_player) then { - ["firedPlayerVehicle", this] call FUNC(localEvent); + ["firedPlayerVehicle", _this] call FUNC(localEvent); } else { if ([_gunner] call EFUNC(common,isPlayer)) then { - ["firedPlayerVehicleNonLocal", this] call FUNC(localEvent); + ["firedPlayerVehicleNonLocal", _this] call FUNC(localEvent); } else { - ["firedNonPlayerVehicle", this] call FUNC(localEvent); + ["firedNonPlayerVehicle", _this] call FUNC(localEvent); }; }; }; From e4122cf42f8d004c56c187003a5a8bab6976c880 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 21:00:42 -0300 Subject: [PATCH 29/34] Fix winddeflection fire eh --- addons/winddeflection/functions/fnc_handleFired.sqf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/winddeflection/functions/fnc_handleFired.sqf b/addons/winddeflection/functions/fnc_handleFired.sqf index 6910d4e830..e2bfca394f 100644 --- a/addons/winddeflection/functions/fnc_handleFired.sqf +++ b/addons/winddeflection/functions/fnc_handleFired.sqf @@ -18,9 +18,9 @@ //IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); -if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && (_bullet isKindOf "BulletBase") && (_unit isKindOf "Man")) exitWith {false}; +if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && (_projectile isKindOf "BulletBase") && (_unit isKindOf "Man")) exitWith {false}; -if (!((_bullet isKindOf "BulletBase") || (_bullet isKindOf "GrenadeBase"))) exitWith {false}; +if (!((_projectile isKindOf "BulletBase") || (_projectile isKindOf "GrenadeBase"))) exitWith {false}; if (_unit distance ACE_player > GVAR(simulationRadius)) exitWith {false}; -GVAR(trackedBullets) pushBack [_bullet, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; +GVAR(trackedBullets) pushBack [_projectile, getNumber(configFile >> "CfgAmmo" >> _ammo >> "airFriction")]; From b6058242c8be6539e93fbd19d61d5b03d5cde024 Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 6 Feb 2016 22:20:08 -0300 Subject: [PATCH 30/34] Fix frag fired EH name --- addons/frag/XEH_postInit.sqf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/frag/XEH_postInit.sqf b/addons/frag/XEH_postInit.sqf index 46910c519d..977866e24e 100644 --- a/addons/frag/XEH_postInit.sqf +++ b/addons/frag/XEH_postInit.sqf @@ -14,12 +14,12 @@ if(isServer) then { if (!GVAR(enabled)) exitWith {}; // Register fire event handler - ["firedPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler); - ["firedPlayerNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); - ["firedNonPlayer", DFUNC(firedEH)] call EFUNC(common,addEventHandler); - ["firedPlayerVehicle", DFUNC(firedEH)] call EFUNC(common,addEventHandler); - ["firedPlayerVehicleNonLocal", DFUNC(firedEH)] call EFUNC(common,addEventHandler); - ["firedNonPlayerVehicle", DFUNC(firedEH)] call EFUNC(common,addEventHandler); + ["firedPlayer", DFUNC(fired)] call EFUNC(common,addEventHandler); + ["firedPlayerNonLocal", DFUNC(fired)] call EFUNC(common,addEventHandler); + ["firedNonPlayer", DFUNC(fired)] call EFUNC(common,addEventHandler); + ["firedPlayerVehicle", DFUNC(fired)] call EFUNC(common,addEventHandler); + ["firedPlayerVehicleNonLocal", DFUNC(fired)] call EFUNC(common,addEventHandler); + ["firedNonPlayerVehicle", DFUNC(fired)] call EFUNC(common,addEventHandler); [FUNC(masterPFH), 0, []] call CBA_fnc_addPerFrameHandler; From 34d9b7d4ea14c37a195466069eeb6a982090857a Mon Sep 17 00:00:00 2001 From: licht-im-Norden87 Date: Wed, 10 Feb 2016 04:26:21 +0100 Subject: [PATCH 31/34] Update README_DE.md --- docs/README_DE.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/README_DE.md b/docs/README_DE.md index 98e41d1ae0..0ec65d61c6 100644 --- a/docs/README_DE.md +++ b/docs/README_DE.md @@ -1,12 +1,12 @@

- +

- ACE3 Version + ACE3 Version - + ACE3 Download @@ -25,6 +25,7 @@ ACE3 Build Status

+

Benötigt die aktuellste Version vonCBA A3.
Besucht uns auf Twitter | Facebook | YouTube | Reddit
From e1b83b8172d3f1bf95c22baec9339219334198cb Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Tue, 9 Feb 2016 22:43:38 -0600 Subject: [PATCH 32/34] Manually pre-load for StaticWeapons and Car Fix #3168 --- addons/medical/XEH_preInit.sqf | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index 5deaf77ceb..b8a223510f 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -125,4 +125,25 @@ call FUNC(parseConfigForInjuries); GVAR(HITPOINTS) = ["HitHead", "HitBody", "HitLeftArm", "HitRightArm", "HitLeftLeg", "HitRightLeg"]; GVAR(SELECTIONS) = ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]; +//Hack for #3168 (units in static weapons do not take any damage): +//doing a manual pre-load with a small distance seems to fix the LOD problems with handle damage not returning full results +GVAR(fixedStatics) = []; +private _fixStatic = { + params ["_vehicle"]; + private _vehType = typeOf _vehicle; + TRACE_2("",_vehicle,_vehType); + if (!(_vehType in GVAR(fixedStatics))) then { + GVAR(fixedStatics) pushBack _vehType; + TRACE_1("starting preload",_vehType); + [{ + 1 preloadObject (_this select 0); + }, { + TRACE_1("preload done",_this); + }, [_vehType]] call EFUNC(common,waitUntilAndExecute); + }; +}; +["StaticWeapon", "init", _fixStatic] call CBA_fnc_addClassEventHandler; +["Car", "init", _fixStatic] call CBA_fnc_addClassEventHandler; + + ADDON = true; From ff4ba98e6830b42a8f68851a1dbf099933a17ea7 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Wed, 10 Feb 2016 11:50:30 -0600 Subject: [PATCH 33/34] Pre-load again on mission load (save game) --- addons/medical/XEH_preInit.sqf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/medical/XEH_preInit.sqf b/addons/medical/XEH_preInit.sqf index b8a223510f..189d6b207d 100644 --- a/addons/medical/XEH_preInit.sqf +++ b/addons/medical/XEH_preInit.sqf @@ -144,6 +144,16 @@ private _fixStatic = { }; ["StaticWeapon", "init", _fixStatic] call CBA_fnc_addClassEventHandler; ["Car", "init", _fixStatic] call CBA_fnc_addClassEventHandler; +addMissionEventHandler ["Loaded",{ + { + TRACE_1("starting preload (save load)",_x); + [{ + 1 preloadObject (_this select 0); + }, { + TRACE_1("preload done",_this); + }, [_x]] call EFUNC(common,waitUntilAndExecute); + } forEach GVAR(fixedStatics); +}]; ADDON = true; From e2ed38609d71b9f1caff0613c7d0e521a1f51b4e Mon Sep 17 00:00:00 2001 From: esteldunedain Date: Sat, 13 Feb 2016 15:04:43 -0300 Subject: [PATCH 34/34] Replace driver by effectivCommander on EFUNC(common,getGunner) and EFUNC(common,firedEH) --- addons/common/functions/fnc_firedEH.sqf | 2 +- addons/common/functions/fnc_getGunner.sqf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/common/functions/fnc_firedEH.sqf b/addons/common/functions/fnc_firedEH.sqf index c11f6d990f..d70f0a8650 100644 --- a/addons/common/functions/fnc_firedEH.sqf +++ b/addons/common/functions/fnc_firedEH.sqf @@ -51,7 +51,7 @@ if (_unit isKindOf "CAManBase") then { } count allTurrets [_unit, true]; // Ensure that at least the pilot is returned if there is no gunner if (isManualFire _unit && {isNull _gunner}) then { - _gunner = driver _unit; + _gunner = effectiveCommander _unit; }; if (_gunner == ACE_player) then { diff --git a/addons/common/functions/fnc_getGunner.sqf b/addons/common/functions/fnc_getGunner.sqf index fb8c19ce45..c11f2882ca 100644 --- a/addons/common/functions/fnc_getGunner.sqf +++ b/addons/common/functions/fnc_getGunner.sqf @@ -30,7 +30,7 @@ private _gunner = objNull; // ensure that at least the pilot is returned if there is no gunner if (isManualFire _vehicle && {isNull _gunner}) then { - _gunner = driver _vehicle; + _gunner = effectiveCommander _vehicle; }; _gunner