2016-10-07 02:21:01 +00:00
|
|
|
/*
|
|
|
|
* Author: commy2
|
|
|
|
* Damages a body part of a local unit. Does not kill the unit.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit <OBJECT>
|
|
|
|
* 1: Body part, can be "Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg" or "All" <STRING>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [player, "HEAD"] call ace_medical_engine_fnc_updateBodyPartVisuals
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2016-10-07 03:10:43 +00:00
|
|
|
params ["_unit", "_bodyPart"];
|
2016-10-07 02:21:01 +00:00
|
|
|
|
|
|
|
if (_bodyPart == "All") exitWith {
|
|
|
|
[_unit, "Head"] call FUNC(updateBodyPartVisuals);
|
|
|
|
[_unit, "Body"] call FUNC(updateBodyPartVisuals);
|
|
|
|
[_unit, "LeftArm"] call FUNC(updateBodyPartVisuals);
|
|
|
|
[_unit, "RightArm"] call FUNC(updateBodyPartVisuals);
|
|
|
|
[_unit, "LeftLeg"] call FUNC(updateBodyPartVisuals);
|
|
|
|
[_unit, "RightLeg"] call FUNC(updateBodyPartVisuals);
|
|
|
|
};
|
|
|
|
|
|
|
|
private _affectedBodyParts = [_bodyPart];
|
|
|
|
|
|
|
|
switch (toLower _bodyPart) do {
|
|
|
|
case "leftarm";
|
|
|
|
case "rightarm": {
|
|
|
|
_bodyPart = "Arms";
|
|
|
|
_affectedBodyParts = ["LeftArm", "RightArm"];
|
|
|
|
};
|
|
|
|
|
|
|
|
case "leftleg";
|
|
|
|
case "rightleg": {
|
|
|
|
_bodyPart = "Legs";
|
|
|
|
_affectedBodyParts = ["LeftLeg", "RightLeg"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2016-12-08 10:38:43 +00:00
|
|
|
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
|
2016-12-05 20:34:20 +00:00
|
|
|
private _damageOnAffectedBodyParts = 0;
|
2016-10-07 02:21:01 +00:00
|
|
|
{
|
2016-10-13 07:47:52 +00:00
|
|
|
private _partIndex = ALL_BODY_PARTS find toLower _x;
|
2016-12-08 10:38:43 +00:00
|
|
|
private _damageOnBodyPart = _bodyPartDamage select _partIndex;
|
2016-10-07 02:21:01 +00:00
|
|
|
// report maximum of both legs or arms
|
2016-12-05 20:34:20 +00:00
|
|
|
_damageOnAffectedBodyParts = _damageOnAffectedBodyParts max _damageOnBodyPart;
|
2016-10-07 02:21:01 +00:00
|
|
|
} forEach _affectedBodyParts;
|
|
|
|
|
2016-12-08 10:38:43 +00:00
|
|
|
[_unit, _bodyPart, _damageOnAffectedBodyParts > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
|