Fire - Fix fire spread to invincible units and not being able to be put on fire by proximity if multiple units are on fire (#8632)

* fire do not propagate to close unit if allowDamage is disable don that unit

* change burnCounter so it works with multiple instances of fires

* fixed exiting burning not resetting burn counter

* changed !isEqualTo to isNotEqualTo

* changed !isEqualTo to isNotEqualTo

* lazy eval, respect old allowDamage variable

---------

Co-authored-by: Grim <69561145+LinkIsGrim@users.noreply.github.com>
Co-authored-by: Salluci <salluci.lovi@gmail.com>
This commit is contained in:
Crowdedlight 2023-06-24 04:34:31 +02:00 committed by GitHub
parent 78c1ce3ae9
commit 6181616cc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -35,3 +35,4 @@
GVAR(fireSources) = [[], nil] call CBA_fnc_hashCreate; GVAR(fireSources) = [[], nil] call CBA_fnc_hashCreate;
}; };
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;

View File

@ -160,8 +160,8 @@ if (_isBurning) exitWith {};
[QGVAR(burn), [ace_player, _intensity * (7 / 8), _instigator]] call CBA_fnc_globalEvent; [QGVAR(burn), [ace_player, _intensity * (7 / 8), _instigator]] call CBA_fnc_globalEvent;
}; };
} else { } else {
if ((ace_player isKindOf "Man") && {_unit isNotEqualTo ace_player}) then { if ((ace_player isKindOf "Man") && {_unit isNotEqualTo ace_player} && {isDamageAllowed ace_player && {ace_player getVariable [QEGVAR(medical,allowDamage), true]}}) then {
private _burnCounter = ace_player getVariable [QGVAR(burnCounter), 0]; private _burnCounter = _unit getVariable [QGVAR(burnCounter), 0];
if (_distanceToUnit < BURN_PROPOGATE_DISTANCE) then { if (_distanceToUnit < BURN_PROPOGATE_DISTANCE) then {
if (_burnCounter < BURN_PROPOGATE_COUNTER_MAX) then { if (_burnCounter < BURN_PROPOGATE_COUNTER_MAX) then {
_burnCounter = _burnCounter + 1; _burnCounter = _burnCounter + 1;
@ -171,7 +171,7 @@ if (_isBurning) exitWith {};
} else { } else {
_burnCounter = 0; _burnCounter = 0;
}; };
ace_player setVariable [QGVAR(burnCounter), _burnCounter]; _unit setVariable [QGVAR(burnCounter), _burnCounter];
}; };
}; };
}; };
@ -324,6 +324,7 @@ if (_isBurning) exitWith {};
}; };
}; };
_unit setVariable [QGVAR(burning), false]; _unit setVariable [QGVAR(burning), false];
_unit setVariable [QGVAR(burnCounter), 0];
}, { }, {
// run condition // run condition
true true