Added TRACE macros

This commit is contained in:
johnb432 2024-06-02 12:19:28 +02:00
parent 48f3d192e2
commit a93c0b46a3
3 changed files with 35 additions and 6 deletions

View File

@ -24,28 +24,43 @@ if (!EGVAR(common,settingsInitFinished)) exitWith {
if (!GVAR(enabled)) exitWith {};
params ["_unit", "_intensity", ["_instigator", objNull]];
TRACE_3("burn",_unit,_intensity,_instigator);
if (BURN_MIN_INTENSITY > _intensity) exitWith {};
if (BURN_MIN_INTENSITY > _intensity) exitWith {
TRACE_3("intensity is too low",_unit,_intensity,BURN_MIN_INTENSITY);
};
// Check if unit is remote (objNull is remote)
if (!local _unit) exitWith {};
if (!local _unit) exitWith {
TRACE_1("unit is null or not local",_unit);
};
// Check if the unit can burn (takes care of spectators and curators)
if (getNumber (configOf _unit >> "isPlayableLogic") == 1 || {!(_unit isKindOf "CAManBase")}) exitWith {};
if (getNumber (configOf _unit >> "isPlayableLogic") == 1 || {!(_unit isKindOf "CAManBase")}) exitWith {
TRACE_1("unit is virtual or not a man",_unit);
};
// If unit is invulnerable, don't burn the unit
if !(isDamageAllowed _unit && {_unit getVariable [QEGVAR(medical,allowDamage), true]}) exitWith {};
if !(isDamageAllowed _unit && {_unit getVariable [QEGVAR(medical,allowDamage), true]}) exitWith {
TRACE_1("unit is invulnerable",_unit);
};
private _eyePos = eyePos _unit;
// Check if unit is mostly submerged in water
if (surfaceIsWater _eyePos && {(_eyePos select 2) < 0.1}) exitWith {};
if (surfaceIsWater _eyePos && {(_eyePos select 2) < 0.1}) exitWith {
TRACE_1("unit is in water",_unit);
};
// If unit is already burning, update intensity, but don't add another PFH
if (_unit call FUNC(isBurning)) exitWith {
TRACE_2("unit already burning, updating intensity",_unit,_intensity);
_unit setVariable [QGVAR(intensity), _intensity, true];
};
TRACE_2("setting unit ablaze",_unit,_intensity);
_unit setVariable [QGVAR(intensity), _intensity, true];
// Fire simulation (objects are handled differently)

View File

@ -24,11 +24,15 @@ params ["_unit", "_instigator"];
_args params ["_unit", "_instigator"];
if (isNull _unit) exitWith {
TRACE_1("unit is null",_unit);
_pfhID call CBA_fnc_removePerFrameHandler;
};
// Locality has changed
if (!local _unit) exitWith {
TRACE_1("unit is no longer local",_unit);
_pfhID call CBA_fnc_removePerFrameHandler;
[QGVAR(burnSimulation), [_unit, _instigator], _unit] call CBA_fnc_targetEvent;
@ -40,6 +44,8 @@ params ["_unit", "_instigator"];
{!(isDamageAllowed _unit && {_unit getVariable [QEGVAR(medical,allowDamage), true]})} ||
{private _eyePos = eyePos _unit; surfaceIsWater _eyePos && {(_eyePos select 2) < 0.1}}
) exitWith {
TRACE_3("unit is no longer burning, invulnerable or in water",_unit,_unit call FUNC(isBurning),isDamageAllowed _unit && {_unit getVariable [ARR_2(QEGVAR(medical,allowDamage),true)]});
// Remove global effects
(_unit getVariable [QGVAR(jipID), ""]) call CBA_fnc_removeGlobalEventJIP;
@ -61,6 +67,8 @@ params ["_unit", "_instigator"];
// Propagate fire to other units (alive or dead) if it's intense
if (_intensity >= BURN_THRESHOLD_INTENSE) then {
TRACE_2("check for other units",_unit,_intensity);
private _adjustedIntensity = 0;
{
@ -73,11 +81,15 @@ params ["_unit", "_instigator"];
};
[QGVAR(burn), [_x, _adjustedIntensity, _instigator], _x] call CBA_fnc_targetEvent;
TRACE_3("propagate fire",_x,_intensity,_adjustedIntensity);
} forEach nearestObjects [_unit, ["CAManBase"], BURN_PROPAGATE_DISTANCE];
};
// Update intensity/fire reactions
if (CBA_missionTime >= _unit getVariable [QGVAR(intensityUpdate), 0]) then {
TRACE_2("update intensity",_unit,_intensity);
_unit setVariable [QGVAR(intensityUpdate), CBA_missionTime + INTENSITY_UPDATE];
_intensity = _intensity - INTENSITY_LOSS - (rain / 10);

View File

@ -27,7 +27,9 @@ _intensity = _intensity * INTENSITY_DECREASE_MULT_PAT_DOWN;
_patient setVariable [QGVAR(intensity), _intensity, true];
// If the unit is still burning, loop the medical action
if !(_patient call FUNC(isBurning)) exitWith {};
if !(_patient call FUNC(isBurning)) exitWith {
TRACE_1("patient no longer burning, quitting",_this);
};
TRACE_1("patient still burning, looping",_this);