mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical AI - Fix splints not being applied in special circumstance & setting adding multiple EH (#10141)
Several medical AI fixes - Not applying splints if too many medications were taken - Potential nil for _target - Setting could add multiple EH, require mission restart
This commit is contained in:
parent
cb3c18c2fb
commit
74de646a02
@ -20,5 +20,16 @@
|
||||
_unit setVariable [QGVAR(lastSuppressed), CBA_missionTime];
|
||||
}] call CBA_fnc_addClassEventHandler;
|
||||
|
||||
if (GVAR(requireItems) == 2) then {
|
||||
["CAManBase", "InitPost", {
|
||||
[{
|
||||
params ["_unit"];
|
||||
if ((!local _unit) || {!alive _unit} || {isPlayer _unit}) exitWith {};
|
||||
TRACE_2("replacing medical items on AI",_unit,typeOf _unit);
|
||||
[_unit] call EFUNC(common,replaceRegisteredItems);
|
||||
}, _this] call CBA_fnc_execNextFrame; // need to delay a frame before modifying items in a backpack
|
||||
}, nil, [IGNORE_BASE_UAVPILOTS], true] call CBA_fnc_addClassEventHandler;
|
||||
};
|
||||
|
||||
#include "stateMachine.inc.sqf"
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
|
@ -24,10 +24,10 @@ if IS_UNCONSCIOUS(_this) exitWith {
|
||||
|
||||
// Find next unit to treat
|
||||
private _healQueue = _this getVariable [QGVAR(healQueue), []];
|
||||
private _target = _healQueue select 0;
|
||||
private _target = _healQueue param [0, objNull];
|
||||
|
||||
// If unit died or was healed, be lazy and wait for the next tick
|
||||
if (isNull _target || {!alive _target} || {!(_target call FUNC(isInjured))}) exitWith {
|
||||
if (!alive _target || {!(_target call FUNC(isInjured))}) exitWith {
|
||||
_this forceSpeed -1;
|
||||
_target forceSpeed -1;
|
||||
_healQueue deleteAt 0;
|
||||
|
@ -87,9 +87,6 @@ switch (true) do {
|
||||
_treatmentArgs = [_target, selectRandom ["leftarm", "rightarm", "leftleg", "rightleg"], "SalineIV"];
|
||||
_treatmentItem = "@iv";
|
||||
};
|
||||
case ((count (_target getVariable [VAR_MEDICATIONS, []])) >= 6): {
|
||||
_treatmentEvent = "#tooManyMeds";
|
||||
};
|
||||
case (((_fractures select 4) == 1)
|
||||
&& {([_healer, "splint"] call FUNC(itemCheck)) # 0}): {
|
||||
_treatmentEvent = QEGVAR(medical_treatment,splintLocal);
|
||||
@ -104,6 +101,9 @@ switch (true) do {
|
||||
_treatmentArgs = [_healer, _target, "rightleg"];
|
||||
_treatmentItem = "splint";
|
||||
};
|
||||
case ((count (_target getVariable [VAR_MEDICATIONS, []])) >= 6): {
|
||||
_treatmentEvent = "#tooManyMeds";
|
||||
};
|
||||
case ((IS_UNCONSCIOUS(_target) || {_heartRate <= 50})
|
||||
&& {([_healer, "epinephrine"] call FUNC(itemCheck)) # 0}): {
|
||||
if (CBA_missionTime < (_target getVariable [QGVAR(nextEpinephrine), -1])) exitWith {
|
||||
|
@ -1,7 +1,8 @@
|
||||
private _categoryArray = [ELSTRING(medical,Category), "STR_TEAM_SWITCH_AI"];
|
||||
|
||||
[
|
||||
QGVAR(enabledFor), "LIST",
|
||||
QGVAR(enabledFor),
|
||||
"LIST",
|
||||
[LLSTRING(enableFor_title), LLSTRING(enableFor_desc)],
|
||||
_categoryArray,
|
||||
[
|
||||
@ -15,7 +16,8 @@ private _categoryArray = [ELSTRING(medical,Category), "STR_TEAM_SWITCH_AI"];
|
||||
] call CBA_fnc_addSetting;
|
||||
|
||||
[
|
||||
QGVAR(requireItems), "LIST",
|
||||
QGVAR(requireItems),
|
||||
"LIST",
|
||||
[LSTRING(requireItems_title), LSTRING(requireItems_desc)],
|
||||
_categoryArray,
|
||||
[
|
||||
@ -24,16 +26,6 @@ private _categoryArray = [ELSTRING(medical,Category), "STR_TEAM_SWITCH_AI"];
|
||||
0
|
||||
],
|
||||
true, // isGlobal
|
||||
{
|
||||
if (GVAR(requireItems) != 2) exitWith {};
|
||||
["CAManBase", "initPost", {
|
||||
[{
|
||||
params ["_unit"];
|
||||
if ((!local _unit) || {!alive _unit} || {isPlayer _unit}) exitWith {};
|
||||
TRACE_2("replacing medical items on AI",_unit,typeOf _unit);
|
||||
[_unit] call EFUNC(common,replaceRegisteredItems);
|
||||
}, _this] call CBA_fnc_execNextFrame; // need to delay a frame before modifying items in a backpack
|
||||
}, nil, [IGNORE_BASE_UAVPILOTS], true] call CBA_fnc_addClassEventHandler;
|
||||
},
|
||||
{[QGVAR(requireItems), _this] call EFUNC(common,cbaSettings_settingChanged)},
|
||||
true // Needs mission restart
|
||||
] call CBA_fnc_addSetting;
|
||||
|
Loading…
Reference in New Issue
Block a user