mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cookoff - Allow enabling only on player crewed vehicles (#7147)
* Add setting for cookoff to only run for player crewed vehicles * No point having per vehicle selection * Merging mutliple settings in to one * Fixing missing comma * Using LSTRING for settings * merging suggested fixes * Moving enabled check to fnc * Use existing strings for CBA options * Reverting change to support legacy eden attribute settings * Adding Pabsts fix for 3den attribute * Update addons/cookoff/CfgEden.hpp Co-Authored-By: PabstMirror <pabstmirror@gmail.com>
This commit is contained in:
parent
2c5df0be77
commit
5d07029db7
@ -12,7 +12,7 @@ class Cfg3DEN {
|
||||
expression = QUOTE(if !(_value) then {_this setVariable [ARR_3('%s',_value,true)];};);
|
||||
typeName = "BOOL";
|
||||
condition = "objectVehicle";
|
||||
defaultValue = QUOTE(GETMVAR(QGVAR(enable),true));
|
||||
defaultValue = QUOTE((GETMVAR(QGVAR(enable),0)) in [ARR_2(1,2)]);
|
||||
};
|
||||
class GVAR(enableAmmoCookoff) {
|
||||
property = QGVAR(enableAmmoCookoff);
|
||||
|
@ -27,9 +27,7 @@ GVAR(cacheTankDuplicates) = call CBA_fnc_createNamespace;
|
||||
};
|
||||
|
||||
_vehicle addEventHandler ["HandleDamage", {
|
||||
if ((_this select 0) getVariable [QGVAR(enable), GVAR(enable)]) then {
|
||||
["tank", _this] call FUNC(handleDamage);
|
||||
};
|
||||
["tank", _this] call FUNC(handleDamage);
|
||||
}];
|
||||
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
|
||||
|
||||
@ -53,9 +51,7 @@ GVAR(cacheTankDuplicates) = call CBA_fnc_createNamespace;
|
||||
};
|
||||
|
||||
_vehicle addEventHandler ["HandleDamage", {
|
||||
if ((_this select 0) getVariable [QGVAR(enable), GVAR(enable)]) then {
|
||||
["tank", _this] call FUNC(handleDamage);
|
||||
};
|
||||
["tank", _this] call FUNC(handleDamage);
|
||||
}];
|
||||
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
|
||||
|
||||
@ -63,9 +59,7 @@ GVAR(cacheTankDuplicates) = call CBA_fnc_createNamespace;
|
||||
params ["_vehicle"];
|
||||
|
||||
_vehicle addEventHandler ["HandleDamage", {
|
||||
if ((_this select 0) getVariable [QGVAR(enable), GVAR(enable)]) then {
|
||||
["car", _this] call FUNC(handleDamage);
|
||||
};
|
||||
["car", _this] call FUNC(handleDamage);
|
||||
}];
|
||||
}, nil, ["Wheeled_APC_F"], true] call CBA_fnc_addClassEventHandler;
|
||||
|
||||
@ -89,7 +83,7 @@ GVAR(cacheTankDuplicates) = call CBA_fnc_createNamespace;
|
||||
|
||||
// blow off turret effect
|
||||
["Tank", "killed", {
|
||||
if ((_this select 0) getVariable [QGVAR(enable),GVAR(enable)]) then {
|
||||
if ((_this select 0) getVariable [QGVAR(enable), GVAR(enable)] in [1, 2, true]) then {
|
||||
if (random 1 < 0.15) then {
|
||||
(_this select 0) call FUNC(blowOffTurret);
|
||||
};
|
||||
|
@ -21,6 +21,12 @@ _thisHandleDamage params ["_vehicle", "", "_damage", "_source", "_ammo", "_hitIn
|
||||
// it's already dead, who cares?
|
||||
if (damage _vehicle >= 1) exitWith {};
|
||||
|
||||
// If cookoff is disabled exit
|
||||
if (_vehicle getVariable [QGVAR(enable), GVAR(enable)] in [0, false]) exitWith {};
|
||||
|
||||
// Check for players and exit if none found and the enable for players only setting is true
|
||||
if (_vehicle getVariable [QGVAR(enable), GVAR(enable)] isEqualTo 2 && {fullCrew [_vehicle, "", false] findIf {isPlayer (_x select 0)} == -1}) exitWith {};
|
||||
|
||||
// get hitpoint name
|
||||
private _hitpoint = "#structural";
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
// CBA Settings [ADDON: ace_cookoff]:
|
||||
|
||||
[
|
||||
QGVAR(enable), "CHECKBOX",
|
||||
QGVAR(enable), "LIST",
|
||||
[LSTRING(enable_hd_name), LSTRING(enable_hd_tooltip)],
|
||||
LSTRING(category_displayName),
|
||||
false, // default value
|
||||
[[0, 1, 2], ["STR_A3_OPTIONS_DISABLED", ELSTRING(common,playerOnly), ELSTRING(common,playersAndAI)], 0],
|
||||
true, // isGlobal
|
||||
{[QGVAR(enable), _this] call EFUNC(common,cbaSettings_settingChanged)},
|
||||
true // Needs mission restart
|
||||
|
Loading…
Reference in New Issue
Block a user