ACE3/addons/medical_blood/functions/fnc_handleWoundReceived.sqf

36 lines
979 B
Plaintext
Raw Normal View History

#include "script_component.hpp"
/*
* Author: Glowbal, commy2
* Handle wounds received event.
*
* Arguments:
* 0: unit <OBJECT>
2019-03-30 16:07:54 +00:00
* 1: bodyPart <String>
* 2: damage <NUMBER>
2019-03-30 16:07:54 +00:00
* 3: shooter <OBJECT>
*
* Return Value:
* None
*
2019-03-30 16:07:54 +00:00
* Example:
* [player, "Body", 0.5, badGuy] call ace_medical_blood_fnc_handleWoundReceived
*
* Public: No
*/
params ["_unit", "", "_damage", "_shooter"];
if (GVAR(enabledFor) == 1 && {!isPlayer _unit && {_unit != ACE_player}}) exitWith {};
if (vehicle _unit != _unit && {!((vehicle _unit) isKindOf "StaticWeapon")}) exitWith {}; // Don't bleed on ground if mounted
_damage = _damage min 1;
if (isNull _shooter) exitWith { // won't be able to calculate the direction properly, so instead we pick something at random
[QGVAR(spurt), [_unit, random 360, _damage]] call CBA_fnc_serverEvent;
};
// Calculate bulletDirection
private _bulletDir = _shooter getDir _unit;
[QGVAR(spurt), [_unit, _bulletDir, _damage]] call CBA_fnc_serverEvent;