Minor tweaks and cleanup

This commit is contained in:
johnb432 2024-06-06 10:21:17 +02:00
parent 209d3ff1b8
commit a4968b52d7
3 changed files with 11 additions and 6 deletions

View File

@ -5,8 +5,8 @@
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Intensity of fire <NUMBER>
* 2: Instigator of fire <OBJECT> (default: objNull)
* 1: Fire intensity <NUMBER>
* 2: Fire instigator <OBJECT> (default: objNull)
*
* Return Value:
* None
@ -54,6 +54,11 @@ if (surfaceIsWater _eyePos && {(_eyePos select 2) < 0.1}) exitWith {
// If unit is already burning, update intensity, but don't add another PFH
if (_unit call FUNC(isBurning)) exitWith {
// Only allow intensity to be increased
if (_intensity <= (_unit getVariable [QGVAR(intensity), 0])) exitWith {
TRACE_2("unit already burning, no intensity update",_unit,_intensity);
};
TRACE_2("unit already burning, updating intensity",_unit,_intensity);
_unit setVariable [QGVAR(intensity), _intensity, true];
@ -63,7 +68,7 @@ TRACE_2("setting unit ablaze",_unit,_intensity);
_unit setVariable [QGVAR(intensity), _intensity, true];
// Fire simulation (objects are handled differently)
// Fire simulation (fire sources are handled differently)
[QGVAR(burnSimulation), [_unit, _instigator], _unit] call CBA_fnc_targetEvent;
// Spawn effects for unit

View File

@ -76,7 +76,7 @@ if (isServer) then {
};
// Display burn indicators
if (_unit == ACE_player && {alive _unit} && {isNil {_unit getVariable QGVAR(burnUIPFH)}}) then { // this accounts for player remote controlled a new unit
if (_unit == ACE_player && {alive _unit} && {isNil {_unit getVariable QGVAR(burnUIPFH)}}) then { // This accounts for player remote controlled a new unit
private _burnIndicatorPFH = [LINKFUNC(burnIndicator), 1, _unit] call CBA_fnc_addPerFrameHandler;
_unit setVariable [QGVAR(burnUIPFH), _burnIndicatorPFH];
};
@ -120,7 +120,7 @@ if (isServer) then {
_fireParticle setParticleRandom [
0.04 * _intensity, // life time
[0.05, 0.05, 2], // position
[0.05 * _intensity, 0.05 * _intensity, 0.05 * _intensity], // move velocity
[0.05, 0.05, 0.05] vectorMultiply _intensity, // move velocity
0, // rotation velocity
0.06 * _intensity, // size
[0, 0, 0, 0], // color

View File

@ -164,6 +164,6 @@ params ["_unit", "_instigator"];
// Use event directly, as ace_medical_fnc_addDamageToUnit requires unit to be alive
[QEGVAR(medical,woundReceived), [_unit, [[_damageToAdd, _bodyPart, _damageToAdd]], _instigator, "burn"]] call CBA_fnc_localEvent;
_unit setVariable [QGVAR(intensity), _intensity, true]; // globally sync intensity across all clients to make sure simulation is deterministic
_unit setVariable [QGVAR(intensity), _intensity, true]; // Globally sync intensity across all clients to make sure simulation is deterministic
};
}, BURN_PROPAGATE_UPDATE, [_unit, _instigator]] call CBA_fnc_addPerFrameHandler;