Made AI medic use epipen on unconscious patients (#5433)

* Made AI medic use epipen on unconscious patients

* Fix epi heal args, use non-local treatment funcs
This commit is contained in:
LordGolias 2017-10-14 21:43:53 +03:00 committed by jonpas
parent 65c5e6e38e
commit 8d9c17ed88
2 changed files with 16 additions and 6 deletions

View File

@ -54,6 +54,7 @@ _target forceSpeed 0;
private _needsBandaging = ([_target] call EFUNC(medical,getBloodLoss)) > 0;
private _needsMorphine = (_target getVariable [QEGVAR(medical,pain), 0]) > 0.2;
private _needsEpinephrine = _target getVariable ["ACE_isUnconscious", false];
switch (true) do {
case _needsBandaging: {
@ -66,7 +67,7 @@ switch (true) do {
};
} forEach _openWounds;
private _selection = ["head","body","hand_l","hand_r","leg_l","leg_r"] select _partIndex;
[_target, "Bandage", _selection] call EFUNC(medical,treatmentAdvanced_bandageLocal);
[_this, _target, _selection, "Bandage"] call EFUNC(medical,treatmentAdvanced_bandage);
#ifdef DEBUG_MODE_FULL
systemChat format ["%1 is bandaging selection %2 on %3", _this, _selection, _target];
@ -77,7 +78,7 @@ switch (true) do {
_this setVariable [QGVAR(treatmentOverAt), CBA_missionTime + 5];
};
case _needsMorphine: {
[_target] call EFUNC(medical,treatmentBasic_morphineLocal);
[_this, _target] call EFUNC(medical,treatmentBasic_morphine);
[_this, false, false] call FUNC(playTreatmentAnim);
_this setVariable [QGVAR(treatmentOverAt), CBA_missionTime + 2];
@ -85,4 +86,13 @@ switch (true) do {
systemChat format ["%1 is giving %2 morphine", _this, _target];
#endif
};
case _needsEpinephrine: {
[_this, _target] call EFUNC(medical,treatmentBasic_epipen);
[_this, false, false] call FUNC(playTreatmentAnim);
_this setVariable [QGVAR(treatmentOverAt), CBA_missionTime + 2];
#ifdef DEBUG_MODE_FULL
systemChat format ["%1 is using an epipen on %2", _this, _target];
#endif
};
};

View File

@ -17,9 +17,9 @@
if !(alive _this) exitWith {false};
private _bloodLoss = [_this] call EFUNC(medical,getBloodLoss);
private _pain = _this getVariable [QEGVAR(medical,pain), 0];
// Advanced only?
private _bloodLoss = [_this] call EFUNC(medical,getBloodLoss);
private _pain = _this getVariable [QEGVAR(medical,pain), 0];
private _unconscious = _this getVariable ["ACE_isUnconscious", false];
// private _heartRate = _this getVariable [QEGVAR(medical,heartRate), 70];
(_bloodLoss > 0) || {_pain > 0.2} // || {_heartRate > 100} || {_heartRate < 40}
(_bloodLoss > 0) || {_pain > 0.2} || _unconscious // || {_heartRate > 100} || {_heartRate < 40}