mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Converted enable setting to bool
This commit is contained in:
parent
0663bd16c9
commit
2cdc40a958
@ -11,7 +11,7 @@ class Cfg3DEN {
|
||||
expression = QUOTE(if (!_value) then {_this setVariable [ARR_3('%s',_value,true)]});
|
||||
typeName = "BOOL";
|
||||
condition = "objectVehicle";
|
||||
defaultValue = QUOTE((GETMVAR(QGVAR(enable),0)) in [ARR_2(1,2)]);
|
||||
defaultValue = QUOTE(GETMVAR(QGVAR(enable),true)]);
|
||||
};
|
||||
class GVAR(enableAmmoCookoff) {
|
||||
property = QGVAR(enableAmmoCookoff);
|
||||
|
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
if (!isServer) exitWith {};
|
||||
if (GVAR(enable) == 0 || {GVAR(cookoffDuration) == 0}) exitWith {};
|
||||
if (!GVAR(enable) || {GVAR(cookoffDuration) == 0}) exitWith {};
|
||||
|
||||
params [
|
||||
"_vehicle",
|
||||
@ -48,14 +48,15 @@ if !(_vehicle isKindOf "AllVehicles") exitWith {};
|
||||
|
||||
if (_vehicle isKindOf "CAManBase" || {_vehicle isKindOf "StaticWeapon"}) exitWith {};
|
||||
|
||||
// If under water, ignore
|
||||
// underwater is not very reliable, so use model center instead
|
||||
if (underwater _vehicle || {private _posASL = getPosWorld _vehicle; surfaceIsWater _posASL && {(_posASL select 2) < 0}) exitWith {};
|
||||
|
||||
// Check if cook-off is disabled on vehicle specifically
|
||||
if !(_vehicle getVariable [QGVAR(enable), true]) exitWith {};
|
||||
|
||||
// Exit if cook-off enabled only for players and no players in vehicle crew found
|
||||
if ((GVAR(enable) isEqualTo 1) && {(crew _vehicle) findIf {isPlayer _x} == -1}) exitWith {};
|
||||
|
||||
TRACE_2("cooking off",_vehicle,_intensity);
|
||||
TRACE_8("",_instigator,_delayBetweenSmokeAndFire,_ammoDetonationChance,_detonateAfterCookoff,_fireSource,_canRing,_maxIntensity,_canJet);
|
||||
TRACE_9("",_source,_instigator,_delayBetweenSmokeAndFire,_ammoDetonationChance,_detonateAfterCookoff,_fireSource,_canRing,_canJet,_maxIntensity);
|
||||
|
||||
if (_vehicle getVariable [QGVAR(isCookingOff), false]) exitWith {};
|
||||
|
||||
@ -101,7 +102,14 @@ if (_delayBetweenSmokeAndFire) then {
|
||||
|
||||
private _intensity = _vehicle getVariable [QGVAR(intensity), 0];
|
||||
|
||||
if (isNull _vehicle || {_intensity <= 1} || {GVAR(enable) == 0} || {GVAR(cookoffDuration) == 0}) exitWith {
|
||||
if (
|
||||
isNull _vehicle ||
|
||||
!GVAR(enable) ||
|
||||
{_intensity <= 1} ||
|
||||
{GVAR(cookoffDuration) == 0} ||
|
||||
{underwater _vehicle} ||
|
||||
{private _posASL = getPosWorld _vehicle; surfaceIsWater _posASL && {(_posASL select 2) < 0})}
|
||||
) exitWith {
|
||||
(_this select 1) call CBA_fnc_removePerFrameHandler;
|
||||
|
||||
// Remove effects from JIP
|
||||
|
@ -25,6 +25,15 @@ params ["_object", ["_destroyWhenFinished", false], ["_source", objNull], ["_ins
|
||||
|
||||
if (isNull _object) exitWith {};
|
||||
|
||||
// Check if the object can cook its ammo off
|
||||
if (
|
||||
underwater _object ||
|
||||
{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])}
|
||||
}) exitWith {};
|
||||
|
||||
// Don't have an object detonate its ammo twice
|
||||
if (_object getVariable [QGVAR(isAmmoDetonating), false]) exitWith {};
|
||||
|
||||
|
@ -29,16 +29,14 @@ if (isNull _object) exitWith {};
|
||||
private _hasFinished = _totalAmmo <= 0 || {_magazines isEqualTo []};
|
||||
|
||||
// If the cook-off has finished or been interrupted, clean up the effects for boxes (no vehicle effects)
|
||||
if (_hasFinished ||
|
||||
{underwater _object} || {
|
||||
if (GVAR(ammoCookoffDuration) == 0) exitWith {true};
|
||||
|
||||
if (_object isKindOf "ReammoBox_F") exitWith {
|
||||
!(GVAR(enableAmmobox) && {_object getVariable [QGVAR(enableAmmoCookoff), true]})
|
||||
};
|
||||
|
||||
!(GVAR(enableAmmoCookoff) && {_object getVariable [QGVAR(enableAmmoCookoff), true]})
|
||||
}) exitWith {
|
||||
if (
|
||||
_hasFinished ||
|
||||
{underwater _object} ||
|
||||
{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])}
|
||||
) exitWith {
|
||||
if (_object isKindOf "ReammoBox_F") then {
|
||||
[QGVAR(cleanupEffects), _object] call CBA_fnc_globalEvent;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
[
|
||||
QGVAR(enable),
|
||||
"LIST",
|
||||
"CHECKBOX",
|
||||
[LSTRING(enable_name), LSTRING(enable_tooltip)],
|
||||
LSTRING(category_displayName),
|
||||
[[0, 1, 2], ["STR_A3_OPTIONS_DISABLED", ELSTRING(common,playerOnly), ELSTRING(common,playersAndAI)], 2],
|
||||
true,
|
||||
1,
|
||||
{[QGVAR(enable), _this] call EFUNC(common,cbaSettings_settingChanged)}
|
||||
] call CBA_fnc_addSetting;
|
||||
|
@ -17,10 +17,10 @@
|
||||
<Czech>ACE Vznícení munice</Czech>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_CookOff_enable_name">
|
||||
<English>Enable vehicle cook-off</English>
|
||||
<English>Enable vehicle cook-off effects</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_CookOff_enable_tooltip">
|
||||
<English>Enables vehicle cook-off effects (fire and sound).</English>
|
||||
<English>Enables vehicle cook-off effects (fire and fire sound, but doesn't include ammunition detonations).</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_CookOff_enableBoxCookoff_name">
|
||||
<English>Enable ammo box cook-off</English>
|
||||
|
Loading…
Reference in New Issue
Block a user