General - Change object config lookups to configOf (#8795)

* configOf lookups

* forEach, missed configOf

* revert handcuff distance change

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* optimize condition

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* capitalization

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* use object in getVehicleIcon

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* add return comment

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* remove extra brackets

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* add missing brackets

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* add return comment pt2

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>

* revert to cursorTarget

Co-authored-by: Filip Maciejewski <veteran29@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
GhostIsSpooky 2022-03-09 00:41:21 -03:00 committed by GitHub
parent 38a308ee24
commit 68ed19911a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 95 additions and 99 deletions

View File

@ -19,7 +19,7 @@
params ["_player", "_turret"]; params ["_player", "_turret"];
private _vehicle = vehicle _player; private _vehicle = vehicle _player;
private _typeOf = typeOf _vehicle; 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 // 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 { private _showGunLaying = if (isNumber (_vehicleCfg >> QGVAR(showGunLaying))) then {

View File

@ -17,10 +17,10 @@
params [["_backpack", objNull, [objNull, ""]]]; params [["_backpack", objNull, [objNull, ""]]];
if (_backpack isEqualType objNull) then { private _config = if (_backpack isEqualType objNull) then {
_backpack = typeOf _backpack; configOf _backpack
} else {
configFile >> "CfgVehicles" >> _backpack
}; };
private _config = configFile >> "CfgVehicles" >> _backpack;
getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} // return getText (_config >> "vehicleClass") == "backpacks" && {getNumber (_config >> "maximumLoad") > 0} // return

View File

@ -5,7 +5,7 @@ class CfgVehicles {
class ACE_ApplyHandcuffs { class ACE_ApplyHandcuffs {
displayName = CSTRING(SetCaptive); displayName = CSTRING(SetCaptive);
selection = "righthand"; selection = "righthand";
distance = 2; distance = HANDCUFFS_DISTANCE;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs)); condition = QUOTE([ARR_2(_player, _target)] call FUNC(canApplyHandcuffs));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doApplyHandcuffs));
exceptions[] = {"isNotSwimming", "isNotInside"}; exceptions[] = {"isNotSwimming", "isNotInside"};
@ -16,7 +16,7 @@ class CfgVehicles {
class ACE_RemoveHandcuffs { class ACE_RemoveHandcuffs {
displayName = CSTRING(ReleaseCaptive); displayName = CSTRING(ReleaseCaptive);
selection = "righthand"; selection = "righthand";
distance = 2; distance = HANDCUFFS_DISTANCE;
condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs)); condition = QUOTE([ARR_2(_player, _target)] call FUNC(canRemoveHandcuffs));
statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs)); statement = QUOTE([ARR_2(_player, _target)] call FUNC(doRemoveHandcuffs));
exceptions[] = {"isNotSwimming", "isNotInside"}; exceptions[] = {"isNotSwimming", "isNotInside"};

View File

