From 3568d0d72e6f4dad4cb6afe0402fc8dedcd45a7f Mon Sep 17 00:00:00 2001 From: commy2 Date: Wed, 11 Feb 2015 16:35:42 +0100 Subject: [PATCH] fix in fcs vehicleInit --- addons/fcs/CfgEventHandlers.hpp | 28 ++++++++++++++++++++++++ addons/fcs/functions/fnc_vehicleInit.sqf | 13 +++++------ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/addons/fcs/CfgEventHandlers.hpp b/addons/fcs/CfgEventHandlers.hpp index 59956f2702..ff0812420a 100644 --- a/addons/fcs/CfgEventHandlers.hpp +++ b/addons/fcs/CfgEventHandlers.hpp @@ -37,3 +37,31 @@ class Extended_Init_EventHandlers { }; }; }; + +class Extended_FiredBIS_EventHandlers { + class Tank { + class ADDON { + clientInit = QUOTE(_this call FUNC(firedEH)); + }; + }; + class Car { + class ADDON { + clientInit = QUOTE(_this call FUNC(firedEH)); + }; + }; + class Helicopter { + class ADDON { + clientInit = QUOTE(_this call FUNC(firedEH)); + }; + }; + class Plane { + class ADDON { + clientInit = QUOTE(_this call FUNC(firedEH)); + }; + }; + class Ship_F { + class ADDON { + clientInit = QUOTE(_this call FUNC(firedEH)); + }; + }; +}; diff --git a/addons/fcs/functions/fnc_vehicleInit.sqf b/addons/fcs/functions/fnc_vehicleInit.sqf index 29de520f5d..fa808c7c27 100644 --- a/addons/fcs/functions/fnc_vehicleInit.sqf +++ b/addons/fcs/functions/fnc_vehicleInit.sqf @@ -17,9 +17,10 @@ private "_vehicle"; _vehicle = _this select 0; { - if (getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(Enabled)) == 1) then { // @todo for all turrets - _vehicle addEventHandler ["Fired", {_this call FUNC(firedEH)}]; + private "_turretConfig"; + _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _x] call EFUNC(common,getTurretConfigPath); + if (getNumber (_turretConfig >> QGVAR(Enabled)) == 1) then { _vehicle setVariable [format ["%1_%2", QGVAR(Distance), _x], 0, true]; _vehicle setVariable [format ["%1_%2", QGVAR(Magazines), _x], [], true]; _vehicle setVariable [format ["%1_%2", QGVAR(Elevation), _x], [], true]; @@ -27,12 +28,10 @@ _vehicle = _this select 0; // calculate offset between gunner camera and muzzle position if !(_vehicle isKindOf "Air") then { - private ["_turretConfig", "_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"]; + private ["_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"]; - _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _x] call EFUNC(common,getTurretConfigPath); - - _gunBeg = getText (_turretConfig >> "gunBeg"); // @todo player turret path - _gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics"); // @todo player turret path + _gunBeg = getText (_turretConfig >> "gunBeg"); + _gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics"); _gunBegPos = (_vehicle selectionPosition _gunBeg) select 0; _gunnerViewPos = (_vehicle selectionPosition _gunnerView) select 0;