ACE3/addons/fire/functions/fnc_fireManagerPFH.sqf

48 lines
1.2 KiB
Plaintext
Raw Normal View History

#include "..\script_component.hpp"
/*
2023-08-16 23:18:01 +00:00
* Author: tcvm
2024-02-05 12:17:33 +00:00
* Handles various objects on fire and determines if units close to objects deserve to get burned.
*
* Arguments:
2024-01-26 17:38:26 +00:00
* 0: Args (not used) <ARRAY>
* 1: PFH Handle (not used) <NUMBER>
*
* Return Value:
* None
*
* Example:
2024-02-05 12:17:33 +00:00
* [[], -1] call CBA_fnc_addPerFrameHandler
*
* Public: No
*/
2024-01-26 17:38:26 +00:00
private _distancePercent = 0;
2024-02-05 12:17:33 +00:00
private _adjustedIntensity = 0;
2024-01-26 17:38:26 +00:00
{
2024-02-05 12:17:33 +00:00
_y params ["_fireLogic", "_radius", "_intensity", "_condition", "_conditionArgs"];
2024-01-26 17:38:26 +00:00
// Remove when condition is no longer valid
if !(_conditionArgs call _condition) then {
2024-02-05 12:17:33 +00:00
(GVAR(fireSources) deleteAt _x) params [["_fireLogic", objNull]];
detach _fireLogic;
deleteVehicle _fireLogic;
2024-01-26 17:38:26 +00:00
continue;
};
2024-02-05 12:17:33 +00:00
// Burn units (alive or dead) close to the fire
{
2024-02-05 12:17:33 +00:00
_distancePercent = 1 - ((_fireLogic distance _x) / _radius);
_adjustedIntensity = _intensity * _distancePercent;
2024-01-26 17:38:26 +00:00
2024-02-05 12:17:33 +00:00
// Don't burn if intensity is too low
if (BURN_MIN_INTENSITY > _adjustedIntensity) then {
continue;
};
2024-02-05 12:17:33 +00:00
[QGVAR(burn), [_x, _adjustedIntensity], _x] call CBA_fnc_targetEvent;
} forEach nearestObjects [_fireLogic, ["CAManBase"], _radius];
2024-01-26 17:38:26 +00:00
} forEach GVAR(fireSources);