diff --git a/addons/artillerytables/functions/fnc_turretChanged.sqf b/addons/artillerytables/functions/fnc_turretChanged.sqf index 1975f65c73a..2467764499b 100644 --- a/addons/artillerytables/functions/fnc_turretChanged.sqf +++ b/addons/artillerytables/functions/fnc_turretChanged.sqf @@ -19,7 +19,7 @@ params ["_player", "_turret"]; private _vehicle = vehicle _player; private _typeOf = typeOf _vehicle; -private _vehicleCfg = configFile >> "CfgVehicles" >> _typeOf; +private _vehicleCfg = configOf _vehicle; // config "ace_artillerytables_showGunLaying" [0 disabled, 1 enabled, 2 enabled w/ alt elevationMode] falls back to artilleryScanner private _showGunLaying = if (isNumber (_vehicleCfg >> QGVAR(showGunLaying))) then { diff --git a/addons/backpacks/functions/fnc_isBackpack.sqf b/addons/backpacks/functions/fnc_isBackpack.sqf index a101a514e9e..e57b9c4ed1e 100644 --- a/addons/backpacks/functions/fnc_isBackpack.sqf +++ b/addons/backpacks/functions/fnc_isBackpack.sqf @@ -17,10 +17,10 @@ params [["_backpack", objNull, [objNull, ""]]]; -if (_backpack isEqualType objNull) then { - _backpack = typeOf _backpack; +private _config = if (_backpack isEqualType objNull) then { + configOf _backpack +} else { + configFile >> "CfgVehicles" >> _backpack }; -private _config = configFile >> "CfgVehicles" >> _backpack; - getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} // return diff --git a/addons/captives/CfgVehicles.hpp b/addons/captives/CfgVehicles.hpp index d000ad60834..8fe05963387 100644 --- a/addons/captives/CfgVehicles.hpp +++ b/addons/captives/CfgVehicles.hpp @@ -5,7 +5,7 @@ class CfgVehicles { class ACE_ApplyHandcuffs { displayName = CSTRING(SetCaptive); selection = "righthand"; - distance = 2; + distance = HANDCUFFS_DISTANCE; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs)); exceptions[] = {"isNotSwimming", "isNotInside"}; @@ -16,7 +16,7 @@ class CfgVehicles { class ACE_RemoveHandcuffs { displayName = CSTRING(ReleaseCaptive); selection = "righthand"; - distance = 2; + distance = HANDCUFFS_DISTANCE; condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); exceptions[] = {"isNotSwimming", "isNotInside"}; diff --git a/addons/captives/XEH_postInit.sqf b/addons/captives/XEH_postInit.sqf index fc0880b7943..8d34c4fb403 100644 --- a/addons/captives/XEH_postInit.sqf +++ b/addons/captives/XEH_postInit.sqf @@ -41,7 +41,7 @@ if (!hasInterface) exitWith {}; private _target = cursorObject; if !([ACE_player, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; if !(_target isKindOf "CAManBase") exitWith {false}; - if ((_target distance ACE_player) > getNumber (configFile >> "CfgVehicles" >> "CAManBase" >> "ACE_Actions" >> "ACE_ApplyHandcuffs" >> "distance")) exitWith {false}; + if ((_target distance ACE_player) > getNumber (configOf ACE_player >> "ACE_Actions" >> "ACE_ApplyHandcuffs" >> "distance")) exitWith {false}; if ([ACE_player, _target] call FUNC(canApplyHandcuffs)) exitWith { [ACE_player, _target] call FUNC(doApplyHandcuffs); diff --git a/addons/captives/script_component.hpp b/addons/captives/script_component.hpp index c0cbefe5b28..76094f990d7 100644 --- a/addons/captives/script_component.hpp +++ b/addons/captives/script_component.hpp @@ -15,3 +15,5 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" + +#define HANDCUFFS_DISTANCE 2 diff --git a/addons/cargo/functions/fnc_initObject.sqf b/addons/cargo/functions/fnc_initObject.sqf index 0df277c5203..c2158443be4 100644 --- a/addons/cargo/functions/fnc_initObject.sqf +++ b/addons/cargo/functions/fnc_initObject.sqf @@ -17,6 +17,7 @@ params ["_object"]; private _type = typeOf _object; +private _config = configOf _object; TRACE_2("params",_object,_type); // If object had size given to it via eden/public then override config canLoad setting @@ -24,7 +25,7 @@ private _canLoadPublic = _object getVariable [QGVAR(canLoad), false]; if (!(_canLoadPublic isEqualType false)) then { WARNING_4("%1[%2] - Variable %3 is %4 - Should be bool",_object,_type,QGVAR(canLoad),_canLoadPublic); }; -private _canLoadConfig = getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(canLoad)) == 1; +private _canLoadConfig = getNumber (_config >> QGVAR(canLoad)) == 1; // Nothing to do here if object can't be loaded if !(_canLoadConfig || {_canLoadPublic in [true, 1]}) exitWith {}; diff --git a/addons/cargo/functions/fnc_initVehicle.sqf b/addons/cargo/functions/fnc_initVehicle.sqf index dac28a5ac96..885131c5342 100644 --- a/addons/cargo/functions/fnc_initVehicle.sqf +++ b/addons/cargo/functions/fnc_initVehicle.sqf @@ -19,10 +19,11 @@ 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 _hasCargoConfig = getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) == 1; +private _hasCargoConfig = getNumber (_config >> QGVAR(hasCargo)) == 1; // Nothing to do here if vehicle has no cargo space if !(_hasCargoConfig || _hasCargoPublic) exitWith {}; @@ -40,13 +41,11 @@ if (_addCargoType) then { // Vehicle can have default ace cargo in its config if (isServer) then { { - if (isClass _x) then { - private _cargoClassname = getText (_x >> "type"); - private _cargoCount = getNumber (_x >> "amount"); - TRACE_3("adding ACE_Cargo", (configName _x), _cargoClassname, _cargoCount); - ["ace_addCargo", [_cargoClassname, _vehicle, _cargoCount]] call CBA_fnc_localEvent; - }; - } count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo")); + private _cargoClassname = getText (_x >> "type"); + private _cargoCount = getNumber (_x >> "amount"); + TRACE_3("adding ACE_Cargo", (configName _x), _cargoClassname, _cargoCount); + ["ace_addCargo", [_cargoClassname, _vehicle, _cargoCount]] call CBA_fnc_localEvent; + } forEach ("true" configClasses (_config >> QUOTE(ADDON) >> "Cargo")); }; // Servers and HCs do not require action menus (beyond this point) diff --git a/addons/common/functions/fnc_findUnloadPosition.sqf b/addons/common/functions/fnc_findUnloadPosition.sqf index 50727b438fb..c0605c477dd 100644 --- a/addons/common/functions/fnc_findUnloadPosition.sqf +++ b/addons/common/functions/fnc_findUnloadPosition.sqf @@ -43,9 +43,13 @@ if (_cargo isKindOf "CAManBase") then { _radiusOfItem = 1.1; } else { //`sizeOf` is unreliable, and does not work with object types that don't exist on map, so estimate size based on cargo size - private _typeOfCargo = if (_cargo isEqualType "") then {_cargo} else {typeOf _cargo}; - private _itemSize = if (isNumber (configFile >> "CfgVehicles" >> _typeOfCargo >> QEGVAR(cargo,size)) && {getNumber (configFile >> "CfgVehicles" >> _typeOfCargo >> QEGVAR(cargo,size)) != -1}) then { - getNumber (configFile >> "CfgVehicles" >> _typeOfCargo >> QEGVAR(cargo,size)); + private _configOfCargo = if (_cargo isEqualType objNull) then { + configOf _cargo + } else { + configFile >> "CfgVehicles" >> _cargo + }; + private _itemSize = if (isNumber (_configOfCargo >> QEGVAR(cargo,size)) && {getNumber (_configOfCargo >> QEGVAR(cargo,size)) != -1}) then { + getNumber (_configOfCargo >> QEGVAR(cargo,size)); } else { if (["ace_cargo"] call FUNC(isModLoaded)) then { [_cargo] call EFUNC(cargo,getSizeItem); diff --git a/addons/common/functions/fnc_getVehicleCargo.sqf b/addons/common/functions/fnc_getVehicleCargo.sqf index 82442700a24..37bd04c27b4 100644 --- a/addons/common/functions/fnc_getVehicleCargo.sqf +++ b/addons/common/functions/fnc_getVehicleCargo.sqf @@ -17,7 +17,7 @@ params [["_vehicle", objNull, [objNull]]]; -private _config = configFile >> "CfgVehicles" >> _vehicle; +private _config = configOf _vehicle; private _cargo = []; private _codrivers = getArray (_config >> "cargoIsCoDriver"); diff --git a/addons/common/functions/fnc_getVehicleCodriver.sqf b/addons/common/functions/fnc_getVehicleCodriver.sqf index 8deef3f9cd2..1e97cc2e026 100644 --- a/addons/common/functions/fnc_getVehicleCodriver.sqf +++ b/addons/common/functions/fnc_getVehicleCodriver.sqf @@ -17,7 +17,7 @@ params [["_vehicle", objNull, [objNull]]]; -private _config = configFile >> "CfgVehicles" >> _vehicle; +private _config = configOf _vehicle; private _cargo = []; private _codrivers = getArray (_config >> "cargoIsCoDriver"); diff --git a/addons/common/functions/fnc_getVehicleIcon.sqf b/addons/common/functions/fnc_getVehicleIcon.sqf index 3c3e4aa7277..7a4daba9c69 100644 --- a/addons/common/functions/fnc_getVehicleIcon.sqf +++ b/addons/common/functions/fnc_getVehicleIcon.sqf @@ -18,7 +18,7 @@ params [["_object", objNull, [objNull, ""]]]; -if ((_object isEqualType objNull && {isNull _object}) || {_object isEqualType "" && {_object == ""}}) exitWith { DEFAULT_TEXTURE }; +if (_object isEqualTo objNull || {_object isEqualTo ""}) exitWith { DEFAULT_TEXTURE }; private _objectType = if (_object isEqualType objNull) then { typeOf _object diff --git a/addons/csw/functions/fnc_proxyWeapon.sqf b/addons/csw/functions/fnc_proxyWeapon.sqf index 55e83cb5ec9..e4449bbbce4 100644 --- a/addons/csw/functions/fnc_proxyWeapon.sqf +++ b/addons/csw/functions/fnc_proxyWeapon.sqf @@ -25,7 +25,7 @@ if (_staticWeapon getVariable [format [QGVAR(proxyHandled_%1), _turret], false]) private _proxyWeapon = getText (configOf _staticWeapon >> "ace_csw" >> "proxyWeapon"); -TRACE_2("",_typeOf,_proxyWeapon); +TRACE_2("",typeOf _staticWeapon,_proxyWeapon); if (_proxyWeapon == "") exitWith {}; private _currentWeapon = (_staticWeapon weaponsTurret [0]) param [0, "#none"]; diff --git a/addons/explosives/functions/fnc_setupExplosive.sqf b/addons/explosives/functions/fnc_setupExplosive.sqf index 2961c8d1012..2e0c6ca4261 100644 --- a/addons/explosives/functions/fnc_setupExplosive.sqf +++ b/addons/explosives/functions/fnc_setupExplosive.sqf @@ -24,7 +24,7 @@ params ["_vehicle", "_unit", "_magClassname"]; TRACE_3("params",_vehicle,_unit,_magClassname); //Get setup object vehicle and model: -private _setupObjectClass = getText(ConfigFile >> "CfgMagazines" >> _magClassname >> QGVAR(SetupObject)); +private _setupObjectClass = getText (configFile >> "CfgMagazines" >> _magClassname >> QGVAR(SetupObject)); if (!isClass (configFile >> "CfgVehicles" >> _setupObjectClass)) exitWith {ERROR("Bad Vehicle");}; private _p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model"); if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game! diff --git a/addons/field_rations/functions/fnc_drinkFromSource.sqf b/addons/field_rations/functions/fnc_drinkFromSource.sqf index e4a2c3ff678..1fee598ac64 100644 --- a/addons/field_rations/functions/fnc_drinkFromSource.sqf +++ b/addons/field_rations/functions/fnc_drinkFromSource.sqf @@ -63,11 +63,11 @@ private _fnc_condition = { [_player, _source] call FUNC(canDrinkFromSource) }; -private _sourceType = typeOf _source; -private _progressText = if (_sourceType == "") then { +private _sourceConfig = configOf _source; +private _progressText = if (isNull _sourceConfig) then { LLSTRING(DrinkingFromSource) } else { - format [LLSTRING(DrinkingFromX), getText (configFile >> "CfgVehicles" >> _sourceType >> "displayName")] + format [LLSTRING(DrinkingFromX), getText (_sourceConfig >> "displayName")] }; [ diff --git a/addons/field_rations/functions/fnc_getActionOffset.sqf b/addons/field_rations/functions/fnc_getActionOffset.sqf index f8cc3926601..e0f11354c3a 100644 --- a/addons/field_rations/functions/fnc_getActionOffset.sqf +++ b/addons/field_rations/functions/fnc_getActionOffset.sqf @@ -17,10 +17,10 @@ params ["_object"]; -private _typeOf = typeOf _object; -if (_typeOf != "") then { +private _configOf = configOf _object; +if !(isNull _configOf) then { // Check for offset in config since we have valid typeOf - private _offset = getArray (configFile >> "CfgVehicles" >> _typeOf >> QXGVAR(offset)); + private _offset = getArray (_configOf >> QXGVAR(offset)); if (_offset isEqualTo []) then {[0, 0, 0]} else {_offset}; } else { // Check for offset corresponding to p3d list diff --git a/addons/field_rations/functions/fnc_getRemainingWater.sqf b/addons/field_rations/functions/fnc_getRemainingWater.sqf index e2b2d56ed5f..d5c8b3f85d3 100644 --- a/addons/field_rations/functions/fnc_getRemainingWater.sqf +++ b/addons/field_rations/functions/fnc_getRemainingWater.sqf @@ -22,10 +22,10 @@ if (!alive _source) exitWith {0}; private _water = _source getVariable QGVAR(currentWaterSupply); if (isNil "_water") then { - private _typeOf = typeOf _source; - if (_typeOf != "") then { + private _configOf = configOf _source; + if !(isNull _configOf) then { // Check for waterSupply entry since we have valid typeOf - _water = getNumber (configFile >> "CfgVehicles" >> _typeOf >> QXGVAR(waterSupply)); + _water = getNumber (_configOf >> QXGVAR(waterSupply)); if (_water == 0) then {_water = REFILL_WATER_DISABLED}; if (_water != REFILL_WATER_DISABLED) then { diff --git a/addons/gunbag/functions/fnc_hasGunbag.sqf b/addons/gunbag/functions/fnc_hasGunbag.sqf index 7f9c7135e08..587a8afae4c 100644 --- a/addons/gunbag/functions/fnc_hasGunbag.sqf +++ b/addons/gunbag/functions/fnc_hasGunbag.sqf @@ -17,4 +17,4 @@ params ["_unit"]; -getNumber (configFile >> "CfgVehicles" >> (backpack _unit) >> QUOTE(ADDON)) == 1 +getNumber ((configOf (backpackContainer _unit)) >> QUOTE(ADDON)) == 1 diff --git a/addons/intelitems/functions/fnc_attributeFocus.sqf b/addons/intelitems/functions/fnc_attributeFocus.sqf index 798a4d9b28f..e2745c487c9 100644 --- a/addons/intelitems/functions/fnc_attributeFocus.sqf +++ b/addons/intelitems/functions/fnc_attributeFocus.sqf @@ -24,7 +24,7 @@ private _object = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull); _control ctrlRemoveAllEventHandlers "SetFocus"; private _ctrlLabel = _display displayCtrl IDC_ATTRIBUTE_LABEL; -private _labelText = getText (configFile >> "CfgVehicles" >> typeOf _object >> "Attributes" >> QGVAR(data) >> "displayName"); +private _labelText = getText ((configOf _object) >> "Attributes" >> QGVAR(data) >> "displayName"); _ctrlLabel ctrlSetText _labelText; private _index = _object getVariable [QGVAR(index), -1]; diff --git a/addons/intelitems/functions/fnc_canPickup.sqf b/addons/intelitems/functions/fnc_canPickup.sqf index 5ca78e0045d..3711f1f3590 100644 --- a/addons/intelitems/functions/fnc_canPickup.sqf +++ b/addons/intelitems/functions/fnc_canPickup.sqf @@ -18,6 +18,6 @@ params ["_object", "_player"]; -private _magazineClass = getText (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(magazine)); +private _magazineClass = getText ((configOf _object) >> QGVAR(magazine)); _magazineClass != "" && {_player canAdd _magazineClass} diff --git a/addons/intelitems/functions/fnc_pickup.sqf b/addons/intelitems/functions/fnc_pickup.sqf index 4d61e3a2814..844c84f3f41 100644 --- a/addons/intelitems/functions/fnc_pickup.sqf +++ b/addons/intelitems/functions/fnc_pickup.sqf @@ -18,7 +18,7 @@ params ["_object", "_player"]; -private _magazineClass = getText (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(magazine)); +private _magazineClass = getText ((configOf _object) >> QGVAR(magazine)); private _index = _object getVariable [QGVAR(index), -1]; // Add magazine to inventory and get its id diff --git a/addons/interact_menu/functions/fnc_createVehiclesActions.sqf b/addons/interact_menu/functions/fnc_createVehiclesActions.sqf index 8218242aabc..814bf04f632 100644 --- a/addons/interact_menu/functions/fnc_createVehiclesActions.sqf +++ b/addons/interact_menu/functions/fnc_createVehiclesActions.sqf @@ -21,13 +21,12 @@ params ["_vehicles", "_statement", "_target"]; _vehicles apply { - private _type = typeOf _x; - private _name = getText (configFile >> "CfgVehicles" >> _type >> "displayName"); + private _name = getText ((configOf _x) >> "displayName"); private _ownerName = [_x, true] call EFUNC(common,getName); if ("" != _ownerName) then { _name = format ["%1 (%2)", _name, _ownerName]; }; - private _icon = [_type] call EFUNC(common,getVehicleIcon); + private _icon = [_x] call EFUNC(common,getVehicleIcon); private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction); [_action, [], _target] } diff --git a/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf b/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf index 27ab70ff5ef..0220a1cc39c 100644 --- a/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf +++ b/addons/interact_menu/functions/fnc_userActions_addHouseActions.sqf @@ -27,21 +27,21 @@ if ((vehicle ACE_player) != ACE_player) exitWith {}; [{ params ["_args", "_pfID"]; - _args params ["_setPosition", "_addedHelpers", "_housesScaned", "_housesToScanForActions"]; + _args params ["_setPosition", "_addedHelpers", "_housesScanned", "_housesToScanForActions"]; if (!EGVAR(interact_menu,keyDown)) then { {deleteVehicle _x;} forEach _addedHelpers; [_pfID] call CBA_fnc_removePerFrameHandler; } else { // Prevent Rare Error when ending mission with interact key down: - if (isNull ace_player) exitWith {}; + if (isNull ACE_player) exitWith {}; //Make the common case fast (cursorTarget is looking at a door): - if ((!isNull cursorTarget) && {cursorTarget isKindOf "Static"} && {!(cursorTarget in _housesScaned)}) then { + if ((!isNull cursorTarget) && {cursorTarget isKindOf "Static"} && {!(cursorTarget in _housesScanned)}) then { if (((count (configOf cursorTarget >> "UserActions")) > 0) || {(count (getArray (configOf cursorTarget >> "ladders"))) > 0}) then { _housesToScanForActions = [cursorTarget]; } else { - _housesScaned pushBack cursorTarget; + _housesScanned pushBack cursorTarget; }; }; @@ -51,47 +51,43 @@ if ((vehicle ACE_player) != ACE_player) exitWith {}; if (_housesToScanForActions isEqualTo []) then { //If player moved >2 meters from last pos, then rescan - if (((getPosASL ace_player) distance _setPosition) < 2) exitWith {}; + if (((getPosASL ACE_player) distance _setPosition) < 2) exitWith {}; - private _nearBuidlings = nearestObjects [ace_player, ["Static"], 30]; + private _nearBuidlings = nearestObjects [ACE_player, ["Static"], 30]; { - private _typeOfHouse = typeOf _x; - if (((count (configFile >> "CfgVehicles" >> _typeOfHouse >> "UserActions")) == 0) && {(count (getArray (configFile >> "CfgVehicles" >> _typeOfHouse >> "ladders"))) == 0}) then { - _housesScaned pushBack _x; + private _configOfHouse = configOf _x; + if (((count (_configOfHouse >> "UserActions")) == 0) && {(count (getArray (_configOfHouse >> "ladders"))) == 0}) then { + _housesScanned pushBack _x; } else { _housesToScanForActions pushBack _x; }; - nil - } count (_nearBuidlings - _housesScaned); + } forEach (_nearBuidlings - _housesScanned); - _args set [0, (getPosASL ace_player)]; + _args set [0, (getPosASL ACE_player)]; } else { - private _houseBeingScaned = _housesToScanForActions deleteAt 0; - private _typeOfHouse = typeOf _houseBeingScaned; + private _houseBeingScanned = _housesToScanForActions deleteAt 0; //Skip this house for now if we are outside of it's radius //(we have to scan far out for the big houses, but we don't want to waste time adding actions on every little shack) - if ((_houseBeingScaned != cursorTarget) && {((ACE_player distance _houseBeingScaned) - ((sizeOf _typeOfHouse) / 2)) > 4}) exitWith {}; + if ((_houseBeingScanned != cursorTarget) && {((ACE_player distance _houseBeingScanned) - ((boundingBoxReal _houseBeingScanned) select 2)) > 4}) exitWith {}; - _housesScaned pushBack _houseBeingScaned; + _housesScanned pushBack _houseBeingScanned; - private _actionSet = [_typeOfHouse] call FUNC(userActions_getHouseActions); + private _actionSet = [typeOf _houseBeingScanned] call FUNC(userActions_getHouseActions); _actionSet params ["_memPoints", "_memPointsActions"]; - // systemChat format ["Add Actions for [%1] (count %2) @ %3", _typeOfHouse, (count _memPoints), diag_tickTime]; + TRACE_3("Add Actions for [%1] (count %2) @ %3",typeOf _houseBeingScanned,(count _memPoints),diag_tickTime); { - private _helperPos = _houseBeingScaned modelToWorldWorld (_houseBeingScaned selectionPosition _x); + private _helperPos = _houseBeingScanned modelToWorldWorld (_houseBeingScanned selectionPosition _x); private _helperObject = "ACE_LogicDummy" createVehicleLocal [0,0,0]; _addedHelpers pushBack _helperObject; - _helperObject setVariable [QGVAR(building), _houseBeingScaned]; + _helperObject setVariable [QGVAR(building), _houseBeingScanned]; _helperObject setPosASL _helperPos; - TRACE_3("Making New Helper",_helperObject,_x,_houseBeingScaned); + TRACE_3("Making New Helper",_helperObject,_x,_houseBeingScanned); { [_helperObject, 0, [], _x] call EFUNC(interact_menu,addActionToObject); - nil - } count (_memPointsActions select _forEachIndex); - + } forEach (_memPointsActions select _forEachIndex); } forEach _memPoints; }; }; -}, 0, [((getPosASL ace_player) vectorAdd [-100,0,0]), [], [], []]] call CBA_fnc_addPerFrameHandler; +}, 0, [((getPosASL ACE_player) vectorAdd [-100,0,0]), [], [], []]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/killtracker/XEH_postInit.sqf b/addons/killtracker/XEH_postInit.sqf index 19d8066d640..2f75baa929f 100644 --- a/addons/killtracker/XEH_postInit.sqf +++ b/addons/killtracker/XEH_postInit.sqf @@ -65,7 +65,7 @@ GVAR(killCount) = 0; if (!isNull _killer) then { if (!(_killer isKindof "CAManBase")) then { // If killer is a vehicle log the vehicle type - _killInfo pushBack format [LLSTRING(Vehicle), getText (configfile >> "CfgVehicles" >> (typeOf _killer) >> "displayName")]; + _killInfo pushBack format [LLSTRING(Vehicle), getText ((configOf _killer) >> "displayName")]; }; if (isNull _instigator) then { _instigator = effectiveCommander _killer; @@ -82,7 +82,7 @@ GVAR(killCount) = 0; // Log firendly fire private _fnc_getSideFromConfig = { params ["_object"]; - switch (getNumber (configFile >> "CfgVehicles" >> (typeOf _object) >> "side")) do { + switch (getNumber ((configOf _object) >> "side")) do { case (0): {east}; case (1): {west}; case (2): {resistance}; @@ -117,7 +117,7 @@ GVAR(killCount) = 0; } else { _killerName = _killer getVariable [QGVAR(aiName), ""]; // allow setting a custom AI name (e.g. VIP Target) if (_killerName == "") then { - _killerName = format ["*AI* - %1", getText (configfile >> "CfgVehicles" >> (typeOf _killer) >> "displayName")]; + _killerName = format ["*AI* - %1", getText ((configOf _killer) >> "displayName")]; }; }; }; @@ -133,7 +133,7 @@ GVAR(killCount) = 0; } else { _unitName = _unit getVariable [QGVAR(aiName), ""]; // allow setting a custom AI name (e.g. VIP Target) if (_unitName == "") then { - _unitName = format ["*AI* - %1", getText (configfile >> "CfgVehicles" >> (typeOf _unit) >> "displayName")]; + _unitName = format ["*AI* - %1", getText ((configOf _unit) >> "displayName")]; }; }; TRACE_3("send kill event",_killer,_unitName,_killInfo); diff --git a/addons/logistics_wirecutter/functions/fnc_isFence.sqf b/addons/logistics_wirecutter/functions/fnc_isFence.sqf index 38610f30fba..a073c2deaf8 100644 --- a/addons/logistics_wirecutter/functions/fnc_isFence.sqf +++ b/addons/logistics_wirecutter/functions/fnc_isFence.sqf @@ -19,14 +19,11 @@ params ["_object"]; TRACE_1("Checking if fence",_object); -private _typeOf = typeOf _object; - -private _returnValue = if (_typeOf != "") then { - // Check for isFence entry since we have valid typeOf - 1 == getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(isFence)); +private _configOf = configOf _object; +if !(isNull _configOf) then { + // Check for isFence entry since we have valid configOf + getNumber (_configOf >> QGVAR(isFence)) == 1 // return } else { // Check the p3d name against list (in script_component.hpp) - (getModelInfo _object select 0) in FENCE_P3DS; + (getModelInfo _object select 0) in FENCE_P3DS // return }; - -_returnValue diff --git a/addons/logistics_wirecutter/script_component.hpp b/addons/logistics_wirecutter/script_component.hpp index 38ed1dd0773..7c65bfe26c2 100644 --- a/addons/logistics_wirecutter/script_component.hpp +++ b/addons/logistics_wirecutter/script_component.hpp @@ -83,6 +83,6 @@ #define HAS_WIRECUTTER(unit) (\ "ACE_wirecutter" in (unit call EFUNC(common,uniqueItems)) \ - || {1 == getNumber (configFile >> "CfgVehicles" >> (backpack unit) >> QGVAR(hasWirecutter))} \ - || {1 == getNumber (configFile >> "CfgWeapons" >> (vest unit) >> QGVAR(hasWirecutter))} \ + || {getNumber ((configOf (backpackContainer unit)) >> QGVAR(hasWirecutter)) == 1} \ + || {getNumber (configFile >> "CfgWeapons" >> (vest unit) >> QGVAR(hasWirecutter)) == 1} \ ) diff --git a/addons/modules/XEH_postInit.sqf b/addons/modules/XEH_postInit.sqf index c6892046fe5..bdc6a9cc406 100644 --- a/addons/modules/XEH_postInit.sqf +++ b/addons/modules/XEH_postInit.sqf @@ -12,7 +12,7 @@ _logic hideObject true; if (_logic getVariable [QGVAR(initalized), false]) exitWith {}; - private _config = (configFile >> "CfgVehicles" >> _logicType); + private _config = configOf _logic; if !(isClass _config) exitWith {}; private _isGlobal = getNumber (_config >> "isGlobal") > 0; diff --git a/addons/nametags/functions/fnc_doShow.sqf b/addons/nametags/functions/fnc_doShow.sqf index 12ac1a04cb4..32acffe0453 100644 --- a/addons/nametags/functions/fnc_doShow.sqf +++ b/addons/nametags/functions/fnc_doShow.sqf @@ -19,7 +19,7 @@ private _player = ACE_player; private _vehicle = vehicle _player; private _type = typeOf _vehicle; -private _config = configFile >> "CfgVehicles" >> _type; +private _config = configOf _vehicle; private _text = format[" %2
", getText(_config>>"picture"), getText (_config >> "DisplayName")]; private _data = [_type] call FUNC(getVehicleData); diff --git a/addons/parachute/functions/fnc_handleReserve.sqf b/addons/parachute/functions/fnc_handleReserve.sqf index 3df8d6607e1..370da43f3a8 100644 --- a/addons/parachute/functions/fnc_handleReserve.sqf +++ b/addons/parachute/functions/fnc_handleReserve.sqf @@ -16,10 +16,10 @@ */ params ["_unit"]; -private _backpack = backpack _unit; +private _backpack = backpackContainer _unit; if ( - _backpack == "" && + isNull _backpack && {(vehicle _unit) isKindOf "ParachuteBase"} && {GETVAR(_unit,GVAR(hasReserve),false)} ) then { @@ -28,7 +28,7 @@ if ( SETVAR(vehicle _unit,GVAR(canCut),true); // Mark the parachute cuttable since reserve is present } else { // Case where inventory has changed otherwise (including when reserve is added) - private _backpackCfg = configFile >> "CfgVehicles" >> _backpack; + private _backpackCfg = configOf _backpack; private _hasReserve = getNumber (_backpackCfg >> "ace_hasReserveParachute") == 1; // Cache reserve parachute state and class when backpack changes diff --git a/addons/pylons/XEH_postInit.sqf b/addons/pylons/XEH_postInit.sqf index ed45222d3cd..3167c0a838a 100644 --- a/addons/pylons/XEH_postInit.sqf +++ b/addons/pylons/XEH_postInit.sqf @@ -14,8 +14,7 @@ GVAR(loadoutAction) = [ // create action private _isRearmVehicle = if (["ace_rearm"] call EFUNC(common,isModLoaded)) then { _vehicles findIf {[_x] call EFUNC(rearm,isSource)} != -1; } else { - private _cfgVehicle = configFile >> "CfgVehicles"; - _vehicles findIf {getNumber (_cfgVehicle >> typeOf _x >> "transportAmmo") > 0} != -1; + _vehicles findIf {getNumber ((configOf _x) >> "transportAmmo") > 0} != -1; }; (_isRearmVehicle && {[ace_player, _target] call FUNC(canConfigurePylons)}) @@ -27,7 +26,7 @@ GVAR(loadoutAction) = [ // create action private _typeOf = typeOf _vehicle; if (_typeOf in GVAR(aircraftWithPylons)) exitWith {}; - if (!isClass (configFile >> "CfgVehicles" >> _typeOf >> 'Components' >> 'TransportPylonsComponent')) exitWith {}; + if (!isClass ((configOf _vehicle) >> 'Components' >> 'TransportPylonsComponent')) exitWith {}; GVAR(aircraftWithPylons) pushBack _typeOf; [_typeOf, 0, ["ACE_MainActions"], GVAR(loadoutAction)] call EFUNC(interact_menu,addActionToClass); diff --git a/addons/rearm/functions/fnc_addVehicleMagazinesToSupply.sqf b/addons/rearm/functions/fnc_addVehicleMagazinesToSupply.sqf index 1ab5377aad8..37b642222a8 100644 --- a/addons/rearm/functions/fnc_addVehicleMagazinesToSupply.sqf +++ b/addons/rearm/functions/fnc_addVehicleMagazinesToSupply.sqf @@ -36,10 +36,8 @@ private _turrets = [_vehicle] call FUNC(getAllRearmTurrets); TRACE_2("",_turretPath,_magazines); { [_truck, _x] call FUNC(addMagazineToSupply); - false - } count _magazines; - false -} count _turrets; + } forEach _magazines; +} forEach _turrets; // 1.70 pylons private _pylonConfigs = configProperties [configFile >> "CfgVehicles" >> _vehicle >> "Components" >> "TransportPylonsComponent" >> "Pylons", "isClass _x"]; diff --git a/addons/rearm/functions/fnc_initSupplyVehicle.sqf b/addons/rearm/functions/fnc_initSupplyVehicle.sqf index 72b807d810a..e748062e657 100644 --- a/addons/rearm/functions/fnc_initSupplyVehicle.sqf +++ b/addons/rearm/functions/fnc_initSupplyVehicle.sqf @@ -19,13 +19,14 @@ if (!hasInterface) exitWith {}; // For now we just add actions, so no need non-c params ["_vehicle"]; private _typeOf = typeOf _vehicle; +private _configOf = configOf _vehicle; TRACE_2("initSupplyVehicle",_vehicle,_typeOf); if (!alive _vehicle) exitWith {}; -private _configSupply = getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(defaultSupply)); +private _configSupply = getNumber (_configOf >> QGVAR(defaultSupply)); private _isSupplyVehicle = _vehicle getVariable [QGVAR(isSupplyVehicle), false]; -private _oldRearmConfig = isClass (configFile >> "CfgVehicles" >> _typeOf >> "ACE_Actions" >> "ACE_MainActions" >> QGVAR(takeAmmo)); +private _oldRearmConfig = isClass (_configOf >> "ACE_Actions" >> "ACE_MainActions" >> QGVAR(takeAmmo)); TRACE_3("",_configSupply,_isSupplyVehicle,_oldRearmConfig); if ((_configSupply <= 0) && {!_isSupplyVehicle} && {!_oldRearmConfig}) exitWith {}; // Ignore if not enabled @@ -75,4 +76,3 @@ if (_oldRearmConfig || {_configSupply > 0}) then { [_vehicle, 0, ["ACE_MainActions"], _actionTakeAmmo] call EFUNC(interact_menu,addActionToObject); [_vehicle, 0, ["ACE_MainActions"], _actionStoreAmmo] call EFUNC(interact_menu,addActionToObject); }; - diff --git a/addons/sitting/functions/fnc_sit.sqf b/addons/sitting/functions/fnc_sit.sqf index 144607b2b77..a8fe2ccf6ce 100644 --- a/addons/sitting/functions/fnc_sit.sqf +++ b/addons/sitting/functions/fnc_sit.sqf @@ -37,7 +37,7 @@ private _actionID = _player addAction [ ]; // Read config -private _configFile = configFile >> "CfgVehicles" >> typeOf _seat; +private _configFile = configOf _seat; private _sitDirection = (getDir _seat) + (_seat getVariable [QXGVAR(sitDirection), getNumber (_configFile >> QXGVAR(sitDirection))]); private _sitPositionAll = _seat getVariable [QXGVAR(sitPosition), getArray (_configFile >> QXGVAR(sitPosition))]; private _multiSitting = (_sitPositionAll select 0) isEqualType []; diff --git a/addons/vehicle_damage/functions/fnc_addEventHandler.sqf b/addons/vehicle_damage/functions/fnc_addEventHandler.sqf index 17254ea1d98..f08c58f574c 100644 --- a/addons/vehicle_damage/functions/fnc_addEventHandler.sqf +++ b/addons/vehicle_damage/functions/fnc_addEventHandler.sqf @@ -25,7 +25,7 @@ if !(GVAR(enabled)) exitWith { }; private _hitpointHash = [[], nil] call CBA_fnc_hashCreate; -private _vehicleConfig = configFile >> "CfgVehicles" >> typeOf _vehicle; +private _vehicleConfig = configOf _vehicle; private _hitpointsConfig = _vehicleConfig >> "HitPoints"; private _turretConfig = _vehicleConfig >> "Turrets"; private _eraHitpoints = [_vehicleConfig >> QGVAR(eraHitpoints), "ARRAY", []] call CBA_fnc_getConfigEntry; diff --git a/addons/vehicle_damage/functions/fnc_handleCookoff.sqf b/addons/vehicle_damage/functions/fnc_handleCookoff.sqf index a4648ee3d3e..9d97b393f32 100644 --- a/addons/vehicle_damage/functions/fnc_handleCookoff.sqf +++ b/addons/vehicle_damage/functions/fnc_handleCookoff.sqf @@ -25,9 +25,10 @@ params ["_vehicle", "_chanceOfFire", "_intensity", ["_injurer", objNull], ["_hit private _alreadyCookingOff = _vehicle getVariable [QGVAR(cookingOff), false]; if (!_alreadyCookingOff && { _chanceOfFire >= random 1 }) exitWith { - private _fireDetonateChance = [configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(detonationDuringFireProb), "number", 0] call CBA_fnc_getConfigEntry; + private _configOf = configOf _vehicle; + private _fireDetonateChance = [_configOf >> QGVAR(detonationDuringFireProb), "number", 0] call CBA_fnc_getConfigEntry; if (_canRing) then { - _canRing = 1 isEqualTo ([configFile >> "CfgVehicles" >> typeOf _vehicle >> QGVAR(canHaveFireRing), "number", 0] call CBA_fnc_getConfigEntry); + _canRing = ([_configOf >> QGVAR(canHaveFireRing), "number", 0] call CBA_fnc_getConfigEntry) == 1; }; private _delayWithSmoke = _chanceOfFire < random 1;