mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Don't cookoff when commander turret is hit (#4280)
This commit is contained in:
parent
aaa6b75302
commit
5a83659136
@ -3,9 +3,25 @@
|
||||
[QGVAR(engineFire), FUNC(engineFire)] call CBA_fnc_addEventHandler;
|
||||
[QGVAR(cookOff), FUNC(cookOff)] call CBA_fnc_addEventHandler;
|
||||
|
||||
GVAR(cacheTankDuplicates) = call CBA_fnc_createNamespace;
|
||||
|
||||
// cookoff and burning engine
|
||||
["Tank", "init", {
|
||||
(_this select 0) addEventHandler ["HandleDamage", {
|
||||
params ["_vehicle"];
|
||||
private _typeOf = typeOf _vehicle;
|
||||
if (isNil {GVAR(cacheTankDuplicates) getVariable _typeOf}) then {
|
||||
private _hitpoints = (getAllHitPointsDamage _vehicle param [0, []]) apply {toLower _x};
|
||||
private _duplicateHitpoints = [];
|
||||
{
|
||||
if ((_x != "") && {_x in (_hitpoints select [0,_forEachIndex])}) then {
|
||||
_duplicateHitpoints pushBack _forEachIndex;
|
||||
};
|
||||
} forEach _hitpoints;
|
||||
TRACE_2("dupes",_typeOf,_duplicateHitpoints);
|
||||
GVAR(cacheTankDuplicates) setVariable [_typeOf, _duplicateHitpoints];
|
||||
};
|
||||
|
||||
_vehicle addEventHandler ["HandleDamage", {
|
||||
if (GVAR(enable)) then {
|
||||
["tank", _this] call FUNC(handleDamage);
|
||||
};
|
||||
|
@ -60,6 +60,10 @@ if (_simulationType == "tank") exitWith {
|
||||
// determine ammo storage location
|
||||
private _ammoLocationHitpoint = getText (_vehicle call CBA_fnc_getObjectConfig >> QGVAR(ammoLocation));
|
||||
|
||||
if (_hitIndex in (GVAR(cacheTankDuplicates) getVariable (typeOf _vehicle))) then {
|
||||
_hitpoint = "#subturret";
|
||||
};
|
||||
|
||||
// ammo was hit, high chance for cook-off
|
||||
if (_hitpoint == _ammoLocationHitpoint) then {
|
||||
if (_damage > 0.5 && {random 1 < 0.7}) then {
|
||||
|
Loading…
Reference in New Issue
Block a user