mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Common - Use hashmap for canInteractWith
check (#10189)
This commit is contained in:
parent
fff66bc27c
commit
3ff635f82d
@ -12,6 +12,8 @@ GVAR(showHudHash) = createHashMap;
|
||||
GVAR(vehicleIconCache) = createHashMap; // for getVehicleIcon
|
||||
GVAR(wheelSelections) = createHashMap;
|
||||
|
||||
GVAR(InteractionConditions) = createHashMap;
|
||||
|
||||
GVAR(blockItemReplacement) = false;
|
||||
|
||||
// Cache for FUNC(isModLoaded)
|
||||
|
@ -19,17 +19,4 @@
|
||||
params ["_conditionName", "_conditionFunc"];
|
||||
|
||||
_conditionName = toLowerANSI _conditionName;
|
||||
|
||||
private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
|
||||
_conditions params ["_conditionNames", "_conditionFuncs"];
|
||||
|
||||
private _index = _conditionNames find _conditionName;
|
||||
|
||||
if (_index == -1) then {
|
||||
_index = count _conditionNames;
|
||||
};
|
||||
|
||||
_conditionNames set [_index, _conditionName];
|
||||
_conditionFuncs set [_index, _conditionFunc];
|
||||
|
||||
GVAR(InteractionConditions) = _conditions;
|
||||
GVAR(InteractionConditions) set [_conditionName, _conditionFunc];
|
||||
|
@ -27,15 +27,11 @@ private _owner = _target getVariable [QGVAR(owner), objNull];
|
||||
if (!isNull _owner && {_unit != _owner}) exitWith {false};
|
||||
|
||||
// check general conditions
|
||||
private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
|
||||
_conditions params ["_conditionNames", "_conditionFuncs"];
|
||||
|
||||
private _canInteract = true;
|
||||
|
||||
{
|
||||
if (!(_x in _exceptions) && {!([_unit, _target] call (_conditionFuncs select _forEachIndex))}) exitWith {
|
||||
if (!(_x in _exceptions) && {!([_unit, _target] call _y)}) exitWith {
|
||||
_canInteract = false;
|
||||
};
|
||||
} forEach _conditionNames;
|
||||
} forEach GVAR(InteractionConditions);
|
||||
|
||||
_canInteract
|
||||
|
@ -18,16 +18,4 @@
|
||||
params ["_conditionName"];
|
||||
|
||||
_conditionName = toLowerANSI _conditionName;
|
||||
|
||||
private _conditions = missionNamespace getVariable [QGVAR(InteractionConditions), [[],[]]];
|
||||
|
||||
_conditions params ["_conditionNames", "_conditionFuncs"];
|
||||
|
||||
private _index = _conditionNames find _conditionName;
|
||||
|
||||
if (_index == -1) exitWith {};
|
||||
|
||||
_conditionNames deleteAt _index;
|
||||
_conditionFuncs deleteAt _index;
|
||||
|
||||
GVAR(InteractionConditions) = _conditions;
|
||||
GVAR(InteractionConditions) deleteAt _conditionName;
|
||||
|
Loading…
Reference in New Issue
Block a user