Refactor private ARRAY to private keyword (#5598)

* Everything

* Fixed missing ;

* Fix missing ; and double private

* Fixed cannot isNull on number

* Turn _temparture back to isNil

* Fix error from merge
This commit is contained in:
Dedmen Miller 2017-10-10 16:39:59 +02:00 committed by PabstMirror
parent 22c8ef1e8a
commit 81e02a7336
236 changed files with 1496 additions and 1920 deletions

View File

@ -21,17 +21,14 @@
scopeName "main"; scopeName "main";
private ["_muzzleVelocityTableCount", "_barrelLengthTableCount", "_lowerDataIndex",
"_upperDataIndex", "_lowerBarrelLength", "_upperBarrelLength", "_lowerMuzzleVelocity",
"_upperMuzzleVelocity", "_interpolationRatio"];
params ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity"]; params ["_barrelLength", "_muzzleVelocityTable", "_barrelLengthTable", "_muzzleVelocity"];
TRACE_4("params",_barrelLength,_muzzleVelocityTable,_barrelLengthTable,_muzzleVelocity); TRACE_4("params",_barrelLength,_muzzleVelocityTable,_barrelLengthTable,_muzzleVelocity);
// If barrel length is not defined, then there is no point in calculating muzzle velocity // If barrel length is not defined, then there is no point in calculating muzzle velocity
if (_barrelLength == 0) exitWith { 0 }; if (_barrelLength == 0) exitWith { 0 };
_muzzleVelocityTableCount = count _muzzleVelocityTable; private _muzzleVelocityTableCount = count _muzzleVelocityTable;
_barrelLengthTableCount = count _barrelLengthTable; private _barrelLengthTableCount = count _barrelLengthTable;
// Exit if tables are different sizes, have no elements or have only one element // Exit if tables are different sizes, have no elements or have only one element
if (_muzzleVelocityTableCount != _barrelLengthTableCount || _muzzleVelocityTableCount == 0 || _barrelLengthTableCount == 0) exitWith { 0 }; if (_muzzleVelocityTableCount != _barrelLengthTableCount || _muzzleVelocityTableCount == 0 || _barrelLengthTableCount == 0) exitWith { 0 };
@ -46,6 +43,9 @@ if (_barrelLength in _barrelLengthTable) exitWith {
if (_barrelLength <= (_barrelLengthTable select 0)) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity }; if (_barrelLength <= (_barrelLengthTable select 0)) exitWith { (_muzzleVelocityTable select 0) - _muzzleVelocity };
if (_barrelLength >= (_barrelLengthTable select _barrelLengthTableCount - 1)) exitWith { (_muzzleVelocityTable select _barrelLengthTableCount - 1) - _muzzleVelocity }; if (_barrelLength >= (_barrelLengthTable select _barrelLengthTableCount - 1)) exitWith { (_muzzleVelocityTable select _barrelLengthTableCount - 1) - _muzzleVelocity };
private _upperDataIndex = -1;
private _lowerDataIndex = -1;
// Find closest bordering values for barrel length // Find closest bordering values for barrel length
{ {
if (_barrelLength <= _x) then { if (_barrelLength <= _x) then {
@ -56,19 +56,15 @@ if (_barrelLength >= (_barrelLengthTable select _barrelLengthTableCount - 1)) ex
} forEach _barrelLengthTable; } forEach _barrelLengthTable;
// Worst case scenario // Worst case scenario
if (isNil "_lowerDataIndex" || isNil "_upperDataIndex") exitWith {0}; if (_upperDataIndex == -1 || _lowerDataIndex == -1) exitWith {0};
_lowerBarrelLength = _barrelLengthTable select _lowerDataIndex; private _lowerBarrelLength = _barrelLengthTable select _lowerDataIndex;
_upperBarrelLength = _barrelLengthTable select _upperDataIndex; private _upperBarrelLength = _barrelLengthTable select _upperDataIndex;
_lowerMuzzleVelocity = _muzzleVelocityTable select _lowerDataIndex; private _lowerMuzzleVelocity = _muzzleVelocityTable select _lowerDataIndex;
_upperMuzzleVelocity = _muzzleVelocityTable select _upperDataIndex; private _upperMuzzleVelocity = _muzzleVelocityTable select _upperDataIndex;
// Calculate interpolation ratio // Calculate interpolation ratio
_interpolationRatio = if (abs (_lowerBarrelLength - _upperBarrelLength) > 0) then { private _interpolationRatio = [0, (_upperBarrelLength - _barrelLength) / (_upperBarrelLength - _lowerBarrelLength)] select (abs (_lowerBarrelLength - _upperBarrelLength) > 0);
(_upperBarrelLength - _barrelLength) / (_upperBarrelLength - _lowerBarrelLength)
} else {
0
};
// Calculate interpolated muzzle velocity shift // Calculate interpolated muzzle velocity shift
(_lowerMuzzleVelocity + ((_upperMuzzleVelocity - _lowerMuzzleVelocity) * (1 - _interpolationRatio))) - _muzzleVelocity // Return (_lowerMuzzleVelocity + ((_upperMuzzleVelocity - _lowerMuzzleVelocity) * (1 - _interpolationRatio))) - _muzzleVelocity // Return

View File

@ -31,7 +31,7 @@
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,"","",""];
}; };
_bullet setVelocity (_bulletVelocity vectorAdd (parseSimpleArray ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, CBA_missionTime toFixed 6]))); _bullet setVelocity (_bulletVelocity vectorAdd (parseSimpleArray ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, CBA_missionTime toFixed 6])));
}; };
nil nil
} count +GVAR(allBullets); } count +GVAR(allBullets);

View File

@ -19,10 +19,7 @@
//IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"]; //IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle", "_gunner", "_turret"];
TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret); TRACE_10("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle, _gunner, _turret);
// Parameterization private _abort = false;
private ["_abort", "_AmmoCacheEntry", "_WeaponCacheEntry", "_opticsName", "_opticType", "_bulletTraceVisible", "_temperature", "_barometricPressure", "_bulletMass", "_bulletLength", "_muzzleVelocity", "_muzzleVelocityShift", "_bulletVelocity", "_bulletLength", "_barrelTwist", "_stabilityFactor", "_barrelVelocityShift", "_ammoTemperatureVelocityShift"];
_abort = false;
if (!(_ammo isKindOf "BulletBase")) exitWith {}; if (!(_ammo isKindOf "BulletBase")) exitWith {};
if (!alive _projectile) exitWith {}; if (!alive _projectile) exitWith {};
@ -33,8 +30,8 @@ if (!GVAR(simulateForEveryone) && !(local _unit)) then {
_abort = true; _abort = true;
if (GVAR(simulateForSnipers)) then { if (GVAR(simulateForSnipers)) then {
if (currentWeapon _unit == primaryWeapon _unit && count primaryWeaponItems _unit > 2) then { if (currentWeapon _unit == primaryWeapon _unit && count primaryWeaponItems _unit > 2) then {
_opticsName = (primaryWeaponItems _unit) select 2; private _opticsName = (primaryWeaponItems _unit) select 2;
_opticType = getNumber(configFile >> "CfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType"); private _opticType = getNumber(configFile >> "CfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType");
_abort = _opticType != 2; // We only abort if the non local shooter is not a sniper _abort = _opticType != 2; // We only abort if the non local shooter is not a sniper
}; };
}; };
@ -46,11 +43,11 @@ if (!GVAR(simulateForEveryone) && !(local _unit)) then {
if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; }; if (GVAR(disabledInFullAutoMode) && getNumber(configFile >> "CfgWeapons" >> _weapon >> _mode >> "autoFire") == 1) then { _abort = true; };
// Get Weapon and Ammo Configurations // Get Weapon and Ammo Configurations
_AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo]; private _AmmoCacheEntry = uiNamespace getVariable format[QGVAR(%1), _ammo];
if (isNil "_AmmoCacheEntry") then { if (isNil "_AmmoCacheEntry") then {
_AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig); _AmmoCacheEntry = _ammo call FUNC(readAmmoDataFromConfig);
}; };
_WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon]; private _WeaponCacheEntry = uiNamespace getVariable format[QGVAR(%1), _weapon];
if (isNil "_WeaponCacheEntry") then { if (isNil "_WeaponCacheEntry") then {
_WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig); _WeaponCacheEntry = _weapon call FUNC(readWeaponDataFromConfig);
}; };
@ -59,22 +56,24 @@ _AmmoCacheEntry params ["_airFriction", "_caliber", "_bulletLength", "_bulletMas
_WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"]; _WeaponCacheEntry params ["_barrelTwist", "_twistDirection", "_barrelLength"];
_bulletVelocity = velocity _projectile; private _bulletVelocity = velocity _projectile;
_muzzleVelocity = vectorMagnitude _bulletVelocity; private _muzzleVelocity = vectorMagnitude _bulletVelocity;
_barrelVelocityShift = 0; private _barrelVelocityShift = 0;
if (GVAR(barrelLengthInfluenceEnabled)) then { if (GVAR(barrelLengthInfluenceEnabled)) then {
_barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift); _barrelVelocityShift = [_barrelLength, _muzzleVelocityTable, _barrelLengthTable, _muzzleVelocity] call FUNC(calculateBarrelLengthVelocityShift);
}; };
_ammoTemperatureVelocityShift = 0; private _ammoTemperatureVelocityShift = 0;
private _temperature = nil; //Need the variable in this scope. So we need to init it here.
if (GVAR(ammoTemperatureEnabled)) then { if (GVAR(ammoTemperatureEnabled)) then {
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
_ammoTemperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift)); _ammoTemperatureVelocityShift = ([_ammoTempMuzzleVelocityShifts, _temperature] call FUNC(calculateAmmoTemperatureVelocityShift));
}; };
if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then { if (GVAR(ammoTemperatureEnabled) || GVAR(barrelLengthInfluenceEnabled)) then {
_muzzleVelocityShift = _barrelVelocityShift + _ammoTemperatureVelocityShift; private _muzzleVelocityShift = _barrelVelocityShift + _ammoTemperatureVelocityShift;
TRACE_4("shift",_muzzleVelocity,_muzzleVelocityShift, _barrelVelocityShift, _ammoTemperatureVelocityShift); TRACE_4("shift",_muzzleVelocity,_muzzleVelocityShift, _barrelVelocityShift, _ammoTemperatureVelocityShift);
if (_muzzleVelocityShift != 0) then { if (_muzzleVelocityShift != 0) then {
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
@ -89,31 +88,31 @@ if (_abort || !(GVAR(extensionAvailable))) exitWith {
}; };
}; };
_bulletTraceVisible = false; private _bulletTraceVisible = false;
if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then { if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then {
if (currentWeapon ACE_player == binocular ACE_player) then { if (currentWeapon ACE_player == binocular ACE_player) then {
_bulletTraceVisible = true; _bulletTraceVisible = true;
} else { } else {
if (currentWeapon ACE_player == primaryWeapon ACE_player && count primaryWeaponItems ACE_player > 2) then { if (currentWeapon ACE_player == primaryWeapon ACE_player && count primaryWeaponItems ACE_player > 2) then {
_opticsName = (primaryWeaponItems ACE_player) select 2; private _opticsName = (primaryWeaponItems ACE_player) select 2;
_opticType = getNumber(configFile >> "CfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType"); private _opticType = getNumber(configFile >> "CfgWeapons" >> _opticsName >> "ItemInfo" >> "opticType");
_bulletTraceVisible = _opticType == 2; _bulletTraceVisible = _opticType == 2;
}; };
}; };
}; };
_stabilityFactor = 1.5; private _stabilityFactor = 1.5;
if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then { if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {
if (isNil "_temperature") then { if (isNil "_temperature") then {
_temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight); _temperature = ((getPosASL _unit) select 2) call EFUNC(weather,calculateTemperatureAtHeight);
}; };
_barometricPressure = ((getPosASL _projectile) select 2) call EFUNC(weather,calculateBarometricPressure); private _barometricPressure = ((getPosASL _projectile) select 2) call EFUNC(weather,calculateBarometricPressure);
_stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor); _stabilityFactor = [_caliber, _bulletLength, _bulletMass, _barrelTwist, _muzzleVelocity, _temperature, _barometricPressure] call FUNC(calculateStabilityFactor);
}; };
GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000; GVAR(currentbulletID) = (GVAR(currentbulletID) + 1) % 10000;
"ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:%18", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _projectile, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, CBA_missionTime toFixed 6]; "ace_advanced_ballistics" callExtension format["new:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17", GVAR(currentbulletID), _airFriction, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _dragModel, _stabilityFactor, _twistDirection, _muzzleVelocity, _transonicStabilityCoef, getPosASL _projectile, EGVAR(common,mapLatitude), EGVAR(weather,currentTemperature), EGVAR(common,mapAltitude), EGVAR(weather,currentHumidity), overcast, CBA_missionTime toFixed 6];
GVAR(allBullets) pushBack [_projectile, _caliber, _bulletTraceVisible, GVAR(currentbulletID)]; GVAR(allBullets) pushBack [_projectile, _caliber, _bulletTraceVisible, GVAR(currentbulletID)];

View File

@ -19,10 +19,8 @@ if (!hasInterface) exitWith {};
if (!GVAR(enabled)) exitWith {}; if (!GVAR(enabled)) exitWith {};
if (!GVAR(extensionAvailable)) exitWith {}; if (!GVAR(extensionAvailable)) exitWith {};
private ["_initStartTime", "_mapSize", "_mapGrids", "_gridCells", "_x", "_y", "_gridCenter", "_gridHeight", "_gridNumObjects", "_gridSurfaceIsWater"]; private _initStartTime = CBA_missionTime;
private _mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize");
_initStartTime = CBA_missionTime;
_mapSize = getNumber (configFile >> "CfgWorlds" >> worldName >> "MapSize");
if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith { if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _mapSize]) == "Terrain already initialized") exitWith {
INFO_1("Terrain already initialized [world: %1]", worldName); INFO_1("Terrain already initialized [world: %1]", worldName);
@ -31,8 +29,8 @@ if (("ace_advanced_ballistics" callExtension format["init:%1:%2", worldName, _ma
#endif #endif
}; };
_mapGrids = ceil(_mapSize / 50) + 1; private _mapGrids = ceil(_mapSize / 50) + 1;
_gridCells = _mapGrids * _mapGrids; private _gridCells = _mapGrids * _mapGrids;
GVAR(currentGrid) = 0; GVAR(currentGrid) = 0;
@ -51,12 +49,12 @@ INFO_2("Starting Terrain Extension [cells: %1] [world: %2]", _gridCells, worldNa
}; };
for "_i" from 1 to 50 do { for "_i" from 1 to 50 do {
_x = floor(GVAR(currentGrid) / _mapGrids) * 50; private _x = floor(GVAR(currentGrid) / _mapGrids) * 50;
_y = (GVAR(currentGrid) - floor(GVAR(currentGrid) / _mapGrids) * _mapGrids) * 50; private _y = (GVAR(currentGrid) - floor(GVAR(currentGrid) / _mapGrids) * _mapGrids) * 50;
_gridCenter = [_x + 25, _y + 25]; private _gridCenter = [_x + 25, _y + 25];
_gridHeight = round(getTerrainHeightASL _gridCenter); private _gridHeight = round(getTerrainHeightASL _gridCenter);
_gridNumObjects = count (_gridCenter nearObjects ["Building", 50]); private _gridNumObjects = count (_gridCenter nearObjects ["Building", 50]);
_gridSurfaceIsWater = if (surfaceIsWater _gridCenter) then {1} else {0}; private _gridSurfaceIsWater = if (surfaceIsWater _gridCenter) then {1} else {0};
"ace_advanced_ballistics" callExtension format["set:%1:%2:%3", _gridHeight, _gridNumObjects, _gridSurfaceIsWater]; "ace_advanced_ballistics" callExtension format["set:%1:%2:%3", _gridHeight, _gridNumObjects, _gridSurfaceIsWater];
GVAR(currentGrid) = GVAR(currentGrid) + 1; GVAR(currentGrid) = GVAR(currentGrid) + 1;
if (GVAR(currentGrid) >= _gridCells) exitWith {}; if (GVAR(currentGrid) >= _gridCells) exitWith {};

View File

@ -28,30 +28,30 @@
#include "script_component.hpp" #include "script_component.hpp"
TRACE_1("Reading Ammo Config",_this); TRACE_1("Reading Ammo Config",_this);
private ["_ammo", "_airFriction", "_caliber", "_bulletLength", "_bulletMass", "_transonicStabilityCoef", "_dragModel", "_ballisticCoefficients", "_velocityBoundaries", "_atmosphereModel", "_ammoTempMuzzleVelocityShifts", "_muzzleVelocityTable", "_barrelLengthTable", "_result"];
private _ammoConfig = configFile >> "CfgAmmo" >> _this; private _ammoConfig = configFile >> "CfgAmmo" >> _this;
_airFriction = getNumber(_ammoConfig >> "airFriction"); private _airFriction = getNumber(_ammoConfig >> "airFriction");
_caliber = getNumber(_ammoConfig >> "ACE_caliber"); private _caliber = getNumber(_ammoConfig >> "ACE_caliber");
_bulletLength = getNumber(_ammoConfig >> "ACE_bulletLength"); private _bulletLength = getNumber(_ammoConfig >> "ACE_bulletLength");
_bulletMass = getNumber(_ammoConfig >> "ACE_bulletMass"); private _bulletMass = getNumber(_ammoConfig >> "ACE_bulletMass");
_transonicStabilityCoef = getNumber(_ammoConfig >> "ACE_transonicStabilityCoef"); private _transonicStabilityCoef = getNumber(_ammoConfig >> "ACE_transonicStabilityCoef");
if (_transonicStabilityCoef == 0) then { if (_transonicStabilityCoef == 0) then {
_transonicStabilityCoef = 0.5; _transonicStabilityCoef = 0.5;
}; };
_dragModel = getNumber(_ammoConfig >> "ACE_dragModel"); private _dragModel = getNumber(_ammoConfig >> "ACE_dragModel");
if (_dragModel == 0 || !(_dragModel in [1, 2, 5, 6, 7, 8])) then { if (_dragModel == 0 || !(_dragModel in [1, 2, 5, 6, 7, 8])) then {
_dragModel = 1; _dragModel = 1;
}; };
_ballisticCoefficients = getArray(_ammoConfig >> "ACE_ballisticCoefficients"); private _ballisticCoefficients = getArray(_ammoConfig >> "ACE_ballisticCoefficients");
_velocityBoundaries = getArray(_ammoConfig >> "ACE_velocityBoundaries"); private _velocityBoundaries = getArray(_ammoConfig >> "ACE_velocityBoundaries");
_atmosphereModel = getText(_ammoConfig >> "ACE_standardAtmosphere"); private _atmosphereModel = getText(_ammoConfig >> "ACE_standardAtmosphere");
if (_atmosphereModel isEqualTo "") then { if (_atmosphereModel isEqualTo "") then {
_atmosphereModel = "ICAO"; _atmosphereModel = "ICAO";
}; };
_ammoTempMuzzleVelocityShifts = getArray(_ammoConfig >> "ACE_ammoTempMuzzleVelocityShifts"); private _ammoTempMuzzleVelocityShifts = getArray(_ammoConfig >> "ACE_ammoTempMuzzleVelocityShifts");
_muzzleVelocityTable = getArray(_ammoConfig >> "ACE_muzzleVelocities"); private _muzzleVelocityTable = getArray(_ammoConfig >> "ACE_muzzleVelocities");
_barrelLengthTable = getArray(_ammoConfig >> "ACE_barrelLengths"); private _barrelLengthTable = getArray(_ammoConfig >> "ACE_barrelLengths");
//Handle subsonic ammo that would have a huge muzzle velocity shift (when ballistic configs not explicitly defined) //Handle subsonic ammo that would have a huge muzzle velocity shift (when ballistic configs not explicitly defined)
private _typicalSpeed = getNumber (_ammoConfig >> "typicalSpeed"); private _typicalSpeed = getNumber (_ammoConfig >> "typicalSpeed");
@ -89,7 +89,7 @@ if ((_typicalSpeed > 0) && {_typicalSpeed < 360}) then {
}; };
}; };
_result = [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable]; private _result = [_airFriction, _caliber, _bulletLength, _bulletMass, _transonicStabilityCoef, _dragModel, _ballisticCoefficients, _velocityBoundaries, _atmosphereModel, _ammoTempMuzzleVelocityShifts, _muzzleVelocityTable, _barrelLengthTable];
uiNamespace setVariable [format[QGVAR(%1), _this], _result]; uiNamespace setVariable [format[QGVAR(%1), _this], _result];

View File

@ -67,7 +67,7 @@ for "_i" from 0.05 to 1.45 step 0.1 do {
private _col = [ [1, 1, 1, _alpha], [0, 1, 0, _alpha], [1, 0, 0, _alpha], [1, 1, 0, _alpha] ] select _cross; private _col = [ [1, 1, 1, _alpha], [0, 1, 0, _alpha], [1, 0, 0, _alpha], [1, 1, 0, _alpha] ] select _cross;
if (_cross != 2 && {lineIntersects [eyePos ACE_player, _newTrajASL]}) then { if (_cross != 2 && {lineIntersects [eyePos ACE_player, _newTrajASL]}) then {
_col set [3, 0.1] _col set [3, 0.1];
}; };
_pathData pushBack [_col, ASLToAGL _newTrajASL, _iDim]; _pathData pushBack [_col, ASLToAGL _newTrajASL, _iDim];

View File

@ -51,37 +51,34 @@ params [
]; ];
_windSpeed params ["_windSpeed1", "_windSpeed2"]; _windSpeed params ["_windSpeed1", "_windSpeed2"];
private ["_tx", "_tz", "_lastBulletPos", "_bulletPos", "_bulletVelocity", "_bulletAccel", "_bulletSpeed", "_gravity", "_deltaT"]; private _tx = 0;
_tx = 0; private _tz = 0;
_tz = 0; private _lastBulletPos = [0, 0, 0];
_lastBulletPos = [0, 0, 0]; private _bulletPos = [0, 0, 0];
_bulletPos = [0, 0, 0]; private _bulletVelocity = [0, 0, 0];
_bulletVelocity = [0, 0, 0]; private _bulletAccel = [0, 0, 0];
_bulletAccel = [0, 0, 0]; private _bulletSpeed = 0;
_bulletSpeed = 0; private _gravity = [0, sin(_scopeBaseAngle + _inclinationAngle) * -9.80665, cos(_scopeBaseAngle + _inclinationAngle) * -9.80665];
_gravity = [0, sin(_scopeBaseAngle + _inclinationAngle) * -9.80665, cos(_scopeBaseAngle + _inclinationAngle) * -9.80665]; private _deltaT = 1 / _simSteps;
_deltaT = 1 / _simSteps;
private ["_elevation", "_windage1", "_windage2", "_lead", "_TOF", "_trueVelocity", "_trueSpeed", "_kineticEnergy", "_verticalCoriolis", "_verticalDeflection", "_horizontalCoriolis", "_horizontalDeflection", "_spinDrift", "_spinDeflection"]; private _elevation = 0;
_elevation = 0; private _windage1 = 0;
_windage1 = 0; private _windage2 = 0;
_windage2 = 0; private _lead = 0;
_lead = 0; private _TOF = 0;
_TOF = 0; private _trueVelocity = [0, 0, 0];
_trueVelocity = [0, 0, 0]; private _trueSpeed = 0;
_trueSpeed = 0; private _verticalCoriolis = 0;
_verticalCoriolis = 0; private _verticalDeflection = 0;
_verticalDeflection = 0; private _horizontalCoriolis = 0;
_horizontalCoriolis = 0; private _horizontalDeflection = 0;
_horizontalDeflection = 0; private _spinDrift = 0;
_spinDrift = 0; private _spinDeflection = 0;
_spinDeflection = 0;
private ["_n", "_range", "_trueRange", "_rangeFactor"]; private _n = 0;
_n = 0; private _range = 0;
_range = 0; private _trueRange = 0;
_trueRange = 0; private _rangeFactor = 1;
_rangeFactor = 1;
if (_storeRangeCardData) then { if (_storeRangeCardData) then {
if (GVAR(currentUnit) == 1) then { if (GVAR(currentUnit) == 1) then {
_rangeFactor = 1.0936133; _rangeFactor = 1.0936133;
@ -89,16 +86,14 @@ if (_storeRangeCardData) then {
GVAR(rangeCardData) = []; GVAR(rangeCardData) = [];
}; };
private ["_wind1", "_wind2", "_windDrift"]; private _wind1 = [cos(270 - _windDirection * 30) * _windSpeed1, sin(270 - _windDirection * 30) * _windSpeed1, 0];
_wind1 = [cos(270 - _windDirection * 30) * _windSpeed1, sin(270 - _windDirection * 30) * _windSpeed1, 0]; private _wind2 = [cos(270 - _windDirection * 30) * _windSpeed2, sin(270 - _windDirection * 30) * _windSpeed2, 0];
_wind2 = [cos(270 - _windDirection * 30) * _windSpeed2, sin(270 - _windDirection * 30) * _windSpeed2, 0]; private _windDrift = 0;
_windDrift = 0;
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_bc = parseNumber(("ace_advanced_ballistics" callExtension format["atmosphericCorrection:%1:%2:%3:%4:%5", _bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel])); _bc = parseNumber(("ace_advanced_ballistics" callExtension format["atmosphericCorrection:%1:%2:%3:%4:%5", _bc, _temperature, _barometricPressure, _relativeHumidity, _atmosphereModel]));
}; };
private ["_eoetvoesMultiplier"]; private _eoetvoesMultiplier = 0;
_eoetvoesMultiplier = 0;
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_eoetvoesMultiplier = 2 * (0.0000729 * _muzzleVelocity / -9.80665) * cos(_latitude) * sin(_directionOfFire); _eoetvoesMultiplier = 2 * (0.0000729 * _muzzleVelocity / -9.80665) * cos(_latitude) * sin(_directionOfFire);
}; };

View File

