forked from acemod/ACE3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trenches - Add modded Entrenching Tools support (acemod#8999)
* Add support for other entrenching tools * Docs * Remove unused variable * Check unit weapons for entrenching tool `weapons` returns weapons in weapon slots and from all containers. * Update addons/trenches/README.md Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com> * Support for shovel Backpacks * Update XEH_preStart.sqf * Add Arsenal "Entrenching Tool" stat Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com> Co-authored-by: PabstMirror <pabstmirror@gmail.com>
- Loading branch information
1 parent
a03c5db
commit 4c23737
Showing
16 changed files
with
118 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class EGVAR(arsenal,stats) { | ||
class statBase; | ||
class GVAR(entrenchingTool): statBase { | ||
scope = 2; | ||
priority = -1; | ||
stats[] = {QGVAR(entrenchingTool)}; | ||
displayName = CSTRING(EntrenchingToolName); | ||
showText = 1; | ||
textStatement = QUOTE(localize 'STR_ACE_Common_Yes'); // using localization macros in QUOTE is a PITA | ||
condition = QUOTE(getNumber (_this select 1 >> (_this select 0) select 0) > 0); | ||
tabs[] = {{0,1,5}, {7}}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,7 @@ class CfgWeapons { | |
class ItemInfo: CBA_MiscItem_ItemInfo { | ||
mass = 10; | ||
}; | ||
|
||
GVAR(entrenchingTool) = 1; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,7 @@ | ||
ace_trenches | ||
================= | ||
|
||
Adds item 'ACE_entrenchingtool' | ||
Adds 2 trenches; Envelope - Small & Envelop - Big | ||
|
||
### Whitelist surfaces for digging | ||
Single surfaces can be whitelisted by adding `ACE_canDig = 1` into `CfgSurfaces`. | ||
Example: | ||
```cpp | ||
class CfgSurfaces { | ||
class myAwesomeSurface { | ||
ACE_canDig = 1; | ||
}; | ||
}; | ||
``` | ||
Provides players with the capability of digging trenches. | ||
|
||
Adds item 'ACE_EntrenchingTool' | ||
Adds 2 trenches; Envelope - Small & Envelop - Big |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
#include "script_component.hpp" | ||
|
||
#include "XEH_PREP.hpp" | ||
|
||
private _entrenchingTools = (QUOTE(getNumber (_x >> QQGVAR(entrenchingTool)) > 0) configClasses (configFile >> "CfgWeapons") apply {configName _x}); | ||
_entrenchingTools append (QUOTE(getNumber (_x >> QQGVAR(entrenchingTool)) > 0) configClasses (configFile >> "CfgVehicles") apply {configName _x}); | ||
TRACE_1("",_entrenchingTools); | ||
|
||
uiNamespace setVariable [QGVAR(entrenchingTools), compileFinal str _entrenchingTools]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: veteran29 | ||
* Checks if unit has entrenching tool. | ||
* | ||
* Arguments: | ||
* 0: Unit <OBJECT> | ||
* | ||
* Return Value: | ||
* Has entrenching tool <BOOL> | ||
* | ||
* Example: | ||
* [bob] call ace_trenches_fnc_hasEntrenchingTool | ||
* | ||
* Public: Yes | ||
*/ | ||
|
||
params [ | ||
["_unit", objNull, [objNull]] | ||
]; | ||
|
||
private _uniqueItems = _unit call EFUNC(common,uniqueItems); | ||
_uniqueItems append weapons _unit; | ||
_uniqueItems pushBack backpack _unit; | ||
|
||
GVAR(entrenchingTools) findIf {_x in _uniqueItems} != -1 // return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
layout: wiki | ||
title: Trenches Framework | ||
description: Explains how to set-up surface whitelisting and entrenching tools. | ||
group: framework | ||
order: 5 | ||
parent: wiki | ||
mod: ace | ||
version: | ||
major: 3 | ||
minor: 5 | ||
patch: 0 | ||
--- | ||
|
||
## 1. Config Values | ||
|
||
### 1.1 Whitelisting surfaces for digging | ||
|
||
Single surfaces can be whitelisted by adding `ACE_canDig = 1` into `CfgSurfaces`. | ||
```cpp | ||
class CfgSurfaces { | ||
class myAwesomeSurface { | ||
ACE_canDig = 1; | ||
}; | ||
}; | ||
``` | ||
### 1.2 Enabling entrenching tool features on an item or backpack | ||
```cpp | ||
class CfgWeapons { // same config also works on backpacks (CfgVehicles) | ||
class yourBaseClass; | ||
class yourEntrenchingToolClass: yourBaseClass | ||
ace_trenches_entrenchingTool = 1; | ||
}; | ||
}; | ||
``` | ||
|
||
## 2. Scripting | ||
|
||
### 2.1 Checking if unit has entrenching tool | ||
|
||
`ace_trenches_fnc_hasEntrenchingTool` | ||
Used to check if unit has any entrenching capable tool. | ||
|
||
```sqf | ||
* Checks if unit has entrenching tool. | ||
* | ||
* Arguments: | ||
* 0: Unit <OBJECT> | ||
* | ||
* Return Value: | ||
* Has entrenching tool <BOOL> | ||
* | ||
* Example: | ||
* [bob] call ace_trenches_fnc_hasEntrenchingTool | ||
``` |