mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added canAccessMedicalEquipment check
This commit is contained in:
parent
7f6a647b4d
commit
ab6bc998c2
@ -50,6 +50,7 @@ PREP(hasTourniquetAppliedTo);
|
||||
PREP(isMedic);
|
||||
PREP(isInMedicalFacility);
|
||||
PREP(isMedicalVehicle);
|
||||
PREP(canAccessMedicalEquipment);
|
||||
|
||||
GVAR(injuredUnitCollection) = [];
|
||||
call FUNC(parseConfigForInjuries);
|
||||
|
31
addons/medical/functions/fnc_canAccessMedicalEquipment.sqf
Normal file
31
addons/medical/functions/fnc_canAccessMedicalEquipment.sqf
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
private ["_target", "_caller", "_accessLevel", "_return"];
|
||||
_caller = _this select 0;
|
||||
_target = _this select 1;
|
||||
|
||||
_accessLevel = _target getvariable [QGVAR(allowSharedEquipmentAccess), -1];
|
||||
|
||||
_return = false;
|
||||
|
||||
if (_accessLevel >= 0) then {
|
||||
if (_accessLevel == 0) exitwith { _return = true; };
|
||||
if (_accessLevel == 1) exitwith { _return = (side _target == side _caller); };
|
||||
if (_accessLevel == 2) exitwith { _return = (group _target == group _caller); };
|
||||
};
|
||||
|
||||
_return;
|
@ -35,7 +35,7 @@ _return = false;
|
||||
if ([vehicle _medic] call FUNC(isMedicalVehicle) && {(vehicle _medic != _medic)}) then {
|
||||
_crew = crew vehicle _medic;
|
||||
{
|
||||
if ([_x, _medic] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith {
|
||||
if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith {
|
||||
_return = true;
|
||||
};
|
||||
}foreach _crew;
|
||||
|
@ -38,7 +38,7 @@ _return = false;
|
||||
if ([vehicle _medic] call FUNC(isMedicalVehicle) && {vehicle _medic != _medic}) then {
|
||||
_crew = crew vehicle _medic;
|
||||
{
|
||||
if ([_x, _medic] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith {
|
||||
if ([_medic, _x] call FUNC(canAccessMedicalEquipment) && {([_x, _item] call EFUNC(common,hasItem))}) exitwith {
|
||||
_return = true;
|
||||
[[_x, _item], QUOTE(EFUNC(common,useItem)), _x] call EFUNC(common,execRemoteFnc);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user