Add Check ammo self interaction setting (#7306)

This commit is contained in:
Filip Maciejewski 2019-12-18 18:31:08 +01:00 committed by jonpas
parent 7f62067a7b
commit ead5105070
7 changed files with 52 additions and 1 deletions

View File

@ -1,6 +1,17 @@
class CfgVehicles { class CfgVehicles {
class Man; class Man;
class CAManBase: Man { class CAManBase: Man {
class ACE_SelfActions {
class ACE_Equipment {
class GVAR(checkAmmo) {
displayName = CSTRING(checkAmmo);
condition = QUOTE(GVAR(showCheckAmmoSelf) && {_player call FUNC(canCheckAmmoSelf)});
statement = QUOTE(call FUNC(checkAmmo));
exceptions[] = {"isNotInside", "isNotSwimming", "isNotSitting"};
};
};
};
class ACE_Actions { class ACE_Actions {
class ACE_Weapon { class ACE_Weapon {
class GVAR(LinkBelt) { class GVAR(LinkBelt) {

View File

@ -1,5 +1,6 @@
PREP(canCheckAmmo); PREP(canCheckAmmo);
PREP(canCheckAmmoSelf);
PREP(getAmmoToLinkBelt); PREP(getAmmoToLinkBelt);
PREP(checkAmmo); PREP(checkAmmo);
PREP(displayAmmo); PREP(displayAmmo);

View File

@ -8,7 +8,7 @@ if (!hasInterface) exitWith {};
// Conditions: canInteract // Conditions: canInteract
if !([ACE_player, vehicle ACE_player, ["isNotInside", "isNotSwimming", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false}; if !([ACE_player, vehicle ACE_player, ["isNotInside", "isNotSwimming", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// Conditions: specific // Conditions: specific
if !(ACE_player call CBA_fnc_canUseWeapon || {(vehicle ACE_player) isKindOf "StaticWeapon"}) exitWith {false}; if !(ACE_player call FUNC(canCheckAmmoSelf)) exitWith {false};
// Ignore if controlling UAV (blocks radar keybind) // Ignore if controlling UAV (blocks radar keybind)
if (!isNull (ACE_controlledUAV param [0, objNull])) exitWith {false}; if (!isNull (ACE_controlledUAV param [0, objNull])) exitWith {false};

View File

@ -6,4 +6,6 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp" #include "XEH_PREP.hpp"
PREP_RECOMPILE_END; PREP_RECOMPILE_END;
#include "initSettings.sqf"
ADDON = true; ADDON = true;

View File

@ -0,0 +1,20 @@
#include "script_component.hpp"
/*
* Author: veteran29
* Check if the player can check his own ammo.
*
* Arguments:
* 0: Player <OBJECT>
*
* Return Value:
* Can check ammo <BOOL>
*
* Example:
* [cursorObject] call ace_reload_fnc_canCheckAmmoSelf
*
* Public: No
*/
params ["_player"];
_player call CBA_fnc_canUseWeapon && {!((vehicle _player) isKindOf "StaticWeapon")}

View File

@ -0,0 +1,9 @@
[
QGVAR(showCheckAmmoSelf),
"CHECKBOX",
[LSTRING(SettingShowCheckAmmoSelf), LSTRING(SettingShowCheckAmmoSelfDesc)],
localize ELSTRING(common,ACEKeybindCategoryWeapons),
false, // default value
0 // isGlobal
] call CBA_fnc_addSetting;

View File

@ -33,6 +33,14 @@
<Chinesesimp>在重新装填时检查新弹匣上的弹药.</Chinesesimp> <Chinesesimp>在重新装填时检查新弹匣上的弹药.</Chinesesimp>
<Chinese>在重新裝填時檢查新彈匣上的彈藥.</Chinese> <Chinese>在重新裝填時檢查新彈匣上的彈藥.</Chinese>
</Key> </Key>
<Key ID="STR_ACE_Reload_SettingShowCheckAmmoSelf">
<English>Always show check ammo self interaction</English>
<Polish>Zawsze pokazuj interakcję od sprawdzania amunicji</Polish>
</Key>
<Key ID="STR_ACE_Reload_SettingShowCheckAmmoSelfDesc">
<English>Shows check ammo self interaction even when not in static weapons.</English>
<Polish>Pokazuje interakcję od sprawdzania amunicji poza bronią statyczną.</Polish>
</Key>
<Key ID="STR_ACE_Reload_checkAmmo"> <Key ID="STR_ACE_Reload_checkAmmo">
<English>Check Ammo</English> <English>Check Ammo</English>
<German>Munition prüfen</German> <German>Munition prüfen</German>