2018-09-17 19:19:29 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
/*
|
2015-02-14 04:05:02 +00:00
|
|
|
* Author: KoffeinFlummi, commy2
|
|
|
|
* Checks if a vehicle is equipped with an FCS and if so, adds the fired event handler. Execute on server.
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2017-06-08 13:31:51 +00:00
|
|
|
* 0: Vehicle <OBJECT>
|
2015-01-11 16:42:31 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2017-06-08 13:31:51 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [car] call ace_fcs_fnc_vehicleInit
|
2015-12-10 15:00:14 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
2015-01-13 21:51:02 +00:00
|
|
|
|
2015-12-10 15:00:14 +00:00
|
|
|
params ["_vehicle"];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-04 02:20:55 +00:00
|
|
|
{
|
2021-02-18 18:58:08 +00:00
|
|
|
private _turretConfig = [configOf _vehicle, _x] call EFUNC(common,getTurretConfigPath);
|
2015-02-03 22:03:43 +00:00
|
|
|
|
2015-02-11 15:35:42 +00:00
|
|
|
if (getNumber (_turretConfig >> QGVAR(Enabled)) == 1) then {
|
2020-05-07 16:28:32 +00:00
|
|
|
if (isNil QGVAR(jipID)) then {
|
|
|
|
GVAR(jipID) = [QGVAR(addFiredEH), [], QGVAR(addFiredEH)] call CBA_fnc_globalEventJIP;
|
|
|
|
TRACE_1("Adding fired EH for players",GVAR(jipID));
|
2019-04-27 19:04:47 +00:00
|
|
|
};
|
|
|
|
|
2015-02-04 02:20:55 +00:00
|
|
|
_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];
|
|
|
|
_vehicle setVariable [format ["%1_%2", QGVAR(Azimuth), _x], 0, true];
|
2015-01-11 16:42:31 +00:00
|
|
|
|
2015-02-04 02:20:55 +00:00
|
|
|
// calculate offset between gunner camera and muzzle position
|
|
|
|
if !(_vehicle isKindOf "Air") then {
|
2015-02-03 22:03:43 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _gunBeg = getText (_turretConfig >> "gunBeg");
|
|
|
|
private _gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics");
|
2015-02-03 22:03:43 +00:00
|
|
|
|
2017-10-10 14:39:59 +00:00
|
|
|
private _gunBegPos = (_vehicle selectionPosition _gunBeg) select 0;
|
|
|
|
private _gunnerViewPos = (_vehicle selectionPosition _gunnerView) select 0;
|
|
|
|
private _viewDiff = _gunBegPos - _gunnerViewPos;
|
2015-02-03 22:03:43 +00:00
|
|
|
|
2015-02-04 02:20:55 +00:00
|
|
|
_vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], _viewDiff, true];
|
|
|
|
} else {
|
|
|
|
_vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], 0, true];
|
|
|
|
};
|
2015-01-14 20:07:41 +00:00
|
|
|
};
|
2020-05-07 16:28:32 +00:00
|
|
|
} forEach allTurrets _vehicle;
|