Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Check ammo self interaction setting #7306

Merged
merged 2 commits into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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