ACE3/addons/fire/functions/fnc_fireManagerPFH.sqf
2023-08-16 19:18:01 -04:00

44 lines
1.3 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: tcvm
* 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;
if (_attachedObject isNotEqualTo objNull) then {
_sourcePos = getPosATL _attachedObject;
};
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;