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 Nov 24, 2024
2 parents 9854b1b + 96d23b5 commit accbed2
Show file tree
Hide file tree
Showing 27 changed files with 657 additions and 18 deletions.
4 changes: 4 additions & 0 deletions .hemtt/lints.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[sqf.var_all_caps]
options.ignore = [
"MTS_RECOMPILES", "MTS_PREP_RECOMPILE"
]
2 changes: 1 addition & 1 deletion 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.6.4-blue.svg?style=flat-square" alt="Metis Enhanced Version">
<img src="https://img.shields.io/badge/Version-1.7.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 Down
18 changes: 18 additions & 0 deletions addons/engineer/CfgVehicles.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,22 @@ class CfgVehicles {
ace_dragging_canDrag = 1;
ace_dragging_dragPosition[] = {0, 1.2, 0};
};

// Assault Breacher Vehicle / MiRPz
class APC_Tracked_01_base_F;
class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F {
class Attributes;
};
class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F {
class Attributes: Attributes {
class GVAR(mineClearing) {
displayName = CSTRING(mineClearingDisplayName);
property = QGVAR(enableMineClearing);
control = "Checkbox";
defaultValue = "true";
typeName = "BOOL";
expression = QUOTE(_this setVariable [ARR_3(QQGVAR(enableMineClearing),_value,true)];); // Only run on server
};
};
};
};
6 changes: 6 additions & 0 deletions addons/engineer/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
PREP(addIgniteMiclicAction);
PREP(canStartMineClearing);
PREP(canStopMineClearing);
PREP(handleMineClearingEffects);
PREP(igniteMiclic);
PREP(initMineClearingActions);
PREP(startMineClearing);
PREP(stopMineClearing);
8 changes: 8 additions & 0 deletions addons/engineer/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ PREP_RECOMPILE_START;
PREP_RECOMPILE_END;

ADDON = true;

["B_APC_Tracked_01_CRV_F", "InitPost", {
_this call FUNC(initMineClearingActions);
}, nil, nil, true] call CBA_fnc_addClassEventHandler;

