ACE3/addons/fortify/functions/fnc_canFortify.sqf
jonpas 742626ff1a
General - Relative script_component.hpp includes (#9378)
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-09-12 20:58:10 +02:00

33 lines
743 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: Kingsley
* Checks whether the given player can fortify.
*
* Arguments:
* 0: Player <OBJECT>
* 1: Cost <NUMBER> (default: 0)
*
* Return Value:
* Can Fortify <BOOL>
*
* Example:
* [player] call ace_fortify_fnc_canFortify
*
* Public: Yes
*/
params ["_player", ["_cost", 0]];
(missionNamespace getVariable [QGVAR(fortifyAllowed), true]) &&
{"ACE_Fortify" in (_player call EFUNC(common,uniqueItems))} &&
{
private _budget = [side group _player] call FUNC(getBudget);
((_budget == -1) || {_budget >= _cost})
} && {
private _inArea = GVAR(locations) isEqualTo [];
{
if (_player inArea _x) exitWith {_inArea = true};
} forEach GVAR(locations);
_inArea
}