Improve cook off settings UX (#5351)

* Improve cookoff setting UX

- Adds second eden attribute to boxes/vehicles to toggle the ammunition
  cookoff itself
- Removes the cookoff toggle from boxes (they only care about ammunition
  cookoff)

* Fix attribute default values

* Update incendiary box ignition code
This commit is contained in:
SilentSpike 2017-12-06 19:13:10 +00:00 committed by PabstMirror
parent 0630ebd93a
commit b1f5caacbb
4 changed files with 19 additions and 8 deletions

View File

@ -11,8 +11,18 @@ class Cfg3DEN {
tooltip = CSTRING(enable_tooltip); tooltip = CSTRING(enable_tooltip);
expression = QUOTE(if !(_value) then {_this setVariable [ARR_3('%s',_value,true)];};); expression = QUOTE(if !(_value) then {_this setVariable [ARR_3('%s',_value,true)];};);
typeName = "BOOL"; typeName = "BOOL";
condition = "objectVehicle";
defaultValue = QUOTE(GETMVAR(QGVAR(enable),true));
};
class GVAR(enableAmmoCookoff) {
property = QGVAR(enableAmmoCookoff);
control = "Checkbox";
displayName = CSTRING(enableAmmoCookoff_name);
tooltip = CSTRING(enableAmmoCookoff_tooltip);
expression = QUOTE(if !(_value) then {_this setVariable [ARR_3('%s',_value,true)];};);
typeName = "BOOL";
condition = "objectHasInventoryCargo"; condition = "objectHasInventoryCargo";
defaultValue = "(true)"; // fix pbo project preprocessing bug defaultValue = QUOTE(if (_this isKindOf 'ReammoBox_F') then { GETMVAR(QGVAR(enableAmmobox),true) } else { GETMVAR(QGVAR(enableAmmoCookoff),true) };);
}; };
}; };
}; };

View File

@ -71,7 +71,7 @@ GVAR(cacheTankDuplicates) = call CBA_fnc_createNamespace;
["ReammoBox_F", "init", { ["ReammoBox_F", "init", {
(_this select 0) addEventHandler ["HandleDamage", { (_this select 0) addEventHandler ["HandleDamage", {
if ((_this select 0) getVariable [QGVAR(enable), GVAR(enableAmmobox)]) then { if ((_this select 0) getVariable [QGVAR(enableAmmoCookoff), GVAR(enableAmmobox)]) then {
["box", _this] call FUNC(handleDamage); ["box", _this] call FUNC(handleDamage);
}; };
}]; }];

View File

@ -44,11 +44,9 @@ if (local _box) then {
// These functions are smart and do all the cooking off work // These functions are smart and do all the cooking off work
if (local _box) then { if (local _box) then {
if (_box getVariable [QGVAR(enableAmmoCookoff), GVAR(enableAmmoCookoff)]) then { if (GVAR(ammoCookoffDuration) == 0) exitWith {};
if (GVAR(ammoCookoffDuration) == 0) exitWith {}; ([_box] call FUNC(getVehicleAmmo)) params ["_mags", "_total"];
([_box] call FUNC(getVehicleAmmo)) params ["_mags", "_total"]; [_box, _mags, _total] call FUNC(detonateAmmunition);
[_box, _mags, _total] call FUNC(detonateAmmunition);
};
// This shit is busy being on fire, magazines aren't accessible/usable // This shit is busy being on fire, magazines aren't accessible/usable
clearMagazineCargoGlobal _box; clearMagazineCargoGlobal _box;

View File

@ -169,7 +169,10 @@ if (isServer) then {
_x setDamage 1; _x setDamage 1;
}; };
if (_x isKindOf "ReammoBox_F") then { if (_x isKindOf "ReammoBox_F") then {
if ("ace_cookoff" call EFUNC(common,isModLoaded) && {EGVAR(cookoff,enable)}) then { if (
"ace_cookoff" call EFUNC(common,isModLoaded) &&
{GETVAR(_x,EGVAR(cookoff,enableAmmoCookoff),EGVAR(cookoff,enableAmmobox))}
) then {
_x call EFUNC(cookoff,cookOffBox); _x call EFUNC(cookoff,cookOffBox);
} else { } else {
_x setDamage 1; _x setDamage 1;