From fda3b98ffc029f4e1b66b813ad3870ae2ba34b0d Mon Sep 17 00:00:00 2001 From: Madin Date: Sat, 11 May 2024 01:54:38 +0200 Subject: [PATCH] added macros --- addons/main/functions/fn_HCfind.sqf | 2 ++ addons/main/functions/fn_checkActivateConditions.sqf | 12 ++++++------ .../functions/fn_expectedNewUnitsCountReturn.sqf | 4 ++-- addons/main/functions/fn_getVehicleInfo.sqf | 2 +- addons/main/functions/fn_moveInVehicleRole.sqf | 6 +++--- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/addons/main/functions/fn_HCfind.sqf b/addons/main/functions/fn_HCfind.sqf index 9a04d45..8b2c5fe 100644 --- a/addons/main/functions/fn_HCfind.sqf +++ b/addons/main/functions/fn_HCfind.sqf @@ -17,10 +17,12 @@ if (!isMultiplayer) exitWith {0}; if (!isServer) exitWith {clientOwner}; private _owner = 2; private _allHCs = entities "HeadlessClient_F"; + { _owner = owner _x; if !(_owner isEqualTo 2) exitWith {}; }forEach _allHCs; + if (_owner isEqualTo 0) then { _owner = 2; }; diff --git a/addons/main/functions/fn_checkActivateConditions.sqf b/addons/main/functions/fn_checkActivateConditions.sqf index 7544b05..4d93a2d 100644 --- a/addons/main/functions/fn_checkActivateConditions.sqf +++ b/addons/main/functions/fn_checkActivateConditions.sqf @@ -20,11 +20,11 @@ if (_logic isEqualTo objNull) exitWith { diag_log text "[MAI_fnc_checkActivateConditions] logic is objNull, exit script" }; -private _forceActivate = _logic getVariable ["forceActivate", false]; -private _activationTriggers = _logic getVariable ["activationTriggers",[]]; -private _activateCondition = _logic getVariable ["activateCondition", {true}]; -private _activation = _logic getVariable ["activation", 1000]; -private _includeAir = _logic getVariable ["includeAir", false]; +private _forceActivate = _logic getVariable [QGWAR(forceActivate), false]; +private _activationTriggers = _logic getVariable [QGWAR(activationTriggers),[]]; +private _activateCondition = _logic getVariable [QGWAR(activateCondition), {true}]; +private _activation = _logic getVariable [QGWAR(activation), 1000]; +private _includeAir = _logic getVariable [QGWAR(includeAir), false]; private _activated = false; if (_forceActivate) then { @@ -57,7 +57,7 @@ if (_forceActivate) then { }; if (_activated) then { - private _deleteTrigger = _logic getVariable ["deleteTrigger", false]; + private _deleteTrigger = _logic getVariable [QGWAR(deleteTrigger), false]; if (_deleteTrigger) then { [ { diff --git a/addons/main/functions/fn_expectedNewUnitsCountReturn.sqf b/addons/main/functions/fn_expectedNewUnitsCountReturn.sqf index 6960010..045c3e3 100644 --- a/addons/main/functions/fn_expectedNewUnitsCountReturn.sqf +++ b/addons/main/functions/fn_expectedNewUnitsCountReturn.sqf @@ -11,5 +11,5 @@ */ params [["_unitsCountChange", 0]]; -private _expectedNewUnitsCount = missionNameSpace getVariable ["MAI_expectedNewUnitsCount", 0]; -MAI_expectedNewUnitsCount = _expectedNewUnitsCount + _unitsCountChange; \ No newline at end of file +private _expectedNewUnitsCount = missionNameSpace getVariable [QGWAR(expectedNewUnitsCount), 0]; +GWAR(expectedNewUnitsCount) = _expectedNewUnitsCount + _unitsCountChange; \ No newline at end of file diff --git a/addons/main/functions/fn_getVehicleInfo.sqf b/addons/main/functions/fn_getVehicleInfo.sqf index 0322089..ee8803a 100644 --- a/addons/main/functions/fn_getVehicleInfo.sqf +++ b/addons/main/functions/fn_getVehicleInfo.sqf @@ -23,7 +23,7 @@ _vehicleHitPoints deleteAt 1; // vehicle skin private _vehCustom = ([_vehicle] call BIS_fnc_getVehicleCustomization) select 0; // ammunition -private _vehAmmo = magazinesAllTurrets vehicle player; +private _vehAmmo = magazinesAllTurrets _vehicle; { _x resize 3; } forEach _vehAmmo; diff --git a/addons/main/functions/fn_moveInVehicleRole.sqf b/addons/main/functions/fn_moveInVehicleRole.sqf index 8bd31ea..f76bc3a 100644 --- a/addons/main/functions/fn_moveInVehicleRole.sqf +++ b/addons/main/functions/fn_moveInVehicleRole.sqf @@ -22,9 +22,9 @@ params [ if (!alive _unit || !alive _vehicle) exitWith {}; if !(isNull objectParent _unit) exitWith {}; // unit in vehicle; -private _timesTried = _unit getVariable ["timesTried", 0]; +private _timesTried = _unit getVariable [QGWAR(timesTried), 0]; if (_timesTried >= 5) exitWith {}; -_unit setVariable ["timesTried", _timesTried + 1]; +_unit setVariable [QGWAR(timesTried), _timesTried + 1]; private _role = toLower (_assignedRole select 0); if (_role isEqualTo "driver") exitWith { @@ -52,7 +52,7 @@ if (_timesTried > 0) then { }; [ { - _this call MAI_fnc_moveInVehicleRole; + _this call FUNC(moveInVehicleRole); }, _this, 1