2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2016-09-11 18:46:35 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
2019-06-28 16:50:11 +00:00
|
|
|
* Handles periodically creating blood for a bleeding unit.
|
|
|
|
* Called from the medical_blood state machine.
|
2016-09-11 18:46:35 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2019-06-28 16:50:11 +00:00
|
|
|
* 0: Unit <OBJECT>
|
2016-09-11 18:46:35 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2019-06-28 16:50:11 +00:00
|
|
|
* 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"];
|
|
|
|
|
2019-06-28 16:50:11 +00:00
|
|
|
// Nothing to do if unit is not bleeding
|
|
|
|
if !(_unit call FUNC(isBleeding)) exitWith {};
|
|
|
|
|
|
|
|
// 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-09-11 18:46:35 +00:00
|
|
|
|
2019-05-08 17:50:00 +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
|
|
|
|
2019-06-28 16:50:11 +00:00
|
|
|
TRACE_2("Creating blood drop for bleeding unit",_unit,_bloodLoss);
|
|
|
|
|
2016-09-19 11:26:32 +00:00
|
|
|
private _position = getPosASL _unit;
|
2019-06-28 16:50:11 +00:00
|
|
|
_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];
|
|
|
|
|
2016-09-27 18:00:58 +00:00
|
|
|
private _bloodDrop = ["blooddrop_1", "blooddrop_2", "blooddrop_3", "blooddrop_4"] select floor (_bloodLoss min 3);
|
2023-02-01 11:03:44 +00:00
|
|
|
[_bloodDrop, _position, _unit] call FUNC(createBlood);
|
2016-09-11 18:46:35 +00:00
|
|
|
};
|