["gm_BPz2a0_base", "InitPost", {
_this call FUNC(initMineClearingActions);
}, nil, nil, true] call CBA_fnc_addClassEventHandler;
2 changes: 1 addition & 1 deletion addons/engineer/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CfgPatches {
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"mts_main", "ace_cargo", "ace_dragging"};
author = ECSTRING(main,authors);
authors[] = {"Timi007", "Mishkar"};
authors[] = {"Timi007", "Mishkar", "Lemonberries"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
Expand Down
18 changes: 18 additions & 0 deletions addons/engineer/engineer_compat_gm/CfgVehicles.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class CfgVehicles {
class gm_Leopard1_base;
class gm_BPz2_base: gm_Leopard1_base {
class Attributes;
};
class gm_BPz2a0_base: gm_BPz2_base {
class Attributes: Attributes {
class GVAR(mineClearing) {
displayName = CSTRING(mineClearingDisplayName);
property = QGVAR(enableMineClearing);
control = "Checkbox";
defaultValue = "true";
typeName = "BOOL";
expression = QUOTE(_this setVariable [ARR_3(QQGVAR(enableMineClearing),_value,true)];); // Only run on server
};
};
};
};
23 changes: 23 additions & 0 deletions addons/engineer/engineer_compat_gm/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "script_component.hpp"

class CfgPatches {
class SUBADDON {
name = COMPONENT_NAME;
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {
QUOTE(ADDON),
"gm_vehicles_land_tracked_bpz2"
};
skipWhenMissingDependencies = 1;
author = ECSTRING(main,authors);
authors[] = {"Timi007"};
url = ECSTRING(main,URL);
VERSION_CONFIG;

addonRootClass = QUOTE(ADDON);
};
};

#include "CfgVehicles.hpp"
3 changes: 3 additions & 0 deletions addons/engineer/engineer_compat_gm/script_component.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#define SUBCOMPONENT compat_gm
#define SUBCOMPONENT_BEAUTIFIED Compat GM
#include "..\script_component.hpp"
26 changes: 26 additions & 0 deletions addons/engineer/functions/fnc_canStartMineClearing.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "script_component.hpp"
/**
* Author: Timi007
*
* Description:
* Checks if the vehicle can start clearing mines.
*
* Parameter(s):
* 0: OBJECT - Mine clearing vehicle (ABV/MiRPz)
* 1: OBJECT - Caller
*
* Returns:
* BOOLEAN - Can start clearing mines.
*
* Example:
* _this call mts_engineer_fnc_canStartMineClearing
*
*/

params ["_vehicle", "_caller"];

(_caller isEqualTo (driver _vehicle)) && // is driver of the vehicle
{_vehicle getVariable [QGVAR(enableMineClearing), true]} && // mine clearing enabled
{!(_vehicle getVariable [QGVAR(mineClearingActive), false])} && // not already mine clearing
{speed _vehicle <= MAX_MINE_CLEARING_SPEED} &&
{isEngineOn _vehicle}
23 changes: 23 additions & 0 deletions addons/engineer/functions/fnc_canStopMineClearing.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "script_component.hpp"
/**
* Author: Timi007
*
* Description:
* Checks if the vehicle can stop clearing mines.
*
* Parameter(s):
* 0: OBJECT - Mine clearing vehicle (ABV/MiRPz)
* 1: OBJECT - Caller
*
* Returns:
* BOOLEAN - Can stop clearing mines.
*
* Example:
* _this call mts_engineer_fnc_canStopMineClearing
*
*/

params ["_vehicle", "_caller"];

(_caller isEqualTo (driver _vehicle)) && // is driver of the vehicle
{_vehicle getVariable [QGVAR(mineClearingActive), false]} // mine clearing is active
118 changes: 118 additions & 0 deletions addons/engineer/functions/fnc_handleMineClearingEffects.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#include "script_component.hpp"
/**
* Author: Timi007
*
* Description:
* Spawn and move the particles during mine clearing.
*
* Parameter(s):
* 0: OBJECT - Mine clearing vehicle (ABV/MiRPz)
*
* Returns:
* Nothing.
*
* Example:
* _this call mts_engineer_fnc_handleMineClearingEffects
*
*/

params [["_vehicle", objNull, [objNull]]];

private _pos = getPos _vehicle;

private _dustParticle = "#particlesource" createVehicleLocal _pos;
_dustParticle setParticleCircle [0, [0, 0, 0]];
_dustParticle setParticleRandom
[
2, // lifeTimeVar
[0.5, 3, 0], // positionVar
[5, 5, 10], // moveVelocityVar
1, // rotationVelocityVar
0, // sizeVar
[0, 0, 0, 0.01], // colorVar
0, // randomDirectionPeriodVar
0, // randomDirectionIntensityVar
0 // angleVar
];
_dustParticle setDropInterval 0.01;

private _dirtParticle = "#particlesource" createVehicleLocal _pos;
_dirtParticle setParticleCircle [0, [0, 0, 0]];
_dirtParticle setParticleRandom
[
2,
[0.5, 3, 0],
[15, 15, 5],
0.1,
0,
[0, 0, 0, 0],
0,
0
];
_dirtParticle setDropInterval 0.5;

[{
params ["_PFHArgs", "_PFHID"];
_PFHArgs params ["_vehicle", "_dustParticle", "_dirtParticle"];

if (!(_vehicle getVariable [QGVAR(mineClearingActive), false])) exitWith {
[_PFHID] call CBA_fnc_removePerFrameHandler;

deleteVehicle _dustParticle;
deleteVehicle _dirtParticle;
};

private _vectorDir = vectorDirVisual _vehicle;

_dustParticle setParticleParams
[
["\A3\data_f\cl_basic", 1, 0, 1],
"",
"Billboard",
1,
4, // lifeTime
[0, 4, -2.5], // pos3D
[(_vectorDir select 0) * 50, (_vectorDir select 1) * 50, 22], // moveVelocity
0, // rotationVelocity
1.6, // weight
1, // volume
0.3, // rubbing
[2.2, 4, 6], // size
[[0.060, 0.04, 0.02, 0.6], [0.050, 0.035, 0.02, 0.4], [0.030, 0.025, 0.015, 0.2]], // color
[1], // animationSpeed
3, // randomDirectionPeriod
3, // randomDirectionIntensity
"", // onTimerScript
"", // beforeDestroyScript
_vehicle,
0, // angle
true, // onSurface
0.1 // bounceOnSurface
];

_dirtParticle setParticleParams
[
["\A3\data_f\ParticleEffects\Universal\Mud", 1, 0, 1],
"",
"SpaceObject",
1,
10,
[0, 4, -2.5],
[(_vectorDir select 0) * 20, (_vectorDir select 1) * 20, 10],
0,
2,
0.1,
0.1,
[0.2],
[[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],
[0.08],
0,
0,
"",
"",
_vehicle,
0,
true,
0.2
];
}, DIRT_SFX_UPDATE_INTERVAL, [_vehicle, _dustParticle, _dirtParticle]] call CBA_fnc_addPerFrameHandler;
2 changes: 1 addition & 1 deletion addons/engineer/functions/fnc_igniteMiclic.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Nothing.
*
* Example:
* [this] call mts_items_fnc_igniteMiclic
* [this] call mts_engineer_fnc_igniteMiclic
*
*/

Expand Down
68 changes: 68 additions & 0 deletions addons/engineer/functions/fnc_initMineClearingActions.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include "script_component.hpp"
/**
* Author: Timi007
*
* Description:
* Adds actions for mine clearing to the vehicle.
*
* Parameter(s):
* 0: OBJECT - Mine clearing vehicle (ABV/MiRPz)
*
* Returns:
* Nothing.
*
* Example:
* _this call mts_engineer_fnc_initMineClearingActions
*
*/

params [["_vehicle", objNull, [objNull]]];

_vehicle addAction [
LLSTRING(startMineClearing),
{
params ["_vehicle"];

[_vehicle] call FUNC(startMineClearing);
},
[], // _arguments
2, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
QUOTE([ARR_2(_target,_this)] call FUNC(canStartMineClearing))
];

_vehicle addAction [
LLSTRING(stopMineClearing),
{
params ["_vehicle"];

[_vehicle] call FUNC(stopMineClearing);
},
[], // _arguments
2, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
QUOTE([ARR_2(_target,_this)] call FUNC(canStopMineClearing))
];

// If driver leaves vehicle during mine clearing, speed limiter and allowDamage need to be set again
_vehicle addEventHandler ["Local", {
params ["_vehicle", "_isLocal"];

TRACE_1("Locality changed during mine clearing",_this);

if (_vehicle getVariable [QGVAR(mineClearingActive), false]) then {
// Set speed limiter and damage again
_vehicle setCruiseControl [MAX_MINE_CLEARING_SPEED, false];
_vehicle allowDamage false;
} else {
// Set speed limiter and damage again
_vehicle setCruiseControl [0, false];
if (_vehicle getVariable [QGVAR(originalIsDamageAllowed), true]) then {
_vehicle allowDamage true;
};
};
}];
Loading

0 comments on commit accbed2

Please sign in to comment.