2018-07-30 09:22:14 +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:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Can request medic <BOOL>
|
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
2019-07-03 14:59:28 +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.
|
|
|
|
|
2018-07-18 10:09:48 +00:00
|
|
|
if ([_this] call EFUNC(medical_treatment,isMedic) || {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
|