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

Fortify - Add item/weapon/backpack fortify tool property #10290

Merged
merged 5 commits into from
Sep 5, 2024
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
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
Loading