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",
"_temperatureIndexA", "_temperatureIndexB", "_interpolationRatio"];
params ["_muzzleVelocityShiftTable", "_temperature"]; 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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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,11 +15,10 @@
* 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);

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

@ -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

@ -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,18 +11,15 @@ 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),
@ -30,16 +27,16 @@ _fragTypes = [
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);

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

@ -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

@ -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);

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

@ -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

@ -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

@ -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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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