diff --git a/addons/cookoff/CfgVehicles.hpp b/addons/cookoff/CfgVehicles.hpp index 86e0df8386..4451d12080 100644 --- a/addons/cookoff/CfgVehicles.hpp +++ b/addons/cookoff/CfgVehicles.hpp @@ -25,24 +25,4 @@ class CfgVehicles { // Big explosions for wheeled APCs (same as for tanks) explosionEffect = "FuelExplosionBig"; }; - class MRAP_01_base_F: Car_F { - GVAR(engineSmokeOffset)[] = {0, -2, 0}; - }; - class MRAP_02_base_F: Car_F { - GVAR(engineSmokeOffset)[] = {0, -2, 0}; - }; - class MRAP_03_base_F: Car_F { - GVAR(engineSmokeOffset)[] = {0, -2, 0}; - }; - class Quadbike_01_base_F: Car_F { - GVAR(engineSmokeOffset)[] = {0, 1, 0}; - }; - - class Truck_F; - class Truck_02_base_F: Truck_F { - GVAR(engineSmokeOffset)[] = {0, -2.6, -0.1}; - }; - class Truck_02_MRL_base_F: Truck_02_base_F { - GVAR(engineSmokeOffset)[] = {0, 0.3, -0.1}; - }; }; diff --git a/addons/cookoff/functions/fnc_engineFireLocal.sqf b/addons/cookoff/functions/fnc_engineFireLocal.sqf index 845ced8bd8..625a6d3fe9 100644 --- a/addons/cookoff/functions/fnc_engineFireLocal.sqf +++ b/addons/cookoff/functions/fnc_engineFireLocal.sqf @@ -23,18 +23,32 @@ if (_endTime < CBA_missionTime) exitWith {}; private _smoke = objNull; if (hasInterface) then { - // Get offset for engine smoke if there is one - private _offset = getArray (configOf _vehicle >> QGVAR(engineSmokeOffset)); + private _hitPoints = getAllHitPointsDamage _vehicle; - if (_offset isEqualTo []) then { - _offset = [0, 0, 0]; + // Get hitpoint for engine + private _index = (_hitPoints select 0) findIf {_x == "hitengine"}; + + // Get corresponding selection + private _position = if (_index != -1) then { + _vehicle selectionPosition [(_hitPoints select 1) select _index, "HitPoints", "AveragePoint"] + } else { + [0, 0, 0] }; - private _position = [ - 0, - (boundingBoxReal _vehicle select 1 select 1) - 2, - (boundingBoxReal _vehicle select 0 select 2) + 2 - ] vectorAdd _offset; + if (_position isEqualTo [0, 0, 0]) then { + // Get offset for engine smoke if there is one + private _offset = getArray (configOf _vehicle >> QGVAR(engineSmokeOffset)); + + if (_offset isEqualTo []) then { + _offset = [0, 0, 0]; + }; + + _position = [ + 0, + (boundingBoxReal _vehicle select 1 select 1) - 2, + (boundingBoxReal _vehicle select 0 select 2) + 2 + ] vectorAdd _offset; + }; // Spawn smoke _smoke = "#particlesource" createVehicleLocal [0, 0, 0]; @@ -50,11 +64,9 @@ if (hasInterface) then { deleteVehicle _smoke; - if (isNull _vehicle) exitWith {}; + if (isNull _vehicle || !isServer) exitWith {}; - if (isServer) then { - (_vehicle getVariable [QGVAR(engineFireJipID), ""]) call CBA_fnc_removeGlobalEventJIP; - }; + (_vehicle getVariable [QGVAR(engineFireJipID), ""]) call CBA_fnc_removeGlobalEventJIP; _vehicle setVariable [QGVAR(isEngineSmoking), false]; };