Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RF Compat - Extinguish vehicle cook-offs and burning units #10604

Merged
merged 3 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions addons/compat_rf/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit));
};
};
27 changes: 27 additions & 0 deletions addons/compat_rf/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "script_component.hpp"

// Compat for ace_cookoff: Extinguish cook-off
if (["ace_cookoff"] call EFUNC(common,isModLoaded)) then {
[missionNamespace, "lxRF_water_droppedOnVehicle", {
params ["_vehicle"];

if (_vehicle getVariable [QEGVAR(cookoff,isAmmoDetonating), false]) then {
_vehicle setVariable [QEGVAR(cookoff,interruptAmmoCookoff), true, true];
};
}] call BIS_fnc_addScriptedEventHandler;
};

// Compat for ace_fire: Extinguish burning units
if (["ace_fire"] call EFUNC(common,isModLoaded)) then {
["CBA_settingsInitialized", {
if (!EGVAR(fire,enabled)) exitWith {};

[missionNamespace, "lxRF_water_droppedOnUnit", {
params ["_unit"];

if (_unit call EFUNC(fire,isBurning)) then {
_unit setVariable [QEGVAR(fire,intensity), nil, true];
};
}] call BIS_fnc_addScriptedEventHandler;
}] call CBA_fnc_addEventHandler;
};
1 change: 1 addition & 0 deletions addons/compat_rf/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ class CfgPatches {
};
};

#include "CfgEventHandlers.hpp"
#include "CfgWeapons.hpp"
#include "CfgVehicles.hpp"
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ if (
{private _posASL = getPosWorld _object; surfaceIsWater _posASL && {(_posASL select 2) < 0}} || // Underwater is not very reliable, so use model center instead
{GVAR(ammoCookoffDuration) == 0} ||
{!([GVAR(enableAmmoCookoff), GVAR(enableAmmobox)] select (_object isKindOf "ReammoBox_F"))} ||
{!(_object getVariable [QGVAR(enableAmmoCookoff), true])}
{!(_object getVariable [QGVAR(enableAmmoCookoff), true])} ||
{_object getVariable [QGVAR(interruptAmmoCookoff), false]} // QGVAR(interruptAmmoCookoff) stops the current cook-off (allowing future ones), whereas QGVAR(enableAmmoCookoff) disables it entirely
) exitWith {
// Box cook-off fire ends after the ammo has detonated (vehicle cook-off fire does not depend on the ammo detonation)
if (_object isKindOf "ReammoBox_F") then {
Expand All @@ -63,6 +64,7 @@ if (
// Reset variables, so the object can detonate its ammo again
_object setVariable [QGVAR(cookoffMagazines), nil];
_object setVariable [QGVAR(virtualMagazines), nil];
_object setVariable [QGVAR(interruptAmmoCookoff), nil, true];
_object setVariable [QGVAR(isAmmoDetonating), nil, true];

// If done, destroy the object if necessary
Expand Down
Loading