Minor optimizations using private, params, and isEqualType (#4323)

* Optimizations with private, params, and isEqualType

* Fixed tab being used instead of space

* Fixed tabs inserted by notepad++

* More usage of new private syntax and params

- changed a few checks for an array being empty to `_arr isEqualTo []`
rather than `count _arr == 0`
- added more uses of `private` on the same line as the variable is
declared
- added more uses of params to assign variables passed as parameters
- removed unnecessary parentheses
- removed several unnecessary variable declarations with private array
syntax

* clean up and formatting
This commit is contained in:
Glowbal 2016-09-04 16:44:22 +02:00 committed by GitHub
parent 60b780e02b
commit b489750d5b
205 changed files with 589 additions and 904 deletions

View File

@ -14,24 +14,22 @@
*/
#include "script_component.hpp"
private ["_muzzleVelocityShiftTableUpperLimit", "_temperatureIndexFunction",
"_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
params ["_muzzleVelocityShiftTable", "_temperature"];
// Check if muzzleVelocityShiftTable is Less Than 11 Entrys
if ((count _muzzleVelocityShiftTable) < 11) exitWith {0};
_muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
private _muzzleVelocityShiftTableUpperLimit = _muzzleVelocityShiftTable select 10;
if (isNil "_muzzleVelocityShiftTableUpperLimit") exitWith { 0 };
// Find exact data index required for given temperature
_temperatureIndexFunction = (_temperature + 15) / 5;
private _temperatureIndexFunction = (_temperature + 15) / 5;
// lower and upper data index used for interpolation
_temperatureIndexA = (0 max (floor(_temperatureIndexFunction))) min 10;
_temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10;
private _temperatureIndexA = (0 max (floor(_temperatureIndexFunction))) min 10;
private _temperatureIndexB = (0 max (ceil(_temperatureIndexFunction))) min 10;
// Interpolation ratio
_interpolationRatio = _temperatureIndexFunction - floor(_temperatureIndexFunction);
private _interpolationRatio = _temperatureIndexFunction - floor(_temperatureIndexFunction);
// Interpolation
(_muzzleVelocityShiftTable select _temperatureIndexA) * (1 - _interpolationRatio) + (_muzzleVelocityShiftTable select _temperatureIndexB) * _interpolationRatio // Return

View File

@ -17,11 +17,9 @@
*/
#include "script_component.hpp"
private "_airDensity";
params ["_ballisticCoefficient", "_temperature"/*in C*/, "_pressure"/*in hPa*/, "_relativeHumidity"/*as ratio 0-1*/, "_atmosphereModel"/*"ICAO" or "ASM"*/];
_airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity);
private _airDensity = [_temperature, _pressure, _relativeHumidity] call EFUNC(weather,calculateAirDensity);
if (_atmosphereModel == "ICAO") then {
(STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient

View File

@ -19,14 +19,13 @@
*/
#include "script_component.hpp"
private ["_twist", "_length", "_stabilityFactor"];
params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"];
// Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf
_twist = _barrelTwist / _caliber;
_length = _bulletLength / _caliber;
private _twist = _barrelTwist / _caliber;
private _length = _bulletLength / _caliber;
_stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2));
private _stabilityFactor = 7587000 * _bulletMass / (_twist^2 * _caliber^3 * _length * (1 + _length^2));
if (_muzzleVelocity > 341.376) then {
(_stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure

View File

@ -15,17 +15,16 @@
private _aceTimeSecond = floor CBA_missionTime;
{
private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"];
_x params ["_bullet","_caliber","_bulletTraceVisible","_index"];
_bulletVelocity = velocity _bullet;
private _bulletVelocity = velocity _bullet;
_bulletSpeed = vectorMagnitude _bulletVelocity;
private _bulletSpeed = vectorMagnitude _bulletVelocity;
if (!alive _bullet || _bulletSpeed < 100) then {
GVAR(allBullets) deleteAt (GVAR(allBullets) find _x);
} else {
_bulletPosition = getPosASL _bullet;
private _bulletPosition = getPosASL _bullet;
if (_bulletTraceVisible && _bulletSpeed > 500) then {
drop ["\A3\data_f\ParticleEffects\Universal\Refract","","Billboard",1,0.1,getPos _bullet,[0,0,0],0,1.275,1,0,[0.02*_caliber,0.01*_caliber],[[0,0,0,0.65],[0,0,0,0.2]],[1,0],0,0,"","",""];

View File

@ -15,11 +15,10 @@
*/
#include "script_component.hpp"
private ["_weaponConfig", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"];
_weaponConfig = (configFile >> "CfgWeapons" >> _this);
private _weaponConfig = (configFile >> "CfgWeapons" >> _this);
_barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
_twistDirection = 1;
private _barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
private _twistDirection = 1;
if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
_twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection");
if !(_twistDirection in [-1, 0, 1]) then {
@ -27,9 +26,9 @@ if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
};
};
_barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength");
private _barrelLength = getNumber(_weaponConfig >> "ACE_barrelLength");
_result = [_barrelTwist, _twistDirection, _barrelLength];
private _result = [_barrelTwist, _twistDirection, _barrelLength];
uiNamespace setVariable [format[QGVAR(%1), _weapon], _result];

View File

@ -15,11 +15,9 @@
*/
#include "script_component.hpp"
private ["_gunName", "_gunProfileEntry"];
_gunName = ctrlText 11001;
private _gunName = ctrlText 11001;
if (_gunName != "") then {
_gunProfileEntry = [_gunName, 810, 100, 0.0679, -0.0010350, 3.81, 0, 2, 10, 120, 0, 0, 9.525, 7.82, 25.40, 0.393, 1, "ICAO"],
private _gunProfileEntry = [_gunName, 810, 100, 0.0679, -0.0010350, 3.81, 0, 2, 10, 120, 0, 0, 9.525, 7.82, 25.40, 0.393, 1, "ICAO"],
GVAR(gunList) = GVAR(gunList) + [_gunProfileEntry];

View File

@ -17,21 +17,20 @@
[] call FUNC(parse_input);
private ["_scopeBaseAngle"];
_scopeBaseAngle = (GVAR(workingMemory) select 3);
GVAR(workingMemory) params ["",
"_muzzleVelocity", "",
"_scopeBaseAngle",
"_airFriction",
"_boreHeight", "", "", "", "", "", "",
"_bulletMass",
"_bulletDiameter",
"_barrelTwist",
"_bc",
"_dragModel",
"_atmosphereModel"
];
private ["_bulletMass", "_bulletDiameter", "_boreHeight", "_airFriction", "_barrelTwist", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel", "_twistDirection"];
_bulletMass = GVAR(workingMemory) select 12;
_bulletDiameter = GVAR(workingMemory) select 13;
_boreHeight = GVAR(workingMemory) select 5;
_airFriction = GVAR(workingMemory) select 4;
_barrelTwist = GVAR(workingMemory) select 14;
_muzzleVelocity = GVAR(workingMemory) select 1;
_bc = GVAR(workingMemory) select 15;
_dragModel = GVAR(workingMemory) select 16;
_atmosphereModel = GVAR(workingMemory) select 17;
_twistDirection = 0;
private _twistDirection = 0;
if (_barrelTwist > 0) then {
_twistDirection = 1;
} else {
@ -39,42 +38,38 @@ if (_barrelTwist > 0) then {
_twistDirection = -1;
};
};
_barrelTwist = abs(_barrelTwist);
_barrelTwist = abs _barrelTwist;
private ["_altitude", "_temperature", "_barometricPressure", "_relativeHumidity"];
_altitude = GVAR(altitude);
_temperature = GVAR(temperature);
_barometricPressure = GVAR(barometricPressure);
_relativeHumidity = GVAR(relativeHumidity);
private _altitude = GVAR(altitude);
private _temperature = GVAR(temperature);
private _barometricPressure = GVAR(barometricPressure);
private _relativeHumidity = GVAR(relativeHumidity);
if (!GVAR(atmosphereModeTBH)) then {
_barometricPressure = 1013.25 * (1 - (0.0065 * _altitude) / (273.15 + _temperature + 0.0065 * _altitude)) ^ 5.255754495;
_relativeHumidity = 50;
};
private ["_bulletLength", "_stabilityFactor"];
_bulletLength = 45.72;
_stabilityFactor = 1.5;
private _bulletLength = 45.72;
private _stabilityFactor = 1.5;
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {
_stabilityFactor = [_bulletDiameter, _bulletLength, _bulletMass, _barrelTwist * 10, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor);
};
};
private ["_latitude", "_directionOfFire", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"];
_latitude = GVAR(latitude) select GVAR(currentTarget);
_directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
_windSpeed1 = (GVAR(windSpeed1) select GVAR(currentTarget));
_windSpeed2 = (GVAR(windSpeed2) select GVAR(currentTarget));
_windDirection = (GVAR(windDirection) select GVAR(currentTarget));
_inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget));
_targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget));
_targetRange = GVAR(rangeCardEndRange);
private _latitude = GVAR(latitude) select GVAR(currentTarget);
private _directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
private _windSpeed1 = (GVAR(windSpeed1) select GVAR(currentTarget));
private _windSpeed2 = (GVAR(windSpeed2) select GVAR(currentTarget));
private _windDirection = (GVAR(windDirection) select GVAR(currentTarget));
private _inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget));
private _targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget));
private _targetRange = GVAR(rangeCardEndRange);
if (GVAR(currentUnit) == 1) then {
_targetRange = _targetRange / 1.0936133;
};
GVAR(rangeCardData) = [];
private ["_result"];
_result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
private _result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
[_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, true, _stabilityFactor, _twistDirection, _latitude, _directionOfFire] call FUNC(calculate_solution);

View File

