mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* 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
82 lines
3.2 KiB
Plaintext
82 lines
3.2 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: VKing
|
|
* Calculate FCS solution
|
|
*
|
|
* Arguments:
|
|
* 0: Vehicle <OBJECT>
|
|
* 1: Turret <ARRAY>
|
|
* 2: Target distance <NUMBER>
|
|
* 3: Azimuth offset <UNKNOWN>
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* [car, [turret], 5, ?] call ace_fcs_fnc_calculateSolution
|
|
*
|
|
* Public: No
|
|
*/
|
|
params ["_vehicle","_turret","_distance","_angleTarget"];
|
|
TRACE_4("params",_vehicle,_turret,_distance,_angleTarget);
|
|
|
|
private _FCSInitSpeed = [];
|
|
private _FCSMagazines = [];
|
|
private _FCSElevation = [];
|
|
private _turretConfig = [configFile >> "CfgVehicles" >> typeOf _vehicle, _turret] call EFUNC(common,getTurretConfigPath);
|
|
|
|
{
|
|
private _magazine = _x;
|
|
private _ammo = getText (configFile >> "CfgMagazines" >> _magazine >> "ammo");
|
|
|
|
private _bulletSimulation = getText (configFile >> "CfgAmmo" >> _ammo >> "simulation");
|
|
if !(_bulletSimulation == "shotMissile") then {
|
|
private _maxElev = getNumber (_turretConfig >> "maxElev");
|
|
private _initSpeed = getNumber (configFile >> "CfgMagazines" >> _magazine >> "initSpeed");
|
|
private _airFriction = getNumber (configFile >> "CfgAmmo" >> _ammo >> "airFriction");
|
|
|
|
{
|
|
private _weapon = _x;
|
|
private _muzzles = getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles");
|
|
private _weaponMagazines = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
|
|
|
|
{
|
|
if (_x != "this") then {
|
|
_weaponMagazines append getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines");
|
|
};
|
|
false
|
|
} count _muzzles;
|
|
|
|
// Fix the `in` operator being case sensitive and BI fucking up the spelling of their own classnames
|
|
private _weaponMagazinesCheck = _weaponMagazines apply {toLower _x};
|
|
|
|
// Another BIS fix: ShotBullet simulation uses weapon initSpeed, others ignore it
|
|
if (toLower _magazine in _weaponMagazinesCheck && {_bulletSimulation == "shotBullet"}) exitWith {
|
|
private _initSpeedCoef = getNumber(configFile >> "CfgWeapons" >> _weapon >> "initSpeed");
|
|
|
|
if (_initSpeedCoef < 0) then {
|
|
_initSpeed = _initSpeed * -_initSpeedCoef;
|
|
};
|
|
|
|
if (_initSpeedCoef > 0) then {
|
|
_initSpeed = _initSpeedCoef;
|
|
};
|
|
};
|
|
false
|
|
} count (_vehicle weaponsTurret _turret);
|
|
|
|
private _offset = "ace_fcs" callExtension format ["%1,%2,%3,%4", _initSpeed, _airFriction, _angleTarget, _distance];
|
|
_offset = parseNumber _offset;
|
|
|
|
_FCSInitSpeed pushBack _initSpeed;
|
|
_FCSMagazines pushBack _magazine;
|
|
_FCSElevation pushBack _offset;
|
|
};
|
|
false
|
|
} count (_vehicle magazinesTurret _turret);
|
|
|
|
[_vehicle, format ["%1_%2", QGVAR(Distance), _turret], _distance] call EFUNC(common,setVariablePublic);
|
|
[_vehicle, format ["%1_%2", QGVAR(InitSpeed), _turret], _FCSInitSpeed] call EFUNC(common,setVariablePublic);
|
|
[_vehicle, format ["%1_%2", QGVAR(Magazines), _turret], _FCSMagazines] call EFUNC(common,setVariablePublic);
|
|
[_vehicle, format ["%1_%2", QGVAR(Elevation), _turret], _FCSElevation] call EFUNC(common,setVariablePublic);
|