Skip to content

Commit

Permalink
Merge pull request #11 from MissHeda/Fix-BloodDrawBug
Browse files Browse the repository at this point in the history
Fix blood draw bug
  • Loading branch information
MissHeda committed Feb 26, 2024
2 parents 400806d + 29040d6 commit 7346720
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions addons/circulation/ACE_Medical_Treatment_Actions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ACE_Medical_Treatment_Actions {
medicRequired = 0;
consumeItem = 1;
callbackSuccess = QUOTE([ARR_3(_medic,_patient,500)] call FUNC(drawBlood));
condition = QUOTE([ARR_3(_medic,_patient,500)] call FUNC(canDraw));
condition = QUOTE([ARR_3(_medic,_patient,500)] call FUNC(canDraw) && (!(EGVAR(pharma,RequireInsIV)) || EFUNC(pharma,removeIV)));
items[] = {"KAT_Empty_bloodIV_500"};
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
Expand All @@ -57,7 +57,7 @@ class ACE_Medical_Treatment_Actions {
medicRequired = 0;
consumeItem = 1;
callbackSuccess = QUOTE([ARR_3(_medic,_patient,250)] call FUNC(drawBlood));
condition = QUOTE([ARR_3(_medic,_patient,250)] call FUNC(canDraw));
condition = QUOTE([ARR_3(_medic,_patient,250)] call FUNC(canDraw) && (!(EGVAR(pharma,RequireInsIV)) || EFUNC(pharma,removeIV)));
items[] = {"KAT_Empty_bloodIV_250"};
animationPatient = "";
animationPatientUnconscious = "AinjPpneMstpSnonWrflDnon_rolltoback";
Expand Down
3 changes: 1 addition & 2 deletions addons/circulation/functions/fnc_canDraw.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ params ["_medic", "_patient", "_volume"];
private _bagItem = format ["ACE_bloodIV_%1", _volume];
private _bloodVolume = (_patient getVariable [QACEGVAR(medical,bloodVolume), 6.0]);
private _volumeChange = _volume/1000;
private _canAddItem = ((_medic canAddItemToUniform _bagItem) || (_medic canAddItemToVest _bagItem) || (_medic canAddItemToBackpack _bagItem)); // make sure the blood can actually be added to the medic, so you don't just lose blood
if (((_bloodVolume - _volumeChange) > GVAR(blood_draw_limit)) && _canAddItem) exitWith {true};
if (((_bloodVolume - _volumeChange) > GVAR(blood_draw_limit))) exitWith {true};
false
4 changes: 2 additions & 2 deletions addons/circulation/functions/fnc_drawBlood.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* None
*
* Example:
* [medic, medic, 500] call kat_circulation_fnc_drawBlood;
* [medic, patient, 500] call kat_circulation_fnc_drawBlood;
*
* Public: No
*/
Expand All @@ -31,5 +31,5 @@ if (GVAR(bloodGroups)) then {
_bloodtypeStr = format ["_%1",_bloodtype];
};
private _itemStr = format ["%1bloodIV%2%3",_modStr,_bloodtypeStr,_bagVolumeStr];
_medic addItem _itemStr;
[_medic, _itemStr] call ACEFUNC(common,addToInventory);
_patient setVariable [QACEGVAR(medical,bloodVolume), _bloodVolume - _volumeChange,true];

0 comments on commit 7346720

Please sign in to comment.