2021-10-14 15:49:10 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
/*
|
2022-01-30 17:54:30 +00:00
|
|
|
* Author: Dani (TCVM)
|
2021-10-14 15:49:10 +00:00
|
|
|
* Handles various fire objects and determines if local units deserves to get burned.
|
|
|
|
* Used to handle external burning objects, not used internally because internal methods are more performant.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Unit on fire <OBJECT>
|
|
|
|
* 1: PFH Handle <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [FUNC(fireManagerPFH), 0.25, [_unit]] call CBA_fnc_addPerFrameHandler
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
|
|
|
params ["_args", "_handle"];
|
|
|
|
|
|
|
|
[GVAR(fireSources), {
|
|
|
|
_value params ["", "", "", "_condition", "_conditionArgs"];
|
|
|
|
_conditionArgs call _condition;
|
|
|
|
}] call CBA_fnc_hashFilter;
|
|
|
|
|
|
|
|
[GVAR(fireSources), {
|
|
|
|
_value params ["_source", "_radius", "_intensity"];
|
|
|
|
private _attachedObject = attachedTo _source;
|
|
|
|
private _sourcePos = getPosATL _source;
|
2021-12-18 23:15:32 +00:00
|
|
|
if (_attachedObject isNotEqualTo objNull) then {
|
2021-10-14 15:49:10 +00:00
|
|
|
_sourcePos = getPosATL _attachedObject;
|
|
|
|
};
|
2021-10-30 21:42:03 +00:00
|
|
|
|
2021-10-14 15:49:10 +00:00
|
|
|
private _nearEntities = _sourcePos nearEntities ["Man", _radius];
|
|
|
|
{
|
|
|
|
private _burning = [_x] call FUNC(isBurning);
|
|
|
|
if !(_burning) then {
|
|
|
|
private _distancePercent = 1 - ((_sourcePos distance _x) / _radius);
|
|
|
|
[QGVAR(burn), [_x, _intensity * _distancePercent]] call CBA_fnc_globalEvent;
|
|
|
|
};
|
|
|
|
} forEach _nearEntities;
|
|
|
|
}] call CBA_fnc_hashEachPair;
|