ACE3/addons/medical_engine/functions/fnc_damageBodyPart.sqf
Grim e06c6f7835
General - Replace toLower with toLowerANSI where applicable (#9790)
* General - Replace toLower with toLowerANSI where applicable

* whoops

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* Update addons/repair/functions/fnc_setHitPointDamage.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/repair/dev/draw_showRepairInfo.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/tagging/XEH_preStart.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/vehicle_damage/functions/fnc_handleCookoff.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Update addons/tagging/XEH_preStart.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* comparment -> compartment

* Update fnc_showHud.sqf

* Update fnc_registerObjects.sqf

* Update addons/common/functions/fnc_cbaSettings_settingChanged.sqf

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
2024-03-07 22:08:13 +01:00

45 lines
1.1 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: commy2
* Damages a body part of a local unit. Does not kill the unit.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Selection, can be "Head", "Body", "Arms" or "Legs" <STRING>
* 2: Damaged <BOOLEAN>
*
* Return Value:
* None
*
* Example:
* [player, "HEAD", true] call ace_medical_engine_fnc_damageBodyPart
*
* Notes:
* Head: Blood visuals @ 0.45
* Body: Blood visuals @ 0.45
* Arms: Blood visuals @ 0.35, increases weapon sway linerarly
* Legs: Blood visuals @ 0.35, limping @ 0.5
*
* Public: No
*/
params ["_unit", "_selection", "_damage"];
TRACE_3("damageBodyPart",_unit,_selection,_damage);
_damage = [0, DAMAGED_MIN_THRESHOLD] select _damage;
switch (toLowerANSI _selection) do {
case ("head"): {
_unit setHitPointDamage ["HitHead", _damage];
};
case ("body"): {
_unit setHitPointDamage ["HitBody", _damage];
};
case ("arms"): {
_unit setHitPointDamage ["HitHands", _damage];
};
case ("legs"): {
_unit setHitPointDamage ["HitLegs", _damage + ([0, LIMPING_MIN_DAMAGE] select (_unit getVariable [QEGVAR(medical,isLimping), false]))];
};
};