diff --git a/.gitignore b/.gitignore index 8a7e6945a6..4ad0a5e1eb 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ CHANGELOG.md sqfvm.exe ArmaScriptCompiler.exe *.sqfc +!extras/**/*.zip diff --git a/AUTHORS.txt b/AUTHORS.txt index bcc4a5d40e..a11e39d78e 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -126,6 +126,7 @@ Keithen Kllrt KokaKolaA3 Krzyciu +LAxemann legman Legolasindar "Viper" licht-im-Norden87 @@ -190,3 +191,4 @@ YetheSamartaka xrufix Zakant zGuba +Zman6258 diff --git a/README.md b/README.md index b461bfe520..4951848123 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

- ACE3 Version + ACE3 Version ACE3 Issues diff --git a/addons/advanced_ballistics/functions/fnc_handleFired.sqf b/addons/advanced_ballistics/functions/fnc_handleFired.sqf index a167d027f3..b41fd7a7c0 100644 --- a/addons/advanced_ballistics/functions/fnc_handleFired.sqf +++ b/addons/advanced_ballistics/functions/fnc_handleFired.sqf @@ -17,7 +17,7 @@ */ //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); if (!(_ammo isKindOf "BulletBase")) exitWith {}; if (!alive _projectile) exitWith {}; diff --git a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf index 6af9efca24..89e89b9f7e 100644 --- a/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf +++ b/addons/advanced_ballistics/functions/fnc_initializeTerrainExtension.sqf @@ -22,7 +22,7 @@ private _initStartTime = diag_tickTime; private _mapSize = worldSize; 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); #ifdef DEBUG_MODE_FULL systemChat "AdvancedBallistics: Terrain already initialized"; #endif @@ -33,14 +33,14 @@ private _gridCells = _mapGrids * _mapGrids; GVAR(currentGrid) = 0; -INFO_2("Starting Terrain Extension [cells: %1] [world: %2]", _gridCells, worldName); +INFO_2("Starting Terrain Extension [cells: %1] [world: %2]",_gridCells,worldName); [{ params ["_args","_idPFH"]; _args params ["_mapGrids", "_gridCells", "_initStartTime"]; if (GVAR(currentGrid) >= _gridCells) exitWith { - INFO_2("Finished terrain initialization in %1 seconds [world: %2]", (diag_tickTime - _initStartTime) toFixed 2, worldName); + INFO_2("Finished terrain initialization in %1 seconds [world: %2]",(diag_tickTime - _initStartTime) toFixed 2,worldName); #ifdef DEBUG_MODE_FULL systemChat format["AdvancedBallistics: Finished terrain initialization in %1 seconds", (diag_tickTime - _initStartTime) toFixed 2]; #endif @@ -53,7 +53,7 @@ INFO_2("Starting Terrain Extension [cells: %1] [world: %2]", _gridCells, worldNa private _gridCenter = [_x + 25, _y + 25]; private _gridHeight = round(getTerrainHeightASL _gridCenter); private _gridNumObjects = count (_gridCenter nearObjects ["Building", 50]); - private _gridSurfaceIsWater = if (surfaceIsWater _gridCenter) then {1} else {0}; + private _gridSurfaceIsWater = parseNumber (surfaceIsWater _gridCenter); "ace_advanced_ballistics" callExtension format["set:%1:%2:%3", _gridHeight, _gridNumObjects, _gridSurfaceIsWater]; GVAR(currentGrid) = GVAR(currentGrid) + 1; if (GVAR(currentGrid) >= _gridCells) exitWith {}; diff --git a/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf index 103ce3d1cd..d6081e6f9e 100644 --- a/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readAmmoDataFromConfig.sqf @@ -66,7 +66,7 @@ if ((_typicalSpeed > 0) && {_typicalSpeed < 360}) then { if (_inheritedBarrelConfig || _inheritedTempConfig) then { private _parentConfig = inheritsFrom _ammoConfig; private _parentSpeed = getNumber (_parentConfig >> "typicalSpeed"); - WARNING_4("Subsonic Ammo %1 (%2 m/s) missing `ACE_muzzleVelocities` or `ACE_ammoTempMuzzleVelocityShifts` configs, attempting to use parent %3 (%4m/s)",_this,_typicalSpeed,configName _parentConfig, _parentSpeed); + WARNING_4("Subsonic Ammo %1 (%2 m/s) missing `ACE_muzzleVelocities` or `ACE_ammoTempMuzzleVelocityShifts` configs, attempting to use parent %3 (%4m/s)",_this,_typicalSpeed,configName _parentConfig,_parentSpeed); if (_parentSpeed <= 0) exitWith {//Handle weird or null parent _muzzleVelocityTable = []; _ammoTempMuzzleVelocityShifts = []; diff --git a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf index bf0e23f97c..c79aeaf2ea 100644 --- a/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf +++ b/addons/advanced_ballistics/functions/fnc_readWeaponDataFromConfig.sqf @@ -21,7 +21,7 @@ private _weaponConfig = (configFile >> "CfgWeapons" >> _this); private _barrelTwist = 0 max getNumber(_weaponConfig >> "ACE_barrelTwist"); -private _twistDirection = [0, 1] select (_barrelTwist != 0); +private _twistDirection = parseNumber (_barrelTwist != 0); if (isNumber (_weaponConfig >> "ACE_twistDirection")) then { _twistDirection = getNumber (_weaponConfig >> "ACE_twistDirection"); if !(_twistDirection in [-1, 0, 1]) then { diff --git a/addons/advanced_fatigue/XEH_postInit.sqf b/addons/advanced_fatigue/XEH_postInit.sqf index 57b57dcf22..db4a9d9c5e 100644 --- a/addons/advanced_fatigue/XEH_postInit.sqf +++ b/addons/advanced_fatigue/XEH_postInit.sqf @@ -60,7 +60,7 @@ if (!hasInterface) exitWith {}; }, true] call CBA_fnc_addPlayerEventHandler; // - Duty factors ------------------------------------------------------------- - if (["ace_medical"] call EFUNC(common,isModLoaded)) then { + if (GVAR(medicalLoaded)) then { [QEGVAR(medical,pain), { // 0->1.0, 0.5->1.05, 1->1.1 linearConversion [0, 1, (_this getVariable [QEGVAR(medical,pain), 0]), 1, 1.1, true]; }] call FUNC(addDutyFactor); diff --git a/addons/advanced_fatigue/XEH_preInit.sqf b/addons/advanced_fatigue/XEH_preInit.sqf index 643b7b0be0..9f58e44fdf 100644 --- a/addons/advanced_fatigue/XEH_preInit.sqf +++ b/addons/advanced_fatigue/XEH_preInit.sqf @@ -13,5 +13,6 @@ GVAR(dutyList) = createHashMap; GVAR(setAnimExclusions) = []; GVAR(inertia) = 0; GVAR(inertiaCache) = createHashMap; +GVAR(medicalLoaded) = ["ace_medical"] call EFUNC(common,isModLoaded); ADDON = true; diff --git a/addons/advanced_fatigue/functions/fnc_mainLoop.sqf b/addons/advanced_fatigue/functions/fnc_mainLoop.sqf index 8903bab495..da469b6d21 100644 --- a/addons/advanced_fatigue/functions/fnc_mainLoop.sqf +++ b/addons/advanced_fatigue/functions/fnc_mainLoop.sqf @@ -23,6 +23,12 @@ if (!alive ACE_player) exitWith { _staminaBarContainer ctrlCommit 1; }; + +private _oxygen = 0.9; // Default AF oxygen saturation +if (GVAR(medicalLoaded) && {EGVAR(medical_vitals,simulateSpo2)}) then { + _oxygen = (ACE_player getVariable [QEGVAR(medical,spo2), 97]) / 100; +}; + private _currentWork = REE; private _currentSpeed = (vectorMagnitude (velocity ACE_player)) min 6; @@ -42,8 +48,8 @@ GVAR(muscleDamage) = (GVAR(muscleDamage) + (_currentWork / GVAR(peakPower)) ^ 3. private _muscleIntegritySqrt = sqrt (1 - GVAR(muscleDamage)); // Calculate available power -private _ae1PathwayPowerFatigued = GVAR(ae1PathwayPower) * sqrt (GVAR(ae1Reserve) / AE1_MAXRESERVE) * OXYGEN * _muscleIntegritySqrt; -private _ae2PathwayPowerFatigued = GVAR(ae2PathwayPower) * sqrt (GVAR(ae2Reserve) / AE2_MAXRESERVE) * OXYGEN * _muscleIntegritySqrt; +private _ae1PathwayPowerFatigued = GVAR(ae1PathwayPower) * sqrt (GVAR(ae1Reserve) / AE1_MAXRESERVE) * _oxygen * _muscleIntegritySqrt; +private _ae2PathwayPowerFatigued = GVAR(ae2PathwayPower) * sqrt (GVAR(ae2Reserve) / AE2_MAXRESERVE) * _oxygen * _muscleIntegritySqrt; // Calculate how much power is consumed from each reserve private _ae1Power = _currentWork min _ae1PathwayPowerFatigued; @@ -58,8 +64,8 @@ GVAR(anReserve) = GVAR(anReserve) - _anPower / WATTSPERATP; GVAR(anFatigue) = GVAR(anFatigue) + _anPower * (0.057 / GVAR(peakPower)) * 1.1; // Aerobic ATP reserve recovery -GVAR(ae1Reserve) = ((GVAR(ae1Reserve) + OXYGEN * 6.60 * (GVAR(ae1PathwayPower) - _ae1Power) / GVAR(ae1PathwayPower) * GVAR(recoveryFactor)) min AE1_MAXRESERVE) max 0; -GVAR(ae2Reserve) = ((GVAR(ae2Reserve) + OXYGEN * 5.83 * (GVAR(ae2PathwayPower) - _ae2Power) / GVAR(ae2PathwayPower) * GVAR(recoveryFactor)) min AE2_MAXRESERVE) max 0; +GVAR(ae1Reserve) = ((GVAR(ae1Reserve) + _oxygen * 6.60 * (GVAR(ae1PathwayPower) - _ae1Power) / GVAR(ae1PathwayPower) * GVAR(recoveryFactor)) min AE1_MAXRESERVE) max 0; +GVAR(ae2Reserve) = ((GVAR(ae2Reserve) + _oxygen * 5.83 * (GVAR(ae2PathwayPower) - _ae2Power) / GVAR(ae2PathwayPower) * GVAR(recoveryFactor)) min AE2_MAXRESERVE) max 0; // Anaerobic ATP reserver and fatigue recovery GVAR(anReserve) = ((GVAR(anReserve) @@ -70,9 +76,9 @@ GVAR(anFatigue) = ((GVAR(anFatigue) - (_ae1PathwayPowerFatigued + _ae2PathwayPowerFatigued - _ae1Power - _ae2Power) * (0.057 / GVAR(peakPower)) * GVAR(anFatigue) ^ 2 * GVAR(recoveryFactor) ) min 1) max 0; -private _aeReservePercentage = (GVAR(ae1Reserve) / AE1_MAXRESERVE + GVAR(ae2Reserve) / AE2_MAXRESERVE) / 2; -private _anReservePercentage = GVAR(anReserve) / AN_MAXRESERVE; -private _perceivedFatigue = 1 - (_anReservePercentage min _aeReservePercentage); +GVAR(aeReservePercentage) = (GVAR(ae1Reserve) / AE1_MAXRESERVE + GVAR(ae2Reserve) / AE2_MAXRESERVE) / 2; +GVAR(anReservePercentage) = GVAR(anReserve) / AN_MAXRESERVE; +private _perceivedFatigue = 1 - (GVAR(anReservePercentage) min GVAR(aeReservePercentage)); [ACE_player, _perceivedFatigue, _currentSpeed, GVAR(anReserve) == 0] call FUNC(handleEffects); diff --git a/addons/ai/functions/fnc_garrison.sqf b/addons/ai/functions/fnc_garrison.sqf index ead982d951..0f9613dd9f 100644 --- a/addons/ai/functions/fnc_garrison.sqf +++ b/addons/ai/functions/fnc_garrison.sqf @@ -7,8 +7,8 @@ * 0: The building(s) nearest this position are used * 1: Limit the building search to those type of building * 2: Units that will be garrisoned - * 3: Radius to fill building(s) (default: 50) - * 4: 0: even filling, 1: building by building, 2: random filling (default: 0) + * 3: Radius to fill building(s) (default: 50) + * 4: 0: even filling, 1: building by building, 2: random filling (default: 0) * 5: True to fill building(s) from top to bottom (default: false) (note: only works with filling mode 0 and 1) * 6: Teleport units (default: false) @@ -128,7 +128,7 @@ switch (_fillingType) do { } else { private _pos = _building select 0; private _nearestUnits = (_pos nearEntities ["CAManBase", 2]); - LOG(format [ARR_3("fnc_garrison: Unit detection | %1 units nearby | %2 units within height",count _nearestUnits, {floor ((getPos _x) select 2) == floor (_pos select 2)} count _nearestUnits)]); + LOG(format [ARR_3("fnc_garrison: Unit detection | %1 units nearby | %2 units within height",count _nearestUnits,{floor ((getPos _x) select 2) == floor (_pos select 2)} count _nearestUnits)]); if (count _nearestUnits > 0 && {[_nearestUnits, _pos] call _fnc_comparePos}) then { LOG(format [ARR_2("fnc_garrison: Unit present | removing position | %1 positions remaining for this building",count (_buildingsIndex select (_buildingsIndex find _building)) - 1)]); @@ -177,7 +177,7 @@ switch (_fillingType) do { } else { private _pos = _building select 0; private _nearestUnits = (_pos nearEntities ["CAManBase", 2]); - LOG(format [ARR_3("fnc_garrison: Unit detection | %1 units nearby | %2 units within height",count _nearestUnits, {floor ((getPos _x) select 2) == floor (_pos select 2)} count _nearestUnits)]); + LOG(format [ARR_3("fnc_garrison: Unit detection | %1 units nearby | %2 units within height",count _nearestUnits,{floor ((getPos _x) select 2) == floor (_pos select 2)} count _nearestUnits)]); if (count _nearestUnits > 0 && {[_nearestUnits, _pos] call _fnc_comparePos}) then { LOG(format [ARR_2("fnc_garrison: Unit present | removing position | %1 positions remaining for this building",count (_buildingsIndex select (_buildingsIndex find _building)) - 1)]); @@ -224,7 +224,7 @@ switch (_fillingType) do { } else { private _pos = selectRandom _building; private _nearestUnits = (_pos nearEntities ["CAManBase", 2]); - LOG(format [ARR_3("fnc_garrison: Unit detection | %1 units nearby | %2 units within height",count _nearestUnits, {floor ((getPos _x) select 2) == floor (_pos select 2)} count _nearestUnits)]); + LOG(format [ARR_3("fnc_garrison: Unit detection | %1 units nearby | %2 units within height",count _nearestUnits,{floor ((getPos _x) select 2) == floor (_pos select 2)} count _nearestUnits)]); if (count _nearestUnits > 0 && {[_nearestUnits, _pos] call _fnc_comparePos}) then { LOG(format [ARR_2("fnc_garrison: Unit present | removing position | %1 positions remaining for this building",count (_buildingsIndex select (_buildingsIndex find _building)) - 1)]); @@ -258,7 +258,7 @@ switch (_fillingType) do { }; }; -TRACE_1(format [ARR_2("fnc_garrison: while loop ended | %1 units ready to be treated by PFH",count _unitMoveList)], _teleport); +TRACE_1(format [ARR_2("fnc_garrison: while loop ended | %1 units ready to be treated by PFH",count _unitMoveList)],_teleport); // Update the unit list and remove duplicate positions and units private _garrison_unitMoveList = missionNameSpace getVariable [QGVAR(garrison_unitMoveList), []]; @@ -279,5 +279,5 @@ if (_teleport) then { [_unitMoveList] call FUNC(garrisonMove); }; -TRACE_1(format [ARR_3("fnc_garrison: End | %1 units left | %2 buildings left", count _unitsArray, count _buildingsIndex)], _unitsArray); +TRACE_1(format [ARR_3("fnc_garrison: End | %1 units left | %2 buildings left",count _unitsArray,count _buildingsIndex)],_unitsArray); _unitsArray diff --git a/addons/ai/functions/fnc_garrisonMove.sqf b/addons/ai/functions/fnc_garrisonMove.sqf index 588ebb2016..4d1c471a0e 100644 --- a/addons/ai/functions/fnc_garrisonMove.sqf +++ b/addons/ai/functions/fnc_garrisonMove.sqf @@ -81,13 +81,13 @@ if (isNil QGVAR(garrison_moveUnitPFH)) then { [QGVAR(enableAttack), [[_unit], true], _unit] call CBA_fnc_targetEvent; }; - LOG(format [ARR_2("garrisonMove PFH: unit in position | %1 units left", count _unitMoveList)]); + LOG(format [ARR_2("garrisonMove PFH: unit in position | %1 units left",count _unitMoveList)]); }; // Check if unit is alive or even existing if (!alive _unit || {_unit getVariable [QGVAR(garrisoned), false]}) then { _unitMoveList deleteAt (_unitMoveList find _x); - LOG(format [ARR_2("garrisonMove PFH: unit dead, deleted or garrisoned via TP | %1 units left", count _unitMoveList)]); + LOG(format [ARR_2("garrisonMove PFH: unit dead, deleted or garrisoned via TP | %1 units left",count _unitMoveList)]); } else { private _unitPos = getPos _unit; diff --git a/addons/ai/functions/fnc_unGarrison.sqf b/addons/ai/functions/fnc_unGarrison.sqf index ab0c525a24..09ebc3e63d 100644 --- a/addons/ai/functions/fnc_unGarrison.sqf +++ b/addons/ai/functions/fnc_unGarrison.sqf @@ -28,7 +28,7 @@ _units = _units select {local _x}; private _leader = leader _unit; - TRACE_3("fnc_ungarrison: unit and leader",_unit , _leader, (_leader == _unit)); + TRACE_3("fnc_ungarrison: unit and leader",_unit,_leader,(_leader == _unit)); _unit setVariable [QGVAR(garrisonned), false, true]; diff --git a/addons/aircraft/functions/fnc_droneSetWaypoint.sqf b/addons/aircraft/functions/fnc_droneSetWaypoint.sqf index 5c919564ce..5ffbbae825 100644 --- a/addons/aircraft/functions/fnc_droneSetWaypoint.sqf +++ b/addons/aircraft/functions/fnc_droneSetWaypoint.sqf @@ -29,7 +29,10 @@ private _currentLoiterRadius = waypointLoiterRadius _waypoint; private _currentLoiterType = waypointLoiterType _waypoint; // Set pos to ATL -_pos set [2, if (_currentHeight >= 50) then { _currentHeight } else { 0 }]; +_pos set [ + 2, + [0, _currentHeight] select (_currentHeight >= 50) +]; // [_group] call CBA_fnc_clearWaypoints; _waypoint = _group addWaypoint [_pos, 0]; diff --git a/addons/aircraft/stringtable.xml b/addons/aircraft/stringtable.xml index 97b08ed3e2..c0cef87756 100644 --- a/addons/aircraft/stringtable.xml +++ b/addons/aircraft/stringtable.xml @@ -29,7 +29,7 @@ Открыть грузовой отсек Apri la rampa di carico Abrir porta de carga - カーゴ ドアを開く + 貨物室ドアを 開く 화물칸 개방 開啟貨艙門 开启货舱门 @@ -46,7 +46,7 @@ Закрыть грузовой отсек Chiudi la rampa di carico Fechar porta de carga - カーゴ ドアを閉じる + 貨物室ドアを 閉じる 화물칸 폐쇄 關閉貨艙門 关闭货舱门 diff --git a/addons/arsenal/XEH_postInit.sqf b/addons/arsenal/XEH_postInit.sqf index ac6283e604..33646a25d7 100644 --- a/addons/arsenal/XEH_postInit.sqf +++ b/addons/arsenal/XEH_postInit.sqf @@ -22,7 +22,8 @@ GVAR(lastSortDirectionRight) = DESCENDING; params ["_object"]; // If the arsenal is already open, refresh arsenal display - if (!isNil QGVAR(currentBox) && {GVAR(currentBox) isEqualTo _object}) then { + // Deliberate == check, fail on objNull + if (!isNil QGVAR(currentBox) && {GVAR(currentBox) == _object}) then { [true, true] call FUNC(refresh); }; }] call CBA_fnc_addEventHandler; diff --git a/addons/arsenal/XEH_preInit.sqf b/addons/arsenal/XEH_preInit.sqf index df4da91338..0227e18f0a 100644 --- a/addons/arsenal/XEH_preInit.sqf +++ b/addons/arsenal/XEH_preInit.sqf @@ -12,57 +12,10 @@ PREP_RECOMPILE_END; #include "initSettings.inc.sqf" // Arsenal events -[QGVAR(statsToggle), { - params ["_display", "_showStats"]; - - private _statsCtrlGroupCtrl = _display displayCtrl IDC_statsBox; - private _statsPreviousPageCtrl = _display displayCtrl IDC_statsPreviousPage; - private _statsNextPageCtrl = _display displayCtrl IDC_statsNextPage; - private _statsCurrentPageCtrl = _display displayCtrl IDC_statsCurrentPage; - - { - _x ctrlShow (GVAR(showStats) && {_showStats}); - } forEach [ - _statsCtrlGroupCtrl, - _statsPreviousPageCtrl, - _statsNextPageCtrl, - _statsCurrentPageCtrl - ]; -}] call CBA_fnc_addEventHandler; - -[QGVAR(statsChangePage), { - _this call FUNC(buttonStatsPage); -}] call CBA_fnc_addEventHandler; - -[QGVAR(displayStats), { - _this call FUNC(handleStats); -}] call CBA_fnc_addEventHandler; - -[QGVAR(actionsChangePage), { - _this call FUNC(buttonActionsPage); -}] call CBA_fnc_addEventHandler; - -[QGVAR(displayActions), { - _this call FUNC(handleActions); -}] call CBA_fnc_addEventHandler; - -[QGVAR(actionsToggle), { - params ["_display", "_showActions"]; - - private _actionsCtrlGroupCtrl = _display displayCtrl IDC_actionsBox; - private _actionsPreviousPageCtrl = _display displayCtrl IDC_actionsPreviousPage; - private _actionsNextPageCtrl = _display displayCtrl IDC_actionsNextPage; - private _actionsCurrentPageCtrl = _display displayCtrl IDC_actionsCurrentPage; - - { - _x ctrlShow (GVAR(showActions) && {_showActions}); - } forEach [ - _actionsCtrlGroupCtrl, - _actionsPreviousPageCtrl, - _actionsNextPageCtrl, - _actionsCurrentPageCtrl - ]; -}] call CBA_fnc_addEventHandler; +[QGVAR(statsChangePage), LINKFUNC(buttonStatsPage)] call CBA_fnc_addEventHandler; +[QGVAR(displayStats), LINKFUNC(handleStats)] call CBA_fnc_addEventHandler; +[QGVAR(actionsChangePage), LINKFUNC(buttonActionsPage)] call CBA_fnc_addEventHandler; +[QGVAR(displayActions), LINKFUNC(handleActions)] call CBA_fnc_addEventHandler; call FUNC(compileActions); call FUNC(compileSorts); @@ -83,8 +36,16 @@ call FUNC(compileStats); EGVAR(common,blockItemReplacement) = false; }] call CBA_fnc_addEventHandler; +[QGVAR(cargoChanged), { + params ["_display"]; + // Only update actions if necessary, this can get performance-intensive using the arrow keys + if (!GVAR(updateActionsOnCargoChange)) exitWith {}; + private _actionInfo = [_display]; + _actionInfo append GVAR(actionInfo); + [QGVAR(displayActions), _actionInfo] call CBA_fnc_localEvent; +}] call CBA_fnc_addEventHandler; + // Setup Tools tab [keys (uiNamespace getVariable [QGVAR(configItemsTools), createHashMap]), LLSTRING(toolsTab), TOOLS_TAB_ICON, -1, true] call FUNC(addRightPanelButton); - ADDON = true; diff --git a/addons/arsenal/defines.hpp b/addons/arsenal/defines.hpp index 73116dde76..ac84f0d8a4 100644 --- a/addons/arsenal/defines.hpp +++ b/addons/arsenal/defines.hpp @@ -155,6 +155,8 @@ #define IDC_statsNextPage 53 #define IDC_statsCurrentPage 54 #define IDC_actionsBox 90 +#define IDC_actionsBackground1 90010 +#define IDC_actionsBackground2 90011 #define IDC_actionsText1 9001 #define IDC_actionsButton1 9002 #define IDC_actionsText2 9003 diff --git a/addons/arsenal/functions/fnc_addAction.sqf b/addons/arsenal/functions/fnc_addAction.sqf index 4606be5abe..05557f159a 100644 --- a/addons/arsenal/functions/fnc_addAction.sqf +++ b/addons/arsenal/functions/fnc_addAction.sqf @@ -10,6 +10,7 @@ * 3: Actions * 4: Condition (default: {true}) * 5: Scope editor (default: 2) + * 6: Update when cargo content changes (default: false) * * Return Value: * 0: Array of IDs @@ -30,7 +31,8 @@ params [ ["_title", "", [""]], ["_actions", [], [[]]], ["_rootCondition", {true}, [{}]], - ["_scopeEditor", 2, [0]] + ["_scopeEditor", 2, [0]], + ["_updateOnCargoChange", false, [false]] ]; // Compile actions from config (in case this is called before preInit) @@ -38,13 +40,13 @@ call FUNC(compileActions); // Skip if not allowed in editor and in editor if (is3DEN && {_scopeEditor != 2}) exitWith { - TRACE_1("Skipping action because in editor", _rootClass); + TRACE_1("Skipping action because in editor",_rootClass); [] }; // Class can't contain ~, because it's used for formatting result if ("~" in _rootClass) exitWith { - TRACE_1("Classname can't contain '~'", _rootClass); + TRACE_1("Classname can't contain '~'",_rootClass); [] }; @@ -65,7 +67,7 @@ private _fnc_addToGroup = { // Don't allow two of the same class if (_group findIf {(_x select 0) == _class} != -1) then { - TRACE_1("An action with this ID already exists", _class); + TRACE_1("An action with this ID already exists",_class); continue; }; @@ -119,4 +121,8 @@ private _group = []; }; } forEach _tabs; +if (_updateOnCargoChange) then { + GVAR(updateActionsOnCargoChange) = true; +}; + _return diff --git a/addons/arsenal/functions/fnc_addSort.sqf b/addons/arsenal/functions/fnc_addSort.sqf index 053f2ff52f..767660402f 100644 --- a/addons/arsenal/functions/fnc_addSort.sqf +++ b/addons/arsenal/functions/fnc_addSort.sqf @@ -72,7 +72,7 @@ private _fnc_addToTabs = { _currentTab pushBack _sort; _return pushBack _sortName; } else { - TRACE_1("A sort with this ID already exists", _sortName); + TRACE_1("A sort with this ID already exists",_sortName); }; } forEach _tabsToAddTo; }; diff --git a/addons/arsenal/functions/fnc_addStat.sqf b/addons/arsenal/functions/fnc_addStat.sqf index 98dfe45213..d618b96a93 100644 --- a/addons/arsenal/functions/fnc_addStat.sqf +++ b/addons/arsenal/functions/fnc_addStat.sqf @@ -77,7 +77,7 @@ private _fnc_addToTabs = { // Find if there is an entry with same ID if (_currentTab findIf {_x select 5 == _statName} != -1) then { - TRACE_1("A stat with this ID already exists", _statName); + TRACE_1("A stat with this ID already exists",_statName); } else { _stat = +_finalArray; _stat set [5, _statName]; @@ -109,11 +109,10 @@ private _tabToChange = []; { _x params ["_tab", "_tabSide"]; - _tabToChange = if (_tabSide == "R") then { + _tabToChange = [ + GVAR(statsListLeftPanel), GVAR(statsListRightPanel) - } else { - GVAR(statsListLeftPanel) - }; + ] select (_tabSide == "R"); _stats = _tabToChange select _tab; diff --git a/addons/arsenal/functions/fnc_buttonActionsPage.sqf b/addons/arsenal/functions/fnc_buttonActionsPage.sqf index 17da357100..b3a46a68e3 100644 --- a/addons/arsenal/functions/fnc_buttonActionsPage.sqf +++ b/addons/arsenal/functions/fnc_buttonActionsPage.sqf @@ -2,12 +2,12 @@ #include "..\defines.hpp" /* * Author: Brett Mayson - * Handles the previous / next page buttons for actions + * Handles the previous / next page buttons for actions. * * Arguments: * 0: Arsenal display - * 1: Actions control - * 2: Previous or next (false = previous, true = next) + * 1: Actions page + * 2: Previous (false) or next (true) page * * Return Value: * None @@ -17,10 +17,11 @@ params ["_display", "_control", "_nextPage"]; -TRACE_1("control enabled", ctrlEnabled _control); +TRACE_1("control enabled",ctrlEnabled _control); if !(ctrlEnabled _control) exitWith {}; GVAR(currentActionPage) = GVAR(currentActionPage) + ([-1, 1] select _nextPage); GVAR(actionsInfo) params ["_panelControl", "_curSel", "_itemCfg"]; + [QGVAR(displayActions), [_display, _panelControl, _curSel, _itemCfg]] call CBA_fnc_localEvent; diff --git a/addons/arsenal/functions/fnc_buttonHide.sqf b/addons/arsenal/functions/fnc_buttonHide.sqf index 6b6c84da93..d1bb5657b0 100644 --- a/addons/arsenal/functions/fnc_buttonHide.sqf +++ b/addons/arsenal/functions/fnc_buttonHide.sqf @@ -52,10 +52,20 @@ private _ctrl = controlNull; IDC_buttonCurrentMag2, IDC_iconBackgroundCurrentMag, IDC_iconBackgroundCurrentMag2, + IDC_statsBox, IDC_statsPreviousPage, IDC_statsNextPage, - IDC_statsCurrentPage + IDC_statsCurrentPage, + IDC_actionsBox, + IDC_actionsPreviousPage, + IDC_actionsNextPage, + IDC_actionsCurrentPage ]; -[QGVAR(statsToggle), [_display, _showToggle]] call CBA_fnc_localEvent; -[QGVAR(actionsToggle), [_display, _showToggle]] call CBA_fnc_localEvent; +if (!_showToggle) exitWith {}; + +// When showing the stats/actions again, update them to fit with currently selected item +GVAR(actionsInfo) params ["_control", "_curSel", "_itemCfg"]; + +[QGVAR(displayStats), [_display, _control, _curSel, _itemCfg]] call CBA_fnc_localEvent; +[QGVAR(displayActions), [_display, _control, _curSel, _itemCfg]] call CBA_fnc_localEvent; diff --git a/addons/arsenal/functions/fnc_buttonStatsPage.sqf b/addons/arsenal/functions/fnc_buttonStatsPage.sqf index bef2631f8c..33eec398e9 100644 --- a/addons/arsenal/functions/fnc_buttonStatsPage.sqf +++ b/addons/arsenal/functions/fnc_buttonStatsPage.sqf @@ -17,11 +17,11 @@ params ["_display", "_control", "_nextPage"]; -TRACE_1("control enabled", ctrlEnabled _control); +TRACE_1("control enabled",ctrlEnabled _control); if !(ctrlEnabled _control) exitWith {}; -GVAR(currentStatPage) = [GVAR(currentStatPage) - 1, GVAR(currentStatPage) + 1] select _nextPage; +GVAR(currentStatPage) = GVAR(currentStatPage) + ([-1, 1] select _nextPage); -GVAR(statsInfo) params ["_isLeftPanel", "_panelControl", "_curSel", "_itemCfg"]; +GVAR(statsInfo) params ["", "_panelControl", "_curSel", "_itemCfg"]; [QGVAR(displayStats), [_display, _panelControl, _curSel, _itemCfg]] call CBA_fnc_localEvent; diff --git a/addons/arsenal/functions/fnc_compileActions.sqf b/addons/arsenal/functions/fnc_compileActions.sqf index 6eda62ac65..cec152bd6a 100644 --- a/addons/arsenal/functions/fnc_compileActions.sqf +++ b/addons/arsenal/functions/fnc_compileActions.sqf @@ -37,6 +37,8 @@ private _actionList = [ private _configGroupEntries = "true" configClasses (configFile >> QGVAR(actions)); +GVAR(updateActionsOnCargoChange) = false; + { private _scopeEditor = getNumber (_x >> "scopeEditor"); @@ -48,6 +50,10 @@ private _configGroupEntries = "true" configClasses (configFile >> QGVAR(actions) private _rootDisplayName = getText (_x >> "displayName"); private _rootCondition = getText (_x >> "condition"); private _rootTabs = getArray (_x >> "tabs"); + private _updateOnCargoChanged = getNumber (_x >> "updateOnCargoChanged"); + if (_updateOnCargoChanged > 0) then { + GVAR(updateActionsOnCargoChange) = true; + }; if (_rootCondition != "") then { _rootCondition = compile _rootCondition; diff --git a/addons/arsenal/functions/fnc_compileStats.sqf b/addons/arsenal/functions/fnc_compileStats.sqf index ef8cba2f40..f19854793a 100644 --- a/addons/arsenal/functions/fnc_compileStats.sqf +++ b/addons/arsenal/functions/fnc_compileStats.sqf @@ -101,7 +101,7 @@ private _priority = 0; (_finalArray select 4) set [1, compile (getText (_x >> "textStatement"))]; }; - TRACE_3("stats array", _finalArray, _leftTabsList, _rightTabsList); + TRACE_3("stats array",_finalArray,_leftTabsList,_rightTabsList); if (_leftTabsList isNotEqualTo []) then { [_statsListLeftPanel, _leftTabsList, "L"] call _fnc_addToTabs; diff --git a/addons/arsenal/functions/fnc_fillLeftPanel.sqf b/addons/arsenal/functions/fnc_fillLeftPanel.sqf index effcc03d20..26f872dfdf 100644 --- a/addons/arsenal/functions/fnc_fillLeftPanel.sqf +++ b/addons/arsenal/functions/fnc_fillLeftPanel.sqf @@ -196,7 +196,7 @@ private _selectedItem = switch (true) do { _lbAdd = _ctrlPanel lbAdd _displayName; _ctrlPanel lbSetData [_lbAdd, _x]; _ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _x]]; - _ctrlPanel lbSetPictureRight [_lbAdd, _modPicture]; + _ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture] select GVAR(enableModIcons)]; } forEach (uiNamespace getVariable QGVAR(faceCache)); GVAR(currentFace) diff --git a/addons/arsenal/functions/fnc_fillRightPanel.sqf b/addons/arsenal/functions/fnc_fillRightPanel.sqf index 346e07fa59..09f986708d 100644 --- a/addons/arsenal/functions/fnc_fillRightPanel.sqf +++ b/addons/arsenal/functions/fnc_fillRightPanel.sqf @@ -87,7 +87,7 @@ private _fnc_fillRightContainer = { _ctrlPanel lnbSetText [[_lbAdd, 1], _displayName]; _ctrlPanel lnbSetData [[_lbAdd, 0], _className]; _ctrlPanel lnbSetPicture [[_lbAdd, 0], _picture]; - _ctrlPanel lnbSetValue [[_lbAdd, 2], [0, 1] select _isUnique]; + _ctrlPanel lnbSetValue [[_lbAdd, 2], parseNumber _isUnique]; _ctrlPanel lnbSetTooltip [[_lbAdd, 0], format ["%1\n%2", _displayName, _className]]; if ((toLower _className) in GVAR(favorites)) then { _ctrlPanel lnbSetColor [[_lbAdd, 1], FAVORITES_COLOR]; diff --git a/addons/arsenal/functions/fnc_handleActions.sqf b/addons/arsenal/functions/fnc_handleActions.sqf index 8dbffaedfe..f28e448256 100644 --- a/addons/arsenal/functions/fnc_handleActions.sqf +++ b/addons/arsenal/functions/fnc_handleActions.sqf @@ -7,7 +7,7 @@ * Arguments: * 0: Arsenal display * 1: Current panel control - * 2: Current panel selection + * 2: Current panel selection * 3: Item config entry * * Return Value: @@ -15,7 +15,6 @@ * * Public: No */ - params ["_display", "_control", "_curSel", "_itemCfg"]; GVAR(actionsInfo) = [_control, _curSel, _itemCfg]; @@ -46,13 +45,12 @@ private _groups = (GVAR(actionList) select _panel) select { }; private _show = _groups isNotEqualTo []; -private _ctrl = _display displayCtrl IDC_actionsBox; -_ctrl ctrlShow _show; -_ctrl ctrlCommit 0.15; +private _actionsBoxCtrl = _display displayCtrl IDC_actionsBox; +_actionsBoxCtrl ctrlShow _show; +_actionsBoxCtrl ctrlCommit 0.15; if (!_show) exitWith {}; -private _actionsBoxCtrl = _display displayCtrl IDC_actionsBox; private _actionsCurrentPageCtrl = _display displayCtrl IDC_actionsCurrentPage; private _currentPage = GVAR(currentActionPage); @@ -83,10 +81,11 @@ _actionsCurrentPageCtrl ctrlSetFade 0; _actionsCurrentPageCtrl ctrlShow true; _actionsCurrentPageCtrl ctrlCommit 0; +private _activeCtrls = []; { _x params ["", "_type", "_label", "_statement"]; - private _idc = 9001 + _forEachIndex * 2; + private _idc = IDC_actionsText1 + _forEachIndex * 2; private _actionTextCtrl = _display displayCtrl _idc; private _actionButtonCtrl = _display displayCtrl (_idc + 1); @@ -99,13 +98,23 @@ _actionsCurrentPageCtrl ctrlCommit 0; [true] call FUNC(refresh); }] call CBA_fnc_execNextFrame; }]; + + if (_activeCtrls isNotEqualTo []) then { + (ctrlPosition (_activeCtrls select -1)) params ["", "_lastPosY", "", "_lastPosH"]; + _actionButtonCtrl ctrlSetPositionY (_lastPosY + _lastPosH + GRID_H); + } else { + _actionButtonCtrl ctrlSetPositionY (6 * GRID_H); + }; + _actionButtonCtrl ctrlAddEventHandler ["ButtonClick", _statement]; _actionButtonCtrl ctrlSetText _label; _actionButtonCtrl ctrlSetFade 0; _actionButtonCtrl ctrlEnable true; _actionButtonCtrl ctrlCommit 0; _actionTextCtrl ctrlSetFade 1; + _actionTextCtrl ctrlEnable false; _actionTextCtrl ctrlCommit 0; + _activeCtrls pushBack _actionButtonCtrl; }; case ACTION_TYPE_TEXT: { private _text = call _statement; @@ -113,13 +122,25 @@ _actionsCurrentPageCtrl ctrlCommit 0; if (isNil "_text") then { _text = ""; }; + if (_text isEqualType []) then { + _text = _text joinString endl; + }; + if (_activeCtrls isNotEqualTo []) then { + (ctrlPosition (_activeCtrls select -1)) params ["", "_lastPosY", "", "_lastPosH"]; + _actionTextCtrl ctrlSetPositionY (_lastPosY + _lastPosH + GRID_H); + } else { + _actionTextCtrl ctrlSetPositionY (5 * GRID_H); + }; _actionTextCtrl ctrlSetText _text; + _actionTextCtrl ctrlSetPositionH (ctrlTextHeight _actionTextCtrl); _actionTextCtrl ctrlSetFade 0; + _actionTextCtrl ctrlEnable false; _actionTextCtrl ctrlCommit 0; _actionButtonCtrl ctrlSetFade 1; _actionButtonCtrl ctrlEnable false; _actionButtonCtrl ctrlCommit 0; + _activeCtrls pushBack _actionTextCtrl; }; default { _actionTextCtrl ctrlSetFade 1; @@ -134,7 +155,7 @@ _actionsCurrentPageCtrl ctrlCommit 0; private _actionCount = count _items; { - private _idc = 9001 + _x * 2; + private _idc = IDC_actionsText1 + _x * 2; private _actionTextCtrl = _display displayCtrl _idc; private _actionButtonCtrl = _display displayCtrl (_idc + 1); @@ -145,6 +166,11 @@ private _actionCount = count _items; } forEach ([0, 1, 2, 3, 4] select [_actionCount, 5]); private _pos = ctrlPosition _actionsBoxCtrl; -_pos set [3, ([11, (5 * _actionCount) + 6] select (_actionCount > 0)) * GRID_H]; -_actionsBoxCtrl ctrlSetPosition _pos; +(ctrlPosition (_activeCtrls select -1)) params ["", "_lastPosY", "", "_lastPosH"]; +private _actionsBoxHeight = _lastPosY + _lastPosH + GRID_H; +_actionsBoxCtrl ctrlSetPositionH _actionsBoxHeight; _actionsBoxCtrl ctrlCommit 0; + +private _background = _display displayCtrl IDC_actionsBackground1; +_background ctrlSetPositionH _actionsBoxHeight; +_background ctrlCommit 0; diff --git a/addons/arsenal/functions/fnc_onArsenalClose.sqf b/addons/arsenal/functions/fnc_onArsenalClose.sqf index bc862f2de0..2cce9b13ee 100644 --- a/addons/arsenal/functions/fnc_onArsenalClose.sqf +++ b/addons/arsenal/functions/fnc_onArsenalClose.sqf @@ -115,12 +115,11 @@ GVAR(currentVoice) = nil; GVAR(currentInsignia) = nil; GVAR(currentAction) = nil; -GVAR(showStats) = nil; GVAR(currentStatPage) = nil; GVAR(statsInfo) = nil; -GVAR(showActions) = nil; GVAR(currentActionPage) = nil; +GVAR(actionsInfo) = nil; profileNamespace setVariable [QGVAR(favorites), GVAR(favorites)]; GVAR(favoritesOnly) = nil; diff --git a/addons/arsenal/functions/fnc_onArsenalOpen.sqf b/addons/arsenal/functions/fnc_onArsenalOpen.sqf index bcc91c133a..9077a13a7a 100644 --- a/addons/arsenal/functions/fnc_onArsenalOpen.sqf +++ b/addons/arsenal/functions/fnc_onArsenalOpen.sqf @@ -74,12 +74,11 @@ GVAR(currentInsignia) = GVAR(center) call BIS_fnc_getUnitInsignia; GVAR(currentAction) = "Stand"; GVAR(shiftState) = false; -GVAR(showStats) = true; GVAR(currentStatPage) = 0; GVAR(statsInfo) = [true, controlNull, nil, nil]; -GVAR(showActions) = true; GVAR(currentActionPage) = 0; +GVAR(actionsInfo) = [controlNull, nil, nil]; // Update current item list call FUNC(updateCurrentItemsList); diff --git a/addons/arsenal/functions/fnc_onKeyDown.sqf b/addons/arsenal/functions/fnc_onKeyDown.sqf index 24fbd624f6..4d62075f78 100644 --- a/addons/arsenal/functions/fnc_onKeyDown.sqf +++ b/addons/arsenal/functions/fnc_onKeyDown.sqf @@ -147,7 +147,7 @@ if (!isNull _loadoutsDisplay) then { // Right panel lnb + and - buttons case (_keyPressed in [DIK_LEFT, DIK_RIGHT]): { if (GVAR(rightTabLnBFocus)) then { - [_display, [1, 0] select (_keyPressed == DIK_LEFT)] call FUNC(buttonCargo); + [_display, parseNumber (_keyPressed != DIK_LEFT)] call FUNC(buttonCargo); }; }; }; diff --git a/addons/arsenal/functions/fnc_refresh.sqf b/addons/arsenal/functions/fnc_refresh.sqf index d40d59c0ff..849b49d16b 100644 --- a/addons/arsenal/functions/fnc_refresh.sqf +++ b/addons/arsenal/functions/fnc_refresh.sqf @@ -25,6 +25,11 @@ if (canSuspend) exitWith { [{_this call FUNC(refresh)}, _this] call CBA_fnc_directCall; }; +private _display = findDisplay IDD_ace_arsenal; + +// Exit quietly if no display found +if (isNull _display) exitWith {}; + if (_updateItems) then { // Update current item list call FUNC(updateCurrentItemsList); @@ -65,6 +70,4 @@ if (!_animate) then { [{GVAR(refreshing) = false}, nil, 3] call CBA_fnc_execAfterNFrames; }; -private _display = findDisplay IDD_ace_arsenal; - [_display, _display displayCtrl GVAR(currentLeftPanel), _animate] call FUNC(fillLeftPanel); diff --git a/addons/arsenal/functions/fnc_removeBox.sqf b/addons/arsenal/functions/fnc_removeBox.sqf index 984db8d099..9fa3ec377a 100644 --- a/addons/arsenal/functions/fnc_removeBox.sqf +++ b/addons/arsenal/functions/fnc_removeBox.sqf @@ -42,8 +42,14 @@ if (_global && {isMultiplayer} && {!isNil "_id"}) then { }; // If the arsenal is already open and not ignoring content (see FUNC(openBox)), close arsenal display -if (!isNil QGVAR(currentBox) && {GVAR(currentBox) isEqualTo _object} && {isNil QGVAR(ignoredVirtualItems)}) then { - [LLSTRING(noVirtualItems), false, 5, 1] call EFUNC(common,displayText); - // Delay a frame in case this is running on display open - [{(findDisplay IDD_ace_arsenal) closeDisplay 0}] call CBA_fnc_execNextFrame; +// Deliberate == check, fail on objNull +if (!isNil QGVAR(currentBox) && {GVAR(currentBox) == _object} && {isNil QGVAR(ignoredVirtualItems)}) then { + // Delay a frame in case this is running on display open/close + [{ + private _display = findDisplay IDD_ace_arsenal; + if (isNull _display) exitWith {}; + + [LLSTRING(noVirtualItems), false, 5, 1] call EFUNC(common,displayText); + _display closeDisplay 0; + }] call CBA_fnc_execNextFrame; }; diff --git a/addons/arsenal/functions/fnc_statTextStatement_illuminators.sqf b/addons/arsenal/functions/fnc_statTextStatement_illuminators.sqf index b677ec8210..3f982f575c 100644 --- a/addons/arsenal/functions/fnc_statTextStatement_illuminators.sqf +++ b/addons/arsenal/functions/fnc_statTextStatement_illuminators.sqf @@ -31,9 +31,9 @@ if (_allItems isEqualTo []) then { _allItems = [configName _config] }; || {_illum && {([_xCfg >> "Flashlight" >> "irLight", "NUMBER", 0] call CBA_fnc_getConfigEntry) == 1}}; private _text = switch (true) do { // shorthand roughly based on PEQ-15 - case (_laser && _illum): { if (_isIR) then { "IR-DUAL" } else { "VIS-DUAL" } }; - case (_laser): { if (_isIR) then { "IR-AIM" } else { "VIS-AIM" } }; // AIM - case (_illum): { if (_isIR) then { "IR-ILM" } else { "VIS-ILM" } }; // ILLUMIATION + case (_laser && _illum): { ["VIS-DUAL", "IR-DUAL"] select _isIR }; // DUAL + case (_laser): { ["VIS-AIM", "IR-AIM"] select _isIR }; // AIM + case (_illum): { ["VIS-ILM", "IR-ILM"] select _isIR }; // ILLUMIATION default { "_" }; // there are some purely cosmetic attachements }; _allModes pushBackUnique _text; diff --git a/addons/arsenal/functions/fnc_statTextStatement_scopeVisionMode.sqf b/addons/arsenal/functions/fnc_statTextStatement_scopeVisionMode.sqf index dca83cb381..b4de06e772 100644 --- a/addons/arsenal/functions/fnc_statTextStatement_scopeVisionMode.sqf +++ b/addons/arsenal/functions/fnc_statTextStatement_scopeVisionMode.sqf @@ -67,7 +67,9 @@ if (!_primaryNVGSupported && {(_opticsModes select {_x select 1}) isEqualTo _opt _primaryNVGSupported = true; }; -if (_primaryNVGIntegrated) exitWith {LLSTRING(statVisionMode_IntPrim)}; +if (_primaryTiIntegrated && _primaryNVGIntegrated) exitWith {LLSTRING(statVisionMode_intPrimTi)}; +if (_primaryTiIntegrated) exitWith {LLSTRING(statVisionMode_ti)}; +if (_primaryNVGIntegrated) exitWith {LLSTRING(statVisionMode_intPrim)}; if (_primaryNVGSupported) exitWith {LLSTRING(statVisionMode_supPrim)}; if (_secondaryNVGSupported) exitWith {LLSTRING(statVisionMode_supSec)}; diff --git a/addons/arsenal/functions/fnc_verifyLoadout.sqf b/addons/arsenal/functions/fnc_verifyLoadout.sqf index b5425c2117..adc76f391a 100644 --- a/addons/arsenal/functions/fnc_verifyLoadout.sqf +++ b/addons/arsenal/functions/fnc_verifyLoadout.sqf @@ -46,11 +46,7 @@ private _fnc_toConfigCase = { // If item doesn't exist in config, "" is returned // Just return unaltered item name in that case, so it can be documented as being unavailable - if (_name != "") then { - _name - } else { - _x - }; + [_x, _name] select (_name != ""); } else { _x }; diff --git a/addons/arsenal/stringtable.xml b/addons/arsenal/stringtable.xml index 7f6947d913..f308765540 100644 --- a/addons/arsenal/stringtable.xml +++ b/addons/arsenal/stringtable.xml @@ -613,7 +613,7 @@ Le set d'équipement suivant a été supprimé : Folgende Ausrüstung wurde entfernt: Następujący zestaw został skasowany: - 次の装備は削除されました: + 装備を削除しました: Il seguente equipaggiamento è stato eliminato: 다음 로드아웃이 삭제됨 : 以下的裝備已被刪除: @@ -629,7 +629,7 @@ Le set d'équipement suivant n'est plus public : Folgende Ausrüstung ist nicht mehr öffentlich: Następujący zestaw nie jest już publiczny: - 次の装備は非公開になりました: + 装備を非公開にしました: Il seguente equipaggiamento non è più pubblico: 다음 로드아웃이 더이상 공용이 아님: 以下的裝備已不再被分享: @@ -645,7 +645,7 @@ Le champ "nom" est vide ! Das Feld "Name" ist leer! Pole nazwy jest puste! - 名前が空白です! + 名前が空欄です! Il campo del nome è vuoto! 이름칸이 비었습니다! 名稱欄位為空! @@ -677,7 +677,7 @@ Un de vos sets d'équipement ayant le même nom est public. Eine deiner Ausrüstungen mit dem gleichen Namen ist öffentlich Jeden z Twoich zestawów nazwany tak samo jest już publiczny - あなたの装備は既に公開されているものと同名です + あなたのものと同じ名前の装備が既に公開されています Un tuo equipaggiamento con lo stesso nome è pubblico 같은 이름의 로드아웃이 공용에 있습니다. 已有相同名稱的裝備在公用分享區 @@ -693,7 +693,7 @@ Le set d'équipement suivant a été enregistré : Folgende Ausrüstung wurde gespeichert: Następujący zestaw został zapisany: - 次の装備は保存されました: + 装備を保存しました: Il seguente equipaggiamento è stato salvato: 다음 로드아웃이 저장됨: 以下的裝備已被保存: @@ -709,7 +709,7 @@ Le set d'équipement suivant a été chargé : Folgene Ausrüstung wurde geladen: Następujący zestaw został wczytany: - 次の装備が読み込みされました: + 装備を読み込みました: Il seguente equipaggiamento è stato caricato: 다음 로드아웃을 불러옴: 以下的裝備已被載入: @@ -725,7 +725,7 @@ Un set d'équipement ayant le même nom existe déjà ! Eine Ausrüstung mit dem gleichen Namen existiert bereits! Zestaw z tą nazwą już istnieje! - 既にその名前は装備に使われています! + 既に同じ名前の装備が存在しています! Un equipaggiamento con lo stesso nome è gia esistente! 같은 이름의 로드아웃이 이미 존재합니다! 已有相同名稱的裝備! @@ -741,7 +741,7 @@ a été renommé en wurde umbenannt in zmienił nazwę na - 次の名前に変更されました + を次の名前に変更しました: È stato rinominato in 이름이 다음과 같이 변경됨: 已被改名為 @@ -1181,7 +1181,7 @@ Nightvision Support Soporte de visión nocturna Nachtsicht Unterstützung - 暗視装置への対応有無 + 暗視装置への対応 Wsparcie noktowizyjne Supporto visore notturno Поддержка ночного видения @@ -1223,7 +1223,7 @@ Vedlejší část hledí podporuje 보조무기 지원여부 - + Primary integrated Primaria integrada Primär Integriert @@ -1238,6 +1238,14 @@ Integrováno do hlavní části hledí 주무기 내장여부 + + Thermal integrated + 熱画像装置内蔵 + + + Thermal & Primary integrated + 熱画像装置内蔵・プライマリに内蔵 + Not Supported No soportada @@ -1257,7 +1265,7 @@ Vision Mode Sichtmodus - ビジョン モード + 映像モード Modalità Visiva 視覺模式 视觉模式 @@ -1495,7 +1503,7 @@ Añade automáticamente accesorios o cargadores (de la categoría seleccionada) a todas las armas de la lista de objetos Es werden automatisch kompatible Aufsätze oder Magazine für alle ausgewählten Waffen hinzugefügt Automatycznie doda kompatybilne dodatki oraz magazynki (odpowiednio do każdej kategorii) dla wszystkich broni na liście - 現在のアイテムリスト内にある全武器に対応する アタッチメントと弾倉(選択したカテゴリに基づく)を自動的に追加します + 現在のアイテムリスト内の全武器に対応する アタッチメントと弾倉(選択したカテゴリに基づく)を自動的に追加します Добавляет совместимые приспособления или магазины (в зависимости от выбранной категории) для всего оружия в текущем списке предметов Irá automaticamente adicionar acessórios ou carregadores (baseado na categoria selecionada) para todas as armas na lista de itens atual Ajoute automatiquement des accessoires ou des chargeurs compatibles (en fonction de la catégorie sélectionnée), pour toutes les armes de la liste actuelle. diff --git a/addons/arsenal/ui/RscAttributes.hpp b/addons/arsenal/ui/RscAttributes.hpp index 0265e86f3f..69acebc52c 100644 --- a/addons/arsenal/ui/RscAttributes.hpp +++ b/addons/arsenal/ui/RscAttributes.hpp @@ -450,22 +450,22 @@ class GVAR(display) { h = QUOTE(55 * GRID_H); class controls { class actionsStaticBackground1: ctrlStaticBackground { - idc = -1; + idc = IDC_actionsBackground1; x = QUOTE(0); y = QUOTE(0); w = QUOTE(47 * GRID_W); - h = QUOTE(56 * GRID_H); + h = QUOTE(55 * GRID_H); colorBackground[]={0.1,0.1,0.1,0.5}; }; class actionsStaticBackground2: ctrlStaticBackground { - idc = -1; + idc = IDC_actionsBackground2; x = QUOTE(0); y = QUOTE(0); w = QUOTE(47 * GRID_W); h = QUOTE(5 * GRID_H); colorBackground[]={0.1,0.1,0.1,0.8}; }; - class actionsText1: RscText { + class actionsText1: RscTextMulti { idc = IDC_actionsText1; fade = 1; x = QUOTE(0 * GRID_W); @@ -479,6 +479,7 @@ class GVAR(display) { }; class actionsButton1: ctrlButton { idc = IDC_actionsButton1; + onMouseEnter = QUOTE(ctrlSetFocus (_this select 0)); fade = 1; text = ""; x = QUOTE(1 * GRID_W); diff --git a/addons/artillerytables/functions/fnc_rangeTableOpen.sqf b/addons/artillerytables/functions/fnc_rangeTableOpen.sqf index 97c8dfe435..327a2903a0 100644 --- a/addons/artillerytables/functions/fnc_rangeTableOpen.sqf +++ b/addons/artillerytables/functions/fnc_rangeTableOpen.sqf @@ -65,7 +65,7 @@ GVAR(magModeData) = []; { _x params ["_xDisplayNameShort", "_xDisplayName", "_xInitSpeed", "_xAirFriction"]; if (_allSameCharge) then { - _ctrlChargeList lbAdd format ["%1", _xDisplayNameShort]; + _ctrlChargeList lbAdd _xDisplayNameShort; _ctrlChargeList lbSetTooltip [count GVAR(magModeData), format ["%1\n%2 m/s\n%3", _xDisplayName, _xInitSpeed toFixed 1, _xAirFriction]]; GVAR(magModeData) pushBack [_xInitSpeed, _xAirFriction]; } else { diff --git a/addons/atragmx/functions/fnc_initGunList.sqf b/addons/atragmx/functions/fnc_initGunList.sqf index 783a68202a..2ae67bb78d 100644 --- a/addons/atragmx/functions/fnc_initGunList.sqf +++ b/addons/atragmx/functions/fnc_initGunList.sqf @@ -15,7 +15,7 @@ * Public: No */ -LOG_2("Trying to load gunlist from profile [Version: %1][Count: %2]", profileNamespace getVariable [ARR_2(QGVAR(profileNamespaceVersion), 'none')], count (profileNamespace getVariable [ARR_2(QGVAR(gunList), [])])); +LOG_2("Trying to load gunlist from profile [Version: %1][Count: %2]",profileNamespace getVariable [ARR_2(QGVAR(profileNamespaceVersion),'none')],count (profileNamespace getVariable [ARR_2(QGVAR(gunList),[])])); private _resetGunList = true; if ((profileNamespace getVariable ["ACE_ATragMX_profileNamespaceVersion", 0]) == ATRAGMX_PROFILE_NAMESPACE_VERSION && {count (profileNamespace getVariable ["ACE_ATragMX_gunList", []]) > 0}) then { diff --git a/addons/atragmx/functions/fnc_update_result.sqf b/addons/atragmx/functions/fnc_update_result.sqf index 4def2f87a6..cfd8f460a9 100644 --- a/addons/atragmx/functions/fnc_update_result.sqf +++ b/addons/atragmx/functions/fnc_update_result.sqf @@ -90,7 +90,7 @@ if (GVAR(showWind2)) then { _elevationAbs = Round(_elevationAbs * 100) / 100; if (_elevationAbs > 0) then { - ctrlSetText [400, format["%1", abs(_elevationAbs)]]; + ctrlSetText [400, str abs _elevationAbs]; } else { if (_elevationAbs < 0) then { ctrlSetText [400, format["%1D", abs(_elevationAbs)]]; @@ -100,7 +100,7 @@ if (_elevationAbs > 0) then { }; _elevationRel = Round(_elevationRel * 100) / 100; if (_elevationRel > 0) then { - ctrlSetText [401, format["%1", abs(_elevationRel)]]; + ctrlSetText [401, str abs _elevationRel]; } else { if (_elevationRel < 0) then { ctrlSetText [401, format["%1D", abs(_elevationRel)]]; @@ -110,7 +110,7 @@ if (_elevationRel > 0) then { }; _elevationCur = Round(_elevationCur * 100) / 100; if (_elevationCur > 0) then { - ctrlSetText [402, format["%1", abs(_elevationCur)]]; + ctrlSetText [402, str abs _elevationCur]; } else { if (_elevationCur < 0) then { ctrlSetText [402, format["%1D", abs(_elevationCur)]]; diff --git a/addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf b/addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf index 4341867b29..2e07a353df 100644 --- a/addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf +++ b/addons/captives/functions/fnc_findEmptyNonFFVCargoSeat.sqf @@ -16,7 +16,7 @@ */ params ["_vehicle"]; -TRACE_1("params", _vehicle); +TRACE_1("params",_vehicle); scopeName "main"; diff --git a/addons/cargo/CfgEventHandlers.hpp b/addons/cargo/CfgEventHandlers.hpp index f6503c2479..29a0c6b277 100644 --- a/addons/cargo/CfgEventHandlers.hpp +++ b/addons/cargo/CfgEventHandlers.hpp @@ -15,3 +15,17 @@ class Extended_PostInit_EventHandlers { init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); }; }; + +class Extended_Killed_EventHandlers { + class CAManBase { + class ADDON { + killed = QUOTE((_this select 0) call FUNC(handleDeployInterrupt)); + }; + }; +}; + +class Extended_DisplayLoad_EventHandlers { + class RscDisplayMission { + ADDON = QUOTE(_this call COMPILE_SCRIPT(XEH_missionDisplayLoad)); + }; +}; diff --git a/addons/cargo/XEH_PREP.hpp b/addons/cargo/XEH_PREP.hpp index 2d77fc90de..10281e2967 100644 --- a/addons/cargo/XEH_PREP.hpp +++ b/addons/cargo/XEH_PREP.hpp @@ -2,10 +2,15 @@ PREP(addCargoItem); PREP(addCargoVehiclesActions); PREP(canLoadItemIn); PREP(canUnloadItem); +PREP(deployCancel); +PREP(deployConfirm); PREP(getCargoSpaceLeft); PREP(getNameItem); +PREP(getSelectedItem); PREP(getSizeItem); PREP(handleDestroyed); +PREP(handleDeployInterrupt); +PREP(handleScrollWheel); PREP(initObject); PREP(initVehicle); PREP(loadItem); @@ -16,6 +21,7 @@ PREP(removeCargoItem); PREP(renameObject); PREP(setSize); PREP(setSpace); +PREP(startDeploy); PREP(startLoadIn); PREP(startUnload); PREP(unloadCarryItem); diff --git a/addons/cargo/XEH_missionDisplayLoad.sqf b/addons/cargo/XEH_missionDisplayLoad.sqf new file mode 100644 index 0000000000..7bdea7571f --- /dev/null +++ b/addons/cargo/XEH_missionDisplayLoad.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" + +params ["_display"]; + +_display displayAddEventHandler ["MouseZChanged", {(_this select 1) call FUNC(handleScrollWheel)}]; +_display displayAddEventHandler ["MouseButtonDown", { + // Right clicking cancels deployment + if (_this select 1 == 1) then { + ACE_player call FUNC(handleDeployInterrupt); + }; +}]; diff --git a/addons/cargo/XEH_postInit.sqf b/addons/cargo/XEH_postInit.sqf index 1848a1e77b..94cb2afc87 100644 --- a/addons/cargo/XEH_postInit.sqf +++ b/addons/cargo/XEH_postInit.sqf @@ -17,10 +17,10 @@ }] call CBA_fnc_addEventHandler; ["ace_unloadCargo", { - params ["_item", "_vehicle", ["_unloader", objNull]]; - TRACE_3("UnloadCargo EH",_item,_vehicle,_unloader); + params ["_item", "_vehicle", ["_unloader", objNull], ["_place", []]]; + TRACE_4("UnloadCargo EH",_item,_vehicle,_unloader,_place); - private _unloaded = [_item, _vehicle, _unloader] call FUNC(unloadItem); // returns true if successful + private _unloaded = [_item, _vehicle, _unloader, _place] call FUNC(unloadItem); // returns true if successful // Show hint as feedback private _hint = [LSTRING(unloadingFailed), LSTRING(unloadedItem)] select _unloaded; @@ -36,13 +36,25 @@ }; }] call CBA_fnc_addEventHandler; +// Direction must be set before setting position according to wiki +[QGVAR(setDirAndUnload), { + params ["_item", "_emptyPosAGL", "_direction"]; + + _item setDir _direction; + + [QGVAR(serverUnload), [_item, _emptyPosAGL]] call CBA_fnc_serverEvent; +}] call CBA_fnc_addEventHandler; + +// hideObjectGlobal must be executed before setPos to ensure light objects are rendered correctly +// Do both on server to ensure they are executed in the correct order [QGVAR(serverUnload), { params ["_item", "_emptyPosAGL"]; _item hideObjectGlobal false; _item setPosASL (AGLtoASL _emptyPosAGL); - [_item, "blockDamage", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set); + // Let objects remain invulernable for a short while after placement + [EFUNC(common,statusEffect_set), [_item, "blockDamage", QUOTE(ADDON), false], 2] call CBA_fnc_waitAndExecute; }] call CBA_fnc_addEventHandler; [QGVAR(paradropItem), { @@ -166,3 +178,38 @@ if (isServer) then { _bodyBag setVariable [QGVAR(customName), [_target, false, true] call EFUNC(common,getName), true]; }] call CBA_fnc_addEventHandler; }; + +// Set variables, even on machines without interfaces, just to be safe +GVAR(selectedItem) = objNull; +GVAR(itemPreviewObject) = objNull; +GVAR(deployPFH) = -1; +GVAR(deployDistance) = -1; +GVAR(deployDirection) = 0; +GVAR(deployHeight) = 0; +GVAR(canDeploy) = false; + +if (!hasInterface) exitWith {}; + +// Cancel object deployment if interact menu opened +["ace_interactMenuOpened", {ACE_player call FUNC(handleDeployInterrupt)}] call CBA_fnc_addEventHandler; + +// Cancel deploy on player change. This does work when returning to lobby, but not when hard disconnecting +["unit", LINKFUNC(handleDeployInterrupt)] call CBA_fnc_addPlayerEventHandler; +["vehicle", {(_this select 0) call FUNC(handleDeployInterrupt)}] call CBA_fnc_addPlayerEventHandler; +["weapon", {(_this select 0) call FUNC(handleDeployInterrupt)}] call CBA_fnc_addPlayerEventHandler; + +// When changing feature cameras, stop deployment +["featureCamera", {(_this select 0) call FUNC(handleDeployInterrupt)}] call CBA_fnc_addPlayerEventHandler; + +// Handle falling unconscious while trying to deploy +["ace_unconscious", {(_this select 0) call FUNC(handleDeployInterrupt)}] call CBA_fnc_addEventHandler; + +// Handle surrendering and handcuffing +["ace_captiveStatusChanged", { + params ["_unit", "_state"]; + + // If surrendered or handcuffed, stop deployment + if (_state) then { + _unit call FUNC(handleDeployInterrupt); + }; +}] call CBA_fnc_addEventHandler; diff --git a/addons/cargo/functions/fnc_deployCancel.sqf b/addons/cargo/functions/fnc_deployCancel.sqf new file mode 100644 index 0000000000..50ee62c457 --- /dev/null +++ b/addons/cargo/functions/fnc_deployCancel.sqf @@ -0,0 +1,39 @@ +#include "..\script_component.hpp" +/* + * Author: Garth 'L-H' de Wet, Ruthberg, commy2, Smith + * Cancels unloading when deploying. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * player call ace_cargo_fnc_deployCancel + * + * Public: No + */ + +if (GVAR(deployPFH) == -1) exitWith {}; + +// Remove deployment pfh +GVAR(deployPFH) call CBA_fnc_removePerFrameHandler; +GVAR(deployPFH) = -1; + +params ["_unit"]; + +// Enable running again +[_unit, "forceWalk", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set); +[_unit, "blockThrow", QUOTE(ADDON), false] call EFUNC(common,statusEffect_set); + +// Delete placement dummy +deleteVehicle GVAR(itemPreviewObject); + +// Remove mouse button actions +call EFUNC(interaction,hideMouseHint); + +[_unit, "DefaultAction", _unit getVariable [QGVAR(deploy), -1]] call EFUNC(common,removeActionEventHandler); +_unit setVariable [QGVAR(deploy), -1]; + +_unit setVariable [QGVAR(isDeploying), false, true]; diff --git a/addons/cargo/functions/fnc_deployConfirm.sqf b/addons/cargo/functions/fnc_deployConfirm.sqf new file mode 100644 index 0000000000..27674b0515 --- /dev/null +++ b/addons/cargo/functions/fnc_deployConfirm.sqf @@ -0,0 +1,56 @@ +#include "..\script_component.hpp" +/* + * Author: Garth 'L-H' de Wet, Ruthberg, commy2, Smith + * Confirms unloading when deploying. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * player call ace_cargo_fnc_deployConfirm + * + * Public: No + */ + +if (GVAR(deployPFH) == -1) exitWith {}; + +params ["_unit"]; + +// Delete placement dummy and unload real item from cargo at dummy position +if (!isNull GVAR(itemPreviewObject) && {[GVAR(selectedItem), GVAR(interactionVehicle), _unit, false, true] call FUNC(canUnloadItem)}) then { + // Position is AGL for unloading event + private _position = ASLToAGL getPosASL GVAR(itemPreviewObject); + private _direction = getDir GVAR(itemPreviewObject); + private _duration = GVAR(loadTimeCoefficient) * (GVAR(selectedItem) call FUNC(getSizeItem)); + + // If unload time is 0, don't show a progress bar + if (_duration <= 0) exitWith { + ["ace_unloadCargo", [GVAR(selectedItem), GVAR(interactionVehicle), _unit, [_position, _direction]]] call CBA_fnc_localEvent; + }; + + [ + _duration, + [GVAR(selectedItem), GVAR(interactionVehicle), _unit, [_position, _direction]], + { + TRACE_1("deploy finish",_this); + + ["ace_unloadCargo", _this select 0] call CBA_fnc_localEvent; + }, + { + TRACE_1("deploy fail",_this); + }, + format [LLSTRING(unloadingItem), [GVAR(selectedItem), true] call FUNC(getNameItem), getText (configOf GVAR(interactionVehicle) >> "displayName")], + { + (_this select 0) params ["_item", "_vehicle", "_unit"]; + + [_item, _vehicle, _unit, false, true] call FUNC(canUnloadItem) // don't check for a suitable unloading position when deploying + }, + ["isNotSwimming"] + ] call EFUNC(common,progressBar); +}; + +// Cleanup EHs and preview object +_unit call FUNC(deployCancel); diff --git a/addons/cargo/functions/fnc_getSelectedItem.sqf b/addons/cargo/functions/fnc_getSelectedItem.sqf new file mode 100644 index 0000000000..a6f9141ae1 --- /dev/null +++ b/addons/cargo/functions/fnc_getSelectedItem.sqf @@ -0,0 +1,29 @@ +#include "..\script_component.hpp" +/* + * Author: Glowbal, Smith + * Get selected item from cargo menu. + * + * Arguments: + * None + * + * Return Value: + * Classname of selected item or selected object or (default: nil) + * + * Example: + * call ace_cargo_fnc_getSelectedItem + * + * Public: No + */ + +disableSerialization; + +private _display = uiNamespace getVariable QGVAR(menuDisplay); + +if (isNil "_display") exitWith {}; + +private _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []]; + +if (_loaded isEqualTo []) exitWith {}; + +// This can be an object or a classname string +_loaded param [lbCurSel (_display displayCtrl 100), nil] diff --git a/addons/cargo/functions/fnc_handleDeployInterrupt.sqf b/addons/cargo/functions/fnc_handleDeployInterrupt.sqf new file mode 100644 index 0000000000..2cb712b5e0 --- /dev/null +++ b/addons/cargo/functions/fnc_handleDeployInterrupt.sqf @@ -0,0 +1,30 @@ +#include "..\script_component.hpp" +/* + * Author: commy2, Smith + * Handle various interruption types. + * + * Arguments: + * 0: (New) unit + * 1: Old unit (for player change) (default: objNull) + * + * Return Value: + * None + * + * Example: + * player call ace_cargo_fnc_handleDeployInterrupt + * + * Public: No +*/ + +params ["_newPlayer", ["_oldPlayer", objNull]]; +TRACE_2("params",_newPlayer,_oldPlayer); + +if (!local _newPlayer) exitWith {}; + +if (_newPlayer getVariable [QGVAR(isDeploying), false]) then { + _newPlayer call FUNC(deployCancel); +}; + +if (_oldPlayer getVariable [QGVAR(isDeploying), false]) then { + _oldPlayer call FUNC(deployCancel); +}; diff --git a/addons/cargo/functions/fnc_handleScrollWheel.sqf b/addons/cargo/functions/fnc_handleScrollWheel.sqf new file mode 100644 index 0000000000..9ec2c498e6 --- /dev/null +++ b/addons/cargo/functions/fnc_handleScrollWheel.sqf @@ -0,0 +1,58 @@ +#include "..\script_component.hpp" +/* + * Author: L-H, commy2, Smith + * Handles rotation of object to unload. + * + * Arguments: + * 0: Scroll amount + * + * Return Value: + * If the scroll was handled + * + * Example: + * 1.2 call ace_cargo_fnc_handleScrollWheel + * + * Public: No + */ + +if (GVAR(deployPFH) == -1) exitWith {false}; + +params ["_scrollAmount"]; + +private _deployedItem = GVAR(itemPreviewObject); + +if (!CBA_events_control) then { + private _unit = ACE_player; + + // Raise/lower + // Move deployed item 15 cm per scroll interval + _scrollAmount = _scrollAmount * 0.15; + + private _position = getPosASL _deployedItem; + private _maxHeight = (_unit modelToWorldVisualWorld [0, 0, 0]) select 2; + + _position set [2, ((_position select 2) + _scrollAmount min (_maxHeight + 1.5)) max _maxHeight]; + + // Move up/down object and reattach at current position + detach _deployedItem; + + // Uses this method of selecting position because setPosATL did not have immediate effect + private _positionChange = _position vectorDiff (getPosASL _deployedItem); + private _selectionPosition = _unit worldToModel (ASLtoAGL getPosWorld _deployedItem); + _selectionPosition = _selectionPosition vectorAdd _positionChange; + _deployedItem attachTo [_unit, _selectionPosition]; + + // Reset the deploy direction + private _direction = _deployedItem getVariable [QGVAR(deployDirection_temp), 0]; + _deployedItem setDir _direction; +} else { + // Rotate + private _direction = _deployedItem getVariable [QGVAR(deployDirection_temp), 0]; + _scrollAmount = _scrollAmount * 10; + _direction = _direction + _scrollAmount; + + _deployedItem setDir _direction; + _deployedItem setVariable [QGVAR(deployDirection_temp), _direction]; +}; + +true diff --git a/addons/cargo/functions/fnc_initObject.sqf b/addons/cargo/functions/fnc_initObject.sqf index a8522ad283..734fe99c39 100644 --- a/addons/cargo/functions/fnc_initObject.sqf +++ b/addons/cargo/functions/fnc_initObject.sqf @@ -44,7 +44,7 @@ if (_item getVariable [QGVAR(initObject),false]) exitWith {}; if (_canLoadConfig) then { GVAR(initializedItemClasses) pushBack _type; - TRACE_1("Adding load cargo action to class", _type); + TRACE_1("Adding load cargo action to class",_type); { [_type, 0, ["ACE_MainActions"], _x] call EFUNC(interact_menu,addActionToClass); @@ -52,7 +52,7 @@ if (_canLoadConfig) then { } else { _item setVariable [QGVAR(initObject), true]; - TRACE_1("Adding load cargo action to object", _item); + TRACE_1("Adding load cargo action to object",_item); { [_item, 0, ["ACE_MainActions"], _x] call EFUNC(interact_menu,addActionToObject); diff --git a/addons/cargo/functions/fnc_initVehicle.sqf b/addons/cargo/functions/fnc_initVehicle.sqf index ed0a02cba9..ec432ea91f 100644 --- a/addons/cargo/functions/fnc_initVehicle.sqf +++ b/addons/cargo/functions/fnc_initVehicle.sqf @@ -16,17 +16,23 @@ */ params ["_vehicle"]; -TRACE_1("params", _vehicle); +TRACE_1("params",_vehicle); private _type = typeOf _vehicle; private _config = configOf _vehicle; // If vehicle had space given to it via eden/public, then override config hasCargo setting -private _hasCargoPublic = _vehicle getVariable [QGVAR(hasCargo), false]; +private _hasCargoPublic = _item getVariable QGVAR(hasCargo); +private _hasCargoPublicDefined = !isNil "_canLoadPublic"; + +if (_hasCargoPublicDefined && {!(_hasCargoPublic isEqualType false)}) then { + WARNING_4("%1[%2] - Variable %3 is %4 - Should be bool",_item,_type,QGVAR(hasCargo),_hasCargoPublic); +}; + private _hasCargoConfig = getNumber (_config >> QGVAR(hasCargo)) == 1; // Nothing to do here if vehicle has no cargo space -if !(_hasCargoConfig || _hasCargoPublic) exitWith {}; +if !((_hasCargoPublicDefined && {_hasCargoPublic in [true, 1]}) || {!_hasCargoPublicDefined && {_hasCargoConfig}}) exitWith {}; // Check if cargo is in cargo holder types (checked when trying to search for loadable objects) private _addCargoType = GVAR(cargoHolderTypes) findIf {_type isKindOf _x} == -1; @@ -68,13 +74,13 @@ if (_type in GVAR(initializedVehicleClasses)) exitWith {}; if (_hasCargoConfig) then { GVAR(initializedVehicleClasses) pushBack _type; - TRACE_1("Adding unload cargo action to class", _type); + TRACE_1("Adding unload cargo action to class",_type); [_type, 0, ["ACE_MainActions"], GVAR(vehicleAction)] call EFUNC(interact_menu,addActionToClass); } else { _vehicle setVariable [QGVAR(initVehicle), true]; - TRACE_1("Adding unload cargo action to object", _vehicle); + TRACE_1("Adding unload cargo action to object",_vehicle); [_vehicle, 0, ["ACE_MainActions"], GVAR(vehicleAction)] call EFUNC(interact_menu,addActionToObject); }; diff --git a/addons/cargo/functions/fnc_onMenuOpen.sqf b/addons/cargo/functions/fnc_onMenuOpen.sqf index b0f7e7ffb9..f99999aabf 100644 --- a/addons/cargo/functions/fnc_onMenuOpen.sqf +++ b/addons/cargo/functions/fnc_onMenuOpen.sqf @@ -25,6 +25,9 @@ if (GVAR(interactionParadrop)) then { (_display displayCtrl 12) ctrlSetText LLSTRING(paradropButton); }; +// Disable deploy option if paradropping or in Zeus +(_display displayCtrl 13) ctrlEnable (GVAR(enableDeploy) && !GVAR(interactionParadrop) && {isNull curatorCamera}); + [{ params ["_vehicle", "_pfhID"]; @@ -33,7 +36,6 @@ if (GVAR(interactionParadrop)) then { private _display = uiNamespace getVariable QGVAR(menuDisplay); if (isNil "_display") exitWith { - GVAR(interactionVehicle) = nil; GVAR(interactionParadrop) = nil; _pfhID call CBA_fnc_removePerFrameHandler; @@ -41,18 +43,18 @@ if (GVAR(interactionParadrop)) then { // Close menu if in invalid state if ( - !alive _vehicle || + !alive ACE_player || + {!alive _vehicle} || {locked _vehicle >= 2} || {!(_vehicle getVariable [QGVAR(hasCargo), true])} || // if the cargo menu could be opened, the vehicle has QGVAR(hasCargo) in its config or the variable is set using FUNC(setSpace) { - isNull findDisplay 312 && // if in Zeus, ignore the following checks + isNull curatorCamera && // if in Zeus, ignore the checks that follow {([ACE_player, _vehicle] call EFUNC(interaction,getInteractionDistance)) >= MAX_LOAD_DISTANCE} && {(vehicle ACE_player) != _vehicle} } ) exitWith { closeDialog 0; - GVAR(interactionVehicle) = nil; GVAR(interactionParadrop) = nil; _pfhID call CBA_fnc_removePerFrameHandler; diff --git a/addons/cargo/functions/fnc_startDeploy.sqf b/addons/cargo/functions/fnc_startDeploy.sqf new file mode 100644 index 0000000000..185f71c712 --- /dev/null +++ b/addons/cargo/functions/fnc_startDeploy.sqf @@ -0,0 +1,86 @@ +#include "..\script_component.hpp" +/* + * Author: Garth 'L-H' de Wet, Ruthberg, commy2, Smith + * Starts the deploy process for unloading an object. + * + * Arguments: + * 0: Unit deploying + * + * Return Value: + * None + * + * Example: + * player call ace_cargo_fnc_startDeploy + * + * Public: No + */ + +// Deny creating preview item as it will destroy player vehicle instantly by collision +if (GVAR(interactionParadrop)) exitWith {}; + +params ["_unit"]; + +// Don't allow deploying if already deploying +if (_unit getVariable [QGVAR(isDeploying), false]) exitWith {}; + +// This can be an object or a classname string +private _item = call FUNC(getSelectedItem); + +if (isNil "_item") exitWith {}; + +// Close opened cargo menu +closeDialog 0; + +GVAR(selectedItem) = _item; + +private _classname = _item; + +if (_classname isEqualType objNull) then { + _classname = typeOf _classname; +}; + +// Prevent the placing unit from running +[_unit, "forceWalk", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); +[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); + +// Create a local preview object +private _itemPreviewObject = createVehicleLocal [_classname, [0, 0, 0], [], 0, "CAN_COLLIDE"]; + +GVAR(itemPreviewObject) = _itemPreviewObject; + +// Prevent collisions with object +_itemPreviewObject disableCollisionWith _unit; +_itemPreviewObject enableSimulation false; +_itemPreviewObject setMass 1e-12; + +// Detect radius of zone where collision can damage the player +private _itemPreviewObjectRadius = 1 max ((boundingBoxReal [_itemPreviewObject, "FireGeometry"]) select 2); + +// Add height offset of model +private _offset = ((_itemPreviewObject modelToWorldVisual [0, 0, 0]) select 2) - ((_unit modelToWorldVisual [0, 0, 0]) select 2) + 1; + +// Attach object +_itemPreviewObject attachTo [_unit, [0, 1.5 * _itemPreviewObjectRadius, _offset]]; + +// PFH that runs while the deployment is in progress +GVAR(deployPFH) = [{ + (_this select 0) params ["_unit", "_vehicle", "_item", "_itemPreviewObject"]; + + if !( + !isNull _itemPreviewObject && + {[_item, _vehicle, _unit, false, true] call FUNC(canUnloadItem)} // don't check for a suitable unloading position when deploying + ) exitWith { + _unit call FUNC(deployCancel); + }; +}, 0.5, [_unit, GVAR(interactionVehicle), _item, _itemPreviewObject]] call CBA_fnc_addPerFrameHandler; + +// Add mouse button action and hint +[LLSTRING(unloadObject), localize "STR_DISP_CANCEL", LLSTRING(scrollAction)] call EFUNC(interaction,showMouseHint); + +_unit setVariable [QGVAR(deploy), [ + _unit, "DefaultAction", + {GVAR(deployPFH) != -1}, + {[_this select 0] call FUNC(deployConfirm)} +] call EFUNC(common,addActionEventHandler)]; + +_unit setVariable [QGVAR(isDeploying), true, true]; diff --git a/addons/cargo/functions/fnc_startLoadIn.sqf b/addons/cargo/functions/fnc_startLoadIn.sqf index 767e5b8d68..7212d89c22 100644 --- a/addons/cargo/functions/fnc_startLoadIn.sqf +++ b/addons/cargo/functions/fnc_startLoadIn.sqf @@ -64,6 +64,8 @@ if ([_item, _vehicle] call FUNC(canLoadItemIn)) then { [objNull, _item, true] call EFUNC(common,claim); + [[LSTRING(loadingFailed), [_item, true] call FUNC(getNameItem)], 3] call EFUNC(common,displayTextStructured); + // Fix cancelling loading a carried item if (!isNull attachedTo _item) then { detach _item; @@ -76,7 +78,7 @@ if ([_item, _vehicle] call FUNC(canLoadItemIn)) then { [QEGVAR(common,fixFloating), _item, _item] call CBA_fnc_targetEvent; }; }, - LLSTRING(loadingItem), + format [LLSTRING(loadingItem), [_item, true] call FUNC(getNameItem), getText (configOf _vehicle >> "displayName")], { (_this select 0) call FUNC(canLoadItemIn) }, @@ -85,6 +87,9 @@ if ([_item, _vehicle] call FUNC(canLoadItemIn)) then { true // return } else { + // Unlock the object + [objNull, _item, true] call EFUNC(common,claim); + [[LSTRING(loadingFailed), [_item, true] call FUNC(getNameItem)], 3] call EFUNC(common,displayTextStructured); // Fix cancelling loading a carried item diff --git a/addons/cargo/functions/fnc_startUnload.sqf b/addons/cargo/functions/fnc_startUnload.sqf index 2fe9e923c2..39dbf59f48 100644 --- a/addons/cargo/functions/fnc_startUnload.sqf +++ b/addons/cargo/functions/fnc_startUnload.sqf @@ -15,18 +15,8 @@ * Public: No */ -disableSerialization; - -private _display = uiNamespace getVariable QGVAR(menuDisplay); - -if (isNil "_display") exitWith {}; - -private _loaded = GVAR(interactionVehicle) getVariable [QGVAR(loaded), []]; - -if (_loaded isEqualTo []) exitWith {}; - // This can be an object or a classname string -private _item = _loaded param [lbCurSel (_display displayCtrl 100), nil]; +private _item = call FUNC(getSelectedItem); if (isNil "_item") exitWith {}; @@ -58,13 +48,13 @@ if (GVAR(interactionParadrop)) exitWith { [LSTRING(unlevelFlightWarning)] call EFUNC(common,displayTextStructured); }; }, - LLSTRING(unloadingItem), + format [LLSTRING(unloadingItem), [_item, true] call FUNC(getNameItem), getText (configOf GVAR(interactionVehicle) >> "displayName")], { - (_this select 0) params ["", "_target"]; + (_this select 0) params ["", "_vehicle"]; - if ((acos ((vectorUp _target) select 2)) > 30) exitWith {false}; // check flight level - if (((getPos _target) select 2) < 25) exitWith {false}; // check height - if ((speed _target) < -5) exitWith {false}; // check reverse + if ((acos ((vectorUp _vehicle) select 2)) > 30) exitWith {false}; // check flight level + if (((getPos _vehicle) select 2) < 25) exitWith {false}; // check height + if ((speed _vehicle) < -5) exitWith {false}; // check reverse true }, @@ -74,7 +64,7 @@ if (GVAR(interactionParadrop)) exitWith { }; // If in zeus -if (!isNull findDisplay 312) exitWith { +if (!isNull curatorCamera) exitWith { // Do not check distance to unit, but do check for valid position if !([_item, GVAR(interactionVehicle), objNull, true] call FUNC(canUnloadItem)) exitWith { [[LSTRING(unloadingFailed), [_item, true] call FUNC(getNameItem)], 3] call EFUNC(common,displayTextStructured); @@ -109,7 +99,7 @@ if ([_item, GVAR(interactionVehicle), _unit] call FUNC(canUnloadItem)) then { { TRACE_1("unload fail",_this); }, - LLSTRING(unloadingItem), + format [LLSTRING(unloadingItem), [_item, true] call FUNC(getNameItem), getText (configOf GVAR(interactionVehicle) >> "displayName")], { (_this select 0) params ["_item", "_vehicle", "_unit"]; diff --git a/addons/cargo/functions/fnc_unloadItem.sqf b/addons/cargo/functions/fnc_unloadItem.sqf index c18e89361e..f32215fdd7 100644 --- a/addons/cargo/functions/fnc_unloadItem.sqf +++ b/addons/cargo/functions/fnc_unloadItem.sqf @@ -7,6 +7,9 @@ * 0: Item to be unloaded or (default: "") * 1: Holder object (vehicle) (default: objNull) * 2: Unloader (default: objNull) + * 3: Deploy parameters (default: []) + * - 0: Position AGL + * - 1: Direction * * Return Value: * Object unloaded @@ -17,8 +20,10 @@ * Public: Yes */ -params [["_item", "", [objNull, ""]], ["_vehicle", objNull, [objNull]], ["_unloader", objNull, [objNull]]]; -TRACE_3("params",_item,_vehicle,_unloader); +params [["_item", "", [objNull, ""]], ["_vehicle", objNull, [objNull]], ["_unloader", objNull, [objNull]], ["_deploy", []]]; +_deploy params ["_emptyPosAGL", "_direction"]; + +TRACE_4("params",_item,_vehicle,_unloader,_deploy); // Get config sensitive case name if (_item isEqualType "") then { @@ -41,9 +46,18 @@ if (_itemSize < 0) exitWith { false // return }; -// This covers testing vehicle stability and finding a safe position -private _emptyPosAGL = [_vehicle, _item, _unloader] call EFUNC(common,findUnloadPosition); -TRACE_1("findUnloadPosition",_emptyPosAGL); +private _deployed = _deploy isNotEqualTo []; + +if (!_deployed) then { + // This covers testing vehicle stability and finding a safe position + for "_i" from 1 to 3 do { + _emptyPosAGL = [_vehicle, _item, _unloader] call EFUNC(common,findUnloadPosition); + + if (_emptyPosAGL isNotEqualTo []) exitWith {}; + }; + + TRACE_1("findUnloadPosition",_emptyPosAGL); +}; if (_emptyPosAGL isEqualTo []) exitWith { // Display text saying there are no safe places to exit the vehicle @@ -67,9 +81,12 @@ private _object = _item; if (_object isEqualType objNull) then { detach _object; - // hideObjectGlobal must be executed before setPos to ensure light objects are rendered correctly - // Do both on server to ensure they are executed in the correct order - [QGVAR(serverUnload), [_object, _emptyPosAGL]] call CBA_fnc_serverEvent; + // If player unloads via deployment, set direction first, then unload + if (_deployed) then { + [QGVAR(setDirAndUnload), [_object, _emptyPosAGL, _direction], _object] call CBA_fnc_targetEvent; + } else { + [QGVAR(serverUnload), [_object, _emptyPosAGL]] call CBA_fnc_serverEvent; + }; if (["ace_zeus"] call EFUNC(common,isModLoaded)) then { // Get which curators had this object as editable @@ -81,6 +98,12 @@ if (_object isEqualType objNull) then { }; } else { _object = createVehicle [_item, _emptyPosAGL, [], 0, "NONE"]; + + // If player unloads via deployment, set direction. Must happen before setPosASL command according to wiki + if (_deployed) then { + _object setDir _direction; + }; + _object setPosASL (AGLtoASL _emptyPosAGL); [QEGVAR(common,fixCollision), _object] call CBA_fnc_localEvent; @@ -88,7 +111,9 @@ if (_object isEqualType objNull) then { }; // Dragging integration -[_unloader, _object] call FUNC(unloadCarryItem); +if (!_deployed) then { + [_unloader, _object] call FUNC(unloadCarryItem); +}; // Invoke listenable event ["ace_cargoUnloaded", [_object, _vehicle, "unload"]] call CBA_fnc_globalEvent; diff --git a/addons/cargo/initSettings.inc.sqf b/addons/cargo/initSettings.inc.sqf index 2f9fd94024..029a845a25 100644 --- a/addons/cargo/initSettings.inc.sqf +++ b/addons/cargo/initSettings.inc.sqf @@ -6,7 +6,7 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)]; [LSTRING(ModuleSettings_enable), LSTRING(ModuleSettings_enable_Description)], _category, true, - true, + 1, {[QGVAR(enable), _this] call EFUNC(common,cbaSettings_settingChanged)} ] call CBA_fnc_addSetting; @@ -16,7 +16,7 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)]; [LSTRING(loadTimeCoefficient), LSTRING(loadTimeCoefficient_description)], _category, [0, 10, 5, 1], - true, + 1, {[QGVAR(loadTimeCoefficient), _this, true] call EFUNC(common,cbaSettings_settingChanged)} ] call CBA_fnc_addSetting; @@ -26,7 +26,7 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)]; [LSTRING(paradropTimeCoefficent), LSTRING(paradropTimeCoefficent_description)], _category, [0, 10, 2.5, 1], - true, + 1, {[QGVAR(paradropTimeCoefficent), _this, true] call EFUNC(common,cbaSettings_settingChanged)} ] call CBA_fnc_addSetting; @@ -36,26 +36,36 @@ private _category = [ELSTRING(main,Category_Logistics), LSTRING(openMenu)]; [LSTRING(openAfterUnload), LSTRING(openAfterUnload_description)], _category, [[0, 1, 2, 3], [ELSTRING(common,never), LSTRING(unloadObject), LSTRING(paradropButton), ELSTRING(common,both)], 0], - false, + 0, {[QGVAR(openAfterUnload), _this, true] call EFUNC(common,cbaSettings_settingChanged)} ] call CBA_fnc_addSetting; -[ - QGVAR(enableRename), - "CHECKBOX", - [LSTRING(ModuleSettings_enableRename), LSTRING(ModuleSettings_enableRename_Description)], - _category, - true, - false, - {[QGVAR(enableRename), _this, true] call EFUNC(common,cbaSettings_settingChanged)} -] call CBA_fnc_addSetting; - [ QGVAR(carryAfterUnload), "CHECKBOX", [LSTRING(carryAfterUnload), LSTRING(carryAfterUnload_description)], _category, true, - false, + 0, {[QGVAR(carryAfterUnload), _this] call EFUNC(common,cbaSettings_settingChanged)} ] call CBA_fnc_addSetting; + +[ + QGVAR(enableDeploy), + "CHECKBOX", + [LSTRING(enableDeploy), LSTRING(enableDeploy_description)], + _category, + true, + 1, + {[QGVAR(enableDeploy), _this] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_fnc_addSetting; + +[ + QGVAR(enableRename), + "CHECKBOX", + [LSTRING(ModuleSettings_enableRename), LSTRING(ModuleSettings_enableRename_Description)], + _category, + true, + 0, + {[QGVAR(enableRename), _this, true] call EFUNC(common,cbaSettings_settingChanged)} +] call CBA_fnc_addSetting; diff --git a/addons/cargo/menu.hpp b/addons/cargo/menu.hpp index 8c41fc43a5..1811369d7d 100644 --- a/addons/cargo/menu.hpp +++ b/addons/cargo/menu.hpp @@ -17,7 +17,7 @@ class GVAR(menu) { }; class CenterBackground: HeaderBackground { y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - h = "13.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + h = "14.2 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; text = "#(argb,8,8,3)color(0,0,0,0.8)"; colorText[] = {0, 0, 0, "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"}; colorBackground[] = {0, 0, 0, "(profilenamespace getVariable ['GUI_BCG_RGB_A',0.9])"}; @@ -72,7 +72,7 @@ class GVAR(menu) { idc = 11; x = "13.1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; y = "14.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "5 * (((safezoneW / safezoneH) min 1.2) / 40)"; + w = "6 * (((safezoneW / safezoneH) min 1.2) / 40)"; h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; @@ -96,8 +96,15 @@ class GVAR(menu) { class btnUnload: btnCancel { text = CSTRING(unloadObject); idc = 12; - x = "20.9 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + x = "19.9 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; action = QUOTE(ACE_player call FUNC(startUnload)); }; + class btnPlace: btnUnload { + text = CSTRING(deployObject); + idc = 13; + y = "15.2 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + action = QUOTE(ACE_player call FUNC(startDeploy)); + colorDisabled[] = {0.25, 0.25, 0.25, 1}; + }; }; }; diff --git a/addons/cargo/stringtable.xml b/addons/cargo/stringtable.xml index 5e42af6c13..fb541dd693 100644 --- a/addons/cargo/stringtable.xml +++ b/addons/cargo/stringtable.xml @@ -33,6 +33,40 @@ 卸载 Boşalt + + Deploy + + + Raise/Lower | (Ctrl + Scroll) Rotate + Heben/Senken | (Strg + Scrollen) Drehen + Alza/Abbassa | (Ctrl + Rotellina) Ruota + Lever/Baisser | (Ctrl + Scroll) Rotation + 上げる/下げる | (Ctrl + スクロール) 回転 + Zvednout/Snížit | (Ctrl + Kolečko myši) Otáčet + Поднять/опустить | (Ctrl + Скролл) Крутить + Wyżej/niżej | (Ctrl + Kółko myszy) obracanie + Yükselt/Alçalt | (Ctrl + Tekerlek) Döndür + Subir/Bajar | (Ctrl + Scroll) Rotar + 抬起/放低 |(Ctrl + 鼠标滚轮)旋转 + 높이기/내리기 | (컨트롤 + 스크롤) 회전 + Subir/Abaixar | (Ctrl + Scroll) Rotacionar + + + Blocked + Obstruido + Bloqueado + Заблокировано + Blokováno + Zablokowany + Bloccato + Blockiert + Bloqué + 取り付け不可 + 막힘 + 断开 + 斷開 + Bloke Edilmiş + Renamed to:<br/>%1 名前を次に変更:<br/>%1 @@ -48,7 +82,7 @@ Custom name has been cleared. - カスタムネームが削除されました。 + カスタム名が削除されました。 Le nom personnalisé a été supprimé. Пользовательское название удалено. Eigener Name wurde gelöscht. @@ -108,7 +142,7 @@ Carga Carico Cargaison - カーゴ + 貨物 화물 貨物 货物 @@ -124,7 +158,7 @@ Menu de carga Menù del Carico Menu de cargaison - カーゴ メニュー + 貨物メニュー 화물 메뉴 貨物選單 货物菜单 @@ -140,7 +174,7 @@ Espacio de carga restante: %1 Spazio di carico rimanente: %1 Espace de chargement restant : %1 - カーゴの空き容量: %1 + 貨物室の空き容量: %1 선적 공간 남음: %1 貨物剩餘空間: %1 货物剩余空间:%1 @@ -156,7 +190,7 @@ Habilitar carga Abilita Carico Activer la cargaison - カーゴを有効化 + 貨物を有効化 화물 활성화 啟用貨物裝載 启用货物装载 @@ -172,7 +206,7 @@ Umožňuje naložit předměty do nákladového prostoru vozidla Abilita il modulo di caricamento nel carico Active la possibilité de charger du matériel dans un module de fret (véhicule/container). - カーゴ モジュールで積み込みを有効化 + 貨物積載モジュールを有効化 화물 모듈을 활성화합니다 啟用貨物裝載功能 启用货物装载功能 @@ -187,7 +221,7 @@ Ajustes de carga Impostazioni Carico Paramètres de cargaison - カーゴ設定 + 貨物設定 화물 설정 貨物設定 货物设定 @@ -203,7 +237,7 @@ Konfigurace nákladního modulu Configura le impostazioni del modulo carico Configure les paramètres du module de cargaison. - カーゴ モジュールの設定を構成 + 貨物モジュールの設定を変更します 화물 모듈의 환경 설정을 바꿉니다 配置貨物模塊設定 配置货物模块设定 @@ -219,7 +253,7 @@ %1<br/>caricato su<br/>%2 %1<br/>berakodva ide:<br/>%2 %1<br/>загружен в<br/>%2 - %1 は<br/>%2 へ<br/>積み込まれました + %1 を<br/>%2 に<br/>積み込みました %1은(는)<br/>%2 에 실림 %1<br/>裝載至<br/>%2 %1<br/>装载至<br/>%2 @@ -235,42 +269,20 @@ Hai scaricato<br/>%1 da<br/>%2 1%<br/>kirakodva ebből:<br/>%2 %1<br/>разгружен из<br/>%2 - %1 が<br/>%2 から<br/>降ろされました + %1 を<br/>%2 から<br/>降ろしました %1은(는)<br/>%2에서 내려짐 從<br/>%2卸載<br/>%1 从<br/>%2卸载<br/>%1 - Loading Cargo - Belade - Carregando carga - Ładowanie cargo - Nakládám - Погрузка - Caricando - Cargando - Chargement de la cargaison - カーゴへ積み込んでいます - 화물 싣기 - 裝載貨物中 - 正在装载货物 - Kargo Yükleniyor + Loading %1 into %2... + Cargando %1 en %2... + %1 を %2 に積み込んでいます・・・ - Unloading Cargo - Entlade - Descarregando carga - Rozładowywanie cargo - Vykládám - Выгрузка - Scaricando - Descargando - Déchargement de la cargaison - カーゴから降ろしています - 화물 내리기 - 卸載貨物中 - 正在卸载货物 - Kargo Boşaltılıyor + Unloading %1 from %2... + Descargando %1 de %2... + %1 を %2 から降ろしています・・・ %1<br/>could not be loaded @@ -309,7 +321,7 @@ Kann nicht entladen werden Impossibile da scaricare Ne peut pas être déchargé - 降ろせません + 荷降ろし不可能です 하역할 수가 없습니다 @@ -317,12 +329,12 @@ Frachtgröße: %1 Dimensione Carico: %1 Encombrement fret: %1 - カーゴ サイズ: %1 + 貨物のサイズ: %1 화물 크기: %1 Custom Name - カスタムネーム + カスタム名 Nom personnalisé Eigener Name Nome Personalizzato @@ -335,7 +347,7 @@ Set a custom cargo name used in the cargo interface. - カーゴ一覧で使用されるカスタムネームを設定します。 + 貨物インターフェイスで使用されるカスタム名を設定します。 Définit un nom de fret personnalisé qui sera visible dans le menu de cargaison. Установить пользовательское имя груза, используемое в интерфейсе погрузки. Definiere eigenen Frachtnamen, welcher im Frachtraum genutzt wird. @@ -350,7 +362,7 @@ Cargo Space Frachtraum Spazio di Carico - カーゴ スペース + 貨物室の容量 貨物空間 货物空间 Przestrzeń ładunkowa @@ -366,7 +378,7 @@ The cargo space available in this vehicle/container Verfügbarer Frachtraum in diesem Fahrzeug/Container Lo spazio disponibile in questo veicolo/container - この車両/コンテナでカーゴ スペースを使えるようにします + この車両/コンテナで使用可能な貨物室の容量 設定此載具/集裝箱可裝載多少貨物 设定此载具/集装箱可装载多少货物 Dostępna przestrzeń ładunkowa w tym pojeździe/kontenerze @@ -381,7 +393,7 @@ Cargo Size Frachtgröße Dimensioni nel Carico - カーゴ サイズ + 貨物のサイズ 貨物的大小 货物的大小 Wielkość ładunku @@ -397,7 +409,7 @@ The cargo space required to hold this object (-1 for not loadable) Frachtraumgröße, welche zum Einladen dieses Objektes benötigt wird (-1 nicht einladbar) Lo spazio di carico necessario per contenere questo oggetto (-1 per non caricabile) - オブジェクトを積載するのに必要なカーゴ スペース (-1 で積載不可にします) + このオブジェクトの積載に必要な貨物室の容量 (-1 で積載不可に) 此貨物會佔掉多少空間(設定-1的話此貨物就不能被裝載) 此货物会占掉多少空间(设定 -1 的话此货物就不能被装载) Wymagana przestrzeń ładunkowa dla tego obiektu (-1 dla niemożliwych do załadowania) @@ -456,7 +468,7 @@ Modifier for how long it takes to paradrop a cargo item. Beeinflusst die zusätzliche Zeit für Türlastabwürfe. - カーゴ アイテムを空中投下するまでの時間を変更します。 + 貨物の空中投下に掛かる時間を変更します。 Modifica quanto tempo viene impiegato per paracadutare oggetti dal carico. Modifie le temps nécessaire au paralargage d'une cargaison. 設定空投所需消耗的時間 @@ -471,7 +483,7 @@ Load Time Coefficient Ladezeitmultiplikator - 積載所要時間係数 + 積載の所要時間係数 Współczynnik czasu załadowania Coefficente Tempo Caricamento Коэф. времени погрузки @@ -486,7 +498,7 @@ Modifies how long it takes to load/unload items.\nTime, in seconds, is the size of the item multiplied by this value. Gibt an, wie lange das Laden / Entladen von Gegenständen dauern soll.\nZeit in Sekunden, die mit der Größe des Gegenstandes multipliziert wird. - アイテムのロード/アンロードに掛かる時間を変更します。\n時間 (秒) は、アイテムのサイズにこの値を掛けたものです。 + 貨物の積み込み/積み下ろしに掛かる時間を変更します。\n時間 (秒) は、貨物のサイズにこの値を掛けたものです。 Modyfikuje, jak długo zajmuje załadowywanie/wyładowywanie przedmiotów. \nCzasem, w sekundach, jest wielkość przedmiotu razy jego wartość. Modifica il tempo impiegato per caricare o scaricare gli oggetti.\nIl tempo, in secondi, equivale alla dimensione dell'oggetto moltiplicata per questo valore Изменяет время для загрузки/выгрузки предметов. \n Время (сек) - это размер предмета, умноженный на это значение. @@ -501,7 +513,7 @@ Reopen Cargo Menu Kargo Menüsünü Tekrar Aç - カーゴ メニューを再度開く + 貨物メニューを再度開く Rouvrir le menu de cargaison Переоткрыть меню погрузки Frachtmenü erneut öffnen @@ -515,7 +527,7 @@ Reopen the Cargo Menu after successful unload. Başarılı bir yük indirmeden sonra Kargo Menüsünü tekrar göster. - カーゴを降ろした後に再びカーゴ メニューを開きます。 + 貨物を降ろした後に再び貨物メニューを開きます。 Réouvre le menu de cargaison après un déchargement réussi. Переоткрыть меню погрузки после успешной выгрузки. Frachtmenü erneut öffnen, nach erfolgreichen Entladen. @@ -531,7 +543,7 @@ 화물 내린 후 운반 Нести после выгрузки Llevar encima tras la descarga - 荷降ろし後の運搬 + 荷降ろし後に持ち運ぶ Niesienie Po Rozładowaniu Nach dem Entladen tragen Trasporta dopo aver Scaricato @@ -543,12 +555,18 @@ 화물 아이템을 내린 후 들거나 끌지 여부를 결정합니다. Нужно ли переносить или тащить предметы после их выгрузки. Controla si los objetos de carga son llevados encima o arrastrados despues de la descarga. - 荷降ろし後、貨物アイテムを運ぶか引きずるかを制御する。 + 荷降ろし後、貨物を運ぶか引きずるかを制御する。 Kontroluje, czy przedmioty z ładunku są przenoszone lub ciągnięte po ich wyładowaniu. Steuert, ob Objekte nach dem Entladen getragen oder gezogen werden. Determina se un oggetto verrà subito trasportato o trascinato dopo essere stato scaricato. Active si les éléments de cargaison sont portés ou traînés après le déchargement. Controla se os itens de carga são carregados ou arrastados após a descarga. + + Enable deploy + + + Controls whether cargo items can be unloaded via the deploy method. + diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 414a0ff7b5..af4b33d49b 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -29,7 +29,7 @@ ["blockRadio", false, [QEGVAR(captives,Handcuffed), QEGVAR(captives,Surrendered), "ace_unconscious"]] call FUNC(statusEffect_addType); ["blockSpeaking", false, ["ace_unconscious"]] call FUNC(statusEffect_addType); ["disableWeaponAssembly", false, ["ace_common", "ace_common_lockVehicle", "ace_csw"]] call FUNC(statusEffect_addType); -["lockInventory", true, []] call FUNC(statusEffect_addType); +["lockInventory", true, [], true] call FUNC(statusEffect_addType); [QGVAR(forceWalk), { params ["_object", "_set"]; @@ -96,7 +96,7 @@ _object setVariable ["acre_sys_core_isDisabled", _set > 0, true]; }; if (["task_force_radio"] call FUNC(isModLoaded)) then { - _object setVariable ["tf_voiceVolume", [1, 0] select (_set > 0), true]; + _object setVariable ["tf_voiceVolume", parseNumber (_set == 0), true]; }; }] call CBA_fnc_addEventHandler; @@ -142,7 +142,7 @@ if (isServer) then { if ((!isNil "_zeusLogic") && {!isNull _zeusLogic}) then { { if ((_x getvariable ["bis_fnc_moduleRemoteControl_owner", objnull]) isEqualTo _dcPlayer) exitWith { - INFO_3("[%1] DC - Was Zeus [%2] while controlling unit [%3] - manually clearing `bis_fnc_moduleRemoteControl_owner`", [_x] call FUNC(getName), _dcPlayer, _x); + INFO_3("[%1] DC - Was Zeus [%2] while controlling unit [%3] - manually clearing `bis_fnc_moduleRemoteControl_owner`",[_x] call FUNC(getName),_dcPlayer,_x); _x setVariable ["bis_fnc_moduleRemoteControl_owner", nil, true]; }; nil diff --git a/addons/common/XEH_preInit.sqf b/addons/common/XEH_preInit.sqf index 78c08d5e42..9b5d27d12c 100644 --- a/addons/common/XEH_preInit.sqf +++ b/addons/common/XEH_preInit.sqf @@ -32,6 +32,7 @@ ACE_COUNTERS = []; GVAR(statusEffect_Names) = []; GVAR(statusEffect_isGlobal) = []; +GVAR(statusEffect_sendJIP) = []; GVAR(setHearingCapabilityMap) = []; diff --git a/addons/common/XEH_preStart.sqf b/addons/common/XEH_preStart.sqf index b872756af8..208adea7b1 100644 --- a/addons/common/XEH_preStart.sqf +++ b/addons/common/XEH_preStart.sqf @@ -5,7 +5,7 @@ if (isFilePatchingEnabled) then { private _notLoaded = configProperties [configfile >> "ace_notLoaded", "isText _x"]; { - INFO_2("%1 not loaded because %2",configName _x, getText _x); + INFO_2("%1 not loaded because %2",configName _x,getText _x); } forEach _notLoaded; }; diff --git a/addons/common/define.hpp b/addons/common/define.hpp index 9e9e92ecb5..ce8765ec9f 100644 --- a/addons/common/define.hpp +++ b/addons/common/define.hpp @@ -1,124 +1,106 @@ - #ifndef ACE_DEFINE_H #define ACE_DEFINE_H // define.hpp -#define true 1 -#define false 0 +#define true 1 +#define false 0 -#define CT_STATIC 0 -#define CT_BUTTON 1 -#define CT_EDIT 2 -#define CT_SLIDER 3 -#define CT_COMBO 4 -#define CT_LISTBOX 5 -#define CT_TOOLBOX 6 -#define CT_CHECKBOXES 7 -#define CT_PROGRESS 8 -#define CT_HTML 9 -#define CT_STATIC_SKEW 10 -#define CT_ACTIVETEXT 11 -#define CT_TREE 12 +#define CT_STATIC 0 +#define CT_BUTTON 1 +#define CT_EDIT 2 +#define CT_SLIDER 3 +#define CT_COMBO 4 +#define CT_LISTBOX 5 +#define CT_TOOLBOX 6 +#define CT_CHECKBOXES 7 +#define CT_PROGRESS 8 +#define CT_HTML 9 +#define CT_STATIC_SKEW 10 +#define CT_ACTIVETEXT 11 +#define CT_TREE 12 #define CT_STRUCTURED_TEXT 13 -#define CT_CONTEXT_MENU 14 -#define CT_CONTROLS_GROUP 15 -#define CT_SHORTCUTBUTTON 16 -#define CT_XKEYDESC 40 -#define CT_XBUTTON 41 -#define CT_XLISTBOX 42 -#define CT_XSLIDER 43 -#define CT_XCOMBO 44 +#define CT_CONTEXT_MENU 14 +#define CT_CONTROLS_GROUP 15 +#define CT_SHORTCUTBUTTON 16 +#define CT_XKEYDESC 40 +#define CT_XBUTTON 41 +#define CT_XLISTBOX 42 +#define CT_XSLIDER 43 +#define CT_XCOMBO 44 #define CT_ANIMATED_TEXTURE 45 -#define CT_OBJECT 80 -#define CT_OBJECT_ZOOM 81 +#define CT_OBJECT 80 +#define CT_OBJECT_ZOOM 81 #define CT_OBJECT_CONTAINER 82 #define CT_OBJECT_CONT_ANIM 83 -#define CT_LINEBREAK 98 -#define CT_ANIMATED_USER 99 -#define CT_MAP 100 -#define CT_MAP_MAIN 101 -#define CT_LISTNBOX 102 +#define CT_LINEBREAK 98 +#define CT_ANIMATED_USER 99 +#define CT_MAP 100 +#define CT_MAP_MAIN 101 +#define CT_LISTNBOX 102 // Static styles -#define ST_POS 0x0F -#define ST_HPOS 0x03 -#define ST_VPOS 0x0C -#define ST_LEFT 0x00 -#define ST_RIGHT 0x01 -#define ST_CENTER 0x02 -#define ST_DOWN 0x04 -#define ST_UP 0x08 -#define ST_VCENTER 0x0c +#define ST_POS 0x0F +#define ST_HPOS 0x03 +#define ST_VPOS 0x0C +#define ST_LEFT 0x00 +#define ST_RIGHT 0x01 +#define ST_CENTER 0x02 +#define ST_DOWN 0x04 +#define ST_UP 0x08 +#define ST_VCENTER 0x0C -#define ST_TYPE 0xF0 -#define ST_SINGLE 0 -#define ST_MULTI 16 -#define ST_TITLE_BAR 32 -#define ST_PICTURE 48 -#define ST_FRAME 64 -#define ST_BACKGROUND 80 -#define ST_GROUP_BOX 96 -#define ST_GROUP_BOX2 112 -#define ST_HUD_BACKGROUND 128 -#define ST_TILE_PICTURE 144 -#define ST_WITH_RECT 160 -#define ST_LINE 176 +#define ST_TYPE 0xF0 +#define ST_SINGLE 0 +#define ST_MULTI 16 +#define ST_TITLE_BAR 32 +#define ST_PICTURE 48 +#define ST_FRAME 64 +#define ST_BACKGROUND 80 +#define ST_GROUP_BOX 96 +#define ST_GROUP_BOX2 112 +#define ST_HUD_BACKGROUND 128 +#define ST_TILE_PICTURE 144 +#define ST_WITH_RECT 160 +#define ST_LINE 176 -#define ST_SHADOW 0x100 -#define ST_NO_RECT 0x200 // this style works for CT_STATIC in conjunction with ST_MULTI -#define ST_KEEP_ASPECT_RATIO 0x800 +#define ST_SHADOW 0x100 +#define ST_NO_RECT 0x200 // this style works for CT_STATIC in conjunction with ST_MULTI +#define ST_KEEP_ASPECT_RATIO 0x800 -#define ST_TITLE ST_TITLE_BAR + ST_CENTER +#define ST_TITLE ST_TITLE_BAR + ST_CENTER // Slider styles -#define SL_DIR 0x400 -#define SL_VERT 0 -#define SL_HORZ 0x400 +#define SL_DIR 0x400 +#define SL_VERT 0 +#define SL_HORZ 0x400 -#define SL_TEXTURES 0x10 +#define SL_TEXTURES 0x10 // Listbox styles -#define LB_TEXTURES 0x10 -#define LB_MULTI 0x20 -#define FONT_ACE "RobotoCondensed" +#define LB_TEXTURES 0x10 +#define LB_MULTI 0x20 +#define FONT_ACE "RobotoCondensed" class ACE_gui_backgroundBase { - type = CT_STATIC; - idc = -1; - style = ST_PICTURE; - colorBackground[] = {0,0,0,0}; - colorText[] = {1, 1, 1, 1}; - font = FONT_ACE; - text = ""; - sizeEx = 0.032; + type = CT_STATIC; + idc = -1; + style = ST_PICTURE; + colorBackground[] = {0, 0, 0, 0}; + colorText[] = {1, 1, 1, 1}; + font = FONT_ACE; + text = ""; + sizeEx = 0.032; }; + class ACE_gui_editBase { type = 2; x = 0; y = 0; h = 0.04; w = 0.2; - colorBackground[] = - { - 0, - 0, - 0, - 1 - }; - colorText[] = - { - 0.95, - 0.95, - 0.95, - 1 - }; - colorSelection[] = - { - "(profilenamespace getVariable ['GUI_BCG_RGB_R',0.3843])", - "(profilenamespace getVariable ['GUI_BCG_RGB_G',0.7019])", - "(profilenamespace getVariable ['GUI_BCG_RGB_B',0.8862])", - 1 - }; + colorBackground[] = {0, 0, 0, 1}; + colorText[] = {0.95, 0.95, 0.95, 1}; + colorSelection[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getVariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getVariable ['GUI_BCG_RGB_B',0.8862])", 1}; autocomplete = ""; text = ""; size = 0.2; @@ -126,629 +108,621 @@ class ACE_gui_editBase { font = "RobotoCondensed"; shadow = 2; sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; - colorDisabled[] = - { - 1, - 1, - 1, - 0.25 + colorDisabled[] = {1, 1, 1, 0.25}; +}; + +class ACE_gui_buttonBase { + idc = -1; + type = 16; + style = ST_LEFT; + text = ""; + action = ""; + x = 0; + y = 0; + w = 0.25; + h = 0.04; + size = 0.03921; + sizeEx = 0.03921; + color[] = {1, 1, 1, 1}; + color2[] = {1, 1, 1, 1}; + colorBackground[] = {1, 1, 1, 0.95}; + colorbackground2[] = {1, 1, 1, 0.95}; + colorDisabled[] = {1, 1, 1, 0.6}; + colorFocused[] = {1, 1, 1, 1}; + colorBackgroundFocused[] = {1, 1, 1, 1}; + periodFocus = 1.2; + periodOver = 0.8; + default = 0; + + class HitZone { + left = 0; + top = 0; + right = 0; + bottom = 0; + }; + class ShortcutPos { + left = 0; + top = 0; + w = 0; + h = 0; + }; + class TextPos { + left = 0.002; + top = 0.0004; + right = 0; + bottom = 0; + }; + + textureNoShortcut = ""; + animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)"; + animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.8)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; + period = 0.5; + font = FONT_ACE; + soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick", 0.09, 1}; + soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush", 0, 0}; + soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter", 0.07, 1}; + soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape", 0.09, 1}; + + class Attributes { + font = FONT_ACE; + color = "#E5E5E5"; + align = "center"; + shadow = "true"; + }; + class AttributesImage { + font = FONT_ACE; + color = "#E5E5E5"; + align = "left"; + shadow = "true"; }; }; - - -class ACE_gui_buttonBase { - idc = -1; - type = 16; - style = ST_LEFT; - text = ""; - action = ""; - x = 0.0; - y = 0.0; - w = 0.25; - h = 0.04; - size = 0.03921; - sizeEx = 0.03921; - color[] = {1.0, 1.0, 1.0, 1}; - color2[] = {1.0, 1.0, 1.0, 1}; - colorBackground[] = {1,1,1,0.95}; - colorbackground2[] = {1,1,1,0.95}; - colorDisabled[] = {1,1,1,0.6}; - colorFocused[] = {1,1,1,1}; - colorBackgroundFocused[] = {1,1,1,1}; - periodFocus = 1.2; - periodOver = 0.8; - default = 0; - class HitZone { - left = 0.00; - top = 0.00; - right = 0.00; - bottom = 0.00; - }; - - class ShortcutPos { - left = 0.00; - top = 0.00; - w = 0.00; - h = 0.00; - }; - - class TextPos { - left = 0.002; - top = 0.0004; - right = 0.0; - bottom = 0.00; - }; - textureNoShortcut = ""; - animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)"; - animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.8)"; - animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; - animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; - animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; - animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; - period = 0.5; - font = FONT_ACE; - soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick",0.09,1}; - soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.0,0}; - soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter",0.07,1}; - soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape",0.09,1}; - class Attributes { - font = FONT_ACE; - color = "#E5E5E5"; - align = "center"; - shadow = "true"; - }; - class AttributesImage { - font = FONT_ACE; - color = "#E5E5E5"; - align = "left"; - shadow = "true"; - }; -}; - class ACE_gui_RscProgress { - type = 8; - style = 0; - colorFrame[] = {1,1,1,0.7}; - colorBar[] = {1,1,1,0.7}; - texture = "#(argb,8,8,3)color(1,1,1,0.7)"; - x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; - y = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; - w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; - h = "0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + type = 8; + style = 0; + colorFrame[] = {1, 1, 1, 0.7}; + colorBar[] = {1, 1, 1, 0.7}; + texture = "#(argb,8,8,3)color(1,1,1,0.7)"; + x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)"; + y = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)"; + w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "0.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; }; - class ACE_gui_staticBase { - idc = -1; - type = CT_STATIC; - x = 0.0; - y = 0.0; - w = 0.183825; - h = 0.104575; - style = ST_LEFT; - font = FONT_ACE; - sizeEx = 0.03921; - colorText[] = {0.95, 0.95, 0.95, 1.0}; - colorBackground[] = {0, 0, 0, 0}; - text = ""; + idc = -1; + type = CT_STATIC; + x = 0; + y = 0; + w = 0.183825; + h = 0.104575; + style = ST_LEFT; + font = FONT_ACE; + sizeEx = 0.03921; + colorText[] = {0.95, 0.95, 0.95, 1}; + colorBackground[] = {0, 0, 0, 0}; + text = ""; }; class RscListBox; class ACE_gui_listBoxBase: RscListBox { - type = CT_LISTBOX; - style = ST_MULTI; - font = FONT_ACE; - sizeEx = 0.03921; - color[] = {1, 1, 1, 1}; - colorText[] = {0.543, 0.5742, 0.4102, 1.0}; - colorScrollbar[] = {0.95, 0.95, 0.95, 1}; - colorSelect[] = {0.95, 0.95, 0.95, 1}; - colorSelect2[] = {0.95, 0.95, 0.95, 1}; - colorSelectBackground[] = {0, 0, 0, 1}; - colorSelectBackground2[] = {0.543, 0.5742, 0.4102, 1.0}; - colorDisabled[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])", 0.25}; - period = 1.2; - rowHeight = 0.03; - colorBackground[] = {0, 0, 0, 1}; - maxHistoryDelay = 1.0; - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - soundSelect[] = {"",0.1,1}; - soundExpand[] = {"",0.1,1}; - soundCollapse[] = {"",0.1,1}; - class ListScrollBar { - arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; - arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; - autoScrollDelay = 5; - autoScrollEnabled = 0; - autoScrollRewind = 0; + type = CT_LISTBOX; + style = ST_MULTI; + font = FONT_ACE; + sizeEx = 0.03921; + color[] = {1, 1, 1, 1}; + colorText[] = {0.543, 0.5742, 0.4102, 1}; + colorScrollbar[] = {0.95, 0.95, 0.95, 1}; + colorSelect[] = {0.95, 0.95, 0.95, 1}; + colorSelect2[] = {0.95, 0.95, 0.95, 1}; + colorSelectBackground[] = {0, 0, 0, 1}; + colorSelectBackground2[] = {0.543, 0.5742, 0.4102, 1}; + colorDisabled[] = {"(profilenamespace getVariable ['GUI_BCG_RGB_R',0.69])", "(profilenamespace getVariable ['GUI_BCG_RGB_G',0.75])", "(profilenamespace getVariable ['GUI_BCG_RGB_B',0.5])", 0.25}; + period = 1.2; + rowHeight = 0.03; + colorBackground[] = {0, 0, 0, 1}; + maxHistoryDelay = 1; autoScrollSpeed = -1; - border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; - color[] = {1,1,1,0.6}; - colorActive[] = {1,1,1,1}; - colorDisabled[] = {1,1,1,0.3}; - height = 0; - scrollSpeed = 0.06; - shadow = 0; - thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; - width = 0; - }; - class ScrollBar { - color[] = {1, 1, 1, 0.6}; - colorActive[] = {1, 1, 1, 1}; - colorDisabled[] = {1, 1, 1, 0.3}; - thumb = ""; - arrowFull = ""; - arrowEmpty = ""; - border = ""; - }; -}; + autoScrollDelay = 5; + autoScrollRewind = 0; + soundSelect[] = {"", 0.1, 1}; + soundExpand[] = {"", 0.1, 1}; + soundCollapse[] = {"", 0.1, 1}; + class ListScrollBar { + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + autoScrollDelay = 5; + autoScrollEnabled = 0; + autoScrollRewind = 0; + autoScrollSpeed = -1; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + color[] = {1, 1, 1, 0.6}; + colorActive[] = {1, 1, 1, 1}; + colorDisabled[] = {1, 1, 1, 0.3}; + height = 0; + scrollSpeed = 0.06; + shadow = 0; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + width = 0; + }; + class ScrollBar { + color[] = {1, 1, 1, 0.6}; + colorActive[] = {1, 1, 1, 1}; + colorDisabled[] = {1, 1, 1, 0.3}; + thumb = ""; + arrowFull = ""; + arrowEmpty = ""; + border = ""; + }; +}; class ACE_gui_listNBox { - type = CT_LISTNBOX;// 102; - style =ST_MULTI; - w = 0.4; - h = 0.4; - font = FONT_ACE; - sizeEx = 0.031; + type = CT_LISTNBOX; // 102; + style = ST_MULTI; + w = 0.4; + h = 0.4; + font = FONT_ACE; + sizeEx = 0.031; - autoScrollSpeed = -1; - autoScrollDelay = 5; - autoScrollRewind = 0; - arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; - arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; - columns[] = {0.0}; - color[] = {1, 1, 1, 1}; - - rowHeight = 0.03; - colorBackground[] = {0, 0, 0, 0.2}; - colorText[] = {1,1, 1, 1.0}; - colorScrollbar[] = {0.95, 0.95, 0.95, 1}; - colorSelect[] = {0.95, 0.95, 0.95, 1}; - colorSelect2[] = {0.95, 0.95, 0.95, 1}; - colorSelectBackground[] = {0, 0, 0, 0.0}; - colorSelectBackground2[] = {0.0, 0.0, 0.0, 0.5}; - colorActive[] = {0,0,0,1}; - colorDisabled[] = {0,0,0,0.3}; - rows = 1; - - drawSideArrows = 0; - idcLeft = -1; - idcRight = -1; - maxHistoryDelay = 1; - soundSelect[] = {"", 0.1, 1}; - period = 1; - shadow = 2; - class ScrollBar { - arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; - arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; - border = "#(argb,8,8,3)color(1,1,1,1)"; - color[] = {1,1,1,0.6}; - colorActive[] = {1,1,1,1}; - colorDisabled[] = {1,1,1,0.3}; - thumb = "#(argb,8,8,3)color(1,1,1,1)"; - }; - class ListScrollBar { - arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; - arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; - autoScrollDelay = 5; - autoScrollEnabled = 0; - autoScrollRewind = 0; autoScrollSpeed = -1; - border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; - color[] = {1,1,1,0.6}; - colorActive[] = {1,1,1,1}; - colorDisabled[] = {1,1,1,0.3}; - height = 0; - scrollSpeed = 0.06; - shadow = 0; - thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; - width = 0; - }; -}; + autoScrollDelay = 5; + autoScrollRewind = 0; + arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; + arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; + columns[] = {0}; + color[] = {1, 1, 1, 1}; + rowHeight = 0.03; + colorBackground[] = {0, 0, 0, 0.2}; + colorText[] = {1, 1, 1, 1}; + colorScrollbar[] = {0.95, 0.95, 0.95, 1}; + colorSelect[] = {0.95, 0.95, 0.95, 1}; + colorSelect2[] = {0.95, 0.95, 0.95, 1}; + colorSelectBackground[] = {0, 0, 0, 0}; + colorSelectBackground2[] = {0, 0, 0, 0.5}; + colorActive[] = {0, 0, 0, 1}; + colorDisabled[] = {0, 0, 0, 0.3}; + rows = 1; + + drawSideArrows = 0; + idcLeft = -1; + idcRight = -1; + maxHistoryDelay = 1; + soundSelect[] = {"", 0.1, 1}; + period = 1; + shadow = 2; + + class ScrollBar { + arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; + arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; + border = "#(argb,8,8,3)color(1,1,1,1)"; + color[] = {1, 1, 1, 0.6}; + colorActive[] = {1, 1, 1, 1}; + colorDisabled[] = {1, 1, 1, 0.3}; + thumb = "#(argb,8,8,3)color(1,1,1,1)"; + }; + class ListScrollBar { + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + autoScrollDelay = 5; + autoScrollEnabled = 0; + autoScrollRewind = 0; + autoScrollSpeed = -1; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + color[] = {1, 1, 1, 0.6}; + colorActive[] = {1, 1, 1, 1}; + colorDisabled[] = {1, 1, 1, 0.3}; + height = 0; + scrollSpeed = 0.06; + shadow = 0; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + width = 0; + }; +}; class RscCombo; class ACE_gui_comboBoxBase: RscCombo { - idc = -1; - type = 4; - style = "0x10 + 0x200"; - x = 0; - y = 0; - w = 0.3; - h = 0.035; - color[] = {0,0,0,0.6}; - colorActive[] = {1,0,0,1}; - colorBackground[] = {0,0,0,1}; - colorDisabled[] = {1,1,1,0.25}; - colorScrollbar[] = {1,0,0,1}; - colorSelect[] = {0,0,0,1}; - colorSelectBackground[] = {1,1,1,0.7}; - colorText[] = {1,1,1,1}; + idc = -1; + type = 4; + style = "0x10 + 0x200"; + x = 0; + y = 0; + w = 0.3; + h = 0.035; + color[] = {0, 0, 0, 0.6}; + colorActive[] = {1, 0, 0, 1}; + colorBackground[] = {0, 0, 0, 1}; + colorDisabled[] = {1, 1, 1, 0.25}; + colorScrollbar[] = {1, 0, 0, 1}; + colorSelect[] = {0, 0, 0, 1}; + colorSelectBackground[] = {1, 1, 1, 0.7}; + colorText[] = {1, 1, 1, 1}; - arrowEmpty = ""; - arrowFull = ""; - wholeHeight = 0.45; - font = FONT_ACE; - sizeEx = 0.031; - soundSelect[] = {"\A3\ui_f\data\sound\RscCombo\soundSelect",0.1,1}; - soundExpand[] = {"\A3\ui_f\data\sound\RscCombo\soundExpand",0.1,1}; - soundCollapse[] = {"\A3\ui_f\data\sound\RscCombo\soundCollapse",0.1,1}; - maxHistoryDelay = 1.0; - class ScrollBar { - color[] = {0.3,0.3,0.3,0.6}; - colorActive[] = {0.3,0.3,0.3,1}; - colorDisabled[] = {0.3,0.3,0.3,0.3}; - thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; - arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; - arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; - border = ""; - }; - class ComboScrollBar { - arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; - arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; - autoScrollDelay = 5; - autoScrollEnabled = 0; - autoScrollRewind = 0; - autoScrollSpeed = -1; - border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; - color[] = {0.3,0.3,0.3,0.6}; - colorActive[] = {0.3,0.3,0.3,1}; - colorDisabled[] = {0.3,0.3,0.3,0.3}; - height = 0; - scrollSpeed = 0.06; - shadow = 0; - thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; - width = 0; - }; + arrowEmpty = ""; + arrowFull = ""; + wholeHeight = 0.45; + font = FONT_ACE; + sizeEx = 0.031; + soundSelect[] = {"\A3\ui_f\data\sound\RscCombo\soundSelect", 0.1, 1}; + soundExpand[] = {"\A3\ui_f\data\sound\RscCombo\soundExpand", 0.1, 1}; + soundCollapse[] = {"\A3\ui_f\data\sound\RscCombo\soundCollapse", 0.1, 1}; + maxHistoryDelay = 1; + + class ScrollBar { + color[] = {0.3, 0.3, 0.3, 0.6}; + colorActive[] = {0.3, 0.3, 0.3, 1}; + colorDisabled[] = {0.3, 0.3, 0.3, 0.3}; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + border = ""; + }; + class ComboScrollBar { + arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; + arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; + autoScrollDelay = 5; + autoScrollEnabled = 0; + autoScrollRewind = 0; + autoScrollSpeed = -1; + border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; + color[] = {0.3, 0.3, 0.3, 0.6}; + colorActive[] = {0.3, 0.3, 0.3, 1}; + colorDisabled[] = {0.3, 0.3, 0.3, 0.3}; + height = 0; + scrollSpeed = 0.06; + shadow = 0; + thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; + width = 0; + }; }; - - class ACE_gui_mapBase { - moveOnEdges = 1; - x = "SafeZoneXAbs"; - y = "SafeZoneY + 1.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "SafeZoneWAbs"; - h = "SafeZoneH - 1.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - type = 100; // Use 100 to hide markers - style = 48; - shadow = 0; + moveOnEdges = 1; + x = "SafeZoneXAbs"; + y = "SafeZoneY + 1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + w = "SafeZoneWAbs"; + h = "SafeZoneH - 1.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + type = 100; // Use 100 to hide markers + style = 48; + shadow = 0; - ptsPerSquareSea = 5; - ptsPerSquareTxt = 3; - ptsPerSquareCLn = 10; - ptsPerSquareExp = 10; - ptsPerSquareCost = 10; - ptsPerSquareFor = 9; - ptsPerSquareForEdge = 9; - ptsPerSquareRoad = 6; - ptsPerSquareObj = 9; - showCountourInterval = 0; - scaleMin = 0.001; - scaleMax = 1.0; - scaleDefault = 0.16; - maxSatelliteAlpha = 0.85; - alphaFadeStartScale = 0.35; - alphaFadeEndScale = 0.4; - colorBackground[] = {0.969,0.957,0.949,1.0}; - colorSea[] = {0.467,0.631,0.851,0.5}; - colorForest[] = {0.624,0.78,0.388,0.5}; - colorForestBorder[] = {0.0,0.0,0.0,0.0}; - colorRocks[] = {0.0,0.0,0.0,0.3}; - colorRocksBorder[] = {0.0,0.0,0.0,0.0}; - colorLevels[] = {0.286,0.177,0.094,0.5}; - colorMainCountlines[] = {0.572,0.354,0.188,0.5}; - colorCountlines[] = {0.572,0.354,0.188,0.25}; - colorMainCountlinesWater[] = {0.491,0.577,0.702,0.6}; - colorCountlinesWater[] = {0.491,0.577,0.702,0.3}; - colorPowerLines[] = {0.1,0.1,0.1,1.0}; - colorRailWay[] = {0.8,0.2,0.0,1.0}; - colorNames[] = {0.1,0.1,0.1,0.9}; - colorInactive[] = {1.0,1.0,1.0,0.5}; - colorOutside[] = {0.0,0.0,0.0,1.0}; - colorTracks[] = {0.84,0.76,0.65,0.15}; - colorTracksFill[] = {0.84,0.76,0.65,1.0}; - colorRoads[] = {0.7,0.7,0.7,1.0}; - colorRoadsFill[] = {1.0,1.0,1.0,1.0}; - colorMainRoads[] = {0.9,0.5,0.3,1.0}; - colorMainRoadsFill[] = {1.0,0.6,0.4,1.0}; - colorGrid[] = {0.1,0.1,0.1,0.6}; - colorGridMap[] = {0.1,0.1,0.1,0.6}; - colorText[] = {1, 1, 1, 0.85}; -font = "RobotoCondensed"; -sizeEx = 0.0270000; -stickX[] = {0.20, {"Gamma", 1.00, 1.50} }; -stickY[] = {0.20, {"Gamma", 1.00, 1.50} }; -onMouseButtonClick = ""; -onMouseButtonDblClick = ""; + ptsPerSquareSea = 5; + ptsPerSquareTxt = 3; + ptsPerSquareCLn = 10; + ptsPerSquareExp = 10; + ptsPerSquareCost = 10; + ptsPerSquareFor = 9; + ptsPerSquareForEdge = 9; + ptsPerSquareRoad = 6; + ptsPerSquareObj = 9; + showCountourInterval = 0; + scaleMin = 0.001; + scaleMax = 1; + scaleDefault = 0.16; + maxSatelliteAlpha = 0.85; + alphaFadeStartScale = 0.35; + alphaFadeEndScale = 0.4; + colorBackground[] = {0.969, 0.957, 0.949, 1}; + colorSea[] = {0.467, 0.631, 0.851, 0.5}; + colorForest[] = {0.624, 0.78, 0.388, 0.5}; + colorForestBorder[] = {0, 0, 0, 0}; + colorRocks[] = {0, 0, 0, 0.3}; + colorRocksBorder[] = {0, 0, 0, 0}; + colorLevels[] = {0.286, 0.177, 0.094, 0.5}; + colorMainCountlines[] = {0.572, 0.354, 0.188, 0.5}; + colorCountlines[] = {0.572, 0.354, 0.188, 0.25}; + colorMainCountlinesWater[] = {0.491, 0.577, 0.702, 0.6}; + colorCountlinesWater[] = {0.491, 0.577, 0.702, 0.3}; + colorPowerLines[] = {0.1, 0.1, 0.1, 1}; + colorRailWay[] = {0.8, 0.2, 0, 1}; + colorNames[] = {0.1, 0.1, 0.1, 0.9}; + colorInactive[] = {1, 1, 1, 0.5}; + colorOutside[] = {0, 0, 0, 1}; + colorTracks[] = {0.84, 0.76, 0.65, 0.15}; + colorTracksFill[] = {0.84, 0.76, 0.65, 1}; + colorRoads[] = {0.7, 0.7, 0.7, 1}; + colorRoadsFill[] = {1, 1, 1, 1}; + colorMainRoads[] = {0.9, 0.5, 0.3, 1}; + colorMainRoadsFill[] = {1, 0.6, 0.4, 1}; + colorGrid[] = {0.1, 0.1, 0.1, 0.6}; + colorGridMap[] = {0.1, 0.1, 0.1, 0.6}; + colorText[] = {1, 1, 1, 0.85}; + font = "RobotoCondensed"; + sizeEx = 0.027; + stickX[] = {0.2, {"Gamma", 1, 1.5}}; + stickY[] = {0.2, {"Gamma", 1, 1.5}}; + onMouseButtonClick = ""; + onMouseButtonDblClick = ""; - fontLabel = "RobotoCondensed"; - sizeExLabel = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; - fontGrid = "TahomaB"; - sizeExGrid = 0.02; - fontUnits = "TahomaB"; - sizeExUnits = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; - fontNames = "RobotoCondensed"; - sizeExNames = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8) * 2"; - fontInfo = "RobotoCondensed"; - sizeExInfo = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; - fontLevel = "TahomaB"; - sizeExLevel = 0.02; - text = "#(argb,8,8,3)color(1,1,1,1)"; - class ActiveMarker { - color[] = {0.30, 0.10, 0.90, 1.00}; - size = 50; - }; - class Legend { - x = "SafeZoneX + ( ((safezoneW / safezoneH) min 1.2) / 40)"; - y = "SafeZoneY + safezoneH - 4.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - w = "10 * ( ((safezoneW / safezoneH) min 1.2) / 40)"; - h = "3.5 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; - font = "RobotoCondensed"; - sizeEx = "( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; - colorBackground[] = {1,1,1,0.5}; - color[] = {0,0,0,1}; - }; - class Task { - icon = "\A3\ui_f\data\map\mapcontrol\taskIcon_CA.paa"; - iconCreated = "\A3\ui_f\data\map\mapcontrol\taskIconCreated_CA.paa"; - iconCanceled = "\A3\ui_f\data\map\mapcontrol\taskIconCanceled_CA.paa"; - iconDone = "\A3\ui_f\data\map\mapcontrol\taskIconDone_CA.paa"; - iconFailed = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_CA.paa"; - color[] = {"(profilenamespace getVariable ['IGUI_TEXT_RGB_R',0])","(profilenamespace getVariable ['IGUI_TEXT_RGB_G',1])","(profilenamespace getVariable ['IGUI_TEXT_RGB_B',1])","(profilenamespace getVariable ['IGUI_TEXT_RGB_A',0.8])"}; - colorCreated[] = {1,1,1,1}; - colorCanceled[] = {0.7,0.7,0.7,1}; - colorDone[] = {0.7,1,0.3,1}; - colorFailed[] = {1,0.3,0.2,1}; - size = 27; - importance = 1; - coefMin = 1; - coefMax = 1; - }; - class Waypoint { - icon = "\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa"; - color[] = {0,0,0,1}; - size = 20; - importance = "1.2 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - class WaypointCompleted { - icon = "\A3\ui_f\data\map\mapcontrol\waypointCompleted_ca.paa"; - color[] = {0,0,0,1}; - size = 20; - importance = "1.2 * 16 * 0.05"; - coefMin = 0.900000; - coefMax = 4; - }; - class CustomMark { - icon = "\A3\ui_f\data\map\mapcontrol\custommark_ca.paa"; - size = 24; - importance = 1; - coefMin = 1; - coefMax = 1; - color[] = {0,0,0,1}; - }; - class Command { - icon = "\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa"; - size = 18; - importance = 1; - coefMin = 1; - coefMax = 1; - color[] = {1,1,1,1}; - }; - class Bush { - icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa"; - color[] = {0.45,0.64,0.33,0.4}; - size = "14/2"; - importance = "0.2 * 14 * 0.05 * 0.05"; - coefMin = 0.25; - coefMax = 4; - }; - class Rock { - icon = "\A3\ui_f\data\map\mapcontrol\rock_ca.paa"; - color[] = {0.1,0.1,0.1,0.8}; - size = 12; - importance = "0.5 * 12 * 0.05"; - coefMin = 0.25; - coefMax = 4; - }; - class SmallTree { - icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa"; - color[] = {0.45,0.64,0.33,0.4}; - size = 12; - importance = "0.6 * 12 * 0.05"; - coefMin = 0.25; - coefMax = 4; - }; - class Tree { - icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa"; - color[] = {0.45,0.64,0.33,0.4}; - size = 12; - importance = "0.9 * 16 * 0.05"; - coefMin = 0.25; - coefMax = 4; - }; - class busstop { - icon = "\A3\ui_f\data\map\mapcontrol\busstop_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class fuelstation { - icon = "\A3\ui_f\data\map\mapcontrol\fuelstation_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class hospital { - icon = "\A3\ui_f\data\map\mapcontrol\hospital_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class church { - icon = "\A3\ui_f\data\map\mapcontrol\church_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class lighthouse { - icon = "\A3\ui_f\data\map\mapcontrol\lighthouse_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class power { - icon = "\A3\ui_f\data\map\mapcontrol\power_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class powersolar { - icon = "\A3\ui_f\data\map\mapcontrol\powersolar_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class powerwave { - icon = "\A3\ui_f\data\map\mapcontrol\powerwave_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class powerwind { - icon = "\A3\ui_f\data\map\mapcontrol\powerwind_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class quay { - icon = "\A3\ui_f\data\map\mapcontrol\quay_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class shipwreck { - icon = "\A3\ui_f\data\map\mapcontrol\shipwreck_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class transmitter { - icon = "\A3\ui_f\data\map\mapcontrol\transmitter_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class watertower { - icon = "\A3\ui_f\data\map\mapcontrol\watertower_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {1,1,1,1}; - }; - class Cross { - icon = "\A3\ui_f\data\map\mapcontrol\Cross_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {0,0,0,1}; - }; - class Chapel { - icon = "\A3\ui_f\data\map\mapcontrol\Chapel_CA.paa"; - size = 24; - importance = 1; - coefMin = 0.85; - coefMax = 1.0; - color[] = {0,0,0,1}; - }; - class Bunker { - icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa"; - size = 14; - importance = "1.5 * 14 * 0.05"; - coefMin = 0.25; - coefMax = 4; - color[] = {0,0,0,1}; - }; - class Fortress { - icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa"; - size = 16; - importance = "2 * 16 * 0.05"; - coefMin = 0.25; - coefMax = 4; - color[] = {0,0,0,1}; - }; - class Fountain { - icon = "\A3\ui_f\data\map\mapcontrol\fountain_ca.paa"; - size = 11; - importance = "1 * 12 * 0.05"; - coefMin = 0.25; - coefMax = 4; - color[] = {0,0,0,1}; - }; - class Ruin { - icon = "\A3\ui_f\data\map\mapcontrol\ruin_ca.paa"; - size = 16; - importance = "1.2 * 16 * 0.05"; - coefMin = 1; - coefMax = 4; - color[] = {0,0,0,1}; - }; - class Stack { - icon = "\A3\ui_f\data\map\mapcontrol\stack_ca.paa"; - size = 20; - importance = "2 * 16 * 0.05"; - coefMin = 0.9; - coefMax = 4; - color[] = {0,0,0,1}; - }; - class Tourism { - icon = "\A3\ui_f\data\map\mapcontrol\tourism_ca.paa"; - size = 16; - importance = "1 * 16 * 0.05"; - coefMin = 0.7; - coefMax = 4; - color[] = {0,0,0,1}; - }; - class ViewTower { - icon = "\A3\ui_f\data\map\mapcontrol\viewtower_ca.paa"; - size = 16; - importance = "2.5 * 16 * 0.05"; - coefMin = 0.5; - coefMax = 4; - color[] = {0,0,0,1}; - }; + fontLabel = "RobotoCondensed"; + sizeExLabel = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; + fontGrid = "TahomaB"; + sizeExGrid = 0.02; + fontUnits = "TahomaB"; + sizeExUnits = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; + fontNames = "RobotoCondensed"; + sizeExNames = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8) * 2"; + fontInfo = "RobotoCondensed"; + sizeExInfo = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; + fontLevel = "TahomaB"; + sizeExLevel = 0.02; + text = "#(argb,8,8,3)color(1,1,1,1)"; + + class ActiveMarker { + color[] = {0.3, 0.1, 0.9, 1}; + size = 50; + }; + class Legend { + x = "SafeZoneX + (((safezoneW / safezoneH) min 1.2) / 40)"; + y = "SafeZoneY + safezoneH - 4.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + w = "10 * (((safezoneW / safezoneH) min 1.2) / 40)"; + h = "3.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; + font = "RobotoCondensed"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; + colorBackground[] = {1, 1, 1, 0.5}; + color[] = {0, 0, 0, 1}; + }; + class Task { + icon = "\A3\ui_f\data\map\mapcontrol\taskIcon_CA.paa"; + iconCreated = "\A3\ui_f\data\map\mapcontrol\taskIconCreated_CA.paa"; + iconCanceled = "\A3\ui_f\data\map\mapcontrol\taskIconCanceled_CA.paa"; + iconDone = "\A3\ui_f\data\map\mapcontrol\taskIconDone_CA.paa"; + iconFailed = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_CA.paa"; + color[] = {"(profilenamespace getVariable ['IGUI_TEXT_RGB_R',0])", "(profilenamespace getVariable ['IGUI_TEXT_RGB_G',1])", "(profilenamespace getVariable ['IGUI_TEXT_RGB_B',1])", "(profilenamespace getVariable ['IGUI_TEXT_RGB_A',0.8])"}; + colorCreated[] = {1, 1, 1, 1}; + colorCanceled[] = {0.7, 0.7, 0.7, 1}; + colorDone[] = {0.7, 1, 0.3, 1}; + colorFailed[] = {1, 0.3, 0.2, 1}; + size = 27; + importance = 1; + coefMin = 1; + coefMax = 1; + }; + class Waypoint { + icon = "\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa"; + color[] = {0, 0, 0, 1}; + size = 20; + importance = "1.2 * 16 * 0.05"; + coefMin = 0.9; + coefMax = 4; + }; + class WaypointCompleted { + icon = "\A3\ui_f\data\map\mapcontrol\waypointCompleted_ca.paa"; + color[] = {0, 0, 0, 1}; + size = 20; + importance = "1.2 * 16 * 0.05"; + coefMin = 0.9; + coefMax = 4; + }; + class CustomMark { + icon = "\A3\ui_f\data\map\mapcontrol\custommark_ca.paa"; + color[] = {0, 0, 0, 1}; + size = 24; + importance = 1; + coefMin = 1; + coefMax = 1; + }; + class Command { + icon = "\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa"; + color[] = {1, 1, 1, 1}; + size = 18; + importance = 1; + coefMin = 1; + coefMax = 1; + }; + class Bush { + icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa"; + color[] = {0.45, 0.64, 0.33, 0.4}; + size = "14/2"; + importance = "0.2 * 14 * 0.05 * 0.05"; + coefMin = 0.25; + coefMax = 4; + }; + class Rock { + icon = "\A3\ui_f\data\map\mapcontrol\rock_ca.paa"; + color[] = {0.1, 0.1, 0.1, 0.8}; + size = 12; + importance = "0.5 * 12 * 0.05"; + coefMin = 0.25; + coefMax = 4; + }; + class SmallTree { + icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa"; + color[] = {0.45, 0.64, 0.33, 0.4}; + size = 12; + importance = "0.6 * 12 * 0.05"; + coefMin = 0.25; + coefMax = 4; + }; + class Tree { + icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa"; + color[] = {0.45, 0.64, 0.33, 0.4}; + size = 12; + importance = "0.9 * 16 * 0.05"; + coefMin = 0.25; + coefMax = 4; + }; + class busstop { + icon = "\A3\ui_f\data\map\mapcontrol\busstop_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class fuelstation { + icon = "\A3\ui_f\data\map\mapcontrol\fuelstation_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class hospital { + icon = "\A3\ui_f\data\map\mapcontrol\hospital_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class church { + icon = "\A3\ui_f\data\map\mapcontrol\church_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class lighthouse { + icon = "\A3\ui_f\data\map\mapcontrol\lighthouse_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class power { + icon = "\A3\ui_f\data\map\mapcontrol\power_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class powersolar { + icon = "\A3\ui_f\data\map\mapcontrol\powersolar_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class powerwave { + icon = "\A3\ui_f\data\map\mapcontrol\powerwave_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class powerwind { + icon = "\A3\ui_f\data\map\mapcontrol\powerwind_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class quay { + icon = "\A3\ui_f\data\map\mapcontrol\quay_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class shipwreck { + icon = "\A3\ui_f\data\map\mapcontrol\shipwreck_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class transmitter { + icon = "\A3\ui_f\data\map\mapcontrol\transmitter_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class watertower { + icon = "\A3\ui_f\data\map\mapcontrol\watertower_CA.paa"; + color[] = {1, 1, 1, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class Cross { + icon = "\A3\ui_f\data\map\mapcontrol\Cross_CA.paa"; + color[] = {0, 0, 0, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class Chapel { + icon = "\A3\ui_f\data\map\mapcontrol\Chapel_CA.paa"; + color[] = {0, 0, 0, 1}; + size = 24; + importance = 1; + coefMin = 0.85; + coefMax = 1; + }; + class Bunker { + icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa"; + color[] = {0, 0, 0, 1}; + size = 14; + importance = "1.5 * 14 * 0.05"; + coefMin = 0.25; + coefMax = 4; + }; + class Fortress { + icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa"; + color[] = {0, 0, 0, 1}; + size = 16; + importance = "2 * 16 * 0.05"; + coefMin = 0.25; + coefMax = 4; + }; + class Fountain { + icon = "\A3\ui_f\data\map\mapcontrol\fountain_ca.paa"; + color[] = {0, 0, 0, 1}; + size = 11; + importance = "1 * 12 * 0.05"; + coefMin = 0.25; + coefMax = 4; + }; + class Ruin { + icon = "\A3\ui_f\data\map\mapcontrol\ruin_ca.paa"; + color[] = {0, 0, 0, 1}; + size = 16; + importance = "1.2 * 16 * 0.05"; + coefMin = 1; + coefMax = 4; + }; + class Stack { + icon = "\A3\ui_f\data\map\mapcontrol\stack_ca.paa"; + color[] = {0, 0, 0, 1}; + size = 20; + importance = "2 * 16 * 0.05"; + coefMin = 0.9; + coefMax = 4; + }; + class Tourism { + icon = "\A3\ui_f\data\map\mapcontrol\tourism_ca.paa"; + color[] = {0, 0, 0, 1}; + size = 16; + importance = "1 * 16 * 0.05"; + coefMin = 0.7; + coefMax = 4; + }; + class ViewTower { + icon = "\A3\ui_f\data\map\mapcontrol\viewtower_ca.paa"; + color[] = {0, 0, 0, 1}; + size = 16; + importance = "2.5 * 16 * 0.05"; + coefMin = 0.5; + coefMax = 4; + }; }; #endif diff --git a/addons/common/dev/test_cfgPatches.sqf b/addons/common/dev/test_cfgPatches.sqf index bd00869360..281c16eca3 100644 --- a/addons/common/dev/test_cfgPatches.sqf +++ b/addons/common/dev/test_cfgPatches.sqf @@ -18,11 +18,11 @@ private _allUnits = []; { private _class = configFile >> "CfgVehicles" >> _x; if (isNull _class) then { - WARNING_1("in units[] but null - %1", _x); + WARNING_1("in units[] but null - %1",_x); _testPass = false; } else { // if (((getNumber (_class >> "scope")) != 2) && {((getNumber (_class >> "scopeCurator")) != 2)}) then { - // WARNING_2("in units[] but not public - %1 from %2", configName _class, configSourceMod _class); + // WARNING_2("in units[] but not public - %1 from %2",configName _class,configSourceMod _class); // _testPass = false; // }; }; @@ -36,11 +36,11 @@ private _allWeapons = []; { private _class = configFile >> "CfgWeapons" >> _x; if (isNull _class) then { - WARNING_1("in weapons[] but null - %1", _x); + WARNING_1("in weapons[] but null - %1",_x); _testPass = false; } else { // if (((getNumber (_class >> "scope")) != 2) && {((getNumber (_class >> "scopeCurator")) != 2)}) then { - // WARNING_2("in weapons[] but not public - %1 from %2", configName _class, configSourceMod _class); + // WARNING_2("in weapons[] but not public - %1 from %2",configName _class,configSourceMod _class); // _testPass = false; // }; }; @@ -51,7 +51,7 @@ private _vics = "(configName _x) select [0,3] == 'ace'" configClasses (configFil { if (((getNumber (_x >> "scope")) == 2) || {((getNumber (_x >> "scopeCurator")) == 2)}) then { if (!((toLower configName _x) in _allUnits)) then { - WARNING_2("Not in any units[] - %1 from %2", configName _x, configSourceMod _x); + WARNING_2("Not in any units[] - %1 from %2",configName _x,configSourceMod _x); _testPass = false; }; }; @@ -63,7 +63,7 @@ private _weapons = "(configName _x) select [0,3] == 'ace'" configClasses (config private _type = toLower configName _x; if (((getNumber (_x >> "scope")) == 2) || {((getNumber (_x >> "scopeCurator")) == 2)}) then { if (!((toLower configName _x) in _allWeapons)) then { - WARNING_2("Not in any weapons[] - %1 from %2", configName _x, configSourceMod _x); + WARNING_2("Not in any weapons[] - %1 from %2",configName _x,configSourceMod _x); _testPass = false; }; }; diff --git a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf index a5bb286768..299dff8373 100644 --- a/addons/common/functions/fnc__handleRequestSyncedEvent.sqf +++ b/addons/common/functions/fnc__handleRequestSyncedEvent.sqf @@ -27,7 +27,7 @@ if (isServer) then { params ["_eventName", "_client"]; if !(_eventName in GVAR(syncedEvents)) exitWith { - ERROR_1("Request for synced event - key [%1] not found.", _eventName); + ERROR_1("Request for synced event - key [%1] not found.",_eventName); false }; diff --git a/addons/common/functions/fnc__handleSyncedEvent.sqf b/addons/common/functions/fnc__handleSyncedEvent.sqf index a7b28de1a6..aac8ac873e 100644 --- a/addons/common/functions/fnc__handleSyncedEvent.sqf +++ b/addons/common/functions/fnc__handleSyncedEvent.sqf @@ -20,7 +20,7 @@ params ["_name", "_args", "_ttl"]; if !(_name in GVAR(syncedEvents)) exitWith { - ERROR_1("Synced event key [%1] not found (_handleSyncedEvent).", _name); + ERROR_1("Synced event key [%1] not found (_handleSyncedEvent).",_name); false }; diff --git a/addons/common/functions/fnc_cbaSettings_convertHelper.sqf b/addons/common/functions/fnc_cbaSettings_convertHelper.sqf index 4597cf3d40..b7ef446cf6 100644 --- a/addons/common/functions/fnc_cbaSettings_convertHelper.sqf +++ b/addons/common/functions/fnc_cbaSettings_convertHelper.sqf @@ -22,7 +22,7 @@ private _output = [format ["// CBA Settings [ADDON: %1]:", _addon]]; private _addonSearch = _addon + "_"; private _addonSearchCount = count _addonSearch; -TRACE_2("",_addonSearch, _addonSearchCount); +TRACE_2("",_addonSearch,_addonSearchCount); private _settings = configProperties [configFile >> "ACE_Settings", "(isClass _x) && {((configName _x) select [0, _addonSearchCount]) == _addonSearch}"]; diff --git a/addons/common/functions/fnc_cbaSettings_transferUserSettings.sqf b/addons/common/functions/fnc_cbaSettings_transferUserSettings.sqf index eaa9d089fc..8b6e62cbf6 100644 --- a/addons/common/functions/fnc_cbaSettings_transferUserSettings.sqf +++ b/addons/common/functions/fnc_cbaSettings_transferUserSettings.sqf @@ -34,7 +34,7 @@ private _aceSettings = configProperties [configFile >> "ACE_Settings", "isClass if (_isClientSettable && {_currentValue isNotEqualTo _profileVar}) then { // CBA_settings_fnc_set will do type checking for the old profile var private _ret = [_settingName, _profileVar, 0, "client", true] call CBA_settings_fnc_set; - INFO_3("Transfering setting [%1: %2] returned %3", _settingName, _profileVar, _ret); + INFO_3("Transfering setting [%1: %2] returned %3",_settingName,_profileVar,_ret); }; }; } forEach _aceSettings; diff --git a/addons/common/functions/fnc_checkFiles.sqf b/addons/common/functions/fnc_checkFiles.sqf index 8b00cad533..47de2290dd 100644 --- a/addons/common/functions/fnc_checkFiles.sqf +++ b/addons/common/functions/fnc_checkFiles.sqf @@ -80,7 +80,7 @@ if (_oldCompats isNotEqualTo []) then { _oldCompats = _oldCompats apply {format ["%1 (%2)", _x select 0, _x select 1]}; [{ // Lasts for ~10 seconds - ERROR_WITH_TITLE_3("The following ACE compatiblity PBOs are outdated", "%1. ACE Main version is %2 from %3.",_this select 0,_this select 1,_this select 2); + ERROR_WITH_TITLE_3("The following ACE compatiblity PBOs are outdated","%1. ACE Main version is %2 from %3.",_this select 0,_this select 1,_this select 2); }, [_oldCompats, _mainVersion, _mainSource], 1] call CBA_fnc_waitAndExecute; }; diff --git a/addons/common/functions/fnc_claimSafeServer.sqf b/addons/common/functions/fnc_claimSafeServer.sqf index e24a421549..6ebee7cb4f 100644 --- a/addons/common/functions/fnc_claimSafeServer.sqf +++ b/addons/common/functions/fnc_claimSafeServer.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" /* * Author: commy2, PabstMirror - * Unit claims the ownership over an object. This is used to prevent multiple players from draging the same ammo box or using up the same wheel when repairing etc. + * Unit claims the ownership over an object. This is used to prevent multiple players from dragging the same ammo box or using up the same wheel when repairing etc. * This function only runs on the server and handles the "ace_common_claimSafe" event. It provides a network safe way claiming objects as all claims are run on server. * Return event is passed [_unit, _target, _success] for new claims, no event on claim release * diff --git a/addons/common/functions/fnc_disableUserInput.sqf b/addons/common/functions/fnc_disableUserInput.sqf index 6c58954b13..3774a3fc29 100644 --- a/addons/common/functions/fnc_disableUserInput.sqf +++ b/addons/common/functions/fnc_disableUserInput.sqf @@ -219,7 +219,7 @@ if (_state) then { _keyPressedInfo set [1, ((_keyPressedInfo select 1) - 1) max 0]; if (_keyPressedInfo isEqualTo [false, 0]) then { - GVAR(keyboardInputMain) deleteAt _key, + GVAR(keyboardInputMain) deleteAt _key; }; }, _key, 0.5] call CBA_fnc_waitAndExecute; }]; diff --git a/addons/common/functions/fnc_firedEH.sqf b/addons/common/functions/fnc_firedEH.sqf index 9a4c8e50d6..cee874782a 100644 --- a/addons/common/functions/fnc_firedEH.sqf +++ b/addons/common/functions/fnc_firedEH.sqf @@ -24,7 +24,7 @@ BEGIN_COUNTER(firedEH); params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; -TRACE_7("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile); +TRACE_7("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); if (_unit isKindOf "CAManBase") then { // The unit it on foot diff --git a/addons/common/functions/fnc_getDeathAnim.sqf b/addons/common/functions/fnc_getDeathAnim.sqf index 2b92e6ef10..4d2e53d3da 100644 --- a/addons/common/functions/fnc_getDeathAnim.sqf +++ b/addons/common/functions/fnc_getDeathAnim.sqf @@ -27,7 +27,7 @@ if (getNumber (_unitAnimationCfg >> "terminal") == 1) exitWith {_animationState} private _unitActionsCfg = configFile >> "CfgMovesBasic" >> "Actions" >> getText (_unitAnimationCfg >> "actions"); -TRACE_2("Animation/Action", configName _unitAnimationCfg, configName _unitActionsCfg); +TRACE_2("Animation/Action",configName _unitAnimationCfg,configName _unitActionsCfg); if (vehicle _unit != _unit) then { private _interpolateArray = getArray (_unitAnimationCfg >> "interpolateTo"); diff --git a/addons/common/functions/fnc_getTurretDirection.sqf b/addons/common/functions/fnc_getTurretDirection.sqf index 6f24b40f3e..7592bc8f33 100644 --- a/addons/common/functions/fnc_getTurretDirection.sqf +++ b/addons/common/functions/fnc_getTurretDirection.sqf @@ -25,7 +25,7 @@ private _pov = getText (_turret >> "memoryPointGunnerOptics"); private _gunBeg = getText (_turret >> "gunBeg"); private _gunEnd = getText (_turret >> "gunEnd"); -TRACE_3("", _pov, _gunBeg, _gunEnd); +TRACE_3("",_pov,_gunBeg,_gunEnd); // Pull the PIP pov or barrel direction, depending on how the model is set up private _povPos = _vehicle modelToWorldVisualWorld (_vehicle selectionPosition _pov); diff --git a/addons/common/functions/fnc_getVehicleUAVCrew.sqf b/addons/common/functions/fnc_getVehicleUAVCrew.sqf index 0ac91e644a..f991e08d57 100644 --- a/addons/common/functions/fnc_getVehicleUAVCrew.sqf +++ b/addons/common/functions/fnc_getVehicleUAVCrew.sqf @@ -17,4 +17,4 @@ params [["_vehicle", objNull, [objNull]]]; -crew _vehicle select {getText (configOf _x >> "simulation") == "UAVPilot"} // return +(crew _vehicle) select {unitIsUAV _x} // return diff --git a/addons/common/functions/fnc_getWeight.sqf b/addons/common/functions/fnc_getWeight.sqf index fd50c62c14..300a74d382 100644 --- a/addons/common/functions/fnc_getWeight.sqf +++ b/addons/common/functions/fnc_getWeight.sqf @@ -5,10 +5,10 @@ * * Arguments: * 0: The Unit (usually the player) - * 1: Force a return type + * 1: Return imperial units * * Return Value: - * The return value + * Weight string * * Example: * [player] call ace_common_fnc_getWeight diff --git a/addons/common/functions/fnc_playConfigSound3D.sqf b/addons/common/functions/fnc_playConfigSound3D.sqf index c282199365..788a2a6b4e 100644 --- a/addons/common/functions/fnc_playConfigSound3D.sqf +++ b/addons/common/functions/fnc_playConfigSound3D.sqf @@ -22,7 +22,7 @@ params ["_soundClass", "_posASL", "_volume", "_distance"]; private _sound = getArray (configFile >> "CfgSounds" >> _soundClass >> "sound"); if (_sound isEqualTo []) exitWith { - ERROR_1("CfgSounds class [%1] does not exist or contains empty sound array", _soundClass); + ERROR_1("CfgSounds class [%1] does not exist or contains empty sound array",_soundClass); }; TRACE_2("sound",_soundClass,_sound); diff --git a/addons/common/functions/fnc_readSettingFromModule.sqf b/addons/common/functions/fnc_readSettingFromModule.sqf index dc9ead397f..5f9678f97b 100644 --- a/addons/common/functions/fnc_readSettingFromModule.sqf +++ b/addons/common/functions/fnc_readSettingFromModule.sqf @@ -23,7 +23,7 @@ params ["_logic", "_settingName", "_moduleVariable"]; // Check if the variable is already defined if (isNil _settingName) exitWith { - ERROR_1("readSettingFromModule - param [%1] is not an ace_setting", _settingName); + ERROR_1("readSettingFromModule - param [%1] is not an ace_setting",_settingName); }; // Check if the parameter is defined in the module diff --git a/addons/common/functions/fnc_readSettingsFromParamsArray.sqf b/addons/common/functions/fnc_readSettingsFromParamsArray.sqf index 2abb5fa73e..7273fc61ca 100644 --- a/addons/common/functions/fnc_readSettingsFromParamsArray.sqf +++ b/addons/common/functions/fnc_readSettingsFromParamsArray.sqf @@ -32,7 +32,7 @@ TRACE_1("Reading missionConfigFile params",_paramsArray); // Check if the variable is already defined if (isNil _settingName) exitWith { - ERROR_1("readSettingsFromParamsArray - param [%1] is not an ace_setting", _settingName); + ERROR_1("readSettingsFromParamsArray - param [%1] is not an ace_setting",_settingName); }; // The setting is not forced, so update the value @@ -52,7 +52,7 @@ TRACE_1("Reading missionConfigFile params",_paramsArray); }; if (!_validValue) exitWith { - WARNING_3("readSettingsFromParamsArray - param [%1] type not valid [%2] - expected type [%3]", _settingName,_settingValue,_settingType); + WARNING_3("readSettingsFromParamsArray - param [%1] type not valid [%2] - expected type [%3]",_settingName,_settingValue,_settingType); }; if ([_settingName, "mission"] call CBA_settings_fnc_isForced) then { diff --git a/addons/common/functions/fnc_receiveRequest.sqf b/addons/common/functions/fnc_receiveRequest.sqf index 6c45fb8966..02a9379e6c 100644 --- a/addons/common/functions/fnc_receiveRequest.sqf +++ b/addons/common/functions/fnc_receiveRequest.sqf @@ -31,7 +31,7 @@ if (isLocalized _requestMessage) then { _requestMessage = format [_requestMessage, [_caller, false, true] call FUNC(getName)]; }; -hint format ["%1", _requestMessage]; // @todo ? +hint str _requestMessage; // @todo ? if (!isNil QGVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT)) then { terminate GVAR(RECIEVE_REQUEST_TIME_OUT_SCRIPT); diff --git a/addons/common/functions/fnc_removeSyncedEventHandler.sqf b/addons/common/functions/fnc_removeSyncedEventHandler.sqf index 5aed6270f4..615f50ce49 100644 --- a/addons/common/functions/fnc_removeSyncedEventHandler.sqf +++ b/addons/common/functions/fnc_removeSyncedEventHandler.sqf @@ -18,7 +18,7 @@ params ["_name"]; if !(_name in GVAR(syncedEvents)) exitWith { - ERROR_1("Synced event key [%1] not found (removeSyncedEventHandler).", _name); + ERROR_1("Synced event key [%1] not found (removeSyncedEventHandler)",_name); false }; diff --git a/addons/common/functions/fnc_runTests.sqf b/addons/common/functions/fnc_runTests.sqf index 946255c42f..4a449fb7eb 100644 --- a/addons/common/functions/fnc_runTests.sqf +++ b/addons/common/functions/fnc_runTests.sqf @@ -22,7 +22,7 @@ private _startTime = diag_tickTime; private _fails = []; private _total = 0; -INFO_1("ace_common_fnc_runTests starting for [%1]", _specificTest); +INFO_1("ace_common_fnc_runTests starting for [%1]",_specificTest); { private _testName = configName _x; @@ -41,8 +41,8 @@ INFO_1("ace_common_fnc_runTests starting for [%1]", _specificTest); }; } forEach (configProperties [configFile >> "ACE_Tests"]); -INFO_1("ace_common_fnc_runTests finished in %1 ms", (1000 * (diag_tickTime - _startTime)) toFixed 1); -INFO_2("[%1 / %2] Tests Passed", (_total - (count _fails)), _total); +INFO_1("ace_common_fnc_runTests finished in %1 ms",(1000 * (diag_tickTime - _startTime)) toFixed 1); +INFO_2("[%1 / %2] Tests Passed",(_total - (count _fails)),_total); if (_fails isNotEqualTo []) then { - INFO_1("Failed: %1", _fails); + INFO_1("Failed: %1",_fails); }; diff --git a/addons/common/functions/fnc_setApproximateVariablePublic.sqf b/addons/common/functions/fnc_setApproximateVariablePublic.sqf index 3ef9595121..ebd4476de5 100644 --- a/addons/common/functions/fnc_setApproximateVariablePublic.sqf +++ b/addons/common/functions/fnc_setApproximateVariablePublic.sqf @@ -38,4 +38,4 @@ if (abs(_value - _oldValue) < _tolerance) exitWith {}; _object setVariable [_varName, _value, true]; _object setVariable [_oldVarName, _value]; -TRACE_2("Published variable:", _varName, _value); +TRACE_2("Published variable:",_varName,_value); diff --git a/addons/common/functions/fnc_setVariablePublic.sqf b/addons/common/functions/fnc_setVariablePublic.sqf index 8b583849be..678e2bc057 100644 --- a/addons/common/functions/fnc_setVariablePublic.sqf +++ b/addons/common/functions/fnc_setVariablePublic.sqf @@ -34,7 +34,7 @@ if (_object isEqualTo (_object getVariable [format ["ACE_onEmbargo_%1", _varName _object setVariable [_varName, _value, true]; _object setVariable [format ["ACE_onEmbargo_%1", _varName], _object]; -TRACE_2("Starting Embargo", _varName, _delay); +TRACE_2("Starting Embargo",_varName,_delay); [{ params ["_object", "_varName", "_value"]; @@ -43,7 +43,7 @@ TRACE_2("Starting Embargo", _varName, _delay); _object setVariable [format ["ACE_onEmbargo_%1", _varName], nil]; //Remove Embargo private _curValue = _object getVariable _varName; - TRACE_4("End of embargo", _object, _varName, _value, _curValue); + TRACE_4("End of embargo",_object,_varName,_value,_curValue); //If value at start of embargo doesn't equal current, then broadcast and start new embargo if (_value isNotEqualTo _curValue) then { diff --git a/addons/common/functions/fnc_showHud.sqf b/addons/common/functions/fnc_showHud.sqf index da6f2e0975..1ca7ca8106 100644 --- a/addons/common/functions/fnc_showHud.sqf +++ b/addons/common/functions/fnc_showHud.sqf @@ -41,11 +41,11 @@ if (isArray (missionConfigFile >> "showHUD")) then { if (_reason != "") then { _reason = toLower _reason; if (_mask isEqualTo []) then { - TRACE_2("Removing", _reason, _mask); + TRACE_2("Removing",_reason,_mask); GVAR(showHudHash) deleteAt _reason; } else { while {(count _mask) < 10} do { _mask pushBack true; }; - TRACE_2("Setting", _reason, _mask); + TRACE_2("Setting",_reason,_mask); GVAR(showHudHash) set [_reason, _mask]; }; }; @@ -63,7 +63,7 @@ for "_index" from 0 to 9 do { _resultMask pushBack _set; }; -TRACE_2("showHud", _resultMask, keys GVAR(showHudHash)); +TRACE_2("showHud",_resultMask,keys GVAR(showHudHash)); showHud _resultMask; _resultMask diff --git a/addons/common/functions/fnc_statusEffect_addType.sqf b/addons/common/functions/fnc_statusEffect_addType.sqf index 959ae8c2ef..c7bd61762e 100644 --- a/addons/common/functions/fnc_statusEffect_addType.sqf +++ b/addons/common/functions/fnc_statusEffect_addType.sqf @@ -5,8 +5,9 @@ * * Arguments: * 0: Status Effect Name, this should match a corresponding event name - * 1: Send event globaly + * 1: Send event globally * 2: Common Effect Reaons to pre-seed durring init + * 3: Send event to JIP (requires sending event globally) * * Return Value: * None @@ -17,14 +18,16 @@ * Public: No */ -params [["_name", "", [""]], ["_isGlobal", false, [false]], ["_commonReasonsArray", [], [[]]]]; +params [["_name", "", [""]], ["_isGlobal", false, [false]], ["_commonReasonsArray", [], [[]]], ["_sendJIP", false, [false]]]; TRACE_3("params",_name,_isGlobal,_commonReasonsArray); -if (_name == "") exitWith {ERROR_1("addStatusEffect - Bad Name %1", _this)}; -if (_name in GVAR(statusEffect_Names)) exitWith {WARNING_1("addStatusEffect - Effect Already Added (note, will not update global bit) %1", _this)}; +if (_name == "") exitWith {ERROR_1("addStatusEffect - Bad Name %1",_this)}; +if (_name in GVAR(statusEffect_Names)) exitWith {WARNING_1("addStatusEffect - Effect Already Added (note, will not update global bit) %1",_this)}; +if (_sendJIP && !_isGlobal) exitWith {WARNING_1("addStatusEffect - Trying to add non-global JIP effect %1",_this)}; GVAR(statusEffect_Names) pushBack _name; GVAR(statusEffect_isGlobal) pushBack _isGlobal; +GVAR(statusEffect_sendJIP) pushBack _sendJIP; //We add reasons at any time, but more efficenet to add all common ones at one time during init if (isServer && {_commonReasonsArray isNotEqualTo []}) then { diff --git a/addons/common/functions/fnc_statusEffect_localEH.sqf b/addons/common/functions/fnc_statusEffect_localEH.sqf index f8ff93dba7..e60679350d 100644 --- a/addons/common/functions/fnc_statusEffect_localEH.sqf +++ b/addons/common/functions/fnc_statusEffect_localEH.sqf @@ -22,12 +22,12 @@ TRACE_2("params",_object,_isLocal); //Only run this after the settings are initialized //Need to wait for all EH to be installed (local event will happen between pre and post init) if !(GVAR(settingsInitFinished)) exitWith { - TRACE_1("pushing to runAtSettingsInitialized", _this); + TRACE_1("pushing to runAtSettingsInitialized",_this); GVAR(runAtSettingsInitialized) pushBack [FUNC(statusEffect_localEH), _this]; }; -if (!_isLocal) exitWith {TRACE_1("object no longer local", _this)}; -if (isNull _object) exitWith {TRACE_1("object null", _this)}; +if (!_isLocal) exitWith {TRACE_1("object no longer local",_this)}; +if (isNull _object) exitWith {TRACE_1("object null",_this)}; //Reset any variables because of respawn [_object, false] call FUNC(statusEffect_resetVariables); diff --git a/addons/common/functions/fnc_statusEffect_respawnEH.sqf b/addons/common/functions/fnc_statusEffect_respawnEH.sqf index 2c4a4840fe..edad032a9a 100644 --- a/addons/common/functions/fnc_statusEffect_respawnEH.sqf +++ b/addons/common/functions/fnc_statusEffect_respawnEH.sqf @@ -21,12 +21,12 @@ TRACE_1("params",_object); //Only run this after the settings are initialized //Need to wait for all EH to be installed (local event will happen between pre and post init) if !(GVAR(settingsInitFinished)) exitWith { - TRACE_1("pushing to runAtSettingsInitialized", _this); + TRACE_1("pushing to runAtSettingsInitialized",_this); GVAR(runAtSettingsInitialized) pushBack [FUNC(statusEffect_respawnEH), _this]; }; -if (!local _object) exitWith {TRACE_1("object no longer local", _this)}; -if (isNull _object) exitWith {TRACE_1("object null", _this)}; +if (!local _object) exitWith {TRACE_1("object no longer local",_this)}; +if (isNull _object) exitWith {TRACE_1("object null",_this)}; //Reset any variables on "real" respawn [_object, false] call FUNC(statusEffect_resetVariables); diff --git a/addons/common/functions/fnc_statusEffect_sendEffects.sqf b/addons/common/functions/fnc_statusEffect_sendEffects.sqf index 10f7ffb30c..a4e3f2d2a4 100644 --- a/addons/common/functions/fnc_statusEffect_sendEffects.sqf +++ b/addons/common/functions/fnc_statusEffect_sendEffects.sqf @@ -30,12 +30,21 @@ if (isNull _object) exitWith {}; TRACE_2("checking if event is nil",_x,_effectNumber); if (_effectNumber != -1) then { private _eventName = format [QGVAR(%1), _x]; - if (GVAR(statusEffect_isGlobal) select _forEachIndex) then { - TRACE_2("Sending Global Event", _object, _effectNumber); - [_eventName, [_object, _effectNumber]] call CBA_fnc_globalEvent; - } else { - TRACE_2("Sending Target Event", _object, _effectNumber); - [_eventName, [_object, _effectNumber], _object] call CBA_fnc_targetEvent; + switch (true) do { + case (GVAR(statusEffect_sendJIP) select _forEachIndex): { + TRACE_2("Sending Global JIP Event",_object,_effectNumber); + private _jipID = format [QGVAR(effect_%1_%2), _eventName, hashValue _object]; + [_eventName, [_object, _effectNumber], _jipID] call CBA_fnc_globalEventJIP; + [_jipID, _object] call CBA_fnc_removeGlobalEventJIP; + }; + case (GVAR(statusEffect_isGlobal) select _forEachIndex): { + TRACE_2("Sending Global Event",_object,_effectNumber); + [_eventName, [_object, _effectNumber]] call CBA_fnc_globalEvent; + }; + default { + TRACE_2("Sending Target Event",_object,_effectNumber); + [_eventName, [_object, _effectNumber], _object] call CBA_fnc_targetEvent; + }; }; }; }; diff --git a/addons/common/functions/fnc_statusEffect_set.sqf b/addons/common/functions/fnc_statusEffect_set.sqf index 48af4bf771..6e8a74bd3e 100644 --- a/addons/common/functions/fnc_statusEffect_set.sqf +++ b/addons/common/functions/fnc_statusEffect_set.sqf @@ -23,7 +23,7 @@ TRACE_4("params",_object,_effectName,_ID,_set); //Only run this after the settings are initialized if !(GVAR(settingsInitFinished)) exitWith { - TRACE_1("pushing to runAtSettingsInitialized", _this); + TRACE_1("pushing to runAtSettingsInitialized",_this); GVAR(runAtSettingsInitialized) pushBack [FUNC(statusEffect_set), _this]; }; diff --git a/addons/common/functions/fnc_syncedEvent.sqf b/addons/common/functions/fnc_syncedEvent.sqf index 5bcb678524..75170fe7d1 100644 --- a/addons/common/functions/fnc_syncedEvent.sqf +++ b/addons/common/functions/fnc_syncedEvent.sqf @@ -20,7 +20,7 @@ params ["_name", "_args", ["_ttl", 0]]; if !(_name in GVAR(syncedEvents)) exitWith { - ERROR_1("Synced event key [%1] not found (syncedEvent).", _name); + ERROR_1("Synced event key [%1] not found (syncedEvent)",_name); false }; diff --git a/addons/common/functions/fnc_unloadPersonLocal.sqf b/addons/common/functions/fnc_unloadPersonLocal.sqf index d7a2f57db0..0378c6a4b8 100644 --- a/addons/common/functions/fnc_unloadPersonLocal.sqf +++ b/addons/common/functions/fnc_unloadPersonLocal.sqf @@ -35,7 +35,7 @@ if (_emptyPos isEqualTo []) then { }; if (count _emptyPos != 3) exitwith { - WARNING_4("Could not find unload pos %1-ASL: %2 isTouchingGround: %3 Speed: %4",_vehicle, getPosASL _vehicle, isTouchingGround _vehicle, speed _vehicle); + WARNING_4("Could not find unload pos %1-ASL: %2 isTouchingGround: %3 Speed: %4",_vehicle,getPosASL _vehicle,isTouchingGround _vehicle,speed _vehicle); if ((!isNull _unloader) && {[_unloader] call FUNC(isPlayer)}) then { //display text saying there are no safe places to exit the vehicle [QGVAR(displayTextStructured), [localize LSTRING(NoRoomToUnload)], [_unloader]] call CBA_fnc_targetEvent; diff --git a/addons/common/stringtable.xml b/addons/common/stringtable.xml index bfce2cd510..64d5fc61f3 100644 --- a/addons/common/stringtable.xml +++ b/addons/common/stringtable.xml @@ -1641,7 +1641,7 @@ Renommer Umbenennen Zmień nazwę - 改名 + 名前変更 Rinomina 이름 바꾸기 重新命名 diff --git a/addons/compat_cup_terrains/$PBOPREFIX$ b/addons/compat_cup_terrains/$PBOPREFIX$ new file mode 100644 index 0000000000..f904236cf3 --- /dev/null +++ b/addons/compat_cup_terrains/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\compat_cup_terrains diff --git a/addons/compat_cup_terrains/CfgEventHandlers.hpp b/addons/compat_cup_terrains/CfgEventHandlers.hpp new file mode 100644 index 0000000000..9cc1b0427b --- /dev/null +++ b/addons/compat_cup_terrains/CfgEventHandlers.hpp @@ -0,0 +1,5 @@ +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_postInit)); + }; +}; diff --git a/addons/compat_cup_terrains/CfgVehicles.hpp b/addons/compat_cup_terrains/CfgVehicles.hpp new file mode 100644 index 0000000000..08176b77fe --- /dev/null +++ b/addons/compat_cup_terrains/CfgVehicles.hpp @@ -0,0 +1,48 @@ +class CfgVehicles { + class House; + class House_Small_F; + class Strategic; + class House_EP1: House {}; + + class Land_Benzina_schnell: House { + transportFuel = 0; + EGVAR(refuel,hooks)[] = {{-1.5,-3.93,-1.25}, {2.35,-3.93,-1.25}}; + EGVAR(refuel,fuelCargo) = REFUEL_INFINITE_FUEL; + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + position = "[0,-3.93,-1.25]"; + distance = 5; + condition = "true"; + }; + }; + }; + class Land_A_FuelStation_Feed: Strategic { + transportFuel = 0; + EGVAR(refuel,hooks)[] = {{-0.34,0,0}, {0.34,0,0}}; + EGVAR(refuel,fuelCargo) = REFUEL_INFINITE_FUEL; + }; + class Land_Ind_FuelStation_Feed_EP1: House_EP1 { + transportFuel = 0; + EGVAR(refuel,hooks)[] = {{-0.34,0,0}, {0.34,0,0}}; + EGVAR(refuel,fuelCargo) = REFUEL_INFINITE_FUEL; + }; + class Land_FuelStation_Feed_PMC: Strategic { + transportFuel = 0; + EGVAR(refuel,hooks)[] = {{-0.34,0,0}, {0.34,0,0}}; + EGVAR(refuel,fuelCargo) = REFUEL_INFINITE_FUEL; + }; + class FuelStation: House_Small_F { + transportFuel = 0; + EGVAR(refuel,hooks)[] = {{1.25, .2, -1.1}}; + EGVAR(refuel,fuelCargo) = REFUEL_INFINITE_FUEL; + class ACE_Actions { + class ACE_MainActions { + displayName = ECSTRING(interaction,MainAction); + position = "[1.25, .2, -1]"; + distance = 5; + condition = "true"; + }; + }; + }; +}; diff --git a/addons/compat_cup_terrains/XEH_postInit.sqf b/addons/compat_cup_terrains/XEH_postInit.sqf new file mode 100644 index 0000000000..32b9393d98 --- /dev/null +++ b/addons/compat_cup_terrains/XEH_postInit.sqf @@ -0,0 +1,5 @@ +#include "script_component.hpp" + +if (["CUP_Terrains_ACE_compat"] call EFUNC(common,isModLoaded)) exitWith { + ERROR_WITH_TITLE("Duplicate CUP/ACE Compats","Compats are now part of ACE - Uninstall 'CUP ACE3 Compatibility Addon - Terrains'"); +}; diff --git a/addons/compat_cup_terrains/config.cpp b/addons/compat_cup_terrains/config.cpp new file mode 100644 index 0000000000..a7020be4da --- /dev/null +++ b/addons/compat_cup_terrains/config.cpp @@ -0,0 +1,27 @@ +#include "script_component.hpp" +#include "\z\ace\addons\refuel\defines.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "CABuildings", + "CAStructuresHouse_A_FuelStation", + "CAStructures_E_Ind_Ind_FuelStation", + "CAStructures_PMC_FuelStation", + "CUP_Buildings_Config", + "ace_refuel" // not a sub-component because it's all this compat does + }; + skipWhenMissingDependencies = 1; + author = ECSTRING(common,ACETeam); + authors[] = {"Community Upgrade Project", "Mike"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgVehicles.hpp" +#include "CfgEventHandlers.hpp" diff --git a/addons/compat_cup_terrains/script_component.hpp b/addons/compat_cup_terrains/script_component.hpp new file mode 100644 index 0000000000..633de5584b --- /dev/null +++ b/addons/compat_cup_terrains/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT compat_cup_terrains +#define COMPONENT_BEAUTIFIED CUP Terrains Compatibility + +#include "\z\ace\addons\main\script_mod.hpp" +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/compat_cup_units/$PBOPREFIX$ b/addons/compat_cup_units/$PBOPREFIX$ new file mode 100644 index 0000000000..7a3dc51ddd --- /dev/null +++ b/addons/compat_cup_units/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\compat_cup_units diff --git a/addons/compat_cup_units/CfgWeapons.hpp b/addons/compat_cup_units/CfgWeapons.hpp new file mode 100644 index 0000000000..37a210db9d --- /dev/null +++ b/addons/compat_cup_units/CfgWeapons.hpp @@ -0,0 +1,87 @@ +#define HEARING(CLASSNAME) \ + class CLASSNAME: ItemCore { \ + ace_hearing_protection = 0.75; \ + ace_hearing_lowerVolume = 0; \ + } + +#define HEARING_PARENT(CLASSNAME,PARENT) \ + class CLASSNAME: PARENT { \ + ace_hearing_protection = 0.75; \ + ace_hearing_lowerVolume = 0; \ + } + +class CfgWeapons { + class ItemCore; + class CUP_H_PMC_Beanie_Khaki; + + HEARING(CUP_H_BAF_DDPM_Mk6_CREW_PRR); + HEARING(CUP_H_BAF_DPM_Mk6_CREW_PRR); + HEARING(CUP_H_BAF_MTP_Mk6_CREW_PRR); + HEARING(CUP_H_CZ_Cap_Headphones); + HEARING(CUP_H_CZ_Cap_Headphones_des); + HEARING(CUP_H_CZ_Helmet05); + HEARING(CUP_H_CZ_Helmet07); + HEARING(CUP_H_CZ_Helmet08); + HEARING(CUP_H_CZ_Helmet09); + HEARING(CUP_H_CZ_Helmet10); + HEARING(CUP_H_FR_ECH); + HEARING(CUP_H_Ger_Beret_TankCommander_Blk); + HEARING(CUP_H_Ger_Beret_TankCommander_Grn); + HEARING(CUP_H_Ger_Cap_EP_Grn1); + HEARING(CUP_H_Ger_Cap_EP_Grn2); + HEARING(CUP_H_Ger_Cap_EP_Tan1); + HEARING(CUP_H_Ger_Cap_EP_Tan2); + HEARING(CUP_H_OpsCore_Black); + HEARING(CUP_H_OpsCore_Black_SF); + HEARING(CUP_H_OpsCore_Covered_AAF); + HEARING(CUP_H_OpsCore_Covered_AAF_SF); + HEARING(CUP_H_OpsCore_Covered_Fleck); + HEARING(CUP_H_OpsCore_Covered_Fleck_SF); + HEARING(CUP_H_OpsCore_Covered_MCAM); + HEARING(CUP_H_OpsCore_Covered_MCAM_SF); + HEARING(CUP_H_OpsCore_Covered_MCAM_US); + HEARING(CUP_H_OpsCore_Covered_MCAM_US_SF); + HEARING(CUP_H_OpsCore_Covered_MTP); + HEARING(CUP_H_OpsCore_Covered_MTP_SF); + HEARING(CUP_H_OpsCore_Covered_Tigerstripe); + HEARING(CUP_H_OpsCore_Covered_Tigerstripe_SF); + HEARING(CUP_H_OpsCore_Covered_Tropen); + HEARING(CUP_H_OpsCore_Covered_Tropen_SF); + HEARING(CUP_H_OpsCore_Covered_UCP); + HEARING(CUP_H_OpsCore_Covered_UCP_SF); + HEARING(CUP_H_OpsCore_Green); + HEARING(CUP_H_OpsCore_Green_SF); + HEARING(CUP_H_OpsCore_Grey); + HEARING(CUP_H_OpsCore_Grey_SF); + HEARING(CUP_H_OpsCore_Spray); + HEARING(CUP_H_OpsCore_Spray_SF); + HEARING(CUP_H_OpsCore_Spray_US); + HEARING(CUP_H_OpsCore_Spray_US_SF); + HEARING(CUP_H_OpsCore_Tan); + HEARING(CUP_H_OpsCore_Tan_SF); + HEARING_PARENT(CUP_H_PMC_Beanie_Headphones_Khaki,CUP_H_PMC_Beanie_Khaki); + HEARING_PARENT(CUP_H_PMC_Beanie_Headphones_Black,CUP_H_PMC_Beanie_Headphones_Khaki); + HEARING_PARENT(CUP_H_PMC_Beanie_Headphones_Winter,CUP_H_PMC_Beanie_Headphones_Khaki); + HEARING(CUP_H_PMC_Cap_Back_EP_Grey); + HEARING(CUP_H_PMC_Cap_Back_EP_Tan); + HEARING(CUP_H_PMC_Cap_EP_Grey); + HEARING(CUP_H_PMC_Cap_EP_Tan); + HEARING(CUP_H_PMC_EP_Headset); + HEARING(CUP_H_USArmy_HelmetMICH_earpro); + HEARING(CUP_H_USArmy_HelmetMICH_earpro_DCU); + HEARING(CUP_H_USArmy_HelmetMICH_earpro_ess); + HEARING(CUP_H_USArmy_HelmetMICH_earpro_ess_DCU); + HEARING(CUP_H_USArmy_HelmetMICH_earpro_ess_wdl); + HEARING(CUP_H_USArmy_HelmetMICH_earpro_wdl); + HEARING(CUP_H_USArmy_Helmet_ECH1_Black); + HEARING(CUP_H_USArmy_Helmet_ECH1_Green); + HEARING(CUP_H_USArmy_Helmet_ECH1_Sand); + HEARING(CUP_H_USArmy_Helmet_ECH2_Black); + HEARING(CUP_H_USArmy_Helmet_ECH2_GREEN); + HEARING(CUP_H_USArmy_Helmet_ECH2_Sand); + HEARING(CUP_H_USMC_Crew_Helmet); + HEARING(CUP_H_USMC_MICH2000_DEF_DES); + HEARING(CUP_H_USMC_MICH2000_DEF_ESS_DES); + HEARING(CUP_H_USMC_MICH2000_DEF_ESS_WDL); + HEARING(CUP_H_USMC_MICH2000_DEF_WDL); +}; diff --git a/addons/compat_cup_units/compat_cup_nouniformrestrictions/CfgVehicles.hpp b/addons/compat_cup_units/compat_cup_nouniformrestrictions/CfgVehicles.hpp new file mode 100644 index 0000000000..386cc7df0b --- /dev/null +++ b/addons/compat_cup_units/compat_cup_nouniformrestrictions/CfgVehicles.hpp @@ -0,0 +1,86 @@ +class CfgVehicles { + class SoldierWB; + class Civilian_F; + + class CUP_BAF_Soldier_DPM_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_BAF_Soldier_DDPM_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_BAF_Soldier_MTP_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_GER_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_NAPA_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_PMC_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_PMC_Soldier_Winter_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_RUS_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_TK_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_TKI_Insurgent_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_TKG_Guerrilla_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_USMC_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_FR_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Civil_Chernarus_Base: Civilian_F { + modelSides[] = {6}; + }; + class CUP_Creatures_Civil_Takistan_Base: Civilian_F { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_ACR_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_CDF_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_UNO_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_OPFINS_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_RACS_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_SLA_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_USA_Soldier_ACU_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_USA_Soldier_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_HIL_Reservist_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_HIL_Recon_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_HIL_Man_Base: SoldierWB { + modelSides[] = {6}; + }; + class CUP_Creatures_Military_HIL_SF_Base: SoldierWB { + modelSides[] = {6}; + }; +}; diff --git a/addons/compat_cup_units/compat_cup_nouniformrestrictions/config.cpp b/addons/compat_cup_units/compat_cup_nouniformrestrictions/config.cpp new file mode 100644 index 0000000000..826f796226 --- /dev/null +++ b/addons/compat_cup_units/compat_cup_nouniformrestrictions/config.cpp @@ -0,0 +1,21 @@ +#include "script_component.hpp" + +class CfgPatches { + class SUBADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "CUP_Creatures_People_LoadOrder", + "ace_nouniformrestrictions" + }; + skipWhenMissingDependencies = 1; + author = ECSTRING(common,ACETeam); + authors[] = {"Mike", "Jonpas"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgVehicles.hpp" diff --git a/addons/compat_cup_units/compat_cup_nouniformrestrictions/script_component.hpp b/addons/compat_cup_units/compat_cup_nouniformrestrictions/script_component.hpp new file mode 100644 index 0000000000..0b98185fa0 --- /dev/null +++ b/addons/compat_cup_units/compat_cup_nouniformrestrictions/script_component.hpp @@ -0,0 +1,3 @@ +#define SUBCOMPONENT nouniformrestrictions +#define SUBCOMPONENT_BEAUTIFIED No Uniform Restrictions +#include "..\script_component.hpp" diff --git a/addons/compat_cup_units/config.cpp b/addons/compat_cup_units/config.cpp new file mode 100644 index 0000000000..bde1052a11 --- /dev/null +++ b/addons/compat_cup_units/config.cpp @@ -0,0 +1,18 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"CUP_Creatures_People_LoadOrder"}; + skipWhenMissingDependencies = 1; + author = ECSTRING(common,ACETeam); + authors[] = {"Mike", "Jonpas"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgWeapons.hpp" diff --git a/addons/compat_cup_units/script_component.hpp b/addons/compat_cup_units/script_component.hpp new file mode 100644 index 0000000000..46e1542b50 --- /dev/null +++ b/addons/compat_cup_units/script_component.hpp @@ -0,0 +1,5 @@ +#define COMPONENT compat_cup_units +#define COMPONENT_BEAUTIFIED CUP Units Compatibility + +#include "\z\ace\addons\main\script_mod.hpp" +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp index 994af4f667..4fda436d18 100644 --- a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/CfgWeapons.hpp @@ -1,7 +1,14 @@ class CfgWeapons { // Last update: RHSAFRF 0.5.6 - class rhs_acc_perst3; - class rhs_acc_perst3_2dp: rhs_acc_perst3 { - baseWeapon = "rhs_acc_perst3_2dp"; + class rhs_acc_perst3_2dp_light; + class rhs_acc_perst3_2dp_light_h: rhs_acc_perst3_2dp_light { + baseWeapon = "rhs_acc_perst3_2dp_h"; + }; + + class acc_pointer_IR; + class rhs_acc_perst1ik: acc_pointer_IR { + MRT_SwitchItemHintText = ""; // prevent false info for illuminator stat + MRT_SwitchItemNextClass = ""; + MRT_SwitchItemPrevClass = ""; }; }; diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp index bb2e1bf3a2..b544accac3 100644 --- a/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_arsenal/config.cpp @@ -15,4 +15,4 @@ class CfgPatches { }; }; -//#include "CfgWeapons.hpp" +#include "CfgWeapons.hpp" diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp index 8dc735265c..b87223ae27 100644 --- a/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_arsenal/CfgWeapons.hpp @@ -3,6 +3,9 @@ class CfgWeapons { class acc_pointer_IR; class rhsusf_acc_anpeq15: acc_pointer_IR { baseWeapon = "rhsusf_acc_anpeq15"; + MRT_SwitchItemHintText = ""; // prevent false info for illuminator stat + MRT_SwitchItemNextClass = ""; + MRT_SwitchItemPrevClass = ""; }; class rhsusf_acc_anpeq15_bk: rhsusf_acc_anpeq15 { baseWeapon = "rhsusf_acc_anpeq15_bk"; @@ -28,8 +31,12 @@ class CfgWeapons { class rhsusf_acc_wmx_bk: rhsusf_acc_M952V { baseWeapon = "rhsusf_acc_wmx_bk"; }; + class rhsusf_acc_anpeq15A: acc_pointer_IR { baseWeapon = "rhsusf_acc_anpeq15A"; + MRT_SwitchItemHintText = ""; // prevent false info for illuminator stat + MRT_SwitchItemNextClass = ""; + MRT_SwitchItemPrevClass = ""; }; class rhsusf_acc_anpeq15_top: rhsusf_acc_anpeq15A { baseWeapon = "rhsusf_acc_anpeq15_top"; @@ -37,8 +44,12 @@ class CfgWeapons { class rhsusf_acc_anpeq15_bk_top: rhsusf_acc_anpeq15_top { baseWeapon = "rhsusf_acc_anpeq15_bk_top"; }; + class rhsusf_acc_anpeq15side: acc_pointer_IR { baseWeapon = "rhsusf_acc_anpeq15side"; + MRT_SwitchItemHintText = ""; // prevent false info for illuminator stat + MRT_SwitchItemNextClass = ""; + MRT_SwitchItemPrevClass = ""; }; class rhsusf_acc_anpeq15side_bk: rhsusf_acc_anpeq15side { baseWeapon = "rhsusf_acc_anpeq15side_bk"; diff --git a/addons/cookoff/CfgSounds.hpp b/addons/cookoff/CfgSounds.hpp new file mode 100644 index 0000000000..742fb589d9 --- /dev/null +++ b/addons/cookoff/CfgSounds.hpp @@ -0,0 +1,66 @@ +#define VOLUME 2 +#define PITCH 1 + +#define SHOTSOUND(type,dist,N,maxDistance)\ +class GVAR(TRIPLES(type,dist,N)) {\ + sound[] = {QPATHTOF(sounds\type\DOUBLES(dist,N).wss), VOLUME, PITCH, maxDistance};\ + titles[] = {};\ +} + +#define SHOTSOUNDCLASS(type,dist,maxDistance)\ +SHOTSOUND(type,dist,1,maxDistance);\ +SHOTSOUND(type,dist,2,maxDistance);\ +SHOTSOUND(type,dist,3,maxDistance) + +#define SHOTSOUNDCLASSTYPE(type,maxDistance)\ +SHOTSOUNDCLASS(type,close,maxDistance);\ +SHOTSOUNDCLASS(type,mid,maxDistance);\ +SHOTSOUNDCLASS(type,far,maxDistance) + +// Allows other mods to change sounds for cook-off +class CfgSounds { + // These macros set up the sounds for the various classes + SHOTSOUNDCLASSTYPE(shotbullet,1250); + SHOTSOUNDCLASSTYPE(shotrocket,1600); + SHOTSOUNDCLASSTYPE(shotshell,1300); + + // Missiles use the same sounds as rockets + class GVAR(shotmissile_close_1): GVAR(shotrocket_close_1) {}; + class GVAR(shotmissile_close_2): GVAR(shotrocket_close_2) {}; + class GVAR(shotmissile_close_3): GVAR(shotrocket_close_3) {}; + class GVAR(shotmissile_mid_1): GVAR(shotrocket_mid_1) {}; + class GVAR(shotmissile_mid_2): GVAR(shotrocket_mid_2) {}; + class GVAR(shotmissile_mid_3): GVAR(shotrocket_mid_3) {}; + class GVAR(shotmissile_far_1): GVAR(shotrocket_far_1) {}; + class GVAR(shotmissile_far_2): GVAR(shotrocket_far_2) {}; + class GVAR(shotmissile_far_3): GVAR(shotrocket_far_3) {}; + + // Submunitions have the same sound as bullets, but a higher maxDistance + class GVAR(shotsubmunitions_close_1): GVAR(shotbullet_close_1) { + sound[] = {QPATHTOF(sounds\shotbullet\close_1.wss), VOLUME, PITCH, 1600}; + }; + class GVAR(shotsubmunitions_close_2): GVAR(shotbullet_close_2) { + sound[] = {QPATHTOF(sounds\shotbullet\close_2.wss), VOLUME, PITCH, 1600}; + }; + class GVAR(shotsubmunitions_close_3): GVAR(shotbullet_close_3) { + sound[] = {QPATHTOF(sounds\shotbullet\close_3.wss), VOLUME, PITCH, 1600}; + }; + class GVAR(shotsubmunitions_mid_1): GVAR(shotbullet_far_1) { + sound[] = {QPATHTOF(sounds\shotbullet\mid_1.wss), VOLUME, PITCH, 1600}; + }; + class GVAR(shotsubmunitions_mid_2): GVAR(shotbullet_mid_2) { + sound[] = {QPATHTOF(sounds\shotbullet\mid_2.wss), VOLUME, PITCH, 1600}; + }; + class GVAR(shotsubmunitions_mid_3): GVAR(shotbullet_mid_3) { + sound[] = {QPATHTOF(sounds\shotbullet\mid_3.wss), VOLUME, PITCH, 1600}; + }; + class GVAR(shotsubmunitions_far_1): GVAR(shotbullet_far_1) { + sound[] = {QPATHTOF(sounds\shotbullet\far_1.wss), VOLUME, PITCH, 1600}; + }; + class GVAR(shotsubmunitions_far_2): GVAR(shotbullet_far_2) { + sound[] = {QPATHTOF(sounds\shotbullet\far_2.wss), VOLUME, PITCH, 1600}; + }; + class GVAR(shotsubmunitions_far_3): GVAR(shotbullet_far_3) { + sound[] = {QPATHTOF(sounds\shotbullet\far_3.wss), VOLUME, PITCH, 1600}; + }; +}; diff --git a/addons/cookoff/XEH_postInit.sqf b/addons/cookoff/XEH_postInit.sqf index b9c8101595..b33723619e 100644 --- a/addons/cookoff/XEH_postInit.sqf +++ b/addons/cookoff/XEH_postInit.sqf @@ -14,15 +14,15 @@ // handle cleaning up effects when vehicle is deleted mid-cookoff [QGVAR(addCleanupHandlers), { params ["_vehicle"]; - + // Don't add a new EH if cookoff is run multiple times if ((_vehicle getVariable [QGVAR(deletedEH), -1]) == -1) then { private _deletedEH = _vehicle addEventHandler ["Deleted", { params ["_vehicle"]; - + [QGVAR(cleanupEffects), [_vehicle]] call CBA_fnc_localEvent; }]; - + _vehicle setVariable [QGVAR(deletedEH), _deletedEH]; }; }] call CBA_fnc_addEventHandler; @@ -58,3 +58,42 @@ [FUNC(detonateAmmunition), [_vehicle, _mags, _total], _delay] call CBA_fnc_waitAndExecute; }; }, nil, ["Man","StaticWeapon"]] call CBA_fnc_addClassEventHandler; + +if (hasInterface) then { + // Plays a sound locally, so that different sounds can be used for various distances + [QGVAR(playCookoffSound), { + params ["_object", "_sound"]; + + if (isNull _object) exitWith {}; + + private _distance = _object distance (positionCameraToWorld [0, 0, 0]); + + TRACE_3("",_object,_sound,_maxDistance); + + // 3 classes of distances: close, mid and far, each having different sound files + private _classDistance = switch (true) do { + case (_distance < DISTANCE_CLOSE): {"close"}; + case (_distance < DISTANCE_MID): {"mid"}; + default {"far"}; + }; + + _sound = format [QGVAR(%1_%2_%3), _sound, _classDistance, floor (random 3) + 1]; + + TRACE_1("",_sound); + + // Allows other mods to change sounds for cook-off + _sound = getArray (configFile >> "CfgSounds" >> _sound >> "sound"); + + if (_sound isEqualTo []) exitWith {}; + + _sound params ["_sound", "_volume", "_pitch", "_maxDistance"]; + + if (_distance > _maxDistance) exitWith {}; + + // Make sure file exists, so RPT isn't spammed with non-existent entry errors + if (!fileExists _sound) exitWith {}; + + // Obeys speed of sound and takes doppler effects into account + playSound3D [_sound, objNull, insideBuilding _object >= 0.5, getPosASL _object, _volume, _pitch + (random 0.2) - 0.1, _maxDistance, 0, true]; + }] call CBA_fnc_addEventHandler; +}; diff --git a/addons/cookoff/config.cpp b/addons/cookoff/config.cpp index 4fba15f5e1..dc7a472855 100644 --- a/addons/cookoff/config.cpp +++ b/addons/cookoff/config.cpp @@ -21,4 +21,5 @@ class CfgPatches { #include "CfgAmmo.hpp" #include "CfgCloudlets.hpp" #include "CfgSFX.hpp" +#include "CfgSounds.hpp" #include "CfgVehicles.hpp" diff --git a/addons/cookoff/functions/fnc_cookOff.sqf b/addons/cookoff/functions/fnc_cookOff.sqf index 1d598cdb96..57cde71682 100644 --- a/addons/cookoff/functions/fnc_cookOff.sqf +++ b/addons/cookoff/functions/fnc_cookOff.sqf @@ -36,7 +36,7 @@ _vehicle setVariable [QGVAR(isCookingOff), true, true]; // limit maximum value of intensity to prevent very long cook-off times _intensity = _intensity min _maxIntensity; -private _config = _vehicle call CBA_fnc_getObjectConfig; +private _config = configOf _vehicle; private _positions = getArray (_config >> QGVAR(cookoffSelections)) select {(_vehicle selectionPosition _x) isNotEqualTo [0,0,0]}; if (_positions isEqualTo []) then { diff --git a/addons/cookoff/functions/fnc_cookOffEffect.sqf b/addons/cookoff/functions/fnc_cookOffEffect.sqf index a907f67606..44282f2f6b 100644 --- a/addons/cookoff/functions/fnc_cookOffEffect.sqf +++ b/addons/cookoff/functions/fnc_cookOffEffect.sqf @@ -40,7 +40,7 @@ if (isServer) then { if (_ring) then { private _intensity = 6; private _radius = 1.5 * ((boundingBoxReal _obj) select 2); - [QEGVAR(fire,addFireSource), [_obj, _radius, _intensity, _obj]] call CBA_fnc_localEvent; + [QEGVAR(fire,addFireSource), [_obj, _radius, _intensity, format [QGVAR(%1), hashValue _obj]]] call CBA_fnc_localEvent; }; }; @@ -52,7 +52,7 @@ if (isServer) then { deleteVehicle _light; deleteVehicle _sound; if (isServer) then { - [QEGVAR(fire,removeFireSource), [_obj]] call CBA_fnc_localEvent; + [QEGVAR(fire,removeFireSource), [format [QGVAR(%1), hashValue _obj]]] call CBA_fnc_localEvent; }; [_pfh] call CBA_fnc_removePerFrameHandler; }; @@ -198,4 +198,3 @@ if (isServer) then { ]; }, 0, [_obj, _jet, _ring, _time, CBA_missionTime, _light, _fireSelection, _sound, _intensity]] call CBA_fnc_addPerFrameHandler; - diff --git a/addons/cookoff/functions/fnc_detonateAmmunition.sqf b/addons/cookoff/functions/fnc_detonateAmmunition.sqf index b4d48f3120..cc39ff43cf 100644 --- a/addons/cookoff/functions/fnc_detonateAmmunition.sqf +++ b/addons/cookoff/functions/fnc_detonateAmmunition.sqf @@ -32,90 +32,89 @@ private _magazineIndex = floor random(count _magazines); private _magazine = _magazines select _magazineIndex; _magazine params ["_magazineClassname", "_amountOfMagazines"]; -if (_amountOfMagazines > 0) exitWith { - private _removed = _amountOfMagazines min floor(1 + random(6 / GVAR(ammoCookoffDuration))); +if (_amountOfMagazines < 0) exitWith { + ERROR_1("mag with no ammo - %1",_magazine); +}; +private _removed = _amountOfMagazines min floor(1 + random(6 / GVAR(ammoCookoffDuration))); - _amountOfMagazines = _amountOfMagazines - _removed; - if (_amountOfMagazines <= 0) then { - _magazines deleteAt _magazineIndex; +_amountOfMagazines = _amountOfMagazines - _removed; +if (_amountOfMagazines <= 0) then { + _magazines deleteAt _magazineIndex; +} else { + _magazine set [1, _amountOfMagazines]; // clear out the magazine +}; +private _timeBetweenAmmoDetonation = (((random 10) / (sqrt _totalAmmo)) min MAX_TIME_BETWEEN_AMMO_DET) max 0.1; +TRACE_2("",_totalAmmo,_timeBetweenAmmoDetonation); +_totalAmmo = _totalAmmo - _removed; + +private _ammo = getText (configFile >> "CfgMagazines" >> _magazineClassname >> "ammo"); +private _ammoCfg = configFile >> "CfgAmmo" >> _ammo; + +private _speedOfAmmo = getNumber (configFile >> "CfgMagazines" >> _magazineClassname >> "initSpeed"); +private _simType = getText (_ammoCfg >> "simulation"); + +private _effect2pos = _vehicle selectionPosition "destructionEffect2"; + +private _spawnProjectile = { + params ["_vehicle", "_ammo", "_speed", "_flyAway"]; + + private _spawnPos = _vehicle modelToWorld [-0.2 + (random 0.4), -0.2 + (random 0.4), random 3]; + if (_spawnPos select 2 < 0) then { + _spawnPos set [2, 0]; + }; + + private _projectile = createVehicle [_ammo, _spawnPos, [], 0, "CAN_COLLIDE"]; + if (_flyAway) then { + private _vectorAmmo = [(-1 + (random 2)), (-1 + (random 2)), -0.2 + (random 1)]; + private _velVec = _vectorAmmo vectorMultiply _speed; + _projectile setVectorDir _velVec; + _projectile setVelocity _velVec; } else { - _magazine set [1, _amountOfMagazines]; // clear out the magazine - }; - private _timeBetweenAmmoDetonation = (((random 10) / (sqrt _totalAmmo)) min MAX_TIME_BETWEEN_AMMO_DET) max 0.1; - TRACE_2("",_totalAmmo,_timeBetweenAmmoDetonation); - _totalAmmo = _totalAmmo - _removed; - - private _ammo = getText (configFile >> "CfgMagazines" >> _magazineClassname >> "ammo"); - private _ammoCfg = configFile >> "CfgAmmo" >> _ammo; - - private _speedOfAmmo = getNumber (configFile >> "CfgMagazines" >> _magazineClassname >> "initSpeed"); - private _simType = getText (_ammoCfg >> "simulation"); - - private _effect2pos = _vehicle selectionPosition "destructionEffect2"; - - private _spawnProjectile = { - params ["_vehicle", "_ammo", "_speed", "_flyAway"]; - - private _spawnPos = _vehicle modelToWorld [-0.2 + (random 0.4), -0.2 + (random 0.4), random 3]; - if (_spawnPos select 2 < 0) then { - _spawnPos set [2, 0]; - }; - - private _projectile = createVehicle [_ammo, _spawnPos, [], 0, "CAN_COLLIDE"]; - if (_flyAway) then { - private _vectorAmmo = [(-1 + (random 2)), (-1 + (random 2)), -0.2 + (random 1)]; - private _velVec = _vectorAmmo vectorMultiply _speed; - _projectile setVectorDir _velVec; - _projectile setVelocity _velVec; - } else { - _projectile setDamage 1; - }; - - _projectile; + _projectile setDamage 1; }; - private _speed = random (_speedOfAmmo / 10) max 1; - - if (toLower _simType == "shotbullet") then { - private _sound = selectRandom [QUOTE(PATHTO_R(sounds\light_crack_close.wss)), QUOTE(PATHTO_R(sounds\light_crack_close_filtered.wss)), QUOTE(PATHTO_R(sounds\heavy_crack_close.wss)), QUOTE(PATHTO_R(sounds\heavy_crack_close_filtered.wss))]; - playSound3D [_sound, objNull, false, (getPosASL _vehicle), 2, 1, 1250]; + _projectile; +}; +private _speed = random (_speedOfAmmo / 10) max 1; +_simType = toLower _simType; +switch (_simType) do { + case ("shotbullet"): { + [QGVAR(playCookoffSound), [_vehicle, _simType]] call CBA_fnc_globalEvent; if (random 1 < 0.6) then { [_vehicle, _ammo, _speed, true] call _spawnProjectile; }; }; - if (toLower _simType == "shotshell") then { - private _sound = selectRandom [QUOTE(PATHTO_R(sounds\heavy_crack_close.wss)), QUOTE(PATHTO_R(sounds\heavy_crack_close_filtered.wss))]; - playSound3D [_sound, objNull, false, (getPosASL _vehicle), 2, 1, 1300]; - + case ("shotshell"): { + [QGVAR(playCookoffSound), [_vehicle, _simType]] call CBA_fnc_globalEvent; if (random 1 < 0.15) then { [_vehicle, _ammo, _speed, true] call _spawnProjectile; }; }; - if (toLower _simType == "shotgrenade") then { + case ("shotgrenade"): { if (random 1 < 0.9) then { _speed = 0; }; [_vehicle, _ammo, _speed, random 1 < 0.5] call _spawnProjectile; }; - if (toLower _simType in ["shotrocket", "shotmissile", "shotsubmunitions"]) then { + case ("shotrocket"); + case ("shotmissile"); + case ("shotsubmunitions"): { if (random 1 < 0.1) then { - private _sound = selectRandom [QUOTE(PATHTO_R(sounds\cannon_crack_close.wss)), QUOTE(PATHTO_R(sounds\cannon_crack_close_filtered.wss))]; - playSound3D [_sound, objNull, false, (getPosASL _vehicle), 3, 1, 1600]; - + [QGVAR(playCookoffSound), [_vehicle, _simType]] call CBA_fnc_globalEvent; [_vehicle, _ammo, _speed, random 1 < 0.3] call _spawnProjectile; } else { createvehicle ["ACE_ammoExplosionLarge", (_vehicle modelToWorld _effect2pos), [], 0 , "CAN_COLLIDE"]; }; }; - if (toLower _simType in ["shotdirectionalbomb", "shotmine"]) then { + case ("shotmine"); + case ("shotdirectionalbomb"): { if (random 1 < 0.5) then { // Not all explosives detonate on destruction, some have scripted alternatives private _scripted = getNumber (_ammoCfg >> "triggerWhenDestroyed") == 1; if !(_scripted) then { _ammo = getText (_ammoCfg >> "ace_explosives_Explosive"); }; - // If a scripted alternative doesn't exist use generic explosion if (_ammo != "") then { [_vehicle, _ammo, 0, false] call _spawnProjectile; @@ -124,12 +123,10 @@ if (_amountOfMagazines > 0) exitWith { }; }; }; - if (toLower _simType == "shotilluminating") then { + case ("shotilluminating"): { if (random 1 < 0.15) then { [_vehicle, _ammo, _speed, random 1 < 0.3] call _spawnProjectile; }; }; - - [FUNC(detonateAmmunition), [_vehicle, _magazines, _totalAmmo], _timeBetweenAmmoDetonation] call CBA_fnc_waitAndExecute; }; -ERROR_1("mag with no ammo - %1", _magazine); +[FUNC(detonateAmmunition), [_vehicle, _magazines, _totalAmmo], _timeBetweenAmmoDetonation] call CBA_fnc_waitAndExecute; diff --git a/addons/cookoff/script_component.hpp b/addons/cookoff/script_component.hpp index 03b3e5c5f5..d41b8f675c 100644 --- a/addons/cookoff/script_component.hpp +++ b/addons/cookoff/script_component.hpp @@ -37,3 +37,6 @@ // Common commander hatch defines for default vehicles #define DEFAULT_COMMANDER_HATCHES ["osa_poklop_commander", "hatch_commander_axis"] + +#define DISTANCE_CLOSE 235 +#define DISTANCE_MID 952 diff --git a/addons/cookoff/sounds/cannon_crack_close.wss b/addons/cookoff/sounds/cannon_crack_close.wss deleted file mode 100644 index b45ea96ab0..0000000000 Binary files a/addons/cookoff/sounds/cannon_crack_close.wss and /dev/null differ diff --git a/addons/cookoff/sounds/cannon_crack_close_filtered.wss b/addons/cookoff/sounds/cannon_crack_close_filtered.wss deleted file mode 100644 index 4ddb18539b..0000000000 Binary files a/addons/cookoff/sounds/cannon_crack_close_filtered.wss and /dev/null differ diff --git a/addons/cookoff/sounds/heavy_crack_close.wss b/addons/cookoff/sounds/heavy_crack_close.wss deleted file mode 100644 index 95cc68d90e..0000000000 Binary files a/addons/cookoff/sounds/heavy_crack_close.wss and /dev/null differ diff --git a/addons/cookoff/sounds/heavy_crack_close_filtered.wss b/addons/cookoff/sounds/heavy_crack_close_filtered.wss deleted file mode 100644 index 1b4520cd4a..0000000000 Binary files a/addons/cookoff/sounds/heavy_crack_close_filtered.wss and /dev/null differ diff --git a/addons/cookoff/sounds/light_crack_close.wss b/addons/cookoff/sounds/light_crack_close.wss deleted file mode 100644 index ef284f24ef..0000000000 Binary files a/addons/cookoff/sounds/light_crack_close.wss and /dev/null differ diff --git a/addons/cookoff/sounds/light_crack_close_filtered.wss b/addons/cookoff/sounds/light_crack_close_filtered.wss deleted file mode 100644 index b1c76fa8ed..0000000000 Binary files a/addons/cookoff/sounds/light_crack_close_filtered.wss and /dev/null differ diff --git a/addons/cookoff/sounds/shotbullet/close_1.wss b/addons/cookoff/sounds/shotbullet/close_1.wss new file mode 100644 index 0000000000..19f07503bf Binary files /dev/null and b/addons/cookoff/sounds/shotbullet/close_1.wss differ diff --git a/addons/cookoff/sounds/shotbullet/close_2.wss b/addons/cookoff/sounds/shotbullet/close_2.wss new file mode 100644 index 0000000000..bf83c29599 Binary files /dev/null and b/addons/cookoff/sounds/shotbullet/close_2.wss differ diff --git a/addons/cookoff/sounds/shotbullet/close_3.wss b/addons/cookoff/sounds/shotbullet/close_3.wss new file mode 100644 index 0000000000..dcf4198acd Binary files /dev/null and b/addons/cookoff/sounds/shotbullet/close_3.wss differ diff --git a/addons/cookoff/sounds/shotbullet/far_1.wss b/addons/cookoff/sounds/shotbullet/far_1.wss new file mode 100644 index 0000000000..07cd30e15b Binary files /dev/null and b/addons/cookoff/sounds/shotbullet/far_1.wss differ diff --git a/addons/cookoff/sounds/shotbullet/far_2.wss b/addons/cookoff/sounds/shotbullet/far_2.wss new file mode 100644 index 0000000000..795581517a Binary files /dev/null and b/addons/cookoff/sounds/shotbullet/far_2.wss differ diff --git a/addons/cookoff/sounds/shotbullet/far_3.wss b/addons/cookoff/sounds/shotbullet/far_3.wss new file mode 100644 index 0000000000..d7e5538150 Binary files /dev/null and b/addons/cookoff/sounds/shotbullet/far_3.wss differ diff --git a/addons/cookoff/sounds/shotbullet/mid_1.wss b/addons/cookoff/sounds/shotbullet/mid_1.wss new file mode 100644 index 0000000000..b02a481b42 Binary files /dev/null and b/addons/cookoff/sounds/shotbullet/mid_1.wss differ diff --git a/addons/cookoff/sounds/shotbullet/mid_2.wss b/addons/cookoff/sounds/shotbullet/mid_2.wss new file mode 100644 index 0000000000..1e184cc1ef Binary files /dev/null and b/addons/cookoff/sounds/shotbullet/mid_2.wss differ diff --git a/addons/cookoff/sounds/shotbullet/mid_3.wss b/addons/cookoff/sounds/shotbullet/mid_3.wss new file mode 100644 index 0000000000..10606bf138 Binary files /dev/null and b/addons/cookoff/sounds/shotbullet/mid_3.wss differ diff --git a/addons/cookoff/sounds/shotrocket/close_1.wss b/addons/cookoff/sounds/shotrocket/close_1.wss new file mode 100644 index 0000000000..31ff1cbe38 Binary files /dev/null and b/addons/cookoff/sounds/shotrocket/close_1.wss differ diff --git a/addons/cookoff/sounds/shotrocket/close_2.wss b/addons/cookoff/sounds/shotrocket/close_2.wss new file mode 100644 index 0000000000..8ef09dcf04 Binary files /dev/null and b/addons/cookoff/sounds/shotrocket/close_2.wss differ diff --git a/addons/cookoff/sounds/shotrocket/close_3.wss b/addons/cookoff/sounds/shotrocket/close_3.wss new file mode 100644 index 0000000000..5410c359e4 Binary files /dev/null and b/addons/cookoff/sounds/shotrocket/close_3.wss differ diff --git a/addons/cookoff/sounds/shotrocket/far_1.wss b/addons/cookoff/sounds/shotrocket/far_1.wss new file mode 100644 index 0000000000..e71990476b Binary files /dev/null and b/addons/cookoff/sounds/shotrocket/far_1.wss differ diff --git a/addons/cookoff/sounds/shotrocket/far_2.wss b/addons/cookoff/sounds/shotrocket/far_2.wss new file mode 100644 index 0000000000..bae24fa78e Binary files /dev/null and b/addons/cookoff/sounds/shotrocket/far_2.wss differ diff --git a/addons/cookoff/sounds/shotrocket/far_3.wss b/addons/cookoff/sounds/shotrocket/far_3.wss new file mode 100644 index 0000000000..093e841277 Binary files /dev/null and b/addons/cookoff/sounds/shotrocket/far_3.wss differ diff --git a/addons/cookoff/sounds/shotrocket/mid_1.wss b/addons/cookoff/sounds/shotrocket/mid_1.wss new file mode 100644 index 0000000000..f927d7f174 Binary files /dev/null and b/addons/cookoff/sounds/shotrocket/mid_1.wss differ diff --git a/addons/cookoff/sounds/shotrocket/mid_2.wss b/addons/cookoff/sounds/shotrocket/mid_2.wss new file mode 100644 index 0000000000..785dd5b603 Binary files /dev/null and b/addons/cookoff/sounds/shotrocket/mid_2.wss differ diff --git a/addons/cookoff/sounds/shotrocket/mid_3.wss b/addons/cookoff/sounds/shotrocket/mid_3.wss new file mode 100644 index 0000000000..7fb384421d Binary files /dev/null and b/addons/cookoff/sounds/shotrocket/mid_3.wss differ diff --git a/addons/cookoff/sounds/shotshell/close_1.wss b/addons/cookoff/sounds/shotshell/close_1.wss new file mode 100644 index 0000000000..aa9a0bc718 Binary files /dev/null and b/addons/cookoff/sounds/shotshell/close_1.wss differ diff --git a/addons/cookoff/sounds/shotshell/close_2.wss b/addons/cookoff/sounds/shotshell/close_2.wss new file mode 100644 index 0000000000..355d061d01 Binary files /dev/null and b/addons/cookoff/sounds/shotshell/close_2.wss differ diff --git a/addons/cookoff/sounds/shotshell/close_3.wss b/addons/cookoff/sounds/shotshell/close_3.wss new file mode 100644 index 0000000000..3847fa870f Binary files /dev/null and b/addons/cookoff/sounds/shotshell/close_3.wss differ diff --git a/addons/cookoff/sounds/shotshell/far_1.wss b/addons/cookoff/sounds/shotshell/far_1.wss new file mode 100644 index 0000000000..262b037c12 Binary files /dev/null and b/addons/cookoff/sounds/shotshell/far_1.wss differ diff --git a/addons/cookoff/sounds/shotshell/far_2.wss b/addons/cookoff/sounds/shotshell/far_2.wss new file mode 100644 index 0000000000..38e0e1eb81 Binary files /dev/null and b/addons/cookoff/sounds/shotshell/far_2.wss differ diff --git a/addons/cookoff/sounds/shotshell/far_3.wss b/addons/cookoff/sounds/shotshell/far_3.wss new file mode 100644 index 0000000000..781f86e4b8 Binary files /dev/null and b/addons/cookoff/sounds/shotshell/far_3.wss differ diff --git a/addons/cookoff/sounds/shotshell/mid_1.wss b/addons/cookoff/sounds/shotshell/mid_1.wss new file mode 100644 index 0000000000..76c68cdee1 Binary files /dev/null and b/addons/cookoff/sounds/shotshell/mid_1.wss differ diff --git a/addons/cookoff/sounds/shotshell/mid_2.wss b/addons/cookoff/sounds/shotshell/mid_2.wss new file mode 100644 index 0000000000..f84b579bc4 Binary files /dev/null and b/addons/cookoff/sounds/shotshell/mid_2.wss differ diff --git a/addons/cookoff/sounds/shotshell/mid_3.wss b/addons/cookoff/sounds/shotshell/mid_3.wss new file mode 100644 index 0000000000..990a583a04 Binary files /dev/null and b/addons/cookoff/sounds/shotshell/mid_3.wss differ diff --git a/addons/csw/CfgVehicles.hpp b/addons/csw/CfgVehicles.hpp index dd5537f645..424289c077 100644 --- a/addons/csw/CfgVehicles.hpp +++ b/addons/csw/CfgVehicles.hpp @@ -4,7 +4,7 @@ class CfgVehicles { class ACE_SelfActions { class GVAR(deploy) { displayName = CSTRING(PlaceTripod_displayName); - condition = QUOTE(call FUNC(assemble_canDeployTripod)); + condition = QUOTE(call FUNC(canDeployTripod)); statement = QUOTE(call FUNC(assemble_deployTripod)); exceptions[] = {}; }; @@ -36,7 +36,7 @@ class CfgVehicles { condition = "true"; class GVAR(pickUp) { displayName = CSTRING(Pickup_displayName); - condition = QUOTE(call FUNC(assemble_canPickupTripod)); + condition = QUOTE(call FUNC(canPickupTripod)); statement = QUOTE(call FUNC(assemble_pickupTripod)); }; class GVAR(mountWeapon) { @@ -125,10 +125,11 @@ class CfgVehicles { class StaticWeapon: LandVehicle { class ACE_Actions { class ACE_MainActions { + // Workaround for static weapons' Get In memory point being at the front of the gun class GVAR(getIn) { displayName = CSTRING(GetIn_displayName); condition = QUOTE(call FUNC(canGetIn)); - statement = QUOTE(call FUNC(getIn)); + statement = QUOTE(_player moveInTurret [ARR_2(_target,[0])]); }; }; }; diff --git a/addons/csw/XEH_PREP.hpp b/addons/csw/XEH_PREP.hpp index 5966578aca..fed4120c86 100644 --- a/addons/csw/XEH_PREP.hpp +++ b/addons/csw/XEH_PREP.hpp @@ -6,9 +6,9 @@ PREP(ai_handleFired); PREP(ai_handleGetIn); PREP(ai_reload); -PREP(assemble_canDeployTripod); +PREP(canDeployTripod); PREP(assemble_canDeployWeapon); -PREP(assemble_canPickupTripod); +PREP(canPickupTripod); PREP(assemble_canPickupWeapon); PREP(assemble_deployTripod); PREP(assemble_deployWeapon); @@ -17,13 +17,12 @@ PREP(assemble_pickupTripod); PREP(assemble_pickupWeapon); PREP(canGetIn); -PREP(getIn); PREP(getCarryMagazine); PREP(proxyWeapon); -PREP(reload_actionsLoad); -PREP(reload_actionsUnload); +PREP(getLoadActions); +PREP(getUnloadActions); PREP(reload_canLoadMagazine); PREP(reload_canUnloadMagazine); PREP(reload_getLoadableMagazines); @@ -33,5 +32,5 @@ PREP(reload_handleRemoveTurretMag); PREP(reload_handleReturnAmmo); PREP(reload_loadMagazine); -PREP(staticWeaponInit); +PREP(initVehicle); PREP(staticWeaponInit_unloadExtraMags); diff --git a/addons/csw/XEH_postInit.sqf b/addons/csw/XEH_postInit.sqf index 8a0f92ce47..87196f3377 100644 --- a/addons/csw/XEH_postInit.sqf +++ b/addons/csw/XEH_postInit.sqf @@ -6,18 +6,27 @@ GVAR(vehicleMagCache) = createHashMap; TRACE_3("settingsInit",GVAR(defaultAssemblyMode),GVAR(handleExtraMagazines),GVAR(ammoHandling)); ["StaticWeapon", "Init", { // needs a small delay for network syncing, or we end up with duplicate mags with ammo handling - [LINKFUNC(staticWeaponInit), _this, 1] call CBA_fnc_waitAndExecute; + [LINKFUNC(initVehicle), _this, 1] call CBA_fnc_waitAndExecute; }, true, [], true] call CBA_fnc_addClassEventHandler; + + GVAR(quickmountEnabled) = ( + missionNamespace getVariable [QEGVAR(quickmount,enabled), false] && + {(missionNamespace getVariable [QEGVAR(quickmount,enableMenu), -1]) in [1,3]} + ); }] call CBA_fnc_addEventHandler; +["CBA_SettingChanged", { + GVAR(quickmountEnabled) = ( + missionNamespace getVariable [QEGVAR(quickmount,enabled), false] && + {(missionNamespace getVariable [QEGVAR(quickmount,enableMenu), -1]) in [1,3]} + ); +}] call CBA_fnc_addEventHandler; // Event handlers: [QGVAR(addTurretMag), LINKFUNC(reload_handleAddTurretMag)] call CBA_fnc_addEventHandler; [QGVAR(removeTurretMag), LINKFUNC(reload_handleRemoveTurretMag)] call CBA_fnc_addEventHandler; [QGVAR(returnAmmo), LINKFUNC(reload_handleReturnAmmo)] call CBA_fnc_addEventHandler; - - #ifdef DEBUG_MODE_FULL call compile preprocessFileLineNumbers QPATHTOF(dev\checkStaticWeapons.sqf); #endif diff --git a/addons/csw/dev/checkStaticWeapons.sqf b/addons/csw/dev/checkStaticWeapons.sqf index 59e712cb70..7d9917daa7 100644 --- a/addons/csw/dev/checkStaticWeapons.sqf +++ b/addons/csw/dev/checkStaticWeapons.sqf @@ -7,14 +7,14 @@ INFO("Checking static weapons"); private _staticWeaponConfigs = configProperties [configFile >> "CfgVehicles", "(isClass _x) && {(configName _x) isKindOf 'StaticWeapon'}", true]; private _staticPublic = _staticWeaponConfigs select {(getNumber (_x >> "scope")) == 2}; -INFO_2("Static Weapons [%1] - CSW Enabled [%2]",count _staticPublic, {(getNumber (_x >> "ace_csw" >> "enabled")) == 1} count _staticPublic); +INFO_2("Static Weapons [%1] - CSW Enabled [%2]",count _staticPublic,{(getNumber (_x >> QUOTE(ADDON) >> "enabled")) == 1} count _staticPublic); INFO("------ Checking static weapons inheritance ------"); private _explicitBases = []; private _inherited = []; { private _config = _x; - private _configEnabled = (getNumber (_config >> "ace_csw" >> "enabled")) == 1; + private _configEnabled = (getNumber (_config >> QUOTE(ADDON) >> "enabled")) == 1; if (_configEnabled) then { private _configExplicit = (count configProperties [_config, "configName _x == 'ace_csw'", false]) == 1; if (_configExplicit) then { @@ -69,7 +69,7 @@ private _logAll = false; { //IGNORE_PRIVATE_WARNING ["_x", "_y"]; - INFO_2("[%1] has no carry varient - Used in %2",_x,_y); + INFO_2("[%1] has no carry variant - Used in %2",_x,_y); } forEach _hash; INFO("------ End -------"); diff --git a/addons/csw/functions/fnc_ai_handleFired.sqf b/addons/csw/functions/fnc_ai_handleFired.sqf index e6d76f13dc..d92e517091 100644 --- a/addons/csw/functions/fnc_ai_handleFired.sqf +++ b/addons/csw/functions/fnc_ai_handleFired.sqf @@ -12,12 +12,12 @@ * Public: No */ -params ["_staticWeapon", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; -TRACE_8("firedEH:",_staticWeapon,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile,_gunner); +params ["_vehicle", "_weapon", "", "", "", "_magazine", "", "_gunner"]; +TRACE_4("firedEH:",_vehicle,_weapon,_magazine,_gunner); +if (someAmmo _vehicle) exitWith {}; if ((!local _gunner) || {[_gunner] call EFUNC(common,isPlayer)}) exitWith {}; -if (someAmmo _staticWeapon) exitWith {}; -TRACE_2("need ammo",someAmmo _staticWeapon,magazinesAllTurrets _staticWeapon); +TRACE_1("need ammo",magazinesAllTurrets _vehicle); -[_staticWeapon, _gunner, _weapon, _magazine] call FUNC(ai_reload); +[_vehicle, _gunner, _weapon, _magazine] call FUNC(ai_reload); diff --git a/addons/csw/functions/fnc_ai_handleGetIn.sqf b/addons/csw/functions/fnc_ai_handleGetIn.sqf index 26a94b58e3..f14a4ccbc7 100644 --- a/addons/csw/functions/fnc_ai_handleGetIn.sqf +++ b/addons/csw/functions/fnc_ai_handleGetIn.sqf @@ -11,12 +11,13 @@ * * Public: No */ -params ["_staticWeapon", "_role", "_gunner"]; -TRACE_3("getInEH:",_staticWeapon,_role,_gunner); +params ["_vehicle", "", "_gunner"]; +TRACE_2("getInEH:",_vehicle,_gunner); + +if (someAmmo _vehicle) exitWith {}; if ((!local _gunner) || {[_gunner] call EFUNC(common,isPlayer)}) exitWith {}; -if (someAmmo _staticWeapon) exitWith {}; -TRACE_2("need ammo",someAmmo _staticWeapon,magazinesAllTurrets _staticWeapon); +TRACE_1("need ammo",magazinesAllTurrets _vehicle); -[_staticWeapon, _gunner, currentWeapon _staticWeapon] call FUNC(ai_reload); +[_vehicle, _gunner, currentWeapon _vehicle] call FUNC(ai_reload); diff --git a/addons/csw/functions/fnc_ai_reload.sqf b/addons/csw/functions/fnc_ai_reload.sqf index 31d41b0588..d472233bcf 100644 --- a/addons/csw/functions/fnc_ai_reload.sqf +++ b/addons/csw/functions/fnc_ai_reload.sqf @@ -14,6 +14,7 @@ * * Public: No */ + params ["_staticWeapon", "_gunner", "_weapon", ["_magazine", ""]]; private _turretPath = [_gunner] call EFUNC(common,getTurretIndex); diff --git a/addons/csw/functions/fnc_assemble_canDeployTripod.sqf b/addons/csw/functions/fnc_assemble_canDeployTripod.sqf deleted file mode 100644 index 82412b5556..0000000000 --- a/addons/csw/functions/fnc_assemble_canDeployTripod.sqf +++ /dev/null @@ -1,21 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author:tcvm - * Checks if the player can deploy the tripod. - * - * Arguments: - * 0: Unit - * - * Return Value: - * Can deploy - * - * Example: - * [player] call ace_csw_fnc_assemble_canDeployTripod - * - * Public: No - */ - -params ["_player"]; - -(getText(configFile >> "CfgWeapons" >> (secondaryWeapon _player) >> QUOTE(ADDON) >> "type") == "mount") - diff --git a/addons/csw/functions/fnc_assemble_canDeployWeapon.sqf b/addons/csw/functions/fnc_assemble_canDeployWeapon.sqf index 897ee6acd0..57f2ce2bc8 100644 --- a/addons/csw/functions/fnc_assemble_canDeployWeapon.sqf +++ b/addons/csw/functions/fnc_assemble_canDeployWeapon.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author:tcvm + * Author: tcvm * Checks if you can deploy a weapon on the tripod * * Arguments: @@ -22,4 +22,3 @@ if (isNil "_carryWeaponClassname") then { _carryWeaponClassname = secondaryWeapo // If the current launcher has a config-value that defines the tripod, it is a CSW (alive _target) && {(getText(configFile >> "CfgWeapons" >> _carryWeaponClassname >> QUOTE(ADDON) >> "assembleTo" >> (typeOf _target))) != ""} - diff --git a/addons/csw/functions/fnc_assemble_canPickupTripod.sqf b/addons/csw/functions/fnc_assemble_canPickupTripod.sqf deleted file mode 100644 index 8a7656db83..0000000000 --- a/addons/csw/functions/fnc_assemble_canPickupTripod.sqf +++ /dev/null @@ -1,22 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author:tcvm - * Checks if the player can pick-up the tripod. - * - * Arguments: - * 0: Tripod - * 1: Unit - * - * Return Value: - * Can pickup - * - * Example: - * [tripod, player] call ace_csw_fnc_assemble_canPickupTripod - * - * Public: No - */ - -params ["_tripod", "_player"]; - -((secondaryWeapon _player) isEqualTo "") && {alive _tripod} - diff --git a/addons/csw/functions/fnc_assemble_canPickupWeapon.sqf b/addons/csw/functions/fnc_assemble_canPickupWeapon.sqf index 9665311d9d..40c6b527d3 100644 --- a/addons/csw/functions/fnc_assemble_canPickupWeapon.sqf +++ b/addons/csw/functions/fnc_assemble_canPickupWeapon.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author:tcvm + * Author: tcvm * If the CSW is mounted or in use this will not allow you to dismount the weapon * * Arguments: @@ -23,4 +23,3 @@ private _notCrewed = (crew _staticWeapon) isEqualTo []; private _deadCrew = !(alive (gunner _staticWeapon)); // need to eject body??? _assemblyMode && {_notCrewed || _deadCrew} - diff --git a/addons/csw/functions/fnc_assemble_deployTripod.sqf b/addons/csw/functions/fnc_assemble_deployTripod.sqf index d3317a4e40..9c2f3ef725 100644 --- a/addons/csw/functions/fnc_assemble_deployTripod.sqf +++ b/addons/csw/functions/fnc_assemble_deployTripod.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author:tcvm + * Author: tcvm * Deploys the tripod * * Arguments: @@ -40,7 +40,7 @@ _cswTripod setVariable [QGVAR(secondaryWeaponMagazine), _secondaryWeaponMagazine]; }; if (!GVAR(defaultAssemblyMode)) then { - [_cswTripod, "disableWeaponAssembly", "ace_csw", true] call EFUNC(common,statusEffect_set); + [_cswTripod, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); }; private _posATL = _player getRelPos [2, 0]; diff --git a/addons/csw/functions/fnc_assemble_deployWeapon.sqf b/addons/csw/functions/fnc_assemble_deployWeapon.sqf index e34e5d19d8..772cad65d4 100644 --- a/addons/csw/functions/fnc_assemble_deployWeapon.sqf +++ b/addons/csw/functions/fnc_assemble_deployWeapon.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author:tcvm + * Author: tcvm * Deploys the current CSW * * Arguments: diff --git a/addons/csw/functions/fnc_assemble_pickupTripod.sqf b/addons/csw/functions/fnc_assemble_pickupTripod.sqf index 449a445dc2..d85f9a3f83 100644 --- a/addons/csw/functions/fnc_assemble_pickupTripod.sqf +++ b/addons/csw/functions/fnc_assemble_pickupTripod.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author:tcvm + * Author: tcvm * Picks up the tripod and adds it to the player launcher slot * * Arguments: @@ -44,4 +44,3 @@ TRACE_3("",_pickupTime,typeOf _tripod,_tripodClassname); [TIME_PROGRESSBAR(_pickupTime), [_tripod, _player, _tripodClassname], _onFinish, {}, localize LSTRING(PickupTripod_progressBar), _condition] call EFUNC(common,progressBar); }, _this] call CBA_fnc_execNextFrame; - diff --git a/addons/csw/functions/fnc_assemble_pickupWeapon.sqf b/addons/csw/functions/fnc_assemble_pickupWeapon.sqf index 99d0229566..440fd31cc0 100644 --- a/addons/csw/functions/fnc_assemble_pickupWeapon.sqf +++ b/addons/csw/functions/fnc_assemble_pickupWeapon.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author:tcvm + * Author: tcvm * Dismounts the weapon from the tripod and drops its backpack beside * * Arguments: diff --git a/addons/csw/functions/fnc_canDeployTripod.sqf b/addons/csw/functions/fnc_canDeployTripod.sqf new file mode 100644 index 0000000000..8969758e4d --- /dev/null +++ b/addons/csw/functions/fnc_canDeployTripod.sqf @@ -0,0 +1,22 @@ +#include "..\script_component.hpp" +/* + * Author: tcvm + * Checks if the unit can deploy a tripod + * + * Arguments: + * 0: Unit + * + * Return Value: + * Can deploy + * + * Example: + * player call ace_csw_fnc_canDeployTripod + * + * Public: No + */ + +params ["_unit"]; + +private _secondaryWeapon = secondaryWeapon _unit; + +_secondaryWeapon != "" && {getText (configFile >> "CfgWeapons" >> _secondaryWeapon >> QUOTE(ADDON) >> "type") == "mount"} // return diff --git a/addons/csw/functions/fnc_canGetIn.sqf b/addons/csw/functions/fnc_canGetIn.sqf index 16ffe29a77..16446c4fb2 100644 --- a/addons/csw/functions/fnc_canGetIn.sqf +++ b/addons/csw/functions/fnc_canGetIn.sqf @@ -1,28 +1,23 @@ #include "..\script_component.hpp" /* - * Author:tcvm - * Checks if the player can get in the weapon + * Author: tcvm + * Checks if it's possible to get in the CSW * * Arguments: - * 0: Static Weapon + * 0: Vehicle * * Return Value: * None * * Example: - * [cursorObject] call ace_csw_fnc_canGetIn + * cursorObject call ace_csw_fnc_canGetIn * * Public: No */ -// hide this action if quick mount is enabled -if ((missionNamespace getVariable [QEGVAR(quickmount,enabled), false]) && {(missionNamespace getVariable [QEGVAR(quickmount,enableMenu), -1]) in [1, 3]}) exitWith { - false -}; +// Hide this action if quick mount is enabled +if (GVAR(quickmountEnabled)) exitWith {false}; -params ["_staticWeapon"]; +params ["_vehicle"]; -alive _staticWeapon -&& {!(alive (gunner _staticWeapon))} -&& {(locked _staticWeapon) < 2} -&& {0.3 < ((vectorUp _staticWeapon) select 2)} +alive _vehicle && {!(alive (gunner _vehicle))} && {(locked _vehicle) < 2} && {!(_vehicle lockedTurret [0])} && {0.3 < ((vectorUp _vehicle) select 2)} // return diff --git a/addons/csw/functions/fnc_canPickupTripod.sqf b/addons/csw/functions/fnc_canPickupTripod.sqf new file mode 100644 index 0000000000..0a9f0f5f90 --- /dev/null +++ b/addons/csw/functions/fnc_canPickupTripod.sqf @@ -0,0 +1,21 @@ +#include "..\script_component.hpp" +/* + * Author: tcvm + * Checks if the unit can pickup the tripod + * + * Arguments: + * 0: Tripod + * 1: Unit + * + * Return Value: + * Can pickup + * + * Example: + * [cursorObject, player] call ace_csw_fnc_canPickupTripod + * + * Public: No + */ + +params ["_tripod", "_unit"]; + +((secondaryWeapon _unit) == "") && {alive _tripod} // return diff --git a/addons/csw/functions/fnc_getIn.sqf b/addons/csw/functions/fnc_getIn.sqf deleted file mode 100644 index 61ca962d06..0000000000 --- a/addons/csw/functions/fnc_getIn.sqf +++ /dev/null @@ -1,24 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author:tcvm - * An action for the player to get in the CSW - * Due to the fact that the default static weapons "Get In" memory point is at the front of - * the gun and can't be acssesed from the back, I am implementing this to get around that issue. - * - * Arguments: - * 0: Static Weapon - * 1: Unit - * - * Return Value: - * None - * - * Example: - * [cursorObject, player] call ace_csw_fnc_getIn - * - * Public: No - */ - -params ["_staticWeapon", "_player"]; -TRACE_2("getIn",_staticWeapon,_player); - -_player moveInTurret [_staticWeapon, [0]]; diff --git a/addons/csw/functions/fnc_reload_actionsLoad.sqf b/addons/csw/functions/fnc_getLoadActions.sqf similarity index 68% rename from addons/csw/functions/fnc_reload_actionsLoad.sqf rename to addons/csw/functions/fnc_getLoadActions.sqf index 557811d440..456362a3b6 100644 --- a/addons/csw/functions/fnc_reload_actionsLoad.sqf +++ b/addons/csw/functions/fnc_getLoadActions.sqf @@ -1,42 +1,42 @@ #include "..\script_component.hpp" /* * Author: PabstMirror - * Gets sub actions for what the player can load into the static weapon + * Gets sub actions for what the unit can load into the CSW * * Arguments: - * 0: Static Weapon - * 1: Player + * 0: Vehicle + * 1: Unit * * Return Value: * Actions * * Example: - * [cursorObject, player] call ace_csw_fnc_reload_actionsLoad + * [cursorObject, player] call ace_csw_fnc_getLoadActions * * Public: No */ -params ["_vehicle", "_player"]; +params ["_vehicle", "_unit"]; -private _actions = []; -private _loadableMagazines = [_vehicle, _player] call FUNC(reload_getLoadableMagazines); +private _loadableMagazines = [_vehicle, _unit] call FUNC(reload_getLoadableMagazines); +if (_loadableMagazines isEqualTo []) exitWith {[]}; private _statement = { - params ["_target", "_player", "_params"]; - _params params ["_carryMag", "_turretPath", "", "_magSource"]; + params ["_target", "_player", "_args"]; + _args params ["_carryMag", "_turretPath", "", "_magSource"]; [_target, _turretPath, _carryMag, _magSource, _player] call FUNC(reload_loadMagazine); }; private _condition = { - params ["_target", "_player", "_params"]; - _params params ["_carryMag", "_turretPath", "", "_magSource"]; + params ["_target", "_player", "_args"]; + _args params ["_carryMag", "_turretPath", "", "_magSource"]; ([_target, _turretPath, _carryMag, _magSource] call FUNC(reload_canLoadMagazine)) select 0 }; private _cfgMagazines = configFile >> "CfgMagazines"; // micro-optimization - +private _actions = []; { _x params ["_carryMag", "", "_loadInfo"]; _loadInfo params ["", "", "", "_isBeltLinking"]; diff --git a/addons/csw/functions/fnc_getUnloadActions.sqf b/addons/csw/functions/fnc_getUnloadActions.sqf new file mode 100644 index 0000000000..32d9cc091a --- /dev/null +++ b/addons/csw/functions/fnc_getUnloadActions.sqf @@ -0,0 +1,74 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror + * Gets sub actions for what can be unloaded from the CSW + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * Actions + * + * Example: + * cursorObject call ace_csw_fnc_getUnloadActions + * + * Public: No + */ + +params ["_vehicle"]; + +private _statement = { + params ["_target", "_player", "_args"]; + _args params ["_vehMag", "_turretPath", "_carryMag"]; + TRACE_5("starting unload",_target,_turretPath,_player,_carryMag,_vehMag); + + private _timeToUnload = 1; + if (!isNull (configOf _target >> QUOTE(ADDON) >> "ammoUnloadTime")) then { + _timeToUnload = getNumber (configOf _target >> QUOTE(ADDON) >> "ammoUnloadTime"); + }; + + [ + TIME_PROGRESSBAR(_timeToUnload), + [_target, _turretPath, _player, _carryMag, _vehMag], + { + (_this select 0) params ["_target", "_turretPath", "", "_carryMag", "_vehMag"]; + TRACE_5("unload progressBar finish",_target,_turretPath,_carryMag,_vehMag,_player); + [QGVAR(removeTurretMag), [_target, _turretPath, _carryMag, _vehMag, _player]] call CBA_fnc_globalEvent; + }, + {TRACE_1("unload progressBar fail",_this);}, + format [localize LSTRING(unloadX), getText (configFile >> "CfgMagazines" >> _carryMag >> "displayName")], + {(_this select 0) call FUNC(reload_canUnloadMagazine)}, + ["isNotInside"] + ] call EFUNC(common,progressBar); +}; + +private _condition = { + params ["_target", "_player", "_args"]; + _args params ["_vehMag", "_turretPath", "_carryMag"]; + [_target, _turretPath, _player, _carryMag, _vehMag] call FUNC(reload_canUnloadMagazine) +}; + +private _actions = []; +private _handledMagTypes = []; + +private _cfgMagazines = configFile >> "CfgMagazines"; + +// Go through magazines on static weapon and check if any are unloadable +{ + _x params ["_xMag", "_xTurret", "_xAmmo"]; + + if ((_xAmmo > 0) && {!(_xMag in _handledMagTypes)}) then { + _handledMagTypes pushBack _xMag; + private _carryMag = _xMag call FUNC(getCarryMagazine); + if (_carryMag == "") exitWith {}; + + private _displayName = getText (_cfgMagazines >> _carryMag >> "displayName"); + private _text = format [LLSTRING(unloadX), _displayName]; + private _picture = getText (_cfgMagazines >> _carryMag >> "picture"); + private _action = [format ["unload_%1", _forEachIndex], _text, _picture, _statement, _condition, {}, [_xMag, _xTurret, _carryMag]] call EFUNC(interact_menu,createAction); + _actions pushBack [_action, [], _vehicle]; + }; +} forEach (magazinesAllTurrets _vehicle); + +TRACE_1("unloadActions",count _actions); +_actions diff --git a/addons/csw/functions/fnc_staticWeaponInit.sqf b/addons/csw/functions/fnc_initVehicle.sqf similarity index 60% rename from addons/csw/functions/fnc_staticWeaponInit.sqf rename to addons/csw/functions/fnc_initVehicle.sqf index 6dcbbf52e6..ed882e435c 100644 --- a/addons/csw/functions/fnc_staticWeaponInit.sqf +++ b/addons/csw/functions/fnc_initVehicle.sqf @@ -1,59 +1,63 @@ #include "..\script_component.hpp" /* * Author: tcvm - * Initializes weapon to disable weapon disassembling + * Initializes CSW systems on vehicle * * Arguments: - * 0: Weapon + * 0: Vehicle * * Return Value: * None * * Example: - * [weapon] call ace_csw_fnc_staticWeaponInit + * cursorObject call ace_csw_fnc_initVehicle * * Public: No */ -params ["_staticWeapon"]; -if (isNull _staticWeapon) exitWith { WARNING_1("%1 became null",_staticWeapon) }; -private _typeOf = typeOf _staticWeapon; -private _configOf = configOf _staticWeapon; -private _configEnabled = (getNumber (_configOf >> "ace_csw" >> "enabled")) == 1; -private _assemblyConfig = _configEnabled && {(getText (_configOf >> "ace_csw" >> "disassembleWeapon")) != ""}; -TRACE_4("staticWeaponInit",_staticWeapon,_typeOf,_configEnabled,_assemblyConfig); - -if (_configEnabled && {GVAR(ammoHandling) == 2}) then { - TRACE_1("adding AI fired handler",_staticWeapon); - _staticWeapon addEventHandler ["Fired", LINKFUNC(ai_handleFired)]; - _staticWeapon addEventHandler ["GetIn", LINKFUNC(ai_handleGetIn)]; // handle AI getting inside weapon with no ammo +params ["_vehicle"]; +if (!alive _vehicle) exitWith { WARNING_1("%1 not alive",_vehicle); }; +if (!simulationEnabled _vehicle) exitWith { + [{simulationEnabled _this}, FUNC(initVehicle), _vehicle] call CBA_fnc_waitUntilAndExecute; }; -TRACE_2("",local _staticWeapon,_staticWeapon turretLocal [0]); -if (_configEnabled && {_staticWeapon turretLocal [0]}) then { // if turret is local to us, then handle mags/weapon +private _typeOf = typeOf _vehicle; +private _configOf = configOf _vehicle; +private _configEnabled = (getNumber (_configOf >> QUOTE(ADDON) >> "enabled")) == 1; +private _assemblyConfig = _configEnabled && {(getText (_configOf >> QUOTE(ADDON) >> "disassembleWeapon")) != ""}; +TRACE_4("initVehicle",_vehicle,_typeOf,_configEnabled,_assemblyConfig); + +if (_configEnabled && {GVAR(ammoHandling) == 2}) then { + TRACE_1("adding AI fired handler",_vehicle); + _vehicle addEventHandler ["Fired", LINKFUNC(ai_handleFired)]; + _vehicle addEventHandler ["GetIn", LINKFUNC(ai_handleGetIn)]; // handle AI getting inside weapon with no ammo +}; + +TRACE_2("",local _vehicle,_vehicle turretLocal [0]); +if (_configEnabled && {_vehicle turretLocal [0]}) then { // if turret is local to us, then handle mags/weapon [{ - params ["_staticWeapon"]; - if (!alive _staticWeapon) exitWith { TRACE_1("dead/deleted",_staticWeapon); }; + params ["_vehicle"]; + if (!alive _vehicle) exitWith { TRACE_1("dead/deleted",_vehicle); }; // Assembly mode: [0=disabled, 1=enabled, 2=enabled&unload, 3=default] - private _assemblyModeIndex = _staticWeapon getVariable [QGVAR(assemblyMode), 3]; + private _assemblyModeIndex = _vehicle getVariable [QGVAR(assemblyMode), 3]; private _emptyWeapon = _assemblyModeIndex isEqualTo 2; private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select _assemblyModeIndex; - TRACE_2("turretLocal",_staticWeapon,_assemblyMode); - [_staticWeapon, [0], _assemblyMode, _emptyWeapon] call FUNC(proxyWeapon); - [_staticWeapon, _assemblyMode, _emptyWeapon] call FUNC(staticWeaponInit_unloadExtraMags); - }, [_staticWeapon]] call CBA_fnc_execNextFrame; // need to wait a frame to allow setting object vars during assembly + TRACE_2("turretLocal",_vehicle,_assemblyMode); + [_vehicle, [0], _assemblyMode, _emptyWeapon] call FUNC(proxyWeapon); + [_vehicle, _assemblyMode, _emptyWeapon] call FUNC(staticWeaponInit_unloadExtraMags); + }, [_vehicle]] call CBA_fnc_execNextFrame; // need to wait a frame to allow setting object vars during assembly }; if (_assemblyConfig) then { [{ - params ["_staticWeapon"]; - if (!alive _staticWeapon) exitWith { TRACE_1("dead/deleted",_staticWeapon); }; - private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select (_staticWeapon getVariable [QGVAR(assemblyMode), 3]); - TRACE_2("assemblyConfig present",_staticWeapon,_assemblyMode); + params ["_vehicle"]; + if (!alive _vehicle) exitWith { TRACE_1("dead/deleted",_vehicle); }; + private _assemblyMode = [false, true, true, GVAR(defaultAssemblyMode)] select (_vehicle getVariable [QGVAR(assemblyMode), 3]); + TRACE_2("assemblyConfig present",_vehicle,_assemblyMode); if (_assemblyMode) then { // Disable vanilla assembly if assemblyMode enabled - [_staticWeapon, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); + [_vehicle, "disableWeaponAssembly", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); }; - }, [_staticWeapon]] call CBA_fnc_execNextFrame; // need to wait a frame to allow setting object vars during assembly + }, [_vehicle]] call CBA_fnc_execNextFrame; // need to wait a frame to allow setting object vars during assembly }; // Add interactions for players @@ -76,7 +80,7 @@ if (hasInterface && {!(_typeOf in GVAR(initializedStaticTypes))}) then { }; private _childenCode = { BEGIN_COUNTER(getActions); // can remove for final release - private _ret = (call FUNC(reload_actionsLoad)) + (call FUNC(reload_actionsUnload)); + private _ret = (call FUNC(getLoadActions)) + (call FUNC(getUnloadActions)); END_COUNTER(getActions); _ret }; diff --git a/addons/csw/functions/fnc_proxyWeapon.sqf b/addons/csw/functions/fnc_proxyWeapon.sqf index 40ab4b1e4c..fedd1d412b 100644 --- a/addons/csw/functions/fnc_proxyWeapon.sqf +++ b/addons/csw/functions/fnc_proxyWeapon.sqf @@ -1,10 +1,10 @@ #include "..\script_component.hpp" /* * Author: tcvm, PabstMirror - * Handles the use of proxy weapons to fix engine-reload times + * Handles the use of proxy weapons to bypass engine reload times * * Arguments: - * 0: Weapon + * 0: Vehicle * 1: Turret * 2: Proxy weapon needed * 2: Weapon should be emptied @@ -13,34 +13,34 @@ * None * * Example: - * [weapon, [0], true, false] call ace_csw_fnc_proxyWeapon + * [cursorObject, [0], true, false] call ace_csw_fnc_proxyWeapon * * Public: No */ -params ["_staticWeapon", "_turret", "_needed", "_emptyWeapon"]; -TRACE_4("proxyWeapon",_staticWeapon,_turret,_needed,_emptyWeapon); +params ["_vehicle", "_turret", "_needed", "_emptyWeapon"]; +TRACE_4("proxyWeapon",_vehicle,_turret,_needed,_emptyWeapon); -if (_staticWeapon getVariable [format [QGVAR(proxyHandled_%1), _turret], false]) exitWith { TRACE_1("already handled",typeOf _staticWeapon); }; +if (_vehicle getVariable [format [QGVAR(proxyHandled_%1), _turret], false]) exitWith { TRACE_1("already handled",typeOf _vehicle); }; -private _proxyWeapon = getText (configOf _staticWeapon >> "ace_csw" >> "proxyWeapon"); +private _proxyWeapon = getText (configOf _vehicle >> QUOTE(ADDON) >> "proxyWeapon"); -TRACE_2("",typeOf _staticWeapon,_proxyWeapon); +TRACE_2("",typeOf _vehicle,_proxyWeapon); if (_proxyWeapon == "") exitWith {}; -private _currentWeapon = (_staticWeapon weaponsTurret [0]) param [0, "#none"]; +private _currentWeapon = (_vehicle weaponsTurret [0]) param [0, "#none"]; if ((missionNamespace getVariable [_proxyWeapon, objNull]) isEqualType {}) then { // check if string is a function TRACE_1("Calling proxyWeapon function",_proxyWeapon); // This function may replace magazines or do other things to the static weapon - _proxyWeapon = [_staticWeapon, _turret, _currentWeapon, _needed, _emptyWeapon] call (missionNamespace getVariable _proxyWeapon); + _proxyWeapon = [_vehicle, _turret, _currentWeapon, _needed, _emptyWeapon] call (missionNamespace getVariable _proxyWeapon); _needed = _proxyWeapon != ""; }; if (!_needed) exitWith { TRACE_2("not needed",_needed,_proxyWeapon); }; // Rearm compatibility, prevent reloading entire static and breaking CSW -_staticWeapon setVariable [QEGVAR(rearm,scriptedLoadout), true, true]; +_vehicle setVariable [QEGVAR(rearm,scriptedLoadout), true, true]; TRACE_2("swapping to proxy weapon",_currentWeapon,_proxyWeapon); -_staticWeapon removeWeaponTurret [_currentWeapon, _turret]; -_staticWeapon addWeaponTurret [_proxyWeapon, _turret]; -_staticWeapon setVariable [format [QGVAR(proxyHandled_%1), _turret], true, true]; +_vehicle removeWeaponTurret [_currentWeapon, _turret]; +_vehicle addWeaponTurret [_proxyWeapon, _turret]; +_vehicle setVariable [format [QGVAR(proxyHandled_%1), _turret], true, true]; diff --git a/addons/csw/functions/fnc_reload_actionsUnload.sqf b/addons/csw/functions/fnc_reload_actionsUnload.sqf deleted file mode 100644 index 5ef40ace70..0000000000 --- a/addons/csw/functions/fnc_reload_actionsUnload.sqf +++ /dev/null @@ -1,75 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: PabstMirror - * Gets sub actions for what the player can unload from the static weapon - * - * Arguments: - * 0: Target - * 1: Player - * - * Return Value: - * Actions - * - * Example: - * [cursorObject, player] call ace_csw_fnc_reload_actionsUnload - * - * Public: No - */ - -params ["_vehicle", "_player"]; - -private _statement = { - params ["_target", "_player", "_params"]; - _params params ["_vehMag", "_turretPath", "_carryMag"]; - TRACE_5("starting unload",_target,_turretPath,_player,_carryMag,_vehMag); - - private _timeToUnload = 1; - if (!isNull(configOf _target >> QUOTE(ADDON) >> "ammoUnloadTime")) then { - _timeToUnload = getNumber(configOf _target >> QUOTE(ADDON) >> "ammoUnloadTime"); - }; - - [ - TIME_PROGRESSBAR(_timeToUnload), - [_target, _turretPath, _player, _carryMag, _vehMag], - { - (_this select 0) params ["_target", "_turretPath", "", "_carryMag", "_vehMag"]; - TRACE_5("unload progressBar finish",_target,_turretPath,_carryMag,_vehMag,_player); - [QGVAR(removeTurretMag), [_target, _turretPath, _carryMag, _vehMag, _player]] call CBA_fnc_globalEvent; - }, - {TRACE_1("unload progressBar fail",_this);}, - format [localize LSTRING(unloadX), getText (configFile >> "CfgMagazines" >> _carryMag >> "displayName")], - {(_this select 0) call FUNC(reload_canUnloadMagazine)}, - ["isNotInside"] - ] call EFUNC(common,progressBar); -}; - -private _condition = { - params ["_target", "_player", "_params"]; - _params params ["_vehMag", "_turretPath", "_carryMag"]; - [_target, _turretPath, _player, _carryMag, _vehMag] call FUNC(reload_canUnloadMagazine) -}; - -private _actions = []; -private _handeledMagTypes = []; - -private _cfgMagazines = configFile >> "CfgMagazines"; - -// Go through magazines on static weapon and check if any are unloadable -{ - _x params ["_xMag", "_xTurret", "_xAmmo"]; - - if ((_xAmmo > 0) && {!(_xMag in _handeledMagTypes)}) then { - _handeledMagTypes pushBack _xMag; - private _carryMag = _xMag call FUNC(getCarryMagazine); - if (_carryMag == "") exitWith {}; - - private _displayName = getText (_cfgMagazines >> _carryMag >> "displayName"); - private _text = format [LLSTRING(unloadX), _displayName]; - private _picture = getText (_cfgMagazines >> _carryMag >> "picture"); - private _action = [format ["unload_%1", _forEachIndex], _text, _picture, _statement, _condition, {}, [_xMag, _xTurret, _carryMag]] call EFUNC(interact_menu,createAction); - _actions pushBack [_action, [], _vehicle]; - }; -} forEach (magazinesAllTurrets _vehicle); - -TRACE_1("unloadActions",count _actions); -_actions diff --git a/addons/csw/functions/fnc_reload_handleAddTurretMag.sqf b/addons/csw/functions/fnc_reload_handleAddTurretMag.sqf index 9a2eae2bd4..e5aa51d342 100644 --- a/addons/csw/functions/fnc_reload_handleAddTurretMag.sqf +++ b/addons/csw/functions/fnc_reload_handleAddTurretMag.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author:tcvm, PabstMirror + * Author: tcvm, PabstMirror * Handles adding ammo to a turret * Called from a global event but only runs where turret is local * @@ -24,7 +24,7 @@ params ["_vehicle", "_turret", "_magSource", "_carryMag", "_ammoReceived", ["_returnTo", _magSource]]; TRACE_6("reload_handleAddTurretMag",_vehicle,_turret,_magSource,_carryMag,_ammoReceived,_returnTo); -TRACE_2("",local _vehicle, _vehicle turretLocal _turret); +TRACE_2("",local _vehicle,_vehicle turretLocal _turret); if (!(_vehicle turretLocal _turret)) exitWith {}; ([_vehicle, _turret, _carryMag] call FUNC(reload_canLoadMagazine)) params ["_canAdd", "_loadedMag", "_neededAmmo", "_isBeltLinking"]; @@ -43,10 +43,10 @@ if (_canAdd) then { // setMagazineTurretAmmo is broken on split locality, use setAmmo for now (this may not work for multi turret vehicles) private _weapon = (_vehicle weaponsTurret _turret) param [0, ""]; - TRACE_3("setAmmo",_vehicle,_weapon, _currentAmmo); + TRACE_3("setAmmo",_vehicle,_weapon,_currentAmmo); _vehicle setAmmo [_weapon, _currentAmmo]; private _currentAmmo = _vehicle magazineTurretAmmo [_loadedMag, _turret]; - if ((_weapon == "") || {_currentAmmo != _currentAmmo}) then { ERROR_1("failed to setAmmo - %1", _this); }; + if ((_weapon == "") || {_currentAmmo != _currentAmmo}) then { ERROR_1("failed to setAmmo - %1",_this); }; } else { if (_loadedMag != "") then { TRACE_1("Removing emtpy mag",_loadedMag); diff --git a/addons/csw/functions/fnc_reload_handleRemoveTurretMag.sqf b/addons/csw/functions/fnc_reload_handleRemoveTurretMag.sqf index d53d35a0d8..59d948ba27 100644 --- a/addons/csw/functions/fnc_reload_handleRemoveTurretMag.sqf +++ b/addons/csw/functions/fnc_reload_handleRemoveTurretMag.sqf @@ -1,6 +1,6 @@ #include "..\script_component.hpp" /* - * Author:tcvm + * Author: tcvm * Handles removing ammo from a turret * Called from a global event but only runs where turret is local * @@ -23,7 +23,7 @@ params ["_vehicle", "_turretPath", "_carryMag", "_vehMag", "_unloadTo"]; TRACE_5("removeTurretMag EH",_vehicle,_turretPath,_carryMag,_vehMag,_unloadTo); -TRACE_3("",local _vehicle, _vehicle turretLocal _turretPath,local _unloadTo); +TRACE_3("",local _vehicle,_vehicle turretLocal _turretPath,local _unloadTo); if (!(_vehicle turretLocal _turretPath)) exitWith {}; private _magsInWeapon = []; // Check how much ammo it has now: @@ -55,10 +55,10 @@ if ((_magsInWeapon isEqualTo []) && {_ammoInFirstMag > _ammoRemoved}) then { // setMagazineTurretAmmo is broken on split locality, use setAmmo for now private _weapon = (_vehicle weaponsTurret _turretPath) param [0, ""]; - TRACE_3("setAmmo",_vehicle,_weapon, _ammoLeft); + TRACE_3("setAmmo",_vehicle,_weapon,_ammoLeft); _vehicle setAmmo [_weapon, _ammoLeft]; private _currentAmmo = _vehicle magazineTurretAmmo [_vehMag, _turretPath]; - if ((_weapon == "") || {_currentAmmo != _ammoLeft}) then { ERROR_1("failed to setAmmo - %1", _this); }; + if ((_weapon == "") || {_currentAmmo != _ammoLeft}) then { ERROR_1("failed to setAmmo - %1",_this); }; } else { diff --git a/addons/csw/functions/fnc_reload_loadMagazine.sqf b/addons/csw/functions/fnc_reload_loadMagazine.sqf index 42508daf1d..9526b5adb8 100644 --- a/addons/csw/functions/fnc_reload_loadMagazine.sqf +++ b/addons/csw/functions/fnc_reload_loadMagazine.sqf @@ -51,7 +51,7 @@ private _onFinish = { [_magSource, _carryMag, _bestAmmoToSend] call EFUNC(common,removeSpecificMagazine); if (_bestAmmoToSend == 0) exitWith {}; - TRACE_6("calling addTurretMag event",_vehicle,_turret,_magSource,_carryMag,_bestAmmoToSend, _unit); + TRACE_6("calling addTurretMag event",_vehicle,_turret,_magSource,_carryMag,_bestAmmoToSend,_unit); [QGVAR(addTurretMag), [_vehicle, _turret, _magSource, _carryMag, _bestAmmoToSend, _unit]] call CBA_fnc_globalEvent; }; diff --git a/addons/dagr/functions/fnc_menuInit.sqf b/addons/dagr/functions/fnc_menuInit.sqf index 5bc757e295..fc05185638 100644 --- a/addons/dagr/functions/fnc_menuInit.sqf +++ b/addons/dagr/functions/fnc_menuInit.sqf @@ -541,7 +541,7 @@ GVAR(menuRun) = true; }; case "options": { (__dsp displayCtrl __Option0) ctrlSetText "Signal Delay"; - (__dsp displayCtrl __Option1) ctrlSetText (if (GVAR(useDegrees)) then { "Direction: Deg" } else { "Direction: MIL" }); + (__dsp displayCtrl __Option1) ctrlSetText (["Direction: MIL", "Direction: Deg"] select GVAR(useDegrees)); (__dsp displayCtrl (__Selection0 + GVAR(selection))) ctrlSetText QPATHTOF(UI\DAGR_Selection.paa); if (GVAR(SEL)) then { GVAR(vectorConnected) = false; diff --git a/addons/dagr/functions/fnc_outputData.sqf b/addons/dagr/functions/fnc_outputData.sqf index 21e19ff023..b7064ce248 100644 --- a/addons/dagr/functions/fnc_outputData.sqf +++ b/addons/dagr/functions/fnc_outputData.sqf @@ -65,10 +65,10 @@ GVAR(outputPFH) = [{ private _dagrTime = [daytime, "HH:MM"] call bis_fnc_timeToString; // Output - __gridControl ctrlSetText format ["%1", _dagrGrid]; - __speedControl ctrlSetText format ["%1", _dagrSpeed]; - __elevationControl ctrlSetText format ["%1", _dagrElevation]; - __headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1 �", _dagrHeading] }); - __timeControl ctrlSetText format ["%1", _dagrTime]; + __gridControl ctrlSetText _dagrGrid; + __speedControl ctrlSetText _dagrSpeed; + __elevationControl ctrlSetText _dagrElevation; + __headingControl ctrlSetText (if (!GVAR(useDegrees)) then { str _dagrHeading } else { format ["%1 �", _dagrHeading] }); + __timeControl ctrlSetText _dagrTime; }, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/dagr/functions/fnc_outputVector.sqf b/addons/dagr/functions/fnc_outputVector.sqf index 5eb1b9bffa..e9bd0ea6c3 100644 --- a/addons/dagr/functions/fnc_outputVector.sqf +++ b/addons/dagr/functions/fnc_outputVector.sqf @@ -89,8 +89,8 @@ private _dagrDist = str GVAR(LAZDIST) + "m"; GVAR(vectorGrid) = _dagrGrid; // OUTPUT -__gridControl ctrlSetText format ["%1", _dagrGrid]; -__speedControl ctrlSetText format ["%1", _dagrDist]; -__elevationControl ctrlSetText format ["%1", _dagrElevation]; -__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _bearing] } else { format ["%1°", _bearing] }); -__timeControl ctrlSetText format ["%1", _dagrTime]; +__gridControl ctrlSetText _dagrGrid; +__speedControl ctrlSetText _dagrDist; +__elevationControl ctrlSetText _dagrElevation; +__headingControl ctrlSetText (if (!GVAR(useDegrees)) then { str _bearing } else { format ["%1°", _bearing] }); +__timeControl ctrlSetText _dagrTime; diff --git a/addons/dagr/functions/fnc_outputWP.sqf b/addons/dagr/functions/fnc_outputWP.sqf index 2e0588ccc4..27944f0bb9 100644 --- a/addons/dagr/functions/fnc_outputWP.sqf +++ b/addons/dagr/functions/fnc_outputWP.sqf @@ -85,10 +85,10 @@ GVAR(outputPFH) = [{ }); // Output - __gridControl ctrlSetText format ["%1", _dagrGrid]; - __speedControl ctrlSetText format ["%1", _bearing]; - __elevationControl ctrlSetText format ["%1", _dagrGrid2]; - __headingControl ctrlSetText (if (!GVAR(useDegrees)) then { format ["%1", _dagrHeading] } else { format ["%1°", _dagrHeading] }); - __timeControl ctrlSetText format ["%1", _dagrDistance]; + __gridControl ctrlSetText _dagrGrid; + __speedControl ctrlSetText str _bearing; + __elevationControl ctrlSetText _dagrGrid2; + __headingControl ctrlSetText (if (!GVAR(useDegrees)) then { str _dagrHeading } else { format ["%1°", _dagrHeading] }); + __timeControl ctrlSetText _dagrDistance; }, GVAR(updateInterval), []] call CBA_fnc_addPerFrameHandler; diff --git a/addons/disarming/functions/fnc_showItemsInListbox.sqf b/addons/disarming/functions/fnc_showItemsInListbox.sqf index e05e27c87e..11d7bd470b 100644 --- a/addons/disarming/functions/fnc_showItemsInListbox.sqf +++ b/addons/disarming/functions/fnc_showItemsInListbox.sqf @@ -55,7 +55,7 @@ params ["_listBoxCtrl", "_itemsCountArray"]; }; }; - _listBoxCtrl lbAdd format ["%1", _displayName]; + _listBoxCtrl lbAdd _displayName; _listBoxCtrl lbSetData [((lbSize _listBoxCtrl) - 1), _classname]; _listBoxCtrl lbSetPicture [((lbSize _listBoxCtrl) - 1), _picture]; _listBoxCtrl lbSetTextRight [((lbSize _listBoxCtrl) - 1), str _count]; diff --git a/addons/dragging/XEH_PREP.hpp b/addons/dragging/XEH_PREP.hpp index 37b9722e8e..0861c9533d 100644 --- a/addons/dragging/XEH_PREP.hpp +++ b/addons/dragging/XEH_PREP.hpp @@ -26,6 +26,8 @@ PREP(resumeDrag); PREP(setCarryable); PREP(setDraggable); PREP(startCarry); +PREP(startCarryLocal); PREP(startCarryPFH); PREP(startDrag); +PREP(startDragLocal); PREP(startDragPFH); diff --git a/addons/dragging/XEH_postInit.sqf b/addons/dragging/XEH_postInit.sqf index 84bcffb544..ae277bf4d2 100644 --- a/addons/dragging/XEH_postInit.sqf +++ b/addons/dragging/XEH_postInit.sqf @@ -67,6 +67,9 @@ if (isNil QGVAR(maxWeightCarryRun)) then { }; }] call CBA_fnc_addEventHandler; +[QGVAR(startCarry), LINKFUNC(startCarryLocal)] call CBA_fnc_addEventHandler; +[QGVAR(startDrag), LINKFUNC(startDragLocal)] call CBA_fnc_addEventHandler; + [QGVAR(carryingContainerClosed), { params ["_container", "_owner"]; TRACE_2("carryingContainerClosed EH",_container,_owner); diff --git a/addons/dragging/functions/fnc_canCarry.sqf b/addons/dragging/functions/fnc_canCarry.sqf index caea20fb8a..be3015868b 100644 --- a/addons/dragging/functions/fnc_canCarry.sqf +++ b/addons/dragging/functions/fnc_canCarry.sqf @@ -28,7 +28,7 @@ if ((_unit getHitPointDamage "HitLegs") >= 0.5) exitWith {false}; // Static weapons need to be empty for carrying (ignore UAV AI) if (_target isKindOf "StaticWeapon") exitWith { - (crew _target) findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1 + (crew _target) findIf {!unitIsUAV _x} == -1 }; // Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues diff --git a/addons/dragging/functions/fnc_canDrag.sqf b/addons/dragging/functions/fnc_canDrag.sqf index 33dcd134b6..586e23feaf 100644 --- a/addons/dragging/functions/fnc_canDrag.sqf +++ b/addons/dragging/functions/fnc_canDrag.sqf @@ -24,7 +24,7 @@ if !([_unit, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)) exi // Static weapons need to be empty for dragging (ignore UAV AI) if (_target isKindOf "StaticWeapon") exitWith { - (crew _target) findIf {getText (configOf _x >> "simulation") != "UAVPilot"} == -1 + (crew _target) findIf {!unitIsUAV _x} == -1 }; // Units need to be unconscious or limping; Units also need to not be in ragdoll, as that causes desync issues diff --git a/addons/dragging/functions/fnc_pauseCarry.sqf b/addons/dragging/functions/fnc_pauseCarry.sqf index bfe27420f6..49c91e166f 100644 --- a/addons/dragging/functions/fnc_pauseCarry.sqf +++ b/addons/dragging/functions/fnc_pauseCarry.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" /* * Author: johnb43 - * Removes user input affecting dragging. + * Removes user input affecting carrying. * * Arguments: * 0: Unit diff --git a/addons/dragging/functions/fnc_setCarryable.sqf b/addons/dragging/functions/fnc_setCarryable.sqf index 174bdbf972..60b9854f41 100644 --- a/addons/dragging/functions/fnc_setCarryable.sqf +++ b/addons/dragging/functions/fnc_setCarryable.sqf @@ -56,8 +56,25 @@ GVAR(initializedClasses_carry) = _initializedClasses; private _icon = [QPATHTOF(UI\icons\box_carry.paa), QPATHTOF(UI\icons\person_carry.paa)] select (_object isKindOf "CAManBase"); -private _carryAction = [QGVAR(carry), LLSTRING(Carry), _icon, {[_player, _target] call FUNC(startCarry)}, {[_player, _target] call FUNC(canCarry)}] call EFUNC(interact_menu,createAction); -private _dropAction = [QGVAR(drop_carry), LLSTRING(Drop), "", {[_player, _target] call FUNC(dropObject_carry)}, {[_player, _target] call FUNC(canDrop_carry)}] call EFUNC(interact_menu,createAction); +private _carryAction = [ + QGVAR(carry), + LLSTRING(Carry), + _icon, + { + [_player, _target] call FUNC(startCarry) + }, { + [_player, _target] call FUNC(canCarry) +}] call EFUNC(interact_menu,createAction); + +private _dropAction = [ + QGVAR(drop_carry), + LLSTRING(Drop), + "", + { + [_player, _target] call FUNC(dropObject_carry) + }, { + [_player, _target] call FUNC(canDrop_carry) +}] call EFUNC(interact_menu,createAction); [_type, 0, ["ACE_MainActions"], _carryAction] call EFUNC(interact_menu,addActionToClass); [_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/dragging/functions/fnc_setDraggable.sqf b/addons/dragging/functions/fnc_setDraggable.sqf index a00e3005e9..e024ec5be2 100644 --- a/addons/dragging/functions/fnc_setDraggable.sqf +++ b/addons/dragging/functions/fnc_setDraggable.sqf @@ -56,8 +56,25 @@ GVAR(initializedClasses) = _initializedClasses; private _icon = [QPATHTOF(UI\icons\box_drag.paa), QPATHTOF(UI\icons\person_drag.paa)] select (_object isKindOf "CAManBase"); -private _dragAction = [QGVAR(drag), LLSTRING(Drag), _icon, {[_player, _target] call FUNC(startDrag)}, {[_player, _target] call FUNC(canDrag)}] call EFUNC(interact_menu,createAction); -private _dropAction = [QGVAR(drop), LLSTRING(Drop), "", {[_player, _target] call FUNC(dropObject)}, {[_player, _target] call FUNC(canDrop)}] call EFUNC(interact_menu,createAction); +private _dragAction = [ + QGVAR(drag), + LLSTRING(Drag), + _icon, + { + [_player, _target] call FUNC(startDrag) + }, { + [_player, _target] call FUNC(canDrag) +}] call EFUNC(interact_menu,createAction); + +private _dropAction = [ + QGVAR(drop), + LLSTRING(Drop), + "", + { + [_player, _target] call FUNC(dropObject); + }, { + [_player, _target] call FUNC(canDrop) +}] call EFUNC(interact_menu,createAction); [_type, 0, ["ACE_MainActions"], _dragAction] call EFUNC(interact_menu,addActionToClass); [_type, 0, [], _dropAction] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/dragging/functions/fnc_startCarry.sqf b/addons/dragging/functions/fnc_startCarry.sqf index 040b701f71..3e2cc17efd 100644 --- a/addons/dragging/functions/fnc_startCarry.sqf +++ b/addons/dragging/functions/fnc_startCarry.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" /* - * Author: commy2, PiZZADOX - * Starts the carrying process. + * Author: johnb43 + * Starts the carrying process safely. * * Arguments: * 0: Unit that should do the carrying @@ -11,82 +11,11 @@ * None * * Example: - * [player, cursorTarget] call ace_dragging_fnc_startCarry; + * [player, cursorTarget] call ace_dragging_fnc_startCarry * * Public: No */ - params ["_unit", "_target"]; -TRACE_2("params",_unit,_target); -// Exempt from weight check if object has override variable set -private _weight = 0; - -if !(_target getVariable [QGVAR(ignoreWeightCarry), false]) then { - _weight = _target call FUNC(getWeight); -}; - -// Exit if object weight is over global var value -if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith { - [LLSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured); -}; - -private _timer = CBA_missionTime + 5; - -// Handle objects vs. persons -if (_target isKindOf "CAManBase") then { - private _primaryWeapon = primaryWeapon _unit; - - // Add a primary weapon if the unit has none - if (_primaryWeapon == "") then { - _unit addWeapon "ACE_FakePrimaryWeapon"; - _primaryWeapon = "ACE_FakePrimaryWeapon"; - }; - - // Select primary, otherwise the drag animation actions don't work - _unit selectWeapon _primaryWeapon; - - // Move a bit closer and adjust direction when trying to pick up a person - [QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent; - _target setPosASL (getPosASL _unit vectorAdd (vectorDir _unit)); - - [_unit, "AcinPknlMstpSnonWnonDnon_AcinPercMrunSnonWnonDnon", 2] call EFUNC(common,doAnimation); - [_target, "AinjPfalMstpSnonWrflDnon_carried_Up", 2] call EFUNC(common,doAnimation); - - _timer = CBA_missionTime + 10; -} else { - // Select no weapon and stop sprinting - private _previousWeaponIndex = [_unit] call EFUNC(common,getFiremodeIndex); - _unit setVariable [QGVAR(previousWeapon), _previousWeaponIndex, true]; - - _unit action ["SwitchWeapon", _unit, _unit, 299]; - - [_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation); - - private _canRun = _weight call FUNC(canRun_carry); - - // Only force walking if we're overweight - [_unit, "forceWalk", QUOTE(ADDON), !_canRun] call EFUNC(common,statusEffect_set); - [_unit, "blockSprint", QUOTE(ADDON), _canRun] call EFUNC(common,statusEffect_set); -}; - -[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); - -// Prevent multiple players from accessing the same object -[_unit, _target, true] call EFUNC(common,claim); - -// Prevents dragging and carrying at the same time -_unit setVariable [QGVAR(isCarrying), true, true]; - -// Required for aborting animation -_unit setVariable [QGVAR(carriedObject), _target, true]; - -[FUNC(startCarryPFH), 0.2, [_unit, _target, _timer]] call CBA_fnc_addPerFrameHandler; - -// Disable collisions by setting the PhysX mass to almost zero -private _mass = getMass _target; - -if (_mass > 1) then { - _target setVariable [QGVAR(originalMass), _mass, true]; - [QEGVAR(common,setMass), [_target, 1e-12]] call CBA_fnc_globalEvent; // Force global sync -}; +// Try to claim the object +[QEGVAR(common,claimSafe), [_unit, _target, true, QGVAR(startCarry)]] call CBA_fnc_serverEvent; diff --git a/addons/dragging/functions/fnc_startCarryLocal.sqf b/addons/dragging/functions/fnc_startCarryLocal.sqf new file mode 100644 index 0000000000..15101e2950 --- /dev/null +++ b/addons/dragging/functions/fnc_startCarryLocal.sqf @@ -0,0 +1,92 @@ +#include "..\script_component.hpp" +/* + * Author: commy2, PiZZADOX + * Starts the carrying process. + * + * Arguments: + * 0: Unit that should do the carrying + * 1: Object to carry + * 2: If object was successfully claimed + * + * Return Value: + * None + * + * Example: + * [player, cursorTarget, true] call ace_dragging_fnc_startCarryLocal + * + * Public: No + */ + +params ["_unit", "_target", "_claimed"]; +TRACE_3("params",_unit,_target,_claimed); + +if (!_claimed) exitWith { WARNING_1("already claimed %1",_this) }; + +// Exempt from weight check if object has override variable set +private _weight = 0; + +if !(_target getVariable [QGVAR(ignoreWeightCarry), false]) then { + _weight = _target call FUNC(getWeight); +}; + +// Exit if object weight is over global var value +if (_weight > GETMVAR(ACE_maxWeightCarry,1E11)) exitWith { + [LLSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured); +}; + +private _timer = CBA_missionTime + 5; + +// Handle objects vs. persons +if (_target isKindOf "CAManBase") then { + private _primaryWeapon = primaryWeapon _unit; + + // Add a primary weapon if the unit has none + if (_primaryWeapon == "") then { + _unit addWeapon "ACE_FakePrimaryWeapon"; + _primaryWeapon = "ACE_FakePrimaryWeapon"; + }; + + // Select primary, otherwise the drag animation actions don't work + _unit selectWeapon _primaryWeapon; + + // Move a bit closer and adjust direction when trying to pick up a person + [QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent; + _target setPosASL (getPosASL _unit vectorAdd (vectorDir _unit)); + + [_unit, "AcinPknlMstpSnonWnonDnon_AcinPercMrunSnonWnonDnon", 2] call EFUNC(common,doAnimation); + [_target, "AinjPfalMstpSnonWrflDnon_carried_Up", 2] call EFUNC(common,doAnimation); + + _timer = CBA_missionTime + 10; +} else { + // Select no weapon and stop sprinting + private _previousWeaponIndex = [_unit] call EFUNC(common,getFiremodeIndex); + _unit setVariable [QGVAR(previousWeapon), _previousWeaponIndex, true]; + + _unit action ["SwitchWeapon", _unit, _unit, 299]; + + [_unit, "AmovPercMstpSnonWnonDnon", 0] call EFUNC(common,doAnimation); + + private _canRun = _weight call FUNC(canRun_carry); + + // Only force walking if we're overweight + [_unit, "forceWalk", QUOTE(ADDON), !_canRun] call EFUNC(common,statusEffect_set); + [_unit, "blockSprint", QUOTE(ADDON), _canRun] call EFUNC(common,statusEffect_set); +}; + +[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); + +// Prevents dragging and carrying at the same time +_unit setVariable [QGVAR(isCarrying), true, true]; + +// Required for aborting animation +_unit setVariable [QGVAR(carriedObject), _target, true]; + +[FUNC(startCarryPFH), 0.2, [_unit, _target, _timer]] call CBA_fnc_addPerFrameHandler; + +// Disable collisions by setting the PhysX mass to almost zero +private _mass = getMass _target; + +if (_mass > 1) then { + _target setVariable [QGVAR(originalMass), _mass, true]; + [QEGVAR(common,setMass), [_target, 1e-12]] call CBA_fnc_globalEvent; // Force global sync +}; diff --git a/addons/dragging/functions/fnc_startDrag.sqf b/addons/dragging/functions/fnc_startDrag.sqf index cd298804e6..8dd6db6dee 100644 --- a/addons/dragging/functions/fnc_startDrag.sqf +++ b/addons/dragging/functions/fnc_startDrag.sqf @@ -1,104 +1,21 @@ #include "..\script_component.hpp" /* - * Author: commy2, PiZZADOX, Malbryn - * Starts the dragging process. + * Author: johnb43 + * Starts the dragging process safely. * * Arguments: - * 0: Unit that should do the dragging + * 0: Unit that should do the carrying * 1: Object to drag * * Return Value: * None * * Example: - * [player, cursorTarget] call ace_dragging_fnc_startDrag; + * [player, cursorTarget] call ace_dragging_fnc_startDrag * * Public: No */ - params ["_unit", "_target"]; -TRACE_2("params",_unit,_target); -// Exempt from weight check if object has override variable set -private _weight = 0; - -if !(_target getVariable [QGVAR(ignoreWeightDrag), false]) then { - _weight = _target call FUNC(getWeight); -}; - -// Exit if object weight is over global var value -if (_weight > GETMVAR(ACE_maxWeightDrag,1E11)) exitWith { - [LLSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured); -}; - -private _primaryWeapon = primaryWeapon _unit; - -// Add a primary weapon if the unit has none -if !(GVAR(dragAndFire)) then { - if (_primaryWeapon == "") then { - _unit addWeapon "ACE_FakePrimaryWeapon"; - _primaryWeapon = "ACE_FakePrimaryWeapon"; - }; - - _unit selectWeapon _primaryWeapon; -} else { // Making sure the unit is holding a primary weapon or handgun - private _handgunWeapon = handgunWeapon _unit; - - if !(currentWeapon _unit in [_primaryWeapon, _handgunWeapon]) then { - if (_primaryWeapon != "") then { - // Use primary if possible - _unit selectWeapon _primaryWeapon; - } else { - if (_handgunWeapon != "") then { - // Use pistol if unit has no primary - _unit selectWeapon _handgunWeapon; - } else { - // Add fake weapon if no weapons besides launcher are available - _unit addWeapon "ACE_FakePrimaryWeapon"; - _unit selectWeapon "ACE_FakePrimaryWeapon"; - }; - }; - }; -}; - -// Save the weapon so we can monitor if it changes -_unit setVariable [QGVAR(currentWeapon), currentWeapon _unit]; - -[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); - -// Prevent multiple players from accessing the same object -[_unit, _target, true] call EFUNC(common,claim); - -// Can't play action that depends on weapon if it was added the same frame -if !(_unit call EFUNC(common,isSwimming)) then { - [{ - private _unitWeapon = _this getVariable [QGVAR(currentWeapon), ""]; - - if (_unitWeapon isKindOf ["Pistol", configFile >> "CfgWeapons"]) then { - [_this, "ACE_dragWithPistol"] call EFUNC(common,doGesture); - } else { - [_this, "ACE_dragWithRifle"] call EFUNC(common,doGesture); - }; - }, _unit] call CBA_fnc_execNextFrame; -}; - -// Move a bit closer and adjust direction when trying to pick up a person -if (_target isKindOf "CAManBase") then { - [QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent; - _target setPosASL (getPosASL _unit vectorAdd (vectorDir _unit vectorMultiply 1.5)); - - [_target, "AinjPpneMrunSnonWnonDb_grab", 2] call EFUNC(common,doAnimation); -}; - -// Prevents dragging and carrying at the same time -_unit setVariable [QGVAR(isDragging), true, true]; - -[FUNC(startDragPFH), 0.2, [_unit, _target, CBA_missionTime + 5]] call CBA_fnc_addPerFrameHandler; - -// Disable collisions by setting the physx mass to almost zero -private _mass = getMass _target; - -if (_mass > 1) then { - _target setVariable [QGVAR(originalMass), _mass, true]; - [QEGVAR(common,setMass), [_target, 1e-12]] call CBA_fnc_globalEvent; // Force global sync -}; +// Try to claim the object +[QEGVAR(common,claimSafe), [_unit, _target, true, QGVAR(startDrag)]] call CBA_fnc_serverEvent; diff --git a/addons/dragging/functions/fnc_startDragLocal.sqf b/addons/dragging/functions/fnc_startDragLocal.sqf new file mode 100644 index 0000000000..b656c8ce5a --- /dev/null +++ b/addons/dragging/functions/fnc_startDragLocal.sqf @@ -0,0 +1,104 @@ +#include "..\script_component.hpp" +/* + * Author: commy2, PiZZADOX, Malbryn + * Starts the dragging process. + * + * Arguments: + * 0: Unit that should do the dragging + * 1: Object to drag + * 2: If object was successfully claimed + * + * Return Value: + * None + * + * Example: + * [player, cursorTarget, true] call ace_dragging_fnc_startDragLocal + * + * Public: No + */ + +params ["_unit", "_target", "_claimed"]; +TRACE_3("params",_unit,_target,_claimed); + +if (!_claimed) exitWith { WARNING_1("already claimed %1",_this) }; + +// Exempt from weight check if object has override variable set +private _weight = 0; + +if !(_target getVariable [QGVAR(ignoreWeightDrag), false]) then { + _weight = _target call FUNC(getWeight); +}; + +// Exit if object weight is over global var value +if (_weight > GETMVAR(ACE_maxWeightDrag,1E11)) exitWith { + [LLSTRING(UnableToDrag)] call EFUNC(common,displayTextStructured); +}; + +private _primaryWeapon = primaryWeapon _unit; + +// Add a primary weapon if the unit has none +if !(GVAR(dragAndFire)) then { + if (_primaryWeapon == "") then { + _unit addWeapon "ACE_FakePrimaryWeapon"; + _primaryWeapon = "ACE_FakePrimaryWeapon"; + }; + + _unit selectWeapon _primaryWeapon; +} else { // Making sure the unit is holding a primary weapon or handgun + private _handgunWeapon = handgunWeapon _unit; + + if !(currentWeapon _unit in [_primaryWeapon, _handgunWeapon]) then { + if (_primaryWeapon != "") then { + // Use primary if possible + _unit selectWeapon _primaryWeapon; + } else { + if (_handgunWeapon != "") then { + // Use pistol if unit has no primary + _unit selectWeapon _handgunWeapon; + } else { + // Add fake weapon if no weapons besides launcher are available + _unit addWeapon "ACE_FakePrimaryWeapon"; + _unit selectWeapon "ACE_FakePrimaryWeapon"; + }; + }; + }; +}; + +// Save the weapon so we can monitor if it changes +_unit setVariable [QGVAR(currentWeapon), currentWeapon _unit]; + +[_unit, "blockThrow", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); + +// Can't play action that depends on weapon if it was added the same frame +if !(_unit call EFUNC(common,isSwimming)) then { + [{ + private _unitWeapon = _this getVariable [QGVAR(currentWeapon), ""]; + + if (_unitWeapon isKindOf ["Pistol", configFile >> "CfgWeapons"]) then { + [_this, "ACE_dragWithPistol"] call EFUNC(common,doGesture); + } else { + [_this, "ACE_dragWithRifle"] call EFUNC(common,doGesture); + }; + }, _unit] call CBA_fnc_execNextFrame; +}; + +// Move a bit closer and adjust direction when trying to pick up a person +if (_target isKindOf "CAManBase") then { + [QEGVAR(common,setDir), [_target, getDir _unit + 180], _target] call CBA_fnc_targetEvent; + _target setPosASL (getPosASL _unit vectorAdd (vectorDir _unit vectorMultiply 1.5)); + + [_target, "AinjPpneMrunSnonWnonDb_grab", 2] call EFUNC(common,doAnimation); +}; + +// Prevents dragging and carrying at the same time +_unit setVariable [QGVAR(isDragging), true, true]; + +[FUNC(startDragPFH), 0.2, [_unit, _target, CBA_missionTime + 5]] call CBA_fnc_addPerFrameHandler; + +// Disable collisions by setting the physx mass to almost zero +private _mass = getMass _target; + +if (_mass > 1) then { + _target setVariable [QGVAR(originalMass), _mass, true]; + [QEGVAR(common,setMass), [_target, 1e-12]] call CBA_fnc_globalEvent; // Force global sync +}; diff --git a/addons/dragging/initKeybinds.inc.sqf b/addons/dragging/initKeybinds.inc.sqf index 8ee36d0283..a8792f3576 100644 --- a/addons/dragging/initKeybinds.inc.sqf +++ b/addons/dragging/initKeybinds.inc.sqf @@ -5,7 +5,7 @@ if (!alive _player) exitWith {false}; if !([_player, objNull, ["isNotDragging", "isNotCarrying", "isNotSwimming"]] call EFUNC(common,canInteractWith)) exitWith {false}; - // If we are drag/carrying something right now then just drop it: + // If we are dragging/carrying something right now then just drop it if (_player getVariable [QGVAR(isDragging), false]) exitWith { [_player, _player getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject); @@ -34,7 +34,7 @@ if (!alive _player) exitWith {false}; if !([_player, objNull, ["isNotDragging", "isNotCarrying"]] call EFUNC(common,canInteractWith)) exitWith {false}; - // If we are drag/carrying something right now then just drop it: + // If we are dragging/carrying something right now then just drop it if (_player getVariable [QGVAR(isDragging), false]) exitWith { [_player, _player getVariable [QGVAR(draggedObject), objNull]] call FUNC(dropObject); diff --git a/addons/dragon/functions/fnc_canPickupTripod.sqf b/addons/dragon/functions/fnc_canPickupTripod.sqf index 3d556385e5..a103277972 100644 --- a/addons/dragon/functions/fnc_canPickupTripod.sqf +++ b/addons/dragon/functions/fnc_canPickupTripod.sqf @@ -21,5 +21,4 @@ params ["_target", "_unit"]; && {!alive (gunner _target)} && {!(_target getVariable [QGVAR(fired), false])} && {!(_target getVariable [QGVAR(sightAttached), ((typeOf _target) == QGVAR(staticAssembled))])} -&& EFUNC(csw,assemble_canPickupTripod) - +&& EFUNC(csw,canPickupTripod) diff --git a/addons/explosives/XEH_PREP.hpp b/addons/explosives/XEH_PREP.hpp index 319bd2fec2..444b9db2ea 100644 --- a/addons/explosives/XEH_PREP.hpp +++ b/addons/explosives/XEH_PREP.hpp @@ -10,6 +10,7 @@ PREP(cancelPlacement); PREP(canDefuse); PREP(canDetonate); PREP(connectExplosive); +PREP(cycleActiveTrigger); PREP(defuseExplosive); PREP(detonateExplosive); PREP(detonateExplosiveAll); diff --git a/addons/explosives/XEH_postInit.sqf b/addons/explosives/XEH_postInit.sqf index bee84c5b0f..40b3bb6959 100644 --- a/addons/explosives/XEH_postInit.sqf +++ b/addons/explosives/XEH_postInit.sqf @@ -50,7 +50,7 @@ if (isServer) then { ["ace_unconscious", { params ["_unit", "_isUnconscious"]; if (!_isUnconscious) exitWith {}; - TRACE_1("Knocked Out, Doing Deadman", _unit); + TRACE_1("Knocked Out, Doing Deadman",_unit); [_unit] call FUNC(onIncapacitated); }] call CBA_fnc_addEventHandler; }; diff --git a/addons/explosives/XEH_preInit.sqf b/addons/explosives/XEH_preInit.sqf index a6b4e97ed3..6141a1d3e0 100644 --- a/addons/explosives/XEH_preInit.sqf +++ b/addons/explosives/XEH_preInit.sqf @@ -8,8 +8,11 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +#include "initKeybinds.inc.sqf" #include "initSettings.inc.sqf" +GVAR(activeTrigger) = ""; + GVAR(detonationHandlers) = []; GVAR(excludedMines) = []; diff --git a/addons/explosives/functions/fnc_addDetonateActions.sqf b/addons/explosives/functions/fnc_addDetonateActions.sqf index c353f973c3..ea4b87128a 100644 --- a/addons/explosives/functions/fnc_addDetonateActions.sqf +++ b/addons/explosives/functions/fnc_addDetonateActions.sqf @@ -49,18 +49,43 @@ private _explosivesList = []; }; }; } forEach _result; -if (_detonator != "ACE_DeadManSwitch") then { - // Add action to detonate all explosives tied to the detonator - if (count _explosivesList > 0) then { - _children pushBack [ + +// If the detonator is not active, is a clacker and has assigned explosives, generate an interaction to make it the active detonator for use with the "trigger all" keybind +if ( + _detonator != GVAR(activeTrigger) && + {_detonator != "Cellphone"} && + { + _explosivesList isNotEqualTo [] || + {_detonator == "ACE_DeadManSwitch" && {_unit getVariable [QGVAR(deadmanInvExplosive), ""] != ""}} + } +) then { + _children pushBack [ [ - "Explosive_All", - localize LSTRING(DetonateAll), - getText(ConfigFile >> "CfgWeapons" >> _detonator >> "picture"), - {(_this select 2) call FUNC(detonateExplosiveAll);}, + QGVAR(setActiveTrigger), + LLSTRING(SetActiveTrigger), + "", + {GVAR(activeTrigger) = (_this select 2) select 0;}, {true}, {}, - [_unit,_range,_explosivesList, _detonator] + [_detonator] + ] call EFUNC(interact_menu,createAction), + [], + _unit + ]; +}; + +if (_detonator != "ACE_DeadManSwitch") then { + // Add action to detonate all explosives tied to the detonator + if (count _explosivesList > 1) then { + _children pushBack [ + [ + "Explosive_All", + LLSTRING(DetonateAll), + getText (configFile >> "CfgWeapons" >> _detonator >> "picture"), + {(_this select 2) call FUNC(detonateExplosiveAll);}, + {true}, + {}, + [_unit, _range, _explosivesList, _detonator] ] call EFUNC(interact_menu,createAction), [], _unit @@ -69,15 +94,15 @@ if (_detonator != "ACE_DeadManSwitch") then { } else { //Add action to detonate all explosives (including the inventory explosive): _children pushBack [ - [ - "Explosive_All_Deadman", - localize LSTRING(DetonateAll), - getText(ConfigFile >> "CfgWeapons" >> _detonator >> "picture"), - {[_player] call FUNC(onIncapacitated)}, - {true} - ] call EFUNC(interact_menu,createAction), - [], - _unit + [ + "Explosive_All_Deadman", + LLSTRING(DetonateAll), + getText (configFile >> "CfgWeapons" >> _detonator >> "picture"), + {[_player] call FUNC(onIncapacitated)}, + {true} + ] call EFUNC(interact_menu,createAction), + [], + _unit ]; //Adds actions for the explosives you can connect to the deadman switch. @@ -89,7 +114,7 @@ if (_detonator != "ACE_DeadManSwitch") then { _connectedInventoryExplosive = _unit getVariable [QGVAR(deadmanInvExplosive), ""]; if (_connectedInventoryExplosive != "") then { - //Add the disconect action + //Add the disconnect action private _magConfig = configFile >> "CfgMagazines" >> _connectedInventoryExplosive; private _name = if ((getText (_magConfig >> "displayNameShort")) != "") then { getText (_magConfig >> "displayNameShort") @@ -99,17 +124,20 @@ if (_detonator != "ACE_DeadManSwitch") then { private _picture = getText (_magConfig >> "picture"); _children pushBack [ - ([ - "Deadman_disconnect", - format ["%1 %2", localize "str_disp_disconnect", _name], - _picture, - { - params ["_player"]; - TRACE_1("clear",_player); - _player setVariable [QGVAR(deadmanInvExplosive), "", true]; - }, - {true} - ] call EFUNC(interact_menu,createAction)), [], _unit]; + ([ + "Deadman_disconnect", + format ["%1 %2", localize "str_disp_disconnect", _name], + _picture, + { + params ["_player"]; + TRACE_1("clear",_player); + _player setVariable [QGVAR(deadmanInvExplosive), "", true]; + }, + {true} + ] call EFUNC(interact_menu,createAction)), + [], + _unit + ]; } else { //Add all magazines that would work with the deadman switch diff --git a/addons/explosives/functions/fnc_cycleActiveTrigger.sqf b/addons/explosives/functions/fnc_cycleActiveTrigger.sqf new file mode 100644 index 0000000000..e5226c6165 --- /dev/null +++ b/addons/explosives/functions/fnc_cycleActiveTrigger.sqf @@ -0,0 +1,53 @@ +#include "..\script_component.hpp" +/* + * Author: mrschick + * Cycles the "Active Trigger" of a unit and shows a CBA Hint that displays the new Active Trigger. + * + * Arguments: + * 0: Unit + * + * Return Value: + * None + * + * Example: + * [ACE_player] call ace_explosives_fnc_cycleActiveTrigger; + * + * Public: No + */ + +params ["_unit"]; +TRACE_1("params",_unit); + +private _detonators = _unit call FUNC(getDetonators); + +// Remove ACE_Cellphone from list, as it should never be the active trigger due to having its own keybind +_detonators deleteAt (_detonators findIf {_x == "ACE_Cellphone"}); + +// Reset Active Trigger if none available +if (_detonators isEqualTo []) exitWith { + GVAR(activeTrigger) = ""; +}; + +private _activeTrigger = GVAR(activeTrigger); +private _index = _detonators findIf {_x == _activeTrigger}; +private _count = count _detonators; + +if (_activeTrigger != "" && {_index != -1} && {_count > 1}) then { + // If active trigger is set and among current detonators, switch to the next one + if (_index < _count - 1) then { + _index = _index + 1; + } else { + _index = 0; + }; + _activeTrigger = _detonators select _index; +} else { + // Assign first detonator in list as the active one + _activeTrigger = _detonators select 0; +}; + +GVAR(activeTrigger) = _activeTrigger; +private _triggerConfig = configFile >> "CfgWeapons" >> _activeTrigger; +private _triggerName = getText (_triggerConfig >> "displayName"); +private _triggerIcon = getText (_triggerConfig >> "picture"); + +[format ["%1: %2", LLSTRING(ActiveTrigger), _triggerName], _triggerIcon] call EFUNC(common,displayTextPicture); diff --git a/addons/explosives/functions/fnc_selectTrigger.sqf b/addons/explosives/functions/fnc_selectTrigger.sqf index ef9b686d25..7c7d5e58d4 100644 --- a/addons/explosives/functions/fnc_selectTrigger.sqf +++ b/addons/explosives/functions/fnc_selectTrigger.sqf @@ -22,6 +22,15 @@ TRACE_3("params",_explosive,_magazine,_trigger); private _config = ConfigFile >> "ACE_Triggers" >> _trigger; +// Make selected trigger the active one (for keybind) if it's the first to be connected +private _activeTrigger = GVAR(activeTrigger); +if ( + _activeTrigger == "" && + {(["Command", "MK16_Transmitter", "DeadManSwitch"] findIf {_x == _trigger}) != -1} +) then { + GVAR(activeTrigger) = getArray (_config >> "requires") select 0; +}; + // If the onSetup function returns true, it is handled elsewhere if (isText(_config >> "onSetup") && {[_explosive,_magazine] call compile getText (_config >> "onSetup")}) exitWith { TRACE_2("onSetup returned true",_explosive,_trigger); diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index 423e8932c3..918bbb0c33 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -161,7 +161,7 @@ GVAR(TweakedAngle) = 0; private _placeAngle = 0; 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 ((getMass _expSetupVehicle) > 5) then {_expSetupVehicle setMass 5;}; diff --git a/addons/explosives/initKeybinds.inc.sqf b/addons/explosives/initKeybinds.inc.sqf new file mode 100644 index 0000000000..c01d39795c --- /dev/null +++ b/addons/explosives/initKeybinds.inc.sqf @@ -0,0 +1,50 @@ +#include "\a3\ui_f\hpp\defineDIKCodes.inc" + +["ACE3 Equipment", QGVAR(openCellphone), LLSTRING(cellphone_displayName), { + if ( + !([ACE_player, "ACE_Cellphone"] call EFUNC(common,hasItem)) || + !([ACE_player, objNull, ["isNotSwimming", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) + ) exitWith {}; + + closeDialog 0; + createDialog "Rsc_ACE_PhoneInterface"; + + true +}] call CBA_fnc_addKeybind; // Unbound + +["ACE3 Equipment", QGVAR(detonateActiveClacker), LLSTRING(DetonateAllOnActive), { + // Prevent use of keybind while surrendering or captive + if !([ACE_player, objNull, ["isNotSwimming", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {}; + + private _detonator = GVAR(activeTrigger); + if (_detonator == "" || !(_detonator in ([ACE_player] call FUNC(getDetonators)))) exitWith {}; + + // When using a Dead Man's Switch, skip all other logic and just call fnc_onIncapacitated, since it already handles everything that is required to detonate all connected explosives + if (_detonator == "ACE_DeadManSwitch") exitWith { + [ACE_player] call FUNC(onIncapacitated); + }; + + private _range = getNumber (configFile >> "CfgWeapons" >> _detonator >> QGVAR(Range)); + + private _explosivesList = []; + { + if (!isNull (_x select 0)) then { + private _required = getArray (configFile >> "ACE_Triggers" >> _x select 4 >> "requires"); + if (_detonator in _required) then { + _explosivesList pushBack _x; + }; + }; + } forEach ([ACE_player] call FUNC(getPlacedExplosives)); + + [ACE_player, _range, _explosivesList, _detonator] call FUNC(detonateExplosiveAll); + + true +}] call CBA_fnc_addKeybind; // Unbound + +["ACE3 Equipment", QGVAR(cycleActiveClacker), LLSTRING(CycleActiveTrigger), { + if !([ACE_player, objNull, ["isNotSwimming", "isNotInside", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {}; + + [ACE_player] call FUNC(cycleActiveTrigger); + + true +}] call CBA_fnc_addKeybind; // Unbound diff --git a/addons/explosives/stringtable.xml b/addons/explosives/stringtable.xml index 86c3183fe3..b9ed8329c8 100644 --- a/addons/explosives/stringtable.xml +++ b/addons/explosives/stringtable.xml @@ -68,6 +68,26 @@ 引爆全部 Hepsini Patlat + + Detonate All on Active Clacker + Alle auf Standardzünder zünden + Detona Tutti sul Detonatore Attivo + + + Set Active Clacker + Als Standardzünder wählen + Imposta Detonatore Attivo + + + Cycle Active Clacker + Standardzünder wechseln + Cambia Detonatore Attivo + + + Active Clacker + Standardzünder + Detonatore Attivo + Explosive code: %1 Sprengstoffcode: %1 diff --git a/addons/fcs/functions/fnc_firedEH.sqf b/addons/fcs/functions/fnc_firedEH.sqf index dedef1c74e..52edd6417f 100644 --- a/addons/fcs/functions/fnc_firedEH.sqf +++ b/addons/fcs/functions/fnc_firedEH.sqf @@ -16,7 +16,7 @@ */ //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); private _FCSMagazines = _vehicle getVariable [format ["%1_%2", QGVAR(Magazines), _turret], []]; @@ -50,7 +50,7 @@ if (_zeroDistance > 0) then { private _antiOffset = _gunner getVariable QGVAR(lastAntiOffset); _offset = _offset - _antiOffset; - TRACE_4("fired",_gunner, currentZeroing _gunner, _antiOffset, _offset); + TRACE_4("fired",_gunner,currentZeroing _gunner,_antiOffset,_offset); }; [_projectile, (_vehicle getVariable format ["%1_%2", QGVAR(Azimuth), _turret]), _offset, 0] call EFUNC(common,changeProjectileDirection); diff --git a/addons/field_rations/stringtable.xml b/addons/field_rations/stringtable.xml index 8a513a2926..78e1ebfe87 100644 --- a/addons/field_rations/stringtable.xml +++ b/addons/field_rations/stringtable.xml @@ -465,7 +465,7 @@ Scorta d'acqua 飲用水補給 饮用水补给 - 水資源 + 水資源量 Водные ресурсы Źródło wody 식수 보급량 @@ -478,7 +478,7 @@ La quantità di acqua disponibile per interazioni ACE Razioni da Campo di sorgenti d'acqua (-1 nessuna, -10 infinita) 水源可供補充飲用水的次數(-1為關閉,-10為無限次)。 水源可供取水的次数(-1为关闭,-10为无限次)。 - ACE フィールド レーションで利用できる水源の量を設定できます。(-1で無効化、-10で無限) + ACE フィールド レーションで利用できる水源の資源量を設定できます。(-1で無効化、-10で無限) Количество воды, доступной для использования в ACE Полевые рационы. (-1 - отключено, -10 - бесконечно) Ilość wody dostępnej dla Akcji ACE Źródła wody (-1 wyłączone, -10 nieskończone) ACE 전투식량 물 근처 행동에서 얼마나 물을 얻어 갈 수 있는지를 정합니다 (-1은 비활성화, -10은 무한대) diff --git a/addons/finger/XEH_postInit.sqf b/addons/finger/XEH_postInit.sqf index caa2ab54e8..641c94ff92 100644 --- a/addons/finger/XEH_postInit.sqf +++ b/addons/finger/XEH_postInit.sqf @@ -4,7 +4,7 @@ if (!hasInterface) exitWith {}; ["CBA_settingsInitialized", { //If not enabled, dont't bother adding eventhandler - TRACE_1("CBA_settingsInitialized eh", GVAR(enabled)); + TRACE_1("CBA_settingsInitialized eh",GVAR(enabled)); if (!GVAR(enabled)) exitWith {}; GVAR(lastFPTime) = -1; diff --git a/addons/finger/functions/fnc_incomingFinger.sqf b/addons/finger/functions/fnc_incomingFinger.sqf index fb65d8eac9..4509a270db 100644 --- a/addons/finger/functions/fnc_incomingFinger.sqf +++ b/addons/finger/functions/fnc_incomingFinger.sqf @@ -25,12 +25,12 @@ private _fingerPos = if (_sourceUnit == ACE_player) then { _fingerPosPrecise vectorAdd ([random (2 * FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2 * FP_RANDOMIZATION_X) - FP_RANDOMIZATION_X, random (2 * FP_RANDOMIZATION_Y) - FP_RANDOMIZATION_Y] vectorMultiply _distance) }; -TRACE_3("incoming finger:", _sourceUnit, _fingerPosPrecise, _fingerPos); +TRACE_3("incoming finger:",_sourceUnit,_fingerPosPrecise,_fingerPos); private _data = [diag_tickTime, _fingerPos, ([_sourceUnit, false, true] call EFUNC(common,getName)), _sourceUnit]; GVAR(fingersHash) set [hashValue _sourceUnit, _data]; if (GVAR(pfeh_id) == -1) then { GVAR(pfeh_id) = [DFUNC(perFrameEH), 0, []] call CBA_fnc_addPerFrameHandler; - TRACE_1("Started PFEH", GVAR(pfeh_id)); + TRACE_1("Started PFEH",GVAR(pfeh_id)); }; diff --git a/addons/finger/functions/fnc_perFrameEH.sqf b/addons/finger/functions/fnc_perFrameEH.sqf index e499ff8808..4af4f6b643 100644 --- a/addons/finger/functions/fnc_perFrameEH.sqf +++ b/addons/finger/functions/fnc_perFrameEH.sqf @@ -44,7 +44,7 @@ private _iconBaseSize = GVAR(sizeCoef) * BASE_SIZE * 0.10713 * (call EFUNC(commo } forEach GVAR(fingersHash); if (GVAR(fingersHash) isEqualTo createHashMap) then { - TRACE_1("Ending PFEH", GVAR(pfeh_id)); + TRACE_1("Ending PFEH",GVAR(pfeh_id)); [GVAR(pfeh_id)] call CBA_fnc_removePerFrameHandler; GVAR(pfeh_id) = -1; }; diff --git a/addons/fire/XEH_postInit.sqf b/addons/fire/XEH_postInit.sqf index 125cb59140..382c06293b 100644 --- a/addons/fire/XEH_postInit.sqf +++ b/addons/fire/XEH_postInit.sqf @@ -10,7 +10,7 @@ }] call CBA_fnc_addEventHandler; ["ace_settingsInitialized", { - TRACE_1("settingsInit", GVAR(enabled)); + TRACE_1("settingsInit",GVAR(enabled)); if (!GVAR(enabled)) exitWith {}; if (isServer) then { diff --git a/addons/fire/functions/fnc_burn.sqf b/addons/fire/functions/fnc_burn.sqf index 08d52bd05c..a98aea9bc8 100644 --- a/addons/fire/functions/fnc_burn.sqf +++ b/addons/fire/functions/fnc_burn.sqf @@ -189,7 +189,7 @@ if (_isBurning) exitWith {}; if ((_unit isEqualTo vehicle _unit) && (_sdr || ({ 0.05 > random 1 }))) then { _unit setVariable [QGVAR(stopDropRoll), true]; if !(_sdr) then { - TRACE_1("stop, drop, roll!", _unit); + TRACE_1("stop,drop,roll!",_unit); _unit setUnitPos "DOWN"; doStop _unit; }; @@ -203,7 +203,7 @@ if (_isBurning) exitWith {}; private _vehicle = vehicle _unit; if (_vehicle != _unit) then { - TRACE_1("Ejecting", _unit); + TRACE_1("Ejecting",_unit); _unit leaveVehicle _vehicle; unassignVehicle _unit; _unit action ["eject",_vehicle]; diff --git a/addons/fortify/functions/fnc_createObjectMarker.sqf b/addons/fortify/functions/fnc_createObjectMarker.sqf index 185ae640eb..ce6fd279b0 100644 --- a/addons/fortify/functions/fnc_createObjectMarker.sqf +++ b/addons/fortify/functions/fnc_createObjectMarker.sqf @@ -29,7 +29,7 @@ private _direction = getDir _object; // Marker name unique to this object private _markerNameStr = format [QGVAR(marker_%1), hashValue _object]; -private _channel = if (GVAR(markObjectsOnMap) == 2) then { 0 } else { 1 }; +private _channel = parseNumber (GVAR(markObjectsOnMap) != 2); private _marker = createMarkerLocal [_markerNameStr, _object, _channel, _unit]; TRACE_2("created",_marker,_channel); diff --git a/addons/gforces/XEH_postInit.sqf b/addons/gforces/XEH_postInit.sqf index a2f69dd608..d0d58488d3 100644 --- a/addons/gforces/XEH_postInit.sqf +++ b/addons/gforces/XEH_postInit.sqf @@ -12,8 +12,7 @@ GVAR(playerIsVirtual) = false; ["unit", { // Add unit changed EH to check if player is either virtual (logic) or a UAV AI params ["_unit"]; - GVAR(playerIsVirtual) = ((getNumber (configOf _unit >> "isPlayableLogic")) == 1) || - {(getText (configOf _unit >> "simulation")) == "UAVPilot"}; + GVAR(playerIsVirtual) = unitIsUAV _unit || {(getNumber (configOf _unit >> "isPlayableLogic")) == 1}; TRACE_3("unit changed",_unit,typeOf _unit,GVAR(playerIsVirtual)); }, true] call CBA_fnc_addPlayerEventHandler; diff --git a/addons/goggles/functions/fnc_handleFired.sqf b/addons/goggles/functions/fnc_handleFired.sqf index ea3455dcee..0c711169ef 100644 --- a/addons/goggles/functions/fnc_handleFired.sqf +++ b/addons/goggles/functions/fnc_handleFired.sqf @@ -16,7 +16,7 @@ */ //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); // no dust in rain if (rain > 0.1) exitWith {true}; diff --git a/addons/grenades/functions/fnc_throwGrenade.sqf b/addons/grenades/functions/fnc_throwGrenade.sqf index 4105e861f6..9a0168da3e 100644 --- a/addons/grenades/functions/fnc_throwGrenade.sqf +++ b/addons/grenades/functions/fnc_throwGrenade.sqf @@ -16,7 +16,7 @@ */ //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); if (_weapon != "Throw") exitWith {}; diff --git a/addons/headless/functions/fnc_transferGroups.sqf b/addons/headless/functions/fnc_transferGroups.sqf index cee85a5109..37580c4fff 100644 --- a/addons/headless/functions/fnc_transferGroups.sqf +++ b/addons/headless/functions/fnc_transferGroups.sqf @@ -132,7 +132,7 @@ private _numTransferredHC3 = 0; }; }; default { - TRACE_1("No Valid HC to transfer to", _currentHC); + TRACE_1("No Valid HC to transfer to",_currentHC); }; }; }; @@ -140,7 +140,7 @@ private _numTransferredHC3 = 0; if (XGVAR(log)) then { private _numTransferredTotal = _numTransferredHC1 + _numTransferredHC2 + _numTransferredHC3; - INFO_4("Groups Transferred: Total: %1 - HC1: %2 - HC2: %3 - HC3: %4", _numTransferredTotal, _numTransferredHC1, _numTransferredHC2, _numTransferredHC3); + INFO_4("Groups Transferred: Total: %1 - HC1: %2 - HC2: %3 - HC3: %4",_numTransferredTotal,_numTransferredHC1,_numTransferredHC2,_numTransferredHC3); }; // Allow rebalance flag diff --git a/addons/hearing/functions/fnc_addEarPlugs.sqf b/addons/hearing/functions/fnc_addEarPlugs.sqf index b73c94bf01..f467352410 100644 --- a/addons/hearing/functions/fnc_addEarPlugs.sqf +++ b/addons/hearing/functions/fnc_addEarPlugs.sqf @@ -48,7 +48,7 @@ _caliber = call { if (_ammo isKindOf ["RocketBase", (configFile >> "CfgAmmo")]) exitWith { 200 }; if (_ammo isKindOf ["MissileBase", (configFile >> "CfgAmmo")]) exitWith { 600 }; if (_ammo isKindOf ["SubmunitionBase", (configFile >> "CfgAmmo")]) exitWith { 80 }; - if (_caliber <= 0) then { 6.5 } else { _caliber }; + [_caliber, 6.5] select (_caliber <= 0); }; private _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5; diff --git a/addons/hearing/functions/fnc_firedNear.sqf b/addons/hearing/functions/fnc_firedNear.sqf index 98ee093381..0d8596f53b 100644 --- a/addons/hearing/functions/fnc_firedNear.sqf +++ b/addons/hearing/functions/fnc_firedNear.sqf @@ -27,7 +27,9 @@ params ["_object", "_firer", "_distance", "_weapon", "", "", "_ammo"]; if (_weapon in ["Throw", "Put"]) exitWith {}; if (_distance > 50) exitWith {}; -private _vehAttenuation = if ((ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player}) then {1} else {GVAR(playerVehAttenuation)}; +private _vehAttenuation = [GVAR(playerVehAttenuation), 1] select ( + (ACE_player == (vehicle ACE_player)) || {isTurnedOut ACE_player} +); private _distance = 1 max _distance; private _silencer = switch (_weapon) do { @@ -78,7 +80,7 @@ if (isNil "_loudness") then { if (_ammo isKindOf ["RocketBase", (configFile >> "CfgAmmo")]) exitWith { 200 }; if (_ammo isKindOf ["MissileBase", (configFile >> "CfgAmmo")]) exitWith { 600 }; if (_ammo isKindOf ["SubmunitionBase", (configFile >> "CfgAmmo")]) exitWith { 80 }; - if (_caliber <= 0) then { 6.5 } else { _caliber }; + [_caliber, 6.5] select (_caliber <= 0) }; _loudness = (_caliber ^ 1.25 / 10) * (_initspeed / 1000) / 5; diff --git a/addons/hellfire/functions/fnc_attackProfile.sqf b/addons/hellfire/functions/fnc_attackProfile.sqf index 28dda99086..26bc3f1ff0 100644 --- a/addons/hellfire/functions/fnc_attackProfile.sqf +++ b/addons/hellfire/functions/fnc_attackProfile.sqf @@ -93,5 +93,5 @@ if (_attackStage >= 3 && { _seekerType isEqualTo "ARH" }) then { }; }; -// TRACE_1("Adjusted target position", _returnTargetPos); +// TRACE_1("Adjusted target position",_returnTargetPos); _returnTargetPos; diff --git a/addons/hellfire/functions/fnc_getAttackProfileSettings.sqf b/addons/hellfire/functions/fnc_getAttackProfileSettings.sqf index fb12cad00f..14d89f82e3 100644 --- a/addons/hellfire/functions/fnc_getAttackProfileSettings.sqf +++ b/addons/hellfire/functions/fnc_getAttackProfileSettings.sqf @@ -31,11 +31,10 @@ private _configLaunchHeightClear = getNumber (_attackConfig >> QGVAR(launchHeigh private _startingStage = if (_configLaunchHeightClear > 0) then { STAGE_LAUNCH; // LOAL-HI / LO } else { - if (_seekerTargetPos isEqualTo [0,0,0]) then { - STAGE_SEEK_CRUISE; // LOAL-DIR - } else { - STAGE_ATTACK_CRUISE // LOBL - }; + [ + STAGE_ATTACK_CRUISE, + STAGE_SEEK_CRUISE + ] select (_seekerTargetPos isEqualTo [0,0,0]); }; // Set data in param array diff --git a/addons/huntir/functions/fnc_cam.sqf b/addons/huntir/functions/fnc_cam.sqf index 54b6516fff..c306595fc7 100644 --- a/addons/huntir/functions/fnc_cam.sqf +++ b/addons/huntir/functions/fnc_cam.sqf @@ -145,7 +145,7 @@ GVAR(no_cams) sort true; GVAR(cam) camCommit 0; ctrlSetText [1, format["%1 m", round(GVAR(pos) select 2)]]; - ctrlSetText [2, format["%1", GVAR(cur_cam) + 1]]; + ctrlSetText [2, str (GVAR(cur_cam) + 1)]; private _cam_time = CBA_missionTime - (GVAR(huntIR) getVariable [QGVAR(startTime), CBA_missionTime]); ctrlSetText [3, format["%1 s", round(_cam_time)]]; private _cam_pos = getPosVisual GVAR(huntIR); diff --git a/addons/interact_menu/functions/fnc_addActionToZeus.sqf b/addons/interact_menu/functions/fnc_addActionToZeus.sqf index b4dbb69f4a..3175bf14ad 100644 --- a/addons/interact_menu/functions/fnc_addActionToZeus.sqf +++ b/addons/interact_menu/functions/fnc_addActionToZeus.sqf @@ -19,7 +19,7 @@ if (!hasInterface) exitWith { [] }; if (!params [["_parentPath", [], [[]]], ["_action", [], [[]], 11]]) exitWith {ERROR("Bad Params"); []}; -if ((_parentPath param [0, ""]) != "ACE_ZeusActions") exitWith {ERROR_1("Bad path %1 - should have ACE_ZeusActions as base", _parentPath); []}; +if ((_parentPath param [0, ""]) != "ACE_ZeusActions") exitWith {ERROR_1("Bad path %1 - should have ACE_ZeusActions as base",_parentPath); []}; TRACE_2("addActionToZeus",_parentPath,_action); private _currentPath = GVAR(ZeusActions); @@ -37,7 +37,7 @@ private _pathValid = false; } forEach _currentPath; } forEach _parentPath; -if (!_pathValid) exitWith {ERROR_1("Bad path %1", _parentPath); []}; +if (!_pathValid) exitWith {ERROR_1("Bad path %1",_parentPath); []}; TRACE_1("Adding Action",_currentPath); _currentPath pushBack [_action, []]; diff --git a/addons/interact_menu/functions/fnc_addMainAction.sqf b/addons/interact_menu/functions/fnc_addMainAction.sqf index 86b37bf416..83349c21b3 100644 --- a/addons/interact_menu/functions/fnc_addMainAction.sqf +++ b/addons/interact_menu/functions/fnc_addMainAction.sqf @@ -27,7 +27,7 @@ if (isNil "_actionTrees") then { private _parentNode = [_actionTrees, ["ACE_MainActions"]] call FUNC(findActionNode); if (isNil {_parentNode}) then { - TRACE_2("No Main Action on object", _objectType, _typeNum); + TRACE_2("No Main Action on object",_objectType,_typeNum); private _mainAction = ["ACE_MainActions", localize ELSTRING(interaction,MainAction), "", {}, {true}] call FUNC(createAction); [_objectType, _typeNum, [], _mainAction] call EFUNC(interact_menu,addActionToClass); }; diff --git a/addons/interact_menu/functions/fnc_compileMenu.sqf b/addons/interact_menu/functions/fnc_compileMenu.sqf index 35b0ea7177..5290d8f284 100644 --- a/addons/interact_menu/functions/fnc_compileMenu.sqf +++ b/addons/interact_menu/functions/fnc_compileMenu.sqf @@ -45,7 +45,7 @@ private _recurseFnc = { private _displayName = getText (_entryCfg >> "displayName"); private _distance = _parentDistance; if (isNumber (_entryCfg >> "distance")) then {_distance = getNumber (_entryCfg >> "distance");}; - // if (_distance < _parentDistance) then {WARNING_3("[%1] distance %2 less than parent %3", configName _entryCfg, _distance, _parentDistance);}; + // if (_distance < _parentDistance) then {WARNING_3("[%1] distance %2 less than parent %3",configName _entryCfg,_distance,_parentDistance);}; private _icon = if (isArray (_entryCfg >> "icon")) then { getArray (_entryCfg >> "icon"); } else { @@ -74,7 +74,7 @@ private _recurseFnc = { if (_condition isEqualTo "") then {_condition = "true"}; } else { // Add canInteract (including exceptions) and canInteractWith to condition - private _canInteractCondition = format [QUOTE([ARR_3(ACE_player,_target,%1)] call EFUNC(common,canInteractWith)), getArray (_entryCfg >> "exceptions")]; + private _canInteractCondition = format [QUOTE([ARR_3(ACE_player,_target,%1)] call EFUNC(common,canInteractWith)),getArray (_entryCfg >> "exceptions")]; private _conditionFormatPattern = ["%1 && {%2}", "%2"] select (_condition isEqualTo "" || {_condition == "true"}); _condition = format [_conditionFormatPattern, _condition, _canInteractCondition]; }; diff --git a/addons/interact_menu/functions/fnc_createAction.sqf b/addons/interact_menu/functions/fnc_createAction.sqf index d920922ddb..ae00f4fb82 100644 --- a/addons/interact_menu/functions/fnc_createAction.sqf +++ b/addons/interact_menu/functions/fnc_createAction.sqf @@ -49,7 +49,7 @@ _position = if (_position isEqualType "") then { } else { if (_position isEqualType []) then { // If the action is set to a array position, create the suitable code - compile format ["%1", _position]; + compile str _position; } else { _position; }; diff --git a/addons/interact_menu/functions/fnc_createVehiclesActions.sqf b/addons/interact_menu/functions/fnc_createVehiclesActions.sqf index 54f92967c2..3aef7b4552 100644 --- a/addons/interact_menu/functions/fnc_createVehiclesActions.sqf +++ b/addons/interact_menu/functions/fnc_createVehiclesActions.sqf @@ -30,6 +30,6 @@ _vehicles apply { _name = format ["%1 (%2m)", _name, _distanceStr]; }; private _icon = [_x] call EFUNC(common,getVehicleIcon); - private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction); + private _action = [str _x, _name, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction); [_action, [], _target] } diff --git a/addons/interact_menu/functions/fnc_removeActionFromClass.sqf b/addons/interact_menu/functions/fnc_removeActionFromClass.sqf index 55aa0f4f82..6772b61c54 100644 --- a/addons/interact_menu/functions/fnc_removeActionFromClass.sqf +++ b/addons/interact_menu/functions/fnc_removeActionFromClass.sqf @@ -35,7 +35,7 @@ if (isNil {_parentNode}) exitWith {}; private _found = false; { if (((_x select 0) select 0) == _actionName) exitWith { - TRACE_2("Deleting Action", _forEachIndex, _x); + TRACE_2("Deleting Action",_forEachIndex,_x); _found = true; (_parentNode select 1) deleteAt _forEachIndex; }; diff --git a/addons/interact_menu/functions/fnc_renderMenu.sqf b/addons/interact_menu/functions/fnc_renderMenu.sqf index e7bb42b4cf..3aa8a05ab3 100644 --- a/addons/interact_menu/functions/fnc_renderMenu.sqf +++ b/addons/interact_menu/functions/fnc_renderMenu.sqf @@ -95,7 +95,7 @@ if (_useListMenu) then { _scaleX = _textSize * 0.17 * 1.1; _scaleY = 0.17 * 0.30 * 4/3; } else { - private _textSize = if (GVAR(textSize) > 2) then {1.3} else {1}; + private _textSIze = [1, 1.3] select (GVAR(textSize) > 2); _scaleX = _textSize * 0.17 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5); _scaleY = _textSize * 0.17 * 4/3 * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.1) max 0.5); }; diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 75e92c02c9..a5f7170588 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -136,7 +136,7 @@ GVAR(isOpeningDoor) = false; if !([ACE_player, cursorTarget] call FUNC(canTapShoulder)) exitWith {false}; //Tap whichever shoulder is closest - private _shoulderNum = [0, 1] select (([cursorTarget, ACE_player] call BIS_fnc_relativeDirTo) > 180); + private _shoulderNum = parseNumber (([cursorTarget, ACE_player] call BIS_fnc_relativeDirTo) > 180); // Statement [ACE_player, cursorTarget, _shoulderNum] call FUNC(tapShoulder); diff --git a/addons/interaction/functions/fnc_addPassengersActions.sqf b/addons/interaction/functions/fnc_addPassengersActions.sqf index 40ba9672ef..50b0d98a21 100644 --- a/addons/interaction/functions/fnc_addPassengersActions.sqf +++ b/addons/interaction/functions/fnc_addPassengersActions.sqf @@ -43,7 +43,7 @@ private _icon = ""; _actions pushBack [ [ - format ["%1", _unit], + str _unit, [_unit, true] call EFUNC(common,getName), [_icon, "#FFFFFF"], { diff --git a/addons/interaction/functions/fnc_openDoor.sqf b/addons/interaction/functions/fnc_openDoor.sqf index a03ca26c04..540712ef41 100644 --- a/addons/interaction/functions/fnc_openDoor.sqf +++ b/addons/interaction/functions/fnc_openDoor.sqf @@ -71,7 +71,7 @@ GVAR(usedScrollWheel) = false; // didn't use incremental opening. Just do animation normally. if !(GVAR(usedScrollWheel)) then { - private _phase = [0, 1] select (_house animationPhase (_animations select 0) < 0.5); + private _phase = parseNumber (_house animationPhase (_animations select 0) < 0.5); {_house animate [_x, _phase]; false} count _animations; }; diff --git a/addons/javelin/functions/fnc_mapHelperDraw.sqf b/addons/javelin/functions/fnc_mapHelperDraw.sqf index 2794d46f58..4f7ac84b4a 100644 --- a/addons/javelin/functions/fnc_mapHelperDraw.sqf +++ b/addons/javelin/functions/fnc_mapHelperDraw.sqf @@ -18,7 +18,7 @@ */ if (isNil QGVAR(arguments)) then { - TRACE_1("Starting optic draw", _this); + TRACE_1("Starting optic draw",_this); // reset shooter var: private _currentShooter = if (ACE_player call CBA_fnc_canUseWeapon) then {ACE_player} else {vehicle ACE_player}; diff --git a/addons/javelin/functions/fnc_onOpticDraw.sqf b/addons/javelin/functions/fnc_onOpticDraw.sqf index e6809a8e04..aacc4f5fa1 100644 --- a/addons/javelin/functions/fnc_onOpticDraw.sqf +++ b/addons/javelin/functions/fnc_onOpticDraw.sqf @@ -146,13 +146,13 @@ if (isNull _newTarget) then { _fireDisabledEH = [_fireDisabledEH] call FUNC(disableFire); } else { if ((!isNull _newTarget) && {_currentTarget != _newTarget}) then { - TRACE_1("New Target, reseting locking", _newTarget); + TRACE_1("New Target, reseting locking",_newTarget); _lockStartTime = CBA_missionTime; _currentTarget = _newTarget; }; if ((CBA_missionTime - _lockStartTime) > __LOCKONTIME) then { // Lock on after 3 seconds - TRACE_2("LOCKED!", _currentTarget, _lockStartTime); + TRACE_2("LOCKED!",_currentTarget,_lockStartTime); __JavelinIGUISeek ctrlSetTextColor __ColorGreen; __JavelinIGUITargetingLines ctrlShow true; diff --git a/addons/kestrel4500/functions/fnc_generateOutputData.sqf b/addons/kestrel4500/functions/fnc_generateOutputData.sqf index 2143904f80..59bb3056dd 100644 --- a/addons/kestrel4500/functions/fnc_generateOutputData.sqf +++ b/addons/kestrel4500/functions/fnc_generateOutputData.sqf @@ -93,7 +93,7 @@ if (GVAR(referenceHeadingMenu) == 0) then { }; case 1: { // Direction if (!GVAR(MinAvgMax)) then { - _textCenterBig = format["%1", format["%1 %2", GVAR(Directions) select GVAR(Direction), round(_playerDir)]]; + _textCenterBig = format["%1 %2", GVAR(Directions) select GVAR(Direction), round(_playerDir)]; } else { _textCenterLine1Left = "Min"; _textCenterLine2Left = "Avg"; diff --git a/addons/laser/XEH_PREP.hpp b/addons/laser/XEH_PREP.hpp index 9b9be64752..2d26ff81f2 100644 --- a/addons/laser/XEH_PREP.hpp +++ b/addons/laser/XEH_PREP.hpp @@ -3,6 +3,7 @@ PREP(addLaserTarget); PREP(addMapHandler); PREP(dev_drawVisibleLaserTargets); PREP(findLaserSource); +PREP(getLaserCode); PREP(handleLaserTargetCreation); PREP(keyLaserCodeChange); PREP(laserOff); @@ -13,6 +14,7 @@ PREP(onLaserDesignatorDraw); PREP(rotateVectLine); PREP(rotateVectLineGetMap); PREP(seekerFindLaserSpot); +PREP(setLaserCode); PREP(shootCone); PREP(shootRay); PREP(showVehicleHud); diff --git a/addons/laser/functions/fnc_getLaserCode.sqf b/addons/laser/functions/fnc_getLaserCode.sqf new file mode 100644 index 0000000000..0a0fce363f --- /dev/null +++ b/addons/laser/functions/fnc_getLaserCode.sqf @@ -0,0 +1,24 @@ +#include "..\script_component.hpp" +/* + * Author: johnb43 + * Gets the laser code of a laser source. + * + * Argument: + * 0: Laser source + * + * Return Value: + * Laser code + * + * Example: + * player call ace_laser_fnc_getLaserCode; + * + * Public: Yes + */ + +params [["_laserSource", objNull, [objNull]]]; + +if (isNull _laserSource) exitWith { + -1 +}; + +_laserSource getVariable [QGVAR(code), ACE_DEFAULT_LASER_CODE] diff --git a/addons/laser/functions/fnc_handleLaserTargetCreation.sqf b/addons/laser/functions/fnc_handleLaserTargetCreation.sqf index b8cedf22c3..bd42a3e5a5 100644 --- a/addons/laser/functions/fnc_handleLaserTargetCreation.sqf +++ b/addons/laser/functions/fnc_handleLaserTargetCreation.sqf @@ -24,13 +24,13 @@ TRACE_1("params",_this); private _owners = allUnits select {(lasertarget _x) == _targetObject}; if (count _owners == 1) exitWith { - TRACE_2("Laser target owner [allUnits]", _targetObject, _owners select 0); + TRACE_2("Laser target owner [allUnits]",_targetObject,_owners select 0); [_targetObject, _owners select 0] call FUNC(addLaserTarget); }; _owners = vehicles select {(lasertarget _x) == _targetObject}; if (count _owners == 1) exitWith { - TRACE_2("Laser target owner [vehicles]", _targetObject, _owners select 0); + TRACE_2("Laser target owner [vehicles]",_targetObject,_owners select 0); [_targetObject, _owners select 0] call FUNC(addLaserTarget); }; @@ -58,7 +58,7 @@ TRACE_1("params",_this); }; }; if (!_foundSource) then { - WARNING_1("Laser target doesn't have owner", _targetObject); + WARNING_1("Laser target doesn't have owner",_targetObject); }; }, _this] call CBA_fnc_execNextFrame; diff --git a/addons/laser/functions/fnc_laserTargetPFH.sqf b/addons/laser/functions/fnc_laserTargetPFH.sqf index 5c5f51931b..0b19b4d1c3 100644 --- a/addons/laser/functions/fnc_laserTargetPFH.sqf +++ b/addons/laser/functions/fnc_laserTargetPFH.sqf @@ -26,7 +26,7 @@ GVAR(trackedLaserTargets) = GVAR(trackedLaserTargets) select { // Turn off the laser in ace_laser [_laserUuid] call FUNC(laserOff); - TRACE_1("Laser off:", _laserUuid); + TRACE_1("Laser off:",_laserUuid); false } else { private _newCode = _owner getVariable [QEGVAR(laser,code), ACE_DEFAULT_LASER_CODE]; diff --git a/addons/laser/functions/fnc_seekerFindLaserSpot.sqf b/addons/laser/functions/fnc_seekerFindLaserSpot.sqf index 9d3e2d6fa1..d1e4626d53 100644 --- a/addons/laser/functions/fnc_seekerFindLaserSpot.sqf +++ b/addons/laser/functions/fnc_seekerFindLaserSpot.sqf @@ -101,7 +101,7 @@ private _finalOwner = objNull; }; } forEach (values GVAR(laserEmitters)); // Go through all values in hash -TRACE_2("",count _spots, _spots); +TRACE_2("",count _spots,_spots); if ((count _spots) > 0) then { private _bucketList = nil; diff --git a/addons/laser/functions/fnc_setLaserCode.sqf b/addons/laser/functions/fnc_setLaserCode.sqf new file mode 100644 index 0000000000..23f7e5c82f --- /dev/null +++ b/addons/laser/functions/fnc_setLaserCode.sqf @@ -0,0 +1,21 @@ +#include "..\script_component.hpp" +/* + * Author: johnb43 + * Sets the laser code on a laser source. + * + * Argument: + * 0: Laser source + * 1: Laser code + * + * Return Value: + * None + * + * Example: + * [player, 1111] call ace_laser_fnc_setLaserCode; + * + * Public: Yes + */ + +params [["_laserSource", objNull, [objNull]], ["_laserCode", ACE_DEFAULT_LASER_CODE, [0]]]; + +_laserSource setVariable [QGVAR(code), _laserCode, true]; diff --git a/addons/laser/functions/fnc_shootRay.sqf b/addons/laser/functions/fnc_shootRay.sqf index 434560eea7..862e972dd1 100644 --- a/addons/laser/functions/fnc_shootRay.sqf +++ b/addons/laser/functions/fnc_shootRay.sqf @@ -21,7 +21,7 @@ BEGIN_COUNTER(shootRay); params ["_posASL", "_dir", ["_ignoreVehicle1", objNull], ["_ignoreVehicle2", objNull]]; -// TRACE_2("ray origin:", _posASL, _dir); +// TRACE_2("ray origin:",_posASL,_dir); private _distance = 0; private _resultPos = nil; @@ -43,7 +43,7 @@ if (_intersects isNotEqualTo []) then { _resultPos = _posASL vectorAdd (_dir vectorMultiply _distance); }; -TRACE_3("", _resultPos, _distance, _intersects); +TRACE_3("",_resultPos,_distance,_intersects); #ifdef DRAW_LASER_INFO if (!isNil "_resultPos") then { diff --git a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf index 46e38acb90..2176793aed 100644 --- a/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_cutDownFence.sqf @@ -22,7 +22,10 @@ TRACE_2("Fence cutting started",_unit,_fence); if (_unit != ACE_player) exitWith {}; // Get cut time based on if unit is a engineer -private _cutTime = if (_unit call EFUNC(common,isEngineer)) then {CUT_TIME_ENGINEER} else {CUT_TIME_DEFAULT}; +private _cutTime = [ + CUT_TIME_DEFAULT, + CUT_TIME_ENGINEER +] select (_unit call EFUNC(common,isEngineer)); if !(_unit call EFUNC(common,isSwimming)) then { [_unit, "AinvPknlMstpSnonWnonDr_medic5", 0] call EFUNC(common,doAnimation); diff --git a/addons/main/script_version.hpp b/addons/main/script_version.hpp index e233476016..c94b9e6193 100644 --- a/addons/main/script_version.hpp +++ b/addons/main/script_version.hpp @@ -1,4 +1,4 @@ #define MAJOR 3 #define MINOR 16 -#define PATCHLVL 1 -#define BUILD 74 +#define PATCHLVL 3 +#define BUILD 79 diff --git a/addons/map/XEH_postInitClient.sqf b/addons/map/XEH_postInitClient.sqf index 56b2b560f4..49b8239e0a 100644 --- a/addons/map/XEH_postInitClient.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -19,9 +19,9 @@ GVAR(flashlights) = [] call CBA_fnc_createNamespace; setCurrentChannel GVAR(DefaultChannel); if (currentChannel == GVAR(DefaultChannel)) then { - // INFO_1("Channel Set - %1", currentChannel); + // INFO_1("Channel Set - %1",currentChannel); } else { - ERROR_2("Failed To Set Channel %1 (is %2)", GVAR(DefaultChannel), currentChannel); + ERROR_2("Failed To Set Channel %1 (is %2)",GVAR(DefaultChannel),currentChannel); }; }, 0, []] call CBA_fnc_addPerFrameHandler; }; diff --git a/addons/map/functions/fnc_blueForceTrackingModule.sqf b/addons/map/functions/fnc_blueForceTrackingModule.sqf index f7436e7bf9..af95ce3d6d 100644 --- a/addons/map/functions/fnc_blueForceTrackingModule.sqf +++ b/addons/map/functions/fnc_blueForceTrackingModule.sqf @@ -22,4 +22,4 @@ params ["_logic"]; [_logic, QGVAR(BFT_HideAiGroups), "HideAiGroups"] call EFUNC(common,readSettingFromModule); [_logic, QGVAR(BFT_ShowPlayerNames), "ShowPlayerNames"] call EFUNC(common,readSettingFromModule); -INFO_3("Blue Force Tracking Module Initialized:", GVAR(BFT_Enabled), GVAR(BFT_Interval), GVAR(BFT_HideAiGroups)); +INFO_3("Blue Force Tracking Module Initialized:",GVAR(BFT_Enabled),GVAR(BFT_Interval),GVAR(BFT_HideAiGroups)); diff --git a/addons/maptools/CfgEventHandlers.hpp b/addons/maptools/CfgEventHandlers.hpp index db25394390..bff1c64e94 100644 --- a/addons/maptools/CfgEventHandlers.hpp +++ b/addons/maptools/CfgEventHandlers.hpp @@ -1,4 +1,3 @@ - class Extended_PreStart_EventHandlers { class ADDON { init = QUOTE(call COMPILE_SCRIPT(XEH_preStart)); diff --git a/addons/maptools/CfgVehicles.hpp b/addons/maptools/CfgVehicles.hpp index 3f59f23c6f..0757aafc51 100644 --- a/addons/maptools/CfgVehicles.hpp +++ b/addons/maptools/CfgVehicles.hpp @@ -92,7 +92,7 @@ class CfgVehicles { }; class ACE_PlottingBoard { displayName = CSTRING(ShowPlottingBoard); - condition = QUOTE(GVAR(plottingBoard_Shown) < 1 && {call FUNC(canUsePlottingBoard)}); + condition = QUOTE(GVAR(plottingBoard_Shown) == 0 && {call FUNC(canUsePlottingBoard)}); statement = QUOTE(GVAR(plottingBoard_Shown) = 1); EXCEPTIONS; showDisabled = 0; @@ -127,7 +127,7 @@ class CfgVehicles { }; class ACE_PlottingBoardAlign { displayName = CSTRING(AlignTo); - condition = QUOTE(GVAR(plottingBoard_Shown) > 0); + condition = QUOTE(GVAR(plottingBoard_Shown) != 0); statement = ""; EXCEPTIONS; showDisabled = 0; @@ -141,7 +141,7 @@ class CfgVehicles { class ACE_PlottingBoardAlignBoardMaptool { displayName = CSTRING(ToMapToolLabel); - condition = QUOTE(GVAR(mapTool_Shown) > 0 && GVAR(plottingBoard_angle) != GVAR(mapTool_angle)); + condition = QUOTE(GVAR(mapTool_Shown) != 0 && GVAR(plottingBoard_angle) != GVAR(mapTool_angle)); statement = QUOTE(GVAR(plottingBoard_angle) = GVAR(mapTool_angle)); EXCEPTIONS; showDisabled = 0; @@ -163,7 +163,7 @@ class CfgVehicles { class ACE_PlottingBoardAlignAcrylicMaptool { displayName = CSTRING(ToMapToolLabel); - condition = QUOTE(GVAR(mapTool_Shown) > 0 && GVAR(plottingBoard_acrylicAngle) != GVAR(mapTool_angle)); + condition = QUOTE(GVAR(mapTool_Shown) != 0 && GVAR(plottingBoard_acrylicAngle) != GVAR(mapTool_angle)); statement = QUOTE(GVAR(plottingBoard_acrylicAngle) = GVAR(mapTool_angle)); EXCEPTIONS; showDisabled = 0; @@ -185,7 +185,7 @@ class CfgVehicles { class ACE_PlottingBoardAlignRulerMaptool { displayName = CSTRING(ToMapToolLabel); - condition = QUOTE(GVAR(mapTool_Shown) > 0 && GVAR(plottingBoard_rulerAngle) != GVAR(mapTool_angle)); + condition = QUOTE(GVAR(mapTool_Shown) != 0 && GVAR(plottingBoard_rulerAngle) != GVAR(mapTool_angle)); statement = QUOTE(GVAR(plottingBoard_rulerAngle) = GVAR(mapTool_angle)); EXCEPTIONS; showDisabled = 0; diff --git a/addons/maptools/XEH_postInitClient.sqf b/addons/maptools/XEH_postInitClient.sqf index a1b8afd08d..5ce1e68892 100644 --- a/addons/maptools/XEH_postInitClient.sqf +++ b/addons/maptools/XEH_postInitClient.sqf @@ -25,13 +25,16 @@ GVAR(plottingBoard_isRotating) = -1; GVAR(plottingBoard_moveToMouse) = true; // used to display it in center of screen when opened GVAR(plottingBoard_markers) = createHashMap; -//Install the event handers for the map tools on the main in-game map -[{!isNull findDisplay 12}, -{ - ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseMoving", {_this call FUNC(handleMouseMove);}]; - ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}]; - ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}]; - ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", {call FUNC(updateMapToolMarkers); call FUNC(openMapGpsUpdate);}]; +// Install the event handers for the map tools on the main in-game map +[{ + !isNull findDisplay 12 +}, { + private _map = (findDisplay 12) displayCtrl 51; + + _map ctrlAddEventHandler ["MouseMoving", LINKFUNC(handleMouseMove)]; + _map ctrlAddEventHandler ["MouseButtonDown", {[1, _this] call FUNC(handleMouseButton);}]; + _map ctrlAddEventHandler ["MouseButtonUp", {[0, _this] call FUNC(handleMouseButton)}]; + _map ctrlAddEventHandler ["Draw", {call FUNC(updateMapToolMarkers); call FUNC(openMapGpsUpdate);}]; }, []] call CBA_fnc_waitUntilAndExecute; ["visibleMap", { diff --git a/addons/maptools/functions/fnc_calculateMapScale.sqf b/addons/maptools/functions/fnc_calculateMapScale.sqf index 667ee5ff5d..7c868d200a 100644 --- a/addons/maptools/functions/fnc_calculateMapScale.sqf +++ b/addons/maptools/functions/fnc_calculateMapScale.sqf @@ -1,21 +1,22 @@ #include "..\script_component.hpp" /* * Author: esteldunedain - * Returns the equivalent of 100m in screen coordinates + * Returns the equivalent of 100m in screen coordinates. * * Arguments: * None * * Return Value: - * None + * Map scale * * Example: - * call ACE_maptools_fnc_calculateMapScale + * call ace_maptools_fnc_calculateMapScale * * Public: No */ -private _pos = ((findDisplay 12) displayCtrl 51) ctrlMapScreenToWorld [0.5, 0.5]; -private _screenOffset = ((findDisplay 12) displayCtrl 51) posWorldToScreen [(_pos select 0) + 100, (_pos select 1)]; +private _mapCtrl = (findDisplay 12) displayCtrl 51; +private _pos = _mapCtrl ctrlMapScreenToWorld [0.5, 0.5]; +private _screenOffset = _mapCtrl posWorldToScreen (_pos vectorAdd [100, 0]); (_screenOffset select 0) - 0.5 diff --git a/addons/maptools/functions/fnc_canUseMapGPS.sqf b/addons/maptools/functions/fnc_canUseMapGPS.sqf index 1d28af74f6..317eee6c42 100644 --- a/addons/maptools/functions/fnc_canUseMapGPS.sqf +++ b/addons/maptools/functions/fnc_canUseMapGPS.sqf @@ -1,16 +1,16 @@ #include "..\script_component.hpp" /* * Author: esteldunedain - * canUseMapGPS + * Returns if the GPS on the map can be used. * * Arguments: * None * * Return Value: - * Boolean + * GPS can be used * * Example: - * call ACE_maptools_fnc_canUseMapGPS + * call ace_maptools_fnc_canUseMapGPS * * Public: No */ diff --git a/addons/maptools/functions/fnc_canUseMapTools.sqf b/addons/maptools/functions/fnc_canUseMapTools.sqf index ef45c9a527..8eb918dfdc 100644 --- a/addons/maptools/functions/fnc_canUseMapTools.sqf +++ b/addons/maptools/functions/fnc_canUseMapTools.sqf @@ -1,23 +1,23 @@ #include "..\script_component.hpp" /* * Author: esteldunedain - * canUseMapTools + * Returns if the map tools can be used. * * Arguments: * None * * Return Value: - * Boolean + * Map tools can be used * * Example: - * call ACE_maptools_fnc_canUseMapTools + * call ace_maptools_fnc_canUseMapTools * * Public: No */ visibleMap && {alive ACE_player} && -{"ACE_MapTools" in (ACE_player call EFUNC(common,uniqueItems))} && {!GVAR(mapTool_isDragging)} && {!GVAR(mapTool_isRotating)} && -{getUnitLoadout ACE_player param [9, []] param [0, ""] != ""} +{ACE_player getSlotItemName TYPE_MAP != ""} && +{[ACE_player, "ACE_MapTools"] call EFUNC(common,hasItem)} diff --git a/addons/maptools/functions/fnc_canUsePlottingBoard.sqf b/addons/maptools/functions/fnc_canUsePlottingBoard.sqf index d3394916f1..9dfd2bf6b5 100644 --- a/addons/maptools/functions/fnc_canUsePlottingBoard.sqf +++ b/addons/maptools/functions/fnc_canUsePlottingBoard.sqf @@ -17,6 +17,6 @@ visibleMap && {alive ACE_player} && -{[ACE_player, "ACE_PlottingBoard"] call EFUNC(common,hasItem)} && {!GVAR(plottingBoard_isDragging)} && -{GVAR(plottingBoard_isRotating) == -1} +{GVAR(plottingBoard_isRotating) == -1} && +{[ACE_player, "ACE_PlottingBoard"] call EFUNC(common,hasItem)} diff --git a/addons/maptools/functions/fnc_drawLinesOnRoamer.sqf b/addons/maptools/functions/fnc_drawLinesOnRoamer.sqf index 722f96468e..782d8762a0 100644 --- a/addons/maptools/functions/fnc_drawLinesOnRoamer.sqf +++ b/addons/maptools/functions/fnc_drawLinesOnRoamer.sqf @@ -4,63 +4,71 @@ * Prevents the cursor from entering the roamer when drawing lines and records the positions * * Arguments: - * 0: The Map + * 0: Map control * 1: Roamer Width * * Return Value: * None * * Example: - * [map, 300] call ace_maptools_fnc_drawLinesOnRoamer + * [CONTROL, 300] call ace_maptools_fnc_drawLinesOnRoamer * * Public: No */ if (!GVAR(drawStraightLines)) exitWith {}; -params ["_theMap", "_roamerWidth"]; +params ["_mapCtrl", "_roamerWidth"]; GVAR(mapTool_pos) params ["_roamerPosX", "_roamerPosY"]; private _posCenter = [_roamerPosX, _roamerPosY, 0]; private _posTopRight = [ -_roamerPosX + (cos GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (sin GVAR(mapTool_angle)) * DIST_TOP_TO_CENTER_PERC * _roamerWidth, -_roamerPosY + (-sin GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (cos GVAR(mapTool_angle)) * DIST_TOP_TO_CENTER_PERC * _roamerWidth, -0]; + _roamerPosX + (cos GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (sin GVAR(mapTool_angle)) * DIST_TOP_TO_CENTER_PERC * _roamerWidth, + _roamerPosY + (-sin GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (cos GVAR(mapTool_angle)) * DIST_TOP_TO_CENTER_PERC * _roamerWidth, + 0 +]; private _posTopLeft = [ -_roamerPosX + (-cos GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (sin GVAR(mapTool_angle)) * DIST_TOP_TO_CENTER_PERC * _roamerWidth, -_roamerPosY + (sin GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (cos GVAR(mapTool_angle)) * DIST_TOP_TO_CENTER_PERC * _roamerWidth, -0]; + _roamerPosX + (-cos GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (sin GVAR(mapTool_angle)) * DIST_TOP_TO_CENTER_PERC * _roamerWidth, + _roamerPosY + (sin GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (cos GVAR(mapTool_angle)) * DIST_TOP_TO_CENTER_PERC * _roamerWidth, + 0 +]; private _posBottomLeft = [ -_roamerPosX + (-cos GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (sin GVAR(mapTool_angle)) * DIST_BOTTOM_TO_CENTER_PERC * _roamerWidth, -_roamerPosY + (sin GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (cos GVAR(mapTool_angle)) * DIST_BOTTOM_TO_CENTER_PERC * _roamerWidth, -0]; + _roamerPosX + (-cos GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (sin GVAR(mapTool_angle)) * DIST_BOTTOM_TO_CENTER_PERC * _roamerWidth, + _roamerPosY + (sin GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (cos GVAR(mapTool_angle)) * DIST_BOTTOM_TO_CENTER_PERC * _roamerWidth, + 0 +]; private _posBottomRight = [ -_roamerPosX + (cos GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (sin GVAR(mapTool_angle)) * DIST_BOTTOM_TO_CENTER_PERC * _roamerWidth, -_roamerPosY + (-sin GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (cos GVAR(mapTool_angle)) * DIST_BOTTOM_TO_CENTER_PERC * _roamerWidth, -0]; + _roamerPosX + (cos GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (sin GVAR(mapTool_angle)) * DIST_BOTTOM_TO_CENTER_PERC * _roamerWidth, + _roamerPosY + (-sin GVAR(mapTool_angle)) * DIST_LEFT_TO_CENTER_PERC * _roamerWidth + (cos GVAR(mapTool_angle)) * DIST_BOTTOM_TO_CENTER_PERC * _roamerWidth, + 0 +]; -private _fnc_Distance = { // Get distance point _p is from a line made from _a to _b (uses 3d array commands, but z should be 0) +private _fnc_distance = { // Get distance point _p is from a line made from _a to _b (uses 3d array commands, but z should be 0) // Ref: https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line#Vector_formulation params ["_a", "_b", "_p"]; + private _n = _b vectorDiff _a; private _pa = _a vectorDiff _p; private _c = _n vectorMultiply ((_pa vectorDotProduct _n) / (_n vectorDotProduct _n)); private _d = _pa vectorDiff _c; - sqrt (_d vectorDotProduct _d); + + sqrt (_d vectorDotProduct _d) }; -private _currentMousePos = _theMap ctrlMapScreenToWorld getMousePosition; +private _currentMousePos = _mapCtrl ctrlMapScreenToWorld getMousePosition; _currentMousePos set [2, 0]; // Break the roamer rectangle into 4 triangle, one for each side switch (true) do { case (_currentMousePos inPolygon [_posCenter, _posTopLeft, _posBottomLeft]): { // Left - private _distanceToRoamerLine = ([_posTopLeft, _posBottomLeft, _currentMousePos] call _fnc_Distance); - _currentMousePos = _currentMousePos vectorAdd ([_distanceToRoamerLine, (GVAR(mapTool_angle) - 90) ,0] call CBA_fnc_polar2vect); + private _distanceToRoamerLine = [_posTopLeft, _posBottomLeft, _currentMousePos] call _fnc_distance; + + _currentMousePos = _currentMousePos vectorAdd ([_distanceToRoamerLine, GVAR(mapTool_angle) - 90, 0] call CBA_fnc_polar2vect); + if (GVAR(freeDrawingData) isEqualTo []) then { // We start drawing on the line GVAR(freeDrawingData) = ["left", _currentMousePos, _currentMousePos]; } else { @@ -68,17 +76,21 @@ switch (true) do { if ((_currentMousePos distance2d _posTopLeft) < ((GVAR(freeDrawingData) select 1) distance2d _posTopLeft)) then { GVAR(freeDrawingData) set [1, _currentMousePos]; }; + if ((_currentMousePos distance2d _posBottomLeft) < ((GVAR(freeDrawingData) select 2) distance2d _posBottomLeft)) then { GVAR(freeDrawingData) set [2, _currentMousePos]; }; }; }; - private _screenPosOfCorrectedPos = _theMap ctrlMapWorldToScreen _currentMousePos; + + private _screenPosOfCorrectedPos = _mapCtrl ctrlMapWorldToScreen _currentMousePos; setMousePosition _screenPosOfCorrectedPos; }; case (_currentMousePos inPolygon [_posCenter, _posTopLeft, _posTopRight]): { // Top - private _distanceToRoamerLine = ([_posTopLeft, _posTopRight, _currentMousePos] call _fnc_Distance); - _currentMousePos = _currentMousePos vectorAdd ([_distanceToRoamerLine, (GVAR(mapTool_angle) + 0) ,0] call CBA_fnc_polar2vect); + private _distanceToRoamerLine = [_posTopLeft, _posTopRight, _currentMousePos] call _fnc_distance; + + _currentMousePos = _currentMousePos vectorAdd ([_distanceToRoamerLine, GVAR(mapTool_angle), 0] call CBA_fnc_polar2vect); + if (GVAR(freeDrawingData) isEqualTo []) then { // We start drawing on the line GVAR(freeDrawingData) = ["top", _currentMousePos, _currentMousePos]; } else { @@ -86,17 +98,21 @@ switch (true) do { if ((_currentMousePos distance2d _posTopLeft) < ((GVAR(freeDrawingData) select 1) distance2d _posTopLeft)) then { GVAR(freeDrawingData) set [1, _currentMousePos]; }; + if ((_currentMousePos distance2d _posTopRight) < ((GVAR(freeDrawingData) select 2) distance2d _posTopRight)) then { GVAR(freeDrawingData) set [2, _currentMousePos]; }; }; }; - private _screenPosOfCorrectedPos = _theMap ctrlMapWorldToScreen _currentMousePos; + + private _screenPosOfCorrectedPos = _mapCtrl ctrlMapWorldToScreen _currentMousePos; setMousePosition _screenPosOfCorrectedPos; }; case (_currentMousePos inPolygon [_posCenter, _posTopRight, _posBottomRight]): { // Right - private _distanceToRoamerLine = ([_posTopRight, _posBottomRight, _currentMousePos] call _fnc_Distance); - _currentMousePos = _currentMousePos vectorAdd ([_distanceToRoamerLine, (GVAR(mapTool_angle) + 90) ,0] call CBA_fnc_polar2vect); + private _distanceToRoamerLine = [_posTopRight, _posBottomRight, _currentMousePos] call _fnc_distance; + + _currentMousePos = _currentMousePos vectorAdd ([_distanceToRoamerLine, GVAR(mapTool_angle) + 90, 0] call CBA_fnc_polar2vect); + if (GVAR(freeDrawingData) isEqualTo []) then { // We start drawing on the line GVAR(freeDrawingData) = ["right", _currentMousePos, _currentMousePos]; } else { @@ -104,17 +120,21 @@ switch (true) do { if ((_currentMousePos distance2d _posTopRight) < ((GVAR(freeDrawingData) select 1) distance2d _posTopRight)) then { GVAR(freeDrawingData) set [1, _currentMousePos]; }; + if ((_currentMousePos distance2d _posBottomRight) < ((GVAR(freeDrawingData) select 2) distance2d _posBottomRight)) then { GVAR(freeDrawingData) set [2, _currentMousePos]; }; }; }; - private _screenPosOfCorrectedPos = _theMap ctrlMapWorldToScreen _currentMousePos; + + private _screenPosOfCorrectedPos = _mapCtrl ctrlMapWorldToScreen _currentMousePos; setMousePosition _screenPosOfCorrectedPos; }; case (_currentMousePos inPolygon [_posCenter, _posBottomLeft, _posBottomRight]): { // Bottom - private _distanceToRoamerLine = ([_posBottomLeft, _posBottomRight, _currentMousePos] call _fnc_Distance); - _currentMousePos = _currentMousePos vectorAdd ([_distanceToRoamerLine, (GVAR(mapTool_angle) + 180) ,0] call CBA_fnc_polar2vect); + private _distanceToRoamerLine = [_posBottomLeft, _posBottomRight, _currentMousePos] call _fnc_distance; + + _currentMousePos = _currentMousePos vectorAdd ([_distanceToRoamerLine, GVAR(mapTool_angle) + 180, 0] call CBA_fnc_polar2vect); + if (GVAR(freeDrawingData) isEqualTo []) then { // We start drawing on the line GVAR(freeDrawingData) = ["bottom", _currentMousePos, _currentMousePos]; } else { @@ -122,23 +142,26 @@ switch (true) do { if ((_currentMousePos distance2d _posBottomLeft) < ((GVAR(freeDrawingData) select 1) distance2d _posBottomLeft)) then { GVAR(freeDrawingData) set [1, _currentMousePos]; }; + if ((_currentMousePos distance2d _posBottomRight) < ((GVAR(freeDrawingData) select 2) distance2d _posBottomRight)) then { GVAR(freeDrawingData) set [2, _currentMousePos]; }; }; }; - private _screenPosOfCorrectedPos = _theMap ctrlMapWorldToScreen _currentMousePos; + + private _screenPosOfCorrectedPos = _mapCtrl ctrlMapWorldToScreen _currentMousePos; setMousePosition _screenPosOfCorrectedPos; }; }; #ifdef DEBUG_MODE_FULL -_theMap drawIcon ['iconStaticMG',[1,0,0,1],_posTopRight,24,24,getDir player,'1,1',1,0.03,'TahomaB','right']; -_theMap drawIcon ['iconStaticMG',[1,0,0,1],_posTopLeft,24,24,getDir player,'-1,1',1,0.03,'TahomaB','right']; -_theMap drawIcon ['iconStaticMG',[1,0,0,1],_posBottomLeft,24,24,getDir player,'-1,-1',1,0.03,'TahomaB','right']; -_theMap drawIcon ['iconStaticMG',[1,0,0,1],_posBottomRight,24,24,getDir player,'1,-1',1,0.03,'TahomaB','right']; +_mapCtrl drawIcon ['iconStaticMG',[1,0,0,1],_posTopRight,24,24,getDir player,'1,1',1,0.03,'TahomaB','right']; +_mapCtrl drawIcon ['iconStaticMG',[1,0,0,1],_posTopLeft,24,24,getDir player,'-1,1',1,0.03,'TahomaB','right']; +_mapCtrl drawIcon ['iconStaticMG',[1,0,0,1],_posBottomLeft,24,24,getDir player,'-1,-1',1,0.03,'TahomaB','right']; +_mapCtrl drawIcon ['iconStaticMG',[1,0,0,1],_posBottomRight,24,24,getDir player,'1,-1',1,0.03,'TahomaB','right']; + if (GVAR(freeDrawingData) isNotEqualTo []) then { - _theMap drawIcon ['iconStaticMG',[0,0,1,1],GVAR(freeDrawingData) select 1,24,24,getDir player,'1,-1',1,0.03,'TahomaB','right']; - _theMap drawIcon ['iconStaticMG',[0,0,1,1],GVAR(freeDrawingData) select 2,24,24,getDir player,'1,-1',1,0.03,'TahomaB','right']; + _mapCtrl drawIcon ['iconStaticMG',[0,0,1,1],GVAR(freeDrawingData) select 1,24,24,getDir player,'1,-1',1,0.03,'TahomaB','right']; + _mapCtrl drawIcon ['iconStaticMG',[0,0,1,1],GVAR(freeDrawingData) select 2,24,24,getDir player,'1,-1',1,0.03,'TahomaB','right']; }; #endif diff --git a/addons/maptools/functions/fnc_handleMouseButton.sqf b/addons/maptools/functions/fnc_handleMouseButton.sqf index 796a84744a..5c35c699d7 100644 --- a/addons/maptools/functions/fnc_handleMouseButton.sqf +++ b/addons/maptools/functions/fnc_handleMouseButton.sqf @@ -8,7 +8,7 @@ * 1: Parameters of the mouse button event * * Return Value: - * True if event was handled + * None * * Example: * [0, []] call ace_maptools_fnc_handleMouseButton @@ -80,13 +80,11 @@ if (_dir != 1) then { if (GVAR(mapTool_isDragging) || GVAR(mapTool_isRotating)) then { GVAR(mapTool_isDragging) = false; GVAR(mapTool_isRotating) = false; - _handled = true; }; if (GVAR(plottingBoard_isDragging) || GVAR(plottingBoard_isRotating) > -1) then { GVAR(plottingBoard_isDragging) = false; GVAR(plottingBoard_isRotating) = -1; - _handled = true; }; } else { // If clicking @@ -125,8 +123,6 @@ if (_dir != 1) then { // Start dragging GVAR(mapTool_isDragging) = true; }; - - _handled = true; }; }; }; @@ -170,11 +166,7 @@ if (_dir != 1) then { // Start dragging GVAR(plottingBoard_isDragging) = true; }; - - _handled = true; }; }; }; }; - -_handled diff --git a/addons/maptools/functions/fnc_handleMouseMove.sqf b/addons/maptools/functions/fnc_handleMouseMove.sqf index 37c6cf4d21..3092d2d532 100644 --- a/addons/maptools/functions/fnc_handleMouseMove.sqf +++ b/addons/maptools/functions/fnc_handleMouseMove.sqf @@ -5,10 +5,11 @@ * * Arguments: * 0: Map control - * 1: Mouse position on screen coordinates + * 1: Mouse x position + * 2: Mouse y position * * Return Value: - * If the event was handled + * None * * Example: * [CONTROL, [0, 5]] call ace_maptools_fnc_handleMouseMove @@ -24,9 +25,7 @@ if (isNull ACE_player || { private _uniqueItems = ACE_player call EFUNC(common,uniqueItems); !(("ACE_MapTools" in _uniqueItems) || {"ACE_PlottingBoard" in _uniqueItems}) -}) exitWith { - false -}; +}) exitWith {}; // If map tools not shown, then exit if (GVAR(mapTool_Shown) == 0 && {GVAR(plottingBoard_Shown) == 0}) exitWith {false}; @@ -36,8 +35,6 @@ private _mousePosition = _mapCtrl ctrlMapScreenToWorld [_mousePosX, _mousePosY]; // Map tools - translation if (GVAR(mapTool_isDragging)) exitWith { GVAR(mapTool_pos) = GVAR(mapTool_startPos) vectorAdd _mousePosition vectorDiff GVAR(mapTool_startDragPos); - - true }; // Map tools - rotation @@ -47,15 +44,11 @@ if (GVAR(mapTool_isRotating)) exitWith { private _angle = (_pos select 0) atan2 (_pos select 1); GVAR(mapTool_angle) = ((GVAR(mapTool_startAngle) + _angle - GVAR(mapTool_startDragAngle)) % 360 + 360) % 360; - - true }; // Plotting board - translation if (GVAR(plottingBoard_isDragging)) exitWith { GVAR(plottingBoard_pos) = GVAR(plottingBoard_startPos) vectorAdd _mousePosition vectorDiff GVAR(plottingBoard_startDragPos); - - true }; // Plotting board - rotation @@ -70,8 +63,4 @@ if (GVAR(plottingBoard_isRotating) > -1) exitWith { case 1: {GVAR(plottingBoard_acrylicAngle) = _returnAngle}; case 2: {GVAR(plottingBoard_rulerAngle) = _returnAngle}; }; - - true }; - -false diff --git a/addons/maptools/functions/fnc_handlePlottingBoardMarkers.sqf b/addons/maptools/functions/fnc_handlePlottingBoardMarkers.sqf index b73bfb7dc4..b7a0c7657a 100644 --- a/addons/maptools/functions/fnc_handlePlottingBoardMarkers.sqf +++ b/addons/maptools/functions/fnc_handlePlottingBoardMarkers.sqf @@ -30,7 +30,7 @@ if (_deleted) exitWith { }; // Do not process non-local or already processed markers, don't check if the plotting board isn't shown -if (!_local || {GVAR(plottingBoard_Shown) < 1} || {QUOTE(ADDON) in _marker}) exitWith {}; +if (!_local || {GVAR(plottingBoard_Shown) == 0} || {QUOTE(ADDON) in _marker}) exitWith {}; // Check if the channel the marker was made in can be marked on the plotting board private _continue = true; diff --git a/addons/maptools/functions/fnc_isInsideMapTool.sqf b/addons/maptools/functions/fnc_isInsideMapTool.sqf index f6c633d885..ad80357411 100644 --- a/addons/maptools/functions/fnc_isInsideMapTool.sqf +++ b/addons/maptools/functions/fnc_isInsideMapTool.sqf @@ -4,32 +4,32 @@ * Return true if the position is inside the map marker (to allow dragging). * * Arguments: - * 0: x Position (in meters) - * 1: y Position (in meters) + * 0: x position (in meters) + * 1: y position (in meters) * * Return Value: - * Boolean + * Is inside map tool * * Example: - * [0, 5] call ACE_maptools_fnc_isInsideMapTool + * [0, 5] call ace_maptools_fnc_isInsideMapTool * * Public: No */ if (GVAR(mapTool_Shown) == 0) exitWith {false}; + private _textureWidth = [TEXTURE_WIDTH_IN_M, TEXTURE_WIDTH_IN_M / 2] select (GVAR(mapTool_Shown) - 1); -private _pos = [_this select 0, _this select 1, 0]; -private _relPos = _pos vectorDiff [GVAR(mapTool_pos) select 0, GVAR(mapTool_pos) select 1, 0]; -private _dirVector = [sin(GVAR(mapTool_angle)), cos(GVAR(mapTool_angle)), 0]; +private _relPos = _this vectorDiff GVAR(mapTool_pos); +private _dirVector = [sin GVAR(mapTool_angle), cos GVAR(mapTool_angle)]; // Projection of the relative position over the longitudinal axis of the map tool private _lambdaLong = _dirVector vectorDotProduct _relPos; + if (_lambdaLong < DIST_BOTTOM_TO_CENTER_PERC * _textureWidth) exitWith {false}; - -// Projection of the relative position over the trasversal axis of the map tool -private _lambdaTrasAbs = vectorMagnitude (_relPos vectorDiff (_dirVector vectorMultiply _lambdaLong)); if (_lambdaLong > DIST_TOP_TO_CENTER_PERC * _textureWidth) exitWith {false}; -if (_lambdaTrasAbs > DIST_LEFT_TO_CENTER_PERC * _textureWidth) exitWith {false}; -true +// Projection of the relative position over the transversal axis of the map tool +private _lambdaTransAbs = vectorMagnitude (_relPos vectorDiff (_dirVector vectorMultiply _lambdaLong)); + +_lambdaTransAbs <= DIST_LEFT_TO_CENTER_PERC * _textureWidth diff --git a/addons/maptools/functions/fnc_isInsidePlottingBoard.sqf b/addons/maptools/functions/fnc_isInsidePlottingBoard.sqf index 081615d1b7..e3e6467508 100644 --- a/addons/maptools/functions/fnc_isInsidePlottingBoard.sqf +++ b/addons/maptools/functions/fnc_isInsidePlottingBoard.sqf @@ -4,8 +4,8 @@ * Return if the position is inside the map marker (to allow dragging) or not. * * Arguments: - * 0: x Position (in meters) - * 1: y Position (in meters) + * 0: x position (in meters) + * 1: y position (in meters) * * Return Value: * Where in the plotting board it is @@ -30,9 +30,11 @@ private _isRuler = if (GVAR(plottingBoard_Shown) == 2) then { private _dirRightVector = [_dirVector select 1, -(_dirVector select 0)]; private _rulerAng = acos (_rulerVector vectorCos _relPos); - if (cos _rulerAng > 0 && {tan (_rulerAng) * _dist < PLOTTINGBOARD_RULERHALFWIDTH}) exitWith {true}; + if (cos _rulerAng > 0 && {(tan _rulerAng) * _dist < PLOTTINGBOARD_RULERHALFWIDTH}) exitWith {true}; _dist > PLOTTINGBOARD_RULERINNERCIRCLE && {_dist < PLOTTINGBOARD_RULEROUTERCIRCLE && {abs (_rulerAng * DEGTOMILS) < PLOTTINGBOAR_RULEROUTERHALFANGLE}} +} else { + false }; if (_isRuler) exitWith {2}; diff --git a/addons/maptools/functions/fnc_openMapGpsUpdate.sqf b/addons/maptools/functions/fnc_openMapGpsUpdate.sqf index 4cfd9be238..6d18436625 100644 --- a/addons/maptools/functions/fnc_openMapGpsUpdate.sqf +++ b/addons/maptools/functions/fnc_openMapGpsUpdate.sqf @@ -1,34 +1,39 @@ #include "..\script_component.hpp" /* * Author: esteldunedain, PabstMirror - * update gps display, called from main map's draw + * Update GPS display, called from main map's draw. * * Arguments: - * 0: Map ctrl + * 0: Map control * * Return Value: * None * * Example: - * [findDisplay 12 displayCtrl 51] call ACE_maptools_fnc_openMapGpsUpdate; + * [findDisplay 12 displayCtrl 51] call ace_maptools_fnc_openMapGpsUpdate; * * Public: No */ params ["_mapCtrl"]; + private _mapDisplay = ctrlParent _mapCtrl; -if ((!GVAR(mapGpsShow)) || {!(call FUNC(canUseMapGPS))}) exitWith { +if (!GVAR(mapGpsShow) || {!(call FUNC(canUseMapGPS))}) exitWith { (_mapDisplay displayCtrl 913589) ctrlShow false; }; + (_mapDisplay displayCtrl 913589) ctrlShow true; if (CBA_missionTime < GVAR(mapGpsNextUpdate)) exitWith {}; + GVAR(mapGpsNextUpdate) = CBA_missionTime + 0.5; private _ctrl = _mapDisplay displayCtrl 913590; _ctrl ctrlSetText str (round (getDir ACE_player)); // Set Heading + _ctrl = _mapDisplay displayCtrl 913591; _ctrl ctrlSetText str (round ((getPosASL ACE_player) select 2) + EGVAR(common,mapAltitude)); // Set Altitude + _ctrl = _mapDisplay displayCtrl 913592; _ctrl ctrlSetText mapGridPosition ACE_player; // Set grid cords diff --git a/addons/maptools/functions/fnc_updateMapToolMarkers.sqf b/addons/maptools/functions/fnc_updateMapToolMarkers.sqf index fbad42c36e..1a6d83b698 100644 --- a/addons/maptools/functions/fnc_updateMapToolMarkers.sqf +++ b/addons/maptools/functions/fnc_updateMapToolMarkers.sqf @@ -25,15 +25,9 @@ if (GVAR(plottingBoard_Shown) == 0) then { _y set [4, 0]; }; } forEach GVAR(plottingBoard_markers); -}; +} else { + if !([ACE_player, "ACE_PlottingBoard"] call EFUNC(common,hasItem)) exitWith {}; -if (((GVAR(mapTool_Shown) == 0) && {GVAR(plottingBoard_Shown) == 0}) || { - private _uniqueItems = ACE_player call EFUNC(common,uniqueItems); - - !(("ACE_MapTools" in _uniqueItems) || {"ACE_PlottingBoard" in _uniqueItems}) -}) exitWith {}; - -if (GVAR(plottingBoard_Shown) > 0) then { if (GVAR(plottingBoard_moveToMouse)) then { GVAR(plottingBoard_pos) = _mapCtrl ctrlMapScreenToWorld getMousePosition; GVAR(plottingBoard_moveToMouse) = false; // we only need to do this once after opening the map tool @@ -97,7 +91,7 @@ if (GVAR(plottingBoard_Shown) > 0) then { } forEach GVAR(plottingBoard_markers); }; -if (GVAR(mapTool_Shown) > 0) then { +if ((GVAR(mapTool_Shown) != 0) && {[ACE_player, "ACE_MapTools"] call EFUNC(common,hasItem)}) then { // Open map tools in center of screen when toggled to be shown if (GVAR(mapTool_moveToMouse)) then { GVAR(mapTool_pos) = _mapCtrl ctrlMapScreenToWorld getMousePosition; diff --git a/addons/maptools/initSettings.inc.sqf b/addons/maptools/initSettings.inc.sqf index 5eaa778e32..172054ff77 100644 --- a/addons/maptools/initSettings.inc.sqf +++ b/addons/maptools/initSettings.inc.sqf @@ -1,4 +1,4 @@ -private _category = format ["ACE %1", localize LSTRING(Name)]; +private _category = format ["ACE %1", LLSTRING(Name)]; [ QGVAR(rotateModifierKey), "LIST", diff --git a/addons/maptools/script_component.hpp b/addons/maptools/script_component.hpp index 7c1c4757d2..adbc1fb3f6 100644 --- a/addons/maptools/script_component.hpp +++ b/addons/maptools/script_component.hpp @@ -18,17 +18,17 @@ #define DEGTOMILS 17.7777778 -#define TEXTURE_WIDTH_IN_M 6205 -#define CENTER_OFFSET_Y_PERC 0.1606 -#define CONSTANT_SCALE 0.2 +#define TEXTURE_WIDTH_IN_M 6205 +#define CENTER_OFFSET_Y_PERC 0.1606 +#define CONSTANT_SCALE 0.2 #define DIST_BOTTOM_TO_CENTER_PERC -0.33 -#define DIST_TOP_TO_CENTER_PERC 0.65 -#define DIST_LEFT_TO_CENTER_PERC 0.30 +#define DIST_TOP_TO_CENTER_PERC 0.65 +#define DIST_LEFT_TO_CENTER_PERC 0.30 -#define PLOTTINGBOARD_DRAWRANGE 3000 -#define PLOTTINGBOARD_TEXTUREWIDTH 6000 -#define PLOTTINGBOARD_RULERCENTER 450 -#define PLOTTINGBOARD_RULERHALFWIDTH 100 +#define PLOTTINGBOARD_DRAWRANGE 3000 +#define PLOTTINGBOARD_TEXTUREWIDTH 6000 +#define PLOTTINGBOARD_RULERCENTER 450 +#define PLOTTINGBOARD_RULERHALFWIDTH 100 #define PLOTTINGBOARD_RULERINNERCIRCLE 2900 #define PLOTTINGBOARD_RULEROUTERCIRCLE 3000 #define PLOTTINGBOARD_RULEROUTERHALFANGLE 100 diff --git a/addons/marker_flags/CfgWeapons.hpp b/addons/marker_flags/CfgWeapons.hpp index b4c2f88125..13a1632f4f 100644 --- a/addons/marker_flags/CfgWeapons.hpp +++ b/addons/marker_flags/CfgWeapons.hpp @@ -14,7 +14,7 @@ class CfgWeapons { mapSize = 0.2; class ItemInfo: CBA_MiscItem_ItemInfo { - mass = 1; + mass = 0.5; }; }; diff --git a/addons/marker_flags/functions/fnc_placeFlag.sqf b/addons/marker_flags/functions/fnc_placeFlag.sqf index 74dc615588..5dd2abb376 100644 --- a/addons/marker_flags/functions/fnc_placeFlag.sqf +++ b/addons/marker_flags/functions/fnc_placeFlag.sqf @@ -18,13 +18,13 @@ */ params [["_player", objNull, [objNull]], ["_item", QGVAR(white), [""]]]; -TRACE_2("Placing flag", _player, _item); +TRACE_2("Placing flag",_player,_item); (GVAR(flagCache) get _item) params ["_vehicleClass"]; private _flag = _vehicleClass createVehicle [0, 0, 0]; -TRACE_1("Created flag", _flag); +TRACE_1("Created flag",_flag); // Set flag start height GVAR(objectHeight) = MAX_HEIGHT; diff --git a/addons/markers/XEH_postInit.sqf b/addons/markers/XEH_postInit.sqf index 25e8317b75..43a1acbf29 100644 --- a/addons/markers/XEH_postInit.sqf +++ b/addons/markers/XEH_postInit.sqf @@ -32,7 +32,7 @@ GVAR(userPlacedMarkers) = []; if (_index < 0) exitWith { if (!isMultiplayer) exitWith {}; - WARNING_1("Could not find data for %1", _marker); + WARNING_1("Could not find data for %1",_marker); }; private _data = GVAR(allMapMarkersProperties) select _index; diff --git a/addons/medical/dev/watchVariable.sqf b/addons/medical/dev/watchVariable.sqf index 0eb191e8dd..05cb094ba8 100644 --- a/addons/medical/dev/watchVariable.sqf +++ b/addons/medical/dev/watchVariable.sqf @@ -28,7 +28,7 @@ GVAR(dev_watchVariableRunning) = true; _return pushBack format ["State: %2", _color, _targetState]; private _hasStableVitals = ["N", "Y"] select ([_unit] call EFUNC(medical_status,hasStableVitals)); private _hasStableCondition = ["N", "Y"] select ([_unit] call EFUNC(medical_status,isInStableCondition)); - private _unconcFlag = if IS_UNCONSCIOUS(_unit) then {"[U]"} else {""}; + private _unconcFlag = ["", "[U]"] select IS_UNCONSCIOUS(_unit); private _timeLeft = _unit getVariable [QEGVAR(medical_statemachine,cardiacArrestTimeLeft), -1]; private _cardiactArrestFlag = if IN_CRDC_ARRST(_unit) then {format ["[CA %1]", _timeLeft toFixed 1]} else {""}; _return pushBack format ["[StableVitals: %1] [StableCon: %2] %3 %4", _hasStableVitals, _hasStableCondition, _unconcFlag, _cardiactArrestFlag]; @@ -38,7 +38,7 @@ GVAR(dev_watchVariableRunning) = true; private _woundBleeding = GET_WOUND_BLEEDING(_unit); private _bloodLoss = GET_BLOOD_LOSS(_unit); private _hemorrhage = GET_HEMORRHAGE(_unit); - private _isBleeding = if (IS_BLEEDING(_unit)) then {"Bleeding"} else {""}; + private _isBleeding = ["", "[Bleeding]"] select IS_BLEEDING(_unit); private _secondsToHeartstop = if (_bloodLoss != 0) then {format ["[Time Left: %1 sec]", (((_bloodVolume - BLOOD_VOLUME_CLASS_4_HEMORRHAGE) max 0) / _bloodLoss) toFixed 0]} else {""}; _return pushBack format ["Blood: %1 [Hemorrhage: %2] %3", _bloodVolume toFixed 3, _hemorrhage, _isBleeding]; _return pushBack format [" - [W: %1 T: %2] %3", _woundBleeding toFixed 4, _bloodLoss toFixed 4, _secondsToHeartstop]; @@ -60,7 +60,7 @@ GVAR(dev_watchVariableRunning) = true; // Damage: private _damage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]]; - private _limping = if (_unit getVariable [QEGVAR(medical,isLimping), false]) then {"[ Limping ]"} else {""}; + private _limping = ["", "[ Limping ]"] select (_unit getVariable [QEGVAR(medical,isLimping), false]); _return pushBack format ["BodyPartDamage: [H: %1] [B: %2]", (_damage select 0) toFixed 2, (_damage select 1) toFixed 2]; _return pushBack format ["[LA:%1] [RA: %2] [LL:%3] [RL: %4]", (_damage select 2) toFixed 2, (_damage select 3) toFixed 2, (_damage select 4) toFixed 2, (_damage select 5) toFixed 2]; @@ -68,8 +68,8 @@ GVAR(dev_watchVariableRunning) = true; _return pushBack format ["[HHnd:%1] [HLeg: %2] %3", (_unit getHitPointDamage "HitHands") toFixed 2, (_unit getHitPointDamage "HitLegs") toFixed 2, _limping]; private _fractures = GET_FRACTURES(_unit); - private _canSprint = if (isSprintAllowed _unit) then {""} else {"[Sprint Blocked]"}; - private _forceWalk = if (isForcedWalk _unit) then {"[Forced Walking]"} else {""}; + private _canSprint = ["[Sprint Blocked]", ""] select (isSprintAllowed _unit); + private _forceWalk = ["", "[Forced Walking]"] select (isForcedWalk _unit); _return pushBack format ["Fractures: %1 %2%3", _fractures, _canSprint, _forceWalk]; diff --git a/addons/medical/functions/fnc_addDamageToUnit.sqf b/addons/medical/functions/fnc_addDamageToUnit.sqf index 23ac9f0990..3d82cbe77a 100644 --- a/addons/medical/functions/fnc_addDamageToUnit.sqf +++ b/addons/medical/functions/fnc_addDamageToUnit.sqf @@ -37,12 +37,12 @@ TRACE_7("addDamageToUnit",_unit,_damageToAdd,_bodyPart,_typeOfDamage,_instigator _bodyPart = toLower _bodyPart; private _bodyPartIndex = ALL_BODY_PARTS find _bodyPart; if (_bodyPartIndex < 0) then { _bodyPartIndex = ALL_SELECTIONS find _bodyPart; }; // 2nd attempt with selection names ("hand_l", "hand_r", "leg_l", "leg_r") -if (_bodyPartIndex < 0) exitWith {ERROR_1("addDamageToUnit - bad selection %1", _this); false}; -if (isNull _unit || {!local _unit} || {!alive _unit}) exitWith {ERROR_2("addDamageToUnit - badUnit %1 [local %2]", _this, local _unit); false}; -if (_damageToAdd < 0) exitWith {ERROR_1("addDamageToUnit - bad damage %1", _this); false}; +if (_bodyPartIndex < 0) exitWith {ERROR_1("addDamageToUnit - bad selection %1",_this); false}; +if (isNull _unit || {!local _unit} || {!alive _unit}) exitWith {ERROR_2("addDamageToUnit - badUnit %1 [local %2]",_this,local _unit); false}; +if (_damageToAdd < 0) exitWith {ERROR_1("addDamageToUnit - bad damage %1",_this); false}; if (!_overrideInvuln && {!((isDamageAllowed _unit) && {_unit getVariable [QEGVAR(medical,allowDamage), true]})}) exitWith { - ERROR_1("addDamageToUnit - unit invulnerable %1", _this); false + ERROR_1("addDamageToUnit - unit invulnerable %1",_this); false }; // Extension is case sensitive and expects this format (different from ALL_BODY_PARTS) @@ -69,7 +69,7 @@ private _selectionSpecific = true; if (isClass _config) then { _selectionSpecific = (getNumber (_config >> "selectionSpecific")) == 1; } else { - WARNING_2("Damage type not in config [%1:%2]", _typeOfDamage, _config); + WARNING_2("Damage type not in config [%1:%2]",_typeOfDamage,_config); }; INFO_4("Debug AddDamageToUnit: Type [%1] - Selection Specific [%2] - HitPoint [%3 -> %4]",_typeOfDamage,_selectionSpecific,_startDmg select _bodyPartIndex,_endDmg select _bodyPartIndex); INFO_4("Pain Change [%1 -> %2] - BodyPartDamage Change [%3 -> %4]",_startPain,_endPain,_startDmg,_endDmg); diff --git a/addons/medical/functions/fnc_setUnconscious.sqf b/addons/medical/functions/fnc_setUnconscious.sqf index cf078ae64b..a1de71c36b 100644 --- a/addons/medical/functions/fnc_setUnconscious.sqf +++ b/addons/medical/functions/fnc_setUnconscious.sqf @@ -38,7 +38,7 @@ if (!local _unit) exitWith { }; if (_knockOut isEqualTo IS_UNCONSCIOUS(_unit)) exitWith { - WARNING_2("setUnconscious called with no change [Unit %1] [State [%2]", _unit, _knockOut); + WARNING_2("setUnconscious called with no change [Unit %1] [State [%2]",_unit,_knockOut); false }; diff --git a/addons/medical_ai/XEH_postInit.sqf b/addons/medical_ai/XEH_postInit.sqf index c53cb78934..0b225c7f0b 100644 --- a/addons/medical_ai/XEH_postInit.sqf +++ b/addons/medical_ai/XEH_postInit.sqf @@ -1,7 +1,7 @@ #include "script_component.hpp" ["CBA_settingsInitialized", { - TRACE_1("settingsInitialized", GVAR(enabledFor)); + TRACE_1("settingsInitialized",GVAR(enabledFor)); if (GVAR(enabledFor) == 0) exitWith {}; // 0: disabled if ((GVAR(enabledFor) == 1) && {!isServer} && {hasInterface}) exitWith {}; // 1: Don't Run on non-hc Clients diff --git a/addons/medical_ai/XEH_preStart.sqf b/addons/medical_ai/XEH_preStart.sqf index 52e3374924..b4d795cbbf 100644 --- a/addons/medical_ai/XEH_preStart.sqf +++ b/addons/medical_ai/XEH_preStart.sqf @@ -13,7 +13,7 @@ private _itemHash = createHashMap; private _items = getArray (configFile >> "ace_medical_treatment_actions" >> _x >> "items"); if (_items isEqualTo []) then { ERROR_1("bad action %1",_x); }; private _itemClassname = configName (configFile >> "CfgWeapons" >> _items # 0); - private _treatment = if ((count _treatments) > 1) then { _x } else { "" }; + private _treatment = ["", _x] select ((count _treatments) > 1); _typeHash set [_itemClassname, _treatment]; } forEach _treatments; _itemHash set [_itemType, _typeHash]; diff --git a/addons/medical_damage/functions/fnc_parseConfigForInjuries.sqf b/addons/medical_damage/functions/fnc_parseConfigForInjuries.sqf index f2441b3704..4dfcbe840a 100644 --- a/addons/medical_damage/functions/fnc_parseConfigForInjuries.sqf +++ b/addons/medical_damage/functions/fnc_parseConfigForInjuries.sqf @@ -38,7 +38,7 @@ private _classID = 0; private _details = [_selections, _bleeding, _pain, _causeLimping, _causeFracture]; GVAR(woundDetails) set [_className, _details]; GVAR(woundDetails) set [_classID, _details]; - + GVAR(woundClassNames) pushBack _className; { GVAR(woundClassNamesComplex) set [10 * _classID + _forEachIndex, format ["%1%2", _className, _x]]; @@ -61,7 +61,7 @@ if (isClass (_damageTypesConfig >> "woundHandlers")) then { _defaultWoundHandlers = [_damageTypesConfig >> "woundHandlers"] call FUNC(parseWoundHandlersCfg); reverse _defaultWoundHandlers; }; -TRACE_1("Found default wound handlers", count _defaultWoundHandlers); +TRACE_1("Found default wound handlers",count _defaultWoundHandlers); // Collect all available damage types from the config { @@ -77,15 +77,15 @@ TRACE_1("Found default wound handlers", count _defaultWoundHandlers); private _thresholds = GET_ARRAY(_damageTypeSubClassConfig >> "thresholds",_thresholdsDefault); private _selectionSpecific = GET_NUMBER(_damageTypeSubClassConfig >> "selectionSpecific",_selectionSpecificDefault); - + private _woundHandlers = []; if (isClass (_damageTypeSubClassConfig >> "woundHandlers")) then { _woundHandlers = [_damageTypeSubClassConfig >> "woundHandlers"] call FUNC(parseWoundHandlersCfg); reverse _woundHandlers; - TRACE_2("Damage type found wound handlers", _className, count _woundHandlers); + TRACE_2("Damage type found wound handlers",_className,count _woundHandlers); } else { _woundHandlers = _defaultWoundHandlers; - TRACE_1("Damage type has no wound handlers, using default", _className); + TRACE_1("Damage type has no wound handlers, using default",_className); }; /* @@ -115,11 +115,11 @@ TRACE_1("Found default wound handlers", count _defaultWoundHandlers); if (_woundType == "woundHandlers") then {continue}; if (_woundType in GVAR(woundDetails)) then { private _weighting = GET_ARRAY(_x >> "weighting",[[ARR_2(0,1)]]); - private _dmgMulti = GET_NUMBER(_x >> "damageMultiplier", 1); - private _bleedMulti = GET_NUMBER(_x >> "bleedingMultiplier", 1); - private _sizeMulti = GET_NUMBER(_x >> "sizeMultiplier", 1); - private _painMulti = GET_NUMBER(_x >> "painMultiplier", 1); - private _fractureMulti = GET_NUMBER(_x >> "fractureMultiplier", 1); + private _dmgMulti = GET_NUMBER(_x >> "damageMultiplier",1); + private _bleedMulti = GET_NUMBER(_x >> "bleedingMultiplier",1); + private _sizeMulti = GET_NUMBER(_x >> "sizeMultiplier",1); + private _painMulti = GET_NUMBER(_x >> "painMultiplier",1); + private _fractureMulti = GET_NUMBER(_x >> "fractureMultiplier",1); _damageWoundDetails pushBack [_woundType, _weighting, _dmgMulti, _bleedMulti, _sizeMulti, _painMulti, _fractureMulti]; } else { WARNING_2("Damage type %1 refers to wound %2, but it doesn't exist: skipping.",_className,configName _x); diff --git a/addons/medical_damage/functions/fnc_woundReceived.sqf b/addons/medical_damage/functions/fnc_woundReceived.sqf index 52dbcba265..a7e3861dee 100644 --- a/addons/medical_damage/functions/fnc_woundReceived.sqf +++ b/addons/medical_damage/functions/fnc_woundReceived.sqf @@ -22,14 +22,13 @@ params ["_unit", "_allDamages", "_shooter", "_ammo"]; private _typeOfDamage = _ammo call FUNC(getTypeOfDamage); if (_typeOfDamage in GVAR(damageTypeDetails)) then { (GVAR(damageTypeDetails) get _typeOfDamage) params ["", "", "_woundHandlers"]; - + private _damageData = [_unit, _allDamages, _typeOfDamage]; { _damageData = _damageData call _x; - TRACE_1("Wound handler returned", _damageData); + TRACE_1("Wound handler returned",_damageData); if !(_damageData isEqualType [] && {(count _damageData) >= 3}) exitWith { - TRACE_1("Return invalid, terminating wound handling", _damageData); + TRACE_1("Return invalid, terminating wound handling",_damageData); }; } forEach _woundHandlers; - }; diff --git a/addons/medical_damage/functions/fnc_woundsHandlerVehiclecrash.sqf b/addons/medical_damage/functions/fnc_woundsHandlerVehiclecrash.sqf index 64ac637107..9aaaf4a382 100644 --- a/addons/medical_damage/functions/fnc_woundsHandlerVehiclecrash.sqf +++ b/addons/medical_damage/functions/fnc_woundsHandlerVehiclecrash.sqf @@ -24,5 +24,5 @@ private _newDamages = _allDamages apply { [_x select 0, selectRandom ALL_BODY_PARTS, _x select 2]; }; -TRACE_1("Vehicle crash handled, passing damage", _newDamages); +TRACE_1("Vehicle crash handled, passing damage",_newDamages); [_unit, _newDamages, _typeOfDamage] //return diff --git a/addons/medical_damage/functions/fnc_woundsHandlerVehiclehit.sqf b/addons/medical_damage/functions/fnc_woundsHandlerVehiclehit.sqf index 5f4bd35941..8f9af8262c 100644 --- a/addons/medical_damage/functions/fnc_woundsHandlerVehiclehit.sqf +++ b/addons/medical_damage/functions/fnc_woundsHandlerVehiclehit.sqf @@ -42,5 +42,5 @@ private _newDamages = []; _newDamages pushBack [_damageMap get _x, _x, _damageToApply]; } forEach (keys _damageMap); // micro-optimization again, two 'get's is still faster than iterating over a hashmap -TRACE_1("Vehicle explosion handled, passing damage", _newDamages); +TRACE_1("Vehicle explosion handled, passing damage",_newDamages); [_unit, _newDamages, _typeOfDamage] //return diff --git a/addons/medical_engine/XEH_postInit.sqf b/addons/medical_engine/XEH_postInit.sqf index 6455904f95..5557807629 100644 --- a/addons/medical_engine/XEH_postInit.sqf +++ b/addons/medical_engine/XEH_postInit.sqf @@ -13,12 +13,11 @@ // Check if last hit point is our dummy. private _allHitPoints = getAllHitPointsDamage _unit param [0, []]; reverse _allHitPoints; - while {(_allHitPoints param [0, ""]) select [0,1] == "#"} do { WARNING_1("Ignoring Reflector hitpoint %1", _allHitPoints deleteAt 0); }; + while {(_allHitPoints param [0, ""]) select [0,1] == "#"} do { WARNING_1("Ignoring Reflector hitpoint %1",_allHitPoints deleteAt 0); }; if (_allHitPoints param [0, ""] != "ACE_HDBracket") then { - private _config = configOf _unit; - if (getText (_config >> "simulation") == "UAVPilot") exitWith {TRACE_1("ignore UAV AI",typeOf _unit);}; - if (getNumber (_config >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)}; + if (unitIsUAV _unit) exitWith {TRACE_1("ignore UAV AI",typeOf _unit);}; + if (getNumber ((configOf _unit) >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)}; ERROR_1("Bad hitpoints for unit type ""%1""",typeOf _unit); } else { // Calling this function inside curly brackets allows the usage of @@ -33,7 +32,7 @@ #ifdef DEBUG_MODE_FULL [QEGVAR(medical,woundReceived), { params ["_unit", "_damages", "_shooter", "_ammo"]; - TRACE_4("wound",_unit,_damages, _shooter, _ammo); + TRACE_4("wound",_unit,_damages,_shooter,_ammo); //systemChat str _this; }] call CBA_fnc_addEventHandler; #endif @@ -87,6 +86,12 @@ if (!isNull objectParent _unit && {local objectParent _unit}) exitWith { [_unit] call FUNC(lockUnconsciousSeat); }; + + // Prevent second ragdoll of uncon units when they're killed + if (IS_UNCONSCIOUS(_unit) && !isAwake _unit) then { + _unit enableSimulation false; + [{_this enableSimulation true}, _unit, 2] call CBA_fnc_waitAndExecute; + }; }] call CBA_fnc_addEventHandler; ["CAManBase", "deleted", { diff --git a/addons/medical_engine/functions/fnc_handleDamage.sqf b/addons/medical_engine/functions/fnc_handleDamage.sqf index 8db9950a86..a60816222f 100644 --- a/addons/medical_engine/functions/fnc_handleDamage.sqf +++ b/addons/medical_engine/functions/fnc_handleDamage.sqf @@ -32,6 +32,11 @@ if (_hitPoint isEqualTo "") then { if !(isDamageAllowed _unit && {_unit getVariable [QEGVAR(medical,allowDamage), true]}) exitWith {_oldDamage}; private _newDamage = _damage - _oldDamage; + +// Happens occasionally for vehiclehit events (see line 80 onwards) +// Just exit early to save some frametime +if (_newDamage == 0 && {_hitpoint isNotEqualTo "ace_hdbracket"}) exitWith {_oldDamage}; + // Get scaled armor value of hitpoint and calculate damage before armor // We scale using passThrough to handle explosive-resistant armor properly (#9063) // We need realDamage to determine which limb was hit correctly @@ -85,8 +90,8 @@ if ( {_ammo isNotEqualTo ""} && { private _ammoCfg = configFile >> "CfgAmmo" >> _ammo; - GET_NUMBER(_ammoCfg >> "explosive", 0) > 0 || - {GET_NUMBER(_ammoCfg >> "indirectHit", 0) > 0} + GET_NUMBER(_ammoCfg >> "explosive",0) > 0 || + {GET_NUMBER(_ammoCfg >> "indirectHit",0) > 0} } ) exitwith { TRACE_5("Vehicle hit",_unit,_shooter,_instigator,_damage,_newDamage); diff --git a/addons/medical_engine/script_macros_medical.hpp b/addons/medical_engine/script_macros_medical.hpp index 56c1eec401..5fecd36413 100644 --- a/addons/medical_engine/script_macros_medical.hpp +++ b/addons/medical_engine/script_macros_medical.hpp @@ -42,6 +42,7 @@ #define GET_ARRAY(config,default) (if (isArray (config)) then {getArray (config)} else {default}) #define DEFAULT_HEART_RATE 80 +#define DEFAULT_SPO2 97 #define DEFAULT_PERIPH_RES 100 // --- blood @@ -153,6 +154,8 @@ #define VAR_WOUND_BLEEDING QEGVAR(medical,woundBleeding) #define VAR_CRDC_ARRST QEGVAR(medical,inCardiacArrest) #define VAR_HEART_RATE QEGVAR(medical,heartRate) +#define VAR_SPO2 QEGVAR(medical,spo2) +#define VAR_OXYGEN_DEMAND QEGVAR(medical,oxygenDemand) #define VAR_PAIN QEGVAR(medical,pain) #define VAR_PAIN_SUPP QEGVAR(medical,painSuppress) #define VAR_PERIPH_RES QEGVAR(medical,peripheralResistance) @@ -175,6 +178,7 @@ #define GET_BLOOD_VOLUME(unit) (unit getVariable [VAR_BLOOD_VOL, DEFAULT_BLOOD_VOLUME]) #define GET_WOUND_BLEEDING(unit) (unit getVariable [VAR_WOUND_BLEEDING, 0]) #define GET_HEART_RATE(unit) (unit getVariable [VAR_HEART_RATE, DEFAULT_HEART_RATE]) +#define GET_SPO2(unit) (unit getVariable [VAR_SPO2, DEFAULT_SPO2]) #define GET_HEMORRHAGE(unit) (unit getVariable [VAR_HEMORRHAGE, 0]) #define GET_PAIN(unit) (unit getVariable [VAR_PAIN, 0]) #define GET_PAIN_SUPPRESS(unit) (unit getVariable [VAR_PAIN_SUPP, 0]) diff --git a/addons/medical_gui/functions/fnc_collectActions.sqf b/addons/medical_gui/functions/fnc_collectActions.sqf index 818decb017..1620b2c5cb 100644 --- a/addons/medical_gui/functions/fnc_collectActions.sqf +++ b/addons/medical_gui/functions/fnc_collectActions.sqf @@ -22,8 +22,8 @@ GVAR(actions) = []; private _configName = configName _x; private _displayName = getText (_x >> "displayName"); private _category = getText (_x >> "category"); - private _condition = compile format [QUOTE([ARR_4(ACE_player, GVAR(target), %1 select GVAR(selectedBodyPart), '%2')] call DEFUNC(medical_treatment,canTreatCached)), ALL_BODY_PARTS, _configName]; - private _statement = compile format [QUOTE([ARR_4(ACE_player, GVAR(target), %1 select GVAR(selectedBodyPart), '%2')] call DEFUNC(medical_treatment,treatment)), ALL_BODY_PARTS, _configName]; + private _condition = compile format [QUOTE([ARR_4(ACE_player,GVAR(target),%1 select GVAR(selectedBodyPart),'%2')] call DEFUNC(medical_treatment,canTreatCached)), ALL_BODY_PARTS, _configName]; + private _statement = compile format [QUOTE([ARR_4(ACE_player,GVAR(target),%1 select GVAR(selectedBodyPart),'%2')] call DEFUNC(medical_treatment,treatment)), ALL_BODY_PARTS, _configName]; private _items = getArray (_x >> "items"); GVAR(actions) pushBack [_displayName, _category, _condition, _statement, _items]; @@ -32,7 +32,7 @@ GVAR(actions) = []; if ("ace_dragging" call EFUNC(common,isModLoaded)) then { GVAR(actions) pushBack [ - localize ELSTRING(dragging,Drag), "drag", + LELSTRING(dragging,Drag), "drag", {ACE_player != GVAR(target) && {[ACE_player, GVAR(target)] call EFUNC(dragging,canDrag)}}, { GVAR(pendingReopen) = false; @@ -41,7 +41,7 @@ if ("ace_dragging" call EFUNC(common,isModLoaded)) then { ]; GVAR(actions) pushBack [ - localize ELSTRING(dragging,Carry), "drag", + LELSTRING(dragging,Carry), "drag", {ACE_player != GVAR(target) && {[ACE_player, GVAR(target)] call EFUNC(dragging,canCarry)}}, { GVAR(pendingReopen) = false; diff --git a/addons/medical_gui/functions/fnc_countTreatmentItems.sqf b/addons/medical_gui/functions/fnc_countTreatmentItems.sqf index 102d996bb3..6e8394c82f 100644 --- a/addons/medical_gui/functions/fnc_countTreatmentItems.sqf +++ b/addons/medical_gui/functions/fnc_countTreatmentItems.sqf @@ -38,7 +38,7 @@ if (ACE_player != GVAR(target)) then { // Vehicle private _medicVehicle = objectParent ACE_player; private _patientVehicle = objectParent GVAR(target); -private _vehicle = if (!isNull _medicVehicle) then {_medicVehicle} else {_patientVehicle}; +private _vehicle = [_patientVehicle, _medicVehicle] select (!isNull _medicVehicle); if (!isNull _vehicle) then { _vehicleCount = 0; diff --git a/addons/medical_gui/functions/fnc_handleToggle.sqf b/addons/medical_gui/functions/fnc_handleToggle.sqf index f0448fc3a3..48232790c1 100644 --- a/addons/medical_gui/functions/fnc_handleToggle.sqf +++ b/addons/medical_gui/functions/fnc_handleToggle.sqf @@ -19,15 +19,14 @@ if (!isNull findDisplay 312) exitWith {}; // Find new target to switch to -private _target = if ( +private _target = [ + ACE_player, + GVAR(previousTarget) +] select ( GVAR(target) == ACE_player && {[ACE_player, GVAR(previousTarget)] call EFUNC(common,canInteractWith)} && {[ACE_player, GVAR(previousTarget)] call FUNC(canOpenMenu)} -) then { - GVAR(previousTarget); -} else { - ACE_player; -}; +); // Exit if new target is same as old if (GVAR(target) == _target) exitWith {}; diff --git a/addons/medical_gui/ui/painkillers.paa b/addons/medical_gui/ui/painkillers.paa new file mode 100644 index 0000000000..3c5da9b30b Binary files /dev/null and b/addons/medical_gui/ui/painkillers.paa differ diff --git a/addons/medical_status/XEH_preInit.sqf b/addons/medical_status/XEH_preInit.sqf index e3c82d5788..82146d82e1 100644 --- a/addons/medical_status/XEH_preInit.sqf +++ b/addons/medical_status/XEH_preInit.sqf @@ -12,9 +12,8 @@ PREP_RECOMPILE_END; ["CAManBase", "init", { params ["_unit"]; - private _config = configOf _unit; - if (getText (_config >> "simulation") == "UAVPilot") exitWith {TRACE_1("ignore UAV AI",typeOf _unit);}; - if (getNumber (_config >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)}; + if (unitIsUAV _unit) exitWith {TRACE_1("ignore UAV AI",typeOf _unit);}; + if (getNumber ((configOf _unit) >> "isPlayableLogic") == 1) exitWith {TRACE_1("ignore logic unit",typeOf _unit)}; // Hopefully this EH gets added first as it can only effect other EH called after it private _ehIndex = _unit addEventHandler ["Killed", {_this call FUNC(handleKilled)}]; diff --git a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf index 4c101c7521..8770eaf0ae 100644 --- a/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf +++ b/addons/medical_status/functions/fnc_addMedicationAdjustment.sqf @@ -7,10 +7,10 @@ * 0: The Unit * 1: Medication * 2: Time in system for the adjustment to reach its peak - * 3: Duration the adjustment will have an effect - * 4: Heart Rate Adjust - * 5: Pain Suppress Adjust - * 6: Flow Adjust + * 3: Duration the adjustment will have an effect + * 4: Heart Rate Adjust + * 5: Pain Suppress Adjust + * 6: Flow Adjust * * Return Value: * None diff --git a/addons/medical_status/functions/fnc_initUnit.sqf b/addons/medical_status/functions/fnc_initUnit.sqf index 786f2be950..278163d90b 100644 --- a/addons/medical_status/functions/fnc_initUnit.sqf +++ b/addons/medical_status/functions/fnc_initUnit.sqf @@ -32,13 +32,15 @@ if (damage _unit > 0) then { if (_isRespawn) then { TRACE_1("reseting all vars on respawn",_isRespawn); // note: state is handled by ace_medical_statemachine_fnc_resetStateDefault - // - Blood and heart ---------------------------------------------------------- + // - Vitals ------------------------------------------------------------------ _unit setVariable [VAR_BLOOD_VOL, DEFAULT_BLOOD_VOLUME, true]; _unit setVariable [VAR_HEART_RATE, DEFAULT_HEART_RATE, true]; _unit setVariable [VAR_BLOOD_PRESS, [80, 120], true]; _unit setVariable [VAR_PERIPH_RES, DEFAULT_PERIPH_RES, true]; _unit setVariable [VAR_CRDC_ARRST, false, true]; _unit setVariable [VAR_HEMORRHAGE, 0, true]; + _unit setVariable [VAR_SPO2, DEFAULT_SPO2, true]; + _unit setVariable [VAR_OXYGEN_DEMAND, 0, true]; // - Pain --------------------------------------------------------------------- _unit setVariable [VAR_PAIN, 0, true]; diff --git a/addons/medical_status/functions/fnc_setUnconsciousState.sqf b/addons/medical_status/functions/fnc_setUnconsciousState.sqf index e3d34f3b5a..5981343c18 100644 --- a/addons/medical_status/functions/fnc_setUnconsciousState.sqf +++ b/addons/medical_status/functions/fnc_setUnconsciousState.sqf @@ -57,9 +57,19 @@ if (_active) then { // Do "Unlock controls" user action, co-pilot will then have to do the "Take Controls" actions _unit action ["UnlockVehicleControl", vehicle _unit]; }; + + // Disable AI talking (yes, this needs to be explicit) + if (!isPlayer _unit && {_unit checkAIFeature "RADIOPROTOCOL"}) then { + _unit disableAI "RADIOPROTOCOL"; + _unit setVariable [QGVAR(reenableRadioProtocol), true, true]; + }; } else { // Unit has woken up, no longer need to track this _unit setVariable [QEGVAR(medical,lastWakeUpCheck), nil]; + + if (_unit getVariable [QGVAR(reenableRadioProtocol), false]) then { + _unit enableAI "RADIOPROTOCOL"; + }; }; // This event doesn't correspond to unconscious in statemachine diff --git a/addons/medical_treatment/ACE_Medical_Treatment.hpp b/addons/medical_treatment/ACE_Medical_Treatment.hpp index eeeacf700f..d1ea741cb3 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment.hpp @@ -605,10 +605,13 @@ class ADDON { incompatibleMedication[] = {}; }; class PainKillers { - painReduce = 0.1; - timeInSystem = 600; + painReduce = 0.35; + hrIncreaseLow[] = {-5, -10}; + hrIncreaseNormal[] = {-5, -15}; + hrIncreaseHigh[] = {-5, -17}; + timeInSystem = 420; timeTillMaxEffect = 60; - maxDose = 10; + maxDose = 6; incompatibleMedication[] = {}; viscosityChange = 5; }; diff --git a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp index 99a477c3f5..4058132e3d 100644 --- a/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp +++ b/addons/medical_treatment/ACE_Medical_Treatment_Actions.hpp @@ -141,6 +141,19 @@ class GVAR(actions) { litter[] = {{"ACE_MedicalLitter_epinephrine"}}; }; + // - Generic Medication --------------------------------------------------- + class Painkillers: Morphine { + displayName = CSTRING(Administer_Painkillers); + displayNameProgress = CSTRING(Administering_Painkillers); + icon = QPATHTOEF(medical_gui,ui\painkillers.paa); + allowedSelections[] = {"Head"}; + medicRequired = 0; + items[] = {"ACE_painkillers"}; + treatmentTime = 4; + sounds[] = {{QPATHTO_R(sounds\Pills.ogg),1,1,50}}; + litter[] = {{"Land_PainKillers_F"}}; // just use BI's model as litter + }; + // - IV Bags -------------------------------------------------------------- class BloodIV: BasicBandage { displayName = CSTRING(Actions_Blood4_1000); diff --git a/addons/medical_treatment/CfgVehicles.hpp b/addons/medical_treatment/CfgVehicles.hpp index c9144704b5..bcecdb155e 100644 --- a/addons/medical_treatment/CfgVehicles.hpp +++ b/addons/medical_treatment/CfgVehicles.hpp @@ -284,6 +284,16 @@ class CfgVehicles { MACRO_ADDITEM(ACE_bodyBag,1); }; }; + class ACE_painkillersItem: Item_Base_F { + scope = 2; + scopeCurator = 2; + displayName = CSTRING(painkillers_Display); + author = "Alganthe"; + vehicleClass = "Items"; + class TransportItems { + MACRO_ADDITEM(ACE_painkillers,1); + }; + }; // Medical supply crates class ThingX; @@ -305,6 +315,7 @@ class CfgVehicles { author = ECSTRING(common,ACETeam); class TransportItems { MACRO_ADDITEM(ACE_fieldDressing,50); + MACRO_ADDITEM(ACE_painkillers,25); MACRO_ADDITEM(ACE_morphine,25); MACRO_ADDITEM(ACE_epinephrine,25); MACRO_ADDITEM(ACE_bloodIV,15); @@ -352,6 +363,7 @@ class CfgVehicles { MACRO_ADDITEM(ACE_elasticBandage,25); MACRO_ADDITEM(ACE_tourniquet,15); MACRO_ADDITEM(ACE_splint,15); + MACRO_ADDITEM(ACE_painkillers,15); MACRO_ADDITEM(ACE_morphine,15); MACRO_ADDITEM(ACE_adenosine,15); MACRO_ADDITEM(ACE_epinephrine,15); diff --git a/addons/medical_treatment/CfgWeapons.hpp b/addons/medical_treatment/CfgWeapons.hpp index 7b31e10bee..31b98bd843 100644 --- a/addons/medical_treatment/CfgWeapons.hpp +++ b/addons/medical_treatment/CfgWeapons.hpp @@ -310,4 +310,17 @@ class CfgWeapons { hiddenSelectionsTextures[] = {QPATHTOF(data\bodybagItem_white_co.paa)}; GVAR(bodyBagObject) = "ACE_bodyBagObject_white"; }; + class ACE_painkillers: ACE_ItemCore { + scope = 2; + author = "Alganthe"; + displayName = CSTRING(painkillers_Display); + model = "\A3\Structures_F_EPA\Items\Medical\PainKillers_F.p3d"; + picture = QPATHTOF(ui\painkillers_ca.paa); + descriptionShort = CSTRING(painkillers_Desc_Short); + descriptionUse = CSTRING(painkillers_Desc_Use); + ACE_isMedicalItem = 1; + class ItemInfo: CBA_MiscItem_ItemInfo { + mass = 1; + }; + }; }; diff --git a/addons/medical_treatment/config.cpp b/addons/medical_treatment/config.cpp index d0ecbddaef..75166a0f0c 100644 --- a/addons/medical_treatment/config.cpp +++ b/addons/medical_treatment/config.cpp @@ -11,8 +11,8 @@ ACE_PATCH_NOT_LOADED(ADDON,PATCH_SKIP) class CfgPatches { class ADDON { name = COMPONENT_NAME; - units[] = {"ACE_fieldDressingItem","ACE_packingBandageItem","ACE_elasticBandageItem","ACE_tourniquetItem","ACE_splintItem","ACE_morphineItem","ACE_adenosineItem","ACE_epinephrineItem","ACE_plasmaIVItem","ACE_bloodIVItem","ACE_salineIVItem","ACE_quikClotItem","ACE_personalAidKitItem","ACE_surgicalKitItem","ACE_sutureItem","ACE_bodyBagItem","ACE_medicalSupplyCrate","ACE_medicalSupplyCrate_advanced"}; - weapons[] = {"ACE_fieldDressing","ACE_packingBandage","ACE_elasticBandage","ACE_tourniquet","ACE_splint","ACE_morphine","ACE_adenosine","ACE_epinephrine","ACE_plasmaIV","ACE_plasmaIV_500","ACE_plasmaIV_250","ACE_bloodIV","ACE_bloodIV_500","ACE_bloodIV_250","ACE_salineIV","ACE_salineIV_500","ACE_salineIV_250","ACE_quikclot","ACE_personalAidKit","ACE_surgicalKit","ACE_suture","ACE_bodyBag","ACE_bodyBag_blue","ACE_bodyBag_white"}; + units[] = {"ACE_fieldDressingItem","ACE_packingBandageItem","ACE_elasticBandageItem","ACE_tourniquetItem","ACE_splintItem","ACE_painkillersItem","ACE_morphineItem","ACE_adenosineItem","ACE_epinephrineItem","ACE_plasmaIVItem","ACE_bloodIVItem","ACE_salineIVItem","ACE_quikClotItem","ACE_personalAidKitItem","ACE_surgicalKitItem","ACE_sutureItem","ACE_bodyBagItem","ACE_medicalSupplyCrate","ACE_medicalSupplyCrate_advanced"}; + weapons[] = {"ACE_fieldDressing","ACE_packingBandage","ACE_elasticBandage","ACE_tourniquet","ACE_splint","ACE_painkillers","ACE_morphine","ACE_adenosine","ACE_epinephrine","ACE_plasmaIV","ACE_plasmaIV_500","ACE_plasmaIV_250","ACE_bloodIV","ACE_bloodIV_500","ACE_bloodIV_250","ACE_salineIV","ACE_salineIV_500","ACE_salineIV_250","ACE_quikclot","ACE_personalAidKit","ACE_surgicalKit","ACE_suture","ACE_bodyBag","ACE_bodyBag_blue","ACE_bodyBag_white"}; requiredVersion = REQUIRED_VERSION; requiredAddons[] = {"ace_medical_status", "ace_medical_damage", "ace_apl"}; author = ECSTRING(common,ACETeam); diff --git a/addons/medical_treatment/functions/fnc_checkPulseLocal.sqf b/addons/medical_treatment/functions/fnc_checkPulseLocal.sqf index 737a40c0ca..3798e64eb4 100644 --- a/addons/medical_treatment/functions/fnc_checkPulseLocal.sqf +++ b/addons/medical_treatment/functions/fnc_checkPulseLocal.sqf @@ -21,8 +21,16 @@ params ["_medic", "_patient", "_bodyPart"]; private _heartRate = 0; -if (alive _patient && {!([_patient, _bodyPart] call FUNC(hasTourniquetAppliedTo))}) then { - _heartRate = GET_HEART_RATE(_patient); +if (!([_patient, _bodyPart] call FUNC(hasTourniquetAppliedTo))) then { + _heartRate = switch (true) do { + case (alive _patient): { + GET_HEART_RATE(_patient) + }; + case (alive (_patient getVariable [QEGVAR(medical,CPR_provider), objNull])): { + random [25, 30, 35] // fake heart rate because patient is dead and off state machine + }; + default { 0 }; + }; }; private _heartRateOutput = LSTRING(Check_Pulse_Output_5); @@ -31,7 +39,7 @@ private _logOutput = LSTRING(Check_Pulse_None); if (_heartRate > 1) then { if (_medic call FUNC(isMedic)) then { _heartRateOutput = LSTRING(Check_Pulse_Output_1); - _logOutput = format ["%1", round _heartRate]; + _logOutput = str round _heartRate; } else { _heartRateOutput = LSTRING(Check_Pulse_Output_2); _logOutput = LSTRING(Check_Pulse_Weak); diff --git a/addons/medical_treatment/functions/fnc_fullHealLocal.sqf b/addons/medical_treatment/functions/fnc_fullHealLocal.sqf index e845e04304..7772db0a6b 100644 --- a/addons/medical_treatment/functions/fnc_fullHealLocal.sqf +++ b/addons/medical_treatment/functions/fnc_fullHealLocal.sqf @@ -63,6 +63,8 @@ _patient setVariable [VAR_FRACTURES, DEFAULT_FRACTURE_VALUES, true]; _patient setVariable [VAR_HEART_RATE, DEFAULT_HEART_RATE, true]; _patient setVariable [VAR_BLOOD_PRESS, [80, 120], true]; _patient setVariable [VAR_PERIPH_RES, DEFAULT_PERIPH_RES, true]; +_patient setVariable [VAR_SPO2, DEFAULT_SPO2, true]; +_patient setVariable [VAR_OXYGEN_DEMAND, 0, true]; // IVs _patient setVariable [QEGVAR(medical,ivBags), nil, true]; diff --git a/addons/medical_treatment/functions/fnc_handleBandageOpening.sqf b/addons/medical_treatment/functions/fnc_handleBandageOpening.sqf index 69a6118099..b90198f0eb 100644 --- a/addons/medical_treatment/functions/fnc_handleBandageOpening.sqf +++ b/addons/medical_treatment/functions/fnc_handleBandageOpening.sqf @@ -36,7 +36,7 @@ if (isClass (_config >> _bandage)) then { _reopeningMinDelay = getNumber (_config >> "reopeningMinDelay"); _reopeningMaxDelay = getNumber (_config >> "reopeningMaxDelay") max _reopeningMinDelay; } else { - WARNING_2("No config for bandage [%1] config base [%2]", _bandage, _config); + WARNING_2("No config for bandage [%1] config base [%2]",_bandage,_config); }; if (isClass (_config >> _className)) then { @@ -54,7 +54,7 @@ if (isClass (_config >> _className)) then { _reopeningMaxDelay = getNumber (_woundTreatmentConfig >> "reopeningMaxDelay") max _reopeningMinDelay; }; } else { - WARNING_2("No config for wound type [%1] config base [%2]", _className, _config); + WARNING_2("No config for wound type [%1] config base [%2]",_className,_config); }; TRACE_5("configs",_bandage,_className,_reopeningChance,_reopeningMinDelay,_reopeningMaxDelay); diff --git a/addons/medical_treatment/functions/fnc_isInMedicalFacility.sqf b/addons/medical_treatment/functions/fnc_isInMedicalFacility.sqf index 2d4468d2c4..d04c1497bd 100644 --- a/addons/medical_treatment/functions/fnc_isInMedicalFacility.sqf +++ b/addons/medical_treatment/functions/fnc_isInMedicalFacility.sqf @@ -21,7 +21,7 @@ params ["_unit"]; private _fnc_check = { private _position = _unit modelToWorldVisual [0, 0, eyePos _unit select 2]; - CHECK_OBJECTS(lineIntersectsWith [ARR_3(_position, _position vectorAdd [ARR_3(0, 0, 10)], _unit)]) || {CHECK_OBJECTS(_unit nearObjects 7.5)} + CHECK_OBJECTS(lineIntersectsWith [ARR_3(_position,_position vectorAdd [ARR_3(0,0,10)],_unit)]) || {CHECK_OBJECTS(_unit nearObjects 7.5)} }; [[], _fnc_check, _unit, QGVAR(inMedicalFacilityCache), IN_MEDICAL_FACILITY_CACHE_EXPIRY] call EFUNC(common,cachedCall); diff --git a/addons/medical_treatment/sounds/Pills.ogg b/addons/medical_treatment/sounds/Pills.ogg new file mode 100644 index 0000000000..7fbe550554 Binary files /dev/null and b/addons/medical_treatment/sounds/Pills.ogg differ diff --git a/addons/medical_treatment/stringtable.xml b/addons/medical_treatment/stringtable.xml index da7374984d..05bb62a646 100644 --- a/addons/medical_treatment/stringtable.xml +++ b/addons/medical_treatment/stringtable.xml @@ -1390,7 +1390,7 @@ Définit s'il s'agit d'un véhicule sanitaire. Se o objeto será ou não um veículo médico Будет ли объект считаться медицинским транспортом. - 対象が医療車両であるかどうか。 + 車両をを医療車両として割り当てます 이 물체는 의료 차량이 됩니다. 是否使该载具为医疗载具? 是否使該載具為醫療載具? @@ -1491,7 +1491,7 @@ Est un véhicule sanitaire Orvosi jármű-e È Veicolo Medico - 医療車両に + 医療車両とする 의료 차량 是医疗载具 是醫療載具 @@ -1508,7 +1508,7 @@ Est une installation sanitaire Orvosi létesítmény-e È Struttura Medica - 医療施設に + 医療施設とする 의료시설 是医疗设施 是醫療設施 @@ -1525,7 +1525,7 @@ Définit l'objet comme étant une installation sanitaire. Egy objektum orvosi létesítményként való regisztrálása Registra un oggetto come struttura medica - オブジェクトを医療施設として割り当てる + オブジェクトを医療施設として割り当てます 물체를 의료시설로 등록합니다 指定一个物体作为医疗设施 指定一個物件作為醫療設施 @@ -4933,5 +4933,33 @@ Zeus操作中は、すべての治療時間にこの係数を掛けます。 제우스일 때 모든 치료 시간에 이 계수를 곱합니다. + + Painkillers + Léky proti bolesti + Schmerztabellen + Болеутоляющее + Środki przeciwbólowe + Antidolorifici + Analgésicos + Analgésiques + 止痛藥 + 鎮痛剤 + 진통제 + Analgésicos + 止痛药 + Ağrı kesici + + + Administer Painkillers + + + Administering Painkillers... + + + Over-the-counter analgesic used to combat light to moderate pain experiences. + + + Over-the-counter analgesic used to combat light to moderate pain experiences. + diff --git a/addons/medical_treatment/ui/painkillers_ca.paa b/addons/medical_treatment/ui/painkillers_ca.paa new file mode 100644 index 0000000000..15036c85cb Binary files /dev/null and b/addons/medical_treatment/ui/painkillers_ca.paa differ diff --git a/addons/medical_vitals/CfgWeapons.hpp b/addons/medical_vitals/CfgWeapons.hpp new file mode 100644 index 0000000000..5c6e4c9fd8 --- /dev/null +++ b/addons/medical_vitals/CfgWeapons.hpp @@ -0,0 +1,10 @@ +class CfgWeapons { + class H_HelmetB; + class H_PilotHelmetFighter_B: H_HelmetB { + GVAR(oxygenSupply) = QUOTE(vehicle _this isKindOf 'Plane' || vehicle _this isKindOf 'Helicopter'); + }; + class Vest_Camo_Base; + class V_RebreatherB: Vest_Camo_Base { + GVAR(oxygenSupply) = QUOTE(eyePos _this select 2 < 0); // will only work for sea-level water + }; +}; diff --git a/addons/medical_vitals/XEH_PREP.hpp b/addons/medical_vitals/XEH_PREP.hpp index 8f8c427751..02f1cc5f89 100644 --- a/addons/medical_vitals/XEH_PREP.hpp +++ b/addons/medical_vitals/XEH_PREP.hpp @@ -1,4 +1,6 @@ PREP(handleUnitVitals); +PREP(scanConfig); PREP(updateHeartRate); +PREP(updateOxygen); PREP(updatePainSuppress); PREP(updatePeripheralResistance); diff --git a/addons/medical_vitals/XEH_preInit.sqf b/addons/medical_vitals/XEH_preInit.sqf index b47cf6628d..8cc49805e9 100644 --- a/addons/medical_vitals/XEH_preInit.sqf +++ b/addons/medical_vitals/XEH_preInit.sqf @@ -6,4 +6,8 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +#include "initSettings.inc.sqf" + +GVAR(oxygenSupplyConditionCache) = uiNamespace getVariable QGVAR(oxygenSupplyConditionCache); + ADDON = true; diff --git a/addons/medical_vitals/XEH_preStart.sqf b/addons/medical_vitals/XEH_preStart.sqf index 022888575e..78dd8ad0e3 100644 --- a/addons/medical_vitals/XEH_preStart.sqf +++ b/addons/medical_vitals/XEH_preStart.sqf @@ -1,3 +1,9 @@ #include "script_component.hpp" #include "XEH_PREP.hpp" + +GVAR(oxygenSupplyConditionCache) = createHashMap; + +call FUNC(scanConfig); + +GVAR(oxygenSupplyConditionCache) = compileFinal GVAR(oxygenSupplyConditionCache); diff --git a/addons/medical_vitals/config.cpp b/addons/medical_vitals/config.cpp index d105aa3144..290c25bc9b 100644 --- a/addons/medical_vitals/config.cpp +++ b/addons/medical_vitals/config.cpp @@ -23,5 +23,6 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" +#include "CfgWeapons.hpp" #endif diff --git a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf index 683cfd34b7..c284b00701 100644 --- a/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf +++ b/addons/medical_vitals/functions/fnc_handleUnitVitals.sqf @@ -31,6 +31,9 @@ if (_syncValues) then { _unit setVariable [QGVAR(lastMomentValuesSynced), CBA_missionTime]; }; +// Update SPO2 intake and usage since last update +[_unit, _deltaT, _syncValues] call FUNC(updateOxygen); + private _bloodVolume = GET_BLOOD_VOLUME(_unit) + ([_unit, _deltaT, _syncValues] call EFUNC(medical_status,getBloodVolumeChange)); _bloodVolume = 0 max _bloodVolume min DEFAULT_BLOOD_VOLUME; diff --git a/addons/medical_vitals/functions/fnc_scanConfig.sqf b/addons/medical_vitals/functions/fnc_scanConfig.sqf new file mode 100644 index 0000000000..377b235315 --- /dev/null +++ b/addons/medical_vitals/functions/fnc_scanConfig.sqf @@ -0,0 +1,23 @@ +#include "..\script_component.hpp" +/* + * Author: LinkIsGrim + * Cache a hashmap of all oxygen-providing items for SpO2 simulation + * + * Arguments: + * None + * + * Return Value: + * None + * + * Public: No +*/ + +private _filter = toString {getText (_x >> QGVAR(oxygenSupply)) != ""}; + +{ + private _cfgRoot = configFile >> _x; + { + private _condition = compile getText (_x >> QGVAR(oxygenSupply)); + GVAR(oxygenSupplyConditionCache) set [configName _x, _condition]; + } forEach (_filter configClasses _cfgRoot); +} forEach ["CfgWeapons", "CfgGoggles"]; diff --git a/addons/medical_vitals/functions/fnc_updateHeartRate.sqf b/addons/medical_vitals/functions/fnc_updateHeartRate.sqf index 9ffc52d663..187a8ffe58 100644 --- a/addons/medical_vitals/functions/fnc_updateHeartRate.sqf +++ b/addons/medical_vitals/functions/fnc_updateHeartRate.sqf @@ -37,6 +37,7 @@ if IN_CRDC_ARRST(_unit) then { if (_bloodVolume > BLOOD_VOLUME_CLASS_4_HEMORRHAGE) then { GET_BLOOD_PRESSURE(_unit) params ["_bloodPressureL", "_bloodPressureH"]; private _meanBP = (2/3) * _bloodPressureH + (1/3) * _bloodPressureL; + private _spo2 = GET_SPO2(_unit); private _painLevel = GET_PAIN_PERCEIVED(_unit); private _targetBP = 107; @@ -51,8 +52,11 @@ if IN_CRDC_ARRST(_unit) then { if (_painLevel > 0.2) then { _targetHR = _targetHR max (80 + 50 * _painLevel); }; + // Increase HR to compensate for low blood oxygen + // Increase HR to compensate for higher oxygen demand (e.g. running, recovering from sprint) + private _oxygenDemand = _unit getVariable [VAR_OXYGEN_DEMAND, 0]; + _targetHR = _targetHR + ((97 - _spo2) * 2) + (_oxygenDemand * -1000); _targetHR = (_targetHR + _hrTargetAdjustment) max 0; - _hrChange = round(_targetHR - _heartRate) / 2; } else { _hrChange = -round(_heartRate / 10); diff --git a/addons/medical_vitals/functions/fnc_updateOxygen.sqf b/addons/medical_vitals/functions/fnc_updateOxygen.sqf new file mode 100644 index 0000000000..f2c0f68f71 --- /dev/null +++ b/addons/medical_vitals/functions/fnc_updateOxygen.sqf @@ -0,0 +1,75 @@ +#include "..\script_component.hpp" +/* + * Author: Brett Mayson + * Update the oxygen levels + * + * Arguments: + * 0: The Unit + * 1: Time since last update + * 2: Sync value? + * + * ReturnValue: + * Current SPO2 + * + * Example: + * [player, 1, false] call ace_medical_vitals_fnc_updateOxygen + * + * Public: No + */ + +params ["_unit", "_deltaT", "_syncValue"]; + +if (!GVAR(simulateSpO2)) exitWith {}; // changing back to default is handled in initSettings.inc.sqf + +#define IDEAL_PPO2 0.255 + +private _current = GET_SPO2(_unit); +private _heartRate = GET_HEART_RATE(_unit); + +private _altitude = EGVAR(common,mapAltitude) + ((getPosASL _unit) select 2); +private _po2 = if (missionNamespace getVariable [QEGVAR(weather,enabled), false]) then { + private _temperature = _altitude call EFUNC(weather,calculateTemperatureAtHeight); + private _pressure = _altitude call EFUNC(weather,calculateBarometricPressure); + [_temperature, _pressure, EGVAR(weather,currentHumidity)] call EFUNC(weather,calculateOxygenDensity) +} else { + // Rough approximation of the partial pressure of oxygen in the air + 0.25725 * (_altitude / 1000 + 1) +}; + +private _oxygenSaturation = (IDEAL_PPO2 min _po2) / IDEAL_PPO2; + +// Check gear for oxygen supply +[goggles _unit, headgear _unit, vest _unit] findIf { + _x in GVAR(oxygenSupplyConditionCache) && + {ACE_player call (GVAR(oxygenSupplyConditionCache) get _x)} && + { // Will only run this if other conditions are met due to lazy eval + _oxygenSaturation = 1; + _po2 = IDEAL_PPO2; + true + } +}; + +// Base oxygen consumption rate +private _negativeChange = BASE_OXYGEN_USE; + +// Fatigue & exercise will demand more oxygen +// Assuming a trained male in midst of peak exercise will have a peak heart rate of ~180 BPM +// Ref: https://academic.oup.com/bjaed/article-pdf/4/6/185/894114/mkh050.pdf table 2, though we don't take stroke volume change into account +if (_unit == ACE_player && {missionNamespace getVariable [QEGVAR(advanced_fatigue,enabled), false]}) then { + _negativeChange = _negativeChange - ((1 - EGVAR(advanced_fatigue,aeReservePercentage)) * 0.1) - ((1 - EGVAR(advanced_fatigue,anReservePercentage)) * 0.05); +}; + +// Effectiveness of capturing oxygen +// increases slightly as po2 starts lowering +// but falls off quickly as po2 drops further +private _capture = 1 max ((_po2 / IDEAL_PPO2) ^ (-_po2 * 3)); +private _positiveChange = _heartRate * 0.00368 * _oxygenSaturation * _capture; + +private _breathingEffectiveness = 1; + +private _rateOfChange = _negativeChange + (_positiveChange * _breathingEffectiveness); + +private _spo2 = (_current + (_rateOfChange * _deltaT)) max 0 min 100; + +_unit setVariable [VAR_OXYGEN_DEMAND, _negativeChange - BASE_OXYGEN_USE]; +_unit setVariable [VAR_SPO2, _spo2, _syncValue]; diff --git a/addons/medical_vitals/initSettings.inc.sqf b/addons/medical_vitals/initSettings.inc.sqf new file mode 100644 index 0000000000..db762d2c52 --- /dev/null +++ b/addons/medical_vitals/initSettings.inc.sqf @@ -0,0 +1,15 @@ +[ + QGVAR(simulateSpO2), + "CHECKBOX", + [LSTRING(simulateSpO2_DisplayName), LSTRING(simulateSpO2_Description)], + [ELSTRING(medical,Category), LSTRING(SubCategory)], + true, + 1, + { + if (_this) exitWith {}; // skip if true + { + _x setVariable [VAR_OXYGEN_DEMAND, 0, true]; + _x setVariable [VAR_SPO2, DEFAULT_SPO2, true]; + } forEach (allUnits select {local _x}) + } // reset oxygen demand on setting change +] call CBA_fnc_addSetting; diff --git a/addons/medical_vitals/script_component.hpp b/addons/medical_vitals/script_component.hpp index 3bfb4bcc26..1064ebc52c 100644 --- a/addons/medical_vitals/script_component.hpp +++ b/addons/medical_vitals/script_component.hpp @@ -16,3 +16,5 @@ #include "\z\ace\addons\medical_engine\script_macros_medical.hpp" #include "\z\ace\addons\main\script_macros.hpp" + +#define BASE_OXYGEN_USE -0.25 diff --git a/addons/medical_vitals/stringtable.xml b/addons/medical_vitals/stringtable.xml new file mode 100644 index 0000000000..f1d7f3fa5b --- /dev/null +++ b/addons/medical_vitals/stringtable.xml @@ -0,0 +1,15 @@ + + + + + Vitals + Vitais + + + Enable SpO2 Simulation + + + Enables oxygen saturation simulation, providing variable heart rate and oxygen demand based on physical activity and altitude. Required for Airway Management. + + + diff --git a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf index 30a0c6ad6e..86415a1914 100644 --- a/addons/microdagr/functions/fnc_mapOnDrawEH.sqf +++ b/addons/microdagr/functions/fnc_mapOnDrawEH.sqf @@ -60,7 +60,7 @@ if (GVAR(currentApplicationPage) == 1) then { _size = 32 * _mapSize; { _x params ["_wpName", "_wpPos"]; - private _alpha = if (_forEachIndex == GVAR(currentWaypoint)) then {1} else {0.5}; + private _alpha = [0.5, 1] select (_forEachIndex == GVAR(currentWaypoint)); _theMap drawIcon [QUOTE(PATHTO_R(images\icon_mapWaypoints.paa)), [1,1,1,_alpha], _wpPos, _size, _size, 0, '', 0 ]; } forEach _waypoints; }; diff --git a/addons/minedetector/functions/fnc_getDetectedObject.sqf b/addons/minedetector/functions/fnc_getDetectedObject.sqf index 6827e59c99..810e4d4ff4 100644 --- a/addons/minedetector/functions/fnc_getDetectedObject.sqf +++ b/addons/minedetector/functions/fnc_getDetectedObject.sqf @@ -49,7 +49,7 @@ private _distance = -1; if (_isDetectable && {!isNull _x}) exitWith { _distance = _detectorPointAGL distance _x; _mine = _x; - TRACE_3("return", _isDetectable, _mine, _distance); + TRACE_3("return",_isDetectable,_mine,_distance); }; } forEach _nearestObjects; diff --git a/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf b/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf index 6ddb60d21b..b690ab2075 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_JAV_DIR.sqf @@ -39,7 +39,7 @@ private _distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; private _distanceToShooter = _projectilePos vectorDistance _shooterPos; private _distanceShooterToTarget = _shooterPos vectorDistance _seekerTargetPos; -TRACE_2("", _distanceToTarget, _distanceToShooter); +TRACE_2("",_distanceToTarget,_distanceToShooter); // Add height depending on distance for compensate private _returnTargetPos = _seekerTargetPos; @@ -69,5 +69,5 @@ switch (_attackProfileStateParams select 0) do { }; }; -TRACE_1("Adjusted target position", _returnTargetPos); +TRACE_1("Adjusted target position",_returnTargetPos); _returnTargetPos; diff --git a/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf b/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf index d7092a924d..f1f360e403 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_JAV_TOP.sqf @@ -39,7 +39,7 @@ private _distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; private _distanceToShooter = _projectilePos vectorDistance _shooterPos; private _distanceShooterToTarget = _shooterPos vectorDistance _seekerTargetPos; -TRACE_2("", _distanceToTarget, _distanceToShooter); +TRACE_2("",_distanceToTarget,_distanceToShooter); // Add height depending on distance for compensate private _returnTargetPos = _seekerTargetPos; @@ -58,7 +58,7 @@ switch( (_attackProfileStateParams select 0) ) do { private _cruisAlt = 140; if (_distanceShooterToTarget < 1250) then { _cruisAlt = 140 * (_distanceShooterToTarget/1250); - TRACE_1("_cruisAlt", _cruisAlt); + TRACE_1("_cruisAlt",_cruisAlt); }; if ( ((ASLToAGL _projectilePos) select 2) - ((ASLToAGL _seekerTargetPos) select 2) >= _cruisAlt) then { if (_cruisAlt < 140) then { @@ -72,7 +72,7 @@ switch( (_attackProfileStateParams select 0) ) do { }; case STAGE_COAST: { TRACE_1("STAGE_COAST",""); - TRACE_1("", ((ASLToAGL _projectilePos) select 2) - (( ASLToAGL _seekerTargetPos) select 2) ); + TRACE_1("",((ASLToAGL _projectilePos) select 2) - (( ASLToAGL _seekerTargetPos) select 2)); if (_distanceToTarget < ( ((ASLToAGL _projectilePos) select 2) - (( ASLToAGL _seekerTargetPos) select 2) ) * 2) then { _attackProfileStateParams set [0, STAGE_TERMINAL]; } else { @@ -86,5 +86,5 @@ switch( (_attackProfileStateParams select 0) ) do { }; }; -TRACE_1("Adjusted target position", _returnTargetPos); +TRACE_1("Adjusted target position",_returnTargetPos); _returnTargetPos; diff --git a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf index 23476ec46c..e346b16eb6 100644 --- a/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf +++ b/addons/missileguidance/functions/fnc_attackProfile_LIN.sqf @@ -30,7 +30,7 @@ private _distanceToTarget = _projectilePos vectorDistance _seekerTargetPos; private _distanceToShooter = _projectilePos vectorDistance _shooterPos; private _distanceShooterToTarget = _shooterPos vectorDistance _seekerTargetPos; -TRACE_2("", _distanceToTarget, _distanceToShooter); +TRACE_2("",_distanceToTarget,_distanceToShooter); // Add height depending on distance for compensate private _addHeight = [0,0,0]; diff --git a/addons/missileguidance/functions/fnc_guidancePFH.sqf b/addons/missileguidance/functions/fnc_guidancePFH.sqf index 132af330c3..0620e9e3c0 100644 --- a/addons/missileguidance/functions/fnc_guidancePFH.sqf +++ b/addons/missileguidance/functions/fnc_guidancePFH.sqf @@ -37,7 +37,7 @@ private _adjustTime = 1; if (accTime > 0) then { _adjustTime = 1/accTime; _adjustTime = _adjustTime * (_runtimeDelta / TIMESTEP_FACTOR); - TRACE_4("Adjust timing", 1/accTime, _adjustTime, _runtimeDelta, (_runtimeDelta / TIMESTEP_FACTOR) ); + TRACE_4("Adjust timing",1/accTime,_adjustTime,_runtimeDelta,(_runtimeDelta / TIMESTEP_FACTOR)); } else { _adjustTime = 0; }; @@ -89,8 +89,8 @@ if ((_minDeflection != 0 || {_maxDeflection != 0}) && {_profileAdjustedTargetPos }; private _finalAdjustVector = [_yaw, _roll, _pitch]; - TRACE_3("", _pitch, _yaw, _roll); - TRACE_3("", _targetVector, _adjustVector, _finalAdjustVector); + TRACE_3("",_pitch,_yaw,_roll); + TRACE_3("",_targetVector,_adjustVector,_finalAdjustVector); if (accTime > 0) then { private _changeVector = (vectorDir _projectile) vectorAdd _finalAdjustVector; diff --git a/addons/missileguidance/functions/fnc_onFired.sqf b/addons/missileguidance/functions/fnc_onFired.sqf index 1c964c5113..1f3519f8c9 100644 --- a/addons/missileguidance/functions/fnc_onFired.sqf +++ b/addons/missileguidance/functions/fnc_onFired.sqf @@ -71,14 +71,14 @@ if (isNil "_target") then { if (!isPlayer _shooter) then { // This was an AI shot, lets still guide it on the AI target _target = _shooter getVariable [QGVAR(vanilla_target), nil]; - TRACE_1("Detected AI Shooter!", _target); + TRACE_1("Detected AI Shooter!",_target); } else { private _canUseLock = getNumber (_config >> "canVanillaLock"); // @TODO: Get vanilla target if (_canUseLock > 0 || difficulty < 1) then { private _vanillaTarget = cursorTarget; - TRACE_1("Using Vanilla Locking", _vanillaTarget); + TRACE_1("Using Vanilla Locking",_vanillaTarget); if (!isNil "_vanillaTarget") then { _target = _vanillaTarget; }; diff --git a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf index 7fc30fb30b..bac01d05b4 100644 --- a/addons/missileguidance/functions/fnc_seekerType_Optic.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_Optic.sqf @@ -34,12 +34,12 @@ private _losOkay = false; if (_angleOkay) then { _losOkay = [_projectile, _target] call FUNC(checkLos); }; -TRACE_2("", _angleOkay, _losOkay); +TRACE_2("",_angleOkay,_losOkay); // Can't see target, return [0,0,0] and let doSeekerSearch handle it if (!_angleOkay || !_losOkay) exitWith {[0,0,0]}; -TRACE_2("", _target, _foundTargetPos); +TRACE_2("",_target,_foundTargetPos); // @TODO: Configurable lead for seekers private _projectileSpeed = (vectorMagnitude velocity _projectile); private _distanceToTarget = (getPosASL _projectile) vectorDistance _foundTargetPos; diff --git a/addons/missileguidance/functions/fnc_seekerType_SALH.sqf b/addons/missileguidance/functions/fnc_seekerType_SALH.sqf index 4b74d0f7e3..a16c58ce5f 100644 --- a/addons/missileguidance/functions/fnc_seekerType_SALH.sqf +++ b/addons/missileguidance/functions/fnc_seekerType_SALH.sqf @@ -27,6 +27,6 @@ _laserParams params ["_code", "_wavelengthMin", "_wavelengthMax"]; private _laserResult = [(getPosASL _projectile), (velocity _projectile), _seekerAngle, _seekerMaxRange, [_wavelengthMin, _wavelengthMax], _code, _projectile] call EFUNC(laser,seekerFindLaserSpot); private _foundTargetPos = _laserResult select 0; -TRACE_1("Search", _laserResult); +TRACE_1("Search",_laserResult); _foundTargetPos; diff --git a/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf b/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf index 3356e91c11..663afa2cc7 100644 --- a/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf +++ b/addons/mk6mortar/functions/fnc_csw_getProxyWeapon.sqf @@ -55,7 +55,7 @@ if (_proxyWeaponNeeded || GVAR(useAmmoHandling)) then { }; }; } else { - WARNING_1("unknown mag %1", _xMag); + WARNING_1("unknown mag %1",_xMag); }; }; } forEach (magazinesAllTurrets _mortar); diff --git a/addons/modules/XEH_postInit.sqf b/addons/modules/XEH_postInit.sqf index bdc6a9cc40..c391916f19 100644 --- a/addons/modules/XEH_postInit.sqf +++ b/addons/modules/XEH_postInit.sqf @@ -26,7 +26,7 @@ _function = missionNamespace getVariable _function; }; if (_isSingular && {_logicType in _uniqueModulesHandled}) then { //ToDo: should this be an exit? - WARNING_1("Module [%1] - More than 1 singular module placed", _logicType); + WARNING_1("Module [%1] - More than 1 singular module placed",_logicType); }; if (_isSingular) then {_uniqueModulesHandled pushBack _logicType;}; diff --git a/addons/nametags/functions/fnc_drawNameTagIcon.sqf b/addons/nametags/functions/fnc_drawNameTagIcon.sqf index aa9c900390..428cf037d5 100644 --- a/addons/nametags/functions/fnc_drawNameTagIcon.sqf +++ b/addons/nametags/functions/fnc_drawNameTagIcon.sqf @@ -21,7 +21,7 @@ * Public: No */ -TRACE_1("drawName:", _this); +TRACE_1("drawName:",_this); params ["", "_target", "", "_heightOffset"]; diff --git a/addons/nightvision/functions/fnc_onFiredPlayer.sqf b/addons/nightvision/functions/fnc_onFiredPlayer.sqf index 0be73062d2..5bc7ff621e 100644 --- a/addons/nightvision/functions/fnc_onFiredPlayer.sqf +++ b/addons/nightvision/functions/fnc_onFiredPlayer.sqf @@ -16,7 +16,7 @@ */ //IGNORE_PRIVATE_WARNING ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"]; -TRACE_7("firedEH:",_unit, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile); +TRACE_7("firedEH:",_unit,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); if ((!GVAR(running)) || {!GVAR(shutterEffects)} @@ -55,7 +55,7 @@ _visibleFire = _visibleFireCoef * _visibleFire; if (_ammo isKindOf "BulletBase") then { _visibleFire = _visibleFire min 5; // Prevent every shot from triggering with HMG }; -TRACE_1("final", _visibleFire); +TRACE_1("final",_visibleFire); if (_visibleFire <= 1.5) exitWith {}; if ((random (linearConversion [1, 4, GVAR(nvgGeneration), 10, 20])) > _visibleFire) exitWith {}; diff --git a/addons/nightvision/functions/fnc_pfeh.sqf b/addons/nightvision/functions/fnc_pfeh.sqf index ad484d097e..dbd101631c 100644 --- a/addons/nightvision/functions/fnc_pfeh.sqf +++ b/addons/nightvision/functions/fnc_pfeh.sqf @@ -36,7 +36,7 @@ if (EGVAR(common,OldIsCamera)) exitWith { }; }; if (!GVAR(running)) then { - TRACE_1("Un-Pausing", GVAR(paused)); + TRACE_1("Un-Pausing",GVAR(paused)); GVAR(running) = true; [true] call FUNC(setupDisplayEffects); [] call FUNC(refreshGoggleType); diff --git a/addons/nightvision/functions/fnc_refreshGoggleType.sqf b/addons/nightvision/functions/fnc_refreshGoggleType.sqf index 7414e58d02..ccfbd017b6 100644 --- a/addons/nightvision/functions/fnc_refreshGoggleType.sqf +++ b/addons/nightvision/functions/fnc_refreshGoggleType.sqf @@ -51,7 +51,7 @@ if ((alive ACE_player) && {isNull (ACE_controlledUAV select 0)}) then { if (isArray (_config >> QGVAR(colorPreset))) then {_preset = getArray (_config >> QGVAR(colorPreset));}; }; - TRACE_1("source: hmd",GVAR(playerHMD)); // Source is player's HMD (or possibly a NVG scope, but no good way to detect that) + TRACE_1("source: hmd",GVAR(playerHMD)); // Source is player's HMD (or possibly a NVG scope,but no good way to detect that) private _config = configFile >> "CfgWeapons" >> GVAR(playerHMD); if (!isClass _config) exitWith {}; diff --git a/addons/nlaw/functions/fnc_attackProfile.sqf b/addons/nlaw/functions/fnc_attackProfile.sqf index ad7622eadd..9628974800 100644 --- a/addons/nlaw/functions/fnc_attackProfile.sqf +++ b/addons/nlaw/functions/fnc_attackProfile.sqf @@ -56,5 +56,5 @@ if ((count _test) > 0) then { }; #endif -// TRACE_1("Adjusted target position", _returnTargetPos); +// TRACE_1("Adjusted target position",_returnTargetPos); _returnTargetPos; diff --git a/addons/optics/functions/fnc_handleFired.sqf b/addons/optics/functions/fnc_handleFired.sqf index 5a1ae0eca0..f36f04d881 100644 --- a/addons/optics/functions/fnc_handleFired.sqf +++ b/addons/optics/functions/fnc_handleFired.sqf @@ -18,7 +18,7 @@ */ // 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); disableSerialization; diff --git a/addons/optics/functions/fnc_onDrawScope2D.sqf b/addons/optics/functions/fnc_onDrawScope2D.sqf index df431407da..c7fb19c9c1 100644 --- a/addons/optics/functions/fnc_onDrawScope2D.sqf +++ b/addons/optics/functions/fnc_onDrawScope2D.sqf @@ -80,11 +80,11 @@ if (_isPIP) then { // Calculate lighting private _dayOpacity = call EFUNC(common,ambientBrightness); -private _nightOpacity = [1, 0] select (_dayOpacity == 1); +private _nightOpacity = parseNumber (_dayOpacity == 1); // Apply lighting and make layers visible (_display displayCtrl 1713001) ctrlSetTextColor [1, 1, 1, 1]; -(_display displayCtrl 1713002) ctrlSetTextColor [1, 1, 1, [0, 1] select (_dayOpacity < 0.5)]; +(_display displayCtrl 1713002) ctrlSetTextColor [1, 1, 1, parseNumber (_dayOpacity < 0.5)]; (_display displayCtrl 1713005) ctrlSetTextColor [1, 1, 1, _dayOpacity]; (_display displayCtrl 1713006) ctrlSetTextColor [1, 1, 1, _nightOpacity]; diff --git a/addons/overheating/XEH_postInit.sqf b/addons/overheating/XEH_postInit.sqf index bbcd9da97f..8f02d734e5 100644 --- a/addons/overheating/XEH_postInit.sqf +++ b/addons/overheating/XEH_postInit.sqf @@ -20,7 +20,7 @@ if (hasInterface) then { }; ["CBA_settingsInitialized", { - TRACE_1("SettingsInitialized eh", GVAR(enabled)); + TRACE_1("SettingsInitialized eh",GVAR(enabled)); if (!GVAR(enabled)) exitWith {}; if (isServer) then { diff --git a/addons/overheating/functions/fnc_firedEH.sqf b/addons/overheating/functions/fnc_firedEH.sqf index 9db3a73dd6..bdb7f864c9 100644 --- a/addons/overheating/functions/fnc_firedEH.sqf +++ b/addons/overheating/functions/fnc_firedEH.sqf @@ -16,7 +16,7 @@ */ //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); BEGIN_COUNTER(firedEH); diff --git a/addons/overpressure/functions/fnc_firedEHBB.sqf b/addons/overpressure/functions/fnc_firedEHBB.sqf index a36eb8bd56..2ef48bf4d9 100644 --- a/addons/overpressure/functions/fnc_firedEHBB.sqf +++ b/addons/overpressure/functions/fnc_firedEHBB.sqf @@ -16,7 +16,7 @@ */ //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); // Retrieve backblast values private _bbValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues); diff --git a/addons/overpressure/functions/fnc_firedEHOP.sqf b/addons/overpressure/functions/fnc_firedEHOP.sqf index 7a76f4b2be..2345d09327 100644 --- a/addons/overpressure/functions/fnc_firedEHOP.sqf +++ b/addons/overpressure/functions/fnc_firedEHOP.sqf @@ -16,7 +16,7 @@ */ //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); // Retrieve overpressure values private _opValues = [_weapon, _ammo, _magazine] call FUNC(getOverPressureValues); diff --git a/addons/overpressure/functions/fnc_getDistance.sqf b/addons/overpressure/functions/fnc_getDistance.sqf index 891178cb52..64ee563974 100644 --- a/addons/overpressure/functions/fnc_getDistance.sqf +++ b/addons/overpressure/functions/fnc_getDistance.sqf @@ -19,7 +19,7 @@ */ params ["_posASL", "_direction", "_maxDistance", "_shooter"]; -TRACE_4("params",_posASL,_direction,_maxDistance, _shooter); +TRACE_4("params",_posASL,_direction,_maxDistance,_shooter); private _intersections = lineIntersectsSurfaces [_posASL, _posASL vectorAdd (_direction vectorMultiply _maxDistance), _shooter, objNull, true, 99]; diff --git a/addons/parachute/functions/fnc_cutParachute.sqf b/addons/parachute/functions/fnc_cutParachute.sqf index 564a9e09cd..c66d9ff050 100644 --- a/addons/parachute/functions/fnc_cutParachute.sqf +++ b/addons/parachute/functions/fnc_cutParachute.sqf @@ -16,7 +16,7 @@ * Public: No */ params ["_unit", "_parachute"]; -TRACE_2("cutParachute", _unit, _parachute); +TRACE_2("cutParachute",_unit,_parachute); playSound3d ["A3\Sounds_F\characters\parachute\parachute_landing.wss", _unit]; _unit action ["GetOut", _parachute]; diff --git a/addons/parachute/functions/fnc_showAltimeter.sqf b/addons/parachute/functions/fnc_showAltimeter.sqf index 47b014f4ab..d4533a7a6b 100644 --- a/addons/parachute/functions/fnc_showAltimeter.sqf +++ b/addons/parachute/functions/fnc_showAltimeter.sqf @@ -53,8 +53,8 @@ private _TimeText = _display displayCtrl 1001; }; _TimeText ctrlSetText (format ["%1:%2", [_hour, 2] call CBA_fnc_formatNumber, [_minute, 2] call CBA_fnc_formatNumber]); - _HeightText ctrlSetText (format ["%1", floor _height]); - _DecendRate ctrlSetText (format ["%1", _descentRate max 0]); + _HeightText ctrlSetText str floor _height; + _DecendRate ctrlSetText str (_descentRate max 0); (_this select 0) set [1, _height]; (_this select 0) set [2, _curTime]; diff --git a/addons/rangecard/functions/fnc_updateRangeCard.sqf b/addons/rangecard/functions/fnc_updateRangeCard.sqf index e8fb0f9c6c..999dfc5a2e 100644 --- a/addons/rangecard/functions/fnc_updateRangeCard.sqf +++ b/addons/rangecard/functions/fnc_updateRangeCard.sqf @@ -33,7 +33,7 @@ if (_ammoClass == "" || _magazineClass == "" || _weaponClass == "") exitWith {}; GVAR(controls) = []; for "_row" from 0 to 49 do { - private _offset = if (_row < 5) then {0} else {0.003}; + private _offset = [0.003, 0] select (_row < 5); private _control = (__dsp ctrlCreate ["RangeCard_RscText", 790000 + _row]); _control ctrlSetPosition [safeZoneX + 0.183, safeZoneY + 0.374 + 0.027 * _row + _offset, 0.062, 0.025]; if (_row in [0, 8, 18, 28, 38, 48]) then { @@ -47,7 +47,7 @@ for "_row" from 0 to 49 do { }; for "_column" from 0 to 8 do { for "_row" from 0 to 49 do { - private _offset = if (_row < 5) then {0} else {0.003}; + private _offset = [0.003, 0] select (_row < 5); private _control = (__dsp ctrlCreate ["RangeCard_RscText", 90000 + _column * 100 + _row]); _control ctrlSetPosition [safeZoneX + 0.249 + _column * 0.055, safeZoneY + 0.374 + 0.027 * _row + _offset, 0.052, 0.025]; _control ctrlCommit 0; @@ -57,7 +57,7 @@ for "_column" from 0 to 8 do { }; for "_column" from 0 to 2 do { for "_row" from 0 to 49 do { - private _offset = if (_row < 5) then {0} else {0.003}; + private _offset = [0.003, 0] select (_row < 5); private _control = (__dsp ctrlCreate ["RangeCard_RscText", 90000 + (9 +_column) * 100 + _row]); _control ctrlSetPosition [safeZoneX + 0.743 + _column * 0.049, safeZoneY + 0.374 + 0.027 * _row + _offset, 0.047, 0.025]; _control ctrlCommit 0; @@ -67,7 +67,7 @@ for "_column" from 0 to 2 do { }; for "_column" from 0 to 2 do { for "_row" from 0 to 49 do { - private _offset = if (_row < 5) then {0} else {0.003}; + private _offset = [0.003, 0] select (_row < 5); private _control = (__dsp ctrlCreate ["RangeCard_RscText", 90000 + (12 +_column) * 100 + _row]); _control ctrlSetPosition [safeZoneX + 0.892 + _column * 0.049, safeZoneY + 0.374 + 0.027 * _row + _offset, 0.047, 0.025]; _control ctrlCommit 0; diff --git a/addons/rearm/functions/fnc_rearmSuccessLocal.sqf b/addons/rearm/functions/fnc_rearmSuccessLocal.sqf index 71802451b7..f41dff6ea9 100644 --- a/addons/rearm/functions/fnc_rearmSuccessLocal.sqf +++ b/addons/rearm/functions/fnc_rearmSuccessLocal.sqf @@ -54,7 +54,7 @@ private _maxMagazines = [_vehicle, _turretPath, _magazineClass] call FUNC(getMax private _ammoCounts = [_vehicle, _turretPath, _magazineClass] call FUNC(getTurretMagazineAmmo); TRACE_3("start",_magazineClass,_maxMagazines,_ammoCounts); -private _ammoToAdd = if (GVAR(level) == 2) then {_numRounds} else {_rounds}; +private _ammoToAdd = [_rounds, _numRounds] select (GVAR(level) == 2); private _ammoAdded = 0; private _arrayModified = false; // skip needing to remove and re-add mags, if we are only adding new ones diff --git a/addons/rearm/stringtable.xml b/addons/rearm/stringtable.xml index 7ddee1dc83..157be6eec2 100644 --- a/addons/rearm/stringtable.xml +++ b/addons/rearm/stringtable.xml @@ -651,7 +651,7 @@ Rearm Cargo Munitionsvorrat - 再武装用カーゴ + 再武装用資源積載量 Ładunek Dozbrajający Munizioni Caricate Боеприпасы для перевооружения @@ -666,7 +666,7 @@ The cargo for rearming (-1 disable) Der Munitionsvorrat, zum Aufmunitionieren von Fahrzeugen (-1 deaktiviert) - カーゴからの再武装 (-1 で無効化) + 再武装に使用する資源の積載量 (-1 で補給無効) Ładunek do dozbrajania (-1 wyłączy) Il carico di munizioni per poter riarmare (-1 per disabilitarlo) Объем боеприпасов для перевооружения (-1 для отмены) diff --git a/addons/recoil/functions/fnc_camshake.sqf b/addons/recoil/functions/fnc_camshake.sqf index 8ffa0eb755..e2a7e3a4a1 100644 --- a/addons/recoil/functions/fnc_camshake.sqf +++ b/addons/recoil/functions/fnc_camshake.sqf @@ -17,7 +17,7 @@ */ //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); #define BASE_POWER 0.40 #define BASE_TIME 0.19 diff --git a/addons/refuel/functions/fnc_getCapacity.sqf b/addons/refuel/functions/fnc_getCapacity.sqf index 94681480ae..c6218831da 100644 --- a/addons/refuel/functions/fnc_getCapacity.sqf +++ b/addons/refuel/functions/fnc_getCapacity.sqf @@ -30,7 +30,7 @@ if (isNil "_capacity") then { // Set capacity even if this isn't a fuel source to save on config lookup time in the event this function is used in a loop _source setVariable [QGVAR(capacity), _capacity, true]; // handle weird edge case when trying to run on "camera"/CfgNonAIVehicles which won't support setVariable and will inf-loop - if (isNil {_source getVariable QGVAR(capacity)}) exitWith { WARNING_1("trying to getCapacity from non-CfgVehicle %1", _this); }; + if (isNil {_source getVariable QGVAR(capacity)}) exitWith { WARNING_1("trying to getCapacity from non-CfgVehicle %1",_this); }; [_source, _capacity] call FUNC(setFuel); }; diff --git a/addons/refuel/stringtable.xml b/addons/refuel/stringtable.xml index ed9b139593..4752f83caf 100644 --- a/addons/refuel/stringtable.xml +++ b/addons/refuel/stringtable.xml @@ -553,7 +553,7 @@ Время взаимодействия со шлангом Tiempo de interacción con la Bomba/Manguera Tempo di interazione Pompa/Pistola - ポンプとホースのインタラクション所要時間 + ポンプ/ホースのインタラクション所要時間 Czas Interakcji z Pompą/Wężem Interaktionszeit zwischen Pumpe und Schlauch Temps d'interaction pompe/tuyau @@ -574,7 +574,7 @@ Fuel Cargo Volume Tankvolumen Объем топлива для заправки - 貯油量 + 給油用燃料積載量 Capacità di Carico Carburante 儲油量 储油量 @@ -591,7 +591,7 @@ The fuel volume available for refueling (-1 disable, -10 if infinite) Das Tankvolumen, welches zum Nachtanken verfügbar ist (-1 deaktiviert, -10 unendlich) Объем топлива, доступный для заправки других машин (-1 отключить, -10 если неограничен) - 給油用の貯油量を設定できます (-1で無効、-10で無限) + 給油に使用する燃料の積載量 (-1で補給無効、-10で無限補給) La capacità di carburante disponibile al rifornimento altrui (-1 disabilita, -10 se infinito) 設定有多少油料可供載具進行加油(-1時關閉,-10為無限油量) 设定有多少油料可供载具进行加油(-1时关闭,-10为无限油量) diff --git a/addons/reload/CfgVehicles.hpp b/addons/reload/CfgVehicles.hpp index 22086ad867..5a05f03734 100644 --- a/addons/reload/CfgVehicles.hpp +++ b/addons/reload/CfgVehicles.hpp @@ -45,5 +45,48 @@ class CfgVehicles { }; }; }; + + class ACE_SelfActions { + class GVAR(reloadTurret) { + displayName = "$STR_controls_tooltips_RELOAD_MAGAZINE"; + condition = QUOTE(call FUNC(canSwapTurretMagazine)); + statement = QUOTE(call FUNC(swapTurretMagazine)); + icon = "\A3\ui_f\data\igui\cfg\simpletasks\types\rearm_ca.paa"; + }; + }; + }; + + class Tank: LandVehicle { + class ACE_SelfActions { + class GVAR(reloadTurret) { + displayName = "$STR_controls_tooltips_RELOAD_MAGAZINE"; + condition = QUOTE(call FUNC(canSwapTurretMagazine)); + statement = QUOTE(call FUNC(swapTurretMagazine)); + icon = "\A3\ui_f\data\igui\cfg\simpletasks\types\rearm_ca.paa"; + }; + }; + }; + + class Car: LandVehicle { + class ACE_SelfActions { + class GVAR(reloadTurret) { + displayName = "$STR_controls_tooltips_RELOAD_MAGAZINE"; + condition = QUOTE(call FUNC(canSwapTurretMagazine)); + statement = QUOTE(call FUNC(swapTurretMagazine)); + icon = "\A3\ui_f\data\igui\cfg\simpletasks\types\rearm_ca.paa"; + }; + }; + }; + + class Air; + class Helicopter: Air { + class ACE_SelfActions { + class GVAR(reloadTurret) { + displayName = "$STR_controls_tooltips_RELOAD_MAGAZINE"; + condition = QUOTE(call FUNC(canSwapTurretMagazine)); + statement = QUOTE(call FUNC(swapTurretMagazine)); + icon = "\A3\ui_f\data\igui\cfg\simpletasks\types\rearm_ca.paa"; + }; + }; }; }; diff --git a/addons/reload/CfgWeapons.hpp b/addons/reload/CfgWeapons.hpp new file mode 100644 index 0000000000..0d52ae8f5c --- /dev/null +++ b/addons/reload/CfgWeapons.hpp @@ -0,0 +1,16 @@ +class CfgWeapons { + class HMG_01; + class HMG_static: HMG_01 { + type = 1; // makes it possible to swap to the fullest magazine + }; + + class GMG_F; + class GMG_20mm: GMG_F { + type = 1; + }; + + class CannonCore; + class mortar_82mm: CannonCore { + type = 1; + }; +}; diff --git a/addons/reload/XEH_PREP.hpp b/addons/reload/XEH_PREP.hpp index 578bc2ce9f..1a62a9f5bd 100644 --- a/addons/reload/XEH_PREP.hpp +++ b/addons/reload/XEH_PREP.hpp @@ -1,7 +1,9 @@ PREP(canCheckAmmo); PREP(canCheckAmmoSelf); +PREP(canSwapTurretMagazine); PREP(getAmmoToLinkBelt); PREP(checkAmmo); PREP(displayAmmo); PREP(onTake); PREP(startLinkingBelt); +PREP(swapTurretMagazine); diff --git a/addons/reload/XEH_postInit.sqf b/addons/reload/XEH_postInit.sqf index 02dedd14c3..a219efed0a 100644 --- a/addons/reload/XEH_postInit.sqf +++ b/addons/reload/XEH_postInit.sqf @@ -53,3 +53,18 @@ if (!hasInterface) exitWith {}; #include "initKeybinds.inc.sqf" + +// Reload when default reload keybind is pressed +addUserActionEventHandler ["ReloadMagazine", "Activate", { + private _vehicle = objectParent ACE_player; + + // If on foot, skip + if (isNull _vehicle) exitWith {}; + + // weaponState is only updated after 3 frames, so wait to run checks in case we're doing an engine reload at the same time + [{ + if !(_this call FUNC(canSwapTurretMagazine)) exitWith {}; + + _this call FUNC(swapTurretMagazine); + }, [_vehicle, ACE_player], 3] call CBA_fnc_execAfterNFrames; +}]; diff --git a/addons/reload/config.cpp b/addons/reload/config.cpp index 1cd11c5b17..f4871f1354 100644 --- a/addons/reload/config.cpp +++ b/addons/reload/config.cpp @@ -14,10 +14,11 @@ class CfgPatches { }; }; -#include "ACE_Arsenal_Stats.hpp" -#include "CfgVehicles.hpp" -#include "CfgMagazines.hpp" -#include "CfgEventHandlers.hpp" #include "CfgActions.hpp" +#include "CfgEventHandlers.hpp" +#include "CfgMagazines.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" +#include "ACE_Arsenal_Stats.hpp" #include "ACE_Settings.hpp" #include "ACE_UI.hpp" diff --git a/addons/reload/functions/fnc_canSwapTurretMagazine.sqf b/addons/reload/functions/fnc_canSwapTurretMagazine.sqf new file mode 100644 index 0000000000..114a124776 --- /dev/null +++ b/addons/reload/functions/fnc_canSwapTurretMagazine.sqf @@ -0,0 +1,52 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror, johnb43 + * Check if the player can reload their vehicle's magazine to one with more ammo. + * + * Arguments: + * 0: Vehicle + * 1: Player + * + * Return Value: + * Can swap turret magazine + * + * Example: + * [vehicle player, player] call ace_reload_fnc_canSwapTurretMagazine + * + * Public: No + */ + +params ["_vehicle", "_unit"]; +TRACE_2("canSwapTurretMagazine",_vehicle,_unit); + +private _turretPath = _vehicle unitTurret _unit; +if (_turretPath in [[-1], []]) exitWith {false}; // skip driver / cargo +if !(_vehicle turretLocal _turretPath) exitWith {false}; // just to be safe + +(weaponState [_vehicle, _turretPath]) params ["_weapon", "_muzzle", "", "_magazine", "_ammoCount", "_roundReloadPhase", "_magazineReloadPhase"]; +TRACE_5("",_weapon,_muzzle,_magazine,_ammoCount,typeOf _vehicle); + +if ((_weapon == "") || {_weapon != _muzzle}) exitWith {false}; // skip multi-muzzle (he/ap auto-cannons) +if (_magazine == "") exitWith {false}; +if (_roundReloadPhase + _magazineReloadPhase != 0) exitWith {false}; // can't reload while already reloading or while shooting +if (isText (configFile >> "CfgMagazines" >> _magazine >> "pylonWeapon")) exitWith {false}; +if (getNumber (configFile >> "CfgWeapons" >> _weapon >> "type") % 2 == 1) exitWith {false}; // engine support for magazine swapping + +private _maxAmmo = getNumber (configFile >> "CfgMagazines" >> _magazine >> "count"); +if ((_ammoCount == 0) || {_ammoCount == _maxAmmo}) exitWith {false}; + +private _magAmmoCounts = []; + +// Get count of rounds in magazines +{ + _x params ["_xMag", "_xTurret", "_xAmmo"]; + + if ((_xMag == _magazine) && {_xTurret isEqualTo _turretPath}) then { + _magAmmoCounts pushBack _xAmmo; + }; +} forEach (magazinesAllTurrets _vehicle); + +TRACE_1("",_magAmmoCounts); + +// Select maximum +(selectMax _magAmmoCounts) > _ammoCount diff --git a/addons/reload/functions/fnc_swapTurretMagazine.sqf b/addons/reload/functions/fnc_swapTurretMagazine.sqf new file mode 100644 index 0000000000..c4574398d1 --- /dev/null +++ b/addons/reload/functions/fnc_swapTurretMagazine.sqf @@ -0,0 +1,43 @@ +#include "..\script_component.hpp" +/* + * Author: PabstMirror, johnb43 + * Reloads a vehicles turret to a new magazine. + * + * Arguments: + * 0: Vehicle + * 1: Player + * + * Return Value: + * None + * + * Example: + * [vehicle player, player] call ace_reload_fnc_swapTurretMagazine + * + * Public: No + */ + +params ["_vehicle", "_unit"]; +TRACE_2("swapTurretMagazine",_vehicle,_unit); + +private _turretPath = _vehicle unitTurret _unit; +(weaponState [_vehicle, _turretPath]) params ["_weapon", "_muzzle", "", "_magazine"]; +TRACE_3("",_weapon,_magazine,typeOf _vehicle); + +private _magazinesAllTurrets = []; + +// Get magazines that are of the correct type; Exclude empty mags +{ + _x params ["_xMag", "_xTurret", "_xAmmo"]; + + if ((_xMag == _magazine) && {_xTurret isEqualTo _turretPath} && {_xAmmo > 0}) then { + _magazinesAllTurrets pushBack _x; + }; +} forEach (magazinesAllTurrets _vehicle); + +// Get count of rounds in magazines, then select maximum +private _magAmmoCounts = _magazinesAllTurrets apply {_x select 2}; +private _mag = _magazinesAllTurrets select (_magAmmoCounts find (selectMax _magAmmoCounts)); + +TRACE_2("",_magAmmoCounts,_mag); + +_unit action ["loadMagazine", _vehicle, _unit, _mag select 4, _mag select 3, _weapon, _muzzle]; diff --git a/addons/repair/functions/fnc_addRepairActions.sqf b/addons/repair/functions/fnc_addRepairActions.sqf index d071f577a6..1e0147d7e2 100644 --- a/addons/repair/functions/fnc_addRepairActions.sqf +++ b/addons/repair/functions/fnc_addRepairActions.sqf @@ -23,7 +23,7 @@ if !(hasInterface && {GVAR(enabled)}) exitWith {}; params ["_vehicle"]; private _type = typeOf _vehicle; -TRACE_2("addRepairActions", _vehicle,_type); +TRACE_2("addRepairActions",_vehicle,_type); // do nothing if the class is already initialized private _initializedClasses = GETMVAR(GVAR(initializedClasses),[]); diff --git a/addons/repair/functions/fnc_doRepair.sqf b/addons/repair/functions/fnc_doRepair.sqf index d02ab33fb7..58dd4590bb 100644 --- a/addons/repair/functions/fnc_doRepair.sqf +++ b/addons/repair/functions/fnc_doRepair.sqf @@ -35,7 +35,7 @@ private _hitPointNewDamage = (_hitPointCurDamage - 0.5) max _postRepairDamageMin if (_hitPointNewDamage < _hitPointCurDamage) then { // raise event to set the new hitpoint damage - TRACE_3("repairing main point", _vehicle, _hitPointIndex, _hitPointNewDamage); + TRACE_3("repairing main point",_vehicle,_hitPointIndex,_hitPointNewDamage); [QGVAR(setVehicleHitPointDamage), [_vehicle, _hitPointIndex, _hitPointNewDamage], _vehicle] call CBA_fnc_targetEvent; _hitPointCurDamage = _hitPointNewDamage; }; @@ -57,7 +57,7 @@ if (isArray _hitpointGroupConfig) then { private _subPointCurDamage = _vehicle getHitIndex _hitPointIndex; private _subPointNewDamage = (_subPointCurDamage - 0.5) max _postRepairDamageMin; if (_subPointNewDamage < _subPointCurDamage) then { - TRACE_3("repairing sub point", _vehicle, _subHitIndex, _subPointNewDamage); + TRACE_3("repairing sub point",_vehicle,_subHitIndex,_subPointNewDamage); [QGVAR(setVehicleHitPointDamage), [_vehicle, _subHitIndex, _subPointNewDamage], _vehicle] call CBA_fnc_targetEvent; }; }; diff --git a/addons/repair/functions/fnc_doRepairTrack.sqf b/addons/repair/functions/fnc_doRepairTrack.sqf index a970488268..519a3f78d6 100644 --- a/addons/repair/functions/fnc_doRepairTrack.sqf +++ b/addons/repair/functions/fnc_doRepairTrack.sqf @@ -26,7 +26,7 @@ TRACE_4("params",_unit,_vehicle,_hitPoint,_claimedObjects); _claimedObjects params [["_track", objNull]]; if ((isNull _track) || {!([_unit, _track, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith))}) exitWith { - ERROR_1("Bad Track", _claimedObjects); + ERROR_1("Bad Track",_claimedObjects); }; // can't use a destroyed track diff --git a/addons/repair/functions/fnc_doReplaceTrack.sqf b/addons/repair/functions/fnc_doReplaceTrack.sqf index d52072b647..a512089c89 100644 --- a/addons/repair/functions/fnc_doReplaceTrack.sqf +++ b/addons/repair/functions/fnc_doReplaceTrack.sqf @@ -26,7 +26,7 @@ TRACE_4("params",_unit,_vehicle,_hitPoint,_claimedObjects); _claimedObjects params [["_track", objNull]]; if ((isNull _track) || {!([_unit, _track, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith))}) exitWith { - ERROR_1("Bad Track", _claimedObjects); + ERROR_1("Bad Track",_claimedObjects); }; // get current hitpoint damage diff --git a/addons/repair/functions/fnc_doReplaceWheel.sqf b/addons/repair/functions/fnc_doReplaceWheel.sqf index 98c3d95cf9..7ec617127c 100644 --- a/addons/repair/functions/fnc_doReplaceWheel.sqf +++ b/addons/repair/functions/fnc_doReplaceWheel.sqf @@ -26,7 +26,7 @@ TRACE_4("params",_unit,_vehicle,_hitPoint,_claimedObjects); _claimedObjects params [["_wheel", objNull]]; if ((isNull _wheel) || {!([_unit, _wheel, ["isNotDragging", "isNotCarrying", "isNotOnLadder"]] call EFUNC(common,canInteractWith))}) exitWith { - WARNING_1("Bad Claimed Wheel", _claimedObjects); + WARNING_1("Bad Claimed Wheel",_claimedObjects); }; // get current hitpoint damage diff --git a/addons/repair/functions/fnc_getHitPointString.sqf b/addons/repair/functions/fnc_getHitPointString.sqf index 5611a6f4e3..93a4c153b2 100644 --- a/addons/repair/functions/fnc_getHitPointString.sqf +++ b/addons/repair/functions/fnc_getHitPointString.sqf @@ -86,7 +86,7 @@ for "_i" from 0 to (count _hitPoint) do { // Don't display part name if no string is found in stringtable if (_text == LSTRING(Hit)) then { - if (_hitPoint != "") then { LOG_1("Hitpoint [%1] - could not be localized", _hitPoint); }; + if (_hitPoint != "") then { LOG_1("Hitpoint [%1] - could not be localized",_hitPoint); }; _text = _textDefault; }; diff --git a/addons/repair/functions/fnc_getSelectionsToIgnore.sqf b/addons/repair/functions/fnc_getSelectionsToIgnore.sqf index d455950a3b..b90e44e8e6 100644 --- a/addons/repair/functions/fnc_getSelectionsToIgnore.sqf +++ b/addons/repair/functions/fnc_getSelectionsToIgnore.sqf @@ -134,7 +134,7 @@ private _processedSelections = []; continue }; - if (ANY_OF(_hitpointGroups, ANY_OF(_x select 1, _x == _hitpoint))) then { // skip child hitpoints + if (ANY_OF(_hitpointGroups,ANY_OF(_x select 1,_x == _hitpoint))) then { // skip child hitpoints TRACE_3("Skipping child hitpoint",_hitpoint,_forEachIndex,_selection); /*#ifdef DEBUG_MODE_FULL systemChat format ["Skipping child hitpoint, hitpoint %1, index %2, selection %3", _hitpoint, _forEachIndex, _selection]; diff --git a/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf b/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf index 1952707204..347c3878d7 100644 --- a/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf +++ b/addons/repair/functions/fnc_getWheelHitPointsWithSelections.sqf @@ -50,7 +50,7 @@ private _wheelHitPointSelections = []; if ((_wheelBoneNameResized != "") && {_x find _wheelBoneNameResized == 0}) exitWith { // same as above. Requirement for physx. _wheelHitPoint = _hitPoints select _forEachIndex; _wheelHitPointSelection = _hitPointSelections select _forEachIndex; - TRACE_2("wheel found [Orginal]", _wheelName, _wheelHitPoint); + TRACE_2("wheel found [Orginal]",_wheelName,_wheelHitPoint); }; } forEach _hitPointSelections; @@ -83,7 +83,7 @@ private _wheelHitPointSelections = []; if (_bestIndex != -1) then { _wheelHitPoint = _hitPoints select _bestIndex; _wheelHitPointSelection = _hitPointSelections select _bestIndex; - TRACE_2("wheel found [Backup]", _wheelName, _wheelHitPoint); + TRACE_2("wheel found [Backup]",_wheelName,_wheelHitPoint); }; }; }; diff --git a/addons/repair/functions/fnc_isEngineer.sqf b/addons/repair/functions/fnc_isEngineer.sqf index 2a013bccda..2962e4f8ad 100644 --- a/addons/repair/functions/fnc_isEngineer.sqf +++ b/addons/repair/functions/fnc_isEngineer.sqf @@ -22,7 +22,7 @@ private _class = _unit getVariable ["ACE_IsEngineer", _unit getUnitTrait "engine // This if statement is here for copmatability with the common variant of isEngineer, which requires a bool. // We cannot move this function to common because we require the GVAR(engineerSetting_Repair), which only makes sense to include in the repair module. -if (_class isEqualType false) then {_class = [0, 1] select _class}; +if (_class isEqualType false) then {_class = parseNumber _class}; TRACE_3("isEngineer",_unit,_engineerN,_class); if (_class >= _engineerN) exitWith {true}; diff --git a/addons/repair/functions/fnc_isInRepairFacility.sqf b/addons/repair/functions/fnc_isInRepairFacility.sqf index 7ea8ace60f..51cc5424bb 100644 --- a/addons/repair/functions/fnc_isInRepairFacility.sqf +++ b/addons/repair/functions/fnc_isInRepairFacility.sqf @@ -34,7 +34,7 @@ private _checkObject = { private _fnc_check = { private _position = _unit modelToWorldVisual [0, 0, eyePos _unit select 2]; - CHECK_OBJECTS(lineIntersectsWith [ARR_3(_position, _position vectorAdd [ARR_3(0, 0, 10)], _unit)]) + CHECK_OBJECTS(lineIntersectsWith [ARR_3(_position,_position vectorAdd [ARR_3(0,0,10)],_unit)]) || {CHECK_OBJECTS(_unit nearObjects 7.5)} }; diff --git a/addons/repair/functions/fnc_normalizeHitPoints.sqf b/addons/repair/functions/fnc_normalizeHitPoints.sqf index 9abeec718c..5e61ef8c88 100644 --- a/addons/repair/functions/fnc_normalizeHitPoints.sqf +++ b/addons/repair/functions/fnc_normalizeHitPoints.sqf @@ -16,10 +16,10 @@ */ params ["_vehicle"]; -TRACE_2("params",_vehicle, typeOf _vehicle); +TRACE_2("params",_vehicle,typeOf _vehicle); // Can't execute all commands if the vehicle isn't local, exit if that's so -if !(local _vehicle) exitWith {ERROR_1("Vehicle Not Local %1", _vehicle);}; +if !(local _vehicle) exitWith {ERROR_1("Vehicle Not Local %1",_vehicle);}; (getAllHitPointsDamage _vehicle) params [["_allHitPoints", []]]; @@ -57,7 +57,7 @@ total = damage _vehicle; // apply normalized damage to all dependand hitpoints { private _damage = call (_dependentHitPointScripts select _forEachIndex); - TRACE_2("setting depend hitpoint", _x, _damage); + TRACE_2("setting depend hitpoint",_x,_damage); _vehicle setHitPointDamage [_x, _damage]; } forEach _dependentHitPoints; diff --git a/addons/repair/functions/fnc_repair.sqf b/addons/repair/functions/fnc_repair.sqf index a86f8f22db..b537963e0f 100644 --- a/addons/repair/functions/fnc_repair.sqf +++ b/addons/repair/functions/fnc_repair.sqf @@ -107,7 +107,7 @@ if !(_return && alive _target) exitWith {false}; //Claim required objects { - TRACE_2("Claiming", _x, (typeOf _x)); + TRACE_2("Claiming",_x,(typeOf _x)); [_caller, _x, false] call EFUNC(common,claim); } forEach _claimObjectsAvailable; diff --git a/addons/repair/functions/fnc_repair_failure.sqf b/addons/repair/functions/fnc_repair_failure.sqf index ce8d29b25d..c305c90b6b 100644 --- a/addons/repair/functions/fnc_repair_failure.sqf +++ b/addons/repair/functions/fnc_repair_failure.sqf @@ -51,7 +51,7 @@ if (_weaponSelect != "") then { //Unclaim repair objects: { - TRACE_2("Releasing", _x, (typeOf _x)); + TRACE_2("Releasing",_x,(typeOf _x)); [objNull, _x, false] call EFUNC(common,claim); } forEach _claimedObjects; diff --git a/addons/repair/functions/fnc_repair_success.sqf b/addons/repair/functions/fnc_repair_success.sqf index 083daa6cc7..271d662cd4 100644 --- a/addons/repair/functions/fnc_repair_success.sqf +++ b/addons/repair/functions/fnc_repair_success.sqf @@ -47,7 +47,7 @@ if (_weaponSelect != "") then { //Unclaim repair objects: { - TRACE_2("Releasing", _x, (typeOf _x)); + TRACE_2("Releasing",_x,(typeOf _x)); [objNull, _x, false] call EFUNC(common,claim); } forEach _claimedObjects; diff --git a/addons/repair/functions/fnc_setHitPointDamage.sqf b/addons/repair/functions/fnc_setHitPointDamage.sqf index 9a28adc211..bfce0e3f5e 100644 --- a/addons/repair/functions/fnc_setHitPointDamage.sqf +++ b/addons/repair/functions/fnc_setHitPointDamage.sqf @@ -23,13 +23,13 @@ params ["_vehicle", "_hitPointIndex", "_hitPointDamage", ["_useEffects", false]] TRACE_4("params",_vehicle,typeOf _vehicle,_hitPointIndex,_hitPointDamage); // can't execute all commands if the vehicle isn't local. exit here. -if !(local _vehicle) exitWith {ERROR_1("Vehicle Not Local %1", _vehicle);}; +if !(local _vehicle) exitWith {ERROR_1("Vehicle Not Local %1",_vehicle);}; // get all hitpoints and selections and damages (getAllHitPointsDamage _vehicle) params [["_allHitPoints", []], ["_allHitPointsSelections", []], ["_allHitPointDamages", []]]; // exit if the hitpoint is not valid -if ((_hitPointIndex < 0) || {_hitPointIndex >= (count _allHitPoints)}) exitWith {ERROR_2("NOT A VALID HITPOINT: %1-%2", _hitPointIndex,_vehicle);}; +if ((_hitPointIndex < 0) || {_hitPointIndex >= (count _allHitPoints)}) exitWith {ERROR_2("NOT A VALID HITPOINT: %1-%2",_hitPointIndex,_vehicle);}; // save structural damage and sum of hitpoint damages diff --git a/addons/repair/stringtable.xml b/addons/repair/stringtable.xml index 48f2ca8a90..10a5fa3a0b 100644 --- a/addons/repair/stringtable.xml +++ b/addons/repair/stringtable.xml @@ -390,7 +390,7 @@ Přidat náhradní díly do vozidla (vyžaduje úložný prostor)? Aggiungi parti di ricambio ai veicoli (richiede spazio nel carico)? Ajoute des pièces de rechange aux véhicules (nécessite le système de cargaison). - 車両へ予備部品を追加しますか? (カーゴ コンポーネントが必要) + 車両へ予備部品を追加しますか? (貨物室が必要) 차량에 예비 부품을 더합니까?(짐칸 요소 필요) 添加载具备件(需相关货物组件)? 添加載具備件 (需相關貨物組件)? @@ -1622,7 +1622,7 @@ Přiřaďte opraváresnké vozidlo Assegna Veicolo Riparazioni Affecter véhicule(s) de réparation - 修理車両として指定 + 修理車両に割り当て 정비 차량 등록 指定维修载具 指定維修載具 @@ -1652,7 +1652,7 @@ Seznam vozidel, která budou klasifikována jako opravárenská, oddělit čárkami. Lista di Veicoli che verranno considerati veicoli riparazioni, separati da virgole. Liste de véhicules qui seront classés comme véhicules de réparation, séparés par des virgules. - 修理車両に指定される車両のリスト。カンマで区切ります。 + 修理車両に割り当てる車両のリスト。カンマで区切ります。 목록내 차량은 정비 차량으로 분류됩니다. 쉼표로 구분합니다. 载具名单,把载具名称输入在这边即可定义其为维修载具。每个载具使用逗号以做区隔。 載具名單,把載具名稱輸入在這邊即可定義其為維修載具。每個載具使用逗號以做區隔。 @@ -1667,7 +1667,7 @@ Opravárenské vozidlo È Veicolo Riparazioni Est un véhicule de réparation - 修理車両にする + 修理車両とする 은 정비 차량이다 是维修载具 是維修載具 @@ -1682,7 +1682,7 @@ Je vozidlo klasifikováno jako opravárenské? Il veicolo è classificato dome veicolo riparazioni? Définit s'il s'agit d'un véhicule de réparation. - 車両を修理車両に指定しますか? + 車両を修理車両として割り当てます 이 차량을 정비 차량으로 분류합니까? 此载具是维修载具吗? 此載具是維修載具嗎? @@ -1712,7 +1712,7 @@ Přiřaďte opravárenské zařízení Assegna Struttura Riparazioni Affecter atelier(s) de réparation - 修理施設とする + 修理施設に割り当て 정비 시설 등록 指定维修设施 指定維修設施 @@ -1742,7 +1742,7 @@ Seznam objektů, které budou klasifikovány jako opravárenské zařízení, oddělit čárkami. Lista di oggetti che verranno classificati come strutture riparazioni, separati da virgole. Liste d'objets qui seront classés comme ateliers de réparation, séparés par des virgules. - 修理施設に指定されるオブジェクトのリスト。カンマで区切ります。 + 修理施設に割り当てるオブジェクトのリスト。カンマで区切ります。 목록내 시설은 정비 시설으로 분류됩니다. 쉼표로 구분합니다. 设施名单,把设施名称输入在这边即可定义其为维修设施。每个设施使用逗号以做区隔。 設施名單,把設施名稱輸入在這邊即可定義其為維修設施。每個設施使用逗號以做區隔。 @@ -1772,7 +1772,7 @@ Je objekt klasifikován jako opravárenské zařízení? L'oggetto è classificato come struttura riparazioni? Définit l'objet comme étant un atelier de réparation. - オブジェクトを修理施設として指定しますか? + オブジェクトを修理施設として割り当てます 이 시설을 정비 시설로 분류합니까? 此设施是维修设施吗? 此設施是維修設施嗎? @@ -2054,7 +2054,7 @@ Number of spare tracks in cargo. Anzahl der Ersatzketten im Laderaum. - カーゴ内の予備履帯の数を指定 + 貨物室内の予備履帯の数を指定 Numero dei cingoli di scorta nel carico. 設定載具在貨艙內攜帶的備用履帶數量 设定载具在货舱内携带的备用履带数量。 @@ -2084,7 +2084,7 @@ Number of spare wheels in cargo. Anzahl der Ersatzreifen im Laderaum. - カーゴ内の予備タイヤの数を指定 + 貨物室内の予備タイヤの数を指定 Numero delle ruote di scorta nel cargo. 設定載具在貨艙內攜帶的備用輪胎數量 设定载具在货舱内携带的备用轮胎数量。 diff --git a/addons/respawn/functions/fnc_handlePlayerChanged.sqf b/addons/respawn/functions/fnc_handlePlayerChanged.sqf index f94e14d644..9514966541 100644 --- a/addons/respawn/functions/fnc_handlePlayerChanged.sqf +++ b/addons/respawn/functions/fnc_handlePlayerChanged.sqf @@ -19,9 +19,9 @@ params ["_newUnit"]; private _side = side group _newUnit; -((GETMVAR(ACE_Rallypoint_West, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == west)); -((GETMVAR(ACE_Rallypoint_West_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == west)); -((GETMVAR(ACE_Rallypoint_East, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == east)); -((GETMVAR(ACE_Rallypoint_East_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == east)); -((GETMVAR(ACE_Rallypoint_Independent, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == independent)); -((GETMVAR(ACE_Rallypoint_Independent_Base, objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal ([0, 1] select (_side == independent)); +((GETMVAR(ACE_Rallypoint_West,objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == west)); +((GETMVAR(ACE_Rallypoint_West_Base,objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == west)); +((GETMVAR(ACE_Rallypoint_East,objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == east)); +((GETMVAR(ACE_Rallypoint_East_Base,objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == east)); +((GETMVAR(ACE_Rallypoint_Independent,objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == independent)); +((GETMVAR(ACE_Rallypoint_Independent_Base,objNull)) getVariable [QGVAR(marker), ""]) setMarkerAlphaLocal (parseNumber (_side == independent)); diff --git a/addons/respawn/functions/fnc_initRallypoint.sqf b/addons/respawn/functions/fnc_initRallypoint.sqf index 50931a87f4..7e4651e1e9 100644 --- a/addons/respawn/functions/fnc_initRallypoint.sqf +++ b/addons/respawn/functions/fnc_initRallypoint.sqf @@ -53,7 +53,7 @@ if (hasInterface) then { private _type = ["selector_selectedFriendly", "selector_selectedEnemy"] select (_respawnMarker == ""); _marker setMarkerTypeLocal _type; - _marker setMarkerAlphaLocal ([0,1] select (_side == playerSide)); // playerSide to guarantee init + _marker setMarkerAlphaLocal (parseNumber (_side == playerSide)); // playerSide to guarantee init private _date = _rallypoint getVariable [QGVAR(markerDate), ""]; diff --git a/addons/respawn/functions/fnc_restoreGear.sqf b/addons/respawn/functions/fnc_restoreGear.sqf index e0823fe6e0..afbc7def86 100644 --- a/addons/respawn/functions/fnc_restoreGear.sqf +++ b/addons/respawn/functions/fnc_restoreGear.sqf @@ -17,7 +17,7 @@ */ params ["_unit", "_allGear", "_activeWeaponAndMuzzle"]; -TRACE_3("restoreGear",_unit, count _allGear, _activeWeaponAndMuzzle); +TRACE_3("restoreGear",_unit,count _allGear,_activeWeaponAndMuzzle); // restore all gear if (!isNil "_allGear") then { diff --git a/addons/scopes/functions/fnc_firedEH.sqf b/addons/scopes/functions/fnc_firedEH.sqf index 86d9848162..f1b8e91bf4 100644 --- a/addons/scopes/functions/fnc_firedEH.sqf +++ b/addons/scopes/functions/fnc_firedEH.sqf @@ -16,7 +16,7 @@ */ //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); if (!(_ammo isKindOf "BulletBase")) exitWith {}; diff --git a/addons/sitting/XEH_clientInit.sqf b/addons/sitting/XEH_clientInit.sqf index 12adfb9f6c..f0b0b7c2f0 100644 --- a/addons/sitting/XEH_clientInit.sqf +++ b/addons/sitting/XEH_clientInit.sqf @@ -4,7 +4,7 @@ if (!hasInterface) exitWith {}; ["ace_settingsInitialized", { - TRACE_1("SettingInit", XGVAR(enable)); + TRACE_1("SettingInit",XGVAR(enable)); // If not enabled, then do not add CanInteractWith Condition or event handlers if (!XGVAR(enable)) exitWith {}; diff --git a/addons/sitting/functions/fnc_sit.sqf b/addons/sitting/functions/fnc_sit.sqf index 98ece0c62f..2d7cc999da 100644 --- a/addons/sitting/functions/fnc_sit.sqf +++ b/addons/sitting/functions/fnc_sit.sqf @@ -92,7 +92,7 @@ private _seatDistOrig = (getPosASL _player) distance _seat; // Remove PFH if not sitting any more if (isNil {_player getVariable QGVAR(sittingStatus)}) exitWith { [_pfhId] call CBA_fnc_removePerFrameHandler; - TRACE_1("Remove PFH",_player getVariable [ARR_2(QGVAR(sittingStatus), false)]); + TRACE_1("Remove PFH",_player getVariable [ARR_2(QGVAR(sittingStatus),false)]); }; // Stand up if chair gets deleted or moved diff --git a/addons/slideshow/functions/fnc_createSlideshow.sqf b/addons/slideshow/functions/fnc_createSlideshow.sqf index 87fd40bbbe..9021a92613 100644 --- a/addons/slideshow/functions/fnc_createSlideshow.sqf +++ b/addons/slideshow/functions/fnc_createSlideshow.sqf @@ -61,7 +61,7 @@ private _currentSlideshow = GVAR(slideshows); // Local variable in case GVAR get // If interaction menu module is not present, set default duration value if !(["ace_interact_menu"] call EFUNC(common,isModLoaded)) then { _duration = NOINTERACTMENU_DURATION; - INFO_1("Interaction Menu module not present, defaulting duration value to %1",_duration); + INFO_1("Interaction Menu module not present,defaulting duration value to %1",_duration); }; // Add interactions if automatic transitions are disabled, else setup automatic transitions diff --git a/addons/smallarms/CfgWeapons.hpp b/addons/smallarms/CfgWeapons.hpp index 1e4be69369..7b569d4292 100644 --- a/addons/smallarms/CfgWeapons.hpp +++ b/addons/smallarms/CfgWeapons.hpp @@ -191,6 +191,9 @@ class CfgWeapons { class LMG_03_F: LMG_03_Base_F { magazineReloadTime = 0; // Fix for reloading every time weapon is equipped }; + class LMG_03_Vehicle_F: LMG_03_F { + magazineReloadTime = 5.8; // Should be same as LMG_03_Base_F + }; // Sniper and anti-materiel rifles ///////////////////////////////// diff --git a/addons/tacticalladder/functions/fnc_deployTL.sqf b/addons/tacticalladder/functions/fnc_deployTL.sqf index 85804e091f..0f399536f4 100644 --- a/addons/tacticalladder/functions/fnc_deployTL.sqf +++ b/addons/tacticalladder/functions/fnc_deployTL.sqf @@ -23,7 +23,7 @@ removeBackpack _unit; private _pos = _unit modelToWorld [0,0,0]; -private _offset = if ((_unit call CBA_fnc_getUnitAnim select 0) == "prone") then { 1 } else {0.8}; +private _offset = [0.8, 1] select (_unit call CBA_fnc_getUnitAnim select 0 == "prone"); _pos set [0, (_pos select 0) + (sin getDir _unit) * _offset]; _pos set [1, (_pos select 1) + (cos getDir _unit) * _offset]; diff --git a/addons/tagging/functions/fnc_tag.sqf b/addons/tagging/functions/fnc_tag.sqf index 4e4310a0cf..aa0ba9fac9 100644 --- a/addons/tagging/functions/fnc_tag.sqf +++ b/addons/tagging/functions/fnc_tag.sqf @@ -45,7 +45,7 @@ if (_intersections isEqualTo []) exitWith { }; (_intersections select 0) params ["_touchingPoint", "_surfaceNormal", "", "_object"]; -TRACE_3("",_touchingPoint, _surfaceNormal, _object); +TRACE_3("",_touchingPoint,_surfaceNormal,_object); // Exit if trying to tag a non static object if ((!isNull _object) && { @@ -93,7 +93,7 @@ private _vectorDirAndUp = if (abs (_v1 select 2) < 0.94) then { [_v1, _v3] }; -TRACE_3("Reference:", _v1, _v2, _v3); +TRACE_3("Reference:",_v1,_v2,_v3); private _fnc_isOk = { params ["_rx", "_ry"]; diff --git a/addons/towing/CfgVehicles.hpp b/addons/towing/CfgVehicles.hpp index df791d95d3..6775a8c9e2 100644 --- a/addons/towing/CfgVehicles.hpp +++ b/addons/towing/CfgVehicles.hpp @@ -1,84 +1,61 @@ -#define TOW_ACTION \ -class ACE_Actions {\ - class ACE_MainActions {\ - class ADDON {\ - displayName = CSTRING(displayName);\ - distance = TOW_ACTION_DISTANCE;\ - condition = QUOTE([ARR_1(_target)] call FUNC(isSuitableSimulation));\ - statement = "";\ - exceptions[] = { INTERACTION_EXCEPTIONS };\ - showDisabled = 0;\ - icon = "";\ - class GVAR(startTow3) {\ - displayName = CSTRING(start3);\ - condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope3')] call EFUNC(common,hasItem));\ - statement = QUOTE([ARR_3(_player,_target,'ACE_rope3')] call FUNC(startTow));\ - exceptions[] = { INTERACTION_EXCEPTIONS };\ - };\ - class GVAR(startTow6) {\ - displayName = CSTRING(start6);\ - condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope6')] call EFUNC(common,hasItem));\ - statement = QUOTE([ARR_3(_player,_target,'ACE_rope6')] call FUNC(startTow));\ - exceptions[] = { INTERACTION_EXCEPTIONS };\ - };\ - class GVAR(startTow12) {\ - displayName = CSTRING(start12);\ - condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope12')] call EFUNC(common,hasItem));\ - statement = QUOTE([ARR_3(_player,_target,'ACE_rope12')] call FUNC(startTow));\ - exceptions[] = { INTERACTION_EXCEPTIONS };\ - };\ - class GVAR(startTow15) {\ - displayName = CSTRING(start15);\ - condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope15')] call EFUNC(common,hasItem));\ - statement = QUOTE([ARR_3(_player,_target,'ACE_rope15')] call FUNC(startTow));\ - exceptions[] = { INTERACTION_EXCEPTIONS };\ - };\ - class GVAR(startTow18) {\ - displayName = CSTRING(start18);\ - condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope18')] call EFUNC(common,hasItem));\ - statement = QUOTE([ARR_3(_player,_target,'ACE_rope18')] call FUNC(startTow));\ - exceptions[] = { INTERACTION_EXCEPTIONS };\ - };\ - class GVAR(startTow27) {\ - displayName = CSTRING(start27);\ - condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope27')] call EFUNC(common,hasItem));\ - statement = QUOTE([ARR_3(_player,_target,'ACE_rope27')] call FUNC(startTow));\ - exceptions[] = { INTERACTION_EXCEPTIONS };\ - };\ - class GVAR(startTow36) {\ - displayName = CSTRING(start36);\ - condition = QUOTE(([ARR_2(_player,_target)] call FUNC(canStartTow)) && [ARR_2(_player,'ACE_rope36')] call EFUNC(common,hasItem));\ - statement = QUOTE([ARR_3(_player,_target,'ACE_rope36')] call FUNC(startTow));\ +#define CONCAT(a,b) a##b +#define TOW_ACTION(length) \ + class GVAR(CONCAT(startTow,length)) {\ + displayName = CSTRING(CONCAT(start,length));\ + condition = QUOTE([ARR_2(_player,'CONCAT(ACE_rope,length)')] call DEFUNC(common,hasItem));\ + statement = QUOTE([ARR_3(_player,_target,'CONCAT(ACE_rope,length)')] call DFUNC(startTow));\ + exceptions[] = { INTERACTION_EXCEPTIONS };\ + } +#define TOW_ACTIONS \ + class ACE_Actions {\ + class ACE_MainActions {\ + class ADDON {\ + displayName = CSTRING(displayName);\ + distance = TOW_ACTION_DISTANCE;\ + condition = QUOTE(alive _target && {_target call DFUNC(isSuitableSimulation)});\ exceptions[] = { INTERACTION_EXCEPTIONS };\ + insertChildren = QUOTE(_target call DFUNC(getDetachActions));\ + TOW_ACTION(3);\ + TOW_ACTION(6);\ + TOW_ACTION(12);\ + TOW_ACTION(15);\ + TOW_ACTION(18);\ + TOW_ACTION(27);\ + TOW_ACTION(36);\ };\ };\ - };\ -} + } class CfgVehicles { class LandVehicle; class Car: LandVehicle { - TOW_ACTION; + TOW_ACTIONS; }; class Tank: LandVehicle { - TOW_ACTION; + TOW_ACTIONS; + }; + + class Ship; + class Ship_F: Ship { + TOW_ACTIONS; }; class ThingX; - class GVAR(hook): ThingX { - displayName = "hook"; // not publicly visible, no stringtable needed + class GVAR(helper): ThingX { + displayName = "helper"; // not publicly visible, no stringtable needed scope = 1; scopeCurator = 1; - model = "\a3\Structures_F_Orange\VR\Helpers\Sign_sphere10cm_Geometry_F.p3d"; + model = "\A3\Weapons_f\empty"; destrType = "DestructNo"; - + }; + class GVAR(hook): GVAR(helper) { + displayName = "hook"; class ACE_Actions { class ACE_MainActions { displayName = CSTRING(detach); - condition = "true"; - statement = QUOTE(private _parent = _target getVariable [ARR_2(QQGVAR(parent),objNull)]; private _child = _target getVariable [ARR_2(QQGVAR(child),objNull)]; [ARR_3(_player,_parent,_child)] call FUNC(detach)); - distance = 2; + statement = QUOTE([ARR_2(_player,_target)] call DFUNC(detachRope)); + distance = TOW_ACTION_DISTANCE; }; }; }; diff --git a/addons/towing/XEH_PREP.hpp b/addons/towing/XEH_PREP.hpp index d26b29e5f0..b72f70c55b 100644 --- a/addons/towing/XEH_PREP.hpp +++ b/addons/towing/XEH_PREP.hpp @@ -1,7 +1,9 @@ PREP(addRopeToVehicle); PREP(attachRopePFH); -PREP(canStartTow); -PREP(detach); +PREP(attachVehicles); +PREP(detachChild); +PREP(detachRope); +PREP(getDetachActions); PREP(isSuitableSimulation); PREP(onMouseButtonDown); PREP(onMouseButtonUp); diff --git a/addons/towing/XEH_postInit.sqf b/addons/towing/XEH_postInit.sqf index 187af19244..01c7d6e48e 100644 --- a/addons/towing/XEH_postInit.sqf +++ b/addons/towing/XEH_postInit.sqf @@ -1,14 +1,40 @@ #include "script_component.hpp" -["MouseButtonDown", LINKFUNC(onMouseButtonDown)] call CBA_fnc_addDisplayHandler; + ["MouseButtonUp", LINKFUNC(onMouseButtonUp)] call CBA_fnc_addDisplayHandler; GVAR(mouseLeft) = false; GVAR(mouseRight) = false; GVAR(blockFireEHID) = -1; -GVAR(cancel) = false; -GVAR(canAttach) = false; - -[QGVAR(setTowParent), { - params ["_parent", "_child"]; - _child setTowParent _parent; +[QGVAR(ropeAttachTo), { + params ["_child", "_relativeAttachPos", "_rope", "_helper"]; + TRACE_4("ropeAttachTo",_child,_relativeAttachPos,_rope,_helper); + _helper ropeDetach _rope; + [_child, _relativeAttachPos] ropeAttachTo _rope; + deleteVehicle _helper; }] call CBA_fnc_addEventHandler; + +[QGVAR(attachVehicles), LINKFUNC(attachVehicles)] call CBA_fnc_addEventHandler; +[QGVAR(detachChild), LINKFUNC(detachChild)] call CBA_fnc_addEventHandler; + +if (!isServer) exitWith {}; + +[QGVAR(cleanupParent), { + params ["_parent"]; + TRACE_1("cleanupParent",_parent); + _parent removeEventHandler ["RopeBreak", _parent getVariable [QGVAR(RopeBreakEHID), -1]]; + _parent setVariable [QGVAR(RopeBreakEHID), -1]; + private _parentParentHooks = _parent getVariable [QGVAR(parentHooks), []]; + if (_parentParentHooks isEqualTo []) then { + TRACE_1("remove Deleted EH",_parent); + _parent removeEventHandler ["Deleted", _parent getVariable [QGVAR(DeletedEHID), -1]]; + _parent setVariable [QGVAR(DeletedEHID), -1]; + }; +}] call CBA_fnc_addEventHandler; + +addMissionEventHandler ["PlayerConnected", { + if (GVAR(allChildren) isEqualTo []) exitWith {}; + params ["", "", "", "_jip", "_owner"]; + if (!_jip) exitWith {}; + TRACE_2("pushing children",_owner,GVAR(allChildren)); + [QGVAR(setTowParentAllChildren), [GVAR(allChildren)], _owner] call CBA_fnc_ownerEvent; +}]; diff --git a/addons/towing/XEH_preInit.sqf b/addons/towing/XEH_preInit.sqf index 894773534a..6a85ba442f 100644 --- a/addons/towing/XEH_preInit.sqf +++ b/addons/towing/XEH_preInit.sqf @@ -8,4 +8,20 @@ PREP_RECOMPILE_END; #include "initSettings.inc.sqf" +// handle JIP +if (isServer) then { + GVAR(allChildren) = []; +} else { + // can't use CBA EH in postInit because too late for server PlayerConnected EH + [QGVAR(setTowParentAllChildren), { + params ["_children"]; + TRACE_1("setTowParentAllChildren",_children); + { + private _parent = _x getVariable QGVAR(parent); + TRACE_2("setTowParent",_x,_parent); + _x setTowParent _parent; + } forEach _children; + }] call CBA_fnc_addEventHandler; +}; + ADDON = true; diff --git a/addons/towing/functions/fnc_addRopeToVehicle.sqf b/addons/towing/functions/fnc_addRopeToVehicle.sqf index 4ff0fce62d..9dec1257d0 100644 --- a/addons/towing/functions/fnc_addRopeToVehicle.sqf +++ b/addons/towing/functions/fnc_addRopeToVehicle.sqf @@ -20,8 +20,8 @@ params ["_vehicle"]; if (0 == getNumber (configOf _vehicle >> QEGVAR(cargo,hasCargo))) exitWith {}; -private _ropeType = if ( +private _ropeType = ["ACE_rope6", "ACE_rope12"] select ( -1 < ["Tank", "Wheeled_APC_F", "Truck_F"] findIf {_vehicle isKindOf _x} -) then {"ACE_rope12"} else {"ACE_rope6"}; +); _vehicle addItemCargoGlobal [_ropeType, 1]; diff --git a/addons/towing/functions/fnc_attachRopePFH.sqf b/addons/towing/functions/fnc_attachRopePFH.sqf index e8336ecc25..37f626e0a9 100644 --- a/addons/towing/functions/fnc_attachRopePFH.sqf +++ b/addons/towing/functions/fnc_attachRopePFH.sqf @@ -40,13 +40,32 @@ if (_intersections isNotEqualTo []) then { _intersectionToUse params ["_intersectPosition", "", "_intersectObject"]; - // if we have a target object, we assume we are attaching to the parent. If no target object, we are attaching to child - GVAR(canAttach) = (_intersectObject isNotEqualTo _ignoreParent) && { (!isNull _target && { _intersectObject isEqualTo _target }) || { isNull _target && { [_intersectObject] call FUNC(isSuitableSimulation) }}} && { !(_intersectObject getVariable [QGVAR(towing), false]) }; + GVAR(canAttach) = + _intersectObject isNotEqualTo _ignoreParent + && { + // if we have a target object, we assume we are attaching to the parent. If no target object, we are attaching to child + if (!isNull _target) then { + _intersectObject isEqualTo _target + } else { + [_intersectObject] call FUNC(isSuitableSimulation) + && { // ignore _intersectObject which has parent != _ignoreParent + private _intersectObjectParent = _intersectObject getVariable [QGVAR(parent), objNull]; + isNull _intersectObjectParent || {_intersectObjectParent == _ignoreParent} + } && { // arma prevents making rings (ropeAttachTo silently fails) + private _ancestor = _ignoreParent getVariable [QGVAR(parent), objNull]; + while {!isNull _ancestor && {_ancestor != _intersectObject}} do { + _ancestor = _ancestor getVariable [QGVAR(parent), objNull]; + }; + isNull _ancestor + } + } + } + ; if (GVAR(canAttach)) then { - TRACE_4("can attach",_target,_intersectObject,_ignoreParent,_ignoreRope); + // TRACE_4("can attach",_target,_intersectObject,_ignoreParent,_ignoreRope); GVAR(attachHelper) setPosASL _intersectPosition; - _hintLMB = localize LSTRING(attach); + _hintLMB = LLSTRING(attach); GVAR(attachHelper) setVariable [QGVAR(object), _intersectObject]; }; @@ -76,4 +95,3 @@ if (_hint isNotEqualTo (_unit getVariable [QGVAR(hint), []])) then { _unit setVariable [QGVAR(hint), _hint]; _hint call EFUNC(interaction,showMouseHint); }; - diff --git a/addons/towing/functions/fnc_attachVehicles.sqf b/addons/towing/functions/fnc_attachVehicles.sqf new file mode 100644 index 0000000000..9fd95f3742 --- /dev/null +++ b/addons/towing/functions/fnc_attachVehicles.sqf @@ -0,0 +1,65 @@ +#include "..\script_component.hpp" +/* + * Author: Dystopian + * Attaches child to parent vehicle. + * Run globally. + * + * Arguments: + * 0: Vehicle to tow from + * 1: Vehicle to tow + * 2: Rope End Position + * 3: Rope + * 4: Attached Helper Object + * + * Return Value: + * None + * + * Example: + * [parent, cursorObject, [0,0,0], ropes parent select 0] call ace_towing_fnc_attachVehicles + * + * Public: No + */ +params ["_parent", "_child", "_relativeAttachPos", "_rope", "_helper"]; +TRACE_5("attachVehicles",_parent,_child,_relativeAttachPos,_rope,_helper); + +if (local _parent) then { + _helper ropeDetach _rope; + [_child, _relativeAttachPos] ropeAttachTo _rope; + deleteVehicle _helper; +}; + +_child setTowParent _parent; +if (!isServer) exitWith {}; + +_child setVariable [QGVAR(parent), _parent, true]; +GVAR(allChildren) pushBack _child; + +{ + if (-1 == _x getVariable [QGVAR(DeletedEHID), -1]) then { + _x setVariable [QGVAR(DeletedEHID), _x addEventHandler ["Deleted", { + params ["_entity"]; + private _childHooks = _entity getVariable [QGVAR(childHooks), []]; + private _parentHooks = _entity getVariable [QGVAR(parentHooks), []]; + TRACE_3("Deleted EH",_entity,_childHooks,_parentHooks); + { + [objNull, _x, _entity] call FUNC(detachRope); + } forEach (_childHooks + _parentHooks); + if (_childHooks isNotEqualTo []) then { // only for parent + // because deleting lasts for several frames we have to delete RB EH to fix double cleanup + _entity removeEventHandler ["RopeBreak", _entity getVariable QGVAR(RopeBreakEHID)]; + }; + }]]; + }; +} forEach [_parent, _child]; + +if (-1 == _parent getVariable [QGVAR(RopeBreakEHID), -1]) then { + _parent setVariable [QGVAR(RopeBreakEHID), _parent addEventHandler ["RopeBreak", { + params ["_parent", "_rope", "_child"]; + if (isNull _rope) exitWith {}; // happens + private _hook = _rope getVariable [QGVAR(hook), objNull]; + private _hookChild = _hook getVariable [QGVAR(vars), []] param [1, objNull]; + if (isNull _hook || {_child != _hookChild}) exitWith {}; // handle helper detach + TRACE_4("RopeBreak EH",_parent,_rope,_child,_hook); + [objNull, _hook] call FUNC(detachRope); + }]]; +}; diff --git a/addons/towing/functions/fnc_canStartTow.sqf b/addons/towing/functions/fnc_canStartTow.sqf deleted file mode 100644 index 1ffca3df86..0000000000 --- a/addons/towing/functions/fnc_canStartTow.sqf +++ /dev/null @@ -1,21 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: tcvm - * Condition for whether or not we can tow from this object - * - * Arguments: - * 0: Unit wanting to start towing - * 1: Vehicle to tow from - * - * Return Value: - * Whether or not we can start towing - * - * Example: - * [player, cursorObject] call ace_towing_fnc_canStartTow - * - * Public: No - */ -params ["_unit", "_target"]; -private _isTowing = _target getVariable [QGVAR(towing), false]; -TRACE_1("is towing",_isTowing); -!_isTowing diff --git a/addons/towing/functions/fnc_detach.sqf b/addons/towing/functions/fnc_detach.sqf deleted file mode 100644 index 92494eae0e..0000000000 --- a/addons/towing/functions/fnc_detach.sqf +++ /dev/null @@ -1,48 +0,0 @@ -#include "..\script_component.hpp" -/* - * Author: tcvm - * Detaches child from parent, and gives rope item back - * - * Arguments: - * 0: Parent - * 1: Child - * - * Return Value: - * None - * - * Example: - * [player, cursorObject] call ace_towing_fnc_detach - * - * Public: No - */ -params ["_unit", "_parent", "_child"]; -TRACE_3("detach",_unit,_parent,_child); - -private _hook = _child getVariable [QGVAR(hook), objNull]; - -_parent removeEventHandler ["Deleted", _hook getVariable QGVAR(parentDeleteEventHandler)]; -_hook setVariable [QGVAR(parentDeleteEventHandler), -1]; - -_child removeEventHandler ["Deleted", _hook getVariable QGVAR(childDeleteEventHandler)]; -_hook setVariable [QGVAR(childDeleteEventHandler), -1]; - -_parent removeEventHandler ["RopeBreak", _parent getVariable QGVAR(ropeBreakEventHandler)]; -_parent setVariable [QGVAR(ropeBreakEventHandler), -1]; - -private _rope = _child getVariable [QGVAR(rope), objNull]; -ropeDestroy _rope; - -private _ropeClass = _hook getVariable [QGVAR(ropeClass), ""]; -deleteVehicle _hook; - -TRACE_1("rope",_ropeClass); - -if (_ropeClass isNotEqualTo "") then { - [_unit, _ropeClass, true] call CBA_fnc_addItem; -}; - -[QGVAR(setTowParent), [objNull, _child], _child] call CBA_fnc_targetEvent; - -_child setVariable [QGVAR(towing), false, true]; -_parent setVariable [QGVAR(towing), false, true]; - diff --git a/addons/towing/functions/fnc_detachChild.sqf b/addons/towing/functions/fnc_detachChild.sqf new file mode 100644 index 0000000000..a30f90d8c6 --- /dev/null +++ b/addons/towing/functions/fnc_detachChild.sqf @@ -0,0 +1,33 @@ +#include "..\script_component.hpp" +/* + * Author: Dystopian + * Detaches child. + * Run globally. + * + * Arguments: + * 0: Child + * + * Return Value: + * None + * + * Example: + * cursorObject call ace_towing_fnc_detachChild + * + * Public: No + */ +params ["_child"]; +TRACE_1("detachChild",_child); + +_child setTowParent objNull; + +if (!isServer) exitWith {}; + +_child setVariable [QGVAR(parent), objNull, true]; +GVAR(allChildren) = GVAR(allChildren) - [_child]; + +private _childChildHooks = _child getVariable [QGVAR(childHooks), []]; +if (_childChildHooks isEqualTo []) then { + TRACE_1("remove Deleted EH",_child); + _child removeEventHandler ["Deleted", _child getVariable [QGVAR(DeletedEHID), -1]]; + _child setVariable [QGVAR(DeletedEHID), -1]; +}; diff --git a/addons/towing/functions/fnc_detachRope.sqf b/addons/towing/functions/fnc_detachRope.sqf new file mode 100644 index 0000000000..8baed5532d --- /dev/null +++ b/addons/towing/functions/fnc_detachRope.sqf @@ -0,0 +1,60 @@ +#include "..\script_component.hpp" +/* + * Author: Dystopian + * Detaches rope of given hook and gives rope item back. + * + * Arguments: + * 0: Player + * 1: Rope Hook + * 2: Deleted object (default: objNull) + * + * Return Value: + * None + * + * Example: + * [player, cursorObject] call ace_towing_fnc_detachRope + * + * Public: No + */ +params ["_unit", "_hook", ["_deletedObject", objNull]]; + +private _hookVars = _hook getVariable QGVAR(vars); +if (isNil "_hookVars") then { // this is hookParent + _hook = _hook getVariable QGVAR(hook); + _hookVars = _hook getVariable QGVAR(vars); +}; + +_hookVars params ["_parent", "_child", "_rope", "_ropeClass", "_hookParent"]; + +TRACE_8("detachRope",_unit,_parent,_child,_hook,_hookParent,_rope,_ropeClass,_deletedObject); + +ropeDestroy _rope; // can run on client + +if (!isNull _unit && {_ropeClass isNotEqualTo ""}) then { + [_unit, _ropeClass, true] call CBA_fnc_addItem; +}; + +{ + detach _x; + deleteVehicle _x; +} forEach [_hook, _hookParent]; + +// cleanup object variables and EHs only if function isn't called from Deleted EH +if (isNull _deletedObject || {_parent isNotEqualTo _deletedObject}) then { + private _parentChildHooks = _parent getVariable [QGVAR(childHooks), []]; + _parentChildHooks = _parentChildHooks - [_hook]; + _parent setVariable [QGVAR(childHooks), _parentChildHooks, true]; + + if (_parentChildHooks isEqualTo []) then { + [QGVAR(cleanupParent), _parent] call CBA_fnc_serverEvent; + }; +}; +if (isNull _deletedObject || {_child isNotEqualTo _deletedObject}) then { + private _childParentHooks = _child getVariable [QGVAR(parentHooks), []]; + _childParentHooks = _childParentHooks - [_hook]; + _child setVariable [QGVAR(parentHooks), _childParentHooks, true]; + + if (_childParentHooks isEqualTo []) then { + [QGVAR(detachChild), _child] call CBA_fnc_globalEvent; + }; +}; diff --git a/addons/towing/functions/fnc_getDetachActions.sqf b/addons/towing/functions/fnc_getDetachActions.sqf new file mode 100644 index 0000000000..4f86220797 --- /dev/null +++ b/addons/towing/functions/fnc_getDetachActions.sqf @@ -0,0 +1,40 @@ +#include "..\script_component.hpp" +/* + * Author: Dystopian + * Creates vehicle detach actions for attached ropes. + * + * Arguments: + * 0: Vehicle + * + * Return Value: + * Detach actions + * + * Example: + * cursorObject call ace_towing_fnc_getDetachActions + * + * Public: No + */ +params ["_vehicle"]; + +private _statement = { + params ["", "_player", "_hook"]; + [_player, _hook] call FUNC(detachRope); +}; + +private _parentHooks = _vehicle getVariable [QGVAR(parentHooks), []]; +private _childHooks = _vehicle getVariable [QGVAR(childHooks), []]; + +(_parentHooks + _childHooks) apply { + private _hook = _x; + _hook getVariable QGVAR(vars) params ["_hookParent", "_hookChild"]; + private _partner = [_hookParent, _hookChild] select (_vehicle == _hookParent); + private _partnerName = getText (configOf _partner >> "displayName"); + private _partnerOwnerName = [_partner, true] call EFUNC(common,getName); + if (_partnerOwnerName != "") then { + _partnerName = format ["%1, %2", _partnerName, _partnerOwnerName]; + }; + private _name = format ["%1 (%2)", LLSTRING(detach), _partnerName]; + private _icon = [_partner] call EFUNC(common,getVehicleIcon); + private _action = [format ["%1", _hook], _name, _icon, _statement, {true}, {}, _hook] call EFUNC(interact_menu,createAction); + [_action, [], _vehicle] +} diff --git a/addons/towing/functions/fnc_isSuitableSimulation.sqf b/addons/towing/functions/fnc_isSuitableSimulation.sqf index c808dc20c4..6df9c3d40e 100644 --- a/addons/towing/functions/fnc_isSuitableSimulation.sqf +++ b/addons/towing/functions/fnc_isSuitableSimulation.sqf @@ -19,8 +19,7 @@ params ["_target"]; // need toLower since apparently this isn't case sensitive private _simulationType = getText ((configOf _target) >> "simulation"); -TRACE_1("sim type",_simulationType); +// TRACE_1("sim type",_simulationType); // Biki lies, you can both tow and tow as either TankX or CarX -(toLower _simulationType) in ["tankx", "carx"] - +(toLower _simulationType) in ["tankx", "carx", "shipx"] diff --git a/addons/towing/functions/fnc_startTow.sqf b/addons/towing/functions/fnc_startTow.sqf index fa70d91cff..33cee1cb7b 100644 --- a/addons/towing/functions/fnc_startTow.sqf +++ b/addons/towing/functions/fnc_startTow.sqf @@ -32,5 +32,6 @@ GVAR(isSwimming) = _unit call EFUNC(common,isSwimming); GVAR(putWeaponAwayNextFrame) = false; GVAR(cancel) = false; GVAR(canAttach) = false; +GVAR(onMouseButtonDownEHID) = ["MouseButtonDown", LINKFUNC(onMouseButtonDown)] call CBA_fnc_addDisplayHandler; [LINKFUNC(towStateMachinePFH), 0, [TOW_STATE_ATTACH_PARENT, _unit, _target, objNull, _ropeLength, _ropeClass]] call CBA_fnc_addPerFrameHandler; [QGVAR(ropeDeployed), [_unit, _target, _ropeClass]] call CBA_fnc_localEvent; diff --git a/addons/towing/functions/fnc_towStateMachinePFH.sqf b/addons/towing/functions/fnc_towStateMachinePFH.sqf index 0adcce76e6..c3b7e19720 100644 --- a/addons/towing/functions/fnc_towStateMachinePFH.sqf +++ b/addons/towing/functions/fnc_towStateMachinePFH.sqf @@ -1,7 +1,7 @@ #include "..\script_component.hpp" /* * Author: tcvm - * Called per frame. Handles current unit state for attaching a rope to two vehicles + * Called per frame. Handles current unit state for attaching a rope to two vehicles. * * Arguments: * 0: PFEH Args @@ -62,14 +62,16 @@ if (_exitCondition && {_state < TOW_STATE_CANCEL}) then { switch (_state) do { case TOW_STATE_ATTACH_PARENT: { - TRACE_2("state attach parent",_unit,_parent); + // TRACE_2("state attach parent",_unit,_parent); [_unit, _parent, objNull, objNull, [0, 0, 0], _length] call FUNC(attachRopePFH); if (GVAR(canAttach) && { GVAR(mouseLeft) }) then { _args set [0, TOW_STATE_ATTACH_CHILD]; - _rope = ropeCreate [_parent, _parent worldToModelVisual ASLtoAGL getPosASLVisual GVAR(attachHelper), _length]; - [GVAR(attachHelper), [0, 0, 0]] ropeAttachTo _rope; - + // can't use unit hand because rope doesn't change position when hand moving + // can't use createVehicleLocal because rope can be non-local (like parent) and it must be attached to global vehicle + GVAR(helper) = createVehicle [QGVAR(helper), [0, 0, 0], [], 0, "CAN_COLLIDE"]; + GVAR(helper) attachTo [_unit, [0, 0, 0], "LeftHand", true]; + _rope = ropeCreate [_parent, _parent worldToModelVisual ASLtoAGL getPosASLVisual GVAR(attachHelper), GVAR(helper), [0, 0, 0], _length]; _args set [3, _rope]; }; @@ -79,7 +81,7 @@ switch (_state) do { }; }; case TOW_STATE_ATTACH_CHILD: { - TRACE_3("state attach child",_unit,_parent,_rope); + // TRACE_3("state attach child",_unit,_parent,_rope); [_unit, objNull, _parent, _rope, getPosASLVisual _rope, _length] call FUNC(attachRopePFH); if (GVAR(canAttach) && { GVAR(mouseLeft) }) then { @@ -108,60 +110,42 @@ switch (_state) do { GVAR(cancel) = false; }; - [QGVAR(setTowParent), [_parent, _child], _parent] call CBA_fnc_targetEvent; + detach GVAR(helper); + // can't delete GVAR(helper) without ropeDetach which requires local rope (==parent), so pass it to owner + if (isNull (_child getVariable [QGVAR(parent), objNull])) then { + [QGVAR(attachVehicles), [_parent, _child, _relativeAttachPos, _rope, GVAR(helper)]] call CBA_fnc_globalEvent; + } else { + [QGVAR(ropeAttachTo), [_child, _relativeAttachPos, _rope, GVAR(helper)], _parent] call CBA_fnc_targetEvent; + }; - GVAR(attachHelper) ropeDetach _rope; - [_child, _relativeAttachPos] ropeAttachTo _rope; + private _hookParent = createVehicle [QGVAR(hook), [0, 0, 0], [], 0, "CAN_COLLIDE"]; + _hookParent attachTo [_parent, _parent worldToModelVisual ASLtoAGL getPosASLVisual _rope]; - private _hook = createVehicle [QGVAR(hook), [0, 0, 0], [], 0, "NONE"]; + private _hook = createVehicle [QGVAR(hook), [0, 0, 0], [], 0, "CAN_COLLIDE"]; _hook attachTo [_child, _relativeAttachPos]; - _hook setVariable [QGVAR(parent), _parent, true]; - _hook setVariable [QGVAR(child), _child, true]; - _child setVariable [QGVAR(rope), _rope, true]; - _child setVariable [QGVAR(hook), _hook, true]; + // use array to decrease public setVar count + private _hookVars = [_parent, _child, _rope, _ropeClass, _hookParent]; + _hook setVariable [QGVAR(vars), _hookVars, true]; - _parent setVariable [QGVAR(hook), _hook, true]; + _hookParent setVariable [QGVAR(hook), _hook, true]; + _rope setVariable [QGVAR(hook), _hook, true]; - _hook setVariable [QGVAR(ropeClass), _ropeClass, true]; + private _childParentHooks = _child getVariable [QGVAR(parentHooks), []]; + _childParentHooks pushBack _hook; + _child setVariable [QGVAR(parentHooks), _childParentHooks, true]; - _child setVariable [QGVAR(towing), true, true]; - _parent setVariable [QGVAR(towing), true, true]; - - _hook setVariable [QGVAR(parentDeleteEventHandler), _parent addEventHandler ["Deleted", { - params ["_entity"]; - - private _hook = _entity getVariable [QGVAR(hook), objNull]; - private _child = _hook getVariable [QGVAR(child), objNull]; - private _parent = _hook getVariable [QGVAR(parent), objNull]; - - [objNull, _parent, _child] call FUNC(detach); - }], true]; - - _hook setVariable [QGVAR(childDeleteEventHandler), _child addEventHandler ["Deleted", { - params ["_entity"]; - - private _hook = _entity getVariable [QGVAR(hook), objNull]; - private _child = _hook getVariable [QGVAR(child), objNull]; - private _parent = _hook getVariable [QGVAR(parent), objNull]; - - [objNull, _parent, _child] call FUNC(detach); - }], true]; - - _parent setVariable [QGVAR(ropeBreakEventHandler), _parent addEventHandler ["RopeBreak", { - params ["_parent", "_rope", "_child"]; - - [objNull, _parent, _child] call FUNC(detach); - - _parent removeEventHandler ["RopeBreak", _parent getVariable QGVAR(ropeBreakEventHandler)]; - _parent setVariable [QGVAR(ropeBreakEventHandler), -1]; - }], true]; + private _parentChildHooks = _parent getVariable [QGVAR(childHooks), []]; + _parentChildHooks pushBack _hook; + _parent setVariable [QGVAR(childHooks), _parentChildHooks, true]; _args set [0, TOW_STATE_CLEANUP]; }; case TOW_STATE_CANCEL: { TRACE_1("state cancel",_rope); if !(isNull _rope) then { + detach GVAR(helper); + deleteVehicle GVAR(helper); ropeDestroy _rope; }; [_unit, _ropeClass, true] call CBA_fnc_addItem; @@ -174,6 +158,7 @@ switch (_state) do { TRACE_2("state cleanup",GVAR(attachHelper),_handle); deleteVehicle GVAR(attachHelper); [_handle] call CBA_fnc_removePerFrameHandler; + ["MouseButtonDown", GVAR(onMouseButtonDownEHID)] call CBA_fnc_removeDisplayHandler; _unit setVariable [QGVAR(hint), []]; call EFUNC(interaction,hideMouseHint); if (GVAR(blockFireEHID) != -1) then { diff --git a/addons/towing/initSettings.inc.sqf b/addons/towing/initSettings.inc.sqf index 03d20781cb..dbfe326d4c 100644 --- a/addons/towing/initSettings.inc.sqf +++ b/addons/towing/initSettings.inc.sqf @@ -7,7 +7,8 @@ { if !(_this && {isServer} && {isNil QGVAR(addRopeToVehicleInventory_initialized)}) exitWith {}; GVAR(addRopeToVehicleInventory_initialized) = true; - ["Tank", "initPost", LINKFUNC(addRopeToVehicle), true, [], true] call CBA_fnc_addClassEventHandler; - ["Car", "initPost", LINKFUNC(addRopeToVehicle), true, [], true] call CBA_fnc_addClassEventHandler; + { + [_x, "initPost", LINKFUNC(addRopeToVehicle), true, [], true] call CBA_fnc_addClassEventHandler; + } forEach ["Car", "Ship", "Tank"]; } ] call CBA_fnc_addSetting; diff --git a/addons/towing/script_component.hpp b/addons/towing/script_component.hpp index 2d9790ac20..c52e84046e 100644 --- a/addons/towing/script_component.hpp +++ b/addons/towing/script_component.hpp @@ -24,4 +24,3 @@ #define TOW_STATE_ATTACH 2 #define TOW_STATE_CANCEL 3 #define TOW_STATE_CLEANUP 4 - diff --git a/addons/trenches/functions/fnc_blockTrench_place.sqf b/addons/trenches/functions/fnc_blockTrench_place.sqf index f602a871e0..4c0a218307 100644 --- a/addons/trenches/functions/fnc_blockTrench_place.sqf +++ b/addons/trenches/functions/fnc_blockTrench_place.sqf @@ -63,10 +63,10 @@ private _east = (abs (_ax - _bx)) >= (abs (_ay - _by)); private _origin2D = []; private _length = 0; if (_east) then { - _origin2D = if (_ax < _bx) then { _start2d } else { _end2d }; + _origin2D = [_end2d, _start2d] select (_ax < _bx); _length = (abs (_ax - _bx)) / _cellsize; } else { - _origin2D = if (_ay < _by) then { _start2d } else { _end2d }; + _origin2D = [_end2d, _start2d] select (_ay < _by); _length = (abs (_ay - _by)) / _cellsize; }; TRACE_3("",_east,_origin2D,_length); diff --git a/addons/ui/functions/fnc_setAdvancedElement.sqf b/addons/ui/functions/fnc_setAdvancedElement.sqf index 3771bf840b..6751d9700c 100644 --- a/addons/ui/functions/fnc_setAdvancedElement.sqf +++ b/addons/ui/functions/fnc_setAdvancedElement.sqf @@ -68,7 +68,7 @@ if (!_force) then { }; private _displays = ((uiNamespace getVariable "IGUI_displays") + [findDisplay IDD_MISSION]) select {_idd == ctrlIDD _x}; -private _fade = [1, 0] select _show; +private _fade = parseNumber !_show; // Disable/Enable elements private _success = false; diff --git a/addons/vehicle_damage/functions/fnc_addEventHandler.sqf b/addons/vehicle_damage/functions/fnc_addEventHandler.sqf index ffd64cc77f..3697ff2cf9 100644 --- a/addons/vehicle_damage/functions/fnc_addEventHandler.sqf +++ b/addons/vehicle_damage/functions/fnc_addEventHandler.sqf @@ -103,7 +103,7 @@ if (isNil "_eh") then { // Maybe its overridden somewhere else, but this makes sure it is the last one [{ params ["_vehicle"]; - TRACE_1("EH not added yet - added eh now", _vehicle); + TRACE_1("EH not added yet - added eh now",_vehicle); private _hd = _vehicle addEventHandler ["HandleDamage", { _this call FUNC(handleDamage) }]; _vehicle setVariable [QGVAR(handleDamage), _hd]; }, [_vehicle]] call CBA_fnc_execNextFrame; diff --git a/addons/vehicle_damage/functions/fnc_processHit.sqf b/addons/vehicle_damage/functions/fnc_processHit.sqf index 48d6ec0055..17575e8f38 100644 --- a/addons/vehicle_damage/functions/fnc_processHit.sqf +++ b/addons/vehicle_damage/functions/fnc_processHit.sqf @@ -248,7 +248,7 @@ switch (_hitArea) do { }; { - TRACE_1("doing damage to hitpoint", _x); + TRACE_1("doing damage to hitpoint",_x); [_vehicle, -1, _x, 1 * _penChance] call FUNC(addDamage); } forEach _partKill; @@ -270,7 +270,7 @@ switch (_hitArea) do { }; if (0.8 * _ammoEffectiveness > random 1) then { - TRACE_1("damaged turret", _ammoEffectiveness * 0.8); + TRACE_1("damaged turret",_ammoEffectiveness * 0.8); [_vehicle, _hitIndex, _hitpointName, 1 * _penChance] call FUNC(addDamage); _vehicle setVariable [QGVAR(canShoot), false]; }; diff --git a/addons/vehiclelock/functions/fnc_onOpenInventory.sqf b/addons/vehiclelock/functions/fnc_onOpenInventory.sqf index 03562a6180..f8ccc59a0f 100644 --- a/addons/vehiclelock/functions/fnc_onOpenInventory.sqf +++ b/addons/vehiclelock/functions/fnc_onOpenInventory.sqf @@ -37,10 +37,10 @@ if (GVAR(LockVehicleInventory) && //if setting not enabled !isNull (findDisplay 602) }, { - TRACE_1("car display open: closing", _this); + TRACE_1("car display open: closing",_this); (findDisplay 602) closeDisplay 0; [{ - TRACE_1("Opening Player Inventory", _this); + TRACE_1("Opening Player Inventory",_this); ACE_player action ["Gear", objNull]; }, []] call CBA_fnc_execNextFrame; }, []] call CBA_fnc_waitUntilAndExecute; diff --git a/addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf b/addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf index c34dbb78e2..7b99f093a7 100644 --- a/addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf +++ b/addons/vehiclelock/functions/fnc_setVehicleLockEH.sqf @@ -20,5 +20,5 @@ params ["_veh", "_isLocked"]; TRACE_2("params",_veh,_isLocked); private _lockNumber = [0, 2] select _isLocked; -TRACE_2("Setting Lock State", _veh, _lockNumber); +TRACE_2("Setting Lock State",_veh,_lockNumber); _veh lock _lockNumber; diff --git a/addons/viewports/dev/debugPoints.sqf b/addons/viewports/dev/debugPoints.sqf index 24b393d70f..53fe016b62 100644 --- a/addons/viewports/dev/debugPoints.sqf +++ b/addons/viewports/dev/debugPoints.sqf @@ -22,7 +22,7 @@ #define IDD_3DEN 313 [] spawn { - INFO_2("Pre-Init [is3den %1][3den display: %2]", is3den, !isNull findDisplay IDD_3DEN); + INFO_2("Pre-Init [is3den %1][3den display: %2]",is3den,!isNull findDisplay IDD_3DEN); if (!is3den) exitWith {}; GVAR(3denIndex) = 0; diff --git a/addons/viewrestriction/XEH_clientInit.sqf b/addons/viewrestriction/XEH_clientInit.sqf index 21455af21b..1ed4f008da 100644 --- a/addons/viewrestriction/XEH_clientInit.sqf +++ b/addons/viewrestriction/XEH_clientInit.sqf @@ -19,7 +19,7 @@ if !(hasInterface) exitWith {}; }; // Exit if third person view is not available - if (difficultyOption "thirdPersonView" == 0) exitWith { + if (difficultyOption "thirdPersonView" != 1) exitWith { WARNING("View Restriction is enabled, but 3rd person is disabled with server difficulty."); }; diff --git a/addons/weaponselect/functions/fnc_throwGrenade.sqf b/addons/weaponselect/functions/fnc_throwGrenade.sqf index 4856a7b738..ffe289a589 100644 --- a/addons/weaponselect/functions/fnc_throwGrenade.sqf +++ b/addons/weaponselect/functions/fnc_throwGrenade.sqf @@ -16,7 +16,7 @@ */ //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); if (_weapon != "Throw") exitWith {}; diff --git a/addons/weather/XEH_PREP.hpp b/addons/weather/XEH_PREP.hpp index 5f17905849..220a18ef3c 100644 --- a/addons/weather/XEH_PREP.hpp +++ b/addons/weather/XEH_PREP.hpp @@ -1,9 +1,9 @@ - PREP(calculateAirDensity); PREP(calculateBarometricPressure); PREP(calculateDensityAltitude); PREP(calculateDewPoint); PREP(calculateHeatIndex); +PREP(calculateOxygenDensity); PREP(calculateRoughnessLength); PREP(calculateSpeedOfSound); PREP(calculateTemperatureAtHeight); diff --git a/addons/weather/functions/fnc_calculateOxygenDensity.sqf b/addons/weather/functions/fnc_calculateOxygenDensity.sqf new file mode 100644 index 0000000000..542b4b2f10 --- /dev/null +++ b/addons/weather/functions/fnc_calculateOxygenDensity.sqf @@ -0,0 +1,20 @@ +#include "..\script_component.hpp" +/* + * Author: Brett Mayson + * Calculates the oxygen density + * + * Arguments: + * 0: Temperature - °C + * 1: Pressure - hPa + * 2: Relative humidity - value between 0.0 and 1.0 + * + * Return Value: + * Density of oxygen - kg * m^(-3) + * + * Example: + * [0, 1020] call ace_weather_fnc_calculateOxygenDensity + * + * Public: No + */ + +(_this call FUNC(calculateAirDensity)) * 0.21 diff --git a/addons/weather/functions/fnc_displayAirTemp.sqf b/addons/weather/functions/fnc_displayAirTemp.sqf index 4eb5bdf3ac..08b325dcac 100644 --- a/addons/weather/functions/fnc_displayAirTemp.sqf +++ b/addons/weather/functions/fnc_displayAirTemp.sqf @@ -17,7 +17,7 @@ */ params ["_apparent_temperature", "_bias"]; -TRACE_2("displayAirTemp",_apparent_temperature, _bias); +TRACE_2("displayAirTemp",_apparent_temperature,_bias); private _temperature1 = floor(_apparent_temperature + (_bias select 0) - (random 2)); private _temperature2 = floor(_apparent_temperature + (_bias select 1) + (random 2)); diff --git a/addons/weather/functions/fnc_displayWindInfo.sqf b/addons/weather/functions/fnc_displayWindInfo.sqf index d7c45e595a..23a87ecbf4 100644 --- a/addons/weather/functions/fnc_displayWindInfo.sqf +++ b/addons/weather/functions/fnc_displayWindInfo.sqf @@ -29,14 +29,14 @@ EGVAR(advanced_ballistics,Protractor) = false; GVAR(WindInfo) = true; -TRACE_1("Starting Wind Info PFEH", GVAR(WindInfo)); +TRACE_1("Starting Wind Info PFEH",GVAR(WindInfo)); [{ disableSerialization; params ["", "_pfID"]; if ((!GVAR(WindInfo)) || {!([ACE_player, ACE_player, []] call EFUNC(common,canInteractWith))}) exitWith { - TRACE_1("Ending Wind Info PFEH", GVAR(WindInfo)); + TRACE_1("Ending Wind Info PFEH",GVAR(WindInfo)); GVAR(WindInfo) = false; (["RscWindIntuitive"] call BIS_fnc_rscLayer) cutText ["", "PLAIN"]; [_pfID] call CBA_fnc_removePerFrameHandler; diff --git a/addons/weather/functions/fnc_getApproximateAirTemp.sqf b/addons/weather/functions/fnc_getApproximateAirTemp.sqf index 33227907a3..91b8af3fcc 100644 --- a/addons/weather/functions/fnc_getApproximateAirTemp.sqf +++ b/addons/weather/functions/fnc_getApproximateAirTemp.sqf @@ -18,7 +18,7 @@ params ["_unit"]; TRACE_1("params",_unit); -if (isNil (format ["%1", _unit getVariable "ACE_airTemperatureBias"])) then { +if (isNil {_unit getVariable "ACE_airTemperatureBias"}) then { _unit setVariable ["ACE_airTemperatureBias", [-(random(3) + 1), random(3) + 1]]; }; diff --git a/addons/winddeflection/functions/fnc_handleFired.sqf b/addons/winddeflection/functions/fnc_handleFired.sqf index e4b547c032..c1b93818f0 100644 --- a/addons/winddeflection/functions/fnc_handleFired.sqf +++ b/addons/winddeflection/functions/fnc_handleFired.sqf @@ -16,7 +16,7 @@ */ //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); if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false] && {_projectile isKindOf "BulletBase" && {_unit isKindOf "Man"}}) exitWith {false}; diff --git a/addons/xm157/functions/fnc_weaponInfo_draw.sqf b/addons/xm157/functions/fnc_weaponInfo_draw.sqf index ef9fd1d528..c03b575f4e 100644 --- a/addons/xm157/functions/fnc_weaponInfo_draw.sqf +++ b/addons/xm157/functions/fnc_weaponInfo_draw.sqf @@ -86,7 +86,7 @@ if (_retTex != ctrlText _ctrlScopeReticle) then { _ctrlScopeReticle ctrlSetText private _rangeInfo = _range call { if (_range == 0) exitWith { "" }; if (_range < 0) exitWith { // range error - blink if recent - if ((_timeSinceLastInput < 3) && {(floor (4*_timeSinceLastInput)) % 2 == 1}) then { "----" } else { "" }; + ["", "----"] select ((_timeSinceLastInput < 3) && {(floor (4*_timeSinceLastInput)) % 2 == 1}); }; format ["%1 m", _range toFixed 0] }; @@ -98,7 +98,7 @@ _ctrl ctrlSetText _rangeInfo; private _bearingInfo = call { private _bearingSetting = GVAR(data) getOrDefault ["bearing_show", 0]; if ((_bearingSetting == 2) && {_timeSinceLastInput > 2}) exitWith { "" }; - if ((_bearingSetting == 1)) exitWith { format ["%1", floor (17.777777 * _weaponDir)]; }; // (6400 Mils, not MRAD) + if ((_bearingSetting == 1)) exitWith { str floor (17.777777 * _weaponDir); }; // (6400 Mils, not MRAD) format ["%1°", floor _weaponDir]; }; private _ctrl = _display displayCtrl IDC_SCREEN_TEXT_UPPER_LEFT; diff --git a/addons/zeus/functions/fnc_bi_moduleCurator.sqf b/addons/zeus/functions/fnc_bi_moduleCurator.sqf index c597955a23..ec04a12d24 100644 --- a/addons/zeus/functions/fnc_bi_moduleCurator.sqf +++ b/addons/zeus/functions/fnc_bi_moduleCurator.sqf @@ -257,7 +257,7 @@ if (_activated) then { //--- Player if (hasinterface) then { waituntil {local player}; - _serverCommand = if (_ownerVar == "#adminLogged") then {"#shutdown"} else {"#kick"}; + _serverCommand = ["#kick", "#shutdown"] select (_ownerVar == "#adminLogged"); //--- Black effect until the interface is open _forced = _logic getvariable ["forced",0] > 0; diff --git a/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf b/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf index b2288be91c..2aa438be53 100644 --- a/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf +++ b/addons/zeus/functions/fnc_bi_moduleRemoteControl.sqf @@ -30,7 +30,7 @@ if (_activated && local _logic && !isnull curatorcamera) then { //--- Get unit under cursor _unit = objnull; _mouseOver = missionnamespace getvariable ["bis_fnc_curatorObjectPlaced_mouseOver",[""]]; - if ((_mouseOver select 0) == typename objnull) then {_unit = _mouseOver select 1;}; + if ((_mouseOver select 0) == "OBJECT") then {_unit = _mouseOver select 1;}; _unit = effectivecommander _unit; //--- Temp owner diff --git a/addons/zeus/functions/fnc_moduleCargoParadropWaypoint.sqf b/addons/zeus/functions/fnc_moduleCargoParadropWaypoint.sqf index 615a11d271..dded460710 100644 --- a/addons/zeus/functions/fnc_moduleCargoParadropWaypoint.sqf +++ b/addons/zeus/functions/fnc_moduleCargoParadropWaypoint.sqf @@ -48,7 +48,7 @@ waitUntil { }; TRACE_2("Finished primary movement",_vehicle distance2D _wpPos,_closeEnoughTicks); -if ((!alive _vehicle) || {!alive _commander}) exitWith {TRACE_2("died",alive _vehicle, alive _commander); true}; +if ((!alive _vehicle) || {!alive _commander}) exitWith {TRACE_2("died",alive _vehicle,alive _commander); true}; if (((getPos _vehicle) select 2) < 25) exitWith {TRACE_1("too low",getPos _vehicle); true}; // Fly level and straight diff --git a/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf b/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf index 6c511bae07..6d2a94139b 100644 --- a/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf +++ b/addons/zeus/functions/fnc_moduleRemoveArsenal.sqf @@ -30,7 +30,7 @@ switch (true) do { }; default { - TRACE_1("Calling removeVirtualXXXCargo functions", _object); + TRACE_1("Calling removeVirtualXXXCargo functions",_object); [_object, (_object call BIS_fnc_getVirtualItemCargo), true] call BIS_fnc_removeVirtualItemCargo; [_object, (_object call BIS_fnc_getVirtualWeaponCargo), true] call BIS_fnc_removeVirtualWeaponCargo; [_object, (_object call BIS_fnc_getVirtualMagazineCargo), true] call BIS_fnc_removeVirtualMagazineCargo; diff --git a/addons/zeus/functions/fnc_ui_toggleFlashlight.sqf b/addons/zeus/functions/fnc_ui_toggleFlashlight.sqf index 9c34bc8f65..5c9a220615 100644 --- a/addons/zeus/functions/fnc_ui_toggleFlashlight.sqf +++ b/addons/zeus/functions/fnc_ui_toggleFlashlight.sqf @@ -53,7 +53,7 @@ if !(isNull _unit) then { if (isNull _unit) then { (_display displayCtrl 56220) lbDelete 0; } else { - (_display displayCtrl 56218) lbSetCurSel ([0, 1] select (_unit isFlashlightOn currentWeapon _unit)); + (_display displayCtrl 56218) lbSetCurSel (parseNumber (_unit isFlashlightOn currentWeapon _unit)); }; private _fnc_onUnload = { diff --git a/addons/zeus/functions/fnc_ui_toggleNvg.sqf b/addons/zeus/functions/fnc_ui_toggleNvg.sqf index 1e60a777ea..5d5747c7ca 100644 --- a/addons/zeus/functions/fnc_ui_toggleNvg.sqf +++ b/addons/zeus/functions/fnc_ui_toggleNvg.sqf @@ -53,7 +53,7 @@ if !(isNull _unit) then { if (isNull _unit) then { (_display displayCtrl 92856) lbDelete 0; } else { - (_display displayCtrl 92855) lbSetCurSel ([0, 1] select (hmd _unit isNotEqualTo "")); + (_display displayCtrl 92855) lbSetCurSel (parseNumber (hmd _unit isNotEqualTo "")); }; private _fnc_onUnload = { diff --git a/addons/zeus/stringtable.xml b/addons/zeus/stringtable.xml index d9401789a4..6f163b46be 100644 --- a/addons/zeus/stringtable.xml +++ b/addons/zeus/stringtable.xml @@ -998,7 +998,7 @@ Einheit muss ein Fahrzeug mit Ladekapazität sein La unidad debe ser un vehículo con espacio de carga L'unité doit être un véhicule muni d'un espace de stockage. - ユニットはカーゴのある車両である必要があります + ユニットは貨物室のある車両である必要があります 대상이 반드시 화물을 실을 수 있는 차량이어야 합니다 单位必须是载具且有载货空间 單位必須是載具且有載貨空間 @@ -1013,7 +1013,7 @@ Einheit muss freie Ladekapazität haben La unidad debe tener espacio de carga disponible L'unité doit avoir de l'espace de chargement disponible. - ユニットのカーゴには空きがありません + ユニットの貨物室に空きが必要です 대상의 화물공간이 남아 있어야 합니다 单位必须有剩余的载货空间 單位必須有剩餘的載貨空間 @@ -1180,7 +1180,7 @@ Cargaison : Груз: Náklad: - カーゴ: + 貨物: Ładunek: Ladung: 화물: @@ -1303,7 +1303,7 @@ Load into Cargo In Frachtraum laden Carica nel carico - カーゴへ積載 + 貨物室へ積載 裝載到貨物中 装载到货物中 화물 싣기 @@ -1318,7 +1318,7 @@ Unload from cargo Aus Frachtraum ausladen Scarica dal carico - カーゴから降ろす + 貨物室から降ろす 화물 내리기 @@ -1901,7 +1901,7 @@ Paradrop Cargo Ladung abwerfen (Fallschirm) - カーゴを空中投下 + 貨物を空中投下 Zrzut ładunku (cargo) Десантировать груз Soltar carga de paraquedas @@ -1917,7 +1917,7 @@ No cargo loaded Keine Ladung geladen - カーゴは積載されていません + 貨物は積載されていません Niczego nie załadowano do cargo Грузовой отсек пуст Nenhuma carga carregada diff --git a/docs/_config.yml b/docs/_config.yml index 52ba8da828..bc7440eee3 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -9,8 +9,8 @@ ace: version: major: 3 minor: 16 - patch: 1 - build: 74 + patch: 3 + build: 79 markdown: kramdown diff --git a/docs/_config_dev.yml b/docs/_config_dev.yml index 67de48f2f6..0d0cf1b7fc 100644 --- a/docs/_config_dev.yml +++ b/docs/_config_dev.yml @@ -9,8 +9,8 @@ ace: version: major: 3 minor: 16 - patch: 1 - build: 74 + patch: 3 + build: 79 markdown: kramdown diff --git a/docs/img/wiki/feature/atragmx1.webp b/docs/img/wiki/feature/atragmx1.webp deleted file mode 100644 index 809f44a6c0..0000000000 Binary files a/docs/img/wiki/feature/atragmx1.webp and /dev/null differ diff --git a/docs/img/wiki/feature/atragmx1ab.webp b/docs/img/wiki/feature/atragmx1ab.webp new file mode 100644 index 0000000000..7a71559f24 Binary files /dev/null and b/docs/img/wiki/feature/atragmx1ab.webp differ diff --git a/docs/img/wiki/feature/atragmx1db.webp b/docs/img/wiki/feature/atragmx1db.webp new file mode 100644 index 0000000000..0bf6bc71f7 Binary files /dev/null and b/docs/img/wiki/feature/atragmx1db.webp differ diff --git a/docs/tools/document_functions.py b/docs/tools/document_functions.py index c3286cf6ef..dab567d208 100644 --- a/docs/tools/document_functions.py +++ b/docs/tools/document_functions.py @@ -192,6 +192,9 @@ class FunctionFile: if arg_default is None: arg_default = "" + if ("SCALAR" in arg_types or "NUMVER" in arg_types): + self.feedback("Bad Arg Type \"{}\"".format(arg_types), 1) + arguments.append([arg_index, arg_name, arg_types, arg_default, arg_notes]) else: # Notes about the above argument won't start with an index diff --git a/docs/wiki/feature/atragmx.md b/docs/wiki/feature/atragmx.md index 2f778f222a..fbac7a30fd 100644 --- a/docs/wiki/feature/atragmx.md +++ b/docs/wiki/feature/atragmx.md @@ -22,7 +22,7 @@ Horus ATragMX software considers atmospheric conditions, gun data, ammunition, r ## 2. Requirement -- [Advanced Ballistics module enabled]({{ site.baseurl }}/wiki/feature/advanced-ballistics.html) +- [Advanced Ballistics enabled]({{ site.baseurl }}/wiki/feature/advanced-ballistics.html) ## 3. Usage @@ -31,9 +31,9 @@ Horus ATragMX software considers atmospheric conditions, gun data, ammunition, r #### 3.1.1 Interaction Menu -- Open the self interaction menu Ctrl + ⊞ Win -- Select `Equipment` -- Select `Open AtragMx` +- Open the self interaction menu Ctrl + ⊞ Win. +- Select `Equipment`. +- Select `Open AtragMx`. #### 3.1.2 Custom key @@ -43,43 +43,66 @@ Horus ATragMX software considers atmospheric conditions, gun data, ammunition, r **Start of the mission:** -- Open the [Range Card]({{ site.baseurl }}/wiki/feature/rangecard.html) and check the cartridge, the zeroed distance, the rifle twist, the muzzle velocity at 15°C and the bore height. +- Open the [Range Card]({{ site.baseurl }}/wiki/feature/rangecard.html) and check the ammunition: bullet diameter, bullet weight, rifle twist, muzzle velocity at 15°C, zeroed distance and bore height. -Range card +Range card -- Open the AtragMx and the `Atmsphr` column, select `Default` and `Done`. [[Manual]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=15) -- `Open Gun` the 7.62x51mm M80 in the `GunList`. [[Manual]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=25) -- Select `E` (English unit) at the top right. [[Manual]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=10) -- Open the `Gun` column, check and update the `Bore`, the `Rifle Twist` and `Done`. +- Open the AtragMx and the `Atmsphr` column, select `Default` and `Done`. +- `Open Gun` the 7.62x51mm M80 in the `GunList`. +- Select `E` (English unit) at the top right. +- Open the `Gun` column, check and update the `Bore (inches)`, `Bullet Weight (grains)`, `Bullet Diam (inches)`, `Rifle Twist (in/trn)` and `Done`. - Select `M` (Metric unit) at the top right. -- Open the `Gun` column, check and update the `Muzzle Velocity`, the `Zero Range` and `Done`. -- *The Muzzle Velocity Table will be automatically updated.* [[Manual]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=22) -- *(Must be edited manually for specific cartridges according with the range card)* +- Open the `Gun` column, check and update the `Muzzle Velocity (m/s)`, the `Zero Range (meters)` and `Done`. +- *Muzzle Velocities (`Options` / `Muz Vel table`) may need a manual update according to the range card.* +- *AtragMx is configured with `C1 coefficient` according to vanilla weapons and its ammunitions in `GunList`.* +- *More information about C1: [Example with `Add New Gun` in `GunList`](#35-example-with-add-new-gun-in-gunlist).* +- Check `Elev` = 0 with `ZR` = `TR` *(if not, open `Gun` column and `Done`)*. - Optionally, `Save Gun` and `Done` in the `GunList`. - + **In position:** -- Update the `Atmsphr` column with the [Kestrel 4500]({{ site.baseurl }}/wiki/feature/kestrel4500.html) and `Done`. +- Update the `Atmsphr` column and `Done`. Requirement: [Kestrel 4500]({{ site.baseurl }}/wiki/feature/kestrel4500.html). - *Check the new `Muzzle Velocity` in the `Gun` column.* -- Update the `Target` column (the [wind arrow]({{ site.baseurl }}/wiki/feature/weather.html) will also help). [[1]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=16) [[2]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=30) [[3]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=32) [[4]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=33) -- *The latitude for all common maps can be found in the [ACE3 Github]({{ site.ace.githubUrl }}/blob/master/addons/common/functions/fnc_getMapData.sqf).* -- Apply the vertical and horizontal elevations on the [scope]({{ site.baseurl }}/wiki/feature/scopes.html). -- Control the breath and press. - +- Update the `Target` column and `Done`. Requirement: [wind arrow]({{ site.baseurl }}/wiki/feature/weather.html), [Protractor]({{ site.baseurl }}/wiki/feature/advanced-ballistics#22-protractor.html), [Map Tools]({{ site.baseurl }}/wiki/feature/maptools.html). For advanced tools: [ACE3 Equipment]({{ site.baseurl }}/wiki/feature.html). + - `Latitude`: *[ACE3 Github]({{ site.ace.githubUrl }}/blob/master/addons/common/functions/fnc_getMapData.sqf) or Eden Editor's Extended Debug Console: Watch:* `ace_common_maplatitude`. + - `Dir of Fire (deg from N)`: *The value is therefore given as the direction of the barrel axis from true north.* **[Horus manual p.14]** + - `Wind speed (m/s)`: *Two wind speed values (low and high) may be entered on the target screen,[...] Lead/Wind2 button on the screen.* **[Horus manual p.32]** + - *Wind takes into account geographic location, season, time of day, obstacles, altitude and surface roughness: [Wind Profile](https://wind-data.ch/tools/profile.php?lng=en).* + - `Wind Direction (clock)`: *Wind Direction is expressed in clock points.[...], wind is always described in terms of where it is coming from.* **[Horus manual p.16]** + - `Inclination Angle`: *The degrees field is marked with a “d” and the cosine field with a “c”.* **[Horus manual p.33]** + - `Target Speed`: *Target Speed Assist* **[Horus manual p.21]** + - `Target Range (meters)`: *Parameter Limits minimum and maximum values: 25 - 3700 meters.* **[Horus manual p.17]** +- Apply vertical (Page Up and Down keys as default) and horizontal (Left Ctrl + Page Up and Down keys as default) elevations to the [scope]({{ site.baseurl }}/wiki/feature/scopes.html). +- Hold Breath (Left Shift as default) and Fire (Prim. Mouse. Btn. as default). + ### 3.3 Example with Truing tool -- Open the `Truing Drop` in the `Options` menu. [[Manual]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=23) -- Add the actual `Target Range` in the `SUPER` column and `Calc`. -- Add the same `Target Range` in the `SUB` column and `Calc`. -- Apply the actual scope elevation in the `Drop` field and `Calc`. -- `Accept` the new `C1`, `Gun` column and `Elev` are updated. -- *The Drag Coefficient Table will be automatically updated.* [[Manual]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=22) -- Optionally, `Save Gun` and `Done` in the `GunList`. - +> This process is called “Truing Drop”, or simply “Truing”. It involves taking 2 or 3 real flight data points (finding bullet drop at 2 or 3 places along its flight) and feeding it into the calculation parameters. **[Horus manual p.23]** + +> The Truing Drop function is opened from ATrag’s main screen by selecting “Options” [...], then selecting “Truing Drop” from the menu that appears. **[Horus manual p.23]** + +> With C1, you can also insert the new BC into the C1 table (with the target range value), or you can replace the C1 table with the following values: +> 1. first entry: Zero Range, original C1. +> 2. second entry: range at 75% of distance between transonic start and subsonic start, with original C1. +> 3. third entry: range 200 (y/m) beyond subsonic start, with new calculated C1. **[Horus manual p.24]** + +- Basic example with ammunition 7.62x51mm G7 ballistic coefficient. + - Open the AtragMx and the `Atmsphr` column, select `Default` and `Done`. + - `Open Gun` a custom profile in the `GunList`. + - *More information about custom profile: [Example with `Add New Gun` in `GunList`](#35-example-with-add-new-gun-in-gunlist).* + - Check `Elev` = 0 with `ZR` = `TR` *(if not, open `Gun` column and `Done`)*. + - Open the `Truing Drop` in the `Options` menu. + - Add the actual `Target Range` in the `SUPER` column and `Calc`. + - Add the same `Target Range` in the `SUB` column and `Calc`. + - Apply the actual scope elevation in the `Drop` field and `Calc`. + - `Accept` the new `C1`, `Gun` column and `Elev` are updated. + - *C1 Ballistic Coefficient vs. Distance Interpolation Table (`Options` / `Drag Coef Table`) will be updated.* + - Optionally, `Save Gun` and `Done` in the `GunList`. + Calculation - -- If a new `Target Range` is applied in the `Target` column, the ballistic coefficient `C1` and the elevation `Elev` will be automatically recalculated. - + +- If a new `Target Range` is applied in the `Target` column, the ballistic coefficient `C1` and the elevation `Elev` will be recalculated. + Interpolation Extrapolation @@ -87,23 +110,26 @@ Horus ATragMX software considers atmospheric conditions, gun data, ammunition, r ### 3.4 Example with overwritten zero distance - The `Default zero distance` can be overwritten with the [Scopes Options]({{ site.baseurl }}/wiki/feature/scopes.html), the [Scopes Framework]({{ site.baseurl }}/wiki/framework/scopes-framework.html) or the [CBA Settings System](https://github.com/CBATeam/CBA_A3/wiki/CBA-Settings-System). -- In this case, the [Range Card]({{ site.baseurl }}/wiki/feature/rangecard.html) will be automatically updated, NOT the AtragMx. -- Open the AtragMx and the `Atmsphr` column, select `Default` and `Done`. [[Manual]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=15) +- In this case, the [Range Card]({{ site.baseurl }}/wiki/feature/rangecard.html) will be updated, **NOT the AtragMx**. +- Open the AtragMx and the `Atmsphr` column, select `Default` and `Done`. - Open the `Gun` column, check and update the `Zero Range` and `Done`. - +- Check `Elev` = 0 with `ZR` = `TR` *(if not, open `Gun` column and `Done`)*. +- Optionally, `Save Gun` and `Done` in the `GunList`. + Zero distance 300m ### 3.5 Example with `Add New Gun` in `GunList` -- Open the [Range Card]({{ site.baseurl }}/wiki/feature/rangecard.html) and check the bullet diameter, the bullet weight, the **(bullet Class Name)** and the muzzle velocities. -- Open the AtragMx and the `Atmsphr` column, select `Default` and `Done`. [[Manual]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=15) -- Select `Add New Gun` in the `GunList`. [[Manual]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=25) +- Open the [Range Card]({{ site.baseurl }}/wiki/feature/rangecard.html) and check the ammunition: **bullet Class Name**, bullet diameter, bullet weight, rifle twist, muzzle velocities, zeroed distance and bore height. +- Open the AtragMx and the `Atmsphr` column, select `Default` and `Done`. +- Select `Add New Gun` in the `GunList`. - Add a `New Gun Name` and `Open Gun`. -- Select `E` (English unit) at the top right. [[Manual]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=10) -- Open the `Gun` column, check and update the `Bullet Weight (grains)`, the `Bullet Diam (inches)` and `Done`. +- Select `E` (English unit) at the top right. +- Open the `Gun` column, check and update the `Bore (inches)`, `Bullet Weight (grains)`, `Bullet Diam (inches)`, `Rifle Twist (in/trn)` and `Done`. - Select `M` (Metric unit) at the top right. -- Open the `Muz Vel Table` in the `Options` menu or click on `MV` in the `Gun` column. -- Edit manually the `Muzzle Velocity Table` according with the [Range Card]({{ site.baseurl }}/wiki/feature/rangecard.html) and `Done`. [[Manual]](https://horusvision.com/download/manual_Horus_ATrag-v385.pdf#page=22) +- Open the `Gun` column, check and update the `Zero Range (meters)` and `Done`. +- Open the `Muz Vel Table` in the `Options` menu or click on `MV` in the `Gun` column. +- Edit manually the `Muzzle Velocity Table` according to the [Range Card]({{ site.baseurl }}/wiki/feature/rangecard.html) and `Done`. - The `C1 coefficient` of the bullet can be found with the Eden Editor `Config Viewer`: > configfile >> "CfgAmmo" >> "**bullet Class Name**" >> "ACE_ballisticCoefficients" @@ -112,26 +138,92 @@ Horus ATragMX software considers atmospheric conditions, gun data, ammunition, r - *The AtragMx accepts only **G1 ballistic coefficient**.* - *G7 ballistic coefficient can be converted, for example, with the online [JBM Ballistics Calculators](http://www.jbmballistics.com/cgi-bin/jbmgf-5.1.cgi)*. +- Check `Elev` = 0 with `ZR` = `TR` *(if not, open `Gun` column and `Done`)*. - Optionally, `Save Gun` and `Done` in the `GunList`. +> Note: The ballistic coefficient can be calculated by using the [360 Degree Training Course mission](#5-resources) as a chronograph at different distances and [JBM Ballistics Calculators](http://www.jbmballistics.com/cgi-bin/jbmbcv-5.1.cgi) for example, an another ballistic software at your own convenience, or the [AtragMx Truing Tool](#33-example-with-truing-tool). -> Note: The ballistic coefficient can be calculated by using the [360 Degree Training Course mission](https://forums.bistudio.com/forums/topic/171228-sp-360-degree-training-course/) as a chronograph at different distances and [JBM Ballistics Calculators](http://www.jbmballistics.com/cgi-bin/jbmbcv-5.1.cgi) for example, an another ballistic software at your own convenience, or the [AtragMx Truing Tool](#33-example-with-truing-tool). - -> Example direct conversion with .408 Cheytac 305 grains G7 BC 0.279 at 2000 meters 15°C: +> Example direct conversion with .408 Cheytac 305 grains, G7 BC 0.279 at 2000 meters, ICAO conditions (15°C, 1013.25hPa, 0%): Conversion G7/G1 BC -### 3.6 Adding ATragMX Presets +### 3.6 Connecting AtragMx with Vector 21 and DAGR -- [ATragMX Framework]({{ site.baseurl }}/wiki/framework/atragmx.html) +- Requirement: [Vector]({{ site.baseurl }}/wiki/framework/vector.html) and [DAGR]({{ site.baseurl }}/wiki/framework/dagr.html). +- Open the self interaction menu Ctrl + ⊞ Win. +- Select `Equipment`. +- Select `Configure DAGR` and `CONNECT TO` (DOWN and HELP/SEL) `Vector 21`(HELP/SEL). +- Equip and use the Vector (B key as default). +- Check target's [slope distance and azimuth]({{ site.baseurl }}/wiki/feature/vector#23-slope-distance-and-azimuth.html) (hold both R and Tab keys as default). +- Open the [AtragMx properly configured before]({{ site.baseurl }}/wiki/feature/atragmx#32-example-with-m14-and-default-762mm-20rnd-mag.html) according to current rifle and ammunition. +- Open the `Target` column: `Dir of Fire (deg from N)`, `Inclination Angle` and `Target Range (meters)` updated with Vector's values. -### 3.7 Reseting the AtragMx `GunList` +### 3.7 Adding AtragMx Presets -- Open the Eden Editor and the Extended Debug Console (Ctrl+D). -- Execute `call ace_atragmx_fnc_clear_user_data` (LOCAL EXEC). +- [AtragMx Framework]({{ site.baseurl }}/wiki/framework/atragmx.html) + +> Scope Base Angle value: +> - Open the AtragMx and the `Atmsphr` column, select `Default` and `Done`. +> - `Open Gun` the custom profile (with an arbitrary scope base angle) in the `GunList`. +> - Check `Elev` value with `ZR` = `TR`. +> - Open the `Gun` column and `Done`. +> - Execute `copyToClipboard Str(ace_atragmx_workingMemory select 3);` [LOCAL EXEC] with the Eden Editor's Extended Debug Console. +> - Paste new value to the `preset`. +> - After new test, check `Elev` = 0 with `ZR` = `TR`. + +### 3.7 Reseting AtragMx `GunList` + +- Open the Eden Editor's Extended Debug Console. +- Execute `call ace_atragmx_fnc_clear_user_data` or `call ace_atragmx_fnc_initGunList` [LOCAL EXEC], (`RESTART` eventually needed). - The original ACE3 `GunList` will be restored (all `Add New Gun` entries deleted). +### 3.8 Example with AtragMx and default ballistic (M14, 7.62mm 20Rnd Mag) + +> Note: ACE3 has two external ballistics, the vanilla default ballistic (enabled as default) and the [Advanced Ballistics]({{ site.baseurl }}/wiki/feature/advanced-ballistics.html) (must be enabled). The ACE3 default ballistic doesn't take atmospheric conditions (except wind), powder temperature, rifle twist and Earth effects into account. The AtragMx will need for `Gun` column: `Bore`, `C1 Coefficient`, `Muzzle Velocity` and `Zero Range`. With `Target` column, `Latitude` and `Dir of Fire` are useless. `Atmsphr` column must not be updated. + +**Start of the mission:** + +- Open the [Range Card]({{ site.baseurl }}/wiki/feature/rangecard.html) and check the ammunition: **bullet Class Name**, muzzle velocity, zeroed distance and bore height. + +Range card + +- Open the AtragMx and the `Atmsphr` column, select `Default` and `Done`. +- Select `E` (English unit) at the top right. +- Open the `Gun` column, check and update the `Bore (inches)` and `Done`. +- Select `M` (Metric unit) at the top right. +- Open the `Gun` column, check and update the `Muzzle Velocity (m/s)`, the `Zero Range (meters)` and `Done`. +- `C1 coefficient` of the bullet = `airFriction x -1000`. +- `airFriction` can be found with the Eden Editor `Config Viewer`: + +> configfile >> "CfgAmmo" >> "**bullet Class Name**" >> "airFriction" + +- *AtragMx is configured with `C1 coefficient` according to vanilla weapons and its ammunitions in `GunList`.* +- *Spin drift and Earth effects not taken into account, `Options` / `Show Coriolis` can be disabled.* +- Check `Elev` = 0 with `ZR` = `TR` *(if not, open `Gun` column and `Done`)*. +- Optionally, `Save Gun` and `Done` in the `GunList`. + +**In position:** + +- **Do not update the `Atmsphr` column.** Default ballistic doesn't take into account temperature, pressure and humidity. +- Update the `Target` column and `Done`. Requirement: [wind arrow]({{ site.baseurl }}/wiki/feature/weather.html), [Protractor]({{ site.baseurl }}/wiki/feature/advanced-ballistics#22-protractor.html), [Map Tools]({{ site.baseurl }}/wiki/feature/maptools.html). For advanced tools: [ACE3 Equipment]({{ site.baseurl }}/wiki/feature.html). + - `Wind speed (m/s)`: *Two wind speed values (low and high) may be entered on the target screen,[...] Lead/Wind2 button on the screen.* **[Horus manual p.32]** + - *Wind takes into account geographic location, season, time of day and obstacles.* + - `Wind Direction (clock)`: *Wind Direction is expressed in clock points.[...], wind is always described in terms of where it is coming from.* **[Horus manual p.16]** + - `Inclination Angle`: *The degrees field is marked with a “d” and the cosine field with a “c”.* **[Horus manual p.33]** + - `Target Speed`: *Target Speed Assist* **[Horus manual p.21]** + - `Target Range (meters)`: *Parameter Limits minimum and maximum values: 25 - 3700 meters.* **[Horus manual p.17]** +- Apply vertical (Page Up and Down keys as default) and horizontal (Left Ctrl + Page Up and Down keys as default) elevations to the [scope]({{ site.baseurl }}/wiki/feature/scopes.html). +- Hold Breath (Left Shift as default) and Fire (Prim. Mouse. Btn. as default). + ## 4. Official References -- [Official Manual]({{ site.ace.githubUrl }}/blob/master/extras/manual_Horus_ATrag-v385.pdf) +- [Horus AtragMx Manual]({{ site.ace.githubUrl }}/blob/master/extras/manual_Horus_ATrag-v385.pdf) + + +## 5. Resources + +Missions by Ruthberg, author of Advanced Ballistics and its tools: + +- Arma3 Missions folder: [360 Degree Training Course v1.3]({{ site.ace.githubUrl }}/blob/master/extras/ruthberg_missions/360_Degree_Training_Course-Missions.zip), *[Features](https://forums.bistudio.com/forums/topic/171228-sp-360-degree-training-course/)* +- Eden Editor mission: [360 Degree Training Course Framework]({{ site.ace.githubUrl }}/blob/master/extras/ruthberg_missions/360_Degree_Training_Course-Framework.zip) diff --git a/docs/wiki/feature/explosives.md b/docs/wiki/feature/explosives.md index ec20c0f62f..ec14c4466a 100644 --- a/docs/wiki/feature/explosives.md +++ b/docs/wiki/feature/explosives.md @@ -35,6 +35,7 @@ Enables attaching explosives to vehicles. - Interact with the explosive ⊞ Win (ACE3 default key bind `Interact Key`). - Choose the arming method. - For clackers use Self Interaction `Explosives` → `Detonate` and choose the corresponding Firing Device. +- Alternatively, use Ctrl+Alt+C (ACE3 default key bind `Detonate All on Active Clacker`) to detonate all explosives tied to the `Active Detonator`, which can be changed via the `Set Active Detonator` interaction on the desired Clacker / Dead Man Switch. ### 2.3 Defusing explosives - A `Defusal Kit` is required. diff --git a/docs/wiki/framework/arsenal-framework.md b/docs/wiki/framework/arsenal-framework.md index 95c7e82211..4baddf66ad 100644 --- a/docs/wiki/framework/arsenal-framework.md +++ b/docs/wiki/framework/arsenal-framework.md @@ -402,6 +402,8 @@ For actions involving frame delays or timers, a second call of the `ace_arsenal_ Since CBA frame functions are deactivated during preInit as of Oct 24th 2023, the refresh function is executed immediatelly after the action code is executed. Take note of this information and the comment below if you'd like your actions to be usable in 3DEN. +By default actions are updated whenever the arsenal is refreshed (`ace_arsenal_fnc_refresh`) and whenever item info (the bottom right GUI element that shows item name and author) is updated. If any action with the `updateOnCargoChanged` property is added, then actions will also be updated on container inventory changes. + ### 7.1 Adding actions via config ```cpp @@ -410,6 +412,7 @@ class ace_arsenal_actions { displayName = "My Actions"; condition = QUOTE(true); scopeEditor = 2; // Only actions with scopeEditor = 2 are shown in 3DEN. Actions working with variables should take object variables being reset between editor view and mission start into account. + updateOnCargoChanged = 1; // See comment above. tabs[] = {0,5}; class text { // A simple text label @@ -417,6 +420,7 @@ class ace_arsenal_actions { }; class statement { // Statement output as text + // Return can be string or array of strings: for array each entry is automatically displayed on a separate line textStatement = QUOTE([_this select 0] call tag_fnc_myTextStatement); }; class button { @@ -441,6 +445,7 @@ The focused unit object is passed to the condition and statement functions. 3 | Actions | Array of arrays | Required 4 | Condition | Code | Optional (default: `{true}`) 5 | Scope editor | Number | Optional (default: `2`) +6 | Update on cargo change | Boolean | Optional (default: `false`) Return Value: - Array of action IDs diff --git a/docs/wiki/framework/laser-framework.md b/docs/wiki/framework/laser-framework.md new file mode 100644 index 0000000000..1a7bbf7d6b --- /dev/null +++ b/docs/wiki/framework/laser-framework.md @@ -0,0 +1,34 @@ +--- +layout: wiki +title: Laser +description: Explains the functions available for laser designators. +group: framework +order: 5 +parent: wiki +mod: ace +version: + major: 3 + minor: 16 + patch: 4 +--- + +## 1. Scripting + +### 1.1. Get object's laser code + +`ace_laser_fnc_getLaserCode` + +| | Arguments | Type | Optional (default value) +---| --------- | ---- | ------------------------ +0 | Unit/Vehicle | Object | Required +**R** | Laser code | Number | Return value + +### 1.2. Set object's laser code + +`ace_laser_fnc_setLaserCode` + +| | Arguments | Type | Optional (default value) +---| --------- | ---- | ------------------------ +0 | Unit/Vehicle | Object | Required +1 | Laser code | Number | Required +**R** | None | None | Return value diff --git a/docs/wiki/framework/medical-treatment-framework.md b/docs/wiki/framework/medical-treatment-framework.md index e42cb21e3b..c84d4382ea 100644 --- a/docs/wiki/framework/medical-treatment-framework.md +++ b/docs/wiki/framework/medical-treatment-framework.md @@ -57,9 +57,60 @@ class ACE_Medical_Treatment_Actions { }; ``` -## 2. Mission Variables +## 2. Medical Vehicles and Facilities -### 2.1 Grave Digging Object Configuration +### 2.1 Medical Vehicles + +To configure a vehicle as a Medical Vehicle by default, set the `attendant` property in the vehicle's config to `1`. +```cpp +class CfgVehicles { + class MyAmbulance { + attendant = 1; + }; +}; +``` +To set a vehicle as a Medical Vehicle mid-mission, set the `ace_medical_isMedicalVehicle` variable globally. +```sqf +// Sets the object behind your cursor to be a medical vehicle +cursorObject setVariable ["ace_medical_isMedicalVehicle", true, true]; + +// Create an interaction to turn a vehicle into a medical vehicle +private _statement = {_target setVariable ["ace_medical_isMedicalVehicle", true, true]}; +private _action = ["TAG_makeMedicalVehicle", "Set as Medical Vehicle", _statement, {!([_target] call ace_medical_treatment_fnc_isMedicalVehicle)}] call ace_interact_menu_fnc_createAction; +[cursorObject, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_createAction; + +// Set all vehicles of type "B_Truck_01_transport_F" as medical vehicles +private _classname = "B_Truck_01_transport_F"; +private _affectChildClasses = false; // Affect variants of this vehicle +["B_Truck_01_transport_F", "InitPost", { + params ["_vehicle"]; + if (!local _vehicle) exitWith {}; + _vehicle setVariable ["ace_medical_isMedicalVehicle", true, true]; +}, _affectChildClasses, [], true] call CBA_fnc_addClassEventHandler; +``` + +### 2.2 Medical Facilities + +To configure an object as a Medical Facility by default, add a new array containing its classname to the `ace_medical_facilities` class in config root. +```cpp +class CfgVehicles { + class ThingX; + class MyMedicalFacility: ThingX {}; + class MyMedicalFacility2_ElectricBoogaloo: MyMedicalFacility {}; +}; + +class ace_medical_facilities { + TAG_allOfMyFacilities[] = {"MyMedicalFacility", "MyMedicalFacility2_ElectricBoogaloo"}; +}; +``` +To set an object as a Medical Facility mid-mission, set the `ace_medical_isMedicalFacility` variable globally. See above. + + +Both Medical Facilities and Medical Vehicles can also be created via the Eden Editor's attributes menu. + +## 3. Mission Variables + +### 3.1 Grave Digging Object Configuration The object created when digging a grave can be modified by setting the `ace_medical_treatment_graveClassname` variable. ```sqf @@ -71,7 +122,7 @@ The object's rotation can also be modified, if necessary. ace_medical_treatment_graveRotation = 0; // rotation angle (will depend on model classname) ``` -### 2.2 Zeus Medical Menu Module +### 3.2 Zeus Medical Menu Module If a mission maker wishes to disable Zeus access to the medical menu, they can set the variable below: ace_medical_gui_enableZeusModule = false; // default is true diff --git a/extras/assets/CookoffSounds/ConvertWAVtoWSS.bat b/extras/assets/CookoffSounds/ConvertWAVtoWSS.bat new file mode 100644 index 0000000000..2db7169f14 --- /dev/null +++ b/extras/assets/CookoffSounds/ConvertWAVtoWSS.bat @@ -0,0 +1 @@ +forfiles /s /m *.wav /c "DeWSSDos -wss/0 -P -V -Y @path @FNAME.wss" diff --git a/extras/assets/CookoffSounds/shotbullet/close_1.wav b/extras/assets/CookoffSounds/shotbullet/close_1.wav new file mode 100644 index 0000000000..27e0c44dd3 Binary files /dev/null and b/extras/assets/CookoffSounds/shotbullet/close_1.wav differ diff --git a/extras/assets/CookoffSounds/shotbullet/close_2.wav b/extras/assets/CookoffSounds/shotbullet/close_2.wav new file mode 100644 index 0000000000..c51039cb73 Binary files /dev/null and b/extras/assets/CookoffSounds/shotbullet/close_2.wav differ diff --git a/extras/assets/CookoffSounds/shotbullet/close_3.wav b/extras/assets/CookoffSounds/shotbullet/close_3.wav new file mode 100644 index 0000000000..46955fa696 Binary files /dev/null and b/extras/assets/CookoffSounds/shotbullet/close_3.wav differ diff --git a/extras/assets/CookoffSounds/shotbullet/far_1.wav b/extras/assets/CookoffSounds/shotbullet/far_1.wav new file mode 100644 index 0000000000..bfccf1461b Binary files /dev/null and b/extras/assets/CookoffSounds/shotbullet/far_1.wav differ diff --git a/extras/assets/CookoffSounds/shotbullet/far_2.wav b/extras/assets/CookoffSounds/shotbullet/far_2.wav new file mode 100644 index 0000000000..39b3e09dee Binary files /dev/null and b/extras/assets/CookoffSounds/shotbullet/far_2.wav differ diff --git a/extras/assets/CookoffSounds/shotbullet/far_3.wav b/extras/assets/CookoffSounds/shotbullet/far_3.wav new file mode 100644 index 0000000000..5714da8440 Binary files /dev/null and b/extras/assets/CookoffSounds/shotbullet/far_3.wav differ diff --git a/extras/assets/CookoffSounds/shotbullet/mid_1.wav b/extras/assets/CookoffSounds/shotbullet/mid_1.wav new file mode 100644 index 0000000000..f757ca68f7 Binary files /dev/null and b/extras/assets/CookoffSounds/shotbullet/mid_1.wav differ diff --git a/extras/assets/CookoffSounds/shotbullet/mid_2.wav b/extras/assets/CookoffSounds/shotbullet/mid_2.wav new file mode 100644 index 0000000000..419e62e847 Binary files /dev/null and b/extras/assets/CookoffSounds/shotbullet/mid_2.wav differ diff --git a/extras/assets/CookoffSounds/shotbullet/mid_3.wav b/extras/assets/CookoffSounds/shotbullet/mid_3.wav new file mode 100644 index 0000000000..c2366ceb17 Binary files /dev/null and b/extras/assets/CookoffSounds/shotbullet/mid_3.wav differ diff --git a/extras/assets/CookoffSounds/shotrocket/close_1.wav b/extras/assets/CookoffSounds/shotrocket/close_1.wav new file mode 100644 index 0000000000..e76da3c464 Binary files /dev/null and b/extras/assets/CookoffSounds/shotrocket/close_1.wav differ diff --git a/extras/assets/CookoffSounds/shotrocket/close_2.wav b/extras/assets/CookoffSounds/shotrocket/close_2.wav new file mode 100644 index 0000000000..82f5c2c657 Binary files /dev/null and b/extras/assets/CookoffSounds/shotrocket/close_2.wav differ diff --git a/extras/assets/CookoffSounds/shotrocket/close_3.wav b/extras/assets/CookoffSounds/shotrocket/close_3.wav new file mode 100644 index 0000000000..29b447e502 Binary files /dev/null and b/extras/assets/CookoffSounds/shotrocket/close_3.wav differ diff --git a/extras/assets/CookoffSounds/shotrocket/far_1.wav b/extras/assets/CookoffSounds/shotrocket/far_1.wav new file mode 100644 index 0000000000..ec019a7d5e Binary files /dev/null and b/extras/assets/CookoffSounds/shotrocket/far_1.wav differ diff --git a/extras/assets/CookoffSounds/shotrocket/far_2.wav b/extras/assets/CookoffSounds/shotrocket/far_2.wav new file mode 100644 index 0000000000..640860b81f Binary files /dev/null and b/extras/assets/CookoffSounds/shotrocket/far_2.wav differ diff --git a/extras/assets/CookoffSounds/shotrocket/far_3.wav b/extras/assets/CookoffSounds/shotrocket/far_3.wav new file mode 100644 index 0000000000..7481f3dfe9 Binary files /dev/null and b/extras/assets/CookoffSounds/shotrocket/far_3.wav differ diff --git a/extras/assets/CookoffSounds/shotrocket/mid_1.wav b/extras/assets/CookoffSounds/shotrocket/mid_1.wav new file mode 100644 index 0000000000..b4e2c75259 Binary files /dev/null and b/extras/assets/CookoffSounds/shotrocket/mid_1.wav differ diff --git a/extras/assets/CookoffSounds/shotrocket/mid_2.wav b/extras/assets/CookoffSounds/shotrocket/mid_2.wav new file mode 100644 index 0000000000..a21b529f07 Binary files /dev/null and b/extras/assets/CookoffSounds/shotrocket/mid_2.wav differ diff --git a/extras/assets/CookoffSounds/shotrocket/mid_3.wav b/extras/assets/CookoffSounds/shotrocket/mid_3.wav new file mode 100644 index 0000000000..3fdffdbe0f Binary files /dev/null and b/extras/assets/CookoffSounds/shotrocket/mid_3.wav differ diff --git a/extras/assets/CookoffSounds/shotshell/close_1.wav b/extras/assets/CookoffSounds/shotshell/close_1.wav new file mode 100644 index 0000000000..105d092a91 Binary files /dev/null and b/extras/assets/CookoffSounds/shotshell/close_1.wav differ diff --git a/extras/assets/CookoffSounds/shotshell/close_2.wav b/extras/assets/CookoffSounds/shotshell/close_2.wav new file mode 100644 index 0000000000..899cde6505 Binary files /dev/null and b/extras/assets/CookoffSounds/shotshell/close_2.wav differ diff --git a/extras/assets/CookoffSounds/shotshell/close_3.wav b/extras/assets/CookoffSounds/shotshell/close_3.wav new file mode 100644 index 0000000000..dbfeb32694 Binary files /dev/null and b/extras/assets/CookoffSounds/shotshell/close_3.wav differ diff --git a/extras/assets/CookoffSounds/shotshell/far_1.wav b/extras/assets/CookoffSounds/shotshell/far_1.wav new file mode 100644 index 0000000000..5490655406 Binary files /dev/null and b/extras/assets/CookoffSounds/shotshell/far_1.wav differ diff --git a/extras/assets/CookoffSounds/shotshell/far_2.wav b/extras/assets/CookoffSounds/shotshell/far_2.wav new file mode 100644 index 0000000000..f5cd390b60 Binary files /dev/null and b/extras/assets/CookoffSounds/shotshell/far_2.wav differ diff --git a/extras/assets/CookoffSounds/shotshell/far_3.wav b/extras/assets/CookoffSounds/shotshell/far_3.wav new file mode 100644 index 0000000000..99fc796e7d Binary files /dev/null and b/extras/assets/CookoffSounds/shotshell/far_3.wav differ diff --git a/extras/assets/CookoffSounds/shotshell/mid_1.wav b/extras/assets/CookoffSounds/shotshell/mid_1.wav new file mode 100644 index 0000000000..a911545a7f Binary files /dev/null and b/extras/assets/CookoffSounds/shotshell/mid_1.wav differ diff --git a/extras/assets/CookoffSounds/shotshell/mid_2.wav b/extras/assets/CookoffSounds/shotshell/mid_2.wav new file mode 100644 index 0000000000..e8dc3e06de Binary files /dev/null and b/extras/assets/CookoffSounds/shotshell/mid_2.wav differ diff --git a/extras/assets/CookoffSounds/shotshell/mid_3.wav b/extras/assets/CookoffSounds/shotshell/mid_3.wav new file mode 100644 index 0000000000..ea6ddd94e6 Binary files /dev/null and b/extras/assets/CookoffSounds/shotshell/mid_3.wav differ diff --git a/extras/ruthberg_missions/360_Degree_Training_Course-Framework.zip b/extras/ruthberg_missions/360_Degree_Training_Course-Framework.zip new file mode 100644 index 0000000000..5886421544 Binary files /dev/null and b/extras/ruthberg_missions/360_Degree_Training_Course-Framework.zip differ diff --git a/extras/ruthberg_missions/360_Degree_Training_Course-Missions.zip b/extras/ruthberg_missions/360_Degree_Training_Course-Missions.zip new file mode 100644 index 0000000000..1d745d815b Binary files /dev/null and b/extras/ruthberg_missions/360_Degree_Training_Course-Missions.zip differ diff --git a/include/a3/ui_f_curator/ui/displays/RscDisplayAttributes.sqf b/include/a3/ui_f_curator/ui/displays/RscDisplayAttributes.sqf index be5a9adb3e..09aba83b06 100644 --- a/include/a3/ui_f_curator/ui/displays/RscDisplayAttributes.sqf +++ b/include/a3/ui_f_curator/ui/displays/RscDisplayAttributes.sqf @@ -54,7 +54,7 @@ switch _mode do { _control = _display displayctrl _idc; //--- Admin specific attribute - _show = if (getnumber (_cfgControl >> "adminOnly") > 0) then {_enableAdmin} else {true}; + _show = [true, _enableAdmin] select (getnumber (_cfgControl >> "adminOnly") > 0); if ((_allAttributes || {_x == configname _cfgControl} count _attributes > 0) && _show) then { _controlPos = ctrlposition _control; @@ -75,10 +75,10 @@ switch _mode do { _target = missionnamespace getvariable ["BIS_fnc_initCuratorAttributes_target",objnull]; _name = switch (typename _target) do { - case (typename objnull): {gettext (configfile >> "cfgvehicles" >> typeof _target >> "displayname")}; - case (typename grpnull): {groupid _target}; - case (typename []): {format ["%1: %3 #%2",groupid (_target select 0),_target select 1,localize "str_a3_cfgmarkers_waypoint_0"]}; - case (typename ""): {markertext _target}; + case ("OBJECT"): {gettext (configfile >> "cfgvehicles" >> typeof _target >> "displayname")}; + case ("GROUP"): {groupid _target}; + case ("ARRAY"): {format ["%1: %3 #%2",groupid (_target select 0),_target select 1,localize "str_a3_cfgmarkers_waypoint_0"]}; + case ("STRING"): {markertext _target}; }; _ctrlTitle ctrlsettext format [ctrltext _ctrlTitle,toupper _name]; @@ -115,19 +115,19 @@ switch _mode do { _display = _this select 0; _target = missionnamespace getvariable ["BIS_fnc_initCuratorAttributes_target",objnull]; switch (typename _target) do { - case (typename objnull): { + case ("OBJECT"): { _isAlive = alive _target; waituntil {isnull _display || (_isAlive && !alive _target)}; }; - case (typename grpnull): { + case ("GROUP"): { waituntil {isnull _display || isnull _target}; }; - case (typename []): { + case ("ARRAY"): { _grp = _target select 0; _wpCount = count waypoints _grp; waituntil {isnull _display || (count waypoints _grp != _wpCount)}; }; - case (typename ""): { + case ("STRING"): { waituntil {isnull _display || markertype _target == ""}; }; };