-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99f8009
commit 56256c8
Showing
6 changed files
with
65 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: Glowbal, mharis001, Cplhardcore | ||
* Local callback for administering an IV bag to a patient. | ||
* | ||
* Arguments: | ||
* 0: Patient <OBJECT> | ||
* 1: Body Part <STRING> | ||
* 2: Treatment <STRING> | ||
* 3: Medic <OBJECT> | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [player, "RightArm", "BloodIV", player] call ace_medical_treatment_fnc_ivBagLocal | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_patient", "_bodyPart", "_classname", "_medic"]; | ||
|
||
// Exit if patient has max blood volume | ||
private _bloodVolume = GET_BLOOD_VOLUME_LITERS(_patient); | ||
if (_bloodVolume >= DEFAULT_BLOOD_VOLUME) exitWith { | ||
// Return the bag if patient is topped up on blood | ||
if (_medic call ACEFUNC(common,isPlayer)) then { | ||
private _receiver = [_patient, _medic, _medic] select GVAR(allowSharedEquipment); | ||
[_receiver, _classname] call EFUNC(common,addToInventory); | ||
TRACE_4("ivBagLocal"_patient,_medic,_receiver,_classname); | ||
} else { | ||
// If the medic is AI, only return bag if enabled | ||
if (missionNamespace getVariable [QEGVAR(medical_ai,requireItems), 0] > 0) then { | ||
[_medic, _classname] call EFUNC(common,addToInventory); | ||
}; | ||
}; | ||
}; | ||
|
||
private _partIndex = ALL_BODY_PARTS find toLowerANSI _bodyPart; | ||
|
||
// Get attributes for the used IV | ||
private _defaultConfig = configFile >> QUOTE(ADDON) >> "IV"; | ||
private _ivConfig = _defaultConfig >> _classname; | ||
|
||
private _volume = GET_NUMBER(_ivConfig >> "volume",getNumber (_defaultConfig >> "volume")); | ||
private _type = GET_STRING(_ivConfig >> "type",getText (_defaultConfig >> "type")); | ||
private _rateCoef = GET_NUMBER(_ivConfig >> "rateCoef",getNumber (_defaultConfig >> "rateCoef")); | ||
|
||
// Add IV bag to patient's ivBags array | ||
private _ivBags = _patient getVariable [QEGVAR(medical,ivBags), []]; | ||
_ivBags pushBack [_volume, _type, _partIndex, _classname, _rateCoef]; | ||
_patient setVariable [QEGVAR(medical,ivBags), _ivBags, true]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters