2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2021-10-14 15:49:10 +00:00
|
|
|
/*
|
2023-08-16 23:18:01 +00:00
|
|
|
* Author: 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:
|
2024-01-26 17:38:26 +00:00
|
|
|
* 0: Args (not used) <ARRAY>
|
|
|
|
* 1: PFH Handle (not used) <NUMBER>
|
2021-10-14 15:49:10 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2024-01-26 17:38:26 +00:00
|
|
|
* [ace_fire_fnc_fireManagerPFH, 0.25] call CBA_fnc_addPerFrameHandler
|
2021-10-14 15:49:10 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2024-01-26 17:38:26 +00:00
|
|
|
private _attachedObject = objNull;
|
|
|
|
private _sourcePos = [];
|
|
|
|
private _distancePercent = 0;
|
2021-10-14 15:49:10 +00:00
|
|
|
|
2024-01-26 17:38:26 +00:00
|
|
|
{
|
|
|
|
_y params ["_source", "_radius", "_intensity", "_condition", "_conditionArgs"];
|
2021-10-14 15:49:10 +00:00
|
|
|
|
2024-01-26 17:38:26 +00:00
|
|
|
// Remove when condition is no longer valid
|
|
|
|
if !(_conditionArgs call _condition) then {
|
|
|
|
GVAR(fireSources) deleteAt _x;
|
|
|
|
|
|
|
|
continue;
|
2021-10-14 15:49:10 +00:00
|
|
|
};
|
2021-10-30 21:42:03 +00:00
|
|
|
|
2024-01-26 17:38:26 +00:00
|
|
|
_attachedObject = attachedTo _source;
|
|
|
|
_sourcePos = ASLtoAGL getPosASL ([_source, _attachedObject] select (!isNull _attachedObject));
|
|
|
|
|
|
|
|
// Burn units close to the fire
|
2021-10-14 15:49:10 +00:00
|
|
|
{
|
2024-01-26 17:38:26 +00:00
|
|
|
if !(_x call FUNC(isBurning)) then {
|
|
|
|
_distancePercent = 1 - ((_sourcePos distance _x) / _radius);
|
|
|
|
|
|
|
|
[QGVAR(burn), [_x, _intensity * _distancePercent], _x] call CBA_fnc_targetEvent;
|
2021-10-14 15:49:10 +00:00
|
|
|
};
|
2024-01-26 17:38:26 +00:00
|
|
|
} forEach (_sourcePos nearEntities ["CAManBase", _radius]);
|
|
|
|
} forEach GVAR(fireSources);
|