Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Timi007 committed Aug 22, 2022
2 parents 123abeb + 488015b commit 7107ce9
Show file tree
Hide file tree
Showing 13 changed files with 215 additions and 41 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<p align="center">
<a href="https://github.com/Metis-Team/mts_enhanced/releases/latest">
<img src="https://img.shields.io/badge/Version-1.4.3-blue.svg?style=flat-square" alt="Metis Enhanced Version">
<img src="https://img.shields.io/badge/Version-1.5.0-blue.svg?style=flat-square" alt="Metis Enhanced Version">
</a>
<a href="https://github.com/Metis-Team/mts_enhanced/releases/latest">
<img src="https://img.shields.io/github/downloads/Metis-Team/mts_enhanced/total.svg?style=flat-square&label=Downloads" alt="Metis Enhanced Downloads">
Expand All @@ -31,7 +31,7 @@

## Components:
- **Armory**: Allows you to save and load loadouts from a database across all server and missions.
- **Common**: Grass cutter ACE action and chat commands for logged in admins.
- **Common**: Grass and bush cutter ACE action and chat commands for logged in admins.
- **Cords**: Cords for PBW uniforms (BW Kleiderkammer).
- **Drill**: Animation and actions for exercise.
- **Engineer**: Equipment for engineers like a Mine Clearing Line Charge (MICLIC).
Expand Down
4 changes: 3 additions & 1 deletion addons/common/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
PREP(addBushCutter);
PREP(addChatCommands);
PREP(addGrassCutter);
PREP(areModsLoaded);
PREP(arsenalPBWFix);
PREP(parseNameToPlayer)
PREP(parseNameToPlayer);
PREP(seesBush);
1 change: 1 addition & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "script_component.hpp"

call FUNC(addBushCutter);
call FUNC(addGrassCutter);
call FUNC(arsenalPBWFix);
call FUNC(addChatCommands);
26 changes: 1 addition & 25 deletions addons/common/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,6 @@ PREP_RECOMPILE_END;
private _version = getText (configFile >> "CfgPatches" >> "mts_main" >> "versionStr");
INFO_1("Metis Enhanced version: %1.", _version);

//grasscutter on/off
[
QGVAR(grasscutter_enabled),
"CHECKBOX",
[LLSTRING(grasscutter), LLSTRING(grasscutter_tooltip)],
[LELSTRING(main,category), LLSTRING(subCategory)],
true,
0,
{}
] call CBA_fnc_addSetting;

//grasscutter size
[
QGVAR(grasscutter_size),
"LIST",
[LLSTRING(grasscutter_size), LLSTRING(grasscutter_size_tooltip)],
[LELSTRING(main,category), LLSTRING(subCategory)],
[
[0, 1],
[LLSTRING(grasscutter_size_large), LLSTRING(grasscutter_size_medium)],
1
],
0,
{}
] call CBA_fnc_addSetting;
#include "initSettings.hpp"

ADDON = true;
52 changes: 52 additions & 0 deletions addons/common/functions/fnc_addBushCutter.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#include "script_component.hpp"
/**
* Author: Timi007
*
* Description:
* Adds ability to destroy the bush infront of the player.
*
* Parameter(s):
* None
*
* Returns:
* Nothing
*
* Example:
* call mts_common_fnc_addBushCutter
*
*/

CHECK(!GVAR(bushcutter_enabled) || !hasinterface);

private _action = [
QGVAR(bushcutter),
LLSTRING(bushcutter_removeBush),
QPATHTOF(ui\mts_bushcutter.paa),
{
params ["", "_player"];

private _bush = [_player, BUSH_CUTTING_DISTANCE] call FUNC(seesBush);

if (isNull _bush) exitWith {WARNING("No bush found. Cannot remove bush.")};

if ((stance _player) isEqualTo "PRONE") then {
_player playMove "AinvPpneMstpSnonWnonDnon_Putdown_AmovPpneMstpSnonWnonDnon";
} else {
_player playMove "AinvPknlMstpSnonWnonDnon_medic0";
};

[GVAR(bushcutter_duration), [_bush], {
(_this select 0) params ["_bush"];

// TODO: When Arma v2.12 releases, change to _bush setDamage [1, true, _player, _player]; (server execution)
_bush setDamage 1;
}, {}, LLSTRING(bushcutter_removeBush)
] call ace_common_fnc_progressBar;
},
{
params ["", "_player"];
[_player, objNull] call ace_common_fnc_canInteractWith &&
{!isNull ([_player, BUSH_CUTTING_DISTANCE] call FUNC(seesBush))}
}
] call ace_interact_menu_fnc_createAction;
[(typeOf ACE_player), 1, ["ACE_SelfActions", "ACE_Equipment"], _action] call ace_interact_menu_fnc_addActionToClass;
25 changes: 16 additions & 9 deletions addons/common/functions/fnc_addGrassCutter.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,31 @@
CHECK(!GVAR(grasscutter_enabled) || !hasinterface);

