Skip to content

Commit

Permalink
Fortify - Add item/weapon/backpack fortify tool property (#10290)
Browse files Browse the repository at this point in the history
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
  • Loading branch information
DartRuffian and johnb432 authored Sep 5, 2024
1 parent 00178ce commit 2f72c77
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions addons/fortify/CfgWeapons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class CfgWeapons {
picture = QPATHTOF(UI\hammer_ca.paa);
scope = 2;
ACE_isTool = 1;
GVAR(fortifyTool) = 1;
class ItemInfo: CBA_MiscItem_ItemInfo {
mass = 0;
};
Expand Down
2 changes: 2 additions & 0 deletions addons/fortify/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ GVAR(locations) = [];
// Custom deploy handlers
GVAR(deployHandlers) = [];

GVAR(fortifyTools) = keys (uiNamespace getVariable QGVAR(fortifyTools));

#include "initSettings.inc.sqf"

ADDON = true;
6 changes: 6 additions & 0 deletions addons/fortify/XEH_preStart.sqf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#include "script_component.hpp"

#include "XEH_PREP.hpp"

private _fortifyTools = (QUOTE(getNumber (_x >> QQGVAR(fortifyTool)) > 0) configClasses (configFile >> "CfgWeapons") apply {configName _x});
_fortifyTools append (QUOTE(getNumber (_x >> QQGVAR(fortifyTool)) > 0) configClasses (configFile >> "CfgVehicles") apply {configName _x});
TRACE_1("",_fortifyTools);

uiNamespace setVariable [QGVAR(fortifyTools), compileFinal (_fortifyTools createHashMapFromArray [])];
6 changes: 5 additions & 1 deletion addons/fortify/functions/fnc_canFortify.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@
params ["_player", ["_cost", 0]];

(missionNamespace getVariable [QGVAR(fortifyAllowed), true]) &&
{"ACE_Fortify" in (_player call EFUNC(common,uniqueItems))} &&
{
private _items = _player call EFUNC(common,uniqueItems);
_items append weapons _player;
_items pushBack backpack _player;
GVAR(fortifyTools) findAny _items != -1
} && {
private _budget = [side group _player] call FUNC(getBudget);
((_budget == -1) || {_budget >= _cost})
} && {
Expand Down
16 changes: 14 additions & 2 deletions docs/wiki/framework/fortify-framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,22 @@ The Fortify budget can be updated for any side using the function.
* [west, -250, false] call ace_fortify_fnc_updateBudget
```

## 2. Config Values

## 2. Events
### 2.1 Enabling fortify tools on an item or backpack
```cpp
class CfgWeapons { // same config also works on backpacks (CfgVehicles)
class yourBaseClass;
class yourFortifyToolClass: yourBaseClass {
ace_fortify_fortifyTool = 1;
};
};
```
## 3. Events
### 2.1 Listenable
### 3.1 Listenable
| Event Name | Passed Parameter(s) | Locality | Description |
| ---------- | ----------- | ------------------- | -------- |
Expand Down

0 comments on commit 2f72c77

Please sign in to comment.