2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-10-02 16:35:40 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal, commy2
|
2019-06-28 16:50:11 +00:00
|
|
|
* Handles the wounds received event by triggering any needed blood creation.
|
2016-10-02 16:35:40 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2019-06-28 16:50:11 +00:00
|
|
|
* 0: Unit <OBJECT>
|
2022-02-20 23:23:56 +00:00
|
|
|
* 1: Damage done to each body part <ARRAY>
|
|
|
|
* 2: Shooter <OBJECT>
|
|
|
|
* 3: Ammo classname or damage type <STRING>
|
2016-10-02 16:35:40 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
2019-03-30 16:07:54 +00:00
|
|
|
* Example:
|
|
|
|
* [player, "Body", 0.5, badGuy] call ace_medical_blood_fnc_handleWoundReceived
|
|
|
|
*
|
2016-10-02 16:35:40 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2022-08-25 17:05:50 +00:00
|
|
|
params ["_unit", "_allDamages", "_shooter", "_damageType"];
|
|
|
|
(_allDamages select 0) params ["_damage"];
|
|
|
|
|
|
|
|
// Don't bleed if damage type does not cause bleeding
|
|
|
|
if (_damageType in GVAR(noBloodDamageTypes)) exitWith {};
|
2016-10-02 16:35:40 +00:00
|
|
|
|
2019-06-28 16:50:11 +00:00
|
|
|
// Don't bleed when players only and a non-player unit is wounded
|
|
|
|
if (GVAR(enabledFor) == BLOOD_ONLY_PLAYERS && {!isPlayer _unit && {_unit != ACE_player}}) exitWith {};
|
2016-10-02 16:35:40 +00:00
|
|
|
|
2019-06-28 16:50:11 +00:00
|
|
|
// Don't bleed on the ground if in a vehicle
|
2024-03-26 12:54:06 +00:00
|
|
|
if (!isNull objectParent _unit && {!(vehicle _unit isKindOf "StaticWeapon")}) exitWith {};
|
2016-10-02 16:35:40 +00:00
|
|
|
|
2019-06-28 16:50:11 +00:00
|
|
|
private _bulletDir = if (isNull _shooter) then {
|
|
|
|
random 360 // Cannot calculate the direction properly, pick a random direction
|
|
|
|
} else {
|
|
|
|
_shooter getDir _unit // Calculate the bullet direction
|
2016-10-02 16:35:40 +00:00
|
|
|
};
|
|
|
|
|
2019-06-28 16:50:11 +00:00
|
|
|
[QGVAR(spurt), [_unit, _bulletDir, _damage min 1]] call CBA_fnc_serverEvent;
|