ACE3/addons/medical_blood/functions/fnc_handleWoundReceived.sqf
mharis001 b2f4b8ea20 Medical - Cleanup settings (#7057)
* Cleanup medical settings

* Fix extra [

* Allow giving IV/blood to self by default

* Medical Blood - Settings improvements and cleanup (#7069)

* Add more blood settings and cleanup

* Fix include before header

* Update addons/medical_blood/functions/fnc_init.sqf

Co-Authored-By: PabstMirror <pabstmirror@gmail.com>

* Disable debug

* Cleanup moved settings

* Fix remaining setting descriptions
2019-06-28 11:50:11 -05:00

36 lines
1.0 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Glowbal, commy2
* Handles the wounds received event by triggering any needed blood creation.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Body Part (not used) <STRING>
* 2: Damage <NUMBER>
* 3: Shooter <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player, "Body", 0.5, badGuy] call ace_medical_blood_fnc_handleWoundReceived
*
* Public: No
*/
params ["_unit", "", "_damage", "_shooter"];
// 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 {};
// Don't bleed on the ground if in a vehicle
if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")}) exitWith {};
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
};
[QGVAR(spurt), [_unit, _bulletDir, _damage min 1]] call CBA_fnc_serverEvent;