Medical AI - Add setting to replace gear for AI (#9458)

This commit is contained in:
PabstMirror 2023-10-04 13:19:10 -05:00 committed by GitHub
parent f088d9bfa1
commit 8143cdc1da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 9 deletions

View File

@ -24,7 +24,7 @@ if (_finishTime > 0) exitWith {
if (CBA_missionTime >= _finishTime) then {
TRACE_5("treatment finished",_finishTime,_treatmentTarget,_treatmentEvent,_treatmentArgs,_treatmentItem);
_healer setVariable [QGVAR(currentTreatment), nil];
if ((GVAR(requireItems)) && {_treatmentItem != ""}) then {
if ((GVAR(requireItems) > 0) && {_treatmentItem != ""}) then {
([_healer, _treatmentItem] call FUNC(itemCheck)) params ["_itemOk", "_itemClassname", "_treatmentClass"];
if (!_itemOk) exitWith { _treatmentEvent = "#fail"; }; // no item after delay
_healer removeItem _itemClassname;

View File

@ -18,7 +18,7 @@
* Public: No
*/
if (!GVAR(requireItems)) exitWith { [true] };
if (GVAR(requireItems) == 0) exitWith { [true] };
params ["_healer", "_treatementType"];

View File

@ -15,11 +15,25 @@ private _categoryArray = [ELSTRING(medical,Category), "STR_TEAM_SWITCH_AI"];
] call CBA_fnc_addSetting;
[
QGVAR(requireItems), "CHECKBOX",
QGVAR(requireItems), "LIST",
[LSTRING(requireItems_title), LSTRING(requireItems_desc)],
_categoryArray,
false,
[
[0, 1, 2],
[LELSTRING(Common,Disabled), LELSTRING(Common,Enabled), format ["%1 - %2", LELSTRING(Common,Enabled), LLSTRING(requireItems_autoReplaceItems)]],
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;
},
true // Needs mission restart
] call CBA_fnc_addSetting;

View File

@ -55,10 +55,13 @@
<Korean>아이템 필요</Korean>
</Key>
<Key ID="STR_ACE_Medical_AI_requireItems_desc">
<English>AI will only perform medical treatment if they have the necessary items in their inventory.\nRequires custom AI loadouts!</English>
<Polish>AI będzie wykonywać zabiegi medyczne tylko wtedy, gdy ma w ekwipunku niezbędne przedmioty. \nWymaga niestandardowego wyposażenia AI!</Polish>
<German>Die KI führt nur dann medizinische Behandlungen durch, wenn sie die erforderlichen Gegenstände in ihrem Inventar hat.\nErfordert benutzerdefinierte KI-Ausrüstungen!</German>
<Korean>소지품에 필요한 아이템이 있을 경우에만 인공지능이 치료를 진행합니다.\n커스텀한 인공지능 로드아웃이 필요합니다!</Korean>
<English>AI will only perform medical treatment if they have the necessary items in their inventory.</English>
<Polish>AI będzie wykonywać zabiegi medyczne tylko wtedy, gdy ma w ekwipunku niezbędne przedmioty.</Polish>
<German>Die KI führt nur dann medizinische Behandlungen durch, wenn sie die erforderlichen Gegenstände in ihrem Inventar hat.</German>
<Korean>소지품에 필요한 아이템이 있을 경우에만 인공지능이 치료를 진행합니다.</Korean>
</Key>
<Key ID="STR_ACE_Medical_AI_requireItems_autoReplaceItems">
<English>Auto Convert Items for AI</English>
</Key>
</Package>
</Project>