mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Medical - Add option to prevent scripted injuries on invulnerable units (#8599)
* Medical - Add option to prevent scripted injuries on invulnerable units * Update docs * Change from CBA setting to optional parameter * Update header arguments to follow coding guidelines Co-authored-by: jonpas <jonpas33@gmail.com> * Update addons/medical/functions/fnc_addDamageToUnit.sqf Co-authored-by: PabstMirror <pabstmirror@gmail.com> * Increase readibility * Fix trace macro * Update addons/medical/functions/fnc_addDamageToUnit.sqf * Update addons/medical/functions/fnc_addDamageToUnit.sqf Co-authored-by: jonpas <jonpas33@gmail.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com> Co-authored-by: BaerMitUmlaut <BaerMitUmlaut@users.noreply.github.com>
This commit is contained in:
parent
422c47aae6
commit
5bad6899cb
@ -9,7 +9,8 @@
|
||||
* 2: Body part ("Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg") <STRING>
|
||||
* 3: Projectile Type <STRING>
|
||||
* 4: Source <OBJECT>
|
||||
* 5: Non-directional damage source array (Optional) <ARRAY>
|
||||
* 5: Non-directional damage source array <ARRAY> (default: [])
|
||||
* 6: Override Invulnerability <BOOL> (default: true)
|
||||
*
|
||||
* Return Value:
|
||||
* Successful <BOOL>
|
||||
@ -22,8 +23,16 @@
|
||||
*/
|
||||
// #define DEBUG_TESTRESULTS
|
||||
|
||||
params [["_unit", objNull, [objNull]], ["_damageToAdd", -1, [0]], ["_bodyPart", "", [""]], ["_typeOfDamage", "", [""]], ["_instigator", objNull, [objNull]], ["_damageSelectionArray", [], [[]]]];
|
||||
TRACE_6("addDamageToUnit",_unit,_damageToAdd,_bodyPart,_typeOfDamage,_instigator,_damageSelectionArray);
|
||||
params [
|
||||
["_unit", objNull, [objNull]],
|
||||
["_damageToAdd", -1, [0]],
|
||||
["_bodyPart", "", [""]],
|
||||
["_typeOfDamage", "", [""]],
|
||||
["_instigator", objNull, [objNull]],
|
||||
["_damageSelectionArray", [], [[]]],
|
||||
["_overrideInvuln", true, [true]]
|
||||
];
|
||||
TRACE_7("addDamageToUnit",_unit,_damageToAdd,_bodyPart,_typeOfDamage,_instigator,_damageSelectionArray,_overrideInvuln);
|
||||
|
||||
_bodyPart = toLower _bodyPart;
|
||||
private _bodyPartIndex = ALL_BODY_PARTS find _bodyPart;
|
||||
@ -32,6 +41,10 @@ if (_bodyPartIndex < 0) exitWith {ERROR_1("addDamageToUnit - bad selection %1",
|
||||
if (isNull _unit || {!local _unit} || {!alive _unit}) exitWith {ERROR_2("addDamageToUnit - badUnit %1 [local %2]", _this, local _unit); false};
|
||||
if (_damageToAdd < 0) exitWith {ERROR_1("addDamageToUnit - bad damage %1", _this); false};
|
||||
|
||||
if (!_overrideInvuln && {!((isDamageAllowed _unit) && {_unit getVariable [QEGVAR(medical,allowDamage), true]})}) exitWith {
|
||||
ERROR_1("addDamageToUnit - unit invulnerable %1", _this); false
|
||||
};
|
||||
|
||||
// Extension is case sensitive and expects this format (different from ALL_BODY_PARTS)
|
||||
_bodyPart = ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"] select _bodyPartIndex;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user