Medical Treatment - Only create litter on empty container (#9924)

This commit is contained in:
PabstMirror 2024-04-06 20:11:51 -05:00 committed by GitHub
parent f5e8e06c24
commit 5ca3465b8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 10 deletions

View File

@ -52,7 +52,7 @@ private _userAndItem = if (GET_NUMBER_ENTRY(_config >> "consumeItem") == 1) then
[objNull, ""]; // Treatment does not require items to be consumed
};
_userAndItem params ["_itemUser", "_usedItem"];
_userAndItem params ["_itemUser", "_usedItem", "_createLitter"];
private _isInZeus = !isNull findDisplay 312;
@ -161,7 +161,7 @@ if (_callbackProgress isEqualTo {}) then {
[
_treatmentTime,
[_medic, _patient, _bodyPart, _classname, _itemUser, _usedItem],
[_medic, _patient, _bodyPart, _classname, _itemUser, _usedItem, _createLitter],
FUNC(treatmentSuccess),
FUNC(treatmentFailure),
getText (_config >> "displayNameProgress"),

View File

@ -11,6 +11,7 @@
* 3: Treatment <STRING>
* 4: Item User <OBJECT>
* 5: Used Item <STRING>
* 6: Create Litter <BOOL>
*
* Return Value:
* None
@ -19,7 +20,8 @@
*/
params ["_args"];
_args params ["_medic", "_patient", "_bodyPart", "_classname", "_itemUser", "_usedItem"];
_args params ["_medic", "_patient", "_bodyPart", "_classname", "_itemUser", "_usedItem", "_createLitter"];
TRACE_7("",_medic,_patient,_bodyPart,_classname,_itemUser,_usedItem,_createLitter);
// Switch medic to end animation immediately
private _endInAnim = _medic getVariable QGVAR(endInAnim);
@ -45,7 +47,7 @@ GET_FUNCTION(_callbackSuccess,configFile >> QGVAR(actions) >> _classname >> "cal
_args call _callbackSuccess;
// Call litter creation handler
_args call FUNC(createLitter);
if (_createLitter) then { _args call FUNC(createLitter); };
// Emit local event for medical API
["ace_treatmentSucceded", [_medic, _patient, _bodyPart, _classname, _itemUser, _usedItem]] call CBA_fnc_localEvent;

View File

@ -10,7 +10,7 @@
* 2: Items <ARRAY>
*
* Return Value:
* User and Item <ARRAY>
* User and Item and Litter Created<ARRAY>
*
* Example:
* [player, cursorObject, ["bandage"]] call ace_medical_treatment_fnc_useItem
@ -40,22 +40,24 @@ private _useOrder = [[_patient, _medic], [_medic, _patient], [_medic]] select GV
switch (true) do {
case (_x in _vehicleItems): {
_unitVehicle addItemCargoGlobal [_x, -1];
[_unit, _x] breakOut "Main";
[_unit, _x, false] breakOut "Main";
};
case (_x in _vehicleMagazines): {
[_unitVehicle, _x] call EFUNC(common,adjustMagazineAmmo);
[_unit, _x] breakOut "Main";
[_unit, _x, false] breakOut "Main";
};
case (_x in _unitItems): {
_unit removeItem _x;
[_unit, _x] breakOut "Main";
[_unit, _x, true] breakOut "Main";
};
case (_x in _unitMagazines): {
private _magsStart = count magazines _unit;
[_unit, _x] call EFUNC(common,adjustMagazineAmmo);
[_unit, _x] breakOut "Main";
private _magsEnd = count magazines _unit;
[_unit, _x, (_magsEnd < _magsStart)] breakOut "Main";
};
};
} forEach _items;
} forEach _useOrder;
[objNull, ""]
[objNull, "", false]