mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e06c6f7835
* General - Replace toLower with toLowerANSI where applicable * whoops Co-authored-by: PabstMirror <pabstmirror@gmail.com> * Update addons/repair/functions/fnc_setHitPointDamage.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/repair/dev/draw_showRepairInfo.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/tagging/XEH_preStart.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/vehicle_damage/functions/fnc_handleCookoff.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * Update addons/tagging/XEH_preStart.sqf Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> * comparment -> compartment * Update fnc_showHud.sqf * Update fnc_registerObjects.sqf * Update addons/common/functions/fnc_cbaSettings_settingChanged.sqf --------- Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
42 lines
1.1 KiB
Plaintext
42 lines
1.1 KiB
Plaintext
#include "..\script_component.hpp"
|
|
/*
|
|
* Author: commy2
|
|
* Check if the unit can interact.
|
|
*
|
|
* Arguments:
|
|
* 0: The player. <OBJECT>
|
|
* 1: The interaction target. objNull to ignore. <OBJECT>
|
|
* 2: Exceptions. What general conditions are to skip? (default: []) <ARRAY>
|
|
*
|
|
* Return Value:
|
|
* Unit can interact? <BOOL>
|
|
*
|
|
* Example:
|
|
* [bob, target, []] call ace_common_fnc_canInteractWith
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
params ["_unit", "_target", ["_exceptions", []]];
|
|
|
|
_exceptions = _exceptions apply {toLowerANSI _x};
|
|
|
|
private _owner = _target getVariable [QGVAR(owner), objNull];
|
|
|
|
// exit if the target is not free to interact
|
|
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 {
|
|
_canInteract = false;
|
|
};
|
|
} forEach _conditionNames;
|
|
|
|
_canInteract
|