Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Medical - Add option to prevent scripted injuries on invulnerable units #8599

Merged
merged 14 commits into from
Nov 8, 2021
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion addons/medical/functions/fnc_addDamageToUnit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* 3: Projectile Type <STRING>
* 4: Source <OBJECT>
* 5: Non-directional damage source array (Optional) <ARRAY>
* 6: Override Invulnerability (Optional, Default: true) <BOOLEAN>
mjc4wilton marked this conversation as resolved.
Show resolved Hide resolved
*
* Return Value:
* Successful <BOOL>
Expand All @@ -22,7 +23,7 @@
*/
// #define DEBUG_TESTRESULTS

params [["_unit", objNull, [objNull]], ["_damageToAdd", -1, [0]], ["_bodyPart", "", [""]], ["_typeOfDamage", "", [""]], ["_instigator", objNull, [objNull]], ["_damageSelectionArray", [], [[]]]];
params [["_unit", objNull, [objNull]], ["_damageToAdd", -1, [0]], ["_bodyPart", "", [""]], ["_typeOfDamage", "", [""]], ["_instigator", objNull, [objNull]], ["_damageSelectionArray", [], [[]]], ["_overrideInvuln", true]];
mjc4wilton marked this conversation as resolved.
Show resolved Hide resolved
TRACE_6("addDamageToUnit",_unit,_damageToAdd,_bodyPart,_typeOfDamage,_instigator,_damageSelectionArray);

_bodyPart = toLower _bodyPart;
Expand All @@ -31,6 +32,7 @@ if (_bodyPartIndex < 0) then { _bodyPartIndex = ALL_SELECTIONS find _bodyPart; }
if (_bodyPartIndex < 0) exitWith {ERROR_1("addDamageToUnit - bad selection %1", _this); false};
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};
mjc4wilton marked this conversation as resolved.
Show resolved Hide resolved

// Extension is case sensitive and expects this format (different from ALL_BODY_PARTS)
_bodyPart = ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"] select _bodyPartIndex;
Expand Down