Skip to content

Commit

Permalink
Arsenal - Add stat to show how AI will use ammo (#8434)
Browse files Browse the repository at this point in the history
* Arsenal - Show AI Usage

* Add condition and move to ballistics

* Add stringtables

* add getVar
  • Loading branch information
PabstMirror authored Aug 29, 2023
1 parent e6a8222 commit fdb7330
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
10 changes: 10 additions & 0 deletions addons/ballistics/ACE_Arsenal_Stats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,14 @@ class EGVAR(arsenal,stats) {
textStatement = QUOTE([ARR_2(_this select 0, _this select 1)] call FUNC(statTextStatement_weaponMuzzleVelocity));
tabs[] = {{0,1}, {}};
};
class ACE_magazineAiUsage: statBase {
scope = 2;
priority = 0;
stats[] = {"aiAmmoUsageFlags"};
displayName= CSTRING(ammoUsage_ai);
showText= 1;
textStatement = QUOTE(call FUNC(statTextStatement_magazineAiUsage));
condition = QUOTE(is3DEN || {!isNull getAssignedCuratorLogic player} || {missionNamespace getVariable [ARR_2(QQGVAR(showAIMagazineUse), missionName == 'Arsenal')]});
tabs[] = {{}, {4}};
};
};
3 changes: 2 additions & 1 deletion addons/ballistics/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
PREP(statTextStatement_weaponMuzzleVelocity);
PREP(statTextStatement_magazineAiUsage);
PREP(statTextStatement_magazineMuzzleVelocity);
PREP(statTextStatement_weaponMuzzleVelocity);
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "script_component.hpp"
/*
* Author: PabstMirror
* Text statement for the magazine's AI Usage.
*
* Arguments:
* 0: not used
* 1: item config path (CONFIG)
*
* Return Value:
* String to display
*
* Public: No
*/

params ["", "_config"];
TRACE_1("statTextStatement_magazineAiUsage",_config);

private _ammo = getText (_config >> "ammo");
private _aiAmmoUsageFlags = getNumber (configFile >> "CfgAmmo" >> _ammo >> "aiAmmoUsageFlags");
private _cost = getNumber (configFile >> "CfgAmmo" >> _ammo >> "cost");

private _output = [];

if ([_aiAmmoUsageFlags, 1] call BIS_fnc_bitflagsCheck) then { _output pushBack LLSTRING(ammoUsageShort_illumination) };
if ([_aiAmmoUsageFlags, 4] call BIS_fnc_bitflagsCheck) then { _output pushBack LLSTRING(ammoUsageShort_concealment) };
if ([_aiAmmoUsageFlags, 64] call BIS_fnc_bitflagsCheck) then { _output pushBack LLSTRING(ammoUsageShort_infantry) };
if ([_aiAmmoUsageFlags, 128] call BIS_fnc_bitflagsCheck) then { _output pushBack LLSTRING(ammoUsageShort_lightVehicle) };
if ([_aiAmmoUsageFlags, 256] call BIS_fnc_bitflagsCheck) then { _output pushBack LLSTRING(ammoUsageShort_armor) };
if ([_aiAmmoUsageFlags, 512] call BIS_fnc_bitflagsCheck) then { _output pushBack LLSTRING(ammoUsageShort_aircraft) };

(_output joinString ", ") + format [" [%1 %2]", localize "str_a3_cfgvehicles_modulecuratorsetobjectcost_f_arguments_cost", _cost]
21 changes: 21 additions & 0 deletions addons/ballistics/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3511,5 +3511,26 @@
<Turkish>Namlu çıkış hızı</Turkish>
<Korean>총구 속도</Korean>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsage_ai">
<English>AI Usage</English>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsageShort_illumination">
<English>Illum</English>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsageShort_concealment">
<English>Smoke</English>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsageShort_infantry">
<English>Inf</English>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsageShort_lightVehicle">
<English>Veh</English>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsageShort_armor">
<English>Armor</English>
</Key>
<Key ID="STR_ACE_Ballistics_ammoUsageShort_aircraft">
<English>Air</English>
</Key>
</Package>
</Project>

0 comments on commit fdb7330

Please sign in to comment.