mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
e2ac18a05d
* advanced_ballistics * advanced_fatigue * advanced_throwing * ai * aircraft * arsenal * atragmx * attach * backpacks * ballistics * captives * cargo * chemlights * common * concertina_wire * cookoff * dagr * disarming * disposable * dogtags * dragging * explosives * fastroping * fcs * finger * frag * gestures * gforces * goggles * grenades * gunbag * hearing * hitreactions * huntir * interact_menu * interaction * inventory * kestrel4500 * laser * laserpointer * logistics_uavbattery * logistics_wirecutter * magazinerepack * map * map_gestures * maptools * markers * medical * medical_ai * medical_blood * medical_menu * microdagr * minedetector * missileguidance * missionmodules * mk6mortar * modules * movement * nametags * nightvision * nlaw * optics * optionsmenu * overheating * overpressure * parachute * pylons * quickmount * rangecard * rearm * recoil * refuel * reload * reloadlaunchers * repair * respawn * safemode * sandbag * scopes * slideshow * spectator * spottingscope * switchunits * tacticalladder * tagging * trenches * tripod * ui * vector * vehiclelock * vehicles * viewdistance * weaponselect * weather * winddeflection * yardage450 * zeus * arsenal defines.hpp * optionals * DEBUG_MODE_FULL 1 * DEBUG_MODE_FULL 2 * Manual fixes * Add SQF Validator check for #include after block comment * explosives fnc_openTimerUI * fix uniqueItems
59 lines
1.9 KiB
Plaintext
59 lines
1.9 KiB
Plaintext
#include "script_component.hpp"
|
|
/*
|
|
* Author: BaerMitUmlaut
|
|
* Makes the unit heal itself.
|
|
*
|
|
* Arguments:
|
|
* None
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* call ACE_medical_ai_fnc_healSelf
|
|
*
|
|
* Public: No
|
|
*/
|
|
|
|
// Player will have to do this manually of course
|
|
if ([_this] call EFUNC(common,isPlayer)) exitWith {};
|
|
// Can't heal self when unconscious
|
|
if (_this getVariable ["ACE_isUnconscious", false]) exitWith {};
|
|
// Check if we're still treating
|
|
if ((_this getVariable [QGVAR(treatmentOverAt), CBA_missionTime]) > CBA_missionTime) exitWith {};
|
|
|
|
private _needsBandaging = ([_this] call EFUNC(medical,getBloodLoss)) > 0;
|
|
private _needsMorphine = (_this getVariable [QEGVAR(medical,pain), 0]) > 0.2;
|
|
|
|
switch (true) do {
|
|
case _needsBandaging: {
|
|
// Select first wound and bandage it
|
|
private _openWounds = _this getVariable [QEGVAR(medical,openWounds), []];
|
|
private _partIndex = {
|
|
_x params ["", "", "_index", "_amount", "_percentage"];
|
|
if (_amount * _percentage > 0) exitWith {
|
|
_index
|
|
};
|
|
} forEach _openWounds;
|
|
private _selection = ["head","body","hand_l","hand_r","leg_l","leg_r"] select _partIndex;
|
|
[_this, "Bandage", _selection] call EFUNC(medical,treatmentAdvanced_bandageLocal);
|
|
|
|
#ifdef DEBUG_MODE_FULL
|
|
systemChat format ["%1 is bandaging selection %2", _this, _selection];
|
|
#endif
|
|
|
|
// Play animation
|
|
[_this, true, true] call FUNC(playTreatmentAnim);
|
|
_this setVariable [QGVAR(treatmentOverAt), CBA_missionTime + 5];
|
|
};
|
|
case _needsMorphine: {
|
|
[_this] call EFUNC(medical,treatmentBasic_morphineLocal);
|
|
[_this, false, true] call FUNC(playTreatmentAnim);
|
|
_this setVariable [QGVAR(treatmentOverAt), CBA_missionTime + 2];
|
|
|
|
#ifdef DEBUG_MODE_FULL
|
|
systemChat format ["%1 is giving himself morphine", _this];
|
|
#endif
|
|
};
|
|
};
|