Skip to content

Commit

Permalink
Merge pull request #4216 from acemod/healHitPoint
Browse files Browse the repository at this point in the history
Heal hitpoint after bandage sets bodyPartStatus
  • Loading branch information
thojkooi authored Aug 7, 2016
2 parents ff297e3 + c46b2d0 commit c2d127f
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions addons/medical/functions/fnc_treatmentAdvanced_bandageLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ if (GVAR(healHitPointAfterAdvBandage) || {GVAR(level) < 2}) then {
// Tally of unbandaged wounds to each body part.
private _headWounds = 0;
private _bodyWounds = 0;
private _legsWounds = 0;
private _armWounds = 0;
private _leftArmWounds = 0;
private _leftLegWounds = 0;
private _rightArmWounds = 0;
private _rightLegWounds = 0;

// Loop through all current wounds and add up the number of unbandaged wounds on each body part.
{
Expand All @@ -132,42 +134,52 @@ if (GVAR(healHitPointAfterAdvBandage) || {GVAR(level) < 2}) then {

// Left Arm
case 2: {
_armWounds = _armWounds + (_numOpenWounds * _bloodLoss);
_leftArmWounds = _leftArmWounds + (_numOpenWounds * _bloodLoss);
};

// Right Arm
case 3: {
_armWounds = _armWounds + (_numOpenWounds * _bloodLoss);
_rightArmWounds = _rightArmWounds + (_numOpenWounds * _bloodLoss);
};

// Left Leg
case 4: {
_legsWounds = _legsWounds + (_numOpenWounds * _bloodLoss);
_leftLegWounds = _leftLegWounds + (_numOpenWounds * _bloodLoss);
};

// Right Leg
case 5: {
_legsWounds = _legsWounds + (_numOpenWounds * _bloodLoss);
_rightLegWounds = _rightLegWounds + (_numOpenWounds * _bloodLoss);
};
};
} forEach _currentWounds;

// ["head", "body", "hand_l", "hand_r", "leg_l", "leg_r"]
private _bodyStatus = _target getVariable [QGVAR(bodyPartStatus), [0,0,0,0,0,0]];

// Any body part that has no wounds is healed to full health
if (_headWounds == 0) then {
_target setHitPointDamage ["hitHead", 0.0];
_bodyStatus set [0, 0];
};

if (_bodyWounds == 0) then {
_target setHitPointDamage ["hitBody", 0.0];
_bodyStatus set [1, 0];
};

if (_armWounds == 0) then {
_target setHitPointDamage ["hitHands", 0.0];
if (_leftArmWounds == 0) then {
_bodyStatus set [2, 0];
};

if (_legsWounds == 0) then {
_target setHitPointDamage ["hitLegs", 0.0];
if (_rightArmWounds == 0) then {
_bodyStatus set [3, 0];
};
if (_leftLegWounds == 0) then {
_bodyStatus set [4, 0];
};
if (_rightLegWounds == 0) then {
_bodyStatus set [5, 0];
};

_target setVariable [QGVAR(bodyPartStatus), _bodyStatus, true];

[_target] call FUNC(handleDamage_advancedSetDamage);
};

true;

0 comments on commit c2d127f

Please sign in to comment.