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:
parent
dc7c4ff4fd
commit
e4e2f0d661
@ -32,4 +32,10 @@ class ACE_Settings {
|
||||
displayName = CSTRING(unJamOnreload_displayName);
|
||||
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), []];
|
||||
|
||||
if (_weapon in _jammedWeapons) then {
|
||||
_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];
|
||||
};
|
||||
|
||||
private _delay = 0;
|
||||
if !(_skipAnim) then {
|
||||
|
||||
_delay = 2.5;
|
||||
private _clearJamAction = getText (configFile >> "CfgWeapons" >> _weapon >> "ACE_clearJamAction");
|
||||
|
||||
if (_clearJamAction == "") then {
|
||||
@ -51,7 +42,27 @@ if (_weapon in _jammedWeapons) then {
|
||||
};
|
||||
};
|
||||
|
||||
if (GVAR(DisplayTextOnJam)) then {
|
||||
[localize LSTRING(WeaponUnjammed)] call EFUNC(common,displayTextStructured);
|
||||
// Check if the jam will be successfull
|
||||
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
|
||||
#include "\z\ace\addons\main\script_mod.hpp"
|
||||
|
||||
// #define DEBUG_MODE_FULL
|
||||
// #define DISABLE_COMPILE_CACHE
|
||||
#define DEBUG_MODE_FULL
|
||||
#define DISABLE_COMPILE_CACHE
|
||||
// #define CBA_DEBUG_SYNCHRONOUS
|
||||
// #define ENABLE_PERFORMANCE_COUNTERS
|
||||
|
||||
|
@ -61,6 +61,12 @@
|
||||
<Key ID="STR_ACE_Overheating_unJamOnreload_description">
|
||||
<English>Reloading clears a weapon jam.</English>
|
||||
</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">
|
||||
<English>Spare barrel</English>
|
||||
<German>Ersatzlauf</German>
|
||||
@ -121,6 +127,9 @@
|
||||
<Portuguese>Arma destravada</Portuguese>
|
||||
<Italian>Arma pronta al fuoco</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Overheating_WeaponUnjamFailed">
|
||||
<English>Jam failed to clear</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Overheating_SwapBarrel">
|
||||
<English>Swap barrel</English>
|
||||
<German>Lauf wechseln</German>
|
||||
|
Loading…
Reference in New Issue
Block a user