Better engine fire placement

This commit is contained in:
johnb432 2024-02-03 19:23:49 +01:00
parent e52990d52a
commit c0a951491b
2 changed files with 25 additions and 33 deletions

View File

@ -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};
};
};

View File

@ -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];
};