Skip to content

Commit

Permalink
Add Check ammo self interaction setting (#7306)
Browse files Browse the repository at this point in the history
  • Loading branch information
veteran29 authored and jonpas committed Dec 18, 2019
1 parent 7f62067 commit ead5105
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 1 deletion.
11 changes: 11 additions & 0 deletions addons/reload/CfgVehicles.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
class CfgVehicles {
class 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_Weapon {
class GVAR(LinkBelt) {
Expand Down
1 change: 1 addition & 0 deletions addons/reload/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

PREP(canCheckAmmo);
PREP(canCheckAmmoSelf);
PREP(getAmmoToLinkBelt);
PREP(checkAmmo);
PREP(displayAmmo);
Expand Down
2 changes: 1 addition & 1 deletion addons/reload/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (!hasInterface) exitWith {};
// Conditions: canInteract
if !([ACE_player, vehicle ACE_player, ["isNotInside", "isNotSwimming", "isNotSitting"]] call EFUNC(common,canInteractWith)) exitWith {false};
// 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)
if (!isNull (ACE_controlledUAV param [0, objNull])) exitWith {false};

Expand Down
2 changes: 2 additions & 0 deletions addons/reload/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;

#include "initSettings.sqf"

ADDON = true;
20 changes: 20 additions & 0 deletions addons/reload/functions/fnc_canCheckAmmoSelf.sqf
Original file line number Diff line number Diff line change
@@ -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")}
9 changes: 9 additions & 0 deletions addons/reload/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

[
QGVAR(showCheckAmmoSelf),
"CHECKBOX",
[LSTRING(SettingShowCheckAmmoSelf), LSTRING(SettingShowCheckAmmoSelfDesc)],
localize ELSTRING(common,ACEKeybindCategoryWeapons),
false, // default value
0 // isGlobal
] call CBA_fnc_addSetting;
8 changes: 8 additions & 0 deletions addons/reload/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@
<Chinesesimp>在重新装填时检查新弹匣上的弹药.</Chinesesimp>
<Chinese>在重新裝填時檢查新彈匣上的彈藥.</Chinese>
</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">
<English>Check Ammo</English>
<German>Munition prüfen</German>
Expand Down

0 comments on commit ead5105

Please sign in to comment.