@ -17,21 +17,19 @@
[] call FUNC(parse_input); [] call FUNC(parse_input);
private ["_scopeBaseAngle"]; private _scopeBaseAngle = (GVAR(workingMemory) select 3);
_scopeBaseAngle = (GVAR(workingMemory) select 3);
private ["_bulletMass", "_bulletDiameter", "_boreHeight", "_airFriction", "_barrelTwist", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel", "_twistDirection"]; private _bulletMass = GVAR(workingMemory) select 12;
_bulletMass = GVAR(workingMemory) select 12; private _bulletDiameter = GVAR(workingMemory) select 13;
_bulletDiameter = GVAR(workingMemory) select 13; private _boreHeight = GVAR(workingMemory) select 5;
_boreHeight = GVAR(workingMemory) select 5; private _airFriction = GVAR(workingMemory) select 4;
_airFriction = GVAR(workingMemory) select 4; private _barrelTwist = GVAR(workingMemory) select 14;
_barrelTwist = GVAR(workingMemory) select 14; private _muzzleVelocity = GVAR(workingMemory) select 1;
_muzzleVelocity = GVAR(workingMemory) select 1; private _bc = GVAR(workingMemory) select 15;
_bc = GVAR(workingMemory) select 15; private _dragModel = GVAR(workingMemory) select 16;
_dragModel = GVAR(workingMemory) select 16; private _atmosphereModel = GVAR(workingMemory) select 17;
_atmosphereModel = GVAR(workingMemory) select 17;
_twistDirection = 0; private _twistDirection = 0;
if (_barrelTwist > 0) then { if (_barrelTwist > 0) then {
_twistDirection = 1; _twistDirection = 1;
} else { } else {
@ -41,34 +39,31 @@ if (_barrelTwist > 0) then {
}; };
_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 = 0.5; _relativeHumidity = 0.5;
}; };
private ["_bulletLength", "_stabilityFactor"]; private _bulletLength = 50 * _bulletMass / ((_bulletDiameter/2)^2);
_bulletLength = 50 * _bulletMass / ((_bulletDiameter/2)^2); 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(targetRange) select GVAR(currentTarget);
_targetRange = GVAR(targetRange) select GVAR(currentTarget);
GVAR(targetSolutionInput) = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, round(_muzzleVelocity), GVAR(targetSolutionInput) = [_scopeBaseAngle, _bulletMass, _boreHeight, _airFriction, _muzzleVelocity, _temperature, _barometricPressure, _relativeHumidity, round(_muzzleVelocity),
[_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false, _stabilityFactor, _twistDirection, _latitude, _directionOfFire]; [_windSpeed1, _windSpeed2], _windDirection, _inclinationAngle, _targetSpeed, _targetRange, _bc, _dragModel, _atmosphereModel, false, _stabilityFactor, _twistDirection, _latitude, _directionOfFire];

View File

