2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-09-04 09:25:03 +00:00
|
|
|
/*
|
|
|
|
* Author: BaerMitUmlaut
|
|
|
|
* Checks if there is a medic available in the unit's group.
|
|
|
|
*
|
|
|
|
* Arguments:
|
2024-07-23 13:28:40 +00:00
|
|
|
* Unit <OBJECT>
|
2016-09-04 09:25:03 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Can request medic <BOOL>
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
2024-07-23 13:28:40 +00:00
|
|
|
* player call ace_medical_ai_fnc_canRequestMedic
|
2017-06-08 13:31:51 +00:00
|
|
|
*
|
2016-09-04 09:25:03 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Note: Although an unconscious unit cannot call for a medic itself,
|
|
|
|
// we ignore this here. We need to "notice" the medic that he should
|
|
|
|
// treat other units, or else he won't do anything on his own.
|
|
|
|
|
2020-11-08 22:32:02 +00:00
|
|
|
private _isMedic = [_this] call EFUNC(medical_treatment,isMedic);
|
|
|
|
if (_isMedic && {!IS_UNCONSCIOUS(_this)} || {vehicle _this != _this}) exitWith {false};
|
2016-09-04 09:25:03 +00:00
|
|
|
|
2019-07-03 14:59:28 +00:00
|
|
|
// Search for a medic, prioritize unitReady
|
|
|
|
private _medic = objNull;
|
2016-09-04 09:25:03 +00:00
|
|
|
{
|
2019-07-03 14:59:28 +00:00
|
|
|
if ([_x] call EFUNC(medical_treatment,isMedic) && {!([_x] call EFUNC(common,isPlayer))} && {
|
|
|
|
_medic = _x;
|
|
|
|
(unitReady _medic)
|
|
|
|
}) exitWith {};
|
2016-09-04 09:25:03 +00:00
|
|
|
} forEach (units _this);
|
2019-07-03 14:59:28 +00:00
|
|
|
|
|
|
|
_this setVariable [QGVAR(assignedMedic), _medic];
|
|
|
|
!isNull _medic
|