Add an unjam action to the interact menu when the weapon is jammed

This commit is contained in:
esteldunedain 2016-02-20 20:19:56 -03:00
parent 2dbf979ec6
commit 11f3189306
6 changed files with 38 additions and 4 deletions

View File

@ -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} );

Binary file not shown.

View File

@ -22,9 +22,8 @@ GVAR(cacheWeaponData) setText QGVAR(cacheWeaponData);
// Conditions: canInteract
if !([ACE_player, objNull, ["isNotInside"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific
if !([ACE_player] call EFUNC(common,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);

View File

@ -2,6 +2,7 @@
ADDON = false;
PREP(canUnjam);
PREP(checkTemperature);
PREP(clearJam);
PREP(displayTemperature);

View 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 EFUNC(common,canUseWeapon)) exitWith {
false
};
true

View File

@ -17,7 +17,7 @@
*/
#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), []];