mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add a 10% chance for the unjam action to fail (like in ACE2)
This commit is contained in:
@ -32,4 +32,10 @@ class ACE_Settings {
|
|||||||
displayName = CSTRING(unJamOnreload_displayName);
|
displayName = CSTRING(unJamOnreload_displayName);
|
||||||
description = CSTRING(unJamOnreload_description);
|
description = CSTRING(unJamOnreload_description);
|
||||||
};
|
};
|
||||||
|
class GVAR(unJamFailChance) {
|
||||||
|
typeName = "SCALAR";
|
||||||
|
value = 0.1;
|
||||||
|
displayName = CSTRING(unJamFailChance_displayName);
|
||||||
|
description = CSTRING(unJamFailChance_description);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -23,18 +23,9 @@ TRACE_3("params",_unit,_weapon,_skipAnim);
|
|||||||
private _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []];
|
private _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []];
|
||||||
|
|
||||||
if (_weapon in _jammedWeapons) then {
|
if (_weapon in _jammedWeapons) then {
|
||||||
_jammedWeapons = _jammedWeapons - [_weapon];
|
private _delay = 0;
|
||||||
|
|
||||||
_unit setVariable [QGVAR(jammedWeapons), _jammedWeapons];
|
|
||||||
|
|
||||||
if (_jammedWeapons isEqualTo []) then {
|
|
||||||
private _id = _unit getVariable [QGVAR(JammingActionID), -1];
|
|
||||||
[_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler);
|
|
||||||
_unit setVariable [QGVAR(JammingActionID), -1];
|
|
||||||
};
|
|
||||||
|
|
||||||
if !(_skipAnim) then {
|
if !(_skipAnim) then {
|
||||||
|
_delay = 2.5;
|
||||||
private _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_clearJamAction");
|
private _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_clearJamAction");
|
||||||
|
|
||||||
if (_clearJamAction == "") then {
|
if (_clearJamAction == "") then {
|
||||||
@ -51,7 +42,27 @@ if (_weapon in _jammedWeapons) then {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(DisplayTextOnJam)) then {
|
// Check if the jam will be successfull
|
||||||
[localize LSTRING(WeaponUnjammed)] call EFUNC(common,displayTextStructured);
|
if (random 1 > GVAR(unJamFailChance)) then {
|
||||||
|
// Success
|
||||||
|
_jammedWeapons = _jammedWeapons - [_weapon];
|
||||||
|
_unit setVariable [QGVAR(jammedWeapons), _jammedWeapons];
|
||||||
|
if (_jammedWeapons isEqualTo []) then {
|
||||||
|
private _id = _unit getVariable [QGVAR(JammingActionID), -1];
|
||||||
|
[_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler);
|
||||||
|
_unit setVariable [QGVAR(JammingActionID), -1];
|
||||||
|
};
|
||||||
|
if (GVAR(DisplayTextOnJam)) then {
|
||||||
|
[{
|
||||||
|
[localize LSTRING(WeaponUnjammed)] call EFUNC(common,displayTextStructured);
|
||||||
|
}, [], _delay] call EFUNC(common,waitAndExecute);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Failure
|
||||||
|
if (GVAR(DisplayTextOnJam)) then {
|
||||||
|
[{
|
||||||
|
[localize LSTRING(WeaponUnjamFailed)] call EFUNC(common,displayTextStructured);
|
||||||
|
}, [], _delay] call EFUNC(common,waitAndExecute);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#define COMPONENT overheating
|
#define COMPONENT overheating
|
||||||
#include "\z\ace\addons\main\script_mod.hpp"
|
#include "\z\ace\addons\main\script_mod.hpp"
|
||||||
|
|
||||||
// #define DEBUG_MODE_FULL
|
#define DEBUG_MODE_FULL
|
||||||
// #define DISABLE_COMPILE_CACHE
|
#define DISABLE_COMPILE_CACHE
|
||||||
// #define CBA_DEBUG_SYNCHRONOUS
|
// #define CBA_DEBUG_SYNCHRONOUS
|
||||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||||
|
|
||||||
|
@ -61,6 +61,12 @@
|
|||||||
<Key ID="STR_ACE_Overheating_unJamOnreload_description">
|
<Key ID="STR_ACE_Overheating_unJamOnreload_description">
|
||||||
<English>Reloading clears a weapon jam.</English>
|
<English>Reloading clears a weapon jam.</English>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Overheating_unJamFailChance_displayName">
|
||||||
|
<English>Chance of unjam failing</English>
|
||||||
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Overheating_unJamFailChance_description">
|
||||||
|
<English>Probability that an unjam action might fail, requiring to be repeated.</English>
|
||||||
|
</Key>
|
||||||
<Key ID="STR_ACE_Overheating_SpareBarrelName">
|
<Key ID="STR_ACE_Overheating_SpareBarrelName">
|
||||||
<English>Spare barrel</English>
|
<English>Spare barrel</English>
|
||||||
<German>Ersatzlauf</German>
|
<German>Ersatzlauf</German>
|
||||||
@ -121,6 +127,9 @@
|
|||||||
<Portuguese>Arma destravada</Portuguese>
|
<Portuguese>Arma destravada</Portuguese>
|
||||||
<Italian>Arma pronta al fuoco</Italian>
|
<Italian>Arma pronta al fuoco</Italian>
|
||||||
</Key>
|
</Key>
|
||||||
|
<Key ID="STR_ACE_Overheating_WeaponUnjamFailed">
|
||||||
|
<English>Jam failed to clear</English>
|
||||||
|
</Key>
|
||||||
<Key ID="STR_ACE_Overheating_SwapBarrel">
|
<Key ID="STR_ACE_Overheating_SwapBarrel">
|
||||||
<English>Swap barrel</English>
|
<English>Swap barrel</English>
|
||||||
<German>Lauf wechseln</German>
|
<German>Lauf wechseln</German>
|
||||||
|
Reference in New Issue
Block a user