private _action = [
QGVAR(grasscutterAction),
QGVAR(grasscutter),
LLSTRING(grasscutter_removeGrass),
QPATHTOF(ui\mts_grasscutter.paa),
{
if ((stance player) isEqualTo "PRONE") then {
player playMove "AinvPpneMstpSnonWnonDnon_Putdown_AmovPpneMstpSnonWnonDnon";
params ["", "_player"];

if ((stance _player) isEqualTo "PRONE") then {
_player playMove "AinvPpneMstpSnonWnonDnon_Putdown_AmovPpneMstpSnonWnonDnon";
} else {
player playMove "AinvPknlMstpSnonWnonDnon_medic0";
_player playMove "AinvPknlMstpSnonWnonDnon_medic0";
};

[5, [], {
private _cutter = (["Land_ClutterCutter_Large_F", "Land_ClutterCutter_Medium_F"] select GVAR(grasscutter_size)) createVehicle [0,0,0];
_cutter setPos (getpos player);
[GVAR(grasscutter_duration), [_player], {
(_this select 0) params ["_player"];

private _cutterType = ["Land_ClutterCutter_Large_F", "Land_ClutterCutter_Medium_F"] select GVAR(grasscutter_size);

private _cutter = _cutterType createVehicle [0, 0, 0];
_cutter setPosATL (getPosATL _player);
}, {}, LLSTRING(grasscutter_removeGrass)
] call ace_common_fnc_progressBar;
},
{
[player, objNull] call ace_common_fnc_canInteractWith;
params ["", "_player"];
[_player, objNull] call ace_common_fnc_canInteractWith
}
] call ace_interact_menu_fnc_createAction;
[(typeOf player), 1, ["ACE_SelfActions", "ACE_Equipment"], _action] call ace_interact_menu_fnc_addActionToClass;
[(typeOf ACE_player), 1, ["ACE_SelfActions", "ACE_Equipment"], _action] call ace_interact_menu_fnc_addActionToClass;
37 changes: 37 additions & 0 deletions addons/common/functions/fnc_seesBush.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "script_component.hpp"
/**
* Author: Timi007
*
* Description:
* Checks if the given unit sees a bush in front of him. Returns the bush if available.
*
* Parameter(s):
* 0: OBJECT - Unit.
* 1: NUMBER - Max distance to search for bushes.
*
* Returns:
* OBJECT - Bush that the given unit sees or objNull if there is no bush.
*
* Example:
* [player] call mts_common_fnc_seesBush;
*
*/

params ["_player", ["_maxDistance", 5, [0]]];

private _startPosASL = eyePos _player;
private _endPosASL = _startPosASL vectoradd (getCameraViewDirection _player vectorMultiply _maxDistance);

private _intersections = lineIntersectsSurfaces [_startPosASL, _endPosASL, _player, objNull, true, 1, "VIEW"];

if (_intersections isEqualTo []) exitWith {objNull};

(_intersections select 0) params ["_bushPosASL", "", "_bush", "_parentObject"];

// Not a bush but maybe ground
if (isNull _bush && isNull _parentObject) exitWith {objNull};

// If is not a bush, exit
if (nearestTerrainObjects [_bush, ["Bush"], 0] isEqualTo []) exitWith {objNull};

_bush
61 changes: 61 additions & 0 deletions addons/common/initSettings.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#define MIN_DURATION 1
#define MAX_DURATION 60
#define TRAILING_DECIMALS 0

#define DEFAULT_GRASSCUTTER_DURATION 5
#define DEFAULT_BUSHCUTTER_DURATION 10

// Grasscutter: On/off
[
QGVAR(grasscutter_enabled),
"CHECKBOX",
[LLSTRING(grasscutter), LLSTRING(grasscutter_tooltip)],
[LELSTRING(main,category), LLSTRING(grasscutter_subCategory)],
true,
0
] call CBA_fnc_addSetting;

// Grasscutter: Size
[
QGVAR(grasscutter_size),
"LIST",
[LLSTRING(grasscutter_size), LLSTRING(grasscutter_size_tooltip)],
[LELSTRING(main,category), LLSTRING(grasscutter_subCategory)],
[
[0, 1],
[LLSTRING(grasscutter_size_large), LLSTRING(grasscutter_size_medium)],
1
],
0
] call CBA_fnc_addSetting;

// Grasscutter: Time it takes to cut grass
[
QGVAR(grasscutter_duration),
"SLIDER",
[LLSTRING(grasscutter_duration), LLSTRING(grasscutter_duration_tooltip)],
[LELSTRING(main,category), LLSTRING(grasscutter_subCategory)],
[MIN_DURATION, MAX_DURATION, DEFAULT_GRASSCUTTER_DURATION, TRAILING_DECIMALS],
1 // Server setting
] call CBA_fnc_addSetting;


// Bushcutter: On/off
[
QGVAR(bushcutter_enabled),
"CHECKBOX",
[LLSTRING(bushcutter), LLSTRING(bushcutter_tooltip)],
[LELSTRING(main,category), LLSTRING(bushcutter_subCategory)],
true,
0
] call CBA_fnc_addSetting;

// Bushcutter: Time it takes to cut down a bush
[
QGVAR(bushcutter_duration),
"SLIDER",
[LLSTRING(bushcutter_duration), LLSTRING(bushcutter_duration_tooltip)],
[LELSTRING(main,category), LLSTRING(bushcutter_subCategory)],
[MIN_DURATION, MAX_DURATION, DEFAULT_BUSHCUTTER_DURATION, TRAILING_DECIMALS],
1 // Server setting
] call CBA_fnc_addSetting;
2 changes: 2 additions & 0 deletions addons/common/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
#endif

#include "\z\mts_enhanced\addons\main\script_macros.hpp"

#define BUSH_CUTTING_DISTANCE 2
36 changes: 35 additions & 1 deletion addons/common/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project name="mts">
<Package name="common">
<Container name="Grasscutter">
<Key ID="STR_mts_common_subCategory">
<Key ID="STR_mts_common_grasscutter_subCategory">
<Original>Grass cutter</Original>
<German>Grasschneider</German>
</Key>
Expand Down Expand Up @@ -34,6 +34,40 @@
<Original>Medium</Original>
<German>Mittel</German>
</Key>
<Key ID="STR_mts_common_grasscutter_duration">
<Original>Duration</Original>
<German>Dauer</German>
</Key>
<Key ID="STR_mts_common_grasscutter_duration_tooltip">
<Original>Time it takes in seconds to remove grass.</Original>
<German>Zeit in Sekunden, um Gras zu enfernen.</German>
</Key>
</Container>
<Container name="Bushcutter">
<Key ID="STR_mts_common_bushcutter_subCategory">
<Original>Bush cutter</Original>
<German>Buschschere</German>
</Key>
<Key ID="STR_mts_common_bushcutter">
<Original>Add bush cutter</Original>
<German>Buschschere hinzufügen</German>
</Key>
<Key ID="STR_mts_common_bushcutter_tooltip">
<Original>Adds the bush cutter to ACE interaction menu.</Original>
<German>Fügt die Buschschere zu dem ACE Interaktionmenu hinzu.</German>
</Key>
<Key ID="STR_mts_common_bushcutter_removeBush">
<Original>Remove bush</Original>
<German>Busch entfernen</German>
</Key>
<Key ID="STR_mts_common_bushcutter_duration">
<Original>Duration</Original>
<German>Dauer</German>
</Key>
<Key ID="STR_mts_common_bushcutter_duration_tooltip">
<Original>Time it takes in seconds to remove a bush.</Original>
<German>Zeit in Sekunden, um einen Busch zu enfernen.</German>
</Key>
</Container>
<Container name="chatCommands">
<Key ID="STR_mts_common_chatCommands_zeusCreated">
Expand Down
Binary file added addons/common/ui/mts_bushcutter.paa
Binary file not shown.
6 changes: 3 additions & 3 deletions addons/main/script_version.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define MAJOR 1
#define MINOR 4
#define PATCHLVL 3
#define BUILD 220502
#define MINOR 5
#define PATCHLVL 0
#define BUILD 220822
2 changes: 2 additions & 0 deletions meta.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
protocol = 1;
publishedid = 2799167087;

0 comments on commit 7107ce9

Please sign in to comment.