forked from acemod/ACE3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vehicle Damage - Fix applying medical damage to non-local and invulne…
…rable units (acemod#9988) * Make medical damage apply to non-local units * Update addons/vehicle_damage/functions/fnc_medicalDamage.sqf Co-authored-by: PabstMirror <[email protected]> * Update addons/vehicle_damage/functions/fnc_medicalDamage.sqf * Update fnc_medicalDamage.sqf * Specify reason for death --------- Co-authored-by: PabstMirror <[email protected]>
- Loading branch information
Showing
5 changed files
with
47 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ PREP(knockOut); | |
PREP(addDamage); | ||
PREP(handleDamageEjectIfDestroyed); | ||
PREP(blowOffTurret); | ||
PREP(medicalDamage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "..\script_component.hpp" | ||
/* | ||
* Author: johnb43 | ||
* Applies medical damage to a unit. | ||
* | ||
* Arguments: | ||
* 0: Target <OBJECT> | ||
* 1: Source <OBJECT> | ||
* 2: Instigator <OBJECT> | ||
* 3: Guarantee death? <BOOL> (default: false) | ||
* | ||
* Return Value: | ||
* None | ||
* | ||
* Example: | ||
* [cursorObject, player, player] call ace_vehicle_damage_fnc_medicalDamage; | ||
* | ||
* Public: No | ||
*/ | ||
|
||
params ["_unit", "_source", "_instigator", ["_guaranteeDeath", false]]; | ||
|
||
// Check if unit is invulnerable | ||
if !(isDamageAllowed _unit && {_unit getVariable [QEGVAR(medical,allowDamage), true]}) exitWith {}; | ||
|
||
if (["ace_medical"] call EFUNC(common,isModLoaded)) then { | ||
for "_i" from 0 to floor (4 + random 3) do { | ||
[_unit, random [0, 0.66, 1], selectRandom ["Head", "Body", "LeftArm", "RightArm", "LeftLeg", "RightLeg"], selectRandom ["bullet", "shell", "explosive"], _instigator] call EFUNC(medical,addDamageToUnit); | ||
}; | ||
} else { | ||
{ | ||
_unit setHitPointDamage [_x, (_unit getHitPointDamage _x) + random [0, 0.66, 1], true, _source, _instigator]; | ||
} forEach ["HitFace", "HitNeck", "HitHead", "HitPelvis", "HitAbdomen", "HitDiaphragm", "HitChest", "HitBody", "HitArms", "HitHands", "HitLegs"]; | ||
}; | ||
|
||
// If guaranteed death is wished | ||
if (_guaranteeDeath && {alive _unit}) then { | ||
[_unit, QGVAR(medicalDamage), _source, _instigator] call EFUNC(common,setDead); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters