Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/medical_ai/functions/fnc_healingLogic.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion addons/medical_ai/functions/fnc_itemCheck.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Public: No
*/

if (!GVAR(requireItems)) exitWith { [true] };
if (GVAR(requireItems) == 0) exitWith { [true] };

params ["_healer", "_treatementType"];

Expand Down
20 changes: 17 additions & 3 deletions addons/medical_ai/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
11 changes: 7 additions & 4 deletions addons/medical_ai/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>