@ -41,7 +41,7 @@ if (!hasInterface) exitWith {};
private _target = cursorObject; private _target = cursorObject;
if !([ACE_player, _target, []] call EFUNC(common,canInteractWith)) exitWith {false}; if !([ACE_player, _target, []] call EFUNC(common,canInteractWith)) exitWith {false};
if !(_target isKindOf "CAManBase") 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 { if ([ACE_player, _target] call FUNC(canApplyHandcuffs)) exitWith {
[ACE_player, _target] call FUNC(doApplyHandcuffs); [ACE_player, _target] call FUNC(doApplyHandcuffs);

View File

@ -15,3 +15,5 @@
#endif #endif
#include "\z\ace\addons\main\script_macros.hpp" #include "\z\ace\addons\main\script_macros.hpp"
#define HANDCUFFS_DISTANCE 2

View File

@ -17,6 +17,7 @@
params ["_object"]; params ["_object"];
private _type = typeOf _object; private _type = typeOf _object;
private _config = configOf _object;
TRACE_2("params",_object,_type); TRACE_2("params",_object,_type);
// If object had size given to it via eden/public then override config canLoad setting // 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 { if (!(_canLoadPublic isEqualType false)) then {
WARNING_4("%1[%2] - Variable %3 is %4 - Should be bool",_object,_type,QGVAR(canLoad),_canLoadPublic); 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 // Nothing to do here if object can't be loaded
if !(_canLoadConfig || {_canLoadPublic in [true, 1]}) exitWith {}; if !(_canLoadConfig || {_canLoadPublic in [true, 1]}) exitWith {};

View File

@ -19,10 +19,11 @@ params ["_vehicle"];
TRACE_1("params", _vehicle); TRACE_1("params", _vehicle);
private _type = typeOf _vehicle; private _type = typeOf _vehicle;
private _config = configOf _vehicle;
// If vehicle had space given to it via eden/public then override config hasCargo setting // If vehicle had space given to it via eden/public then override config hasCargo setting
private _hasCargoPublic = _vehicle getVariable [QGVAR(hasCargo), false]; 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 // Nothing to do here if vehicle has no cargo space
if !(_hasCargoConfig || _hasCargoPublic) exitWith {}; if !(_hasCargoConfig || _hasCargoPublic) exitWith {};
@ -40,13 +41,11 @@ if (_addCargoType) then {
// Vehicle can have default ace cargo in its config // Vehicle can have default ace cargo in its config
if (isServer) then { if (isServer) then {
{ {
if (isClass _x) then {
private _cargoClassname = getText (_x >> "type"); private _cargoClassname = getText (_x >> "type");
private _cargoCount = getNumber (_x >> "amount"); private _cargoCount = getNumber (_x >> "amount");
TRACE_3("adding ACE_Cargo", (configName _x), _cargoClassname, _cargoCount); TRACE_3("adding ACE_Cargo", (configName _x), _cargoClassname, _cargoCount);
["ace_addCargo", [_cargoClassname, _vehicle, _cargoCount]] call CBA_fnc_localEvent; ["ace_addCargo", [_cargoClassname, _vehicle, _cargoCount]] call CBA_fnc_localEvent;
}; } forEach ("true" configClasses (_config >> QUOTE(ADDON) >> "Cargo"));
} count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo"));
}; };
// Servers and HCs do not require action menus (beyond this point) // Servers and HCs do not require action menus (beyond this point)

View File

@ -43,9 +43,13 @@ if (_cargo isKindOf "CAManBase") then {
_radiusOfItem = 1.1; _radiusOfItem = 1.1;
} else { } else {
//`sizeOf` is unreliable, and does not work with object types that don't exist on map, so estimate size based on cargo size //`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 _configOfCargo = if (_cargo isEqualType objNull) then {
private _itemSize = if (isNumber (configFile >> "CfgVehicles" >> _typeOfCargo >> QEGVAR(cargo,size)) && {getNumber (configFile >> "CfgVehicles" >> _typeOfCargo >> QEGVAR(cargo,size)) != -1}) then { configOf _cargo
getNumber (configFile >> "CfgVehicles" >> _typeOfCargo >> QEGVAR(cargo,size)); } 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 { } else {
if (["ace_cargo"] call FUNC(isModLoaded)) then { if (["ace_cargo"] call FUNC(isModLoaded)) then {
[_cargo] call EFUNC(cargo,getSizeItem); [_cargo] call EFUNC(cargo,getSizeItem);

View File

@ -17,7 +17,7 @@
params [["_vehicle", objNull, [objNull]]]; params [["_vehicle", objNull, [objNull]]];
private _config = configFile >> "CfgVehicles" >> _vehicle; private _config = configOf _vehicle;
private _cargo = []; private _cargo = [];
private _codrivers = getArray (_config >> "cargoIsCoDriver"); private _codrivers = getArray (_config >> "cargoIsCoDriver");

View File

@ -17,7 +17,7 @@
params [["_vehicle", objNull, [objNull]]]; params [["_vehicle", objNull, [objNull]]];
private _config = configFile >> "CfgVehicles" >> _vehicle; private _config = configOf _vehicle;
private _cargo = []; private _cargo = [];
private _codrivers = getArray (_config >> "cargoIsCoDriver"); private _codrivers = getArray (_config >> "cargoIsCoDriver");

View File

@ -18,7 +18,7 @@
params [["_object", objNull, [objNull, ""]]]; 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 { private _objectType = if (_object isEqualType objNull) then {
typeOf _object typeOf _object

View File

@ -25,7 +25,7 @@ if (_staticWeapon getVariable [format [QGVAR(proxyHandled_%1), _turret], false])
private _proxyWeapon = getText (configOf _staticWeapon >> "ace_csw" >> "proxyWeapon"); private _proxyWeapon = getText (configOf _staticWeapon >> "ace_csw" >> "proxyWeapon");
TRACE_2("",_typeOf,_proxyWeapon); TRACE_2("",typeOf _staticWeapon,_proxyWeapon);
if (_proxyWeapon == "") exitWith {}; if (_proxyWeapon == "") exitWith {};
private _currentWeapon = (_staticWeapon weaponsTurret [0]) param [0, "#none"]; private _currentWeapon = (_staticWeapon weaponsTurret [0]) param [0, "#none"];

View File

@ -24,7 +24,7 @@ params ["_vehicle", "_unit", "_magClassname"];
TRACE_3("params",_vehicle,_unit,_magClassname); TRACE_3("params",_vehicle,_unit,_magClassname);
//Get setup object vehicle and model: //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");}; if (!isClass (configFile >> "CfgVehicles" >> _setupObjectClass)) exitWith {ERROR("Bad Vehicle");};
private _p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model"); private _p3dModel = getText (configFile >> "CfgVehicles" >> _setupObjectClass >> "model");
if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game! if (_p3dModel == "") exitWith {ERROR("No Model");}; //"" - will crash game!

View File

@ -63,11 +63,11 @@ private _fnc_condition = {
[_player, _source] call FUNC(canDrinkFromSource) [_player, _source] call FUNC(canDrinkFromSource)
}; };
private _sourceType = typeOf _source; private _sourceConfig = configOf _source;
private _progressText = if (_sourceType == "") then { private _progressText = if (isNull _sourceConfig) then {
LLSTRING(DrinkingFromSource) LLSTRING(DrinkingFromSource)
} else { } else {
format [LLSTRING(DrinkingFromX), getText (configFile >> "CfgVehicles" >> _sourceType >> "displayName")] format [LLSTRING(DrinkingFromX), getText (_sourceConfig >> "displayName")]
}; };
[ [

View File

@ -17,10 +17,10 @@
params ["_object"]; params ["_object"];
private _typeOf = typeOf _object; private _configOf = configOf _object;
if (_typeOf != "") then { if !(isNull _configOf) then {
// Check for offset in config since we have valid typeOf // 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}; if (_offset isEqualTo []) then {[0, 0, 0]} else {_offset};
} else { } else {
// Check for offset corresponding to p3d list // Check for offset corresponding to p3d list

View File

@ -22,10 +22,10 @@ if (!alive _source) exitWith {0};
private _water = _source getVariable QGVAR(currentWaterSupply); private _water = _source getVariable QGVAR(currentWaterSupply);
if (isNil "_water") then { if (isNil "_water") then {
private _typeOf = typeOf _source; private _configOf = configOf _source;
if (_typeOf != "") then { if !(isNull _configOf) then {
// Check for waterSupply entry since we have valid typeOf // 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 == 0) then {_water = REFILL_WATER_DISABLED};
if (_water != REFILL_WATER_DISABLED) then { if (_water != REFILL_WATER_DISABLED) then {

View File

@ -17,4 +17,4 @@
params ["_unit"]; params ["_unit"];
getNumber (configFile >> "CfgVehicles" >> (backpack _unit) >> QUOTE(ADDON)) == 1 getNumber ((configOf (backpackContainer _unit)) >> QUOTE(ADDON)) == 1

View File

@ -24,7 +24,7 @@ private _object = GETMVAR(BIS_fnc_initCuratorAttributes_target,objNull);
_control ctrlRemoveAllEventHandlers "SetFocus"; _control ctrlRemoveAllEventHandlers "SetFocus";
private _ctrlLabel = _display displayCtrl IDC_ATTRIBUTE_LABEL; 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; _ctrlLabel ctrlSetText _labelText;
private _index = _object getVariable [QGVAR(index), -1]; private _index = _object getVariable [QGVAR(index), -1];

View File

@ -18,6 +18,6 @@
params ["_object", "_player"]; params ["_object", "_player"];
private _magazineClass = getText (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(magazine)); private _magazineClass = getText ((configOf _object) >> QGVAR(magazine));
_magazineClass != "" && {_player canAdd _magazineClass} _magazineClass != "" && {_player canAdd _magazineClass}

View File

@ -18,7 +18,7 @@
params ["_object", "_player"]; 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]; private _index = _object getVariable [QGVAR(index), -1];
// Add magazine to inventory and get its id // Add magazine to inventory and get its id

View File

@ -21,13 +21,12 @@
params ["_vehicles", "_statement", "_target"]; params ["_vehicles", "_statement", "_target"];
_vehicles apply { _vehicles apply {
private _type = typeOf _x; private _name = getText ((configOf _x) >> "displayName");
private _name = getText (configFile >> "CfgVehicles" >> _type >> "displayName");
private _ownerName = [_x, true] call EFUNC(common,getName); private _ownerName = [_x, true] call EFUNC(common,getName);
if ("" != _ownerName) then { if ("" != _ownerName) then {
_name = format ["%1 (%2)", _name, _ownerName]; _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); private _action = [format ["%1", _x], _name, _icon, _statement, {true}, {}, _x] call EFUNC(interact_menu,createAction);
[_action, [], _target] [_action, [], _target]
} }

View File

@ -27,21 +27,21 @@ if ((vehicle ACE_player) != ACE_player) exitWith {};
[{ [{
params ["_args", "_pfID"]; params ["_args", "_pfID"];
_args params ["_setPosition", "_addedHelpers", "_housesScaned", "_housesToScanForActions"]; _args params ["_setPosition", "_addedHelpers", "_housesScanned", "_housesToScanForActions"];
if (!EGVAR(interact_menu,keyDown)) then { if (!EGVAR(interact_menu,keyDown)) then {
{deleteVehicle _x;} forEach _addedHelpers; {deleteVehicle _x;} forEach _addedHelpers;
[_pfID] call CBA_fnc_removePerFrameHandler; [_pfID] call CBA_fnc_removePerFrameHandler;
} else { } else {
// Prevent Rare Error when ending mission with interact key down: // 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): //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 { if (((count (configOf cursorTarget >> "UserActions")) > 0) || {(count (getArray (configOf cursorTarget >> "ladders"))) > 0}) then {
_housesToScanForActions = [cursorTarget]; _housesToScanForActions = [cursorTarget];
} else { } else {
_housesScaned pushBack cursorTarget; _housesScanned pushBack cursorTarget;
}; };
}; };
@ -51,47 +51,43 @@ if ((vehicle ACE_player) != ACE_player) exitWith {};
if (_housesToScanForActions isEqualTo []) then { if (_housesToScanForActions isEqualTo []) then {
//If player moved >2 meters from last pos, then rescan //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; private _configOfHouse = configOf _x;
if (((count (configFile >> "CfgVehicles" >> _typeOfHouse >> "UserActions")) == 0) && {(count (getArray (configFile >> "CfgVehicles" >> _typeOfHouse >> "ladders"))) == 0}) then { if (((count (_configOfHouse >> "UserActions")) == 0) && {(count (getArray (_configOfHouse >> "ladders"))) == 0}) then {
_housesScaned pushBack _x; _housesScanned pushBack _x;
} else { } else {
_housesToScanForActions pushBack _x; _housesToScanForActions pushBack _x;
}; };
nil } forEach (_nearBuidlings - _housesScanned);
} count (_nearBuidlings - _housesScaned);
_args set [0, (getPosASL ace_player)]; _args set [0, (getPosASL ACE_player)];
} else { } else {
private _houseBeingScaned = _housesToScanForActions deleteAt 0; private _houseBeingScanned = _housesToScanForActions deleteAt 0;
private _typeOfHouse = typeOf _houseBeingScaned;
//Skip this house for now if we are outside of it's radius //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) //(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"]; _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]; private _helperObject = "ACE_LogicDummy" createVehicleLocal [0,0,0];
_addedHelpers pushBack _helperObject; _addedHelpers pushBack _helperObject;
_helperObject setVariable [QGVAR(building), _houseBeingScaned]; _helperObject setVariable [QGVAR(building), _houseBeingScanned];
_helperObject setPosASL _helperPos; _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); [_helperObject, 0, [], _x] call EFUNC(interact_menu,addActionToObject);
nil } forEach (_memPointsActions select _forEachIndex);
} count (_memPointsActions select _forEachIndex);
} forEach _memPoints; } 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;

View File

@ -65,7 +65,7 @@ GVAR(killCount) = 0;
if (!isNull _killer) then { if (!isNull _killer) then {
if (!(_killer isKindof "CAManBase")) then { // If killer is a vehicle log the vehicle type 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 { if (isNull _instigator) then {
_instigator = effectiveCommander _killer; _instigator = effectiveCommander _killer;
@ -82,7 +82,7 @@ GVAR(killCount) = 0;
// Log firendly fire // Log firendly fire
private _fnc_getSideFromConfig = { private _fnc_getSideFromConfig = {
params ["_object"]; params ["_object"];
switch (getNumber (configFile >> "CfgVehicles" >> (typeOf _object) >> "side")) do { switch (getNumber ((configOf _object) >> "side")) do {
case (0): {east}; case (0): {east};
case (1): {west}; case (1): {west};
case (2): {resistance}; case (2): {resistance};
@ -117,7 +117,7 @@ GVAR(killCount) = 0;
} else { } else {
_killerName = _killer getVariable [QGVAR(aiName), ""]; // allow setting a custom AI name (e.g. VIP Target) _killerName = _killer getVariable [QGVAR(aiName), ""]; // allow setting a custom AI name (e.g. VIP Target)
if (_killerName == "") then { 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 { } else {
_unitName = _unit getVariable [QGVAR(aiName), ""]; // allow setting a custom AI name (e.g. VIP Target) _unitName = _unit getVariable [QGVAR(aiName), ""]; // allow setting a custom AI name (e.g. VIP Target)
if (_unitName == "") then { 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); TRACE_3("send kill event",_killer,_unitName,_killInfo);

View File

@ -19,14 +19,11 @@
params ["_object"]; params ["_object"];
TRACE_1("Checking if fence",_object); TRACE_1("Checking if fence",_object);
private _typeOf = typeOf _object; private _configOf = configOf _object;
if !(isNull _configOf) then {
private _returnValue = if (_typeOf != "") then { // Check for isFence entry since we have valid configOf
// Check for isFence entry since we have valid typeOf getNumber (_configOf >> QGVAR(isFence)) == 1 // return
1 == getNumber (configFile >> "CfgVehicles" >> _typeOf >> QGVAR(isFence));
} else { } else {
// Check the p3d name against list (in script_component.hpp) // 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

View File

@ -83,6 +83,6 @@
#define HAS_WIRECUTTER(unit) (\ #define HAS_WIRECUTTER(unit) (\
"ACE_wirecutter" in (unit call EFUNC(common,uniqueItems)) \ "ACE_wirecutter" in (unit call EFUNC(common,uniqueItems)) \
|| {1 == getNumber (configFile >> "CfgVehicles" >> (backpack unit) >> QGVAR(hasWirecutter))} \ || {getNumber ((configOf (backpackContainer unit)) >> QGVAR(hasWirecutter)) == 1} \
|| {1 == getNumber (configFile >> "CfgWeapons" >> (vest unit) >> QGVAR(hasWirecutter))} \ || {getNumber (configFile >> "CfgWeapons" >> (vest unit) >> QGVAR(hasWirecutter)) == 1} \
) )

View File

@ -12,7 +12,7 @@
_logic hideObject true; _logic hideObject true;
if (_logic getVariable [QGVAR(initalized), false]) exitWith {}; if (_logic getVariable [QGVAR(initalized), false]) exitWith {};
private _config = (configFile >> "CfgVehicles" >> _logicType); private _config = configOf _logic;
if !(isClass _config) exitWith {}; if !(isClass _config) exitWith {};
private _isGlobal = getNumber (_config >> "isGlobal") > 0; private _isGlobal = getNumber (_config >> "isGlobal") > 0;

View File

@ -19,7 +19,7 @@
private _player = ACE_player; private _player = ACE_player;
private _vehicle = vehicle _player; private _vehicle = vehicle _player;
private _type = typeOf _vehicle; private _type = typeOf _vehicle;
private _config = configFile >> "CfgVehicles" >> _type; private _config = configOf _vehicle;
private _text = format["<t size='1.4'><img image='%1'></t> <t size='1.7' shadow='true'>%2</t><br/>", getText(_config>>"picture"), getText (_config >> "DisplayName")]; private _text = format["<t size='1.4'><img image='%1'></t> <t size='1.7' shadow='true'>%2</t><br/>", getText(_config>>"picture"), getText (_config >> "DisplayName")];
private _data = [_type] call FUNC(getVehicleData); private _data = [_type] call FUNC(getVehicleData);

View File

@ -16,10 +16,10 @@
*/ */
params ["_unit"]; params ["_unit"];
private _backpack = backpack _unit; private _backpack = backpackContainer _unit;
if ( if (
_backpack == "" && isNull _backpack &&
{(vehicle _unit) isKindOf "ParachuteBase"} && {(vehicle _unit) isKindOf "ParachuteBase"} &&
{GETVAR(_unit,GVAR(hasReserve),false)} {GETVAR(_unit,GVAR(hasReserve),false)}
) then { ) then {
@ -28,7 +28,7 @@ if (
SETVAR(vehicle _unit,GVAR(canCut),true); // Mark the parachute cuttable since reserve is present SETVAR(vehicle _unit,GVAR(canCut),true); // Mark the parachute cuttable since reserve is present
} else { } else {
// Case where inventory has changed otherwise (including when reserve is added) // 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; private _hasReserve = getNumber (_backpackCfg >> "ace_hasReserveParachute") == 1;
// Cache reserve parachute state and class when backpack changes // Cache reserve parachute state and class when backpack changes

View File

@ -14,8 +14,7 @@ GVAR(loadoutAction) = [ // create action
private _isRearmVehicle = if (["ace_rearm"] call EFUNC(common,isModLoaded)) then { private _isRearmVehicle = if (["ace_rearm"] call EFUNC(common,isModLoaded)) then {
_vehicles findIf {[_x] call EFUNC(rearm,isSource)} != -1; _vehicles findIf {[_x] call EFUNC(rearm,isSource)} != -1;
} else { } else {
private _cfgVehicle = configFile >> "CfgVehicles"; _vehicles findIf {getNumber ((configOf _x) >> "transportAmmo") > 0} != -1;
_vehicles findIf {getNumber (_cfgVehicle >> typeOf _x >> "transportAmmo") > 0} != -1;
}; };
(_isRearmVehicle && {[ace_player, _target] call FUNC(canConfigurePylons)}) (_isRearmVehicle && {[ace_player, _target] call FUNC(canConfigurePylons)})
@ -27,7 +26,7 @@ GVAR(loadoutAction) = [ // create action
private _typeOf = typeOf _vehicle; private _typeOf = typeOf _vehicle;
if (_typeOf in GVAR(aircraftWithPylons)) exitWith {}; 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; GVAR(aircraftWithPylons) pushBack _typeOf;
[_typeOf, 0, ["ACE_MainActions"], GVAR(loadoutAction)] call EFUNC(interact_menu,addActionToClass); [_typeOf, 0, ["ACE_MainActions"], GVAR(loadoutAction)] call EFUNC(interact_menu,addActionToClass);

View File

@ -36,10 +36,8 @@ private _turrets = [_vehicle] call FUNC(getAllRearmTurrets);
TRACE_2("",_turretPath,_magazines); TRACE_2("",_turretPath,_magazines);
{ {
[_truck, _x] call FUNC(addMagazineToSupply); [_truck, _x] call FUNC(addMagazineToSupply);
false } forEach _magazines;
} count _magazines; } forEach _turrets;
false
} count _turrets;
// 1.70 pylons // 1.70 pylons
private _pylonConfigs = configProperties [configFile >> "CfgVehicles" >> _vehicle >> "Components" >> "TransportPylonsComponent" >> "Pylons", "isClass _x"]; private _pylonConfigs = configProperties [configFile >> "CfgVehicles" >> _vehicle >> "Components" >> "TransportPylonsComponent" >> "Pylons", "isClass _x"];

View File

@ -19,13 +19,14 @@ if (!hasInterface) exitWith {}; // For now we just add actions, so no need non-c
params ["_vehicle"]; params ["_vehicle"];
private _typeOf = typeOf _vehicle; private _typeOf = typeOf _vehicle;
private _configOf = configOf _vehicle;
TRACE_2("initSupplyVehicle",_vehicle,_typeOf); TRACE_2("initSupplyVehicle",_vehicle,_typeOf);
if (!alive _vehicle) exitWith {}; 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 _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); TRACE_3("",_configSupply,_isSupplyVehicle,_oldRearmConfig);
if ((_configSupply <= 0) && {!_isSupplyVehicle} && {!_oldRearmConfig}) exitWith {}; // Ignore if not enabled 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"], _actionTakeAmmo] call EFUNC(interact_menu,addActionToObject);
[_vehicle, 0, ["ACE_MainActions"], _actionStoreAmmo] call EFUNC(interact_menu,addActionToObject); [_vehicle, 0, ["ACE_MainActions"], _actionStoreAmmo] call EFUNC(interact_menu,addActionToObject);
}; };

View File

@ -37,7 +37,7 @@ private _actionID = _player addAction [
]; ];
// Read config // 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 _sitDirection = (getDir _seat) + (_seat getVariable [QXGVAR(sitDirection), getNumber (_configFile >> QXGVAR(sitDirection))]);
private _sitPositionAll = _seat getVariable [QXGVAR(sitPosition), getArray (_configFile >> QXGVAR(sitPosition))]; private _sitPositionAll = _seat getVariable [QXGVAR(sitPosition), getArray (_configFile >> QXGVAR(sitPosition))];
private _multiSitting = (_sitPositionAll select 0) isEqualType []; private _multiSitting = (_sitPositionAll select 0) isEqualType [];

View File

@ -25,7 +25,7 @@ if !(GVAR(enabled)) exitWith {
}; };
private _hitpointHash = [[], nil] call CBA_fnc_hashCreate; private _hitpointHash = [[], nil] call CBA_fnc_hashCreate;
private _vehicleConfig = configFile >> "CfgVehicles" >> typeOf _vehicle; private _vehicleConfig = configOf _vehicle;
private _hitpointsConfig = _vehicleConfig >> "HitPoints"; private _hitpointsConfig = _vehicleConfig >> "HitPoints";
private _turretConfig = _vehicleConfig >> "Turrets"; private _turretConfig = _vehicleConfig >> "Turrets";
private _eraHitpoints = [_vehicleConfig >> QGVAR(eraHitpoints), "ARRAY", []] call CBA_fnc_getConfigEntry; private _eraHitpoints = [_vehicleConfig >> QGVAR(eraHitpoints), "ARRAY", []] call CBA_fnc_getConfigEntry;

View File

@ -25,9 +25,10 @@ params ["_vehicle", "_chanceOfFire", "_intensity", ["_injurer", objNull], ["_hit
private _alreadyCookingOff = _vehicle getVariable [QGVAR(cookingOff), false]; private _alreadyCookingOff = _vehicle getVariable [QGVAR(cookingOff), false];
if (!_alreadyCookingOff && { _chanceOfFire >= random 1 }) exitWith { 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 { 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; private _delayWithSmoke = _chanceOfFire < random 1;