ACE3/addons/medical_blood/functions/fnc_onBleeding.sqf

40 lines
1.2 KiB
Plaintext
Raw Normal View History

#include "script_component.hpp"
2016-09-11 18:46:35 +00:00
/*
* Author: Glowbal
* Handles periodically creating blood for a bleeding unit.
* Called from the medical_blood state machine.
2016-09-11 18:46:35 +00:00
*
* Arguments:
* 0: Unit <OBJECT>
2016-09-11 18:46:35 +00:00
*
* Return Value:
* None
2016-09-11 18:46:35 +00:00
*
* Example:
2019-03-30 16:07:54 +00:00
* [player] call ace_medical_blood_fnc_onBleeding
2016-09-11 18:46:35 +00:00
*
* 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 {};
2016-09-11 18:46:35 +00:00
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];
2016-09-11 18:46:35 +00:00
TRACE_2("Creating blood drop for bleeding unit",_unit,_bloodLoss);
2016-09-19 11:26:32 +00:00
private _position = getPosASL _unit;
_position = _position vectorAdd [random 0.4 - 0.2, random 0.4 - 0.2, 0];
2016-09-11 18:46:35 +00:00
_position set [2, 0];
private _bloodDrop = ["blooddrop_1", "blooddrop_2", "blooddrop_3", "blooddrop_4"] select floor (_bloodLoss min 3);
[_bloodDrop, _position, _unit] call FUNC(createBlood);
2016-09-11 18:46:35 +00:00
};