@ -15,10 +15,8 @@
*/
#include "script_component.hpp"
private ["_targetSize", "_imageSize", "_angle", "_estRange"];
_angle = parseNumber(ctrlText 7012);
_targetSize = parseNumber(ctrlText 7010);
private _angle = parseNumber(ctrlText 7012);
private _targetSize = parseNumber(ctrlText 7010);
if (GVAR(rangeAssistUseTargetHeight)) then {
_targetSize = _targetSize * cos(_angle);
};
@ -33,7 +31,7 @@ switch (GVAR(rangeAssistTargetSizeUnit)) do {
_targetSize = _targetSize * 0.01;
};
};
_imageSize = parseNumber(ctrlText 7011);
private _imageSize = parseNumber(ctrlText 7011);
switch (GVAR(rangeAssistImageSizeUnit)) do {
case 0: {
_imageSize = _imageSize / 6400 * 360;
@ -45,7 +43,7 @@ switch (GVAR(rangeAssistImageSizeUnit)) do {
_imageSize = _imageSize / 60 / 1.047;
};
};
_estRange = parseNumber(ctrlText 7013);
private _estRange = parseNumber(ctrlText 7013);
if (GVAR(currentUnit) == 1) then {
_estRange = _estRange / 1.0936133;
};

View File

@ -15,8 +15,7 @@
*/
#include "script_component.hpp"
private ["_target"];
_target = 0 max _this min 3;
private _target = 0 max _this min 3;
call FUNC(parse_input);

View File

@ -15,8 +15,7 @@
*/
#include "script_component.hpp"
private ["_index"];
_index = lbCurSel 6000;
private _index = lbCurSel 6000;
if (_index == -1) exitWith {};

View File

@ -23,9 +23,8 @@ if !(ctrlVisible 9000) then {
ctrlSetFocus ((uiNamespace getVariable "ATragMX_Display") displayCtrl 9002);
[{
private ["_args", "_startTime"];
_args = _this select 0;
_startTime = _args select 0;
params ["_args"];
_args params ["_startTime"];
if (!(GVAR(speedAssistTimer))) exitWith {
GVAR(speedAssistTimer) = true;

View File

@ -22,10 +22,8 @@ TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_attachedList"];
_attachedList = _unit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
private _attachedList = _unit getVariable [QGVAR(attached), []];
if (_attachedList isEqualTo []) exitWith {};
(_attachedList select 0) params ["_xObject"];
if (!isNull _xObject) then {

View File

@ -22,10 +22,8 @@ TRACE_1("params",_unit);
if (!local _unit) exitWith {};
private ["_attachedList"];
_attachedList = _unit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
private _attachedList = _unit getVariable [QGVAR(attached), []];
if (_attachedList isEqualTo []) exitWith {};
(_attachedList select 0) params ["_xObject", "_xItemName"];
if (isNull _xObject) then {

View File

@ -19,11 +19,9 @@
params ["_deadUnit"];
TRACE_1("params",_deadUnit);
private ["_attachedList"];
private _attachedList = _deadUnit getVariable [QGVAR(attached), []];
_attachedList = _deadUnit getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {};
if (_attachedList isEqualTo []) exitWith {};
{
_x params ["_xObject"];

View File

@ -1,12 +1,10 @@
// by commy2
#include "script_component.hpp"
private "_paper";
params ["_wall"];
if (local _wall) then {
_paper = "UserTexture_1x2_F" createVehicle position _wall;
private _paper = "UserTexture_1x2_F" createVehicle position _wall;
_paper attachTo [_wall, [0,-0.02,0.6]];
_paper setDir getDir _wall;

View File

@ -13,8 +13,7 @@
if (isServer) then {
addMissionEventHandler ["HandleDisconnect", {
params ["_disconnectedPlayer"];
private "_escortedUnit";
_escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull];
private _escortedUnit = _disconnectedPlayer getVariable [QGVAR(escortedUnit), objNull];
if ((!isNull _escortedUnit) && {(attachedTo _escortedUnit) == _disconnectedPlayer}) then {
detach _escortedUnit;
};

View File

@ -16,11 +16,9 @@
*/
#include "script_component.hpp"
private "_returnValue";
params ["_unit", "_newSurrenderState"];
_returnValue = if (_newSurrenderState) then {
private _returnValue = if (_newSurrenderState) then {
//no weapon equiped AND not currently surrendering and
GVAR(allowSurrender) && {(currentWeapon _unit) == ""} && {!(_unit getVariable [QGVAR(isSurrendering), false])}
} else {

View File

@ -16,8 +16,6 @@
*/
#include "script_component.hpp"
private ["_cargo"];
params ["_player", "_unit"];
((vehicle _unit) != _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}

View File

@ -16,20 +16,18 @@
*/
#include "script_component.hpp"
private ["_weapon", "_listedItemClasses", "_actions", "_allGear"];
params ["_player", "_unit"];
_weapon = currentWeapon _player;
private _weapon = currentWeapon _player;
if (_weapon == primaryWeapon _player && {_weapon != ""}) then {
[_player, "AmovPercMstpSlowWrflDnon", 0] call EFUNC(common,doAnimation);
};
_listedItemClasses = [];
private _listedItemClasses = [];
_actions = [localize LSTRING(FriskMenuHeader), ""] call ACE_Interaction_fnc_prepareSelectMenu;
private _actions = [localize LSTRING(FriskMenuHeader), ""] call ACE_Interaction_fnc_prepareSelectMenu;
_allGear = [];
private _allGear = [];
if ((handgunWeapon _unit) != "") then {
_allGear pushBack (handgunWeapon _unit);
@ -54,8 +52,7 @@ if (count (assignedItems _unit) > 0) then {
// Assigned Items
{
if (!(_x in _listedItemClasses)) then {
private "_item";
_item = configFile >> "CfgMagazines" >> _x;
private _item = configFile >> "CfgMagazines" >> _x;
if (isNil "_item" || str _item == "") then { //str _item ?
_item = configFile >> "CfgWeapons" >> _x;
};

View File

@ -21,9 +21,7 @@ params ["_vehicle", "", "_unit"];
TRACE_2("params",_vehicle,_unit);
if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
private ["_cargoIndex"];
_cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1];
private _cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1];
if (_cargoIndex != -1) then {
//If captive was not "unloaded", then move them back into the vehicle.

View File

@ -23,8 +23,7 @@ if (!local _unit) exitWith {};
// Group and side respawn can potentially respawn you as a captive unit
// Base and instant respawn cannot, so captive should be entirely reset
// So we explicity account for the respawn type
private ["_respawn"];
_respawn = [0] call BIS_fnc_missionRespawnType;
private _respawn = [0] call BIS_fnc_missionRespawnType;
if (_respawn > 3) then {
if (_unit getVariable [QGVAR(isHandcuffed), false]) then {

View File

@ -19,11 +19,9 @@
params ["_target","_vehicle"];
TRACE_2("params",_target,_vehicle);
private ["_cargoIndex"];
_getSeat = [_vehicle] call FUNC(findEmptyNonFFVCargoSeat);
TRACE_1("free cargo seat",_getSeat);
_cargoIndex = _getSeat select 0;
_getSeat params ["_cargoIndex"];
if (_cargoIndex == -1) exitWith {ERROR("cargo index -1");};
_target moveInCargo [_vehicle, _cargoIndex];

View File

@ -25,9 +25,8 @@ if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) ex
if (isServer) then {
{
if (isClass _x) then {
private ["_cargoClassname", "_cargoCount"];
_cargoClassname = getText (_x >> "type");
_cargoCount = getNumber (_x >> "amount");
private _cargoClassname = getText (_x >> "type");
private _cargoCount = getNumber (_x >> "amount");
TRACE_3("adding ACE_Cargo", (configName _x), _cargoClassname, _cargoCount);
["ace_addCargo", [_cargoClassname, _vehicle, _cargoCount]] call CBA_fnc_localEvent;
};

View File

@ -171,8 +171,7 @@ switch (_position) do {
};
case "cargo" : {
private "_positions";
_positions = [typeOf _vehicle] call FUNC(getVehicleCargo);
private _positions = [typeOf _vehicle] call FUNC(getVehicleCargo);
{
if (alive _x) then {_positions deleteAt (_positions find (_vehicle getCargoIndex _x))};

View File

@ -53,8 +53,7 @@ _unit action ["Eject", vehicle _unit];
[_unit, _anim, 1, true] call FUNC(doAnimation);
[{
_unit = _this select 0;
_anim = _this select 1;
params ["_unit", "_anim"];
if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then {
[_unit, _anim, 2, true] call FUNC(doAnimation);
};

View File

@ -16,17 +16,15 @@
PARAMS_2(_wirecoil,_unit);
private ["_wireNoGeo", "_dir", "_pos", "_wireNoGeoPos"];
_wireNoGeo = "ACE_ConcertinaWireNoGeo" createVehicle [0,0,0];
private _wireNoGeo = "ACE_ConcertinaWireNoGeo" createVehicle [0,0,0];
{
_wireNoGeo animate [_x, 1];
} count WIRE_FAST;
GVAR(placer) = _unit;
_dir = getDir _unit;
_pos = getPosASL _unit;
_wireNoGeoPos = _pos vectorAdd [1.1 * sin(_dir), 1.1 * cos(_dir), 0];
private _dir = getDir _unit;
private _pos = getPosASL _unit;
private _wireNoGeoPos = _pos vectorAdd [1.1 * sin(_dir), 1.1 * cos(_dir), 0];
_wireNoGeo setDir _dir;
_wireNoGeo setPosASL _wireNoGeoPos;
@ -39,16 +37,15 @@ GVAR(deployPFH) = [{
params ["_args", "_idPFH"];
_args params ["_wireNoGeo", "_wireNoGeoPos", "_unit"];
private ["_range", "_posStart", "_posEnd", "_dirVect", "_dir", "_anim", "_wire"];
_posStart = (_wireNoGeo modelToWorldVisual (_wireNoGeo selectionPosition "start")) call EFUNC(common,positionToASL);
_posEnd = (getPosASL _unit) vectorAdd (vectorDir _unit);
_dirVect = _posStart vectorDiff _posEnd;
_dir = _dirVect call CBA_fnc_vectDir;
_range = vectorMagnitude _dirVect;
_anim = 0 max (1 - (_range / 12));
private _posStart = (_wireNoGeo modelToWorldVisual (_wireNoGeo selectionPosition "start")) call EFUNC(common,positionToASL);
private _posEnd = (getPosASL _unit) vectorAdd (vectorDir _unit);
private _dirVect = _posStart vectorDiff _posEnd;
private _dir = _dirVect call CBA_fnc_vectDir;
private _range = vectorMagnitude _dirVect;
private _anim = 0 max (1 - (_range / 12));
if (!(alive _unit) || _range >= 12 || (_unit getVariable [QGVAR(wireDeployed), false])) exitWith {
_wire = "ACE_ConcertinaWire" createvehicle [0, 0, 0];
private _wire = "ACE_ConcertinaWire" createvehicle [0, 0, 0];
{
_wire animate [_x, _anim];
} count WIRE_FAST;

View File

@ -22,12 +22,10 @@ if (uiNamespace getVariable [QEGVAR(interact_menu,cursorMenuOpened),false]) exit
};
params ["_wire", "_unit"];
private ["_config", "_delay"];
_config = (configFile >> "CfgVehicles" >> typeOf _unit);
_delay = if (getNumber(_config >> "engineer") == 1 || getNumber(_config >> "canDeactivateMines") == 1) then {60} else {120};
private _config = (configFile >> "CfgVehicles" >> typeOf _unit);
private _delay = [120, 60] select (getNumber (_config >> "engineer") == 1 || {getNumber (_config >> "canDeactivateMines") == 1});
// TODO: Animation?
[
_delay,
[_wire],

View File

@ -16,8 +16,6 @@
params ["_wire", "_killer"];
TRACE_2("params",_wire,_killer);
private ["_distance", "_vehicle"];
if (isNull _killer) then {
_killer = _wire getVariable [QGVAR(lastDamager), objNull];
if (isNull _killer) then {
@ -29,9 +27,9 @@ if (isNull _killer) then {
};
if (isNull _killer || {_killer == _wire} || {_killer == gunner (vehicle _killer)}) exitWith {};
_distance = _wire distance _killer;
private _distance = _wire distance _killer;
if (_distance > 14 || {_distance < 2}) exitWith {}; // Fix if shooting wire
_vehicle = vehicle _killer;
private _vehicle = vehicle _killer;
[QGVAR(vehicleDamage), [_wire, _vehicle], [_vehicle]] call CBA_fnc_targetEvent;

View File

@ -447,11 +447,10 @@ GVAR(menuRun) = true;
};
};
if (GVAR(F2)) then {
private ["_grid", "_gridVector"];
_grid = toArray GVAR(vectorGrid);
private _grid = toArray GVAR(vectorGrid);
_grid deleteAt 4;
_grid = toString _grid;
_gridVector = parseNumber _grid;
private _gridVector = parseNumber _grid;
GVAR(digit1) = floor(_gridVector / 10000000);
GVAR(digit2) = floor(_gridVector / 1000000 - GVAR(digit1) *10);
GVAR(digit3) = floor(_gridVector / 100000 - GVAR(digit2) * 10 - GVAR(digit1) * 100);

View File

@ -21,9 +21,7 @@
params ["_caller", "_target", "_listOfObjectsToRemove"];
private "_itemsToAdd";
_itemsToAdd = [];
private _itemsToAdd = [];
{
if (_x == (uniform _target)) then {
_itemsToAdd = _itemsToAdd + (uniformItems _target);

View File

@ -18,10 +18,8 @@
params ["_target"];
private ["_items", "_counts"];
_items = [];
_counts = [];
private _items = [];
private _counts = [];
{
_x params ["_item", "_count"];
_items append _item;

View File

@ -17,7 +17,6 @@
*/
#include "script_component.hpp"
params ["_caller", "_target"];
private "_display";
#define DEFUALTPATH "\A3\Ui_f\data\GUI\Cfg\Ranks\%1_gs.paa"
//Sanity Checks
if (_caller != ACE_player) exitWith {ERROR("Player isn't caller?");};
@ -28,7 +27,7 @@ disableSerialization;
createDialog QGVAR(remoteInventory);
_display = uiNamespace getVariable ["ACE_remoteInventory", displayNull];
private _display = uiNamespace getVariable ["ACE_remoteInventory", displayNull];
if (isNull _display) exitWith {ERROR("Display is Null");};
GVAR(disarmTarget) = _target;

View File

@ -18,20 +18,17 @@
#include "script_component.hpp"
disableSerialization;
private ["_classname", "_count", "_displayName", "_picture"];
params ["_listBoxCtrl", "_itemsCountArray"];
{
private "_configPath";
_displayName = "";
_picture = "";
_classname = _x;
_count = (_itemsCountArray select 1) select _forEachIndex;
private _classname = _x;
private _count = (_itemsCountArray select 1) select _forEachIndex;
if ((_classname != DUMMY_ITEM) && {_classname != "ACE_FakePrimaryWeapon"}) then { //Don't show the dummy potato or fake weapon
private "_configPath";
private _displayName = "";
private _picture = "";
switch (true) do {
case (isClass (configFile >> "CfgWeapons" >> _classname)): {
_configPath = (configFile >> "CfgWeapons");

View File

@ -21,8 +21,6 @@
*/
#include "script_component.hpp"
private ["_problem", "_beginingArray", "_index"];
PARAMS_4(_startA,_endA,_startB,_endB);
//Quick Lazy Count Check
@ -30,11 +28,11 @@ if (((count _startA) + (count _startB)) != ((count _endA) + (count _endB))) exit
false
};
_beginingArray = (_startA + _startB);
private _beginingArray = (_startA + _startB);
_problem = false;
private _problem = false;
{
_index = _beginingArray find _x;
private _index = _beginingArray find _x;
if (_index == -1) exitWith {_problem = true;};
_beginingArray deleteAt _index;
} forEach (_endA + _endB);

View File

@ -36,9 +36,11 @@ _itemCount = [];
_children = [];
{
private "_name";
_name = if(isText(_x >> "displayNameShort") && {getText(_x >> "displayNameShort") != ""}) then
{getText (_x >> "displayNameShort")}else{getText(_x >> "displayName")};
private _name = getText (_x >> "displayNameShort");
if (_name isEqualTo "") then {
_name = getText (_x >> "displayName");
};
_children pushBack
[
[

View File

@ -26,8 +26,7 @@ if ((_i mod 4) == 0) then {
};
ctrlSetText [1400,format["Calling%1",_arr select (_i - 4)]];
private "_explosive";
_explosive = [_code] call FUNC(getSpeedDialExplosive);
private _explosive = [_code] call FUNC(getSpeedDialExplosive);
if (_i >= (count _arr + 2)) then {
[_pfID] call CALLSTACK(CBA_fnc_removePerFrameHandler);

View File

@ -15,9 +15,7 @@
*/
#include "script_component.hpp"
private "_speedDial";
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
private _speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
if (count _speedDial == 0) exitWith {};
{
if ((_x select 0) == (_this select 0)) exitWith {

View File

@ -20,9 +20,7 @@
params ["_explosive", "_magazine", "_trigger"];
TRACE_3("params",_explosive,_magazine,_trigger);
private ["_config"];
_config = ConfigFile >> "ACE_Triggers" >> _trigger;
private _config = ConfigFile >> "ACE_Triggers" >> _trigger;
// If the onSetup function returns true, it is handled elsewhere
if (isText(_config >> "onSetup") && {[_explosive,_magazine] call compile getText (_config >> "onSetup")}) exitWith {

View File

@ -15,11 +15,10 @@
* Public: No
*/
#include "script_component.hpp"
private ["_speedDial", "_amount"];
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
if (count _speedDial == 0) exitWith {};
_amount = if((_this select 0))then{1}else{-1};
private _speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
if (_speedDial isEqualTo []) exitWith {};
private _amount = [-1, 1] select (_this select 0);
GVAR(CurrentSpeedDial) = (GVAR(CurrentSpeedDial) + _amount + count _speedDial) mod (count _speedDial);

View File

@ -16,31 +16,30 @@
#include "script_component.hpp"
params ["_vehicle"];
private ["_config", "_ropeOrigins", "_ropeOrigin", "_deployedRopes", "_hookAttachment", "_origin", "_dummy", "_hook", "_ropeTop", "_ropeBottom"];
_config = configFile >> "CfgVehicles" >> typeOf _vehicle;
private _config = configFile >> "CfgVehicles" >> typeOf _vehicle;
_ropeOrigins = getArray (_config >> QGVAR(ropeOrigins));
_deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
_hookAttachment = _vehicle getVariable [QGVAR(FRIES), _vehicle];
private _ropeOrigins = getArray (_config >> QGVAR(ropeOrigins));
private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
private _hookAttachment = _vehicle getVariable [QGVAR(FRIES), _vehicle];
{
_ropeOrigin = _x;
_hook = QGVAR(helper) createVehicle [0, 0, 0];
private _ropeOrigin = _x;
private _hook = QGVAR(helper) createVehicle [0, 0, 0];
_hook allowDamage false;
if (typeName _ropeOrigin == "ARRAY") then {
if (_ropeOrigin isEqualType []) then {
_hook attachTo [_hookAttachment, _ropeOrigin];
} else {
_hook attachTo [_hookAttachment, [0, 0, 0], _ropeOrigin];
};
_origin = getPosATL _hook;
private _origin = getPosATL _hook;
_dummy = createVehicle [QGVAR(helper), _origin vectorAdd [0, 0, -1], [], 0, "CAN_COLLIDE"];
private _dummy = createVehicle [QGVAR(helper), _origin vectorAdd [0, 0, -1], [], 0, "CAN_COLLIDE"];
_dummy allowDamage false;
_dummy disableCollisionWith _vehicle;
_ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [0, 0, 0], 0.5];
_ropeBottom = ropeCreate [_dummy, [0, 0, 0], 1];
private _ropeTop = ropeCreate [_dummy, [0, 0, 0], _hook, [0, 0, 0], 0.5];
private _ropeBottom = ropeCreate [_dummy, [0, 0, 0], 1];
ropeUnwind [_ropeBottom, 30, 34.5, false];
_ropeTop addEventHandler ["RopeBreak", {[_this, "top"] call FUNC(onRopeBreak)}];

View File

@ -1,4 +1,3 @@
#include "script_component.hpp"
private ["_round"];
_round = _this select 0;
params ["_round"];
GVAR(blackList) set [(count GVAR(blackList)), _round];

View File

@ -1,23 +1,20 @@
#include "script_component.hpp"
private ["_color", "_data", "_index", "_obj", "_objSpd", "_origin", "_positions"];
if (GVAR(autoTrace)) then {
[] call FUNC(startTracing);
};
// setAccTime 0.05;
_index = (count GVAR(traces));
_obj = _this select 1;
_origin = _this select 0;
_color = [1,0,0,1];
private _index = count GVAR(traces);
params ["_origin", "_obj"];
private _color = [1,0,0,1];
if((count _this) > 2) then {
_color = _this select 2;
};
_positions = [];
_objSpd = vectorMagnitude (velocity _obj);
private _positions = [];
private _objSpd = vectorMagnitude (velocity _obj);
_positions set[(count _positions), [(getPos _obj), _objSpd]];
_data = [_origin, typeOf _origin, typeOf _obj, _objSpd, _positions, _color];
private _data = [_origin, typeOf _origin, typeOf _obj, _objSpd, _positions, _color];
GVAR(traces) set[_index, _data];
[DFUNC(trackTrace), 0, [_obj, _index, CBA_missionTime]] call CBA_fnc_addPerFrameHandler;

View File

@ -1,18 +1,12 @@
//fnc_doExplosions.sqf
#include "script_component.hpp"
private ["_params", "_explosions", "_index", "_i", "_exp", "_refExp", "_bpos", "_hit", "_distance", "_indirectHitRange", "_depth"];
_params = _this select 0;
_explosions = _params select 0;
_index = _params select 1;
params ["_args"];
_args params ["_explosions", "_index"];
for "_i" from _index to ((_index+2) min (count _explosions)) do {
_exp = _explosions select _i;
_refExp = _exp select 0;
_bpos = _exp select 1;
_hit = _exp select 2;
_distance = _exp select 3;
_indirectHitRange = _exp select 4;
_depth = _exp select 5;
private _exp = _explosions select _i;
_exp params ["_refExp", "_bpos", "_hit", "_distance", "_indirectHitRange", "_depth"];
_refExp createVehicle (ASLtoATL _bpos);
// if(_hit >= 150 && _distance > _indirectHitRange) then {
// [_bpos, _refExp, _depth] call FUNC(doReflections);

View File

@ -1,18 +1,16 @@
//fnc_doReflections.sqf
#include "script_component.hpp"
private ["_pos", "_ammo", "_depth", "_hit", "_range", "_hitFactor", "_indirectHitRange", "_indirectHit", "_testParams"];
params ["_pos", "_ammo"];
_pos = _this select 0;
_ammo = _this select 1;
_depth = 1;
private _depth = 1;
if(count _this > 2) then {
_depth = _this select 2;
};
// TEST_ICONS pushBack [_pos, format["EXP!", _hit, _range, _hitFactor]];
if(_depth <= 2) then {
_indirectHitRange = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHitRange");
_indirectHit = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHit");
_testParams = [_pos, [_indirectHitRange, _indirectHit], [], [], -4, _depth, 0];
private _indirectHitRange = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHitRange");
private _indirectHit = getNumber(configFile >> "CfgAmmo" >> _ammo >> "indirectHit");
private _testParams = [_pos, [_indirectHitRange, _indirectHit], [], [], -4, _depth, 0];
[DFUNC(findReflections), 0, _testParams] call CBA_fnc_addPerFrameHandler;
};

View File

@ -2,46 +2,41 @@
#include "script_component.hpp"
// ACE_player sideChat "WAAAAAAAAAAAAAAAAAAAAA";
private ["_hitData", "_initialData", "_hpData", "_object", "_foundObjects", "_index", "_foundObjecsts", "_roundType", "_round", "_caliber", "_explosive", "_idh", "_alive", "_exit", "_vm", "_velocity", "_oldVelocity", "_curVelocity", "_diff", "_polar", "_unitDir", "_spallPos", "_pos1", "_i", "_pos2", "_blah", "_data", "_spallPolar", "_warn", "_c", "_m", "_k", "_gC", "_fragPower", "_fragTypes", "_spread", "_spallCount", "_elev", "_dir", "_vel", "_spallFragVect", "_fragType", "_fragment", "_pos"];
params ["_hitData"];
private _initialData = GVAR(spallHPData) select (_hitData select 0);
private _hpData = (_hitData select 1) select (_this select 1);
_hitData = _this select 0;
_initialData = GVAR(spallHPData) select (_hitData select 0);
_hpData = (_hitData select 1) select (_this select 1);
_object = _hpData select 0;
_hpData params ["_object"];
_object removeEventHandler ["hitPart", _initialData select 0];
_foundObjects = _initialData select 7;
_index = _foundObjects find _object;
private _foundObjects = _initialData select 7;
private _index = _foundObjects find _object;
if(_index != -1) then {
_foundObjecsts set[_index, nil];
_foundObjects set[_index, nil];
};
_roundType = (_initialData select 2);
_round = (_initialData select 3);
_object = (_initialData select 1);
_initialData params ["", "_object", "_roundType", "_round"];
_caliber = getNumber(configFile >> "CfgAmmo" >> _roundType >> "caliber");
_explosive = getNumber(configFile >> "CfgAmmo" >> _roundType >> "explosive");
_idh = getNumber(configFile >> "CfgAmmo" >> _roundType >> "indirectHitRange");
private _caliber = getNumber(configFile >> "CfgAmmo" >> _roundType >> "caliber");
private _explosive = getNumber(configFile >> "CfgAmmo" >> _roundType >> "explosive");
private _idh = getNumber(configFile >> "CfgAmmo" >> _roundType >> "indirectHitRange");
_alive = true;
if(!alive _round && (_initialData select 6) == 1) then {
private _alive = true;
if(!alive _round && (_initialData select 6) isEqualTo 1) then {
_alive = false;
};
if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
// ACE_player sideChat format["BBBB"];
_exit = false;
_vm = 1;
_velocity = _initialData select 5;
private _exit = false;
private _vm = 1;
private _velocity = _initialData select 5;
_oldVelocity = vectorMagnitude _velocity;
_curVelocity = vectorMagnitude (velocity _round);
private _oldVelocity = vectorMagnitude _velocity;
private _curVelocity = vectorMagnitude (velocity _round);
if(alive _round) then {
_diff = _velocity vectorDiff (velocity _round);
_polar = _diff call CBA_fnc_vect2polar;
private _diff = _velocity vectorDiff (velocity _round);
private _polar = _diff call CBA_fnc_vect2polar;
// ACE_player sideChat format["polar: %1", _polar];
if((abs(_polar select 1) > 45 || abs(_polar select 2) > 45)) then {
if(_caliber < 2.5) then {
@ -53,12 +48,12 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
};
};
if(!_exit) then {
_unitDir = vectorNormalized _velocity;
_pos = _hpData select 3;
_spallPos = nil;
private _unitDir = vectorNormalized _velocity;
private _pos = _hpData select 3;
private _spallPos = nil;
for "_i" from 0 to 100 do {
_pos1 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * _i));
_pos2 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * (_i + 1)));
private _pos1 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * _i));
private _pos2 = _pos vectorAdd (_unitDir vectorMultiply (0.01 * (_i + 1)));
// _blah = [_object, "FIRE"] intersect [_object worldToModel (ASLtoATL _pos1), _object worldToModel (ASLtoATL _pos2)];
// diag_log text format["b: %1", _blah];
@ -71,29 +66,29 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
};
};
if(!isNil "_spallPos") then {
_spallPolar = _velocity call CBA_fnc_vect2polar;
private _spallPolar = _velocity call CBA_fnc_vect2polar;
if(_explosive > 0) then {
// ACE_player sideChat format["EXPLOSIVE!"];
_warn = false;
_c = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(CHARGE));
private _warn = false;
private _c = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(CHARGE));
if(_c == 0) then { _c = 1; _warn = true;};
_m = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(METAL));
private _m = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(METAL));
if(_m == 0) then { _m = 2; _warn = true;};
_k = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(GURNEY_K));
private _k = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(GURNEY_K));
if(_k == 0) then { _k = 1/2; _warn = true;};
_gC = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(GURNEY_C));
private _gC = getNumber(configFile >> "CfgAmmo" >> _roundType >> QGVAR(GURNEY_C));
if(_gC == 0) then { _gC = 2440; _warn = true;};
if(_warn) then {
ACE_LOGWARNING_1("Ammo class %1 lacks proper explosive properties definitions for frag!",_roundType); //TODO: turn this off when we get closer to release
};
_fragPower = (((_m/_c)+_k)^-(1/2))*_gC;
private _fragPower = (((_m/_c)+_k)^-(1/2))*_gC;
_spallPolar set[0, _fragPower*0.66];
};
_fragTypes = [
private _fragTypes = [
QGVAR(spall_small), QGVAR(spall_small), QGVAR(spall_small),
QGVAR(spall_small),QGVAR(spall_medium),QGVAR(spall_medium),QGVAR(spall_medium),
QGVAR(spall_medium), QGVAR(spall_large), QGVAR(spall_large), QGVAR(spall_huge),
@ -102,21 +97,21 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
];
// diag_log text format["SPALL POWER: %1", _spallPolar select 0];
_spread = 15+(random 25);
_spallCount = 5+(random 10);
private _spread = 15+(random 25);
private _spallCount = 5+(random 10);
for "_i" from 1 to _spallCount do {
_elev = ((_spallPolar select 2)-_spread)+(random (_spread*2));
_dir = ((_spallPolar select 1)-_spread)+(random (_spread*2));
private _elev = ((_spallPolar select 2)-_spread)+(random (_spread*2));
private _dir = ((_spallPolar select 1)-_spread)+(random (_spread*2));
if(abs _elev > 90) then {
_dir = _dir + 180;
};
_dir = _dir % 360;
_vel = (_spallPolar select 0)*0.33*_vm;
private _vel = (_spallPolar select 0)*0.33*_vm;
_vel = (_vel-(_vel*0.25))+(random (_vel*0.5));
_spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
_fragType = round (random ((count _fragTypes)-1));
_fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
private _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
private _fragType = round (random ((count _fragTypes)-1));
private _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
_fragment setPosASL _spallPos;
_fragment setVelocity _spallFragVect;
@ -127,18 +122,18 @@ if(_alive || {_caliber >= 2.5} || {(_explosive > 0 && {_idh >= 1})}) then {
_spread = 5+(random 5);
_spallCount = 3+(random 5);
for "_i" from 1 to _spallCount do {
_elev = ((_spallPolar select 2)-_spread)+(random (_spread*2));
_dir = ((_spallPolar select 1)-_spread)+(random (_spread*2));
private _elev = ((_spallPolar select 2)-_spread)+(random (_spread*2));
private _dir = ((_spallPolar select 1)-_spread)+(random (_spread*2));
if(abs _elev > 90) then {
_dir = _dir + 180;
};
_dir = _dir % 360;
_vel = (_spallPolar select 0)*0.55*_vm;
private _vel = (_spallPolar select 0)*0.55*_vm;
_vel = (_vel-(_vel*0.25))+(random (_vel*0.5));
_spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
_fragType = round (random ((count _fragTypes)-1));
_fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
private _spallFragVect = [_vel, _dir, _elev] call CBA_fnc_polar2vect;
private _fragType = round (random ((count _fragTypes)-1));
private _fragment = (_fragTypes select _fragType) createVehicleLocal [0,0,10000];
_fragment setPosASL _spallPos;
_fragment setVelocity _spallFragVect;

View File

@ -1,25 +1,18 @@
//fnc_findReflections.sqf
#include "script_component.hpp"
private ["_split", "_radi", "_params", "_pos", "_explosiveInfo", "_los", "_nlos", "_zIndex", "_depth", "_indirectHitRange", "_indirectHit", "_distanceCount", "_lastPos", "_test", "_vec", "_testPos", "_buckets", "_excludes", "_bucketIndex", "_bucketPos", "_bucketList", "_c", "_index", "_blist", "_avgX", "_avgY", "_avgZ", "_bpos", "_distance", "_hitFactor", "_hit", "_range", "_refExp", "_rand", "_i", "_x", "_res", "_forEachIndex", "_explosions", "_can", "_dirvec", "_zAng"];
private ["_lastPos", "_test", "_vec", "_testPos", "_buckets", "_excludes", "_bucketIndex", "_bucketPos", "_bucketList", "_c", "_index", "_blist", "_avgX", "_avgY", "_avgZ", "_bpos", "_distance", "_hitFactor", "_hit", "_range", "_refExp", "_i", "_x", "_res", "_forEachIndex", "_explosions", "_can", "_dirvec", "_zAng"];
BEGIN_COUNTER(fnc_findReflections);
_params = _this select 0;
_pos = _params select 0;
_explosiveInfo = _params select 1;
_los = _params select 2;
_nlos = _params select 3;
_zIndex = _params select 4;
_depth = _params select 5;
_rand = _params select 6;
params ["_args"];
_args params ["_pos", "_explosiveInfo", "_los", "_nlos", "_zIndex", "_depth", "_rand"];
_split = 15;
_radi = (360/_split*_depth);
private _split = 15;
private _radi = (360/_split*_depth);
// player sideChat format["p: %1", _explosiveInfo];
_indirectHitRange = _explosiveInfo select 0;
_indirectHit = _explosiveInfo select 1;
_distanceCount = (floor _indirectHitRange*4) min 100;
_explosiveInfo params ["_indirectHitRange", "_indirectHit"];
private _distanceCount = (floor _indirectHitRange*4) min 100;
if(_zIndex < 5) then {
_lastPos = _pos;

View File

@ -11,18 +11,15 @@ if(!isServer) exitWith { };
BEGIN_COUNTER(frago);
// _startTime = diag_tickTime;
private ["_startTime", "_round", "_lastPos", "_lastVel", "_shellType", "_gun", "_fragTypes", "_warn", "_atlPos", "_isArmed", "_fuseDist", "_indirectHitRange", "_fragRange", "_c", "_m", "_k", "_gC", "_fragPower", "_fragPowerRandom", "_manObjects", "_objects", "_crew", "_fragCount", "_fragArcs", "_doRandom", "_boundingBox", "_targetPos", "_distance", "_add", "_bbX", "_bbY", "_bbZ", "_cubic", "_targetVel", "_baseVec", "_dir", "_currentCount", "_count", "_vecVar", "_vec", "_fp", "_vel", "_fragType", "_fragObj", "_randomCount", "_sectorSize", "_sectorOffset", "_i", "_randomDir", "_endTime", "_target"];
private ["_fuseDist", "_indirectHitRange", "_fragRange", "_c", "_m", "_k", "_gC", "_fragPower", "_fragPowerRandom", "_manObjects", "_objects", "_crew", "_fragCount", "_fragArcs", "_doRandom", "_boundingBox", "_targetPos", "_distance", "_add", "_bbX", "_bbY", "_bbZ", "_cubic", "_targetVel", "_baseVec", "_dir", "_currentCount", "_count", "_vecVar", "_vec", "_fp", "_vel", "_fragType", "_fragObj", "_randomCount", "_sectorSize", "_sectorOffset", "_i", "_randomDir", "_endTime", "_target"];
_round = _this select 0;
_lastPos = _this select 1;
_lastVel = _this select 2;
_shellType = _this select 3;
_gun = nil;
params ["_round", "_lastPos", "_lastVel", "_shellType"];
private _gun = nil;
if((count _this) > 5) then {
_gun = _this select 5;
};
_fragTypes = [
private _fragTypes = [
QGVAR(tiny), QGVAR(tiny), QGVAR(tiny),
QGVAR(tiny_HD), QGVAR(tiny_HD), QGVAR(tiny_HD),
QGVAR(small),QGVAR(small),QGVAR(small),QGVAR(small),
@ -30,16 +27,16 @@ _fragTypes = [
QGVAR(medium_HD), QGVAR(medium_HD), QGVAR(medium_HD), QGVAR(medium_HD), QGVAR(medium_HD)
];
_warn = false;
private _warn = false;
if(isArray (configFile >> "CfgAmmo" >> _shellType >> QGVAR(CLASSES))) then {
_fragTypes = getArray (configFile >> "CfgAmmo" >> _shellType >> QGVAR(CLASSES));
} else {
_warn = true;
};
_atlPos = ASLtoATL _lastPos;
private _atlPos = ASLtoATL _lastPos;
_isArmed = true;
private _isArmed = true;
if(!isNil "_gun") then {
_fuseDist = getNumber(configFile >> "CfgAmmo" >> _shellType >> "fuseDistance");
_isArmed = ((getPosASL _gun) distance _lastPos > _fuseDist);

View File

@ -1,31 +1,27 @@
//fnc_spallTrack.sqf
#include "script_component.hpp"
private ["_round", "_multiplier", "_foundObjects", "_foundObjectHPIds", "_delta", "_curPos", "_velocity", "_velocityStep", "_forwardPos", "_intersectsWith", "_index", "_hpId", "_data"];
_round = _this select 0;
_multiplier = _this select 1;
_foundObjects = _this select 2;
_foundObjectHPIds = _this select 3;
params ["_round", "_multiplier", "_foundObjects", "_foundObjectHPIds"];
_delta = (1/diag_fps) * _multiplier;
_curPos = getPosASL _round;
_velocity = velocity _round;
private _delta = (1/diag_fps) * _multiplier;
private _curPos = getPosASL _round;
private _velocity = velocity _round;
_velocityStep = _velocity vectorMultiply _delta;
_forwardPos = _curPos vectorAdd _velocityStep;
private _velocityStep = _velocity vectorMultiply _delta;
private _forwardPos = _curPos vectorAdd _velocityStep;
_intersectsWith = lineIntersectsWith [_curPos, _forwardPos];
private _intersectsWith = lineIntersectsWith [_curPos, _forwardPos];
if (count _intersectsWith > 0) then {
// player sideChat format["inter: %1", _intersectsWith];
{
if(!(_x in _foundObjects)) then {
// diag_log text format["Adding HP: %1", _x];
_index = (count GVAR(spallHPData));
_hpId = _x addEventHandler ["hitPart", compile format["[%1, _this] call " + QFUNC(spallHP), _index]];
private _index = count GVAR(spallHPData);
private _hpId = _x addEventHandler ["hitPart", compile format["[%1, _this] call " + QFUNC(spallHP), _index]];
_foundObjects set[(count _foundObjects), _x];
_foundObjectHPIds set[(count _foundObjectHPIds), _hpId];
_data = [_hpId, _x, typeOf _round, _round, _curPos, _velocity, 0, _foundObjects, _foundObjectHPIds];
private _data = [_hpId, _x, typeOf _round, _round, _curPos, _velocity, 0, _foundObjects, _foundObjectHPIds];
GVAR(spallHPData) set[_index, _data];
};
} forEach _intersectsWith;

View File

@ -1,14 +1,12 @@
#include "script_component.hpp"
private ["_params", "_tracerObj", "_index", "_positions", "_data"];
_params = _this select 0;
_tracerObj = _params select 0;
_index = _params select 1;
params ["_args"];
_args params ["_tracerObj", "_index"];
if (alive _tracerObj && (count GVAR(traces)) > 0) then {
_data = GVAR(traces) select _index;
_positions = _data select 4;
_positions set [(count _positions), [(getPos _tracerObj), vectorMagnitude (velocity _tracerObj)]];
private _data = GVAR(traces) select _index;
private _positions = _data select 4;
_positions pushBack [(getPos _tracerObj), vectorMagnitude (velocity _tracerObj)];
} else {
[(_this select 1)] call CBA_fnc_removePerFrameHandler;
};

View File

@ -19,8 +19,7 @@
params ["_vehicle", "_player"];
private "_actions";
_actions = [];
private _actions = [];
{
private _unit = _x;

View File

@ -22,8 +22,7 @@ params ["_unit", "_target"];
[_unit, "GestureGo"] call EFUNC(common,doGesture);
private "_chance";
_chance = [0.5, 0.8] select (count weapons _unit > 0);
private _chance = [0.5, 0.8] select (count weapons _unit > 0);
{
if (count weapons _x == 0 && {random 1 < _chance}) then {

View File

@ -16,15 +16,13 @@
*/
#include "script_component.hpp"
private "_info";
_info = [MACRO_DOOR_REACH_DISTANCE] call FUNC(getDoor);
private _info = [MACRO_DOOR_REACH_DISTANCE] call FUNC(getDoor);
_info params ["_house", "_door"];
if (isNull _house) exitWith {};
private "_getDoorAnimations";
_getDoorAnimations = [_house, _door] call FUNC(getDoorAnimations);
private _getDoorAnimations = [_house, _door] call FUNC(getDoorAnimations);
_getDoorAnimations params ["_animations", "_lockedVariable"];
@ -49,8 +47,7 @@ GVAR(usedScrollWheel) = false;
// didn't use incremental opening. Just do animation normally.
if !(GVAR(usedScrollWheel)) then {
private "_phase";
_phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
private _phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5);
{_house animate [_x, _phase]; false} count _animations;
};

View File

@ -22,13 +22,11 @@ params ["_unit"];
[_unit, "GestureGo"] call EFUNC(common,doGesture);
private "_chance";
_chance = [0.5, 0.8] select (count weapons _unit > 0);
private _chance = [0.5, 0.8] select (count weapons _unit > 0);
{
if (count weapons _x == 0 && {random 1 < _chance}) then {
private "_position";
_position = getPosASL _unit vectorAdd (eyeDirection _unit vectorMultiply SEND_DISTANCE);
private _position = getPosASL _unit vectorAdd (eyeDirection _unit vectorMultiply SEND_DISTANCE);
_position set [2, 0];
[QGVAR(sendAway), [_x, _position], [_x]] call CBA_fnc_targetEvent;

View File

@ -26,8 +26,7 @@ params ["_leftClick", "_rightClick", ["_scroll", ""]];
disableSerialization;
private "_display";
_display = uiNamespace getVariable ["ACE_Helper_Display", objNull];
private _display = uiNamespace getVariable ["ACE_Helper_Display", objNull];
if (isNull _display) exitWith {};

View File

@ -6,9 +6,7 @@ PARAMS_2(_shooter,_weapon);
// Bail on not missile or javelin PFEH not running
if ((_shooter != ACE_player) || {(GVAR(pfehID) == -1)}) exitWith { false };
private ["_configs"];
_configs = configProperties [configFile >> "CfgWeapons" >> _weapon, QUOTE(configName _x == QUOTE(QGVAR(enabled))), false];
private _configs = configProperties [configFile >> "CfgWeapons" >> _weapon, QUOTE(configName _x == QUOTE(QGVAR(enabled))), false];
if (((count _configs) < 1) || {(getNumber (_configs select 0)) != 1}) exitWith {};
__JavelinIGUITargeting ctrlShow false;

View File

@ -123,7 +123,7 @@ _offsetY = __OffsetY;
__JavelinIGUITargeting ctrlShow true;
__JavelinIGUITargetingConstrains ctrlShow true;
_zamerny = if (_currentTarget isKindOf "CAManBase") then {_currentTarget selectionPosition "body"} else {_currentTarget selectionPosition "zamerny"};
_zamerny = _currentTarget selectionPosition (["zamerny", "body"] select (_currentTarget isKindOf "CAManBase"));
_randomPosWithinBounds = [(_zamerny select 0) + 1 - (random 2.0),(_zamerny select 1) + 1 - (random 2.0),(_zamerny select 2) + 0.5 - (random 1.0)];
_apos = worldToScreen (_currentTarget modelToWorld _randomPosWithinBounds);

View File

@ -103,8 +103,7 @@ switch (_this) do {
case 6: { // Backlight
};
case 7: { // Exit
private ["_exit"];
_exit = true;
private _exit = true;
if (GVAR(referenceHeadingMenu) == 1) then {
GVAR(referenceHeadingMenu) = 0;
_exit = false;

View File

@ -16,10 +16,9 @@
* Public: No
*/
#include "script_component.hpp"
private "_table";
params ["_year", "_month", "_day"];
_table = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4];
private _table = [0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4];
if (_month < 3) then {
_year = _year - 1;
};

View File

@ -62,8 +62,7 @@ GVAR(Overlay) = true;
if (diag_tickTime > GVAR(updateTimer)) then {
GVAR(updateTimer) = diag_tickTime + 1;
private ["_outputData"];
_outputData = [] call FUNC(generateOutputData);
private _outputData = [] call FUNC(generateOutputData);
3 cutRsc ["RscKestrel4500", "PLAIN", 1, false];
_outputData params [

View File

@ -18,9 +18,7 @@
#define __ctrlCenterLine3 (__dsp displayCtrl 74602)
#define __ctrlCenterLine4 (__dsp displayCtrl 74603)
private ["_outputData"];
_outputData = [] call FUNC(generateOutputData);
private _outputData = [] call FUNC(generateOutputData);
{
ctrlSetText [_x , _outputData select _forEachIndex];

View File

@ -14,9 +14,7 @@
*/
#include "script_component.hpp"
private ["_windSpeed"];
_windSpeed = call FUNC(measureWindSpeed);
private _windSpeed = call FUNC(measureWindSpeed);
GVAR(ImpellerState) = GVAR(ImpellerState) + (ceil(_windSpeed) min 1) max _windSpeed;
if (GVAR(ImpellerState) > 1000) then { GVAR(ImpellerState) = 0 };

View File

@ -1,21 +1,18 @@
#include "script_component.hpp"
private ["_pos1", "_pos2", "_spacing", "_vectorTo", "_x", "_y", "_z", "_distance", "_count", "_return", "_alt", "_pos", "_designator", "_seeker"];
_pos1 = _this select 0;
_pos2 = _this select 1;
_designator = _this select 2;
_seeker = _this select 3;
_spacing = 100;
params ["_pos1", "_pos2", "_designator", "_seeker"]
private _spacing = 100;
if((count _this) > 4) then {
_spacing = _this select 4;
};
_return = true;
_vectorTo = [_pos2, _pos1] call BIS_fnc_vectorFromXToY;
private _return = true;
private _vectorTo = [_pos2, _pos1] call BIS_fnc_vectorFromXToY;
_x = (_vectorTo select 0)*0.25;
_y = (_vectorTo select 1)*0.25;
_z = (_vectorTo select 2)*0.25;
private _x = (_vectorTo select 0)*0.25;
private _y = (_vectorTo select 1)*0.25;
private _z = (_vectorTo select 2)*0.25;
_pos2 = [(_pos2 select 0) + _x, (_pos2 select 1) + _y, (_pos2 select 2) + _z];

View File

@ -1,13 +1,12 @@
#include "script_component.hpp"
private["_checkPos", "_i", "_largest", "_largestSpot", "_list", "_outliers", "_remainingSpots", "_samplePos", "_spot", "_spots", "_testPos"];
_list = _this select 0;
_checkPos = _this select 1;
_spots = [];
_outliers = [];
_spot = [];
_testPos = (_list select 0) select 0;
params ["_list", "_checkPos"];
private _spots = [];
private _outliers = [];
private _spot = [];
(_list select 0) params ["_testPos"];
{
_samplePos = _x select 0;
_x params ["_samplePos"];
if(!lineIntersects [_samplePos, _checkPos] && {!terrainIntersectASL [_samplePos, _checkPos]}) then {
if(_samplePos distance _testPos < 2) then {
_spot pushBack _samplePos;
@ -20,12 +19,12 @@ _spots pushBack _spot;
if(count _outliers > 0) then {
for "_i" from 1 to 3 do {
_remainingSpots = _outliers;
private _remainingSpots = _outliers;
_outliers = [];
_spot = [];
_testPos = (_remainingSpots select 0);
{
_samplePos = _x;
private _samplePos = _x;
if(!lineIntersects [_samplePos, _checkPos] && {!terrainIntersectASL [_samplePos, _checkPos]}) then {
if(_samplePos distance _testPos < 2) then {
_spot pushBack _samplePos;
@ -37,11 +36,11 @@ if(count _outliers > 0) then {
_spots pushBack _spot;
};
};
_largest = 0;
_largestSpot = [];
private _largest = 0;
private _largestSpot = [];
{
if((count _x) > _largest) then {
_largest = (count _x);
if(count _x > _largest) then {
_largest = count _x;
_largestSpot = _x;
};
} forEach _spots;

View File

@ -1,8 +1,7 @@
//fnc_handleLaserOff.sqf
#include "script_component.hpp"
private ["_uuid"];
_uuid = _this select 0;
params ["_uuid"];
if ([GVAR(laserEmitters), _uuid] call CBA_fnc_hashHasKey) then {
[GVAR(laserEmitters), _uuid] call CBA_fnc_hashRem;
};

View File

@ -1,7 +1,5 @@
//fnc_handleLaserOn.sqf
#include "script_component.hpp"
private ["_uuid", "_args"];
_uuid = _this select 0;
_args = _this select 1;
params ["_uuid", "_args"];
[GVAR(laserEmitters), _uuid, _args] call CBA_fnc_hashSet;

View File

@ -11,6 +11,5 @@
#include "script_component.hpp"
private ["_uuid"];
_uuid = _this select 0;
params ["_uuid"];
["ace_laserOff", [_uuid]] call CBA_fnc_globalEvent;

View File

@ -16,8 +16,7 @@
#include "script_component.hpp"
private ["_uuid", "_args"];
_uuid = format["%1%2%3", floor diag_tickTime, floor random 1000, floor random 10000];
_args = [_uuid, _this];
private _uuid = format["%1%2%3", floor diag_tickTime, floor random 1000, floor random 10000];
private _args = [_uuid, _this];
["ace_laserOn", _args] call CBA_fnc_globalEvent;
_uuid;

View File

@ -2,12 +2,9 @@
#include "script_component.hpp"
TRACE_1("enter", _this);
private["_args", "_laserTarget", "_pos", "_shooter", "_uuid"];
//TRACE_1("enter", _this);
_args = _this select 0;
_laserTarget = _args select 0;
_shooter = _args select 1;
_uuid = _args select 2;
params ["_args"];
_args params ["_laserTarget", "_shooter", "_uuid"];
if(isNull _laserTarget || !alive _shooter) exitWith {
[(_this select 1)] call CBA_fnc_removePerFrameHandler;

View File

@ -16,8 +16,7 @@ GVAR(nearUnits) = [];
// @todo. Maybe move to common?
[{
private "_nearUnits";
_nearUnits = [];
private _nearUnits = [];
{
_nearUnits append crew _x;
if (count _nearUnits > 10) exitWith {

View File

@ -15,19 +15,18 @@
* Public: No
*/
#include "script_component.hpp"
private ["_onFinish", "_onFailure"];
params ["_caller", "_target"];
if (!(_this call FUNC(canRefuelUAV))) exitWith {};
_onFinish = {
private _onFinish = {
(_this select 0) params ["_caller", "_target"];
_caller removeItem "ACE_UAVBattery";
playSound3D [QUOTE(PATHTO_R(sounds\exchange_battery.ogg)), objNull, false, getPosASL _caller, 1, 1, 10];
[QEGVAR(common,setFuel), [_target, 1], [_target]] call CBA_fnc_targetEvent; //setFuel is local
};
_onFailure = {
private _onFailure = {
(_this select 0) params ["_caller", "_target"];
[_caller, "AmovPknlMstpSrasWrflDnon", 1] call EFUNC(common,doAnimation);
};

View File

@ -22,10 +22,9 @@ params ["_target", "_player"];
private _unitMagazines = [];
private _unitMagCounts = [];
{
private "_xFullMagazineCount";
_x params ["_xClassname", "_xCount", "_xLoaded", "_xType"];
_xFullMagazineCount = getNumber (configFile >> "CfgMagazines" >> _xClassname >> "count");
private _xFullMagazineCount = getNumber (configFile >> "CfgMagazines" >> _xClassname >> "count");
//for every partial magazine, that is either in inventory or can be moved there
if ((_xCount < _xFullMagazineCount) && {_xCount > 0} && {(!_xLoaded) || {_player canAdd _xClassname}}) then {

View File

@ -16,11 +16,9 @@
*/
#include "script_component.hpp"
private "_proximityPlayers";
params ["_unit", "_range"];
_proximityPlayers = (getPos _unit) nearEntities [["CAMAnBase"], _range];
private _proximityPlayers = (getPos _unit) nearEntities [["CAMAnBase"], _range];
_proximityPlayers deleteAt (_proximityPlayers find _unit);
_proximityPlayers append (crew vehicle _unit);
_proximityPlayers

View File

@ -55,10 +55,9 @@ if (isServer) then {
if (hasInterface) then {
_fnc_createEffect = {
private "_effect";
params ["_type", "_layer", "_default"];
_effect = ppEffectCreate [_type, _layer];
private _effect = ppEffectCreate [_type, _layer];
_effect ppEffectForceInNVG true;
_effect ppEffectAdjust _default;
_effect ppEffectCommit 0;

View File

@ -14,7 +14,6 @@
#include "script_component.hpp"
private "_genericMessages";
params ["_caller", "_target"];
private _genericMessages = [LSTRING(diagnoseMessage), [_target] call EFUNC(common,getName)];

View File

@ -14,7 +14,6 @@
#include "script_component.hpp"
private "_vehicle";
params ["_caller", "_target"];
if ([_target] call EFUNC(common,isAwake)) exitWith {
@ -27,4 +26,4 @@ if ([_target] call FUNC(isBeingDragged)) then {
[_caller, _target] call EFUNC(dragging,dropObject);
};
_vehicle = [_caller, _target] call EFUNC(common,loadPerson);
private _vehicle = [_caller, _target] call EFUNC(common,loadPerson);

View File

@ -17,9 +17,8 @@
#include "script_component.hpp"
private "_bodyPartn";
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
private _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
if (_bodyPartn > 1) exitWith {};

View File

@ -77,7 +77,6 @@ if (diag_frameno > (_unit getVariable [QGVAR(frameNo_damageCaching), -3]) + 2) t
// handle the cached damages 3 frames later
[{
private ["_args", "_params"];
params ["_args", "_idPFH"];
_args params ["_unit", "_frameno"];
if (diag_frameno >= _frameno + 2) then {

View File

@ -17,8 +17,7 @@
#include "script_component.hpp"
private "_bodyPartn";
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
private _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
// TODO implement internal injuries

View File

@ -13,7 +13,6 @@
#include "script_component.hpp"
private "_openWounds";
params ["_unit"];
if (!local _unit) exitWith {};

View File

@ -23,8 +23,7 @@ if (_local) then {
};
if ((_unit getVariable ["ACE_isUnconscious",false]) && {count (_unit getVariable [QGVAR(unconsciousArguments), []]) >= 6}) then {
private "_arguments";
_arguments = (_unit getVariable [QGVAR(unconsciousArguments), []]);
private _arguments = (_unit getVariable [QGVAR(unconsciousArguments), []]);
_arguments set [2, CBA_missionTime];
[DFUNC(unconsciousPFH), 0.1, _arguments ] call CBA_fnc_addPerFrameHandler;

View File

@ -17,9 +17,7 @@
params ["_target"];
private "_owner";
_owner = _target getVariable [QEGVAR(common,owner), objNull];
private _owner = _target getVariable [QEGVAR(common,owner), objNull];
if (isNull _owner) exitWith {false};

View File

@ -17,9 +17,7 @@
params ["_target"];
private "_owner";
_owner = _target getVariable [QEGVAR(common,owner), objNull];
private _owner = _target getVariable [QEGVAR(common,owner), objNull];
if (isNull _owner) exitWith {false};

View File

@ -17,9 +17,8 @@
params ["_logic"];
if (!isNull _logic) then {
private ["_list", "_setting"];
_list = _logic getVariable ["EnableList", ""];
_setting = _logic getVariable ["role", 0];
private _list = _logic getVariable ["EnableList", ""];
private _setting = _logic getVariable ["role", 0];
[_list, QGVAR(medicClass), _setting, true] call EFUNC(common,assignObjectsInList);
[synchronizedObjects _logic, QGVAR(medicClass), _setting, true] call EFUNC(common,assignObjectsInList);

View File

@ -17,9 +17,8 @@
params ["_logic"];
if (!isNull _logic) then {
private ["_list", "_setting"];
_list = _logic getVariable ["EnableList", ""];
_setting = _logic getVariable ["enabled", 0];
private _list = _logic getVariable ["EnableList", ""];
private _setting = _logic getVariable ["enabled", 0];
[_list, QGVAR(medicClass), _setting, true] call EFUNC(common,assignObjectsInList);
[synchronizedObjects _logic, QGVAR(medicClass), _setting, true, true] call EFUNC(common,assignObjectsInList);

View File

@ -14,7 +14,6 @@
#include "script_component.hpp"
private "_timeInCardiacArrest";
params ["_unit"];
if (_unit getVariable [QGVAR(inCardiacArrest),false]) exitWith {};
@ -24,7 +23,7 @@ _unit setVariable [QGVAR(heartRate), 0];
["ace_cardiacArrestEntered", [_unit]] call CBA_fnc_localEvent;
[_unit, true] call FUNC(setUnconscious);
_timeInCardiacArrest = 120 + round(random(600));
private _timeInCardiacArrest = 120 + round(random(600));
[{
params ["_args", "_idPFH"];

View File

@ -15,8 +15,7 @@ params ["_unit", "_damage"];
if (!local _unit) exitWith {};
private "_allHitPoints";
_allHitPoints = getAllHitPointsDamage _unit select 2;
private _allHitPoints = getAllHitPointsDamage _unit select 2;
_unit setDamage _damage;

View File

@ -32,8 +32,7 @@ if (count _fxBloodControls != 3) then {
_bloodCtrl3 ctrlSetText "A3\Ui_f\data\igui\rsctitles\HealthTextures\blood_upper_ca.paa";
// positions are from config
private "_ctrlPosition";
_ctrlPosition = [
private _ctrlPosition = [
((0 * safezoneW) + safezoneX) + ((safezoneW - (2.125 * safezoneW * 3/4)) / 2),
(-0.0625 * safezoneH) + safezoneY,
2.125 * safezoneW * 3/4,

View File

@ -16,12 +16,10 @@
*/
#include "script_component.hpp"
private "_bandagedWounds";
params ["_args", "_elapsedTime", "_totalTime"];
_args params ["_caller", "_target"];
_bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []];
private _bandagedWounds = _target getVariable [QGVAR(bandagedWounds), []];
//In case two people stitch up one patient and the last wound has already been closed we can stop already
if (count _bandagedWounds == 0) exitWith { false };

View File

@ -16,12 +16,11 @@
#include "script_component.hpp"
private "_removeItem";
params ["_caller", "_target", "_selectionName", "_className", "_items"];
if (count _items == 0) exitWith {false};
if (_items isEqualTo []) exitWith {false};
_removeItem = _items select 0;
_items params ["_removeItem"];
if (local _target) then {
[QGVAR(treatmentIVLocal), [_target, _className]] call CBA_fnc_localEvent;
} else {

View File

@ -47,8 +47,7 @@ if (_target getVariable [QEGVAR(medical,hasPain), false]) then {
_totalIvVolume = 0;
{
private "_value";
_value = _target getVariable _x;
private _value = _target getVariable _x;
if (!isNil "_value") then {
_totalIvVolume = _totalIvVolume + (_target getVariable [_x, 0]);
};

View File

@ -16,9 +16,7 @@
#include "script_component.hpp"
params ["_showType"];
private ["_returnValue"];
_returnValue = false;
private _returnValue = false;
_returnValue = switch (_showType) do {
case (DISPLAY_MODE_CLOSED): { true }; //Can always close

View File

@ -17,11 +17,8 @@
*/
#include "script_component.hpp"
private "_waypoints";
params ["_waypointName","_waypointPosASL"];
_waypoints = ACE_player getVariable [QGVAR(waypoints), []];
private _waypoints = ACE_player getVariable [QGVAR(waypoints), []];
_waypoints pushBack [_waypointName, _waypointPosASL];
ACE_player setVariable [QGVAR(waypoints), _waypoints];

View File

@ -16,10 +16,9 @@
*/
#include "script_component.hpp"
private "_waypoints";
params ["_wpIndex"];
_waypoints = ACE_player getVariable [QGVAR(waypoints), []];
private _waypoints = ACE_player getVariable [QGVAR(waypoints), []];
if ((_wpIndex < 0) || (_wpIndex > ((count _waypoints) - 1))) exitWith {ERROR("out of bounds wp");};

View File

@ -20,12 +20,10 @@
params ["_theMap", "_mouseButton", "_xPos", "_yPos"];
private ["_worldPos"];
//Only handle LMB
if (_mouseButton != 0) exitWith {};
_worldPos = _theMap ctrlMapScreenToWorld [_xPos, _yPos];
private _worldPos = _theMap ctrlMapScreenToWorld [_xPos, _yPos];
_worldPos pushBack (getTerrainHeightASL _worldPos);
GVAR(newWaypointPosition) = _worldPos;

View File

@ -8,8 +8,8 @@
EXPLODE_7_PVT(((_this select 1) select 0),_shooter,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
private ["_targetPos", "_projectilePos", "_target", "_seekerTargetPos", "_launchParams", "_targetLaunchParams"];
private["_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos", "_state"];
private["_cruisAlt", "_distanceShooterToTarget", "_shooterPos"];
private [_distanceToTarget", "_distanceToShooter", "_addHeight", "_returnTargetPos", "_state"];
private [cruisAlt", "_distanceShooterToTarget", "_shooterPos"];
_seekerTargetPos = _this select 0;
_launchParams = _this select 1;

View File

@ -18,7 +18,5 @@
PARAMS_2(_mortarVeh,_unit);
private "_currentSetting";
_currentSetting = _mortarVeh getVariable [QGVAR(useMils), true];
private _currentSetting = _mortarVeh getVariable [QGVAR(useMils), true];
_mortarVeh setVariable [QGVAR(useMils), (!_currentSetting)];

View File

@ -20,33 +20,28 @@
#include "script_component.hpp"
#include "common.hpp";
private ["_type", "_varName", "_data", "_isAir", "_config", "_fnc_addTurret", "_fnc_addTurretUnit"];
params ["_type"];
_varName = format ["ACE_CrewInfo_Cache_%1", _type];
_data = + (uiNamespace getVariable _varName);
private _varName = format ["ACE_CrewInfo_Cache_%1", _type];
private _data = + (uiNamespace getVariable _varName);
if (!isNil "_data") exitWith {_data};
_data = [];
_isAir = _type isKindOf "Air";
private _isAir = _type isKindOf "Air";
_fnc_addTurretUnit = {
private ["_config", "_path", "_role", "_simulationEmpty", "_simulationLaserDesignate", "_simulationOther", "_magazine", "_ammo", "_simulation"];
private _fnc_addTurretUnit = {
params ["_config", "_path"];
private _role = CARGO;
_config = _this select 0;
_path = _this select 1;
_role = CARGO;
_simulationEmpty = 0;
_simulationLaserDesignate = 0;
_simulationOther = 0;
private _simulationEmpty = 0;
private _simulationLaserDesignate = 0;
private _simulationOther = 0;
{
{
_magazine = configFile >> "CfgMagazines" >> _x;
_ammo = configFile >> "CfgAmmo" >> getText (_magazine >> "ammo");
_simulation = getText (_ammo >> "simulation");
private _magazine = configFile >> "CfgMagazines" >> _x;
private _ammo = configFile >> "CfgAmmo" >> getText (_magazine >> "ammo");
private _simulation = getText (_ammo >> "simulation");
if(_simulation=="") then {
_simulationEmpty = _simulationEmpty + 1;
@ -78,21 +73,17 @@ _fnc_addTurretUnit = {
};
_fnc_addTurret = {
private ["_config", "_path", "_count", "_offset", "_index", "_turretPath", "_turretConfig"];
_config = _this select 0;
_path = _this select 1;
private _fnc_addTurret = {
params ["_config", "_path"];
_config = _config >> "Turrets";
_count = count _config;
private _count = count _config;
_offset = 0;
private _offset = 0;
for "_index" from 0 to (_count - 1) do {
_turretPath = _path + [_index - _offset];
_turretConfig = _config select _index;
private _turretPath = _path + [_index - _offset];
private _turretConfig = _config select _index;
if (isClass _turretConfig) then {
[_turretConfig, _turretPath] call _fnc_addTurretUnit;
[_turretConfig, _turretPath] call _fnc_addTurret;

View File

@ -19,11 +19,9 @@
params ["_player", "_changeInBrightness"];
TRACE_2("params",_player,_changeInBrightness);
private ["_brightness"];
if (!hasInterface) exitWith {};
_brightness = _player getVariable [QGVAR(NVGBrightness), 0];
private _brightness = _player getVariable [QGVAR(NVGBrightness), 0];
_brightness = ((round (10 * _brightness + _changeInBrightness) / 10) min 0.5) max -0.5;

View File

@ -23,8 +23,7 @@ private _display = uiNamespace getVariable [QGVAR(RscWeaponInfo2D), displayNull]
if (isNull _display) exitWith {};
// Reduce the reticle movement as the player drops into lower, supported stances.
private "_recoilCoef";
_recoilCoef = switch (true) do {
private _recoilCoef = switch (true) do {
case (isWeaponDeployed _unit): {0.1};
case (isWeaponRested _unit): {0.4};
default {1};
@ -47,8 +46,7 @@ private ["_sizeX", "_sizeY"];
_sizeX = (0.75 + _recoilScope)/(getResolution select 5);
_sizeY = _sizeX*(4/3);
private "_positionReticle";
_positionReticle = [
private _positionReticle = [
safezoneX + 0.5 * safezoneW - 0.5*(_sizeX + _reticleShiftX),
safezoneY + 0.5 * safezoneH - 0.5*(_sizeY + _reticleShiftY),
_sizeX,
@ -58,8 +56,7 @@ _positionReticle = [
(_display displayCtrl 1713001) ctrlSetPosition _positionReticle;
(_display displayCtrl 1713002) ctrlSetPosition _positionReticle;
private "_positionBody";
_positionBody = [
private _positionBody = [
safezoneX + 0.5 * safezoneW - 0.5*(2 * _sizeX + _scopeShiftX),
safezoneY + 0.5 * safezoneH - 0.5*(2 * _sizeY + _scopeShiftY),
2 * _sizeX,

View File

@ -3,20 +3,16 @@
disableSerialization;
private ["_display", "_control"];
params ["_display"];
_display = _this select 0;
_control = _display displayCtrl 1713154;
private _control = _display displayCtrl 1713154;
if (!ctrlShown (_display displayCtrl 154)) exitWith {
_control ctrlShow false;
};
private ["_sizeX", "_sizeY"];
_sizeX = (call EFUNC(common,getZoom))/4;
_sizeY = _sizeX*safezoneW/safezoneH;
private _sizeX = (call EFUNC(common,getZoom))/4;
private _sizeY = _sizeX*safezoneW/safezoneH;
_control ctrlSetPosition [
safezoneX+0.5*safezoneW-0.5*_sizeX,

Some files were not shown because too many files have changed in this diff Show More