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
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions 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>
*
* 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]];
TRACE_6("addDamageToUnit",_unit,_damageToAdd,_bodyPart,_typeOfDamage,_instigator,_damageSelectionArray);

_bodyPart = toLower _bodyPart;
Expand All @@ -31,7 +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 (!GVAR(allowInvulnDamage) && {!(isDamageAllowed _unit)} && {!(_unit getVariable [QEGVAR(medical,allowDamage), true])}) exitWith {ERROR_1("addDamageToUnit - unit invulnerable %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;
Expand Down
8 changes: 0 additions & 8 deletions addons/medical/initSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,3 @@
[1, 30, 1, 1],
true
] call CBA_fnc_addSetting;

[
QGVAR(allowInvulnDamage),
"CHECKBOX",
[LSTRING(allowInvulnDamage_DisplayName), LSTRING(allowInvulnDamage_Description)],
LSTRING(Category),
true
] call CBA_fnc_addSetting;
6 changes: 0 additions & 6 deletions addons/medical/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@
<Russian>Увеличивает частоту проверок на спонтанное пробуждение, когда пациент под действием адреналина.</Russian>
<Turkish>Hastanın sisteminde Epinefrin olduğunda rasgele uyanma kontrollerinin ne sıklıkla gerçekleştiğini artırır.</Turkish>
</Key>
<Key ID="STR_ACE_Medical_allowInvulnDamage_DisplayName">
<English>Allow Damage to Invulnerable Units</English>
</Key>
<Key ID="STR_ACE_Medical_allowInvulnDamage_Description">
<English>Allows scripts to damage to invulnerable units</English>
</Key>
<Key ID="STR_ACE_Medical_Limping_DisplayName">
<English>Limping</English>
<Russian>Хромота</Russian>
Expand Down
4 changes: 0 additions & 4 deletions docs/wiki/feature/medical-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ Fatal damage is now controlled by either "Large hits to vital organs", "Sum of t

Two sliders that dictate how much damage players and ai can take before going unconscious or dying if Sum of Trauma is enabled. Set to higher values to make units stronger, lower to make them weaker.

##### 1.1.1.6 Allow Damage to Invulnerable Units

Checkbox that enables scripts to apply ACE medical damage types to units which are invulnerable via calling the "ace_medical_fnc_addDamageToUnit" function. Units need to be made invulnerable via both the "allowDamage" command and "ace_medical_allowDamage" variable on the unit in order to prevent script-induced damage.

#### 1.1.2 AI

##### 1.1.2.1 Medic AI
Expand Down