2015-02-22 14:01:31 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
|
|
|
* Check if caller can access targets medical equipment, based upon accessLevel.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: The caller <OBJECT>
|
|
|
|
* 1: The target <OBJECT>
|
|
|
|
*
|
|
|
|
* ReturnValue:
|
|
|
|
* Can Treat <BOOL>
|
|
|
|
*
|
|
|
|
* Public: Yes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-08-22 14:25:10 +00:00
|
|
|
private ["_accessLevel", "_return"];
|
2015-09-03 13:49:49 +00:00
|
|
|
params ["_caller", "_target"];
|
2015-02-22 14:01:31 +00:00
|
|
|
|
2015-11-30 16:27:09 +00:00
|
|
|
_accessLevel = _target getVariable [QGVAR(allowSharedEquipmentAccess), -1];
|
2015-02-22 14:01:31 +00:00
|
|
|
|
|
|
|
_return = false;
|
|
|
|
|
|
|
|
if (_accessLevel >= 0) then {
|
2015-11-30 16:14:05 +00:00
|
|
|
if (_accessLevel == 0) exitWith { _return = true; };
|
|
|
|
if (_accessLevel == 1) exitWith { _return = (side _target == side _caller); };
|
|
|
|
if (_accessLevel == 2) exitWith { _return = (group _target == group _caller); };
|
2015-02-22 14:01:31 +00:00
|
|
|
};
|
|
|
|
|
2015-08-22 14:25:10 +00:00
|
|
|
_return;
|