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

View File

@ -17,11 +17,9 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private "_airDensity";
params ["_ballisticCoefficient", "_temperature"/*in C*/, "_pressure"/*in hPa*/, "_relativeHumidity"/*as ratio 0-1*/, "_atmosphereModel"/*"ICAO" or "ASM"*/]; 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 { if (_atmosphereModel == "ICAO") then {
(STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient (STD_AIR_DENSITY_ICAO / _airDensity) * _ballisticCoefficient

View File

@ -19,14 +19,13 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_twist", "_length", "_stabilityFactor"];
params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"]; params ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure"];
// Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf // Source: http://www.jbmballistics.com/ballistics/bibliography/articles/miller_stability_1.pdf
_twist = _barrelTwist / _caliber; private _twist = _barrelTwist / _caliber;
_length = _bulletLength / _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 { if (_muzzleVelocity > 341.376) then {
(_stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3)) * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure (_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 _aceTimeSecond = floor CBA_missionTime;
{ {
private ["_bulletVelocity", "_bulletPosition", "_bulletSpeed"]; _x params ["_bullet","_caliber","_bulletTraceVisible","_index"];
_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 { if (!alive _bullet || _bulletSpeed < 100) then {
GVAR(allBullets) deleteAt (GVAR(allBullets) find _x); GVAR(allBullets) deleteAt (GVAR(allBullets) find _x);
} else { } else {
_bulletPosition = getPosASL _bullet; private _bulletPosition = getPosASL _bullet;
if (_bulletTraceVisible && _bulletSpeed > 500) then { 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,"","",""]; 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" #include "script_component.hpp"
private ["_weaponConfig", "_barrelTwist", "_twistDirection", "_barrelLength", "_result"]; private _weaponConfig = (configFile >> "CfgWeapons" >> _this);
_weaponConfig = (configFile >> "CfgWeapons" >> _this);
_barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist"); private _barrelTwist = getNumber(_weaponConfig >> "ACE_barrelTwist");
_twistDirection = 1; private _twistDirection = 1;
if (isNumber (_weaponConfig >> "ACE_twistDirection")) then { if (isNumber (_weaponConfig >> "ACE_twistDirection")) then {
_twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection"); _twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection");
if !(_twistDirection in [-1, 0, 1]) then { 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]; uiNamespace setVariable [format[QGVAR(%1), _weapon], _result];

View File

@ -15,11 +15,9 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_gunName", "_gunProfileEntry"]; private _gunName = ctrlText 11001;
_gunName = ctrlText 11001;
if (_gunName != "") then { 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]; GVAR(gunList) = GVAR(gunList) + [_gunProfileEntry];

View File

@ -17,21 +17,20 @@
[] call FUNC(parse_input); [] call FUNC(parse_input);
private ["_scopeBaseAngle"]; GVAR(workingMemory) params ["",
_scopeBaseAngle = (GVAR(workingMemory) select 3); "_muzzleVelocity", "",
"_scopeBaseAngle",
"_airFriction",
"_boreHeight", "", "", "", "", "", "",
"_bulletMass",
"_bulletDiameter",
"_barrelTwist",
"_bc",
"_dragModel",
"_atmosphereModel"
];
private ["_bulletMass", "_bulletDiameter", "_boreHeight", "_airFriction", "_barrelTwist", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel", "_twistDirection"]; private _twistDirection = 0;
_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;
if (_barrelTwist > 0) then { if (_barrelTwist > 0) then {
_twistDirection = 1; _twistDirection = 1;
} else { } else {
@ -39,42 +38,38 @@ if (_barrelTwist > 0) then {
_twistDirection = -1; _twistDirection = -1;
}; };
}; };
_barrelTwist = abs(_barrelTwist); _barrelTwist = abs _barrelTwist;
private ["_altitude", "_temperature", "_barometricPressure", "_relativeHumidity"]; private _altitude = GVAR(altitude);
_altitude = GVAR(altitude); private _temperature = GVAR(temperature);
_temperature = GVAR(temperature); private _barometricPressure = GVAR(barometricPressure);
_barometricPressure = GVAR(barometricPressure); private _relativeHumidity = GVAR(relativeHumidity);
_relativeHumidity = GVAR(relativeHumidity);
if (!GVAR(atmosphereModeTBH)) then { if (!GVAR(atmosphereModeTBH)) then {
_barometricPressure = 1013.25 * (1 - (0.0065 * _altitude) / (273.15 + _temperature + 0.0065 * _altitude)) ^ 5.255754495; _barometricPressure = 1013.25 * (1 - (0.0065 * _altitude) / (273.15 + _temperature + 0.0065 * _altitude)) ^ 5.255754495;
_relativeHumidity = 50; _relativeHumidity = 50;
}; };
private ["_bulletLength", "_stabilityFactor"]; private _bulletLength = 45.72;
_bulletLength = 45.72; private _stabilityFactor = 1.5;
_stabilityFactor = 1.5;
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
if (_bulletDiameter > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) 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); _stabilityFactor = [_bulletDiameter, _bulletLength, _bulletMass, _barrelTwist * 10, _muzzleVelocity, _temperature, _barometricPressure] call EFUNC(advanced_ballistics,calculateStabilityFactor);
}; };
}; };
private ["_latitude", "_directionOfFire", "_windSpeed1", "_windSpeed2", "_windDirection", "_inclinationAngle", "_targetSpeed", "_targetRange"]; private _latitude = GVAR(latitude) select GVAR(currentTarget);
_latitude = GVAR(latitude) select GVAR(currentTarget); private _directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget);
_directionOfFire = GVAR(directionOfFire) select GVAR(currentTarget); private _windSpeed1 = (GVAR(windSpeed1) select GVAR(currentTarget));
_windSpeed1 = (GVAR(windSpeed1) select GVAR(currentTarget)); private _windSpeed2 = (GVAR(windSpeed2) select GVAR(currentTarget));
_windSpeed2 = (GVAR(windSpeed2) select GVAR(currentTarget)); private _windDirection = (GVAR(windDirection) select GVAR(currentTarget));
_windDirection = (GVAR(windDirection) select GVAR(currentTarget)); private _inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget));
_inclinationAngle = (GVAR(inclinationAngle) select GVAR(currentTarget)); private _targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget));
_targetSpeed = (GVAR(targetSpeed) select GVAR(currentTarget)); private _targetRange = GVAR(rangeCardEndRange);
_targetRange = GVAR(rangeCardEndRange);
if (GVAR(currentUnit) == 1) then { if (GVAR(currentUnit) == 1) then {
_targetRange = _targetRange / 1.0936133; _targetRange = _targetRange / 1.0936133;
}; };
GVAR(rangeCardData) = []; GVAR(rangeCardData) = [];
private ["_result"]; private _result = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, 1000,
_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); [_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" #include "script_component.hpp"
private ["_targetSize", "_imageSize", "_angle", "_estRange"]; private _angle = parseNumber(ctrlText 7012);
private _targetSize = parseNumber(ctrlText 7010);
_angle = parseNumber(ctrlText 7012);
_targetSize = parseNumber(ctrlText 7010);
if (GVAR(rangeAssistUseTargetHeight)) then { if (GVAR(rangeAssistUseTargetHeight)) then {
_targetSize = _targetSize * cos(_angle); _targetSize = _targetSize * cos(_angle);
}; };
@ -33,7 +31,7 @@ switch (GVAR(rangeAssistTargetSizeUnit)) do {
_targetSize = _targetSize * 0.01; _targetSize = _targetSize * 0.01;
}; };
}; };
_imageSize = parseNumber(ctrlText 7011); private _imageSize = parseNumber(ctrlText 7011);
switch (GVAR(rangeAssistImageSizeUnit)) do { switch (GVAR(rangeAssistImageSizeUnit)) do {
case 0: { case 0: {
_imageSize = _imageSize / 6400 * 360; _imageSize = _imageSize / 6400 * 360;
@ -45,7 +43,7 @@ switch (GVAR(rangeAssistImageSizeUnit)) do {
_imageSize = _imageSize / 60 / 1.047; _imageSize = _imageSize / 60 / 1.047;
}; };
}; };
_estRange = parseNumber(ctrlText 7013); private _estRange = parseNumber(ctrlText 7013);
if (GVAR(currentUnit) == 1) then { if (GVAR(currentUnit) == 1) then {
_estRange = _estRange / 1.0936133; _estRange = _estRange / 1.0936133;
}; };

View File

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

View File

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

View File

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

View File

@ -68,7 +68,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _model; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _model;
[{ [{
private["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_lineInterection"]; private ["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_lineInterection"];
params ["_args","_idPFH"]; params ["_args","_idPFH"];
_args params ["_unit","_attachToVehicle","_itemClassname","_itemVehClass","_onAtachText","_actionID"]; _args params ["_unit","_attachToVehicle","_itemClassname","_itemVehClass","_onAtachText","_actionID"];

View File

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

View File

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

View File

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

View File

@ -1,12 +1,10 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
private "_paper";
params ["_wall"]; params ["_wall"];
if (local _wall) then { 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 attachTo [_wall, [0,-0.02,0.6]];
_paper setDir getDir _wall; _paper setDir getDir _wall;

View File

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

View File

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

View File

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

View File

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

View File

@ -21,9 +21,7 @@ params ["_vehicle", "", "_unit"];
TRACE_2("params",_vehicle,_unit); TRACE_2("params",_vehicle,_unit);
if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then { if ((local _unit) && {_unit getVariable [QGVAR(isHandcuffed), false]}) then {
private ["_cargoIndex"]; private _cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1];
_cargoIndex = _unit getVariable [QGVAR(CargoIndex), -1];
if (_cargoIndex != -1) then { if (_cargoIndex != -1) then {
//If captive was not "unloaded", then move them back into the vehicle. //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 // Group and side respawn can potentially respawn you as a captive unit
// Base and instant respawn cannot, so captive should be entirely reset // Base and instant respawn cannot, so captive should be entirely reset
// So we explicity account for the respawn type // So we explicity account for the respawn type
private ["_respawn"]; private _respawn = [0] call BIS_fnc_missionRespawnType;
_respawn = [0] call BIS_fnc_missionRespawnType;
if (_respawn > 3) then { if (_respawn > 3) then {
if (_unit getVariable [QGVAR(isHandcuffed), false]) then { if (_unit getVariable [QGVAR(isHandcuffed), false]) then {

View File

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

View File

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

View File

@ -91,7 +91,7 @@ private _keybinds = actionKeysNamesArray _action apply {
_alt = true; _alt = true;
}; };
default { default {
// @todo handle double keys? ("C+R") // @todo handle double keys? ("C + R")
// currently only reports last key // currently only reports last key
// not usable by keyDown by default // not usable by keyDown by default
_key = _keyTable find _x; _key = _keyTable find _x;

View File

@ -69,9 +69,9 @@ private _refresh = {
private _position = switch (_setting) do { private _position = switch (_setting) do {
case TOP_RIGHT_DOWN: {[X_POS_ICONS, Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; case TOP_RIGHT_DOWN: {[X_POS_ICONS, Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
case TOP_RIGHT_LEFT: {[X_POS_ICONS_SECOND - ((_forEachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND - (ICON_WIDTH / 2), ICON_WIDTH, ICON_WIDTH]}; case TOP_RIGHT_LEFT: {[X_POS_ICONS_SECOND - ((_forEachIndex + 3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND - (ICON_WIDTH / 2), ICON_WIDTH, ICON_WIDTH]};
case TOP_LEFT_DOWN: {[LEFT_SIDE + (0.5 * ICON_WIDTH), Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; case TOP_LEFT_DOWN: {[LEFT_SIDE + (0.5 * ICON_WIDTH), Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
case TOP_LEFT_RIGHT: {[LEFT_SIDE + (0.5 * ICON_WIDTH) - ((_forEachIndex+3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND, ICON_WIDTH, ICON_WIDTH]}; case TOP_LEFT_RIGHT: {[LEFT_SIDE + (0.5 * ICON_WIDTH) - ((_forEachIndex + 3) * DIFFERENCE_ICONS), Y_POS_ICONS_SECOND, ICON_WIDTH, ICON_WIDTH]};
default {[X_POS_ICONS, Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]}; default {[X_POS_ICONS, Y_POS_ICONS + (_forEachIndex * DIFFERENCE_ICONS), ICON_WIDTH, ICON_WIDTH]};
}; };

View File

@ -171,8 +171,7 @@ switch (_position) do {
}; };
case "cargo" : { case "cargo" : {
private "_positions"; private _positions = [typeOf _vehicle] call FUNC(getVehicleCargo);
_positions = [typeOf _vehicle] call FUNC(getVehicleCargo);
{ {
if (alive _x) then {_positions deleteAt (_positions find (_vehicle getCargoIndex _x))}; 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, _anim, 1, true] call FUNC(doAnimation);
[{ [{
_unit = _this select 0; params ["_unit", "_anim"];
_anim = _this select 1;
if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then { if ((_unit getVariable "ACE_isUnconscious") and (animationState _unit != _anim)) then {
[_unit, _anim, 2, true] call FUNC(doAnimation); [_unit, _anim, 2, true] call FUNC(doAnimation);
}; };

View File

@ -1,7 +1,7 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
private["_client", "_clientVersion", "_count", "_error", "_files", "_index", "_missingAddon", "_missingAddonServer", "_missingAddons", "_missingAddonsServer", "_oldVersionClient", "_oldVersionServer", "_oldVersionsClient", "_oldVersionsServer", "_serverFiles", "_serverVersion", "_serverVersions", "_string", "_version", "_versions"]; private ["_client", "_clientVersion", "_count", "_error", "_files", "_index", "_missingAddon", "_missingAddonServer", "_missingAddons", "_missingAddonsServer", "_oldVersionClient", "_oldVersionServer", "_oldVersionsClient", "_oldVersionsServer", "_serverFiles", "_serverVersion", "_serverVersions", "_string", "_version", "_versions"];
_files = []; _files = [];

View File

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

View File

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

View File

@ -16,8 +16,6 @@
params ["_wire", "_killer"]; params ["_wire", "_killer"];
TRACE_2("params",_wire,_killer); TRACE_2("params",_wire,_killer);
private ["_distance", "_vehicle"];
if (isNull _killer) then { if (isNull _killer) then {
_killer = _wire getVariable [QGVAR(lastDamager), objNull]; _killer = _wire getVariable [QGVAR(lastDamager), objNull];
if (isNull _killer) then { if (isNull _killer) then {
@ -29,9 +27,9 @@ if (isNull _killer) then {
}; };
if (isNull _killer || {_killer == _wire} || {_killer == gunner (vehicle _killer)}) exitWith {}; 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 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; [QGVAR(vehicleDamage), [_wire, _vehicle], [_vehicle]] call CBA_fnc_targetEvent;

View File

@ -45,10 +45,10 @@ if (_mode == 0) then {
// Check if two Single coils are placed next to each other (i.e playes have built a big wire obstacle) // Check if two Single coils are placed next to each other (i.e playes have built a big wire obstacle)
_wireCheckPosAr = [ _wireCheckPosAr = [
[_x + (sin (_dir_w+90) * 1.5),_y + (cos (_dir_w+90) * 1.5)], [_x + (sin (_dir_w + 90) * 1.5),_y + (cos (_dir_w + 90) * 1.5)],
[(_x-(sin _dir_w)) + (sin (_dir_w+90) * 1.5),(_y-(cos _dir_w)) + (cos (_dir_w+90) * 1.5)], [(_x-(sin _dir_w)) + (sin (_dir_w + 90) * 1.5),(_y-(cos _dir_w)) + (cos (_dir_w + 90) * 1.5)],
[_x + (sin (_dir_w-90) * 1.5),_y + (cos (_dir_w-90) * 1.5)], [_x + (sin (_dir_w - 90) * 1.5),_y + (cos (_dir_w - 90) * 1.5)],
[(_x-(sin _dir_w)) + (sin (_dir_w-90) * 1.5),(_y-(cos _dir_w)) + (cos (_dir_w-90) * 1.5)] [(_x-(sin _dir_w)) + (sin (_dir_w - 90) * 1.5),(_y-(cos _dir_w)) + (cos (_dir_w - 90) * 1.5)]
]; ];
{ {
_found = false; _found = false;
@ -113,7 +113,7 @@ if (_mode == 1) then {
_vPos = getPosASL _vehicle; _vPos = getPosASL _vehicle;
_vDir = getDir _vehicle; _vDir = getDir _vehicle;
_vehicle setPosASL (_vPos vectorAdd [-0.35 * sin(_vDir), -0.35 * cos(_vDir), 0]); _vehicle setPosASL (_vPos vectorAdd [-0.35 * sin(_vDir), -0.35 * cos(_vDir), 0]);
// TODO: Needs to be placed in safe distance to wire, so we do not constantly re-spawn new wires // TODO: Needs to be placed in safe distance to wire, so we do not constantly re - spawn new wires
}, [_vehicle, _wire], 0.1] call CBA_fnc_waitAndExecute; }, [_vehicle, _wire], 0.1] call CBA_fnc_waitAndExecute;
}; };

View File

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

View File

@ -30,7 +30,7 @@ __background ctrlSetText QPATHTOF(UI\dagr_gps.paa);
if (GVAR(outputPFH) != -1) exitWith {}; if (GVAR(outputPFH) != -1) exitWith {};
GVAR(outputPFH) = [{ GVAR(outputPFH) = [{
private["_dagrElevation", "_dagrGrid", "_dagrHeading", "_dagrSpeed", "_dagrTime", "_elevation", "_gridArray", "_speed"]; private ["_dagrElevation", "_dagrGrid", "_dagrHeading", "_dagrSpeed", "_dagrTime", "_elevation", "_gridArray", "_speed"];
// Abort Condition // Abort Condition
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith { if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {

View File

@ -30,7 +30,7 @@ __background ctrlSetText QPATHTOF(UI\dagr_wp.paa);
if (GVAR(outputPFH) != -1) exitWith {}; if (GVAR(outputPFH) != -1) exitWith {};
GVAR(outputPFH) = [{ GVAR(outputPFH) = [{
private["_MYpos", "_WPpos", "_bearing", "_dagrDistance", "_dagrGrid", "_dagrHeading", "_distance", "_gridArray"]; private ["_MYpos", "_WPpos", "_bearing", "_dagrDistance", "_dagrGrid", "_dagrHeading", "_distance", "_gridArray"];
// Abort Condition // Abort Condition
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith { if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@
params ["_unit", "_explosive", "_magazineClass", "_extra"]; params ["_unit", "_explosive", "_magazineClass", "_extra"];
TRACE_4("params",_unit,_explosive,_magazineClass,_extra); TRACE_4("params",_unit,_explosive,_magazineClass,_extra);
private["_config", "_detonators", "_hasRequired", "_requiredItems", "_code", "_count", "_codeSet"]; private ["_config", "_detonators", "_hasRequired", "_requiredItems", "_code", "_count", "_codeSet"];
// Config is the last item in the list of passed in items. // Config is the last item in the list of passed in items.
_config = (_this select 3) select (count (_this select 3) - 1); _config = (_this select 3) select (count (_this select 3) - 1);

View File

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

View File

@ -27,7 +27,7 @@ _unit setVariable [QGVAR(Dialing), true, true];
_ran = (ceil(random 8)) + 1; _ran = (ceil(random 8)) + 1;
_arr = []; _arr = [];
for [{_i=0}, {_i<_ran}, {_i=_i+1}] do { for [{_i=0}, {_i<_ran}, {_i=_i + 1}] do {
_arr = _arr + ['.','..','...','']; _arr = _arr + ['.','..','...',''];
}; };
if (_unit == ace_player) then { if (_unit == ace_player) then {

View File

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

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@
params ["_vehicle", "_unit", "_magClassname"]; params ["_vehicle", "_unit", "_magClassname"];
TRACE_3("params",_vehicle,_unit,_magClassname); TRACE_3("params",_vehicle,_unit,_magClassname);
private["_isAttachable", "_setupObjectClass", "_supportedTriggers", "_p3dModel"]; private ["_isAttachable", "_setupObjectClass", "_supportedTriggers", "_p3dModel"];
//Get setup object vehicle and model: //Get setup object vehicle and model:
_setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> QGVAR(SetupObject)); _setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> QGVAR(SetupObject));
@ -62,7 +62,7 @@ GVAR(TweakedAngle) = 0;
params ["_args", "_pfID"]; params ["_args", "_pfID"];
_args params ["_unit", "_magClassname", "_setupObjectClass", "_isAttachable"]; _args params ["_unit", "_magClassname", "_setupObjectClass", "_isAttachable"];
private["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testPos", "_testPositionIsValid", "_virtualPosASL"]; private ["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testPos", "_testPositionIsValid", "_virtualPosASL"];
_lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,0,10]) call EFUNC(common,positionToASL)); _lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,0,10]) call EFUNC(common,positionToASL));
_basePosASL = (eyePos _unit); _basePosASL = (eyePos _unit);

View File

@ -19,7 +19,7 @@
params ["_unit", "_target"]; params ["_unit", "_target"];
TRACE_2("params",_unit,_target); TRACE_2("params",_unit,_target);
private["_actionToPlay", "_defuseTime", "_isEOD"]; private ["_actionToPlay", "_defuseTime", "_isEOD"];
_target = attachedTo (_target); _target = attachedTo (_target);

View File

@ -18,7 +18,7 @@
params ["_magazineClassname"]; params ["_magazineClassname"];
TRACE_1("params",_magazineClassname); TRACE_1("params",_magazineClassname);
private["_result", "_config", "_count", "_index"]; private ["_result", "_config", "_count", "_index"];
_result = []; _result = [];
_config = getArray (ConfigFile >> "CfgMagazines" >> _magazineClassname >> "ACE_Triggers" >> "SupportedTriggers"); _config = getArray (ConfigFile >> "CfgMagazines" >> _magazineClassname >> "ACE_Triggers" >> "SupportedTriggers");

View File

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

View File

@ -22,7 +22,7 @@ params ["_sourceUnit", "_fingerPosPrecise", "_distance"];
private _fingerPos = if (_sourceUnit == ACE_player) then { private _fingerPos = if (_sourceUnit == ACE_player) then {
_fingerPosPrecise _fingerPosPrecise
} else { } else {
_fingerPosPrecise vectorAdd ([random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2*FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y] vectorMultiply _distance) _fingerPosPrecise vectorAdd ([random (2 * FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2 * FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2 * FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y] vectorMultiply _distance)
}; };
TRACE_3("incoming finger:", _sourceUnit, _fingerPosPrecise, _fingerPos); TRACE_3("incoming finger:", _sourceUnit, _fingerPosPrecise, _fingerPos);

View File

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

View File

@ -55,7 +55,7 @@ if(_doFragTrack && {alive _round}) then {
_spallTrack = []; _spallTrack = [];
_spallTrackID = []; _spallTrackID = [];
private["_args"]; private ["_args"];
_args = [_round, (getPosASL _round), (velocity _round), _type, diag_frameno, _gun, _doSpall, _spallTrack, _spallTrackID, _args = [_round, (getPosASL _round), (velocity _round), _type, diag_frameno, _gun, _doSpall, _spallTrack, _spallTrackID,
(getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip))), (getNumber (configFile >> "CfgAmmo" >> _type >> QGVAR(skip))),
(getNumber (configFile >> "CfgAmmo" >> _type >> "explosive")), (getNumber (configFile >> "CfgAmmo" >> _type >> "explosive")),

View File

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

View File

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

View File

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

View File

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

View File

@ -1,25 +1,18 @@
//fnc_findReflections.sqf //fnc_findReflections.sqf
#include "script_component.hpp" #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); BEGIN_COUNTER(fnc_findReflections);
_params = _this select 0; params ["_args"];
_pos = _params select 0; _args params ["_pos", "_explosiveInfo", "_los", "_nlos", "_zIndex", "_depth", "_rand"];
_explosiveInfo = _params select 1;
_los = _params select 2;
_nlos = _params select 3;
_zIndex = _params select 4;
_depth = _params select 5;
_rand = _params select 6;
_split = 15; private _split = 15;
_radi = (360/_split*_depth); private _radi = (360/_split*_depth);
// player sideChat format["p: %1", _explosiveInfo]; // player sideChat format["p: %1", _explosiveInfo];
_indirectHitRange = _explosiveInfo select 0; _explosiveInfo params ["_indirectHitRange", "_indirectHit"];
_indirectHit = _explosiveInfo select 1; private _distanceCount = (floor _indirectHitRange*4) min 100;
_distanceCount = (floor _indirectHitRange*4) min 100;
if(_zIndex < 5) then { if(_zIndex < 5) then {
_lastPos = _pos; _lastPos = _pos;

View File

@ -11,42 +11,39 @@ if(!isServer) exitWith { };
BEGIN_COUNTER(frago); BEGIN_COUNTER(frago);
// _startTime = diag_tickTime; // _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; params ["_round", "_lastPos", "_lastVel", "_shellType"];
_lastPos = _this select 1; private _gun = nil;
_lastVel = _this select 2;
_shellType = _this select 3;
_gun = nil;
if((count _this) > 5) then { if((count _this) > 5) then {
_gun = _this select 5; _gun = _this select 5;
}; };
_fragTypes = [ private _fragTypes = [
QGVAR(tiny), QGVAR(tiny), QGVAR(tiny), QGVAR(tiny), QGVAR(tiny), QGVAR(tiny),
QGVAR(tiny_HD), QGVAR(tiny_HD), QGVAR(tiny_HD), QGVAR(tiny_HD), QGVAR(tiny_HD), QGVAR(tiny_HD),
QGVAR(small),QGVAR(small),QGVAR(small),QGVAR(small), QGVAR(small),QGVAR(small),QGVAR(small),QGVAR(small),
QGVAR(small_HD),QGVAR(small_HD),QGVAR(small_HD),QGVAR(small_HD), QGVAR(small_HD),QGVAR(small_HD),QGVAR(small_HD),QGVAR(small_HD),
QGVAR(medium_HD), QGVAR(medium_HD), QGVAR(medium_HD), QGVAR(medium_HD), QGVAR(medium_HD) 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 { if(isArray (configFile >> "CfgAmmo" >> _shellType >> QGVAR(CLASSES))) then {
_fragTypes = getArray (configFile >> "CfgAmmo" >> _shellType >> QGVAR(CLASSES)); _fragTypes = getArray (configFile >> "CfgAmmo" >> _shellType >> QGVAR(CLASSES));
} else { } else {
_warn = true; _warn = true;
}; };
_atlPos = ASLtoATL _lastPos; private _atlPos = ASLtoATL _lastPos;
_isArmed = true; private _isArmed = true;
if(!isNil "_gun") then { if(!isNil "_gun") then {
_fuseDist = getNumber(configFile >> "CfgAmmo" >> _shellType >> "fuseDistance"); _fuseDist = getNumber(configFile >> "CfgAmmo" >> _shellType >> "fuseDistance");
_isArmed = ((getPosASL _gun) distance _lastPos > _fuseDist); _isArmed = ((getPosASL _gun) distance _lastPos > _fuseDist);
}; };
_indirectHitRange = getNumber(configFile >> "CfgAmmo" >> _shellType >> "indirecthitrange"); _indirectHitRange = getNumber(configFile >> "CfgAmmo" >> _shellType >> "indirecthitrange");
_fragRange = 20*_indirectHitRange*4; _fragRange = 20 * _indirectHitRange * 4;
// _c = 185; // grams of comp-b // _c = 185; // grams of comp-b
// _m = 210; // grams of fragmentating metal // _m = 210; // grams of fragmentating metal
// _k = 3/5; // spherical K factor // _k = 3/5; // spherical K factor
@ -72,9 +69,9 @@ if(_warn) then {
}; };
_fragPower = (((_m/_c)+_k)^-(1/2))*_gC; _fragPower = (((_m/_c)+_k)^-(1/2))*_gC;
_fragPower = _fragPower*0.8; // Gunery equation is for a non-fragmenting metal, imperical value of 80% represents fragmentation _fragPower = _fragPower * 0.8; // Gunery equation is for a non-fragmenting metal, imperical value of 80% represents fragmentation
_fragPowerRandom = _fragPower*0.5; _fragPowerRandom = _fragPower * 0.5;
if((_atlPos select 2) < 0.5) then { if((_atlPos select 2) < 0.5) then {
_lastPos set[2, (_lastPos select 2)+0.5]; _lastPos set[2, (_lastPos select 2)+0.5];
}; };
@ -123,7 +120,7 @@ if(_isArmed && (count _objects) > 0) then {
_bbX = (abs((_boundingBox select 0) select 0))+((_boundingBox select 1) select 0); _bbX = (abs((_boundingBox select 0) select 0))+((_boundingBox select 1) select 0);
_bbY = (abs((_boundingBox select 0) select 1))+((_boundingBox select 1) select 1); _bbY = (abs((_boundingBox select 0) select 1))+((_boundingBox select 1) select 1);
_bbZ = (abs((_boundingBox select 0) select 2))+((_boundingBox select 1) select 2); _bbZ = (abs((_boundingBox select 0) select 2))+((_boundingBox select 1) select 2);
_cubic = _bbX*_bbY*_bbZ; _cubic = _bbX * _bbY * _bbZ;
if(_cubic > 1) then { if(_cubic > 1) then {
_doRandom = true; _doRandom = true;
@ -181,7 +178,7 @@ if(_isArmed && (count _objects) > 0) then {
if(_fragCount > MAX_FRAG_COUNT) exitWith {}; if(_fragCount > MAX_FRAG_COUNT) exitWith {};
} forEach _objects; } forEach _objects;
if(_fragCount > MAX_FRAG_COUNT) exitWith {}; if(_fragCount > MAX_FRAG_COUNT) exitWith {};
_randomCount = ((ceil((MAX_FRAG_COUNT-_fragCount)*0.1)) max 0)+20; _randomCount = ((ceil((MAX_FRAG_COUNT - _fragCount)*0.1)) max 0)+20;
_sectorSize = 360 / (_randomCount max 1); _sectorSize = 360 / (_randomCount max 1);
// _doRandom = false; // _doRandom = false;
if(_doRandom) then { if(_doRandom) then {

View File

@ -15,12 +15,12 @@
if (!GVAR(enabled)) exitWith {}; if (!GVAR(enabled)) exitWith {};
private["_gcIndex", "_iter"]; private ["_gcIndex", "_iter"];
_gcIndex = []; _gcIndex = [];
_iter = 0; _iter = 0;
while { (count GVAR(objects)) > 0 && { _iter < (GVAR(MaxTrackPerFrame) min (count GVAR(objects))) } } do { while { (count GVAR(objects)) > 0 && { _iter < (GVAR(MaxTrackPerFrame) min (count GVAR(objects))) } } do {
private["_object", "_args"]; private ["_object", "_args"];
if(GVAR(lastIterationIndex) >= (count GVAR(objects))) then { if(GVAR(lastIterationIndex) >= (count GVAR(objects))) then {
GVAR(lastIterationIndex) = 0; GVAR(lastIterationIndex) = 0;
}; };
@ -38,7 +38,7 @@ while { (count GVAR(objects)) > 0 && { _iter < (GVAR(MaxTrackPerFrame) min (cou
}; };
// clean up dead object references // clean up dead object references
private["_deletionCount", "_deleteIndex"]; private ["_deletionCount", "_deleteIndex"];
_deletionCount = 0; _deletionCount = 0;
{ {
TRACE_1("GC Projectile", _x); TRACE_1("GC Projectile", _x);

View File

@ -32,7 +32,7 @@ _this set[1, (getPosASL _round)];
_this set[2, (velocity _round)]; _this set[2, (velocity _round)];
if(_doSpall) then { if(_doSpall) then {
private["_scale"]; private ["_scale"];
_scale = ( (count GVAR(objects)) / GVAR(MaxTrackPerFrame) ) max 0.1; _scale = ( (count GVAR(objects)) / GVAR(MaxTrackPerFrame) ) max 0.1;
[_round, _scale, _spallTrack, _foundObjectHPIds] call FUNC(spallTrack); [_round, _scale, _spallTrack, _foundObjectHPIds] call FUNC(spallTrack);
}; };

View File

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

View File

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

View File

@ -21,11 +21,11 @@ params ["_text", "_icon", "_sPos", "_textSettings"];
TRACE_2("Icon",_text,_sPos); TRACE_2("Icon",_text,_sPos);
if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then { if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
private _displayNum = [[46, 12] select visibleMap,91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]); private _displayNum = [[46, 12] select visibleMap, 91919] select (uiNamespace getVariable [QGVAR(cursorMenuOpened),false]);
GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021+GVAR(iconCount)]); GVAR(iconCtrls) pushBack ((findDisplay _displayNum) ctrlCreate ["RscStructuredText", 54021 + GVAR(iconCount)]);
if (GVAR(useCursorMenu)) then { if (GVAR(useCursorMenu)) then {
((finddisplay _displayNum) displayctrl (54021+GVAR(iconCount))) ctrlAddEventHandler ["MouseMoving", DFUNC(handleMouseMovement)]; ((finddisplay _displayNum) displayctrl (54021 + GVAR(iconCount))) ctrlAddEventHandler ["MouseMoving", DFUNC(handleMouseMovement)];
((finddisplay _displayNum) displayctrl (54021+GVAR(iconCount))) ctrlAddEventHandler ["MouseButtonDown", DFUNC(handleMouseButtonDown)]; ((finddisplay _displayNum) displayctrl (54021 + GVAR(iconCount))) ctrlAddEventHandler ["MouseButtonDown", DFUNC(handleMouseButtonDown)];
}; };
}; };
private _ctrl = GVAR(iconCtrls) select GVAR(iconCount); private _ctrl = GVAR(iconCtrls) select GVAR(iconCount);
@ -44,9 +44,9 @@ _text = if (GVAR(UseListMenu)) then {
GVAR(iconCount) = GVAR(iconCount) + 1; GVAR(iconCount) = GVAR(iconCount) + 1;
private _pos = if (GVAR(UseListMenu)) then { private _pos = if (GVAR(UseListMenu)) then {
[(_sPos select 0)-(0.0095*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.20*SafeZoneW, 0.035*SafeZoneW] [(_sPos select 0) - (0.0095 * SafeZoneW), (_sPos select 1) - (0.0095 * SafeZoneW), 0.20 * SafeZoneW, 0.035 * SafeZoneW]
} else { } else {
[(_sPos select 0)-(0.0750*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.15*SafeZoneW, 0.100*SafeZoneW] [(_sPos select 0) - (0.0750 * SafeZoneW), (_sPos select 1) - (0.0095 * SafeZoneW), 0.15 * SafeZoneW, 0.100 * SafeZoneW]
}; };
if (GVAR(cursorKeepCentered) && {uiNamespace getVariable [QGVAR(cursorMenuOpened),false]}) then { if (GVAR(cursorKeepCentered) && {uiNamespace getVariable [QGVAR(cursorMenuOpened),false]}) then {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,11 +5,11 @@ TRACE_1("enter", _this);
#define __TRACKINTERVAL 0 // how frequent the check should be. #define __TRACKINTERVAL 0 // how frequent the check should be.
#define __LOCKONTIME 3 // Lock on won't occur sooner #define __LOCKONTIME 3 // Lock on won't occur sooner
private["_apos", "_aposX", "_aposY", "_args", "_boundsInput", "_bpos", "_canFire", "_constraintBottom"]; private ["_apos", "_aposX", "_aposY", "_args", "_boundsInput", "_bpos", "_canFire", "_constraintBottom"];
private["_constraintLeft", "_constraintRight", "_constraintTop", "_currentTarget", "_fireDisabledEH"]; private ["_constraintLeft", "_constraintRight", "_constraintTop", "_currentTarget", "_fireDisabledEH"];
private["_firedEH", "_fov", "_lastTick", "_lockTime", "_maxX", "_maxY", "_minX", "_minY", "_newTarget"]; private ["_firedEH", "_fov", "_lastTick", "_lockTime", "_maxX", "_maxY", "_minX", "_minY", "_newTarget"];
private["_offsetX", "_offsetY", "_pos", "_randomLockInterval", "_randomPosWithinBounds", "_range"]; private ["_offsetX", "_offsetY", "_pos", "_randomLockInterval", "_randomPosWithinBounds", "_range"];
private["_runTime", "_soundTime", "_targetArray", "_zamerny", "_currentShooter"]; private ["_runTime", "_soundTime", "_targetArray", "_zamerny", "_currentShooter"];
_currentShooter = if (ACE_player call CBA_fnc_canUseWeapon) then {ACE_player} else {vehicle ACE_player}; _currentShooter = if (ACE_player call CBA_fnc_canUseWeapon) then {ACE_player} else {vehicle ACE_player};
@ -35,7 +35,7 @@ _soundTime = _args select 4;
_randomLockInterval = _args select 5; _randomLockInterval = _args select 5;
_fireDisabledEH = _args select 6; _fireDisabledEH = _args select 6;
private["_ammo", "_magazineConfig", "_weaponConfig"]; private ["_ammo", "_magazineConfig", "_weaponConfig"];
_weaponConfig = configProperties [configFile >> "CfgWeapons" >> (currentWeapon _currentShooter), QUOTE(configName _x == QUOTE(QGVAR(enabled))), false]; _weaponConfig = configProperties [configFile >> "CfgWeapons" >> (currentWeapon _currentShooter), QUOTE(configName _x == QUOTE(QGVAR(enabled))), false];
_magazineConfig = if ((currentMagazine _currentShooter) != "") then { _magazineConfig = if ((currentMagazine _currentShooter) != "") then {
_ammo = getText (configFile >> "CfgMagazines" >> (currentMagazine _currentShooter) >> "ammo"); _ammo = getText (configFile >> "CfgMagazines" >> (currentMagazine _currentShooter) >> "ammo");
@ -123,7 +123,7 @@ _offsetY = __OffsetY;
__JavelinIGUITargeting ctrlShow true; __JavelinIGUITargeting ctrlShow true;
__JavelinIGUITargetingConstrains 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)]; _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); _apos = worldToScreen (_currentTarget modelToWorld _randomPosWithinBounds);
@ -202,17 +202,17 @@ if (isNull _newTarget) then {
_minX = ((_bpos select 0) + _offsetX) max _constraintLeft; _minX = ((_bpos select 0) + _offsetX) max _constraintLeft;
_minY = ((_bpos select 1) + _offsetY) max _constraintTop; _minY = ((_bpos select 1) + _offsetY) max _constraintTop;
_maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH); _maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025 * (3 / 4) * SafezoneH);
_maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH); _maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025 * SafezoneH);
TRACE_4("", _boundsInput, _bpos, _minX, _minY); TRACE_4("", _boundsInput, _bpos, _minX, _minY);
__JavelinIGUITargetingGateTL ctrlSetPosition [_minX,_minY]; __JavelinIGUITargetingGateTL ctrlSetPosition [_minX, _minY];
__JavelinIGUITargetingGateTR ctrlSetPosition [_maxX,_minY]; __JavelinIGUITargetingGateTR ctrlSetPosition [_maxX, _minY];
__JavelinIGUITargetingGateBL ctrlSetPosition [_minX,_maxY]; __JavelinIGUITargetingGateBL ctrlSetPosition [_minX, _maxY];
__JavelinIGUITargetingGateBR ctrlSetPosition [_maxX,_maxY]; __JavelinIGUITargetingGateBR ctrlSetPosition [_maxX, _maxY];
{_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL,__JavelinIGUITargetingGateTR,__JavelinIGUITargetingGateBL,__JavelinIGUITargetingGateBR]; {_x ctrlCommit __TRACKINTERVAL} forEach [__JavelinIGUITargetingGateTL, __JavelinIGUITargetingGateTR, __JavelinIGUITargetingGateBL, __JavelinIGUITargetingGateBR];
_currentShooter setVariable["ace_missileguidance_target", _currentTarget, false]; _currentShooter setVariable["ace_missileguidance_target", _currentTarget, false];
@ -241,8 +241,8 @@ if (isNull _newTarget) then {
_minX = ((_bpos select 0) + _offsetX) max _constraintLeft; _minX = ((_bpos select 0) + _offsetX) max _constraintLeft;
_minY = ((_bpos select 1) + _offsetY) max _constraintTop; _minY = ((_bpos select 1) + _offsetY) max _constraintTop;
_maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025*(3/4)*SafezoneH); _maxX = ((_bpos select 2) + _offsetX) min (_constraintRight - 0.025 * (3 / 4) * SafezoneH);
_maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025*SafezoneH); _maxY = ((_bpos select 3) + _offsetY) min (_constraintBottom - 0.025 * SafezoneH);
TRACE_4("", _boundsInput, _bpos, _minX, _minY); TRACE_4("", _boundsInput, _bpos, _minX, _minY);
@ -272,7 +272,7 @@ if (isNull _newTarget) then {
__JavelinIGUITargetingLines ctrlShow false; __JavelinIGUITargetingLines ctrlShow false;
__JavelinIGUITargetingConstraints ctrlShow false; __JavelinIGUITargetingConstraints ctrlShow false;
_currentShooter setVariable ["ace_missileguidance_target",nil, false]; _currentShooter setVariable ["ace_missileguidance_target", nil, false];
// Disallow fire // Disallow fire
_fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire);

View File

@ -1,7 +1,7 @@
//#define DEBUG_MODE_FULL //#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
TRACE_1("enter", _this); TRACE_1("enter", _this);
private["_args", "_disableFireEH"]; private ["_args", "_disableFireEH"];
// uiNameSpace setVariable ['ACE_RscOptics_javelin',nil]; // uiNameSpace setVariable ['ACE_RscOptics_javelin',nil];

View File

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

View File

@ -16,10 +16,9 @@
* Public: No * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private "_table";
params ["_year", "_month", "_day"]; 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 { if (_month < 3) then {
_year = _year - 1; _year = _year - 1;
}; };

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
//#define DEBUG_MODE_FULL //#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
private["_oldLaserCode", "_laserCode"]; private ["_oldLaserCode", "_laserCode"];
_oldLaserCode = ACE_player getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE]; _oldLaserCode = ACE_player getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE];
if(_oldLaserCode > ACE_DEFAULT_LASER_CODE) then { if(_oldLaserCode > ACE_DEFAULT_LASER_CODE) then {

View File

@ -1,6 +1,6 @@
//#define DEBUG_MODE_FULL //#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
private["_oldLaserCode", "_laserCode"]; private ["_oldLaserCode", "_laserCode"];
_oldLaserCode = ACE_player getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE]; _oldLaserCode = ACE_player getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE];
_laserCode = _oldLaserCode + 1; _laserCode = _oldLaserCode + 1;

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
TRACE_1("enter", _this); TRACE_1("enter", _this);
PARAMS_1(_laserTarget); PARAMS_1(_laserTarget);
private["_uuid"]; private ["_uuid"];
// Add the target to the global targets array // Add the target to the global targets array
// Everyone tracks them // Everyone tracks them

View File

@ -1,6 +1,6 @@
//#define DEBUG_MODE_FULL //#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
private["_laserCode"]; private ["_laserCode"];
_laserCode = ACE_player getVariable[QGVAR(code), ACE_DEFAULT_LASER_CODE]; _laserCode = ACE_player getVariable[QGVAR(code), ACE_DEFAULT_LASER_CODE];
if(!isNil "_laserCode") then { if(!isNil "_laserCode") then {

View File

@ -1,5 +1,5 @@
#include "script_component.hpp" #include "script_component.hpp"
private["_d", "_map", "_p", "_theta", "_u"]; private ["_d", "_map", "_p", "_theta", "_u"];
_map = _this select 0; _map = _this select 0;
_theta = _this select 1; _theta = _this select 1;

View File

@ -18,7 +18,7 @@
private ["_pos", "_seekerWavelengths", "_seekerCode", "_spots", "_buckets", "_excludes", "_bucketIndex", "_finalPos", "_owner", "_obj", "_x", "_method"]; private ["_pos", "_seekerWavelengths", "_seekerCode", "_spots", "_buckets", "_excludes", "_bucketIndex", "_finalPos", "_owner", "_obj", "_x", "_method"];
private ["_emitterWavelength", "_laserCode", "_divergence", "_laser", "_res", "_bucketPos", "_bucketList", "_c", "_forEachIndex", "_index"]; private ["_emitterWavelength", "_laserCode", "_divergence", "_laser", "_res", "_bucketPos", "_bucketList", "_c", "_forEachIndex", "_index"];
private ["_testPos", "_finalBuckets", "_largest", "_largestIndex", "_finalBucket", "_owners", "_avgX", "_avgY", "_avgZ", "_count", "_maxOwner", "_maxOwnerIndex", "_finalOwner"]; private ["_testPos", "_finalBuckets", "_largest", "_largestIndex", "_finalBucket", "_owners", "_avgX", "_avgY", "_avgZ", "_count", "_maxOwner", "_maxOwnerIndex", "_finalOwner"];
private["_dir", "_seekerCos", "_seekerFov", "_testDotProduct", "_testPoint", "_testPointVector"]; private ["_dir", "_seekerCos", "_seekerFov", "_testDotProduct", "_testPoint", "_testPointVector"];
_pos = _this select 0; _pos = _this select 0;
_dir = vectorNormalized (_this select 1); _dir = vectorNormalized (_this select 1);

View File

@ -12,7 +12,7 @@
//#define DEBUG_MODE_FULL //#define DEBUG_MODE_FULL
#include "script_component.hpp" #include "script_component.hpp"
private["_emmiter", "_owner", "_gunnerInfo", "_turretInfo", "_povPos", "_povDir"]; private ["_emmiter", "_owner", "_gunnerInfo", "_turretInfo", "_povPos", "_povDir"];
_emmiter = _this select 0; _emmiter = _this select 0;
_owner = _this select 1; _owner = _this select 1;

View File

@ -13,7 +13,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private["_gunnerInfo", "_turretInfo"]; private ["_gunnerInfo", "_turretInfo"];
params ["_emmiter"]; params ["_emmiter"];
_gunnerInfo = [_emmiter, (currentWeapon _emmiter)] call CBA_fnc_getFirer; _gunnerInfo = [_emmiter, (currentWeapon _emmiter)] call CBA_fnc_getFirer;

View File

@ -18,7 +18,7 @@ TRACE_1("enter", _this);
#define FCS_UPDATE_DELAY 1 #define FCS_UPDATE_DELAY 1
FUNC(laserHudDesignatePFH) = { FUNC(laserHudDesignatePFH) = {
private["_strongestResultPos", "_args", "_localLaserTarget", "_laserResultPosition", "_laserResult", "_shooter", "_vehicle", "_weapon", "_gunnerInfo", "_turretInfo", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir", "_result", "_resultPositions", "_firstResult", "_forceUpdateTime"]; private ["_strongestResultPos", "_args", "_localLaserTarget", "_laserResultPosition", "_laserResult", "_shooter", "_vehicle", "_weapon", "_gunnerInfo", "_turretInfo", "_pov", "_gunBeg", "_gunEnd", "_povPos", "_povDir", "_result", "_resultPositions", "_firstResult", "_forceUpdateTime"];
params ["_args"]; params ["_args"];
_args params ["_shooter", "_localLaserTarget"]; _args params ["_shooter", "_localLaserTarget"];
_vehicle = vehicle _shooter; _vehicle = vehicle _shooter;

View File

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

View File

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

View File

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

View File

@ -26,7 +26,7 @@
if (!GVAR(enabled) || !visibleMap) exitWith {}; if (!GVAR(enabled) || !visibleMap) exitWith {};
private["_color", "_drawPosVariableName", "_group", "_grpName", "_pos", "_unitUID"]; private ["_color", "_drawPosVariableName", "_group", "_grpName", "_pos", "_unitUID"];
params ["_mapHandle"]; params ["_mapHandle"];

View File

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

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