ACE3/addons/medical_blood/functions/fnc_onBleeding.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

40 lines
1.2 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Glowbal
* Handles periodically creating blood for a bleeding unit.
* Called from the medical_blood state machine.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [player] call ace_medical_blood_fnc_onBleeding
*
* Public: No
*/
params ["_unit"];
// Nothing to do if unit is not bleeding
if !(_unit call FUNC(isBleeding)) exitWith {};
// Don't bleed on the ground if in a vehicle
if (vehicle _unit != _unit && {!(vehicle _unit isKindOf "StaticWeapon")}) exitWith {};
if (CBA_missionTime > (_unit getVariable [QGVAR(nextTime), -10])) then {
private _bloodLoss = (if (GVAR(useAceMedical)) then {GET_BLOOD_LOSS(_unit) * 2.5} else {getDammage _unit * 2}) min 6;
_unit setVariable [QGVAR(nextTime), CBA_missionTime + 8 + random 2 - _bloodLoss];
TRACE_2("Creating blood drop for bleeding unit",_unit,_bloodLoss);
private _position = getPosASL _unit;
_position = _position vectorAdd [random 0.4 - 0.2, random 0.4 - 0.2, 0];
_position set [2, 0];
private _bloodDrop = ["blooddrop_1", "blooddrop_2", "blooddrop_3", "blooddrop_4"] select floor (_bloodLoss min 3);
[_bloodDrop, _position] call FUNC(createBlood);
};