@ -15,12 +15,10 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_targetRange", "_numTicks", "_timeSecs", "_estSpeed"]; private _targetRange = parseNumber(ctrlText 8004);
private _numTicks = parseNumber(ctrlText 8005);
_targetRange = parseNumber(ctrlText 8004); private _timeSecs = parseNumber(ctrlText 8006);
_numTicks = parseNumber(ctrlText 8005); private _estSpeed = 0;
_timeSecs = parseNumber(ctrlText 8006);
_estSpeed = 0;
if (GVAR(currentUnit) == 1) then { if (GVAR(currentUnit) == 1) then {
_targetRange = _targetRange / 1.0936133; _targetRange = _targetRange / 1.0936133;

View File

@ -77,11 +77,10 @@ if (GVAR(currentUnit) != 2) then {
GVAR(barometricPressure) = 340 max GVAR(barometricPressure) min 1350; GVAR(barometricPressure) = 340 max GVAR(barometricPressure) min 1350;
}; };
private ["_windSpeed1", "_windSpeed2", "_targetSpeed", "_targetRange", "_inclinationAngleCosine", "_inclinationAngleDegree"]; private _windSpeed1 = parseNumber(ctrlText 140020);
_windSpeed1 = parseNumber(ctrlText 140020); private _windSpeed2 = parseNumber(ctrlText 140021);
_windSpeed2 = parseNumber(ctrlText 140021); private _targetSpeed = parseNumber(ctrlText 140050);
_targetSpeed = parseNumber(ctrlText 140050); private _targetRange = parseNumber(ctrlText 140060);
_targetRange = parseNumber(ctrlText 140060);
if (GVAR(currentUnit) != 2) then { if (GVAR(currentUnit) != 2) then {
_windSpeed1 = 0 max _windSpeed1 min 50; _windSpeed1 = 0 max _windSpeed1 min 50;
_windSpeed2 = 0 max _windSpeed2 min 50; _windSpeed2 = 0 max _windSpeed2 min 50;
@ -107,8 +106,8 @@ GVAR(windSpeed2) set [GVAR(currentTarget), _windSpeed2];
GVAR(windDirection) set [GVAR(currentTarget), 1 max Round(parseNumber(ctrlText 140030)) min 12]; GVAR(windDirection) set [GVAR(currentTarget), 1 max Round(parseNumber(ctrlText 140030)) min 12];
GVAR(targetSpeed) set [GVAR(currentTarget), _targetSpeed]; GVAR(targetSpeed) set [GVAR(currentTarget), _targetSpeed];
GVAR(targetRange) set [GVAR(currentTarget), _targetRange]; GVAR(targetRange) set [GVAR(currentTarget), _targetRange];
_inclinationAngleCosine = 0.5 max parseNumber(ctrlText 140041) min 1; private _inclinationAngleCosine = 0.5 max parseNumber(ctrlText 140041) min 1;
_inclinationAngleDegree = -60 max round(parseNumber(ctrlText 140040)) min 60; private _inclinationAngleDegree = -60 max round(parseNumber(ctrlText 140040)) min 60;
if (_inclinationAngleDegree != GVAR(inclinationAngle) select GVAR(currentTarget)) then { if (_inclinationAngleDegree != GVAR(inclinationAngle) select GVAR(currentTarget)) then {
GVAR(inclinationAngle) set [GVAR(currentTarget), _inclinationAngleDegree]; GVAR(inclinationAngle) set [GVAR(currentTarget), _inclinationAngleDegree];
} else { } else {
@ -122,19 +121,18 @@ if ((ctrlText 140051) == ">") then {
GVAR(targetSpeedDirection) set [GVAR(currentTarget), -1]; GVAR(targetSpeedDirection) set [GVAR(currentTarget), -1];
}; };
private ["_boreHeight", "_bulletMass", "_bulletDiameter", "_airFriction", "_rifleTwist", "_muzzleVelocity", "_zeroRange"]; private _boreHeight = parseNumber(ctrlText 120000);
_boreHeight = parseNumber(ctrlText 120000); private _bulletMass = parseNumber(ctrlText 120010);
_bulletMass = parseNumber(ctrlText 120010); private _bulletDiameter = parseNumber(ctrlText 120020);
_bulletDiameter = parseNumber(ctrlText 120020); private _airFriction = parseNumber(ctrlText 120030);
_airFriction = parseNumber(ctrlText 120030);
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_airFriction = 0.1 max _airFriction min 2; _airFriction = 0.1 max _airFriction min 2;
} else { } else {
_airFriction = _airFriction / -1000; _airFriction = _airFriction / -1000;
}; };
_rifleTwist = parseNumber(ctrlText 120040); private _rifleTwist = parseNumber(ctrlText 120040);
_muzzleVelocity = parseNumber(ctrlText 120050); private _muzzleVelocity = parseNumber(ctrlText 120050);
_zeroRange = parseNumber(ctrlText 120060); private _zeroRange = parseNumber(ctrlText 120060);
if (GVAR(currentUnit) != 2) then { if (GVAR(currentUnit) != 2) then {
_boreHeight = 0.1 max _boreHeight min 5; _boreHeight = 0.1 max _boreHeight min 5;
_bulletMass = 1 max _bulletMass min 1500; _bulletMass = 1 max _bulletMass min 1500;

View File

@ -33,19 +33,20 @@ private _lookupTableSize = count _lookupTable;
if (_lookupTableSize < 2) exitWith {}; if (_lookupTableSize < 2) exitWith {};
_lookupTable sort true; _lookupTable sort true;
private ["_lowerIndex", "_upperIndex"]; private _lowerIndex = -1;
private _upperIndex = -1;
for "_index" from 1 to (_lookupTableSize - 1) do { for "_index" from 1 to (_lookupTableSize - 1) do {
_upperIndex = _index; _upperIndex = _index;
_lowerIndex = _upperIndex - 1; _lowerIndex = _upperIndex - 1;
if (((_lookupTable select _index) select 0) >= (GVAR(targetRange) select GVAR(currentTarget))) exitWith {}; if (((_lookupTable select _index) select 0) >= (GVAR(targetRange) select GVAR(currentTarget))) exitWith {};
}; };
private ["_lowerDistance", "_upperDistance", "_lowerC1", "_upperC1", "_c1"]; private _lowerDistance = (_lookupTable select _lowerIndex) select 0;
_lowerDistance = (_lookupTable select _lowerIndex) select 0; private _upperDistance = (_lookupTable select _upperIndex) select 0;
_upperDistance = (_lookupTable select _upperIndex) select 0; private _lowerC1 = (_lookupTable select _lowerIndex) select 1;
_lowerC1 = (_lookupTable select _lowerIndex) select 1; private _upperC1 = (_lookupTable select _upperIndex) select 1;
_upperC1 = (_lookupTable select _upperIndex) select 1; private _c1 = _lowerC1;
_c1 = _lowerC1;
if (_lowerDistance != _upperDistance) then { if (_lowerDistance != _upperDistance) then {
private _slope = (_upperC1 - _lowerC1) / (_upperDistance - _lowerDistance); private _slope = (_upperC1 - _lowerC1) / (_upperDistance - _lowerDistance);
_c1 = _lowerC1 + ((GVAR(targetRange) select GVAR(currentTarget)) - _lowerDistance) * _slope; _c1 = _lowerC1 + ((GVAR(targetRange) select GVAR(currentTarget)) - _lowerDistance) * _slope;

View File

@ -33,19 +33,19 @@ private _lookupTableSize = count _lookupTable;
if (_lookupTableSize < 2) exitWith {}; if (_lookupTableSize < 2) exitWith {};
_lookupTable sort true; _lookupTable sort true;
private ["_lowerIndex", "_upperIndex"]; private _lowerIndex = -1;
private _upperIndex = -1;
for "_index" from 1 to (_lookupTableSize - 1) do { for "_index" from 1 to (_lookupTableSize - 1) do {
_upperIndex = _index; _upperIndex = _index;
_lowerIndex = _upperIndex - 1; _lowerIndex = _upperIndex - 1;
if (((_lookupTable select _index) select 0) >= GVAR(temperature)) exitWith {}; if (((_lookupTable select _index) select 0) >= GVAR(temperature)) exitWith {};
}; };
private ["_lowerTemperature", "_upperTemperature", "_lowerMuzzleVelocity", "_upperMuzzleVelocity", "_muzzleVelocity"]; private _lowerTemperature = (_lookupTable select _lowerIndex) select 0;
_lowerTemperature = (_lookupTable select _lowerIndex) select 0; private _upperTemperature = (_lookupTable select _upperIndex) select 0;
_upperTemperature = (_lookupTable select _upperIndex) select 0; private _lowerMuzzleVelocity = (_lookupTable select _lowerIndex) select 1;
_lowerMuzzleVelocity = (_lookupTable select _lowerIndex) select 1; private _upperMuzzleVelocity = (_lookupTable select _upperIndex) select 1;
_upperMuzzleVelocity = (_lookupTable select _upperIndex) select 1; private _muzzleVelocity = _lowerMuzzleVelocity;
_muzzleVelocity = _lowerMuzzleVelocity;
if (_lowerTemperature != _upperTemperature) then { if (_lowerTemperature != _upperTemperature) then {
private _slope = (_upperMuzzleVelocity - _lowerMuzzleVelocity) / (_upperTemperature - _lowerTemperature); private _slope = (_upperMuzzleVelocity - _lowerMuzzleVelocity) / (_upperTemperature - _lowerTemperature);
_muzzleVelocity = _lowerMuzzleVelocity + (GVAR(temperature) - _lowerTemperature) * _slope; _muzzleVelocity = _lowerMuzzleVelocity + (GVAR(temperature) - _lowerTemperature) * _slope;

View File

@ -15,8 +15,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_index"]; private _index = 0 max (lbCurSel 6000);
_index = 0 max (lbCurSel 6000);
GVAR(gunList) set [_index, +GVAR(workingMemory)]; GVAR(gunList) set [_index, +GVAR(workingMemory)];

View File

@ -21,8 +21,7 @@ if (ctrlVisible 8000) then {
if (_this == 1) then { if (_this == 1) then {
[] call FUNC(calculate_target_speed_assist); [] call FUNC(calculate_target_speed_assist);
private ["_targetSpeed"]; private _targetSpeed = parseNumber(ctrlText 8007);
_targetSpeed = parseNumber(ctrlText 8007);
if (_targetSpeed != 0) then { if (_targetSpeed != 0) then {
ctrlSetText [330, Str(_targetSpeed)]; ctrlSetText [330, Str(_targetSpeed)];
ctrlSetText [140050, Str(_targetSpeed)]; ctrlSetText [140050, Str(_targetSpeed)];

View File

@ -15,9 +15,8 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_inclinationAngleCosine", "_inclinationAngleDegree"]; private _inclinationAngleCosine = 0.5 max parseNumber(ctrlText 140041) min 1;
_inclinationAngleCosine = 0.5 max parseNumber(ctrlText 140041) min 1; private _inclinationAngleDegree = -60 max parseNumber(ctrlText 140040) min 60;
_inclinationAngleDegree = -60 max parseNumber(ctrlText 140040) min 60;
if (_this == 0) then { if (_this == 0) then {
ctrlSetText [140040, Str(round(acos(_inclinationAngleCosine)))]; ctrlSetText [140040, Str(round(acos(_inclinationAngleCosine)))];

View File

@ -15,8 +15,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_range", "_elevation", "_windage1", "_windage2", "_clickSize", "_clickNumber", "_clickInterval", "_lead", "_TOF", "_velocity", "_kineticEnergy", "_rangeOutput", "_elevationOutput", "_windageOutput", "_lastColumnOutput", "_speedOfSound"]; private _lastColumnOutput = "";
_lastColumnOutput = "";
if (GVAR(showWind2) && GVAR(rangeCardCurrentColumn) == 0) then { if (GVAR(showWind2) && GVAR(rangeCardCurrentColumn) == 0) then {
ctrlSetText [5006, "Wind2"]; ctrlSetText [5006, "Wind2"];
@ -32,17 +31,17 @@ if (GVAR(currentUnit) == 1) then {
lnbClear 5007; lnbClear 5007;
_speedOfSound = GVAR(temperature) call EFUNC(weather,calculateSpeedOfSound); private _speedOfSound = GVAR(temperature) call EFUNC(weather,calculateSpeedOfSound);
{ {
_range = _x select 0; private _range = _x select 0;
_elevation = _x select 1; private _elevation = _x select 1;
_windage1 = (_x select 2) select 0; private _windage1 = (_x select 2) select 0;
_windage2 = (_x select 2) select 1; private _windage2 = (_x select 2) select 1;
_lead = _x select 3; private _lead = _x select 3;
_TOF = _x select 4; private _TOF = _x select 4;
_velocity = _x select 5; private _velocity = _x select 5;
_kineticEnergy = _x select 6; private _kineticEnergy = _x select 6;
switch (GVAR(currentScopeUnit)) do { switch (GVAR(currentScopeUnit)) do {
case 0: { case 0: {
@ -56,13 +55,9 @@ _speedOfSound = GVAR(temperature) call EFUNC(weather,calculateSpeedOfSound);
_windage2 = _windage2 * 1.047; _windage2 = _windage2 * 1.047;
}; };
case 3: { case 3: {
switch (GVAR(workingMemory) select 7) do { private _clickSize = [1, 1 / 1.047, 3.38] select (GVAR(workingMemory) select 7);
case 0: { _clickSize = 1; }; private _clickNumber = GVAR(workingMemory) select 8;
case 1: { _clickSize = 1 / 1.047; }; private _clickInterval = _clickSize / _clickNumber;
case 2: { _clickSize = 3.38; };
};
_clickNumber = GVAR(workingMemory) select 8;
_clickInterval = _clickSize / _clickNumber;
_elevation = Round(_elevation / _clickInterval); _elevation = Round(_elevation / _clickInterval);
_windage1 = Round(_windage1 / _clickInterval); _windage1 = Round(_windage1 / _clickInterval);
@ -70,10 +65,10 @@ _speedOfSound = GVAR(temperature) call EFUNC(weather,calculateSpeedOfSound);
}; };
}; };
_elevationOutput = Str(Round(_elevation * 100) / 100); private _elevationOutput = Str(Round(_elevation * 100) / 100);
_windageOutput = Str(Round(_windage1 * 100) / 100); private _windageOutput = Str(Round(_windage1 * 100) / 100);
_rangeOutput = Str(_range); private _rangeOutput = Str(_range);
if (_velocity < _speedOfSound) then { if (_velocity < _speedOfSound) then {
_rangeOutput = _rangeOutput + "*"; _rangeOutput = _rangeOutput + "*";
}; };

View File

@ -15,15 +15,14 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_elevationAbs", "_elevationRel", "_elevationCur", "_windageAbs", "_windageRel", "_windageCur", "_wind2", "_lead", "_clickSize", "_clickNumber", "_clickInterval"]; private _elevationAbs = GVAR(elevationOutput) select GVAR(currentTarget);
_elevationAbs = GVAR(elevationOutput) select GVAR(currentTarget); private _elevationRel = 0;
_elevationRel = 0; private _elevationCur = 0;
_elevationCur = 0; private _windageAbs = GVAR(windage1Output) select GVAR(currentTarget);
_windageAbs = GVAR(windage1Output) select GVAR(currentTarget); private _windageRel = 0;
_windageRel = 0; private _windageCur = 0;
_windageCur = 0;
_wind2 = GVAR(windage2Output) select GVAR(currentTarget); private _wind2 = GVAR(windage2Output) select GVAR(currentTarget);
if (GVAR(showCoriolis)) then { if (GVAR(showCoriolis)) then {
_elevationRel = GVAR(verticalCoriolisOutput) select GVAR(currentTarget); _elevationRel = GVAR(verticalCoriolisOutput) select GVAR(currentTarget);
@ -38,7 +37,7 @@ if (GVAR(showCoriolis)) then {
_windageRel = _windageAbs - _windageCur; _windageRel = _windageAbs - _windageCur;
}; };
_lead = GVAR(leadOutput) select GVAR(currentTarget); private _lead = GVAR(leadOutput) select GVAR(currentTarget);
switch (GVAR(currentScopeUnit)) do { switch (GVAR(currentScopeUnit)) do {
case 0: { case 0: {
@ -66,13 +65,9 @@ switch (GVAR(currentScopeUnit)) do {
_windageCur = _windageCur * 1.047; _windageCur = _windageCur * 1.047;
}; };
case 3: { case 3: {
switch (GVAR(workingMemory) select 7) do { private _clickSize = [1, 1 / 1.047, 3.38] select (GVAR(workingMemory) select 7);
case 0: { _clickSize = 1; }; private _clickNumber = GVAR(workingMemory) select 8;
case 1: { _clickSize = 1 / 1.047; }; private _clickInterval = _clickSize / _clickNumber;
case 2: { _clickSize = 3.38; };
};
_clickNumber = GVAR(workingMemory) select 8;
_clickInterval = _clickSize / _clickNumber;
_elevationAbs = Round(_elevationAbs / _clickInterval); _elevationAbs = Round(_elevationAbs / _clickInterval);
_windageAbs = Round(_windageAbs / _clickInterval); _windageAbs = Round(_windageAbs / _clickInterval);

View File

@ -17,23 +17,19 @@
[] call FUNC(parse_input); [] call FUNC(parse_input);
private ["_bulletMass", "_boreHeight", "_airFriction", "_muzzleVelocity", "_bc", "_dragModel", "_atmosphereModel"]; private _bulletMass = GVAR(workingMemory) select 12;
_bulletMass = GVAR(workingMemory) select 12; private _boreHeight = GVAR(workingMemory) select 5;
_boreHeight = GVAR(workingMemory) select 5; private _airFriction = GVAR(workingMemory) select 4;
_airFriction = GVAR(workingMemory) select 4; private _muzzleVelocity = GVAR(workingMemory) select 1;
_muzzleVelocity = GVAR(workingMemory) select 1; private _bc = GVAR(workingMemory) select 15;
_bc = GVAR(workingMemory) select 15; private _dragModel = GVAR(workingMemory) select 16;
_dragModel = GVAR(workingMemory) select 16; private _atmosphereModel = GVAR(workingMemory) select 17;
_atmosphereModel = GVAR(workingMemory) select 17; private _zeroRange = GVAR(workingMemory) select 2;
private _altitude = GVAR(altitude);
private _temperature = GVAR(temperature);
private _barometricPressure = GVAR(barometricPressure);
private _relativeHumidity = GVAR(relativeHumidity);
private ["_zeroRange"];
_zeroRange = GVAR(workingMemory) select 2;
private ["_altitude", "_temperature", "_barometricPressure", "_relativeHumidity"];
_altitude = GVAR(altitude);
_temperature = GVAR(temperature);
_barometricPressure = GVAR(barometricPressure);
_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 = 0.5; _relativeHumidity = 0.5;

View File

@ -15,11 +15,10 @@
//Add deviceKey entry: //Add deviceKey entry:
private ["_conditonCode", "_toggleCode", "_closeCode"]; private _conditonCode = {
_conditonCode = {
[] call FUNC(can_show); [] call FUNC(can_show);
}; };
_toggleCode = { private _toggleCode = {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {}; if !([ACE_player, objNull, ["notOnMap", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {};
if (GVAR(active)) exitWith { if (GVAR(active)) exitWith {
@ -28,7 +27,7 @@ _toggleCode = {
// Statement // Statement
[] call FUNC(create_dialog); [] call FUNC(create_dialog);
}; };
_closeCode = { private _closeCode = {
if (GVAR(active)) exitWith { if (GVAR(active)) exitWith {
closeDialog 0; closeDialog 0;
}; };

View File

@ -21,29 +21,27 @@ params ["_attachToVehicle","_unit","_args", ["_silentScripted", false]];
_args params [["_itemClassname","", [""]]]; _args params [["_itemClassname","", [""]]];
TRACE_4("params",_attachToVehicle,_unit,_itemClassname,_silentScripted); TRACE_4("params",_attachToVehicle,_unit,_itemClassname,_silentScripted);
private ["_itemVehClass", "_onAtachText", "_selfAttachPosition", "_attachedItem", "_tempObject", "_actionID", "_model"];
//Sanity Check (_unit has item in inventory, not over attach limit) //Sanity Check (_unit has item in inventory, not over attach limit)
if ((_itemClassname == "") || {(!_silentScripted) && {!(_this call FUNC(canAttach))}}) exitWith {ERROR("Tried to attach, but check failed");}; if ((_itemClassname == "") || {(!_silentScripted) && {!(_this call FUNC(canAttach))}}) exitWith {ERROR("Tried to attach, but check failed");};
_itemVehClass = getText (configFile >> "CfgWeapons" >> _itemClassname >> "ACE_Attachable"); private _itemVehClass = getText (configFile >> "CfgWeapons" >> _itemClassname >> "ACE_Attachable");
_onAtachText = getText (configFile >> "CfgWeapons" >> _itemClassname >> "displayName"); private _onAttachText = getText (configFile >> "CfgWeapons" >> _itemClassname >> "displayName");
if (_itemVehClass == "") then { if (_itemVehClass == "") then {
_itemVehClass = getText (configFile >> "CfgMagazines" >> _itemClassname >> "ACE_Attachable"); _itemVehClass = getText (configFile >> "CfgMagazines" >> _itemClassname >> "ACE_Attachable");
_onAtachText = getText (configFile >> "CfgMagazines" >> _itemClassname >> "displayName"); _onAttachText = getText (configFile >> "CfgMagazines" >> _itemClassname >> "displayName");
}; };
if (_itemVehClass == "") exitWith {ERROR("no ACE_Attachable for Item");}; if (_itemVehClass == "") exitWith {ERROR("no ACE_Attachable for Item");};
_onAtachText = format [localize LSTRING(Item_Attached), _onAtachText]; private _onAttachText = format [localize LSTRING(Item_Attached), _onAttachText];
if (_unit == _attachToVehicle) then { //Self Attachment if (_unit == _attachToVehicle) then { //Self Attachment
_attachedItem = _itemVehClass createVehicle [0,0,0]; private _attachedItem = _itemVehClass createVehicle [0,0,0];
_attachedItem attachTo [_unit, [0.05, -0.09, 0.1], "leftshoulder"]; _attachedItem attachTo [_unit, [0.05, -0.09, 0.1], "leftshoulder"];
if (!_silentScripted) then { if (!_silentScripted) then {
_unit removeItem _itemClassname; // Remove item _unit removeItem _itemClassname; // Remove item
[_onAtachText] call EFUNC(common,displayTextStructured); [_onAttachText] call EFUNC(common,displayTextStructured);
}; };
_unit setVariable [QGVAR(attached), [[_attachedItem, _itemClassname]], true]; _unit setVariable [QGVAR(attached), [[_attachedItem, _itemClassname]], true];
} else { } else {
@ -54,10 +52,10 @@ if (_unit == _attachToVehicle) then { //Self Attachment
[{[localize LSTRING(PlaceAction), ""] call EFUNC(interaction,showMouseHint)}, []] call CBA_fnc_execNextFrame; [{[localize LSTRING(PlaceAction), ""] call EFUNC(interaction,showMouseHint)}, []] call CBA_fnc_execNextFrame;
_unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)]; _unit setVariable [QGVAR(placeActionEH), [_unit, "DefaultAction", {true}, {GVAR(placeAction) = PLACE_APPROVE;}] call EFUNC(common,AddActionEventHandler)];
_actionID = _unit addAction [format ["<t color='#FF0000'>%1</t>", localize LSTRING(CancelAction)], {GVAR(placeAction) = PLACE_CANCEL}]; private _actionID = _unit addAction [format ["<t color='#FF0000'>%1</t>", localize LSTRING(CancelAction)], {GVAR(placeAction) = PLACE_CANCEL}];
//Display to show virtual object: //Display to show virtual object:
_model = getText (configFile >> "CfgAmmo" >> _itemVehClass >> "model"); private _model = getText (configFile >> "CfgAmmo" >> _itemVehClass >> "model");
if (_model == "") then { if (_model == "") then {
_model = getText (configFile >> "CfgVehicles" >> _itemVehClass >> "model"); _model = getText (configFile >> "CfgVehicles" >> _itemVehClass >> "model");
}; };
@ -67,16 +65,15 @@ if (_unit == _attachToVehicle) then { //Self Attachment
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _model; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _model;
[{ [{
private ["_angle", "_dir", "_screenPos", "_realDistance", "_up", "_virtualPos", "_virtualPosASL", "_lineInterection"];
params ["_args","_idPFH"]; params ["_args","_idPFH"];
_args params ["_unit","_attachToVehicle","_itemClassname","_itemVehClass","_onAtachText","_actionID"]; _args params ["_unit","_attachToVehicle","_itemClassname","_itemVehClass","_onAttachText","_actionID"];
_virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]); private _virtualPosASL = (eyePos _unit) vectorAdd (positionCameraToWorld [0,0,0.6]) vectorDiff (positionCameraToWorld [0,0,0]);
if (cameraView == "EXTERNAL") then { if (cameraView == "EXTERNAL") then {
_virtualPosASL = _virtualPosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0])); _virtualPosASL = _virtualPosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0]));
}; };
_virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition); private _virtualPos = _virtualPosASL call EFUNC(common,ASLToPosition);
_lineInterection = lineIntersects [eyePos ACE_player, _virtualPosASL, ACE_player]; private _lineInterection = lineIntersects [eyePos ACE_player, _virtualPosASL, ACE_player];
//Don't allow placing in a bad position: //Don't allow placing in a bad position:
if (_lineInterection && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;}; if (_lineInterection && {GVAR(placeAction) == PLACE_APPROVE}) then {GVAR(placeAction) = PLACE_WAITING;};
@ -95,7 +92,7 @@ if (_unit == _attachToVehicle) then { //Self Attachment
(QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; (QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
if (GVAR(placeAction) == PLACE_APPROVE) then { if (GVAR(placeAction) == PLACE_APPROVE) then {
[_unit, _attachToVehicle, _itemClassname, _itemVehClass, _onAtachText, _virtualPos] call FUNC(placeApprove); [_unit, _attachToVehicle, _itemClassname, _itemVehClass, _onAttachText, _virtualPos] call FUNC(placeApprove);
}; };
} else { } else {
//Show the virtual object: //Show the virtual object:
@ -103,18 +100,18 @@ if (_unit == _attachToVehicle) then { //Self Attachment
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false;
} else { } else {
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow true; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow true;
_screenPos = worldToScreen _virtualPos; private _screenPos = worldToScreen _virtualPos;
if (_screenPos isEqualTo []) exitWith { if (_screenPos isEqualTo []) exitWith {
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false;
}; };
_realDistance = (_virtualPos distance (positionCameraToWorld [0,0,0])) / ((call CBA_fnc_getFov) select 1); private _realDistance = (_virtualPos distance (positionCameraToWorld [0,0,0])) / ((call CBA_fnc_getFov) select 1);
_screenPos = [(_screenPos select 0), _realDistance, (_screenPos select 1)]; _screenPos = [(_screenPos select 0), _realDistance, (_screenPos select 1)];
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetPosition _screenPos; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetPosition _screenPos;
_dir = (positionCameraToWorld [0,0,1]) vectorFromTo (positionCameraToWorld [0,0,0]); private _dir = (positionCameraToWorld [0,0,1]) vectorFromTo (positionCameraToWorld [0,0,0]);
_angle = asin (_dir select 2); private _angle = asin (_dir select 2);
_up = [0, cos _angle, sin _angle]; private _up = [0, cos _angle, sin _angle];
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModelDirAndUp [[1,0,0], _up]; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModelDirAndUp [[1,0,0], _up];
}; };
}; };
}, 0, [_unit, _attachToVehicle, _itemClassname, _itemVehClass, _onAtachText, _actionID]] call CBA_fnc_addPerFrameHandler; }, 0, [_unit, _attachToVehicle, _itemClassname, _itemVehClass, _onAttachText, _actionID]] call CBA_fnc_addPerFrameHandler;
}; };

View File

@ -21,10 +21,8 @@ params ["_attachToVehicle","_player","_args"];
_args params [["_itemClassname","", [""]]]; _args params [["_itemClassname","", [""]]];
TRACE_3("params",_attachToVehicle,_player,_itemClassname); TRACE_3("params",_attachToVehicle,_player,_itemClassname);
private ["_attachLimit", "_attachedObjects"]; private _attachLimit = [6, 1] select (_player == _attachToVehicle);
private _attachedObjects = _attachToVehicle getVariable [QGVAR(attached), []];
_attachLimit = [6, 1] select (_player == _attachToVehicle);
_attachedObjects = _attachToVehicle getVariable [QGVAR(attached), []];
((_player == _attachToVehicle) || {canStand _player}) && ((_player == _attachToVehicle) || {canStand _player}) &&
{(_attachToVehicle distance _player) < 10} && {(_attachToVehicle distance _player) < 10} &&

View File

@ -24,9 +24,7 @@ if ((vehicle _unit) != _unit) exitWith {false};
private _attachedList = _attachToVehicle getVariable [QGVAR(attached), []]; private _attachedList = _attachToVehicle getVariable [QGVAR(attached), []];
if ((count _attachedList) == 0) exitWith {false}; if ((count _attachedList) == 0) exitWith {false};
private ["_inRange"]; private _inRange = false;
_inRange = false;
{ {
_x params ["_xObject"]; _x params ["_xObject"];
if (isNull _xObject) exitWith { if (isNull _xObject) exitWith {

View File

@ -19,16 +19,14 @@
params ["_attachToVehicle","_unit"], params ["_attachToVehicle","_unit"],
TRACE_2("params",_attachToVehicle,_unit); TRACE_2("params",_attachToVehicle,_unit);
private ["_attachedList", "_itemDisplayName", "_attachedObject", "_attachedIndex", "_itemName", "_minDistance", "_isChemlight"]; private _attachedList = _attachToVehicle getVariable [QGVAR(attached), []];
_attachedList = _attachToVehicle getVariable [QGVAR(attached), []]; private _attachedObject = objNull;
private _attachedIndex = -1;
_attachedObject = objNull; private _itemName = "";
_attachedIndex = -1;
_itemName = "";
//Find closest attached object //Find closest attached object
_minDistance = 1000; private _minDistance = 1000;
{ {
_x params ["_xObject", "_xItemName"]; _x params ["_xObject", "_xItemName"];
@ -45,7 +43,7 @@ _minDistance = 1000;
if (isNull _attachedObject || {_itemName == ""}) exitWith {ERROR("Could not find attached object")}; if (isNull _attachedObject || {_itemName == ""}) exitWith {ERROR("Could not find attached object")};
// Check if item is a chemlight // Check if item is a chemlight
_isChemlight = _attachedObject isKindOf "Chemlight_base"; private _isChemlight = _attachedObject isKindOf "Chemlight_base";
// Exit if can't add the item // Exit if can't add the item
if (!(_unit canAdd _itemName) && {!_isChemlight}) exitWith { if (!(_unit canAdd _itemName) && {!_isChemlight}) exitWith {
@ -80,7 +78,7 @@ _attachedList deleteAt _attachedIndex;
_attachToVehicle setVariable [QGVAR(attached), _attachedList, true]; _attachToVehicle setVariable [QGVAR(attached), _attachedList, true];
// Display message // Display message
_itemDisplayName = getText (configFile >> "CfgWeapons" >> _itemName >> "displayName"); private _itemDisplayName = getText (configFile >> "CfgWeapons" >> _itemName >> "displayName");
if (_itemDisplayName == "") then { if (_itemDisplayName == "") then {
_itemDisplayName = getText (configFile >> "CfgMagazines" >> _itemName >> "displayName"); _itemDisplayName = getText (configFile >> "CfgMagazines" >> _itemName >> "displayName");
}; };

View File

@ -17,21 +17,20 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_listed", "_actions", "_item", "_displayName", "_picture", "_action"];
params ["_target","_player"]; params ["_target","_player"];
TRACE_2("params",_target,_player); TRACE_2("params",_target,_player);
_listed = []; private _listed = [];
_actions = []; private _actions = [];
{ {
if !(_x in _listed) then { if !(_x in _listed) then {
_listed pushBack _x; _listed pushBack _x;
_item = ConfigFile >> "CfgMagazines" >> _x; private _item = ConfigFile >> "CfgMagazines" >> _x;
if (getText (_item >> "ACE_Attachable") != "") then { if (getText (_item >> "ACE_Attachable") != "") then {
_displayName = getText(_item >> "displayName"); private _displayName = getText(_item >> "displayName");
_picture = getText(_item >> "picture"); private _picture = getText(_item >> "picture");
_action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call CBA_fnc_execNextFrame}, {true}, {}, [_x]] call EFUNC(interact_menu,createAction); private _action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call CBA_fnc_execNextFrame}, {true}, {}, [_x]] call EFUNC(interact_menu,createAction);
_actions pushBack [_action, [], _target]; _actions pushBack [_action, [], _target];
}; };
}; };
@ -40,11 +39,11 @@ _actions = [];
{ {
if !(_x in _listed) then { if !(_x in _listed) then {
_listed pushBack _x; _listed pushBack _x;
_item = ConfigFile >> "CfgWeapons" >> _x; private _item = ConfigFile >> "CfgWeapons" >> _x;
if (getText (_item >> "ACE_Attachable") != "") then { if (getText (_item >> "ACE_Attachable") != "") then {
_displayName = getText(_item >> "displayName"); private _displayName = getText(_item >> "displayName");
_picture = getText(_item >> "picture"); private _picture = getText(_item >> "picture");
_action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call CBA_fnc_execNextFrame}, {true}, {}, [_x]] call EFUNC(interact_menu,createAction); private _action = [_x, _displayName, _picture, {[{_this call FUNC(attach)}, _this] call CBA_fnc_execNextFrame}, {true}, {}, [_x]] call EFUNC(interact_menu,createAction);
_actions pushBack [_action, [], _target]; _actions pushBack [_action, [], _target];
}; };
}; };

View File

@ -25,34 +25,32 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_startingOffset", "_startDistanceFromCenter", "_closeInUnitVector", "_closeInMax", "_closeInMin", "_closeInDistance", "_endPosTestOffset", "_endPosTest", "_doesIntersect", "_startingPosShifted", "_startASL", "_endPosShifted", "_endASL", "_attachedObject", "_attachList"]; params ["_unit", "_attachToVehicle", "_itemClassname", "_itemVehClass", "_onAttachText", "_startingPosition"];
TRACE_6("params",_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAttachText,_startingPosition);
params ["_unit", "_attachToVehicle", "_itemClassname", "_itemVehClass", "_onAtachText", "_startingPosition"]; private _startingOffset = _attachToVehicle worldToModel _startingPosition;
TRACE_6("params",_unit,_attachToVehicle,_itemClassname,_itemVehClass,_onAtachText,_startingPosition);
_startingOffset = _attachToVehicle worldToModel _startingPosition; private _startDistanceFromCenter = vectorMagnitude _startingOffset;
private _closeInUnitVector = vectorNormalized (_startingOffset vectorFromTo [0,0,0]);
_startDistanceFromCenter = vectorMagnitude _startingOffset; private _closeInMax = _startDistanceFromCenter;
_closeInUnitVector = vectorNormalized (_startingOffset vectorFromTo [0,0,0]); private _closeInMin = 0;
_closeInMax = _startDistanceFromCenter;
_closeInMin = 0;
while {(_closeInMax - _closeInMin) > 0.01} do { while {(_closeInMax - _closeInMin) > 0.01} do {
_closeInDistance = (_closeInMax + _closeInMin) / 2; private _closeInDistance = (_closeInMax + _closeInMin) / 2;
// systemChat format ["Trying %1 from %2 start %3", _closeInDistance, [_closeInMax, _closeInMin], _startDistanceFromCenter]; // systemChat format ["Trying %1 from %2 start %3", _closeInDistance, [_closeInMax, _closeInMin], _startDistanceFromCenter];
_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); private _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance);
_endPosTestOffset set [2, (_startingOffset select 2)]; _endPosTestOffset set [2, (_startingOffset select 2)];
_endPosTest = _attachToVehicle modelToWorldVisual _endPosTestOffset; private _endPosTest = _attachToVehicle modelToWorldVisual _endPosTestOffset;
_doesIntersect = false; private _doesIntersect = false;
{ {
if (_doesIntersect) exitWith {}; if (_doesIntersect) exitWith {};
_startingPosShifted = _startingPosition vectorAdd _x; private _startingPosShifted = _startingPosition vectorAdd _x;
_startASL = if (surfaceIsWater _startingPosShifted) then {_startingPosShifted} else {ATLtoASL _startingPosShifted}; private _startASL = if (surfaceIsWater _startingPosShifted) then {_startingPosShifted} else {ATLtoASL _startingPosShifted};
{ {
_endPosShifted = _endPosTest vectorAdd _x; private _endPosShifted = _endPosTest vectorAdd _x;
_endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted}; private _endASL = if (surfaceIsWater _startingPosShifted) then {_endPosShifted} else {ATLtoASL _endPosShifted};
#ifdef DRAW_ATTACH_SCAN #ifdef DRAW_ATTACH_SCAN
[{ [{
@ -78,7 +76,7 @@ while {(_closeInMax - _closeInMin) > 0.01} do {
}; };
}; };
_closeInDistance = (_closeInMax + _closeInMin) / 2; private _closeInDistance = (_closeInMax + _closeInMin) / 2;
//Checks (too close to center or can't attach) //Checks (too close to center or can't attach)
if (((_startDistanceFromCenter - _closeInDistance) < 0.1) || {!([_attachToVehicle, _unit, _itemClassname] call FUNC(canAttach))}) exitWith { if (((_startDistanceFromCenter - _closeInDistance) < 0.1) || {!([_attachToVehicle, _unit, _itemClassname] call FUNC(canAttach))}) exitWith {
@ -90,17 +88,17 @@ if (((_startDistanceFromCenter - _closeInDistance) < 0.1) || {!([_attachToVehicl
_closeInDistance = (_closeInDistance - 0.0085); _closeInDistance = (_closeInDistance - 0.0085);
//Create New 'real' Object //Create New 'real' Object
_endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance); private _endPosTestOffset = _startingOffset vectorAdd (_closeInUnitVector vectorMultiply _closeInDistance);
_endPosTestOffset set [2, (_startingOffset select 2)]; _endPosTestOffset set [2, (_startingOffset select 2)];
_attachedObject = _itemVehClass createVehicle (getPos _unit); private _attachedObject = _itemVehClass createVehicle (getPos _unit);
_attachedObject attachTo [_attachToVehicle, _endPosTestOffset]; _attachedObject attachTo [_attachToVehicle, _endPosTestOffset];
//Remove Item from inventory //Remove Item from inventory
_unit removeItem _itemClassname; _unit removeItem _itemClassname;
//Add Object to attached array //Add Object to attached array
_attachList = _attachToVehicle getVariable [QGVAR(attached), []]; private _attachList = _attachToVehicle getVariable [QGVAR(attached), []];
_attachList pushBack [_attachedObject, _itemClassname]; _attachList pushBack [_attachedObject, _itemClassname];
_attachToVehicle setVariable [QGVAR(attached), _attachList, true]; _attachToVehicle setVariable [QGVAR(attached), _attachList, true];
[_onAtachText] call EFUNC(common,displayTextStructured); [_onAttachText] call EFUNC(common,displayTextStructured);

View File

@ -23,7 +23,8 @@ params ["_unit", "_classname", ["_container", ""], ["_ammoCount", -1]];
private _type = _classname call FUNC(getItemType); private _type = _classname call FUNC(getItemType);
private ["_canAdd", "_addedToUnit"]; private _canAdd = false;
private _addedToUnit = false;
switch (_container) do { switch (_container) do {
case "vest": { case "vest": {

View File

@ -1,9 +1,7 @@
// by commy2 // by commy2
#include "script_component.hpp" #include "script_component.hpp"
private ["_client", "_clientVersion", "_count", "_error", "_files", "_index", "_missingAddon", "_missingAddonServer", "_missingAddons", "_missingAddonsServer", "_oldVersionClient", "_oldVersionServer", "_oldVersionsClient", "_oldVersionsServer", "_serverFiles", "_serverVersion", "_serverVersions", "_string", "_version", "_versions"]; private _files = [];
_files = [];
{ {
if (_x find "a3_" != 0 && {_x find "ace_" != 0} && {!(toLower _x in (missionNamespace getVariable ["ACE_Version_Whitelist", []]))}) then { if (_x find "a3_" != 0 && {_x find "ace_" != 0} && {!(toLower _x in (missionNamespace getVariable ["ACE_Version_Whitelist", []]))}) then {
@ -11,9 +9,9 @@ _files = [];
}; };
} forEach activatedAddons; } forEach activatedAddons;
_versions = []; private _versions = [];
{ {
_version = parseNumber getText (configFile >> "CfgPatches" >> _x >> "version"); private _version = parseNumber getText (configFile >> "CfgPatches" >> _x >> "version");
_versions set [_forEachIndex, _version]; _versions set [_forEachIndex, _version];
} forEach _files; } forEach _files;
@ -32,27 +30,27 @@ if (!isServer) then {
!isNil "ACE_Version_ClientVersions" && {!isNil "ACE_Version_ServerVersions"} !isNil "ACE_Version_ClientVersions" && {!isNil "ACE_Version_ServerVersions"}
}; };
_client = profileName; private _client = profileName;
_files = ACE_Version_ClientVersions select 0; _files = ACE_Version_ClientVersions select 0;
_versions = ACE_Version_ClientVersions select 1; _versions = ACE_Version_ClientVersions select 1;
_serverFiles = ACE_Version_ServerVersions select 0; private _serverFiles = ACE_Version_ServerVersions select 0;
_serverVersions = ACE_Version_ServerVersions select 1; private _serverVersions = ACE_Version_ServerVersions select 1;
// Compare client and server files and versions // Compare client and server files and versions
_missingAddons = []; private _missingAddons = [];
_oldVersionsClient = []; private _oldVersionsClient = [];
_oldVersionsServer = []; private _oldVersionsServer = [];
{ {
_serverVersion = _serverVersions select _forEachIndex; private _serverVersion = _serverVersions select _forEachIndex;
_index = _files find _x; private _index = _files find _x;
if (_index == -1) then { if (_index == -1) then {
if (_x != "ace_server") then {_missingAddons pushBack _x;}; if (_x != "ace_server") then {_missingAddons pushBack _x;};
} else { } else {
_clientVersion = _versions select _index; private _clientVersion = _versions select _index;
if (_clientVersion < _serverVersion) then { if (_clientVersion < _serverVersion) then {
_oldVersionsClient pushBack [_x, _clientVersion, _serverVersion]; _oldVersionsClient pushBack [_x, _clientVersion, _serverVersion];
@ -65,9 +63,9 @@ if (!isServer) then {
} forEach _serverFiles; } forEach _serverFiles;
// find client files which the server doesn't have // find client files which the server doesn't have
_missingAddonsServer = []; private _missingAddonsServer = [];
{ {
_index = _serverFiles find _x; private _index = _serverFiles find _x;
if (_index == -1) then { if (_index == -1) then {
_missingAddonsServer pushBack _x; _missingAddonsServer pushBack _x;
} }
@ -75,10 +73,10 @@ if (!isServer) then {
// display and log error messages // display and log error messages
private _fnc_cutComma = { private _fnc_cutComma = {
_string = _this; private _string = _this;
_string = toArray _string; _string = toArray _string;
_count = count _string; private _count = count _string;
_string set [_count - 2, toArray "." select 0]; _string set [_count - 2, toArray "." select 0];
_string set [_count - 1, -1]; _string set [_count - 1, -1];
_string = _string - [-1]; _string = _string - [-1];
@ -86,11 +84,11 @@ if (!isServer) then {
toString _string; toString _string;
}; };
_missingAddon = false; private _missingAddon = false;
if (count _missingAddons > 0) then { if (count _missingAddons > 0) then {
_missingAddon = true; _missingAddon = true;
_error = format ["[ACE] %1: ERROR missing addon(s): ", _client]; private _error = format ["[ACE] %1: ERROR missing addon(s): ", _client];
{ {
_error = _error + format ["%1, ", _x]; _error = _error + format ["%1, ", _x];
@ -103,11 +101,11 @@ if (!isServer) then {
[QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent; [QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent;
}; };
_missingAddonServer = false; private _missingAddonServer = false;
if (count _missingAddonsServer > 0) then { if (count _missingAddonsServer > 0) then {
_missingAddonServer = true; _missingAddonServer = true;
_error = format ["[ACE] %1: ERROR missing server addon(s): ", _client]; private _error = format ["[ACE] %1: ERROR missing server addon(s): ", _client];
{ {
_error = _error + format ["%1, ", _x]; _error = _error + format ["%1, ", _x];
@ -120,11 +118,11 @@ if (!isServer) then {
[QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent; [QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent;
}; };
_oldVersionClient = false; private _oldVersionClient = false;
if (count _oldVersionsClient > 0) then { if (count _oldVersionsClient > 0) then {
_oldVersionClient = true; _oldVersionClient = true;
_error = format ["[ACE] %1: ERROR outdated addon(s): ", _client]; private _error = format ["[ACE] %1: ERROR outdated addon(s): ", _client];
{ {
_error = _error + format ["%1 (client: %2, server: %3), ", _x select 0, _x select 1, _x select 2]; _error = _error + format ["%1 (client: %2, server: %3), ", _x select 0, _x select 1, _x select 2];
@ -137,11 +135,11 @@ if (!isServer) then {
[QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent; [QGVAR(systemChatGlobal), _error] call CBA_fnc_globalEvent;
}; };
_oldVersionServer = false; private _oldVersionServer = false;
if (count _oldVersionsServer > 0) then { if (count _oldVersionsServer > 0) then {
_oldVersionServer = true; _oldVersionServer = true;
_error = format ["[ACE] %1: ERROR outdated server addon(s): ", _client]; private _error = format ["[ACE] %1: ERROR outdated server addon(s): ", _client];
{ {
_error = _error + format ["%1 (client: %2, server: %3), ", _x select 0, _x select 1, _x select 2]; _error = _error + format ["%1 (client: %2, server: %3), ", _x select 0, _x select 1, _x select 2];

View File

@ -27,12 +27,11 @@ params ["_wire"];
_args params ["_wire"]; _args params ["_wire"];
if (_wire animationPhase "wire_2" == 1) then { if (_wire animationPhase "wire_2" == 1) then {
private ["_dir", "_pos", "_wirecoil"];
_dir = getDir _wire; private _dir = getDir _wire;
_pos = getPosASL _wire; private _pos = getPosASL _wire;
_wirecoil = "ACE_ConcertinaWireCoil" createvehicle [0, 0, 0]; private _wirecoil = "ACE_ConcertinaWireCoil" createvehicle [0, 0, 0];
deleteVehicle _wire; deleteVehicle _wire;

View File

@ -17,10 +17,8 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_wire", "_vehicle"]; params ["_wire", "_vehicle"];
private ["_type", "_mode", "_anim", "_parts", "_selectionPart", "_selection", "_pos_w", "_dir_w"]; private _type = typeOf _wire;
private _mode = switch (_type) do {
_type = typeOf _wire;
_mode = switch (_type) do {
case "ACE_ConcertinaWire": { 0 }; case "ACE_ConcertinaWire": { 0 };
case "Land_Razorwire_F": { 1 }; case "Land_Razorwire_F": { 1 };
default { -1 }; default { -1 };
@ -38,16 +36,16 @@ if (_mode == -1) exitWith {};
//9.78744 (10) //9.78744 (10)
_type = typeOf _wire; _type = typeOf _wire;
_anim = _wire animationPhase "wire_2"; private _anim = _wire animationPhase "wire_2";
_pos_w = getPos _wire; private _pos_w = getPos _wire;
_dir_w = getDir _wire; private _dir_w = getDir _wire;
if (_mode == 0) then { if (_mode == 0) then {
private ["_x", "_y", "_found", "_wireCheckPosAr", "_no"]; private _found = false;
_pos_w params ["_x","_y"]; _pos_w params ["_x","_y"];
// Check if two Single coils are placed next to each other (i.e playes have built a big wire obstacle) // Check if two Single coils are placed next to each other (i.e playes have built a big wire obstacle)
_wireCheckPosAr = [ private _wireCheckPosAr = [
[_x + (sin (_dir_w + 90) * 1.5),_y + (cos (_dir_w + 90) * 1.5)], [_x + (sin (_dir_w + 90) * 1.5),_y + (cos (_dir_w + 90) * 1.5)],
[(_x-(sin _dir_w)) + (sin (_dir_w + 90) * 1.5),(_y-(cos _dir_w)) + (cos (_dir_w + 90) * 1.5)], [(_x-(sin _dir_w)) + (sin (_dir_w + 90) * 1.5),(_y-(cos _dir_w)) + (cos (_dir_w + 90) * 1.5)],
[_x + (sin (_dir_w - 90) * 1.5),_y + (cos (_dir_w - 90) * 1.5)], [_x + (sin (_dir_w - 90) * 1.5),_y + (cos (_dir_w - 90) * 1.5)],
@ -55,7 +53,7 @@ if (_mode == 0) then {
]; ];
{ {
_found = false; _found = false;
_no = nearestObjects [_x, [typeOf _wire], 3]; //diag_log _no; diag_log "....."; private _no = nearestObjects [_x, [typeOf _wire], 3]; //diag_log _no; diag_log ".....";
_no = _no - [_wire]; //diag_log _no; _no = _no - [_wire]; //diag_log _no;
if (count _no > 0) exitWith { if (count _no > 0) exitWith {
_found = true; //diag_log "found"; _found = true; //diag_log "found";
@ -76,6 +74,8 @@ if (_mode == 0) then {
}; };
}; };
private _parts = [];
if (_mode == 1) then { if (_mode == 1) then {
switch (true) do { switch (true) do {
case (_vehicle isKindOf "Tank"): { case (_vehicle isKindOf "Tank"): {
@ -95,9 +95,9 @@ if (_mode == 1) then {
if (canMove _vehicle) then { if (canMove _vehicle) then {
{ {
_selectionPart = "hit" + _x; private _selectionPart = "hit" + _x;
if (isText(configFile >> "CfgVehicles" >> typeOf _vehicle >> "hitpoints" >> _selectionPart >> "name")) then { if (isText(configFile >> "CfgVehicles" >> typeOf _vehicle >> "hitpoints" >> _selectionPart >> "name")) then {
_selection = getText(configFile >> "CfgVehicles" >> typeOf _vehicle >> "hitpoints" >> _selectionPart >> "name"); private _selection = getText(configFile >> "CfgVehicles" >> typeOf _vehicle >> "hitpoints" >> _selectionPart >> "name");
// TODO: Only the tires that have touched the wire should burst. // TODO: Only the tires that have touched the wire should burst.
_vehicle setHit [_selection, 1]; _vehicle setHit [_selection, 1];
}; };
@ -107,14 +107,13 @@ if (canMove _vehicle) then {
if (_mode == 1) then { if (_mode == 1) then {
if (_vehicle isKindOf "StaticWeapon") exitWith {}; if (_vehicle isKindOf "StaticWeapon") exitWith {};
[{ [{
PARAMS_2(_vehicle,_wire); params ["_vehicle", "_wire"];
_vehicle setVelocity ((velocity _vehicle) vectorMultiply 0.75); _vehicle setVelocity ((velocity _vehicle) vectorMultiply 0.75);
private ["_vPos", "_vDir"];
// Set vehicle back in front of wire, since the wire will make the vehicle jump, and a wire with no geometry lod is undestructible and not recognizeable // Set vehicle back in front of wire, since the wire will make the vehicle jump, and a wire with no geometry lod is undestructible and not recognizeable
_vPos = getPosASL _vehicle; private _vPos = getPosASL _vehicle;
_vDir = getDir _vehicle; private _vDir = getDir _vehicle;
_vehicle setPosASL (_vPos vectorAdd [-0.35 * sin(_vDir), -0.35 * cos(_vDir), 0]); _vehicle setPosASL (_vPos vectorAdd [-0.35 * sin(_vDir), -0.35 * cos(_vDir), 0]);
// TODO: Needs to be placed in safe distance to wire, so we do not constantly re - spawn new wires // TODO: Needs to be placed in safe distance to wire, so we do not constantly re - spawn new wires
}, [_vehicle, _wire], 0.1] call CBA_fnc_waitAndExecute; }, [_vehicle, _wire], 0.1] call CBA_fnc_waitAndExecute;

View File

@ -29,7 +29,7 @@ if (_hitIndex != -1) then {
}; };
// get change in damage // get change in damage
private "_oldDamage"; private _oldDamage = 0;
if (_hitpoint isEqualTo "#structural") then { if (_hitpoint isEqualTo "#structural") then {
_oldDamage = damage _vehicle; _oldDamage = damage _vehicle;

View File

@ -19,7 +19,7 @@
#define EMP_RF_ACC 5 // Rangefinder Accuracy #define EMP_RF_ACC 5 // Rangefinder Accuracy
PARAMS_3(_slopeDistance,_azimuth,_inclination); params ["_slopeDistance", "_azimuth", "_inclination"];
if (GVAR(vectorConnected)) then { if (GVAR(vectorConnected)) then {
GVAR(LAZPOS) = (eyePos player) vectorAdd ([_slopeDistance, _azimuth, _inclination] call CBA_fnc_polar2vect); GVAR(LAZPOS) = (eyePos player) vectorAdd ([_slopeDistance, _azimuth, _inclination] call CBA_fnc_polar2vect);

View File

@ -31,8 +31,6 @@ __background ctrlSetText QPATHTOF(UI\dagr_gps.paa);
if (GVAR(outputPFH) != -1) exitWith {}; if (GVAR(outputPFH) != -1) exitWith {};
GVAR(outputPFH) = [{ GVAR(outputPFH) = [{
private ["_dagrElevation", "_dagrGrid", "_dagrHeading", "_dagrSpeed", "_dagrTime", "_elevation", "_gridArray", "_speed"];
// Abort Condition // Abort Condition
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith { if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
GVAR(outputPFH) = -1; GVAR(outputPFH) = -1;
@ -41,30 +39,30 @@ GVAR(outputPFH) = [{
}; };
// GRID // GRID
_gridArray = [(getPos ACE_player), false] call EFUNC(common,getMapGridFromPos); private _gridArray = [(getPos ACE_player), false] call EFUNC(common,getMapGridFromPos);
_gridArray params ["_gridArrayX","_gridArrayY"]; _gridArray params ["_gridArrayX","_gridArrayY"];
_dagrGrid = format ["%1 %2", ((_gridArrayX) select [0,4]), ((_gridArrayY) select [0,4])]; private _dagrGrid = format ["%1 %2", ((_gridArrayX) select [0,4]), ((_gridArrayY) select [0,4])];
// SPEED // SPEED
_speed = speed (vehicle ACE_player); private _speed = speed (vehicle ACE_player);
_speed = floor (_speed * 10) / 10; _speed = floor (_speed * 10) / 10;
_speed = abs(_speed); _speed = abs(_speed);
_dagrspeed = str _speed + "kph"; _dagrspeed = str _speed + "kph";
// Elevation // Elevation
_elevation = getPosASL ACE_player; private _elevation = getPosASL ACE_player;
_elevation = floor ((_elevation select 2) + EGVAR(common,mapAltitude)); _elevation = floor ((_elevation select 2) + EGVAR(common,mapAltitude));
_dagrElevation = str _elevation + "m"; private _dagrElevation = str _elevation + "m";
// Heading // Heading
_dagrHeading = if (!GVAR(useDegrees)) then { private _dagrHeading = if (!GVAR(useDegrees)) then {
floor (DEG_TO_MIL(direction (vehicle ACE_player))) floor (DEG_TO_MIL(direction (vehicle ACE_player)))
} else { } else {
floor (direction (vehicle ACE_player)) floor (direction (vehicle ACE_player))
}; };
// Time // Time
_dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString; private _dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString;
// Output // Output
__gridControl ctrlSetText format ["%1", _dagrGrid]; __gridControl ctrlSetText format ["%1", _dagrGrid];

View File

@ -16,8 +16,6 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_xGrid", "_yGrid", "_dagrGrid", "_bearing", "_dagrDist", "_dagrElevation", "_dagrTime", "_elevation", "_xCoord", "_yCoord"];
135471 cutRsc ["DAGR_DISPLAY", "plain down"]; 135471 cutRsc ["DAGR_DISPLAY", "plain down"];
#define __display (uiNameSpace getVariable "DAGR_DISPLAY") #define __display (uiNameSpace getVariable "DAGR_DISPLAY")
@ -39,7 +37,7 @@ if (_lazPosX < 0) then { _lazPosX = _lazPosX + 99999;};
if (_lazPosY < 0) then {_lazPosY = _lazPosY + 99999;}; if (_lazPosY < 0) then {_lazPosY = _lazPosY + 99999;};
// Find laser position // Find laser position
_xGrid = toArray Str(round _lazPosX); private _xGrid = toArray Str(round _lazPosX);
while {count _xGrid < 5} do { while {count _xGrid < 5} do {
_xGrid = [48] + _xGrid; _xGrid = [48] + _xGrid;
@ -48,7 +46,7 @@ _xGrid resize 4;
_xGrid = toString _xGrid; _xGrid = toString _xGrid;
_xGrid = parseNumber _xGrid; _xGrid = parseNumber _xGrid;
_yGrid = toArray Str(round _lazPosY); private _yGrid = toArray Str(round _lazPosY);
while {count _yGrid < 5} do { while {count _yGrid < 5} do {
_yGrid = [48] + _yGrid; _yGrid = [48] + _yGrid;
}; };
@ -56,37 +54,37 @@ _yGrid resize 4;
_yGrid = toString _yGrid; _yGrid = toString _yGrid;
_yGrid = parseNumber _yGrid; _yGrid = parseNumber _yGrid;
_xCoord = switch true do { private _xCoord = switch true do {
case (_xGrid >= 1000): { "" + Str(_xGrid) }; case (_xGrid >= 1000): { "" + Str(_xGrid) };
case (_xGrid >= 100): { "0" + Str(_xGrid) }; case (_xGrid >= 100): { "0" + Str(_xGrid) };
case (_xGrid >= 10): { "00" + Str(_xGrid) }; case (_xGrid >= 10): { "00" + Str(_xGrid) };
default { "000" + Str(_xGrid) }; default { "000" + Str(_xGrid) };
}; };
_yCoord = switch true do { private _yCoord = switch true do {
case (_yGrid >= 1000): { "" + Str(_yGrid) }; case (_yGrid >= 1000): { "" + Str(_yGrid) };
case (_yGrid >= 100): { "0" + Str(_yGrid) }; case (_yGrid >= 100): { "0" + Str(_yGrid) };
case (_yGrid >= 10): { "00" + Str(_yGrid) }; case (_yGrid >= 10): { "00" + Str(_yGrid) };
default { "000" + Str(_yGrid) }; default { "000" + Str(_yGrid) };
}; };
_dagrGrid = _xCoord + " " + _yCoord; private _dagrGrid = _xCoord + " " + _yCoord;
// Find target elevation // Find target elevation
_elevation = floor ((_lazPosZ) + EGVAR(common,mapAltitude)); private _elevation = floor ((_lazPosZ) + EGVAR(common,mapAltitude));
_dagrElevation = str _elevation + "m"; private _dagrElevation = str _elevation + "m";
// Time // Time
_dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString; private _dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString;
// Bearing // Bearing
_bearing = GVAR(LAZHEADING); private _bearing = GVAR(LAZHEADING);
if (_bearing >= 360) then {_bearing = _bearing - 360;}; if (_bearing >= 360) then {_bearing = _bearing - 360;};
if (!GVAR(useDegrees)) then {_bearing = DEG_TO_MIL(_bearing)}; if (!GVAR(useDegrees)) then {_bearing = DEG_TO_MIL(_bearing)};
_bearing = floor (_bearing); _bearing = floor (_bearing);
// Distance // Distance
_dagrDist = str GVAR(LAZDIST) + "m"; private _dagrDist = str GVAR(LAZDIST) + "m";
// Put grid into variable so DAGR menu can access it // Put grid into variable so DAGR menu can access it
GVAR(vectorGrid) = _dagrGrid; GVAR(vectorGrid) = _dagrGrid;

View File

@ -31,8 +31,6 @@ __background ctrlSetText QPATHTOF(UI\dagr_wp.paa);
if (GVAR(outputPFH) != -1) exitWith {}; if (GVAR(outputPFH) != -1) exitWith {};
GVAR(outputPFH) = [{ GVAR(outputPFH) = [{
private ["_MYpos", "_WPpos", "_bearing", "_dagrDistance", "_dagrGrid", "_dagrHeading", "_distance", "_gridArray"];
// Abort Condition // Abort Condition
if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith { if !(GVAR(run) && [ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)) exitWith {
GVAR(outputPFH) = -1; GVAR(outputPFH) = -1;
@ -41,13 +39,13 @@ GVAR(outputPFH) = [{
}; };
// GRID // GRID
_gridArray = [(getPos ACE_player), false] call EFUNC(common,getMapGridFromPos); private _gridArray = [(getPos ACE_player), false] call EFUNC(common,getMapGridFromPos);
_gridArray params ["_gridArrayX","_gridArrayY"]; _gridArray params ["_gridArrayX","_gridArrayY"];
_dagrGrid = format ["%1 %2", (_gridArrayX select [0,4]), (_gridArrayY select [0,4])]; private _dagrGrid = format ["%1 %2", (_gridArrayX select [0,4]), (_gridArrayY select [0,4])];
// WP Grid // WP Grid
_xGrid2 = floor (DAGR_WP_INFO / 10000); private _xGrid2 = floor (DAGR_WP_INFO / 10000);
_yGrid2 = DAGR_WP_INFO - _xGrid2 * 10000; private _yGrid2 = DAGR_WP_INFO - _xGrid2 * 10000;
_xCoord2 = switch true do { _xCoord2 = switch true do {
case (_xGrid2 >= 1000): { "" + Str(_xGrid2) }; case (_xGrid2 >= 1000): { "" + Str(_xGrid2) };
@ -66,21 +64,21 @@ GVAR(outputPFH) = [{
_dagrGrid2 = _xCoord2 + " " + _yCoord2; _dagrGrid2 = _xCoord2 + " " + _yCoord2;
// Distance // Distance
_WPpos = [_dagrGrid2, true] call EFUNC(common,getMapPosFromGrid); private _WPpos = [_dagrGrid2, true] call EFUNC(common,getMapPosFromGrid);
_MYpos = [_dagrGrid, true] call EFUNC(common,getMapPosFromGrid); private _MYpos = [_dagrGrid, true] call EFUNC(common,getMapPosFromGrid);
_distance = _MYpos distance _WPpos; private _distance = _MYpos distance _WPpos;
_distance = floor (_distance * 10) / 10; _distance = floor (_distance * 10) / 10;
_dagrDistance = str _distance + "m"; private _dagrDistance = str _distance + "m";
// Heading // Heading
_dagrHeading = floor (if (GVAR(useDegrees)) then { private _dagrHeading = floor (if (GVAR(useDegrees)) then {
direction (vehicle ACE_player) direction (vehicle ACE_player)
} else { } else {
DEG_TO_MIL(direction (vehicle ACE_player)) DEG_TO_MIL(direction (vehicle ACE_player))
}); });
// WP Heading // WP Heading
_bearing = floor (if (GVAR(useDegrees)) then { private _bearing = floor (if (GVAR(useDegrees)) then {
((_WPpos vectorDiff _MYpos) call CBA_fnc_vectDir) ((_WPpos vectorDiff _MYpos) call CBA_fnc_vectDir)
} else { } else {
DEG_TO_MIL(((_WPpos vectorDiff _MYpos) call CBA_fnc_vectDir)) DEG_TO_MIL(((_WPpos vectorDiff _MYpos) call CBA_fnc_vectDir))

View File

@ -30,11 +30,10 @@
[0, [false, false, false]], false] call CBA_fnc_addKeybind; // (empty default key) [0, [false, false, false]], false] call CBA_fnc_addKeybind; // (empty default key)
//Add deviceKey entry: //Add deviceKey entry:
private ["_conditonCode", "_toggleCode", "_closeCode"]; private _conditonCode = {
_conditonCode = {
([ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem)); ([ACE_player, "ACE_DAGR"] call EFUNC(common,hasItem));
}; };
_toggleCode = { private _toggleCode = {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {};
@ -44,7 +43,7 @@ _toggleCode = {
[] call FUNC(menuInit); [] call FUNC(menuInit);
}; };
}; };
_closeCode = { private _closeCode = {
// Statement // Statement
if (GVAR(run)) then { if (GVAR(run)) then {
//If dispaly is open, close it: //If dispaly is open, close it:

View File

@ -16,16 +16,14 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_animationStateCfgMoves", "_putDownAnim"];
params ["_target"]; params ["_target"];
//Check animationState for putDown anim //Check animationState for putDown anim
//This ensures the unit doesn't have to actualy do any animation to drop something //This ensures the unit doesn't have to actualy do any animation to drop something
//This should always be true for the 3 possible status effects that allow disarming //This should always be true for the 3 possible status effects that allow disarming
_animationStateCfgMoves = getText (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _target) >> "actions"); private _animationStateCfgMoves = getText (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState _target) >> "actions");
if (_animationStateCfgMoves == "") exitWith { false }; if (_animationStateCfgMoves == "") exitWith { false };
_putDownAnim = getText (configFile >> "CfgMovesBasic" >> "Actions" >> _animationStateCfgMoves >> "PutDown"); private _putDownAnim = getText (configFile >> "CfgMovesBasic" >> "Actions" >> _animationStateCfgMoves >> "PutDown");
if (_putDownAnim != "") exitWith { false }; if (_putDownAnim != "") exitWith { false };

View File

@ -21,12 +21,10 @@
#define TIME_MAX_WAIT 5 #define TIME_MAX_WAIT 5
private ["_fncSumArray", "_return", "_holder", "_dropPos", "_targetMagazinesStart", "_holderMagazinesStart", "_xClassname", "_xAmmo", "_targetMagazinesEnd", "_holderMagazinesEnd", "_holderItemsStart", "_targetItemsStart", "_addToCrateClassnames", "_addToCrateCount", "_index", "_holderItemsEnd", "_targetItemsEnd", "_holderIsEmpty"];
params ["_caller", "_target", "_listOfItemsToRemove", ["_doNotDropAmmo", false, [false]]]; //By default units drop all weapon mags when dropping a weapon params ["_caller", "_target", "_listOfItemsToRemove", ["_doNotDropAmmo", false, [false]]]; //By default units drop all weapon mags when dropping a weapon
_fncSumArray = { private _fncSumArray = {
_return = 0; private _return = 0;
{_return = _return + _x;} count (_this select 0); {_return = _return + _x;} count (_this select 0);
_return _return
}; };
@ -39,7 +37,7 @@ if (_doNotDropAmmo && {({_x in _listOfItemsToRemove} count (magazines _target))
[_caller, _target, "Debug: Trying to drop magazine with _doNotDropAmmo flag"] call FUNC(eventTargetFinish); [_caller, _target, "Debug: Trying to drop magazine with _doNotDropAmmo flag"] call FUNC(eventTargetFinish);
}; };
_holder = objNull; private _holder = objNull;
//If not dropping ammo, don't use an existing container //If not dropping ammo, don't use an existing container
if (!_doNotDropAmmo) then { if (!_doNotDropAmmo) then {
@ -52,7 +50,7 @@ if (!_doNotDropAmmo) then {
//Create a new weapon holder //Create a new weapon holder
if (isNull _holder) then { if (isNull _holder) then {
_dropPos = _target modelToWorld [0.4, 0.75, 0]; //offset someone unconscious isn't lying over it private _dropPos = _target modelToWorld [0.4, 0.75, 0]; //offset someone unconscious isn't lying over it
_dropPos set [2, ((getPosASL _target) select 2)]; _dropPos set [2, ((getPosASL _target) select 2)];
_holder = createVehicle [DISARM_CONTAINER, _dropPos, [], 0, "CAN_COLLIDE"]; _holder = createVehicle [DISARM_CONTAINER, _dropPos, [], 0, "CAN_COLLIDE"];
_holder setPosASL _dropPos; _holder setPosASL _dropPos;
@ -73,19 +71,19 @@ _holder setVariable [QGVAR(holderInUse), true];
//Remove Magazines //Remove Magazines
_targetMagazinesStart = magazinesAmmo _target; private _targetMagazinesStart = magazinesAmmo _target;
_holderMagazinesStart = magazinesAmmoCargo _holder; private _holderMagazinesStart = magazinesAmmoCargo _holder;
{ {
EXPLODE_2_PVT(_x,_xClassname,_xAmmo); _x params ["_xClassname", "_xAmmo"];
if ((_xClassname in _listOfItemsToRemove) && {(getNumber (configFile >> "CfgMagazines" >> _xClassname >> "ACE_isUnique")) == 0}) then { if ((_xClassname in _listOfItemsToRemove) && {(getNumber (configFile >> "CfgMagazines" >> _xClassname >> "ACE_isUnique")) == 0}) then {
_holder addMagazineAmmoCargo [_xClassname, 1, _xAmmo]; _holder addMagazineAmmoCargo [_xClassname, 1, _xAmmo];
_target removeMagazine _xClassname; _target removeMagazine _xClassname;
}; };
} forEach _targetMagazinesStart; } forEach _targetMagazinesStart;
_targetMagazinesEnd = magazinesAmmo _target; private _targetMagazinesEnd = magazinesAmmo _target;
_holderMagazinesEnd = magazinesAmmoCargo _holder; private _holderMagazinesEnd = magazinesAmmoCargo _holder;
//Verify Mags dropped from unit: //Verify Mags dropped from unit:
if (({((_x select 0) in _listOfItemsToRemove) && {(getNumber (configFile >> "CfgMagazines" >> (_x select 0) >> "ACE_isUnique")) == 0}} count _targetMagazinesEnd) != 0) exitWith { if (({((_x select 0) in _listOfItemsToRemove) && {(getNumber (configFile >> "CfgMagazines" >> (_x select 0) >> "ACE_isUnique")) == 0}} count _targetMagazinesEnd) != 0) exitWith {
@ -100,14 +98,14 @@ if (!([_targetMagazinesStart, _targetMagazinesEnd, _holderMagazinesStart, _holde
}; };
//Remove Items, Assigned Items and NVG //Remove Items, Assigned Items and NVG
_holderItemsStart = getitemCargo _holder; private _holderItemsStart = getitemCargo _holder;
_targetItemsStart = (assignedItems _target) + (items _target) - (weapons _target); private _targetItemsStart = (assignedItems _target) + (items _target) - (weapons _target);
if ((headgear _target) != "") then {_targetItemsStart pushBack (headgear _target);}; if ((headgear _target) != "") then {_targetItemsStart pushBack (headgear _target);};
if ((goggles _target) != "") then {_targetItemsStart pushBack (goggles _target);}; if ((goggles _target) != "") then {_targetItemsStart pushBack (goggles _target);};
_addToCrateClassnames = []; private _addToCrateClassnames = [];
_addToCrateCount = []; private _addToCrateCount = [];
{ {
if (_x in _listOfItemsToRemove) then { if (_x in _listOfItemsToRemove) then {
if (_x in (items _target)) then { if (_x in (items _target)) then {
@ -115,7 +113,7 @@ _addToCrateCount = [];
} else { } else {
_target unlinkItem _x; _target unlinkItem _x;
}; };
_index = _addToCrateClassnames find _x; private _index = _addToCrateClassnames find _x;
if (_index != -1) then { if (_index != -1) then {
_addToCrateCount set [_index, ((_addToCrateCount select _index) + 1)]; _addToCrateCount set [_index, ((_addToCrateCount select _index) + 1)];
} else { } else {
@ -130,8 +128,8 @@ _addToCrateCount = [];
_holder addItemCargoGlobal [(_addToCrateClassnames select _forEachIndex), (_addToCrateCount select _forEachIndex)]; _holder addItemCargoGlobal [(_addToCrateClassnames select _forEachIndex), (_addToCrateCount select _forEachIndex)];
} forEach _addToCrateClassnames; } forEach _addToCrateClassnames;
_holderItemsEnd = getitemCargo _holder; private _holderItemsEnd = getitemCargo _holder;
_targetItemsEnd = (assignedItems _target) + (items _target) - (weapons _target); private _targetItemsEnd = (assignedItems _target) + (items _target) - (weapons _target);
if ((headgear _target) != "") then {_targetItemsEnd pushBack (headgear _target);}; if ((headgear _target) != "") then {_targetItemsEnd pushBack (headgear _target);};
if ((goggles _target) != "") then {_targetItemsEnd pushBack (goggles _target);}; if ((goggles _target) != "") then {_targetItemsEnd pushBack (goggles _target);};
@ -158,7 +156,7 @@ if (((vest _target) != "") && {(vest _target) in _listOfItemsToRemove} && {(vest
//If holder is still empty, it will be 'garbage collected' while we wait for the drop 'action' to take place //If holder is still empty, it will be 'garbage collected' while we wait for the drop 'action' to take place
//So add a dummy item and just remove at the end //So add a dummy item and just remove at the end
_holderIsEmpty = ([_holder] call FUNC(getAllGearContainer)) isEqualTo [[],[]]; private _holderIsEmpty = ([_holder] call FUNC(getAllGearContainer)) isEqualTo [[],[]];
if (_holderIsEmpty) then { if (_holderIsEmpty) then {
TRACE_1("Debug: adding dummy item to holder",_holder); TRACE_1("Debug: adding dummy item to holder",_holder);
_holder addItemCargoGlobal [DUMMY_ITEM, 1]; _holder addItemCargoGlobal [DUMMY_ITEM, 1];
@ -166,16 +164,14 @@ if (_holderIsEmpty) then {
//Start the PFEH to do the actions (which could take >1 frame) //Start the PFEH to do the actions (which could take >1 frame)
[{ [{
private ["_needToRemoveWeapon", "_needToRemoveMagazines", "_needToRemoveBackpack", "_needToRemoveVest", "_needToRemoveUniform", "_error", "_magsToPickup", "_index", "_magazinesInHolder"]; params ["_args", "_pfID"];
_args params ["_caller", "_target", "_listOfItemsToRemove", "_holder", "_holderIsEmpty", "_maxWaitTime", "_doNotDropAmmo", "_startingMagazines"];
PARAMS_2(_args,_pfID); private _needToRemoveWeapon = ({_x in _listOfItemsToRemove} count (weapons _target)) > 0;
EXPLODE_8_PVT(_args,_caller,_target,_listOfItemsToRemove,_holder,_holderIsEmpty,_maxWaitTime,_doNotDropAmmo,_startingMagazines); private _needToRemoveMagazines = ({_x in _listOfItemsToRemove} count (magazines _target)) > 0;
private _needToRemoveBackpack = ((backPack _target) != "") && {(backPack _target) in _listOfItemsToRemove};
_needToRemoveWeapon = ({_x in _listOfItemsToRemove} count (weapons _target)) > 0; private _needToRemoveVest = ((vest _target) != "") && {(vest _target) in _listOfItemsToRemove};
_needToRemoveMagazines = ({_x in _listOfItemsToRemove} count (magazines _target)) > 0; private _needToRemoveUniform = ((uniform _target) != "") && {(uniform _target) in _listOfItemsToRemove};
_needToRemoveBackpack = ((backPack _target) != "") && {(backPack _target) in _listOfItemsToRemove};
_needToRemoveVest = ((vest _target) != "") && {(vest _target) in _listOfItemsToRemove};
_needToRemoveUniform = ((uniform _target) != "") && {(uniform _target) in _listOfItemsToRemove};
if ((CBA_missionTime < _maxWaitTime) && {[_target] call FUNC(canBeDisarmed)} && {_needToRemoveWeapon || _needToRemoveMagazines || _needToRemoveBackpack}) then { if ((CBA_missionTime < _maxWaitTime) && {[_target] call FUNC(canBeDisarmed)} && {_needToRemoveWeapon || _needToRemoveMagazines || _needToRemoveBackpack}) then {
//action drop weapons (keeps loaded magazine and attachements) //action drop weapons (keeps loaded magazine and attachements)
@ -198,18 +194,18 @@ if (_holderIsEmpty) then {
[_pfID] call CBA_fnc_removePerFrameHandler; [_pfID] call CBA_fnc_removePerFrameHandler;
if (_doNotDropAmmo) then { if (_doNotDropAmmo) then {
_error = false; private _error = false;
_magsToPickup = +_startingMagazines; private _magsToPickup = +_startingMagazines;
{ {
_index = _magsToPickup find _x; private _index = _magsToPickup find _x;
if (_index == -1) exitWith {_error = true; ERROR("More mags than when we started?")}; if (_index == -1) exitWith {_error = true; ERROR("More mags than when we started?")};
_magsToPickup deleteAt _index; _magsToPickup deleteAt _index;
} forEach (magazinesAmmo _target); } forEach (magazinesAmmo _target);
_magazinesInHolder = magazinesAmmoCargo _holder; private _magazinesInHolder = magazinesAmmoCargo _holder;
{ {
_index = _magazinesInHolder find _x; private _index = _magazinesInHolder find _x;
if (_index == -1) exitWith {_error = true; ERROR("Missing mag not in holder")}; if (_index == -1) exitWith {_error = true; ERROR("Missing mag not in holder")};
_magazinesInHolder deleteAt _index; _magazinesInHolder deleteAt _index;
} forEach _magsToPickup; } forEach _magsToPickup;

View File

@ -18,9 +18,7 @@
params ["_target"]; params ["_target"];
private ["_allItems", "_classnamesCount", "_index", "_uniqueClassnames"]; private _allItems = (((items _target) + (assignedItems _target)) - (weapons _target)) + (weapons _target) + (magazines _target);
_allItems = (((items _target) + (assignedItems _target)) - (weapons _target)) + (weapons _target) + (magazines _target);
if ((backpack _target) != "") then { if ((backpack _target) != "") then {
_allItems pushBack (backpack _target); _allItems pushBack (backpack _target);
@ -39,11 +37,11 @@ if ((goggles _target) != "") then {
_allItems pushBack (goggles _target); _allItems pushBack (goggles _target);
}; };
_uniqueClassnames = []; private _uniqueClassnames = [];
_classnamesCount = []; private _classnamesCount = [];
//Filter unique and count //Filter unique and count
{ {
_index = _uniqueClassnames find _x; private _index = _uniqueClassnames find _x;
if (_index != -1) then { if (_index != -1) then {
_classnamesCount set [_index, ((_classnamesCount select _index) + 1)]; _classnamesCount set [_index, ((_classnamesCount select _index) + 1)];
} else { } else {

View File

@ -48,7 +48,6 @@ GVAR(disarmTarget) = _target;
//Setup PFEH //Setup PFEH
[{ [{
private ["_groundContainer", "_targetContainer", "_playerName", "_icon", "_rankPicture", "_targetUniqueItems", "_holderUniqueItems", "_holder"];
disableSerialization; disableSerialization;
params ["_args", "_idPFH"]; params ["_args", "_idPFH"];
_args params ["_player", "_target", "_display"]; _args params ["_player", "_target", "_display"];
@ -62,13 +61,13 @@ GVAR(disarmTarget) = _target;
if (!isNull _display) then { closeDialog 0; }; //close dialog if still open if (!isNull _display) then { closeDialog 0; }; //close dialog if still open
} else { } else {
_groundContainer = _display displayCtrl 632; private _groundContainer = _display displayCtrl 632;
_targetContainer = _display displayCtrl 633; private _targetContainer = _display displayCtrl 633;
_playerName = _display displayCtrl 111; private _playerName = _display displayCtrl 111;
_rankPicture = _display displayCtrl 1203; private _rankPicture = _display displayCtrl 1203;
//Show rank and name (just like BIS's inventory) //Show rank and name (just like BIS's inventory)
_icon = format [DEFUALTPATH, toLower (rank _target)]; private _icon = format [DEFUALTPATH, toLower (rank _target)];
if (_icon isEqualTo DEFUALTPATH) then {_icon = ""}; if (_icon isEqualTo DEFUALTPATH) then {_icon = ""};
_rankPicture ctrlSetText _icon; _rankPicture ctrlSetText _icon;
_playerName ctrlSetText ([GVAR(disarmTarget), false, true] call EFUNC(common,getName)); _playerName ctrlSetText ([GVAR(disarmTarget), false, true] call EFUNC(common,getName));
@ -78,11 +77,11 @@ GVAR(disarmTarget) = _target;
lbClear _targetContainer; lbClear _targetContainer;
//Show the items in the ground disarmTarget's inventory //Show the items in the ground disarmTarget's inventory
_targetUniqueItems = [GVAR(disarmTarget)] call FUNC(getAllGearUnit); private _targetUniqueItems = [GVAR(disarmTarget)] call FUNC(getAllGearUnit);
[_targetContainer, _targetUniqueItems] call FUNC(showItemsInListbox); [_targetContainer, _targetUniqueItems] call FUNC(showItemsInListbox);
//Try to find a holder that the target is using to drop items into: //Try to find a holder that the target is using to drop items into:
_holder = objNull; private _holder = objNull;
{ {
if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith { if ((_x getVariable [QGVAR(disarmUnit), objNull]) == _target) exitWith {
_holder = _x; _holder = _x;
@ -91,7 +90,7 @@ GVAR(disarmTarget) = _target;
//If a holder exists, show it's inventory //If a holder exists, show it's inventory
if (!isNull _holder) then { if (!isNull _holder) then {
_holderUniqueItems = [_holder] call FUNC(getAllGearContainer); private _holderUniqueItems = [_holder] call FUNC(getAllGearContainer);
[_groundContainer, _holderUniqueItems] call FUNC(showItemsInListbox); [_groundContainer, _holderUniqueItems] call FUNC(showItemsInListbox);
}; };
}; };

View File

@ -26,7 +26,7 @@ params ["_listBoxCtrl", "_itemsCountArray"];
private _count = (_itemsCountArray select 1) select _forEachIndex; private _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 _configPath = configNull;
private _displayName = ""; private _displayName = "";
private _picture = ""; private _picture = "";
switch (true) do { switch (true) do {

View File

@ -21,7 +21,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
PARAMS_4(_startA,_endA,_startB,_endB); params ["_startA", "_endA", "_startB", "_endB"];
//Quick Lazy Count Check //Quick Lazy Count Check
if (((count _startA) + (count _startB)) != ((count _endA) + (count _endB))) exitWith { if (((count _startA) + (count _startB)) != ((count _endA) + (count _endB))) exitWith {

View File

@ -80,7 +80,7 @@ class RscACE_SelectTimeUI {
y = 0.06; y = 0.06;
w = 0.49; w = 0.49;
h = 0.025; h = 0.025;
onSliderPosChanged = "private ['_mins', '_secs'];_mins = floor((_this select 1)/60);_secs=floor((_this select 1) - (_mins*60));ctrlSetText [8870, format[localize 'STR_ACE_Explosives_TimerMenu',_mins, _secs]];"; onSliderPosChanged = "_mins = floor((_this select 1)/60);_secs=floor((_this select 1) - (_mins*60));ctrlSetText [8870, format[localize 'STR_ACE_Explosives_TimerMenu',_mins, _secs]];";
}; };
class cancelBtn: RscButton { class cancelBtn: RscButton {
idc = 8855; idc = 8855;

View File

@ -21,23 +21,21 @@
params ["_unit", "_explosive", "_magazineClass", "_extra"]; params ["_unit", "_explosive", "_magazineClass", "_extra"];
TRACE_4("params",_unit,_explosive,_magazineClass,_extra); TRACE_4("params",_unit,_explosive,_magazineClass,_extra);
private ["_config", "_detonators", "_hasRequired", "_requiredItems", "_code", "_count", "_codeSet"];
// Config is the last item in the list of passed in items. // Config is the last item in the list of passed in items.
_config = (_this select 3) select (count (_this select 3) - 1); private _config = (_this select 3) select (count (_this select 3) - 1);
_requiredItems = getArray(_config >> "requires"); private _requiredItems = getArray(_config >> "requires");
_hasRequired = true; private _hasRequired = true;
_detonators = [_unit] call FUNC(getDetonators); private _detonators = [_unit] call FUNC(getDetonators);
{ {
if !(_x in _detonators) exitWith{ if !(_x in _detonators) exitWith{
_hasRequired = false; _hasRequired = false;
}; };
} count _requiredItems; } count _requiredItems;
_codeSet = false; private _codeSet = false;
while {!_codeSet} do { while {!_codeSet} do {
_code = str(round (random 9999)); private _code = str(round (random 9999));
_count = 4 - count (toArray _code); _count = 4 - count (toArray _code);
while {_count > 0} do { while {_count > 0} do {
_code = "0" + _code; _code = "0" + _code;
@ -48,7 +46,7 @@ while {!_codeSet} do {
if (isNil QGVAR(CellphoneIEDs)) then { if (isNil QGVAR(CellphoneIEDs)) then {
GVAR(CellphoneIEDs) = []; GVAR(CellphoneIEDs) = [];
}; };
_count = GVAR(CellphoneIEDs) pushBack [_explosive,_code,GetNumber(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> "Cellphone" >> "FuseTime")]; private _count = GVAR(CellphoneIEDs) pushBack [_explosive,_code,GetNumber(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> "Cellphone" >> "FuseTime")];
_count = _count + 1; _count = _count + 1;
publicVariable QGVAR(CellphoneIEDs); publicVariable QGVAR(CellphoneIEDs);

View File

@ -21,14 +21,12 @@
params ["_unit", "_explosive", "_magazineClass"]; params ["_unit", "_explosive", "_magazineClass"];
TRACE_3("params",_unit,_explosive,_magazineClass); TRACE_3("params",_unit,_explosive,_magazineClass);
private ["_clacker", "_config", "_requiredItems", "_hasRequired", "_detonators"];
// Config is the last item in the list of passed in items. // Config is the last item in the list of passed in items.
_config = (_this select 3) select (count (_this select 3) - 1); private _config = (_this select 3) select (count (_this select 3) - 1);
_requiredItems = getArray(_config >> "requires"); private _requiredItems = getArray(_config >> "requires");
_hasRequired = true; private _hasRequired = true;
_detonators = [_unit] call FUNC(getDetonators); private _detonators = [_unit] call FUNC(getDetonators);
{ {
if !(_x in _detonators) exitWith{ if !(_x in _detonators) exitWith{
_hasRequired = false; _hasRequired = false;
@ -36,9 +34,9 @@ _detonators = [_unit] call FUNC(getDetonators);
} count _requiredItems; } count _requiredItems;
if !(_hasRequired) exitWith {}; if !(_hasRequired) exitWith {};
_config = ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> configName _config; private _config = ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> configName _config;
_clacker = _unit getVariable [QGVAR(Clackers), []]; private _clacker = _unit getVariable [QGVAR(Clackers), []];
GVAR(PlacedCount) = GVAR(PlacedCount) + 1; GVAR(PlacedCount) = GVAR(PlacedCount) + 1;
_clacker pushBack [_explosive, getNumber(_config >> "FuseTime"), format [localize LSTRING(DetonateCode), _clacker pushBack [_explosive, getNumber(_config >> "FuseTime"), format [localize LSTRING(DetonateCode),

View File

@ -19,18 +19,16 @@
params ["_unit", "_detonator"]; params ["_unit", "_detonator"];
TRACE_2("params",_unit,_detonator); TRACE_2("params",_unit,_detonator);
private ["_result", "_item", "_children", "_range", "_required","_explosivesList"]; private _range = getNumber (ConfigFile >> "CfgWeapons" >> _detonator >> QGVAR(Range));
_range = getNumber (ConfigFile >> "CfgWeapons" >> _detonator >> QGVAR(Range)); private _result = [_unit] call FUNC(getPlacedExplosives);
private _children = [];
_result = [_unit] call FUNC(getPlacedExplosives); private _explosivesList = [];
_children = [];
_explosivesList = [];
{ {
if (!isNull(_x select 0)) then { if (!isNull(_x select 0)) then {
_required = getArray (ConfigFile >> "ACE_Triggers" >> (_x select 4) >> "requires"); private _required = getArray (ConfigFile >> "ACE_Triggers" >> (_x select 4) >> "requires");
if (_detonator in _required) then { if (_detonator in _required) then {
_item = ConfigFile >> "CfgMagazines" >> (_x select 3); private _item = ConfigFile >> "CfgMagazines" >> (_x select 3);
_explosivesList pushBack _x; _explosivesList pushBack _x;

View File

@ -18,15 +18,13 @@
params ["_unit"]; params ["_unit"];
TRACE_1("params",_unit); TRACE_1("params",_unit);
private ["_mags", "_item", "_index", "_children", "_itemCount", "_list"]; private _mags = magazines _unit;
private _list = [];
_mags = magazines _unit; private _itemCount = [];
_list = [];
_itemCount = [];
{ {
_item = ConfigFile >> "CfgMagazines" >> _x; private _item = ConfigFile >> "CfgMagazines" >> _x;
if (getNumber(_item >> QGVAR(Placeable)) == 1) then { if (getNumber(_item >> QGVAR(Placeable)) == 1) then {
_index = _list find _item; private _index = _list find _item;
if (_index != -1) then { if (_index != -1) then {
_itemCount set [_index, (_itemCount select _index) + 1]; _itemCount set [_index, (_itemCount select _index) + 1];
} else { } else {
@ -36,7 +34,7 @@ _itemCount = [];
}; };
} forEach _mags; } forEach _mags;
_children = []; private _children = [];
{ {
private _name = getText (_x >> "displayNameShort"); private _name = getText (_x >> "displayNameShort");

View File

@ -19,10 +19,8 @@
params ["_name", "_code"]; params ["_name", "_code"];
TRACE_2("params",_name,_code); TRACE_2("params",_name,_code);
private ["_speedDial", "_found"]; private _speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
private _found = false;
_speedDial = ace_player getVariable [QGVAR(SpeedDial), []];
_found = false;
if ((_code) == "") exitWith { if ((_code) == "") exitWith {
[_name] call FUNC(removeFromSpeedDial); [_name] call FUNC(removeFromSpeedDial);

View File

@ -18,12 +18,10 @@
params ["_unit"]; params ["_unit"];
TRACE_1("params",_unit); TRACE_1("params",_unit);
private ["_children", "_config", "_detonators"]; private _detonators = [_unit] call FUNC(getDetonators);
private _children = [];
_detonators = [_unit] call FUNC(getDetonators);
_children = [];
{ {
_config = ConfigFile >> "CfgWeapons" >> _x; private _config = ConfigFile >> "CfgWeapons" >> _x;
_children pushBack _children pushBack
[ [
[ [

View File

@ -19,16 +19,14 @@
params ["_magazine", "_explosive"]; params ["_magazine", "_explosive"];
TRACE_2("params",_magazine,_explosive); TRACE_2("params",_magazine,_explosive);
private ["_hasRequiredItems","_triggerTypes", "_children", "_detonators", "_required", "_magTriggers", "_isAttached"]; private _isAttached = !isNull (attachedTo _explosive);
private _detonators = [ACE_player] call FUNC(getDetonators);
_isAttached = !isNull (attachedTo _explosive); private _triggerTypes = [_magazine] call FUNC(triggerType);
_detonators = [ACE_player] call FUNC(getDetonators); private _magTriggers = ConfigFile >> "CfgMagazines" >> _magazine >> "ACE_Triggers";
_triggerTypes = [_magazine] call FUNC(triggerType); private _children = [];
_magTriggers = ConfigFile >> "CfgMagazines" >> _magazine >> "ACE_Triggers";
_children = [];
{ {
_required = getArray (_x >> "requires"); private _required = getArray (_x >> "requires");
_hasRequiredItems = true; private _hasRequiredItems = true;
{ {
if !(_x in _detonators) exitWith { if !(_x in _detonators) exitWith {
_hasRequiredItems = false; _hasRequiredItems = false;

View File

@ -24,12 +24,10 @@
params ["_unit", "_range", "_item", ["_triggerClassname", "#unknown", [""]]]; params ["_unit", "_range", "_item", ["_triggerClassname", "#unknown", [""]]];
TRACE_4("detonateExplosive",_unit,_range,_item,_triggerClassname); TRACE_4("detonateExplosive",_unit,_range,_item,_triggerClassname);
private ["_result", "_ignoreRange", "_pos"]; private _ignoreRange = (_range == -1);
_ignoreRange = (_range == -1);
if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {TRACE_1("out of range",_range); false}; if (!_ignoreRange && {(_unit distance (_item select 0)) > _range}) exitWith {TRACE_1("out of range",_range); false};
_result = true; private _result = true;
{ {
// Pass [Unit<OBJECT>, MaxRange <NUMBER>, Explosive <OBJECT>, FuzeTime <NUMBER>, TriggerItem <STRING>] // Pass [Unit<OBJECT>, MaxRange <NUMBER>, Explosive <OBJECT>, FuzeTime <NUMBER>, TriggerItem <STRING>]
private _handlerResult = [_unit, _range, _item select 0, _item select 1, _triggerClassname] call _x; private _handlerResult = [_unit, _range, _item select 0, _item select 1, _triggerClassname] call _x;
@ -38,14 +36,13 @@ _result = true;
if (!_result) exitWith {false}; if (!_result) exitWith {false};
if (getNumber (ConfigFile >> "CfgAmmo" >> typeOf (_item select 0) >> "TriggerWhenDestroyed") == 0) then { if (getNumber (ConfigFile >> "CfgAmmo" >> typeOf (_item select 0) >> "TriggerWhenDestroyed") == 0) then {
private ["_exp", "_previousExp"]; private _previousExp = _item select 0;
_previousExp = _item select 0; private _exp = getText (ConfigFile >> "CfgAmmo" >> typeOf (_previousExp) >> QGVAR(Explosive));
_exp = getText (ConfigFile >> "CfgAmmo" >> typeOf (_previousExp) >> QGVAR(Explosive));
if (_exp != "") then { if (_exp != "") then {
_exp = createVehicle [_exp, [0,0,15001], [], 0, "NONE"]; _exp = createVehicle [_exp, [0,0,15001], [], 0, "NONE"];
_exp setDir (getDir _previousExp); _exp setDir (getDir _previousExp);
_item set [0, _exp]; _item set [0, _exp];
_pos = getPosASL _previousExp; private _pos = getPosASL _previousExp;
deleteVehicle _previousExp; deleteVehicle _previousExp;
_exp setPosASL _pos; _exp setPosASL _pos;
}; };

View File

@ -19,23 +19,20 @@
params ["_unit", "_code"]; params ["_unit", "_code"];
TRACE_2("params",_unit,_code); TRACE_2("params",_unit,_code);
private ["_arr", "_ran", "_i"];
if (_unit getVariable [QGVAR(Dialing),false]) exitWith {}; if (_unit getVariable [QGVAR(Dialing),false]) exitWith {};
if !(alive _unit) exitWith {}; if !(alive _unit) exitWith {};
_unit setVariable [QGVAR(Dialing), true, true]; _unit setVariable [QGVAR(Dialing), true, true];
_ran = (ceil(random 8)) + 1; private _ran = (ceil(random 8)) + 1;
_arr = []; private _arr = [];
for [{_i=0}, {_i<_ran}, {_i=_i + 1}] do { for "_i" from 1 to _ran do {
_arr = _arr + ['.','..','...','']; _arr = _arr + ['.','..','...',''];
}; };
if (_unit == ace_player) then { if (_unit == ace_player) then {
ctrlSetText [1400,"Calling"]; ctrlSetText [1400,"Calling"];
[FUNC(dialingPhone), 0.25, [_unit,4,_arr,_code]] call CALLSTACK(CBA_fnc_addPerFrameHandler); [FUNC(dialingPhone), 0.25, [_unit,4,_arr,_code]] call CALLSTACK(CBA_fnc_addPerFrameHandler);
} else { } else {
private ["_explosive"]; private _explosive = [_code] call FUNC(getSpeedDialExplosive);
_explosive = [_code] call FUNC(getSpeedDialExplosive);
if ((count _explosive) > 0) then { if ((count _explosive) > 0) then {
[{ [{
playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_this select 1),3.16228,1,75]; playSound3D [QUOTE(PATHTO_R(Data\Audio\Cellphone_Ring.wss)),objNull, false, getPosASL (_this select 1),3.16228,1,75];

View File

@ -21,16 +21,14 @@
params ["_unit"]; params ["_unit"];
TRACE_1("params",_unit); TRACE_1("params",_unit);
private ["_clackerList", "_adjustedList", "_list", "_filter"]; private _filter = nil;
_filter = nil;
if (count _this > 1) then { if (count _this > 1) then {
_filter = ConfigFile >> "ACE_Triggers" >> (_this select 1); _filter = ConfigFile >> "ACE_Triggers" >> (_this select 1);
}; };
_clackerList = []; private _clackerList = [];
_adjustedList = false; private _adjustedList = false;
_clackerList = _unit getVariable [QGVAR(Clackers), []]; _clackerList = _unit getVariable [QGVAR(Clackers), []];
_list = []; private _list = [];
{ {
if (isNull (_x select 0)) then { if (isNull (_x select 0)) then {
_clackerList set [_forEachIndex, "X"]; _clackerList set [_forEachIndex, "X"];

View File

@ -18,10 +18,8 @@
params ["_code"]; params ["_code"];
TRACE_1("params",_code); TRACE_1("params",_code);
private ["_explosive"];
if (isNil QGVAR(CellphoneIEDs)) exitWith {[]}; if (isNil QGVAR(CellphoneIEDs)) exitWith {[]};
_explosive = []; private _explosive = [];
{ {
if ((_x select 1) == _code) exitWith { if ((_x select 1) == _code) exitWith {
_explosive = _x; _explosive = _x;

View File

@ -18,10 +18,8 @@
params ["_unit"]; params ["_unit"];
TRACE_1("params",_unit); TRACE_1("params",_unit);
private ["_result", "_magazines"]; private _result = false;
private _magazines = magazines _unit;
_result = false;
_magazines = magazines _unit;
{ {
if (getNumber (ConfigFile >> "CfgMagazines" >> _x >> QGVAR(Placeable)) == 1) exitWith { if (getNumber (ConfigFile >> "CfgMagazines" >> _x >> QGVAR(Placeable)) == 1) exitWith {
_result = true; _result = true;

View File

@ -46,7 +46,7 @@ if (!("ACE_DefusalKit" in (items ACE_player))) exitWith {};
private _config = configFile >> "CfgAmmo" >> typeOf _x; private _config = configFile >> "CfgAmmo" >> typeOf _x;
private _size = getNumber (_config >> QGVAR(size)); private _size = getNumber (_config >> QGVAR(size));
TRACE_3("Making Defuse Helper",(_x),(typeOf _x),(_size == 1)); TRACE_3("Making Defuse Helper",(_x),(typeOf _x),(_size == 1));
private ["_defuseHelper"]; private _defuseHelper = objNull;
if (_size == 1) then { if (_size == 1) then {
_defuseHelper = "ACE_DefuseObject_Large" createVehicleLocal (getPos _x); _defuseHelper = "ACE_DefuseObject_Large" createVehicleLocal (getPos _x);
} else { } else {

View File

@ -25,8 +25,7 @@ if ((_receiver != ace_player) && {_giver != ace_player}) exitWith {};
private _config = ConfigFile >> "CfgWeapons" >> _item; private _config = ConfigFile >> "CfgWeapons" >> _item;
if (isClass _config && {getNumber(_config >> QGVAR(Detonator)) == 1}) then { if (isClass _config && {getNumber(_config >> QGVAR(Detonator)) == 1}) then {
private ["_clackerItems"]; private _clackerItems = _giver getVariable [QGVAR(Clackers), []];
_clackerItems = _giver getVariable [QGVAR(Clackers), []];
_receiver setVariable [QGVAR(Clackers), (_receiver getVariable [QGVAR(Clackers), []]) + _clackerItems, true]; _receiver setVariable [QGVAR(Clackers), (_receiver getVariable [QGVAR(Clackers), []]) + _clackerItems, true];
private _detonators = [_giver] call FUNC(getDetonators); private _detonators = [_giver] call FUNC(getDetonators);

View File

@ -24,11 +24,9 @@
params ["_unit", "_pos", "_dir", "_magazineClass", "_triggerConfig", "_triggerSpecificVars", ["_setupPlaceholderObject", objNull]]; params ["_unit", "_pos", "_dir", "_magazineClass", "_triggerConfig", "_triggerSpecificVars", ["_setupPlaceholderObject", objNull]];
TRACE_7("params",_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars,_setupPlaceholderObject); TRACE_7("params",_unit,_pos,_dir,_magazineClass,_triggerConfig,_triggerSpecificVars,_setupPlaceholderObject);
private ["_ammo", "_explosive", "_attachedTo", "_magazineTrigger", "_pitch", "_digDistance", "_canDigDown", "_soundEnviron", "_surfaceType"];
[_unit, "PutDown"] call EFUNC(common,doGesture); [_unit, "PutDown"] call EFUNC(common,doGesture);
_attachedTo = objNull; private _attachedTo = objNull;
if (!isNull _setupPlaceholderObject) then { if (!isNull _setupPlaceholderObject) then {
_attachedTo = attachedTo _setupPlaceholderObject; _attachedTo = attachedTo _setupPlaceholderObject;
deleteVehicle _setupPlaceholderObject; deleteVehicle _setupPlaceholderObject;
@ -39,7 +37,7 @@ if (isNil "_triggerConfig") exitWith {
objNull objNull
}; };
_magazineTrigger = ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> _triggerConfig; private _magazineTrigger = ConfigFile >> "CfgMagazines" >> _magazineClass >> "ACE_Triggers" >> _triggerConfig;
_triggerConfig = ConfigFile >> "ACE_Triggers" >> _triggerConfig; _triggerConfig = ConfigFile >> "ACE_Triggers" >> _triggerConfig;
if (isNil "_triggerConfig") exitWith { if (isNil "_triggerConfig") exitWith {
@ -47,7 +45,7 @@ if (isNil "_triggerConfig") exitWith {
objNull objNull
}; };
_ammo = getText(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ammo"); private _ammo = getText(ConfigFile >> "CfgMagazines" >> _magazineClass >> "ammo");
if (isText(_magazineTrigger >> "ammo")) then { if (isText(_magazineTrigger >> "ammo")) then {
_ammo = getText (_magazineTrigger >> "ammo"); _ammo = getText (_magazineTrigger >> "ammo");
}; };
@ -55,14 +53,14 @@ _triggerSpecificVars pushBack _triggerConfig;
//Dig the explosive down into the ground (usually on "pressurePlate") //Dig the explosive down into the ground (usually on "pressurePlate")
if (isNumber (_magazineTrigger >> "digDistance")) then { if (isNumber (_magazineTrigger >> "digDistance")) then {
_digDistance = getNumber (_magazineTrigger >> "digDistance"); private _digDistance = getNumber (_magazineTrigger >> "digDistance");
//Get Surface Type: //Get Surface Type:
_canDigDown = true; private _canDigDown = true;
_surfaceType = surfaceType _pos; private _surfaceType = surfaceType _pos;
if ((_surfaceType select [0,1]) == "#") then {_surfaceType = _surfaceType select [1, 99];}; if ((_surfaceType select [0,1]) == "#") then {_surfaceType = _surfaceType select [1, 99];};
if ((_surfaceType != "") || {isClass (configFile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron")}) then { if ((_surfaceType != "") || {isClass (configFile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron")}) then {
_soundEnviron = getText (configFile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron"); private _soundEnviron = getText (configFile >> "CfgSurfaces" >> _surfaceType >> "soundEnviron");
TRACE_2("Dig Down Surface",_surfaceType,_soundEnviron); TRACE_2("Dig Down Surface",_surfaceType,_soundEnviron);
_canDigDown = !(_soundEnviron in ["road", "tarmac", "concrete", "concrete_int", "int_concrete", "concrete_ext"]); _canDigDown = !(_soundEnviron in ["road", "tarmac", "concrete", "concrete_int", "int_concrete", "concrete_ext"]);
}; };
@ -75,7 +73,7 @@ if (isNumber (_magazineTrigger >> "digDistance")) then {
}; };
}; };
_explosive = createVehicle [_ammo, _pos, [], 0, "NONE"]; private _explosive = createVehicle [_ammo, _pos, [], 0, "NONE"];
_explosive setPosATL _pos; _explosive setPosATL _pos;
if (!isNull _attachedTo) then { if (!isNull _attachedTo) then {
@ -91,7 +89,7 @@ if (isText(_triggerConfig >> "onPlace") && {[_unit,_explosive,_magazineClass,_tr
//TODO: placing explosives on hills looks funny //TODO: placing explosives on hills looks funny
_pitch = getNumber (_magazineTrigger >> "pitch"); private _pitch = getNumber (_magazineTrigger >> "pitch");
//Globaly set the position and angle: //Globaly set the position and angle:
[QGVAR(place), [_explosive, _dir, _pitch, _unit]] call CBA_fnc_globalEvent; [QGVAR(place), [_explosive, _dir, _pitch, _unit]] call CBA_fnc_globalEvent;

View File

@ -24,12 +24,10 @@
params ["_vehicle", "_unit", "_magClassname"]; params ["_vehicle", "_unit", "_magClassname"];
TRACE_3("params",_vehicle,_unit,_magClassname); TRACE_3("params",_vehicle,_unit,_magClassname);
private ["_isAttachable", "_setupObjectClass", "_supportedTriggers", "_p3dModel"];
//Get setup object vehicle and model: //Get setup object vehicle and model:
_setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> QGVAR(SetupObject)); private _setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> QGVAR(SetupObject));
if (!isClass (configFile >> "CfgVehicles" >> _setupObjectClass)) exitWith {ERROR("Bad Vehicle");}; if (!isClass (configFile >> "CfgVehicles" >> _setupObjectClass)) exitWith {ERROR("Bad Vehicle");};
_p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model"); private _p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model");
if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game! if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game!
[_unit, "forceWalk", "ACE_Explosives", true] call EFUNC(common,statusEffect_set); [_unit, "forceWalk", "ACE_Explosives", true] call EFUNC(common,statusEffect_set);
@ -44,8 +42,8 @@ _unit setVariable [QGVAR(cancelActionEH), [_unit, "zoomtemp", {true}, {GVAR(plac
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _p3dModel; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetModel _p3dModel;
//Make sure it has a trigger that works when attached (eg, no tripwires that only do pressurePlate) //Make sure it has a trigger that works when attached (eg, no tripwires that only do pressurePlate)
_isAttachable = false; private _isAttachable = false;
_supportedTriggers = getArray (configFile >> "CfgMagazines" >> _magClassname >> "ACE_Triggers" >> "SupportedTriggers"); private _supportedTriggers = getArray (configFile >> "CfgMagazines" >> _magClassname >> "ACE_Triggers" >> "SupportedTriggers");
{ {
if ((getNumber (configFile >> "ACE_Triggers" >> _x >> "isAttachable")) == 1) exitWith {_isAttachable = true;}; if ((getNumber (configFile >> "ACE_Triggers" >> _x >> "isAttachable")) == 1) exitWith {_isAttachable = true;};
} forEach _supportedTriggers; } forEach _supportedTriggers;
@ -62,10 +60,8 @@ GVAR(TweakedAngle) = 0;
params ["_args", "_pfID"]; params ["_args", "_pfID"];
_args params ["_unit", "_magClassname", "_setupObjectClass", "_isAttachable"]; _args params ["_unit", "_magClassname", "_setupObjectClass", "_isAttachable"];
private ["_angle", "_attachVehicle", "_badPosition", "_basePosASL", "_cameraAngle", "_distanceFromBase", "_expSetupVehicle", "_index", "_intersectsWith", "_lookDirVector", "_max", "_min", "_modelDir", "_modelOffset", "_modelUp", "_placeAngle", "_realDistance", "_return", "_screenPos", "_testBase", "_testPos", "_testPositionIsValid", "_virtualPosASL"]; private _lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,0,10]) call EFUNC(common,positionToASL));
private _basePosASL = (eyePos _unit);
_lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,0,10]) call EFUNC(common,positionToASL));
_basePosASL = (eyePos _unit);
if (cameraView == "EXTERNAL") then { //If external, show explosive over the right shoulder if (cameraView == "EXTERNAL") then { //If external, show explosive over the right shoulder
_basePosASL = _basePosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0])); _basePosASL = _basePosASL vectorAdd ((positionCameraToWorld [0.3,0,0]) vectorDiff (positionCameraToWorld [0,0,0]));
}; };
@ -74,13 +70,13 @@ GVAR(TweakedAngle) = 0;
_basePosASL set [2, ((_basePosASL select 2) - 0.3)]; _basePosASL set [2, ((_basePosASL select 2) - 0.3)];
_lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,3,10]) call EFUNC(common,positionToASL)); _lookDirVector = ((positionCameraToWorld [0,0,0]) call EFUNC(common,positionToASL)) vectorFromTo ((positionCameraToWorld [0,3,10]) call EFUNC(common,positionToASL));
}; };
_cameraAngle = (_lookDirVector select 0) atan2 (_lookDirVector select 1); private _cameraAngle = (_lookDirVector select 0) atan2 (_lookDirVector select 1);
_testPositionIsValid = { private _testPositionIsValid = {
_testBase = _basePosASL vectorAdd (_lookDirVector vectorMultiply (_this select 0)); private _testBase = _basePosASL vectorAdd (_lookDirVector vectorMultiply (_this select 0));
_return = true; private _return = true;
{ {
_testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)]; private _testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)];
#ifdef DEBUG_MODE_FULL #ifdef DEBUG_MODE_FULL
drawLine3d [(eyePos _unit) call EFUNC(common,ASLToPosition), (_testPos) call EFUNC(common,ASLToPosition), [1,0,0,1]]; drawLine3d [(eyePos _unit) call EFUNC(common,ASLToPosition), (_testPos) call EFUNC(common,ASLToPosition), [1,0,0,1]];
#endif #endif
@ -89,22 +85,22 @@ GVAR(TweakedAngle) = 0;
_return _return
}; };
_distanceFromBase = PLACE_RANGE_MAX; private _distanceFromBase = PLACE_RANGE_MAX;
_badPosition = !([_distanceFromBase] call _testPositionIsValid); private _badPosition = !([_distanceFromBase] call _testPositionIsValid);
_attachVehicle = objNull; private _attachVehicle = objNull;
if (_isAttachable && _badPosition) then { if (_isAttachable && _badPosition) then {
_attachVehicle = objNull; _attachVehicle = objNull;
_testBase = _basePosASL vectorAdd _lookDirVector; private _testBase = _basePosASL vectorAdd _lookDirVector;
{ {
_testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)]; private _testPos = _testBase vectorAdd [0.1 * (_x select 0) * (cos _cameraAngle), 0.1 * (_x select 0) * (sin _cameraAngle), 0.1 * (_x select 1)];
_intersectsWith = lineIntersectsWith [eyePos _unit, _testPos, _unit]; private _intersectsWith = lineIntersectsWith [eyePos _unit, _testPos, _unit];
if (count _intersectsWith == 1) exitWith {_attachVehicle = (_intersectsWith select 0);}; if (count _intersectsWith == 1) exitWith {_attachVehicle = (_intersectsWith select 0);};
} forEach [[0,0], [-1,-1], [1,-1], [-1,1], [1,1]]; } forEach [[0,0], [-1,-1], [1,-1], [-1,1], [1,1]];
if ((!isNull _attachVehicle) && {[PLACE_RANGE_MIN] call _testPositionIsValid} && if ((!isNull _attachVehicle) && {[PLACE_RANGE_MIN] call _testPositionIsValid} &&
{(_attachVehicle isKindOf "Car") || {_attachVehicle isKindOf "Tank"} || {_attachVehicle isKindOf "Air"} || {_attachVehicle isKindOf "Ship"}}) then { {(_attachVehicle isKindOf "Car") || {_attachVehicle isKindOf "Tank"} || {_attachVehicle isKindOf "Air"} || {_attachVehicle isKindOf "Ship"}}) then {
_min = PLACE_RANGE_MIN; private _min = PLACE_RANGE_MIN;
_max = PLACE_RANGE_MAX; private _max = PLACE_RANGE_MAX;
for "_index" from 0 to 6 do { for "_index" from 0 to 6 do {
_distanceFromBase = (_min + _max) / 2; _distanceFromBase = (_min + _max) / 2;
if ([_distanceFromBase] call _testPositionIsValid) then { if ([_distanceFromBase] call _testPositionIsValid) then {
@ -120,7 +116,7 @@ GVAR(TweakedAngle) = 0;
}; };
}; };
_virtualPosASL = _basePosASL vectorAdd (_lookDirVector vectorMultiply _distanceFromBase); private _virtualPosASL = _basePosASL vectorAdd (_lookDirVector vectorMultiply _distanceFromBase);
//Update mouse hint: //Update mouse hint:
if (_badPosition) then { if (_badPosition) then {
@ -160,8 +156,8 @@ GVAR(TweakedAngle) = 0;
(QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; (QGVAR(virtualAmmo) call BIS_fnc_rscLayer) cutText ["", "PLAIN"];
if (GVAR(placeAction) == PLACE_APPROVE) then { if (GVAR(placeAction) == PLACE_APPROVE) then {
_placeAngle = 0; private _placeAngle = 0;
_expSetupVehicle = _setupObjectClass createVehicle (_virtualPosASL call EFUNC(common,ASLToPosition)); private _expSetupVehicle = _setupObjectClass createVehicle (_virtualPosASL call EFUNC(common,ASLToPosition));
TRACE_1("Planting Mass", (getMass _expSetupVehicle)); TRACE_1("Planting Mass", (getMass _expSetupVehicle));
//If the object is too heavy, it can kill a player if it colides //If the object is too heavy, it can kill a player if it colides
@ -173,7 +169,7 @@ GVAR(TweakedAngle) = 0;
_expSetupVehicle setDir _placeAngle; _expSetupVehicle setDir _placeAngle;
_placeAngle = _placeAngle + 180; //CfgAmmos seem to be 180 for some reason _placeAngle = _placeAngle + 180; //CfgAmmos seem to be 180 for some reason
} else { } else {
_modelOffset = _attachVehicle worldToModel (_virtualPosASL call EFUNC(common,ASLToPosition)); private _modelOffset = _attachVehicle worldToModel (_virtualPosASL call EFUNC(common,ASLToPosition));
_placeAngle = _cameraAngle - (getDir _attachVehicle) + 180; _placeAngle = _cameraAngle - (getDir _attachVehicle) + 180;
_expSetupVehicle attachTo [_attachVehicle, _modelOffset]; _expSetupVehicle attachTo [_attachVehicle, _modelOffset];
_expSetupVehicle setVectorDirAndUp [[0,0,-1],[(sin _placeAngle),(cos _placeAngle),0]]; _expSetupVehicle setVectorDirAndUp [[0,0,-1],[(sin _placeAngle),(cos _placeAngle),0]];
@ -191,21 +187,21 @@ GVAR(TweakedAngle) = 0;
}; };
} else { } else {
_screenPos = worldToScreen (_virtualPosASL call EFUNC(common,ASLToPosition)); private _screenPos = worldToScreen (_virtualPosASL call EFUNC(common,ASLToPosition));
if (_badPosition || {_screenPos isEqualTo []}) then { if (_badPosition || {_screenPos isEqualTo []}) then {
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow false;
} else { } else {
//Show the model on the hud in aprox the same size/location as it will be placed: //Show the model on the hud in aprox the same size/location as it will be placed:
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow true; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlShow true;
_realDistance = ((_virtualPosASL call EFUNC(common,ASLToPosition)) distance (positionCameraToWorld [0,0,0])) / ((call CBA_fnc_getFov) select 1); private _realDistance = ((_virtualPosASL call EFUNC(common,ASLToPosition)) distance (positionCameraToWorld [0,0,0])) / ((call CBA_fnc_getFov) select 1);
_screenPos = [(_screenPos select 0), _realDistance, (_screenPos select 1)]; _screenPos = [(_screenPos select 0), _realDistance, (_screenPos select 1)];
((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetPosition _screenPos; ((uiNamespace getVariable [QGVAR(virtualAmmoDisplay), displayNull]) displayCtrl 800851) ctrlSetPosition _screenPos;
_modelDir = [0,0,-1]; private _modelDir = [0,0,-1];
_modelUp = [0,-1,0]; private _modelUp = [0,-1,0];
if (isNull _attachVehicle) then { if (isNull _attachVehicle) then {
_angle = acos (_lookDirVector select 2); private _angle = acos (_lookDirVector select 2);
_modelUp = [0, (cos _angle), (sin _angle)]; _modelUp = [0, (cos _angle), (sin _angle)];
_modelDir = [cos GVAR(TweakedAngle), sin GVAR(TweakedAngle), 0] vectorCrossProduct _modelUp; _modelDir = [cos GVAR(TweakedAngle), sin GVAR(TweakedAngle), 0] vectorCrossProduct _modelUp;
}; };

View File

@ -19,15 +19,12 @@
params ["_unit", "_target"]; params ["_unit", "_target"];
TRACE_2("params",_unit,_target); TRACE_2("params",_unit,_target);
private ["_actionToPlay", "_defuseTime", "_isEOD"];
_target = attachedTo (_target); _target = attachedTo (_target);
_fnc_DefuseTime = { private _fnc_DefuseTime = {
params ["_specialist", "_target"]; params ["_specialist", "_target"];
TRACE_2("defuseTime",_specialist,_target); TRACE_2("defuseTime",_specialist,_target);
private ["_defuseTime"]; private _defuseTime = 5;
_defuseTime = 5;
if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> QGVAR(DefuseTime))) then { if (isNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> QGVAR(DefuseTime))) then {
_defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> QGVAR(DefuseTime)); _defuseTime = getNumber(ConfigFile >> "CfgAmmo" >> typeOf (_target) >> QGVAR(DefuseTime));
}; };
@ -36,7 +33,7 @@ _fnc_DefuseTime = {
}; };
_defuseTime _defuseTime
}; };
_actionToPlay = "MedicOther"; private _actionToPlay = "MedicOther";
if (STANCE _unit == "Prone") then { if (STANCE _unit == "Prone") then {
_actionToPlay = "PutDown"; _actionToPlay = "PutDown";
}; };
@ -49,7 +46,7 @@ if (ACE_player != _unit) then {
[_unit, _actionToPlay] call EFUNC(common,doGesture); [_unit, _actionToPlay] call EFUNC(common,doGesture);
_unit disableAI "MOVE"; _unit disableAI "MOVE";
_unit disableAI "TARGET"; _unit disableAI "TARGET";
_defuseTime = [[_unit] call EFUNC(Common,isEOD), _target] call _fnc_DefuseTime; private _defuseTime = [[_unit] call EFUNC(Common,isEOD), _target] call _fnc_DefuseTime;
[{ [{
params ["_unit", "_target"]; params ["_unit", "_target"];
TRACE_2("defuse finished",_unit,_target); TRACE_2("defuse finished",_unit,_target);
@ -60,8 +57,8 @@ if (ACE_player != _unit) then {
}; };
} else { } else {
[_unit, _actionToPlay] call EFUNC(common,doGesture); [_unit, _actionToPlay] call EFUNC(common,doGesture);
_isEOD = [_unit] call EFUNC(Common,isEOD); private _isEOD = [_unit] call EFUNC(Common,isEOD);
_defuseTime = [_isEOD, _target] call _fnc_DefuseTime; private _defuseTime = [_isEOD, _target] call _fnc_DefuseTime;
if (_isEOD || {!GVAR(RequireSpecialist)}) then { if (_isEOD || {!GVAR(RequireSpecialist)}) then {
[_defuseTime, [_unit,_target], {(_this select 0) call FUNC(defuseExplosive)}, {}, (localize LSTRING(DefusingExplosive)), {true}, ["isNotSwimming"]] call EFUNC(common,progressBar); [_defuseTime, [_unit,_target], {(_this select 0) call FUNC(defuseExplosive)}, {}, (localize LSTRING(DefusingExplosive)), {true}, ["isNotSwimming"]] call EFUNC(common,progressBar);
}; };

View File

@ -18,11 +18,9 @@
params ["_magazineClassname"]; params ["_magazineClassname"];
TRACE_1("params",_magazineClassname); TRACE_1("params",_magazineClassname);
private ["_result", "_config", "_count", "_index"]; private _result = [];
private _config = getArray (ConfigFile >> "CfgMagazines" >> _magazineClassname >> "ACE_Triggers" >> "SupportedTriggers");
_result = []; private _count = count _config;
_config = getArray (ConfigFile >> "CfgMagazines" >> _magazineClassname >> "ACE_Triggers" >> "SupportedTriggers");
_count = count _config;
for "_index" from 0 to (_count - 1) do { for "_index" from 0 to (_count - 1) do {
_result set [_index, ConfigFile >> "ACE_Triggers" >> (_config select _index)]; _result set [_index, ConfigFile >> "ACE_Triggers" >> (_config select _index)];

View File

@ -28,14 +28,13 @@ params ["_vehicle"];
// calculate offset between gunner camera and muzzle position // calculate offset between gunner camera and muzzle position
if !(_vehicle isKindOf "Air") then { if !(_vehicle isKindOf "Air") then {
private ["_gunBeg", "_gunnerView", "_gunBegPos", "_gunnerViewPos", "_viewDiff"];
_gunBeg = getText (_turretConfig >> "gunBeg"); private _gunBeg = getText (_turretConfig >> "gunBeg");
_gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics"); private _gunnerView = getText (_turretConfig >> "memoryPointGunnerOptics");
_gunBegPos = (_vehicle selectionPosition _gunBeg) select 0; private _gunBegPos = (_vehicle selectionPosition _gunBeg) select 0;
_gunnerViewPos = (_vehicle selectionPosition _gunnerView) select 0; private _gunnerViewPos = (_vehicle selectionPosition _gunnerView) select 0;
_viewDiff = _gunBegPos - _gunnerViewPos; private _viewDiff = _gunBegPos - _gunnerViewPos;
_vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], _viewDiff, true]; _vehicle setVariable [format ["%1_%2", QGVAR(ViewDiff), _x], _viewDiff, true];
} else { } else {

View File

@ -17,11 +17,9 @@
if (call FUNC(externalCamera)) exitWith {false}; if (call FUNC(externalCamera)) exitWith {false};
private ["_unit", "_effects"]; private _unit = ACE_player;
_unit = ACE_player; private _effects = GETGLASSES(_unit);
_effects = GETGLASSES(_unit);
_effects set [DIRT, true]; _effects set [DIRT, true];
SETGLASSES(_unit,_effects); SETGLASSES(_unit,_effects);

View File

@ -17,9 +17,7 @@
if (call FUNC(ExternalCamera)) exitWith {}; if (call FUNC(ExternalCamera)) exitWith {};
private ["_unit", "_amount"]; private _unit = ACE_player;
_unit = ACE_player;
if ([_unit] call FUNC(isGogglesVisible)) exitWith { if ([_unit] call FUNC(isGogglesVisible)) exitWith {
GVAR(GogglesEffectsLayer) cutRsc ["RscACE_GogglesEffects", "PLAIN", 2, false]; GVAR(GogglesEffectsLayer) cutRsc ["RscACE_GogglesEffects", "PLAIN", 2, false];
@ -42,7 +40,7 @@ if (GETVAR(_unit,ACE_EyesDamaged,false)) exitWith {
SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT) + 1,0,2)); SETDUST(DAMOUNT,CLAMP(GETDUSTT(DAMOUNT) + 1,0,2));
_amount = 1 - (GETDUSTT(DAMOUNT) * 0.125); private _amount = 1 - (GETDUSTT(DAMOUNT) * 0.125);
GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [_amount, _amount, _amount, _amount], [1, 1, 1, 0]]; GVAR(PostProcessEyes) ppEffectAdjust [1, 1, 0, [0, 0, 0, 0], [_amount, _amount, _amount, _amount], [1, 1, 1, 0]];
GVAR(PostProcessEyes) ppEffectCommit 1; GVAR(PostProcessEyes) ppEffectCommit 1;

View File

@ -28,12 +28,10 @@ if ((getNumber (configFile >> "CfgVehicles" >> (typeOf _player) >> "isPlayableLo
TRACE_1("skipping playable logic",typeOf _player); // VirtualMan_F (placeable logic zeus / spectator) TRACE_1("skipping playable logic",typeOf _player); // VirtualMan_F (placeable logic zeus / spectator)
}; };
private ["_config", "_postProcessColour", "_postProcessTintAmount", "_imagePath"]; private _config = configFile >> "CfgGlasses" >> _glasses;
_config = configFile >> "CfgGlasses" >> _glasses; private _postProcessColour = getArray (_config >> "ACE_Color");
private _postProcessTintAmount = getNumber (_config >> "ACE_TintAmount");
_postProcessColour = getArray (_config >> "ACE_Color");
_postProcessTintAmount = getNumber (_config >> "ACE_TintAmount");
if (_postProcessTintAmount != 0 && {GVAR(UsePP)}) then { if (_postProcessTintAmount != 0 && {GVAR(UsePP)}) then {
_postProcessColour set [3, _postProcessTintAmount/100]; _postProcessColour set [3, _postProcessTintAmount/100];
@ -45,7 +43,7 @@ if (_postProcessTintAmount != 0 && {GVAR(UsePP)}) then {
GVAR(PostProcess) ppEffectCommit 30; GVAR(PostProcess) ppEffectCommit 30;
}; };
_imagePath = getText (_config >> ["ACE_Overlay", "ACE_OverlayCracked"] select GETBROKEN); private _imagePath = getText (_config >> ["ACE_Overlay", "ACE_OverlayCracked"] select GETBROKEN);
if (_imagePath != "") then { if (_imagePath != "") then {
GVAR(GogglesLayer) cutRsc ["RscACE_Goggles", "PLAIN", 1, false]; GVAR(GogglesLayer) cutRsc ["RscACE_Goggles", "PLAIN", 1, false];

View File

@ -15,13 +15,11 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_fnc_underCover"]; private _unit = ACE_player;
_unit = ACE_player;
if (!alive _unit) exitWith {}; if (!alive _unit) exitWith {};
_fnc_underCover = { private _fnc_underCover = {
params ["_unit"]; params ["_unit"];
if (vehicle _unit != _unit && {!isTurnedOut _unit}) exitWith {true}; if (vehicle _unit != _unit && {!isTurnedOut _unit}) exitWith {true};

View File

@ -15,9 +15,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_fnc_underCover"]; private _unit = ACE_player;
_unit = ACE_player;
if (!alive _unit) exitWith {}; if (!alive _unit) exitWith {};
@ -33,10 +31,9 @@ if (GVAR(FrameEvent) select 0) exitWith {
}; };
// check if the unit is affected by rotor wash // check if the unit is affected by rotor wash
private ["_rotorWash", "_safe"];
_rotorWash = GVAR(FrameEvent) select 1; private _rotorWash = GVAR(FrameEvent) select 1;
_safe = false; private _safe = false;
// no rotor wash? remove effects. // no rotor wash? remove effects.
if !(_rotorWash select 0) exitWith { if !(_rotorWash select 0) exitWith {

View File

@ -16,12 +16,10 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit", "_broken", "_effects"]; private _unit = ACE_player;
_unit = ACE_player; private _broken = GETBROKEN;
private _effects = GLASSESDEFAULT;
_broken = GETBROKEN;
_effects = GLASSESDEFAULT;
_effects set [BROKEN, _broken]; _effects set [BROKEN, _broken];
SETGLASSES(_unit,_effects); SETGLASSES(_unit,_effects);

View File

@ -23,9 +23,7 @@ call FUNC(applyDirtEffect);
if (GETBROKEN) exitWith {true}; if (GETBROKEN) exitWith {true};
private ["_config", "_effects"]; private _config = configFile >> "CfgGlasses" >> goggles _unit;
_config = configFile >> "CfgGlasses" >> goggles _unit;
if ((_this select 1) call FUNC(GetExplosionIndex) < getNumber (_config >> "ACE_Resistance")) exitWith {true}; if ((_this select 1) call FUNC(GetExplosionIndex) < getNumber (_config >> "ACE_Resistance")) exitWith {true};
@ -34,7 +32,7 @@ if !([_unit] call FUNC(isGogglesVisible)) exitWith {
true true
}; };
_effects = GETGLASSES(_unit); private _effects = GETGLASSES(_unit);
_effects set [BROKEN, true]; _effects set [BROKEN, true];
SETGLASSES(_unit,_effects); SETGLASSES(_unit,_effects);

View File

@ -24,17 +24,15 @@ if (rain > 0.1) exitWith {true};
// effect only aplies when lying on the ground // effect only aplies when lying on the ground
if (stance _unit != "PRONE") exitWith {true}; if (stance _unit != "PRONE") exitWith {true};
private ["_position", "_particleConfig", "_cloudType", "_surface", "_bullets"];
// check if the unit really is on the ground and not in a building // check if the unit really is on the ground and not in a building
_position = getPosATL _unit; private _position = getPosATL _unit;
if (_position select 2 > 0.2) exitWith {true}; if (_position select 2 > 0.2) exitWith {true};
// get weapon dust effect // get weapon dust effect
_particleConfig = configFile >> "CfgWeapons" >> _weapon >> "GunParticles"; private _particleConfig = configFile >> "CfgWeapons" >> _weapon >> "GunParticles";
_cloudType = ""; private _cloudType = "";
if (isClass (_particleConfig >> "FirstEffect")) then { // @todo read this with custom / non-standard config classnames if (isClass (_particleConfig >> "FirstEffect")) then { // @todo read this with custom / non-standard config classnames
_cloudType = getText (_particleConfig >> "FirstEffect" >> "effectName"); _cloudType = getText (_particleConfig >> "FirstEffect" >> "effectName");
@ -50,7 +48,7 @@ if (_cloudType == "") exitWith {true};
// get if the surface is dusty // get if the surface is dusty
if (surfaceIsWater _position) exitWith {true}; if (surfaceIsWater _position) exitWith {true};
_surface = surfaceType _position select [1]; // cuts of the leading # private _surface = surfaceType _position select [1]; // cuts of the leading #
if (_surface != GVAR(surfaceCache)) then { if (_surface != GVAR(surfaceCache)) then {
GVAR(surfaceCache) = _surface; GVAR(surfaceCache) = _surface;
@ -61,7 +59,7 @@ if (_surface != GVAR(surfaceCache)) then {
if (!GVAR(surfaceCacheIsDust)) exitWith {true}; if (!GVAR(surfaceCacheIsDust)) exitWith {true};
// increment dust value with type bullet // increment dust value with type bullet
_bullets = GETDUSTT(DBULLETS); private _bullets = GETDUSTT(DBULLETS);
if (diag_tickTime - GETDUSTT(DTIME) > 1) then { if (diag_tickTime - GETDUSTT(DTIME) > 1) then {
_bullets = 0; _bullets = 0;

View File

@ -17,9 +17,7 @@
params ["_unit"]; params ["_unit"];
private ["_currentGlasses", "_position"]; private _currentGlasses = goggles _unit;
_currentGlasses = goggles _unit;
if (_currentGlasses == "") exitWith {false}; if (_currentGlasses == "") exitWith {false};
@ -27,6 +25,6 @@ if (_currentGlasses == "") exitWith {false};
if (getNumber (configFile >> "CfgGlasses" >> _currentGlasses >> "ACE_Resistance") == 0) exitWith {false}; if (getNumber (configFile >> "CfgGlasses" >> _currentGlasses >> "ACE_Resistance") == 0) exitWith {false};
// check if in water and has diving goggles or on land and not diving goggles // check if in water and has diving goggles or on land and not diving goggles
_position = getPosASLW _unit; private _position = getPosASLW _unit;
(surfaceIsWater _position && {_position select 2 < 0.25}) isEqualTo (_currentGlasses call FUNC(isDivingGoggles)) // return (surfaceIsWater _position && {_position select 2 < 0.25}) isEqualTo (_currentGlasses call FUNC(isDivingGoggles)) // return

View File

@ -20,8 +20,7 @@ params ["_unit", "_damage"];
TRACE_2("explosion near player",_unit,_damage); TRACE_2("explosion near player",_unit,_damage);
private ["_strength"]; private _strength = (0 max _damage) * 30;
_strength = (0 max _damage) * 30;
if (_strength < 0.01) exitWith {}; if (_strength < 0.01) exitWith {};
// Call inmediately, as it will get pick up later anyway by the update thread // Call inmediately, as it will get pick up later anyway by the update thread

View File

@ -84,4 +84,4 @@ class CfgMagazines {
ammo = "ACE_Hellfire_AGM114N"; ammo = "ACE_Hellfire_AGM114N";
pylonWeapon = QGVAR(launcher_N); pylonWeapon = QGVAR(launcher_N);
}; };
}; };

View File

@ -135,22 +135,20 @@ GVAR(no_cams) sort true;
}; };
}; };
private ["_cam_coord_y", "_cam_coord_x", "_cam_time", "_cam_pos"];
GVAR(logic) setPosATL (GVAR(pos) vectorAdd [0, 0, -5]); GVAR(logic) setPosATL (GVAR(pos) vectorAdd [0, 0, -5]);
GVAR(logic) setDir GVAR(ROTATE); GVAR(logic) setDir GVAR(ROTATE);
GVAR(logic) setVectorUp [0.0001, 0.0001, 1]; GVAR(logic) setVectorUp [0.0001, 0.0001, 1];
GVAR(cam) CameraEffect ["internal", "BACK"]; GVAR(cam) CameraEffect ["internal", "BACK"];
_cam_coord_y = GVAR(ELEVAT) * cos(GVAR(ROTATE)); private _cam_coord_y = GVAR(ELEVAT) * cos(GVAR(ROTATE));
_cam_coord_x = GVAR(ELEVAT) * sin(GVAR(ROTATE)); private _cam_coord_x = GVAR(ELEVAT) * sin(GVAR(ROTATE));
GVAR(cam) camSetRelPos [_cam_coord_x, _cam_coord_y, 2]; GVAR(cam) camSetRelPos [_cam_coord_x, _cam_coord_y, 2];
GVAR(cam) camCommit 0; GVAR(cam) camCommit 0;
ctrlSetText [1, format["%1 m", round(GVAR(pos) select 2)]]; ctrlSetText [1, format["%1 m", round(GVAR(pos) select 2)]];
ctrlSetText [2, format["%1", GVAR(cur_cam) + 1]]; ctrlSetText [2, format["%1", GVAR(cur_cam) + 1]];
_cam_time = CBA_missionTime - (GVAR(huntIR) getVariable [QGVAR(startTime), CBA_missionTime]); private _cam_time = CBA_missionTime - (GVAR(huntIR) getVariable [QGVAR(startTime), CBA_missionTime]);
ctrlSetText [3, format["%1 s", round(_cam_time)]]; ctrlSetText [3, format["%1 s", round(_cam_time)]];
_cam_pos = getPosVisual GVAR(huntIR); private _cam_pos = getPosVisual GVAR(huntIR);
_cam_pos = format ["X = %1, Y = %2", round (_cam_pos select 0), round (_cam_pos select 1)]; _cam_pos = format ["X = %1, Y = %2", round (_cam_pos select 0), round (_cam_pos select 1)];
ctrlSetText [5, _cam_pos]; ctrlSetText [5, _cam_pos];
ctrlSetText [6, ""]; ctrlSetText [6, ""];

View File

@ -33,9 +33,8 @@ if (!hasInterface) exitWith {};
"ACE_HuntIR_Propell" createVehicle (getPosATL _projectile); "ACE_HuntIR_Propell" createVehicle (getPosATL _projectile);
[{ [{
private ["_huntir"];
params ["_position"]; params ["_position"];
_huntir = createVehicle ["ACE_HuntIR", _position, [], 0, "FLY"]; private _huntir = createVehicle ["ACE_HuntIR", _position, [], 0, "FLY"];
_huntir setPosATL _position; _huntir setPosATL _position;
_huntir setVariable [QGVAR(startTime), CBA_missionTime, true]; _huntir setVariable [QGVAR(startTime), CBA_missionTime, true];
[{ [{
@ -44,10 +43,10 @@ if (!hasInterface) exitWith {};
if (isNull _huntir) exitWith { if (isNull _huntir) exitWith {
[_idPFH] call CBA_fnc_removePerFrameHandler; [_idPFH] call CBA_fnc_removePerFrameHandler;
}; };
private ["_parachuteDamage", "_velocity"];
_parachuteDamage = _huntir getHitPointDamage "HitParachute"; private _parachuteDamage = _huntir getHitPointDamage "HitParachute";
if (_parachuteDamage > 0) then { if (_parachuteDamage > 0) then {
_velocity = velocity _huntir; private _velocity = velocity _huntir;
_velocity set [2, -1 min -20 * sqrt(_parachuteDamage)]; _velocity set [2, -1 min -20 * sqrt(_parachuteDamage)];
_huntir setVelocity _velocity; _huntir setVelocity _velocity;
_huntir setVectorUp [0, 0, 1]; _huntir setVectorUp [0, 0, 1];

View File

@ -46,9 +46,8 @@ createDialog QGVAR(cam_dialog_off);
closeDialog 0; closeDialog 0;
}; };
private ["_elapsedTime", "_nearestHuntIRs"]; private _elapsedTime = CBA_missionTime - GVAR(startTime);
_elapsedTime = CBA_missionTime - GVAR(startTime); private _nearestHuntIRs = ACE_player nearEntities ["ACE_HuntIR", HUNTIR_MAX_TRANSMISSION_RANGE];
_nearestHuntIRs = ACE_player nearEntities ["ACE_HuntIR", HUNTIR_MAX_TRANSMISSION_RANGE];
if ((!dialog) || GVAR(done)) exitWith { if ((!dialog) || GVAR(done)) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler; [_this select 1] call CBA_fnc_removePerFrameHandler;

View File

@ -32,9 +32,7 @@ disableSerialization;
#define __CENTER_X 0.70 #define __CENTER_X 0.70
#define __CENTER_Y 0.65 #define __CENTER_Y 0.65
private ["_fnc_correctIt"]; private _fnc_correctIt = {
_fnc_correctIt = {
params ["_pos", "_dir"]; params ["_pos", "_dir"];
if (_dir >= 270 || {_dir <= 90}) then { if (_dir >= 270 || {_dir <= 90}) then {
_pos set [1, (_pos select 1) + __OFFSET_Y] _pos set [1, (_pos select 1) + __OFFSET_Y]
@ -62,12 +60,11 @@ HUNTIR_CAM_ROSE_LAYER_ID cutRsc [QGVAR(cam_rose), "PLAIN"];
[_idPFH] call CBA_fnc_removePerFrameHandler; [_idPFH] call CBA_fnc_removePerFrameHandler;
}; };
private ["_dir", "_x1", "_y1", "_pos"]; private _dir = getDir GVAR(cam); // direction player;
_dir = getDir GVAR(cam); // direction player;
_x1 = __CENTER_X - (__RADIUS * sin(_dir)); private _x1 = __CENTER_X - (__RADIUS * sin(_dir));
_y1 = __CENTER_Y - (__RADIUS * cos(_dir)); private _y1 = __CENTER_Y - (__RADIUS * cos(_dir));
_pos = [[_x1, _y1], _dir] call _fnc_correctIt; private _pos = [[_x1, _y1], _dir] call _fnc_correctIt;
__CHAR_N ctrlSetPosition [_pos select 0, _pos select 1, __WIDTH, __HEIGHT]; __CHAR_N ctrlSetPosition [_pos select 0, _pos select 1, __WIDTH, __HEIGHT];
__CHAR_N ctrlCommit 0; __CHAR_N ctrlCommit 0;

View File

@ -16,8 +16,7 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_ret"]; private _ret = false;
_ret = false;
switch (_this select 1) do { switch (_this select 1) do {
// A = Lower zoom level // A = Lower zoom level

View File

@ -19,12 +19,11 @@
params ["_object", "_typeNum", "_fullPath"]; params ["_object", "_typeNum", "_fullPath"];
private ["_res","_varName","_actionList"]; private _res = _fullPath call FUNC(splitPath);
_res = _fullPath call FUNC(splitPath);
_res params ["_parentPath", "_actionName"]; _res params ["_parentPath", "_actionName"];
_varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum; private _varName = [QGVAR(actions),QGVAR(selfActions)] select _typeNum;
_actionList = _object getVariable [_varName, []]; private _actionList = _object getVariable [_varName, []];
{ {
if (((_x select 0) select 0) isEqualTo _actionName && if (((_x select 0) select 0) isEqualTo _actionName &&
{(_x select 1) isEqualTo _parentPath}) exitWith { {(_x select 1) isEqualTo _parentPath}) exitWith {

View File

@ -19,23 +19,21 @@
params ["_distance"]; params ["_distance"];
private ["_position0", "_position1", "_intersections", "_house", "_door"]; private _position0 = positionCameraToWorld [0, 0, 0];
private _position1 = positionCameraToWorld [0, 0, _distance];
_position0 = positionCameraToWorld [0, 0, 0]; private _intersections = lineIntersectsSurfaces [AGLToASL _position0, AGLToASL _position1, cameraOn, objNull, true, 1, "GEOM"];
_position1 = positionCameraToWorld [0, 0, _distance];
_intersections = lineIntersectsSurfaces [AGLToASL _position0, AGLToASL _position1, cameraOn, objNull, true, 1, "GEOM"];
if (_intersections isEqualTo []) exitWith {[objNull, ""]}; if (_intersections isEqualTo []) exitWith {[objNull, ""]};
_house = _intersections select 0 select 2; private _house = _intersections select 0 select 2;
// shithouse is bugged // shithouse is bugged
if (typeOf _house == "") exitWith {[objNull, ""]}; if (typeOf _house == "") exitWith {[objNull, ""]};
_intersections = [_house, "GEOM"] intersect [_position0, _position1]; _intersections = [_house, "GEOM"] intersect [_position0, _position1];
_door = toLower (_intersections select 0 select 0); private _door = toLower (_intersections select 0 select 0);
if (isNil "_door") exitWith {[_house, ""]}; if (isNil "_door") exitWith {[_house, ""]};

View File

@ -30,7 +30,7 @@ private _ndx = (abs _dx) / ((abs (_bbx)) - 1);
private _ndy = (abs _dy) / ((abs (_bbY)) - 1); private _ndy = (abs _dy) / ((abs (_bbY)) - 1);
private _ndz = (abs _dz) / ((abs (_bbZ)) - 1); private _ndz = (abs _dz) / ((abs (_bbZ)) - 1);
private "_pos"; private _pos = [];
if (_ndx > _ndy) then { if (_ndx > _ndy) then {
if (_ndx > _ndz) then { if (_ndx > _ndz) then {
// _ndx is greater, will colide with x plane first // _ndx is greater, will colide with x plane first

View File

@ -34,7 +34,7 @@ private _ndy = (abs _dy) / ((abs (_bbY)) - 1);
private _ndz = (abs _dz) / ((abs (_bbZ)) - 1); private _ndz = (abs _dz) / ((abs (_bbZ)) - 1);
private "_pos"; private _pos = [];
if (_ndx > _ndy) then { if (_ndx > _ndy) then {
if (_ndx > _ndz) then { if (_ndx > _ndz) then {
// _ndx is greater, will colide with x plane first // _ndx is greater, will colide with x plane first

View File

@ -16,9 +16,7 @@
#include "script_component.hpp" #include "script_component.hpp"
// IGNORE_PRIVATE_WARNING(_target); // IGNORE_PRIVATE_WARNING(_target);
private ["_weaponDir", "_refSystem"]; private _weaponDir = _target weaponDirection currentWeapon _target;
private _refSystem = _weaponDir call EFUNC(common,createOrthonormalReference);
_weaponDir = _target weaponDirection currentWeapon _target;
_refSystem = _weaponDir call EFUNC(common,createOrthonormalReference);
(_target selectionPosition "righthand") vectorAdd ((_refSystem select 2) vectorMultiply 0.1); (_target selectionPosition "righthand") vectorAdd ((_refSystem select 2) vectorMultiply 0.1);

View File

@ -22,7 +22,7 @@ params ["_unit", "_team"];
// display message // display message
if (_unit == ACE_player) then { if (_unit == ACE_player) then {
private "_message"; private _message = "";
if (_team == "MAIN") then { if (_team == "MAIN") then {
_message = localize LSTRING(LeftTeam); _message = localize LSTRING(LeftTeam);

View File

@ -18,14 +18,13 @@
#include "script_component.hpp" #include "script_component.hpp"
params ["_player", "_target", "_weapon"]; params ["_player", "_target", "_weapon"];
private ["_compatibleMags", "_filteredMags", "_magToPass", "_magToPassIndex", "_playerName", "_magToPassDisplayName"];
_compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines"); private _compatibleMags = getArray (configfile >> "CfgWeapons" >> _weapon >> "magazines");
_filteredMags = magazinesAmmoFull _player select {(_x select 0) in _compatibleMags && {!(_x select 2)}}; private _filteredMags = magazinesAmmoFull _player select {(_x select 0) in _compatibleMags && {!(_x select 2)}};
//select magazine with most ammo //select magazine with most ammo
_magToPass = _filteredMags select 0; private _magToPass = _filteredMags select 0;
_magToPassIndex = 0; private _magToPassIndex = 0;
{ {
_x params ["_className", "_ammoCount"]; _x params ["_className", "_ammoCount"];
if ((_ammoCount > (_magToPass select 1)) && (_target canAdd _className)) then { if ((_ammoCount > (_magToPass select 1)) && (_target canAdd _className)) then {
@ -49,6 +48,6 @@ _player removeMagazines _magToPassClassName;
_target addMagazine [_magToPassClassName, _magToPassAmmoCount]; _target addMagazine [_magToPassClassName, _magToPassAmmoCount];
_playerName = [_player] call EFUNC(common,getName); private _playerName = [_player] call EFUNC(common,getName);
_magToPassDisplayName = getText (configFile >> "CfgMagazines" >> _magToPassClassName >> "displayName"); private _magToPassDisplayName = getText (configFile >> "CfgMagazines" >> _magToPassClassName >> "displayName");
[QEGVAR(common,displayTextStructured), [[LSTRING(PassMagazineHint), _playerName, _magToPassDisplayName], 1.5, _target], [_target]] call CBA_fnc_targetEvent; [QEGVAR(common,displayTextStructured), [[LSTRING(PassMagazineHint), _playerName, _magToPassDisplayName], 1.5, _target], [_target]] call CBA_fnc_targetEvent;

View File

@ -15,19 +15,18 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_altitude", "_airDensity", "_densityAltitude", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_windSpeed", "_crosswind", "_headwind"]; private _playerDir = getDir ACE_player;
_playerDir = getDir ACE_player; private _playerAltitude = (getPosASL ACE_player) select 2;
_playerAltitude = (getPosASL ACE_player) select 2; private _temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight);
_temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight); private _humidity = EGVAR(weather,currentHumidity);
_humidity = EGVAR(weather,currentHumidity); private _barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure);
_barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure); private _altitude = EGVAR(common,mapAltitude) + _playerAltitude;
_altitude = EGVAR(common,mapAltitude) + _playerAltitude; private _airDensity = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateAirDensity);
_airDensity = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateAirDensity); private _densityAltitude = _airDensity call EFUNC(weather,calculateDensityAltitude);
_densityAltitude = _airDensity call EFUNC(weather,calculateDensityAltitude); private _chill = [_temperature, _humidity] call EFUNC(weather,calculateWindChill);
_chill = [_temperature, _humidity] call EFUNC(weather,calculateWindChill); private _heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex);
_heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex); private _dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint);
_dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint); private _wetBulb = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateWetBulb);
_wetBulb = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateWetBulb);
if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then { if (isNil QGVAR(MIN) || isNil QGVAR(MAX)) then {
GVAR(MIN) = [0, _playerDir, 0, 0, 0, _temperature, _chill, _humidity, _heatIndex, _dewPoint, _wetBulb, _barometricPressure, _altitude, _densityAltitude]; GVAR(MIN) = [0, _playerDir, 0, 0, 0, _temperature, _chill, _humidity, _heatIndex, _dewPoint, _wetBulb, _barometricPressure, _altitude, _densityAltitude];
@ -47,11 +46,11 @@ if (GVAR(MinAvgMaxMode) == 1) then {
} count [2, 3, 4]; } count [2, 3, 4];
// Wind SPD // Wind SPD
_windSpeed = call FUNC(measureWindSpeed); private _windSpeed = call FUNC(measureWindSpeed);
[2, _windSpeed] call FUNC(updateMemory); [2, _windSpeed] call FUNC(updateMemory);
// CROSSWIND // CROSSWIND
_crosswind = 0; private _crosswind = 0;
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_crosswind = abs(sin(GVAR(RefHeading) - _playerDir) * _windSpeed); _crosswind = abs(sin(GVAR(RefHeading) - _playerDir) * _windSpeed);
} else { } else {
@ -60,7 +59,7 @@ if (GVAR(MinAvgMaxMode) == 1) then {
[3, _crosswind] call FUNC(updateMemory); [3, _crosswind] call FUNC(updateMemory);
// HEADWIND // HEADWIND
_headwind = 0; private _headwind = 0;
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
_headwind = cos(GVAR(RefHeading) - _playerDir) * _windSpeed; _headwind = cos(GVAR(RefHeading) - _playerDir) * _windSpeed;
} else { } else {

View File

@ -33,48 +33,46 @@
if (diag_tickTime - GVAR(headingSetDisplayTimer) < 0.8) exitWith {["", "", " Heading Set", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]}; if (diag_tickTime - GVAR(headingSetDisplayTimer) < 0.8) exitWith {["", "", " Heading Set", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]};
private ["_playerDir", "_playerAltitude", "_temperature", "_humidity", "_barometricPressure", "_airDensity", "_densityAltitude", "_chill", "_heatIndex", "_dewPoint", "_wetBulb", "_dayString", "_monthString", "_windSpeed", "_windDir", "_textTop", "_textCenterBig", "_textCenter", "_textCenterLine1Left", "_textCenterLine2Left", "_textCenterLine3Left", "_textCenterLine1Right", "_textCenterLine2Right", "_textCenterLine3Right", "_textInfoLine1", "_textInfoLine2", "_textBottomBig", "_textCenterLine1", "_textCenterLine2", "_textCenterLine3", "_textCenterLine4", "_textCenterLine5", "_textCenterLine6"];
[] call FUNC(collectData); [] call FUNC(collectData);
_textTop = GVAR(Menus) select GVAR(Menu); private _textTop = GVAR(Menus) select GVAR(Menu);
_textCenterBig = ""; private _textCenterBig = "";
_textCenter = ""; private _textCenter = "";
_textCenterLine1Left = ""; private _textCenterLine1Left = "";
_textCenterLine2Left = ""; private _textCenterLine2Left = "";
_textCenterLine3Left = ""; private _textCenterLine3Left = "";
_textCenterLine1Right = ""; private _textCenterLine1Right = "";
_textCenterLine2Right = ""; private _textCenterLine2Right = "";
_textCenterLine3Right = ""; private _textCenterLine3Right = "";
_textInfoLine1 = ""; private _textInfoLine1 = "";
_textInfoLine2 = ""; private _textInfoLine2 = "";
_textBottomBig = ""; private _textBottomBig = "";
_textCenterLine1 = ""; private _textCenterLine1 = "";
_textCenterLine2 = ""; private _textCenterLine2 = "";
_textCenterLine3 = ""; private _textCenterLine3 = "";
_textCenterLine4 = ""; private _textCenterLine4 = "";
_textCenterLine5 = ""; private _textCenterLine5 = "";
_textCenterLine6 = ""; private _textCenterLine6 = "";
_windSpeed = call FUNC(measureWindSpeed); private _windSpeed = call FUNC(measureWindSpeed);
_windDir = (ACE_wind select 0) atan2 (ACE_wind select 1); private _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
_playerDir = getDir ACE_player; private _playerDir = getDir ACE_player;
_playerAltitude = (getPosASL ACE_player) select 2; private _playerAltitude = (getPosASL ACE_player) select 2;
_temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight); private _temperature = _playerAltitude call EFUNC(weather,calculateTemperatureAtHeight);
_humidity = EGVAR(weather,currentHumidity); private _humidity = EGVAR(weather,currentHumidity);
_barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure); private _barometricPressure = _playerAltitude call EFUNC(weather,calculateBarometricPressure);
_airDensity = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateAirDensity); private _airDensity = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateAirDensity);
_densityAltitude = _airDensity call EFUNC(weather,calculateDensityAltitude); private _densityAltitude = _airDensity call EFUNC(weather,calculateDensityAltitude);
_chill = [_temperature, _humidity] call EFUNC(weather,calculateWindChill); private _chill = [_temperature, _humidity] call EFUNC(weather,calculateWindChill);
_heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex); private _heatIndex = [_temperature, _humidity] call EFUNC(weather,calculateHeatIndex);
_dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint); private _dewPoint = [_temperature, _humidity] call EFUNC(weather,calculateDewPoint);
_wetBulb = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateWetBulb); private _wetBulb = [_temperature, _barometricPressure, _humidity] call EFUNC(weather,calculateWetBulb);
GVAR(Direction) = 4 * floor(_playerDir / 90); GVAR(Direction) = 4 * floor(_playerDir / 90);
if (_playerDir % 90 > 10) then { GVAR(Direction) = GVAR(Direction) + 1}; if (_playerDir % 90 > 10) then { GVAR(Direction) = GVAR(Direction) + 1};
@ -87,8 +85,8 @@ if (GVAR(referenceHeadingMenu) == 0) then {
switch (GVAR(Menu)) do { switch (GVAR(Menu)) do {
case 0: { // Date case 0: { // Date
date params ["_year", "_month", "_day"]; date params ["_year", "_month", "_day"];
_dayString = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] select (date call FUNC(dayOfWeek)); private _dayString = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] select (date call FUNC(dayOfWeek));
_monthString = localize (["str_january","str_february","str_march","str_april","str_may","str_june","str_july","str_august","str_september","str_october","str_november","str_december"] select (_month - 1)); private _monthString = localize (["str_january","str_february","str_march","str_april","str_may","str_june","str_july","str_august","str_september","str_october","str_november","str_december"] select (_month - 1));
_textTop = _dayString; _textTop = _dayString;
_textCenter = format["%1 %2 %3", _day, _monthString, _year]; _textCenter = format["%1 %2 %3", _day, _monthString, _year];
_textBottomBig = [daytime, "HH:MM:SS"] call bis_fnc_timeToString; _textBottomBig = [daytime, "HH:MM:SS"] call bis_fnc_timeToString;

View File

@ -15,11 +15,9 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_playerDir", "_windSpeed", "_windDir"]; private _playerDir = getDir ACE_player;
private _windSpeed = vectorMagnitude ACE_wind;
_playerDir = getDir ACE_player; private _windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
_windSpeed = vectorMagnitude ACE_wind;
_windDir = (ACE_wind select 0) atan2 (ACE_wind select 1);
if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then {
// With wind gradient // With wind gradient
_windSpeed = [eyePos ACE_player, true, true, true] call EFUNC(weather,calculateWindSpeed); _windSpeed = [eyePos ACE_player, true, true, true] call EFUNC(weather,calculateWindSpeed);

View File

@ -27,11 +27,10 @@
//Add deviceKey entry: //Add deviceKey entry:
private ["_conditonCode", "_toggleCode", "_closeCode"]; private _conditonCode = {
_conditonCode = {
[] call FUNC(canShow); [] call FUNC(canShow);
}; };
_toggleCode = { private _toggleCode = {
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {}; if !([ACE_player, objNull, []] call EFUNC(common,canInteractWith)) exitWith {};
@ -44,7 +43,7 @@ _toggleCode = {
[] call FUNC(createKestrelDialog); [] call FUNC(createKestrelDialog);
}; };
}; };
_closeCode = { private _closeCode = {
// Statement // Statement
if (GVAR(Overlay)) then { if (GVAR(Overlay)) then {
//If dispaly is open, close it: //If dispaly is open, close it:

View File

@ -19,17 +19,15 @@
params ["_unit", "_fenceObject"]; params ["_unit", "_fenceObject"];
TRACE_2("params",_unit,_fenceObject); TRACE_2("params",_unit,_fenceObject);
private ["_timeToCut", "_progressCheck", "_onCompletion", "_onFail"];
if (_unit != ACE_player) exitWith {}; if (_unit != ACE_player) exitWith {};
_timeToCut = if ([_unit] call EFUNC(common,isEngineer)) then {7.5} else {11}; private _timeToCut = if ([_unit] call EFUNC(common,isEngineer)) then {7.5} else {11};
if !(_unit call EFUNC(common,isSwimming)) then { if !(_unit call EFUNC(common,isSwimming)) then {
[_unit, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation); [_unit, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation);
}; };
_onCompletion = { private _onCompletion = {
TRACE_1("_onCompletion",_this); TRACE_1("_onCompletion",_this);
(_this select 0) params ["_fenceObject", "", "_unit"]; (_this select 0) params ["_fenceObject", "", "_unit"];
_fenceObject setdamage 1; _fenceObject setdamage 1;
@ -38,7 +36,7 @@ _onCompletion = {
}; };
}; };
_onFail = { private _onFail = {
TRACE_1("_onFail", _this); TRACE_1("_onFail", _this);
(_this select 0) params ["", "", "_unit"]; (_this select 0) params ["", "", "_unit"];
if !(_unit call EFUNC(common,isSwimming)) then { if !(_unit call EFUNC(common,isSwimming)) then {
@ -46,7 +44,7 @@ _onFail = {
}; };
}; };
_progressCheck = { private _progressCheck = {
params ["_args", "_passedTime"]; params ["_args", "_passedTime"];
_args params ["_fenceObject", "_lastSoundEffectTime", "_unit"]; _args params ["_fenceObject", "_lastSoundEffectTime", "_unit"];

View File

@ -27,7 +27,6 @@ if (!("ACE_wirecutter" in (items ace_player))) exitWith {};
TRACE_1("Starting wire-cut action PFEH",_interactionType); TRACE_1("Starting wire-cut action PFEH",_interactionType);
[{ [{
private ["_fncStatement", "_attachedFence", "_fncCondition", "_helper", "_action"];
params ["_args", "_pfID"]; params ["_args", "_pfID"];
_args params ["_setPosition", "_addedHelpers", "_fencesHelped"]; _args params ["_setPosition", "_addedHelpers", "_fencesHelped"];
@ -41,11 +40,11 @@ TRACE_1("Starting wire-cut action PFEH",_interactionType);
//If player moved >5 meters from last pos, then rescan //If player moved >5 meters from last pos, then rescan
if (((getPosASL ace_player) distance _setPosition) > 5) then { if (((getPosASL ace_player) distance _setPosition) > 5) then {
_fncStatement = { private _fncStatement = {
params ["", "_player", "_attachedFence"]; params ["", "_player", "_attachedFence"];
[_player, _attachedFence] call FUNC(cutDownFence); [_player, _attachedFence] call FUNC(cutDownFence);
}; };
_fncCondition = { private _fncCondition = {
params ["_helper", "_player", "_attachedFence"]; params ["_helper", "_player", "_attachedFence"];
if (!([_player, _attachedFence, ["isNotSwimming"]] call EFUNC(common,canInteractWith))) exitWith {false}; if (!([_player, _attachedFence, ["isNotSwimming"]] call EFUNC(common,canInteractWith))) exitWith {false};
((!isNull _attachedFence) && {(damage _attachedFence) < 1} && {("ACE_wirecutter" in (items _player))} && { ((!isNull _attachedFence) && {(damage _attachedFence) < 1} && {("ACE_wirecutter" in (items _player))} && {
@ -60,8 +59,8 @@ TRACE_1("Starting wire-cut action PFEH",_interactionType);
if (!(_x in _fencesHelped)) then { if (!(_x in _fencesHelped)) then {
if ([_x] call FUNC(isFence)) then { if ([_x] call FUNC(isFence)) then {
_fencesHelped pushBack _x; _fencesHelped pushBack _x;
_helper = "ACE_LogicDummy" createVehicleLocal (getpos _x); private _helper = "ACE_LogicDummy" createVehicleLocal (getpos _x);
_action = [QGVAR(helperCutFence), (localize LSTRING(CutFence)), QPATHTOF(ui\wirecutter_ca.paa), _fncStatement, _fncCondition, {}, _x, {[0,0,0]}, 5.5, [false, false, false, false, true]] call EFUNC(interact_menu,createAction); private _action = [QGVAR(helperCutFence), (localize LSTRING(CutFence)), QPATHTOF(ui\wirecutter_ca.paa), _fncStatement, _fncCondition, {}, _x, {[0,0,0]}, 5.5, [false, false, false, false, true]] call EFUNC(interact_menu,createAction);
[_helper, 0, [],_action] call EFUNC(interact_menu,addActionToObject); [_helper, 0, [],_action] call EFUNC(interact_menu,addActionToObject);
_helper setPosASL ((getPosASL _x) vectorAdd [0,0,1.25]); _helper setPosASL ((getPosASL _x) vectorAdd [0,0,1.25]);
_addedHelpers pushBack _helper; _addedHelpers pushBack _helper;

View File

@ -23,12 +23,12 @@ STACK TRACING
//#define DEBUG_EVENTS //#define DEBUG_EVENTS
#ifdef ENABLE_CALLSTACK #ifdef ENABLE_CALLSTACK
#define CALLSTACK(function) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'ANON', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'ANON'; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;} #define CALLSTACK(function) {if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'ANON', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'ANON'; private _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#define CALLSTACK_NAMED(function, functionName) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, functionName, _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = functionName; _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;} #define CALLSTACK_NAMED(function, functionName) {if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, functionName, _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = functionName; private _ret = _this call ##function; ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#define DUMPSTACK ([__FILE__, __LINE__] call ACE_DUMPSTACK_FNC) #define DUMPSTACK ([__FILE__, __LINE__] call ACE_DUMPSTACK_FNC)
#define FUNC(var1) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(ADDON,fnc,var1)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(ADDON,fnc,var1)'; _ret = _this call TRIPLES(ADDON,fnc,var1); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;} #define FUNC(var1) {if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(ADDON,fnc,var1)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(ADDON,fnc,var1)'; private _ret = _this call TRIPLES(ADDON,fnc,var1); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#define EFUNC(var1,var2) {private ['_ret']; if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)'; _ret = _this call TRIPLES(DOUBLES(PREFIX,var1),fnc,var2); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;} #define EFUNC(var1,var2) {if(ACE_IS_ERRORED) then { ['AUTO','AUTO'] call ACE_DUMPSTACK_FNC; ACE_IS_ERRORED = false; }; ACE_IS_ERRORED = true; ACE_STACK_TRACE set [ACE_STACK_DEPTH, [diag_tickTime, __FILE__, __LINE__, ACE_CURRENT_FUNCTION, 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)', _this]]; ACE_STACK_DEPTH = ACE_STACK_DEPTH + 1; ACE_CURRENT_FUNCTION = 'TRIPLES(DOUBLES(PREFIX,var1),fnc,var2)'; private _ret = _this call TRIPLES(DOUBLES(PREFIX,var1),fnc,var2); ACE_STACK_DEPTH = ACE_STACK_DEPTH - 1; ACE_IS_ERRORED = false; _ret;}
#else #else
#define CALLSTACK(function) function #define CALLSTACK(function) function
#define CALLSTACK_NAMED(function, functionName) function #define CALLSTACK_NAMED(function, functionName) function
@ -40,7 +40,7 @@ STACK TRACING
PERFORMANCE COUNTERS SECTION PERFORMANCE COUNTERS SECTION
**/ **/
//#define ENABLE_PERFORMANCE_COUNTERS //#define ENABLE_PERFORMANCE_COUNTERS
// To Use: [] call ace_common_fnc_dumpPerformanceCounters; // To Use: [] call ace_common_fnc_dumpPerformanceCounters;
#ifdef ENABLE_PERFORMANCE_COUNTERS #ifdef ENABLE_PERFORMANCE_COUNTERS
#define CBA_fnc_addPerFrameHandler { _ret = [(_this select 0), (_this select 1), (_this select 2), #function] call CBA_fnc_addPerFrameHandler; if(isNil "ACE_PFH_COUNTER" ) then { ACE_PFH_COUNTER=[]; }; ACE_PFH_COUNTER pushBack [[_ret, __FILE__, __LINE__], [(_this select 0), (_this select 1), (_this select 2)]]; _ret } #define CBA_fnc_addPerFrameHandler { _ret = [(_this select 0), (_this select 1), (_this select 2), #function] call CBA_fnc_addPerFrameHandler; if(isNil "ACE_PFH_COUNTER" ) then { ACE_PFH_COUNTER=[]; }; ACE_PFH_COUNTER pushBack [[_ret, __FILE__, __LINE__], [(_this select 0), (_this select 1), (_this select 2)]]; _ret }

View File

@ -107,7 +107,6 @@ GVAR(effectTimeBlood) = CBA_missionTime;
// MAIN EFFECTS LOOP // MAIN EFFECTS LOOP
[{ [{
private ["_bleeding", "_blood"];
// Zeus interface is open or player is dead; disable everything // Zeus interface is open or player is dead; disable everything
if (!(isNull curatorCamera) or !(alive ACE_player)) exitWith { if (!(isNull curatorCamera) or !(alive ACE_player)) exitWith {
GVAR(effectUnconsciousCC) ppEffectEnable false; GVAR(effectUnconsciousCC) ppEffectEnable false;
@ -148,7 +147,7 @@ GVAR(effectTimeBlood) = CBA_missionTime;
}; };
}; };
_bleeding = [ACE_player] call FUNC(getBloodLoss); private _bleeding = [ACE_player] call FUNC(getBloodLoss);
// Bleeding Indicator // Bleeding Indicator
if (_bleeding > 0 and GVAR(effectTimeBlood) + 3.5 < CBA_missionTime) then { if (_bleeding > 0 and GVAR(effectTimeBlood) + 3.5 < CBA_missionTime) then {
GVAR(effectTimeBlood) = CBA_missionTime; GVAR(effectTimeBlood) = CBA_missionTime;
@ -156,7 +155,7 @@ GVAR(effectTimeBlood) = CBA_missionTime;
}; };
// Blood Volume Effect // Blood Volume Effect
_blood = if (GVAR(level) < 2) then { private _blood = if (GVAR(level) < 2) then {
(ACE_player getVariable [QGVAR(bloodVolume), 100]) / 100; (ACE_player getVariable [QGVAR(bloodVolume), 100]) / 100;
} else { } else {
(((ACE_player getVariable [QGVAR(bloodVolume), 100]) - 60) max 0) / 40; (((ACE_player getVariable [QGVAR(bloodVolume), 100]) - 60) max 0) / 40;
@ -177,14 +176,13 @@ GVAR(lastHeartBeatSound) = CBA_missionTime;
// HEARTRATE BASED EFFECTS // HEARTRATE BASED EFFECTS
[{ [{
private ["_heartRate", "_interval", "_minTime", "_sound", "_strength", "_pain"]; private _heartRate = ACE_player getVariable [QGVAR(heartRate), 70];
_heartRate = ACE_player getVariable [QGVAR(heartRate), 70]; private _pain = ACE_player getVariable [QGVAR(pain), 0];
_pain = ACE_player getVariable [QGVAR(pain), 0];
if (GVAR(level) == 1) then { if (GVAR(level) == 1) then {
_heartRate = 60 + 40 * _pain; _heartRate = 60 + 40 * _pain;
}; };
if (_heartRate <= 0) exitWith {}; if (_heartRate <= 0) exitWith {};
_interval = 60 / (_heartRate min 40); private _interval = 60 / (_heartRate min 40);
if ((ACE_player getVariable ["ACE_isUnconscious", false])) then { if ((ACE_player getVariable ["ACE_isUnconscious", false])) then {
if (GVAR(painEffectType) == 1) then { if (GVAR(painEffectType) == 1) then {
@ -198,7 +196,7 @@ GVAR(lastHeartBeatSound) = CBA_missionTime;
// Pain effect, no pain effect in zeus camera // Pain effect, no pain effect in zeus camera
if (isNull curatorCamera) then { if (isNull curatorCamera) then {
_strength = ((_pain - (ACE_player getVariable [QGVAR(painSuppress), 0])) max 0) min 1; private _strength = ((_pain - (ACE_player getVariable [QGVAR(painSuppress), 0])) max 0) min 1;
_strength = _strength * (ACE_player getVariable [QGVAR(painCoefficient), GVAR(painCoefficient)]); _strength = _strength * (ACE_player getVariable [QGVAR(painCoefficient), GVAR(painCoefficient)]);
if (GVAR(painEffectType) == 1) then { if (GVAR(painEffectType) == 1) then {
GVAR(effectPainCC) ppEffectEnable false; GVAR(effectPainCC) ppEffectEnable false;
@ -250,12 +248,12 @@ GVAR(lastHeartBeatSound) = CBA_missionTime;
}; };
if (GVAR(level) >= 2 && {_heartRate > 0}) then { if (GVAR(level) >= 2 && {_heartRate > 0}) then {
_minTime = 60 / _heartRate; private _minTime = 60 / _heartRate;
if (CBA_missionTime - GVAR(lastHeartBeatSound) > _minTime) then { if (CBA_missionTime - GVAR(lastHeartBeatSound) > _minTime) then {
GVAR(lastHeartBeatSound) = CBA_missionTime; GVAR(lastHeartBeatSound) = CBA_missionTime;
// Heart rate sound effect // Heart rate sound effect
if (_heartRate < 60) then { if (_heartRate < 60) then {
_sound = GVAR(heartBeatSounds_Normal) select (random((count GVAR(heartBeatSounds_Normal)) -1)); private _sound = GVAR(heartBeatSounds_Normal) select (random((count GVAR(heartBeatSounds_Normal)) -1));
playSound _sound; playSound _sound;
} else { } else {
if (_heartRate > 150) then { if (_heartRate > 150) then {

View File

@ -16,8 +16,6 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_pain"];
params ["_unit", "_addedPain"]; params ["_unit", "_addedPain"];
//Only run on local units: //Only run on local units:
if (!local _unit) exitWith {ERROR("unit is not local");}; if (!local _unit) exitWith {ERROR("unit is not local");};

View File

@ -17,18 +17,17 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_newUnit", "_class", "_group", "_position", "_side", "_name"];
params ["_oldBody", "_caller"]; params ["_oldBody", "_caller"];
if (alive _oldBody) exitWith {_oldBody}; // we only want to do this for dead bodies if (alive _oldBody) exitWith {_oldBody}; // we only want to do this for dead bodies
_name = _oldBody getVariable ["ACE_name", "unknown"]; private _name = _oldBody getVariable ["ACE_name", "unknown"];
_class = typeOf _oldBody; private _class = typeOf _oldBody;
_side = side _caller; private _side = side _caller;
_group = createGroup _side; private _group = createGroup _side;
_position = getPos _oldBody; private _position = getPos _oldBody;
_newUnit = _group createUnit [typeOf _oldBody, _position, [], 0, "NONE"]; private _newUnit = _group createUnit [typeOf _oldBody, _position, [], 0, "NONE"];
_newUnit setVariable ["ACE_name", _name, true]; _newUnit setVariable ["ACE_name", _name, true];
_newUnit disableAI "TARGET"; _newUnit disableAI "TARGET";

View File

@ -31,7 +31,6 @@ if (_show) then {
("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutRsc [QGVAR(DisplayInformation),"PLAIN"]; ("ACE_MedicalRscDisplayInformation" call BIS_fnc_rscLayer) cutRsc [QGVAR(DisplayInformation),"PLAIN"];
[{ [{
private ["_target", "_display", "_alphaLevel", "_damaged", "_availableSelections", "_openWounds", "_selectionBloodLoss", "_red", "_green", "_blue", "_alphaLevel", "_allInjuryTexts", "_lbCtrl", "_genericMessages"];
params ["_args", "_idPFH"]; params ["_args", "_idPFH"];
_args params ["_target", "_selectionN"]; _args params ["_target", "_selectionN"];

View File

@ -18,10 +18,10 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_unit","_return","_status"];
params ["_unit"]; params ["_unit"];
_status = _unit getVariable [QGVAR(triageLevel), -1];
_return = switch (_status) do { private _status = _unit getVariable [QGVAR(triageLevel), -1];
private _return = switch (_status) do {
case 1: {[localize LSTRING(Triage_Status_Minor), 1, [0, 0.5, 0, 0.9]]}; case 1: {[localize LSTRING(Triage_Status_Minor), 1, [0, 0.5, 0, 0.9]]};
case 2: {[localize LSTRING(Triage_Status_Delayed), 2, [0.7, 0.5, 0, 0.9]]}; case 2: {[localize LSTRING(Triage_Status_Delayed), 2, [0.7, 0.5, 0, 0.9]]};
case 3: {[localize LSTRING(Triage_Status_Immediate), 3, [0.4, 0.07, 0.07, 0.9]]}; case 3: {[localize LSTRING(Triage_Status_Immediate), 3, [0.4, 0.07, 0.07, 0.9]]};

View File

@ -21,7 +21,6 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_className", "_reopeningChance", "_reopeningMinDelay", "_reopeningMaxDelay", "_config", "_woundTreatmentConfig", "_bandagedWounds", "_exist", "_injuryId", "_existingInjury", "_delay", "_openWounds", "_selectedInjury", "_bandagedInjury"];
params ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage"]; params ["_target", "_impact", "_part", "_injuryIndex", "_injury", "_bandage"];
private _classID = _injury select 1; private _classID = _injury select 1;
@ -66,7 +65,7 @@ private _bandagedInjury = [];
{ {
if ((_x select 1) == _injuryType && (_x select 2) == (_injury select 2)) exitwith { if ((_x select 1) == _injuryType && (_x select 2) == (_injury select 2)) exitwith {
_exist = true; _exist = true;
_existingInjury = _x; private _existingInjury = _x;
_existingInjury set [3, (_existingInjury select 3) + _impact]; _existingInjury set [3, (_existingInjury select 3) + _impact];
_bandagedWounds set [_foreachIndex, _existingInjury]; _bandagedWounds set [_foreachIndex, _existingInjury];
@ -85,7 +84,7 @@ _target setVariable [QGVAR(bandagedWounds), _bandagedWounds, true];
TRACE_1("",_reopeningChance); TRACE_1("",_reopeningChance);
// Check if we are ever going to reopen this // Check if we are ever going to reopen this
if (random(1) <= _reopeningChance) then { if (random(1) <= _reopeningChance) then {
_delay = _reopeningMinDelay + random(_reopeningMaxDelay - _reopeningMinDelay); private _delay = _reopeningMinDelay + random(_reopeningMaxDelay - _reopeningMinDelay);
TRACE_1("Will open",_delay); TRACE_1("Will open",_delay);
[{ [{
params ["_target", "_impact", "_part", "_injuryIndex", "_injury"]; params ["_target", "_impact", "_part", "_injuryIndex", "_injury"];
@ -103,7 +102,7 @@ if (random(1) <= _reopeningChance) then {
{ {
if ((_x select 1) == _injuryId && (_x select 2) == (_injury select 2)) exitwith { if ((_x select 1) == _injuryId && (_x select 2) == (_injury select 2)) exitwith {
_exist = true; _exist = true;
_existingInjury = _x; private _existingInjury = _x;
_existingInjury set [3, ((_existingInjury select 3) - _impact) max 0]; _existingInjury set [3, ((_existingInjury select 3) - _impact) max 0];
_bandagedWounds set [_foreachIndex, _existingInjury]; _bandagedWounds set [_foreachIndex, _existingInjury];
}; };

View File

@ -19,11 +19,9 @@
params ["_unit", "_newDamage"]; params ["_unit", "_newDamage"];
private ["_selection", "_totalDamage"]; private _selection = "body";
_selection = "body"; private _totalDamage = (_unit getHit _selection) + _newDamage;
_totalDamage = (_unit getHit _selection) + _newDamage;
_unit setHit [_selection, _totalDamage]; _unit setHit [_selection, _totalDamage];

View File

@ -20,11 +20,10 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_bodyPartn", "_fractures", "_fractureType"];
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"]; params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfDamage"];
_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); private _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
_fractureType = 1; private _fractureType = 1;
if (_amountOfDamage > 0.05) then { if (_amountOfDamage > 0.05) then {
// TODO specify fractures based off typeOfInjury details better. // TODO specify fractures based off typeOfInjury details better.
@ -61,10 +60,9 @@ if (_amountOfDamage > 0.05) then {
}; };
}; };
private ["_fractures", "_fractureID", "_amountOf"]; private _fractures = _unit getVariable[QGVAR(fractures), []];
_fractures = _unit getVariable[QGVAR(fractures), []]; private _fractureID = 1;
_fractureID = 1; private _amountOf = count _fractures;
_amountOf = count _fractures;
if (_amountOf > 0) then { if (_amountOf > 0) then {
_fractureID = (_fractures select (_amountOf - 1) select 0) + 1; _fractureID = (_fractures select (_amountOf - 1) select 0) + 1;
}; };

View File

@ -20,19 +20,18 @@
#include "script_component.hpp" #include "script_component.hpp"
private ["_bodyPartn", "_injuryTypeInfo", "_allInjuriesForDamageType", "_allPossibleInjuries", "_highestPossibleDamage", "_highestPossibleSpot", "_minDamage", "_openWounds", "_woundID", "_toAddInjury", "_painToAdd", "_bloodLoss", "_bodyPartNToAdd", "_classType", "_damageLevels", "_foundIndex", "_i", "_injury", "_maxDamage", "_pain", "_painLevel", "_selections", "_toAddClassID", "_woundsCreated"];
params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"]; params ["_unit", "_selectionName", "_damage", "_typeOfProjectile", "_typeOfDamage"];
TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD Called",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage); TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD Called",_unit, _selectionName, _damage, _shooter, _typeOfProjectile,_typeOfDamage);
// Convert the selectionName to a number and ensure it is a valid selection. // Convert the selectionName to a number and ensure it is a valid selection.
_bodyPartn = [_selectionName] call FUNC(selectionNameToNumber); private _bodyPartn = [_selectionName] call FUNC(selectionNameToNumber);
if (_bodyPartn < 0) exitWith {}; if (_bodyPartn < 0) exitWith {};
// Get the injury type information. Format: [typeDamage thresholds, selectionSpecific, woundTypes] // Get the injury type information. Format: [typeDamage thresholds, selectionSpecific, woundTypes]
_injuryTypeInfo = missionNamespace getVariable [format[QGVAR(woundInjuryType_%1), _typeOfDamage],[[], false, []]]; private _injuryTypeInfo = missionNamespace getVariable [format[QGVAR(woundInjuryType_%1), _typeOfDamage],[[], false, []]];
// This are the available injuries for this damage type. Format [[classtype, selections, bloodloss, minimalDamage, pain], ..] // This are the available injuries for this damage type. Format [[classtype, selections, bloodloss, minimalDamage, pain], ..]
_allInjuriesForDamageType = _injuryTypeInfo select 2; private _allInjuriesForDamageType = _injuryTypeInfo select 2;
// It appears we are dealing with an unknown type of damage. // It appears we are dealing with an unknown type of damage.
if (count _allInjuriesForDamageType == 0) then { if (count _allInjuriesForDamageType == 0) then {
@ -42,20 +41,19 @@ if (count _allInjuriesForDamageType == 0) then {
}; };
// find the available injuries for this damage type and damage amount // find the available injuries for this damage type and damage amount
_highestPossibleSpot = -1; private _highestPossibleSpot = -1;
_highestPossibleDamage = -1; private _highestPossibleDamage = -1;
_allPossibleInjuries = []; private _allPossibleInjuries = [];
{ {
_damageLevels = _x select 4; private _damageLevels = _x select 4;
_minDamage = _damageLevels select 0; _damageLevels params ["_minDamage","_maxDamage"];
_maxDamage = _damageLevels select 1;
// Check if the damage is higher as the min damage for the specific injury // Check if the damage is higher as the min damage for the specific injury
if (_damage >= _minDamage && {_damage <= _maxDamage || _maxDamage < 0}) then { if (_damage >= _minDamage && {_damage <= _maxDamage || _maxDamage < 0}) then {
//_classType = _x select 0; //private _classType = _x select 0;
_selections = _x select 1; private _selections = _x select 1;
//_bloodLoss = _x select 2; //private _bloodLoss = _x select 2;
//_pain = _x select 3; //private _pain = _x select 3;
// Check if the injury can be applied to the given selection name // Check if the injury can be applied to the given selection name
if ("All" in _selections || _selectionName in _selections) then { if ("All" in _selections || _selectionName in _selections) then {
@ -76,21 +74,21 @@ _allPossibleInjuries = [];
if (_highestPossibleSpot < 0) exitWith {}; if (_highestPossibleSpot < 0) exitWith {};
// Administration for open wounds and ids // Administration for open wounds and ids
_openWounds = _unit getVariable[QGVAR(openWounds), []]; private _openWounds = _unit getVariable[QGVAR(openWounds), []];
_woundID = _unit getVariable[QGVAR(lastUniqueWoundID), 1]; private _woundID = _unit getVariable[QGVAR(lastUniqueWoundID), 1];
_painToAdd = 0; private _painToAdd = 0;
_woundsCreated = []; private _woundsCreated = [];
{ {
if (_x select 0 <= _damage) exitWith { if (_x select 0 <= _damage) exitWith {
for "_i" from 0 to ((_x select 1)-1) do { for "_i" from 0 to ((_x select 1)-1) do {
// Find the injury we are going to add. Format [ classID, allowdSelections, bloodloss, painOfInjury, minimalDamage] // Find the injury we are going to add. Format [ classID, allowdSelections, bloodloss, painOfInjury, minimalDamage]
_toAddInjury = if (random(1) >= 0.85) then {_allInjuriesForDamageType select _highestPossibleSpot} else {selectRandom _allPossibleInjuries}; private _toAddInjury = if (random(1) >= 0.85) then {_allInjuriesForDamageType select _highestPossibleSpot} else {selectRandom _allPossibleInjuries};
_toAddClassID = _toAddInjury select 0; private _toAddClassID = _toAddInjury select 0;
_foundIndex = -1; private _foundIndex = -1;
_bodyPartNToAdd = if (_injuryTypeInfo select 1) then {_bodyPartn} else {floor(random(6))}; private _bodyPartNToAdd = if (_injuryTypeInfo select 1) then {_bodyPartn} else {floor(random(6))};
// If the injury type is selection part specific, we will check if one of those injury types already exists and find the spot for it.. // If the injury type is selection part specific, we will check if one of those injury types already exists and find the spot for it..
if ((_injuryTypeInfo select 1)) then { if ((_injuryTypeInfo select 1)) then {
{ {
@ -101,7 +99,7 @@ _woundsCreated = [];
} forEach _openWounds; } forEach _openWounds;
}; };
_injury = []; private _injury = [];
if (_foundIndex < 0) then { if (_foundIndex < 0) then {
// Create a new injury. Format [ID, classID, bodypart, percentage treated, bloodloss rate] // Create a new injury. Format [ID, classID, bodypart, percentage treated, bloodloss rate]
_injury = [_woundID, _toAddInjury select 0, _bodyPartNToAdd, 1, _toAddInjury select 2]; _injury = [_woundID, _toAddInjury select 0, _bodyPartNToAdd, 1, _toAddInjury select 2];
@ -132,6 +130,6 @@ if (count _woundsCreated > 0) then {
_unit setVariable [QGVAR(lastUniqueWoundID), _woundID, true]; _unit setVariable [QGVAR(lastUniqueWoundID), _woundID, true];
}; };
_painLevel = _unit getVariable [QGVAR(pain), 0]; private _painLevel = _unit getVariable [QGVAR(pain), 0];
_unit setVariable [QGVAR(pain), _painLevel + _painToAdd]; _unit setVariable [QGVAR(pain), _painLevel + _painToAdd];
TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD",_unit, _painLevel, _painToAdd, _unit getVariable QGVAR(pain), _unit getVariable QGVAR(openWounds),_woundsCreated); TRACE_6("ACE_DEBUG: HandleDamage_WoundsOLD",_unit, _painLevel, _painToAdd, _unit getVariable QGVAR(pain), _unit getVariable QGVAR(openWounds),_woundsCreated);

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