2023-09-12 18:58:10 +00:00
|
|
|
#include "..\script_component.hpp"
|
2021-10-14 15:49:10 +00:00
|
|
|
/*
|
2024-06-22 18:07:36 +00:00
|
|
|
* Author: tcvm, johnb43
|
|
|
|
* Handles various objects on fire and determines if units close to objects deserve to get burned.
|
2021-10-14 15:49:10 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2024-06-22 18:07:36 +00:00
|
|
|
* None
|
2021-10-14 15:49:10 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2024-06-22 18:07:36 +00:00
|
|
|
* ace_fire_fnc_fireManagerPFH call CBA_fnc_addPerFrameHandler
|
2021-10-14 15:49:10 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2024-06-22 18:07:36 +00:00
|
|
|
{
|
|
|
|
_y params ["_fireLogic", "_radius", "_intensity", "_condition", "_conditionArgs"];
|
|
|
|
TRACE_2("fireManagerPFH loop",_x,_y);
|
|
|
|
|
|
|
|
// Remove when condition is no longer valid
|
|
|
|
if !(_conditionArgs call _condition) then {
|
|
|
|
TRACE_2("condition no longer valid, deleting",_x,_y);
|
|
|
|
|
|
|
|
detach _fireLogic;
|
|
|
|
deleteVehicle _fireLogic;
|
2021-10-14 15:49:10 +00:00
|
|
|
|
2024-06-22 18:07:36 +00:00
|
|
|
GVAR(fireSources) deleteAt _x;
|
2021-10-14 15:49:10 +00:00
|
|
|
|
2024-06-22 18:07:36 +00:00
|
|
|
continue;
|
2021-10-14 15:49:10 +00:00
|
|
|
};
|
2021-10-30 21:42:03 +00:00
|
|
|
|
2024-06-22 18:07:36 +00:00
|
|
|
// Burn units (alive or dead) close to the fire
|
2021-10-14 15:49:10 +00:00
|
|
|
{
|
2024-06-22 18:07:36 +00:00
|
|
|
private _distancePercent = 1 - ((_fireLogic distance _x) / _radius);
|
|
|
|
private _adjustedIntensity = _intensity * _distancePercent;
|
|
|
|
|
|
|
|
// Don't burn if intensity is too low or already burning with higher intensity
|
|
|
|
if (BURN_MIN_INTENSITY > _adjustedIntensity || {(_x getVariable [QGVAR(intensity), 0]) > _adjustedIntensity}) then {
|
|
|
|
continue;
|
2021-10-14 15:49:10 +00:00
|
|
|
};
|
2024-06-22 18:07:36 +00:00
|
|
|
|
|
|
|
[QGVAR(burn), [_x, _adjustedIntensity], _x] call CBA_fnc_targetEvent;
|
|
|
|
|
|
|
|
TRACE_3("propagate fire",_x,_intensity,_adjustedIntensity);
|
|
|
|
} forEach nearestObjects [_fireLogic, ["CAManBase"], _radius];
|
|
|
|
} forEach GVAR(fireSources);
|