ACE3/addons/overpressure/functions/fnc_cacheOverPressureValues.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

58 lines
1.7 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: joko // Jonas
* Cache the shot data for a given weapon/mag/ammo combination.
* Will use the config that has the highest priority.
*
* Arguments:
* 0: Weapon <STRING>
* 1: Magazine <STRING>
* 2: Ammo <STRING>
*
* Return Value:
* Shot Config <ARRAY>:
* 0: Angle <Number>
* 1: Range <Number>
* 2: Damage <Number>
*
* Example:
* ["cannon_125mm","Sh_125mm_APFSDS_T_Green","24Rnd_125mm_APFSDS_T_Green"] call ace_overpressure_fnc_cacheOverPressureValues
*
* Public: No
*/
params ["_weapon", "_ammo", "_magazine"];
TRACE_3("Parameter",_weapon,_magazine,_ammo);
// get Priority Array from Config
private _array = [
getNumber (configFile >> "CfgWeapons" >> _weapon >> QGVAR(priority)),
getNumber (configFile >> "CfgMagazines" >> _magazine >> QGVAR(priority)),
getNumber (configFile >> "CfgAmmo" >> _ammo >> QGVAR(priority))
];
(_array call CBA_fnc_findMax) params ["", ["_indexOfMaxPriority", 0, [0]]];
TRACE_2("Priority Array",_array,_indexOfMaxPriority);
// create the Config entry Point
private _config = [
(configFile >> "CfgWeapons" >> _weapon),
(configFile >> "CfgMagazines" >> _magazine),
(configFile >> "CfgAmmo" >> _ammo)
] select _indexOfMaxPriority;
TRACE_1("ConfigPath",_config);
// get the Variables out of the Configes and create a array with then
private _return = [
(getNumber (_config >> QGVAR(angle))),
(getNumber (_config >> QGVAR(range))) * GVAR(distanceCoefficient),
(getNumber (_config >> QGVAR(damage)))
];
private _varName = format [QGVAR(values%1%2%3), _weapon, _ammo, _magazine];
missionNameSpace setVariable [_varName, _return];
TRACE_2("Return",_varName,_return);
_return