mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #3371 from acemod/moreSevereJamming
More severe jamming
This commit is contained in:
commit
91e671085e
@ -26,4 +26,16 @@ class ACE_Settings {
|
||||
displayName = CSTRING(overheatingDispersion_displayName);
|
||||
description = CSTRING(overheatingDispersion_description);
|
||||
};
|
||||
class GVAR(unJamOnreload) {
|
||||
typeName = "BOOL";
|
||||
value = 0;
|
||||
displayName = CSTRING(unJamOnreload_displayName);
|
||||
description = CSTRING(unJamOnreload_description);
|
||||
};
|
||||
class GVAR(unJamFailChance) {
|
||||
typeName = "SCALAR";
|
||||
value = 0.1;
|
||||
displayName = CSTRING(unJamFailChance_displayName);
|
||||
description = CSTRING(unJamFailChance_description);
|
||||
};
|
||||
};
|
||||
|
@ -4,6 +4,15 @@ class CfgVehicles {
|
||||
class CAManBase: Man {
|
||||
class ACE_SelfActions {
|
||||
class ACE_Equipment {
|
||||
class ACE_UnJam {
|
||||
displayName = CSTRING(UnjamWeapon);
|
||||
condition = QUOTE( [_player] call FUNC(canUnjam) );
|
||||
exceptions[] = {"isNotInside", "isNotSitting"};
|
||||
statement = QUOTE( [ARR_2(_player, currentMuzzle _player)] call FUNC(clearJam); );
|
||||
showDisabled = 0;
|
||||
priority = 4;
|
||||
icon = QUOTE(PATHTOF(UI\unjam_ca.paa));
|
||||
};
|
||||
class ACE_SwapBarrel {
|
||||
displayName = CSTRING(SwapBarrel);
|
||||
condition = QUOTE( 'ACE_SpareBarrel' in items _player && {getNumber (configFile >> 'CfgWeapons' >> currentWeapon _player >> 'ACE_Overheating_allowSwapBarrel') == 1} );
|
||||
|
BIN
addons/overheating/UI/unjam_ca.paa
Normal file
BIN
addons/overheating/UI/unjam_ca.paa
Normal file
Binary file not shown.
@ -1,4 +1,5 @@
|
||||
|
||||
PREP(canUnjam);
|
||||
PREP(checkTemperature);
|
||||
PREP(clearJam);
|
||||
PREP(displayTemperature);
|
||||
|
@ -23,9 +23,8 @@ GVAR(cacheSilencerData) = call CBA_fnc_createNamespace;
|
||||
// Conditions: canInteract
|
||||
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
|
||||
// Conditions: specific
|
||||
if !([ACE_player] call CBA_fnc_canUseWeapon &&
|
||||
{currentWeapon ACE_player in (ACE_player getVariable [QGVAR(jammedWeapons), []])}
|
||||
) exitWith {false};
|
||||
|
||||
if !([ACE_player] call FUNC(canUnjam)) exitWith {false};
|
||||
|
||||
// Statement
|
||||
[ACE_player, currentMuzzle ACE_player, false] call FUNC(clearJam);
|
||||
|
25
addons/overheating/functions/fnc_canUnjam.sqf
Normal file
25
addons/overheating/functions/fnc_canUnjam.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Author: Commy2 and esteldunedain
|
||||
* Return true if the unit can unjam it's current weapon
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Player <OBJECT>
|
||||
*
|
||||
* Return Value:
|
||||
* Bool
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit"];
|
||||
TRACE_1("_unit",_unit);
|
||||
|
||||
private _jammedWeapons = _unit getVariable [QGVAR(jammedWeapons), []];
|
||||
if !(currentWeapon _unit in _jammedWeapons) exitWith {
|
||||
false
|
||||
};
|
||||
if !([_unit] call CBA_fnc_canUseWeapon) exitWith {
|
||||
false
|
||||
};
|
||||
true
|
@ -17,24 +17,15 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
params ["_unit", "_weapon", "_skipAnim"];
|
||||
params ["_unit", "_weapon", ["_skipAnim", false]];
|
||||
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);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -94,7 +94,7 @@ if (GVAR(showParticleEffects) && {(ACE_time > ((_unit getVariable [QGVAR(lastDro
|
||||
// Only compute jamming for the local player
|
||||
if (_unit != ACE_player) exitWith {END_COUNTER(firedEH);};
|
||||
|
||||
_jamChance = _jamChance * ([[0.5, 1.5, 7.5, 37.5], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray));
|
||||
_jamChance = _jamChance * ([[0.5, 1.5, 15, 150], 3 * _scaledTemperature] call EFUNC(common,interpolateFromArray));
|
||||
|
||||
// increase jam chance on dusty grounds if prone (and at ground level)
|
||||
if ((stance _unit == "PRONE") && {((getPosATL _unit) select 2) < 1}) then {
|
||||
|
@ -15,6 +15,8 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
if !(GVAR(unJamOnreload)) exitWith {};
|
||||
|
||||
params ["_unit", "_container", "_item"];
|
||||
TRACE_3("params",_unit,_container,_item);
|
||||
|
||||
|
@ -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,18 @@
|
||||
<Polish>Przegrzane bronie będą mniej celne oraz będą miały zmniejszoną prędkość pocisku. Wpływa na wszystkich graczy.</Polish>
|
||||
<Italian>Armi surriscaldate saranno meno precise ed avranno una ridotta velocità alla volata. Applica per tutti i giocatori.</Italian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Overheating_unJamOnreload_displayName">
|
||||
<English>Unjam weapon on reload</English>
|
||||
</Key>
|
||||
<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 +133,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