ACE3/addons/fcs/functions/fnc_vehicleInit.sqf
Dedmen Miller e2ac18a05d [WIP] Fix script errors reporting wrong line numbers (#6407)
* advanced_ballistics

* advanced_fatigue

* advanced_throwing

* ai

* aircraft

* arsenal

* atragmx

* attach

* backpacks

* ballistics

* captives

* cargo

* chemlights

* common

* concertina_wire

* cookoff

* dagr

* disarming

* disposable

* dogtags

* dragging

* explosives

* fastroping

* fcs

* finger

* frag

* gestures

* gforces

* goggles

* grenades

* gunbag

* hearing

* hitreactions

* huntir

* interact_menu

* interaction

* inventory

* kestrel4500

* laser

* laserpointer

* logistics_uavbattery

* logistics_wirecutter

* magazinerepack

* map

* map_gestures

* maptools

* markers

* medical

* medical_ai

* medical_blood

* medical_menu

* microdagr

* minedetector

* missileguidance

* missionmodules

* mk6mortar

* modules

* movement

* nametags

* nightvision

* nlaw

* optics

* optionsmenu

* overheating

* overpressure

* parachute

* pylons

* quickmount

* rangecard

* rearm

* recoil

* refuel

* reload

* reloadlaunchers

* repair

* respawn

* safemode

* sandbag

* scopes

* slideshow

* spectator

* spottingscope

* switchunits

* tacticalladder

* tagging

* trenches

* tripod

* ui

* vector

* vehiclelock

* vehicles

* viewdistance

* weaponselect

* weather

* winddeflection

* yardage450

* zeus

* arsenal defines.hpp

* optionals

* DEBUG_MODE_FULL 1

* DEBUG_MODE_FULL 2

* Manual fixes

* Add SQF Validator check for #include after block comment

* explosives fnc_openTimerUI

* fix uniqueItems
2018-09-17 14:19:29 -05:00

46 lines
1.6 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: KoffeinFlummi, commy2
* Checks if a vehicle is equipped with an FCS and if so, adds the fired event handler. Execute on server.
*
* Arguments:
* 0: Vehicle <OBJECT>
*
* Return Value:
* None
*
* Example:
* [car] call ace_fcs_fnc_vehicleInit
*
* Public: No
*/
params ["_vehicle"];
{
private _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];
_vehicle setVariable [format ["%1_%2", QGVAR(Azimuth), _x], 0, true];
// calculate offset between gunner camera and muzzle position
if !(_vehicle isKindOf "Air") then {
private _gunBeg = getText (_turretConfig >> "gunBeg");
private _gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics");
private _gunBegPos = (_vehicle selectionPosition _gunBeg) select 0;
private _gunnerViewPos = (_vehicle selectionPosition _gunnerView) select 0;
private _viewDiff = _gunBegPos - _gunnerViewPos;
_vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], _viewDiff, true];
} else {
_vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], 0, true];
};
};
false
} count allTurrets _vehicle;