ACE3/addons/medical_engine/functions/fnc_updateBodyPartVisuals.sqf

39 lines
1.3 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
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>
2017-06-08 18:50:38 +00:00
* 1: Update Head <BOOLEAN>
* 2: Update Body <BOOLEAN>
* 3: Update Arms <BOOLEAN>
* 4: Update Legs <BOOLEAN>
2016-10-07 02:21:01 +00:00
*
* Return Value:
* None
*
* Example:
2017-06-08 18:50:38 +00:00
* [player, true, true, true, true] call ace_medical_engine_fnc_updateBodyPartVisuals
2016-10-07 02:21:01 +00:00
*
* Public: No
*/
2017-06-08 18:50:38 +00:00
params ["_unit", "_updateHead", "_updateBody", "_updateArms", "_updateLegs"];
TRACE_5("updateBodyPartVisuals",_unit,_updateHead,_updateBody,_updateArms,_updateLegs);
2016-10-07 02:21:01 +00:00
2016-12-08 10:38:43 +00:00
private _bodyPartDamage = _unit getVariable [QEGVAR(medical,bodyPartDamage), [0,0,0,0,0,0]];
2017-06-08 18:50:38 +00:00
if (_updateHead) then {
[_unit, "head", (_bodyPartDamage select 0) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
};
if (_updateBody) then {
[_unit, "body", (_bodyPartDamage select 1) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
};
if (_updateArms) then {
[_unit, "arms", ((_bodyPartDamage select 2) max (_bodyPartDamage select 3)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
};
if (_updateLegs) then {
[_unit, "legs", ((_bodyPartDamage select 4) max (_bodyPartDamage select 5)) > VISUAL_BODY_DAMAGE_THRESHOLD] call FUNC(damageBodyPart);
};