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 Jan 19, 2022
2 parents aa830ee + 7ea2e37 commit 4903f9f
Show file tree
Hide file tree
Showing 18 changed files with 300 additions and 138 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A collection of useful components to enhance the MilSim gameplay experience for

<p align="center">
<a href="https://github.com/Metis-Team/mts_enhanced/releases/latest">
<img src="https://img.shields.io/badge/Version-1.3.2-blue.svg?style=flat-square" alt="Metis Marker Version">
<img src="https://img.shields.io/badge/Version-1.3.3-blue.svg?style=flat-square" alt="Metis Marker 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 Marker Downloads">
Expand Down
4 changes: 2 additions & 2 deletions addons/engineer/functions/fnc_igniteMiclic.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*
* Parameter(s):
* 0: OBJECT - Object which should act like a MICLIC.
* 1: NUMBER - Effective mine clearing distance in meters (optional, default: 75m).
* 2: NUMBER - First fuse delay before launching the rocket-projected explosive line charge (optional, default: 30 seconds).
* 1: NUMBER - Effective mine clearing distance in meters (optional, default: 70 m).
* 2: NUMBER - First fuse delay before launching the rocket-projected explosive line charge (optional, default: 45 seconds).
* 3: NUMBER - Second fuse delay before detonating the explosive line charge (optional, default: 5 seconds).
* 4: NUMBER - Launch angle in degrees of the rocket attached to the explosive line charge (optional, default: 45°).
*
Expand Down
4 changes: 2 additions & 2 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 3
#define PATCHLVL 2
#define BUILD 211112
#define PATCHLVL 3
#define BUILD 220119
25 changes: 0 additions & 25 deletions addons/map/CfgSounds.hpp

This file was deleted.

8 changes: 7 additions & 1 deletion addons/map/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
PREP(addOpenMapAction);
PREP(addPickupMapAction);
PREP(addPlaceMapAction);
PREP(mapActionMenu);
PREP(hasMap);
PREP(openMap);
PREP(pickupMap);
PREP(placeMapOnVehicle);
PREP(playMapSound);
PREP(removeMap);
15 changes: 10 additions & 5 deletions addons/map/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

CHECK(!hasinterface);

private _worldMap = format["Land_Map_%1_F", worldName];
private _worldMap = format ["Land_Map_%1_F", worldName];
if (!isNull (configFile >> "CfgVehicles" >> _worldMap)) then {
GVAR(itemMapClassname) = _worldMap;
} else {
Expand All @@ -14,20 +14,25 @@ if (!isNull (configFile >> "CfgVehicles" >> _worldMap)) then {

if (player isEqualTo _unit && !_isMapShown && !isNull GVAR(map)) then {
if (!GVAR(hasMap)) then {
player unlinkItem "ItemMap";
[_unit] call FUNC(removeMap);
};

GVAR(map) = objNull;
};
}] call CBA_fnc_addPlayerEventhandler;

call FUNC(addPlaceMapAction);

GVAR(map) = objNull;
[QGVAR(removeMap),{
[QGVAR(removeMap), {
params ["_map"];

if (visibleMap && {_map isEqualTo GVAR(map)}) then {
openMap false;
};
}] call CBA_fnc_addEventHandler;

[QGVAR(addMapActions), {
_this call FUNC(addOpenMapAction);
_this call FUNC(addPickupMapAction);
}] call CBA_fnc_addEventHandler;

call FUNC(addPlaceMapAction);
5 changes: 2 additions & 3 deletions addons/map/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"mts_main","ace_interact_menu","ace_common","a3_ui_f"};
requiredAddons[] = {"mts_main", "ace_interact_menu", "ace_common"};
author = ECSTRING(main,authors);
authors[] = {"PhILoX","Timi007"};
authors[] = {"PhILoX", "Timi007"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};

#include "CfgEventHandlers.hpp"
#include "CfgSounds.hpp"
37 changes: 37 additions & 0 deletions addons/map/functions/fnc_addOpenMapAction.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "script_component.hpp"
/**
* Author: PhILoX, Timi007
*
* Description:
* Adds the open map actions to the placed map.
* This function has a local effect.
*
* Parameter(s):
* 0: OBJECT - Placed map
*
* Returns:
* Nothing.
*
* Example:
* [_map] call mts_map_fnc_addOpenMapAction
*
*/

params [["_map", objNull, [objNull]]];

CHECK(!hasinterface || isNull _map);

private _openMap = [
QGVAR(openMap),
LLSTRING(openMap),
"A3\Ui_f\data\GUI\Rsc\RscDisplayArsenal\map_ca.paa",
{
params ["_map", "_player"];
[_player, _map] call FUNC(openMap);
},
{
params ["_map", "_player"];
[_player, _map] call ace_common_fnc_canInteractWith
}
] call ace_interact_menu_fnc_createAction;
[_map, 0, ["ACE_MainActions"], _openMap] call ace_interact_menu_fnc_addActionToObject;
42 changes: 42 additions & 0 deletions addons/map/functions/fnc_addPickupMapAction.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include "script_component.hpp"
/**
* Author: PhILoX, Timi007
*
* Description:
* Adds the pickup map actions to the placed map.
* This function has a local effect.
*
* Parameter(s):
* 0: OBJECT - Placed map
* 1: OBJECT - The vehicle which the map is placed on. (Optional, only needed if map was placed on vehicle)
*
* Returns:
* Nothing.
*
* Example:
* [_map] call mts_map_fnc_addPickupMapAction
*
*/

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

CHECK(!hasinterface || isNull _map);

private _pickupMap = [
QGVAR(pickupMap),
LLSTRING(pickupMap),
"A3\Ui_f\data\IGUI\Cfg\Actions\take_ca.paa",
{
params ["_map", "_player", "_args"];
_args params ["_vehicle"];

[_player, _map, _vehicle] call FUNC(pickupMap);
},
{
params ["_map", "_player"];
!([_player] call FUNC(hasMap)) && {[_player, _map] call ace_common_fnc_canInteractWith}
},
{},
[_vehicle]
] call ace_interact_menu_fnc_createAction;
[_map, 0, ["ACE_MainActions"], _pickupMap] call ace_interact_menu_fnc_addActionToObject;
19 changes: 10 additions & 9 deletions addons/map/functions/fnc_addPlaceMapAction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,37 @@ private _placeMapAction = [
{
params ["", "_player"];

if !((toLower (stance _player)) isEqualTo "crouch") then {
if ((stance _player) isNotEqualTo "CROUCH") then {
_player playAction "crouch";
};

[{(toLower (stance _this)) isEqualTo "crouch"}, {
[{(stance _this) isEqualTo "CROUCH"}, {
params ["_player"];

_player playAction "putdown";
private _sound = format [QGVAR(unfoldSound_%1), ((floor random 4) + 1)];
[_player, [_sound, 300]] remoteExecCall ["say3D"];
[_player, "unfold"] call FUNC(playMapSound);
}, _player] call CBA_fnc_waitUntilAndExecute;

[{((animationState _this) select [25,7]) isEqualTo "putdown"}, {
params ["_player"];

private _pos = _player getRelPos [1, 0];
_pos set [2, ((getposATL _player) select 2)];
_pos set [2, (getposATL _player) select 2];

private _map = GVAR(itemMapClassname) createVehicle [0,0,0];
private _map = GVAR(itemMapClassname) createVehicle [0, 0, 0];
_map setDir ((getDir _player) + 90);
_map setPosATL _pos;

[_map] remoteExecCall [QFUNC(mapActionMenu), 0, _map];
private _id = [QGVAR(addMapActions), [_map]] call CBA_fnc_globalEventJIP;
[_id, _map] call CBA_fnc_removeGlobalEventJIP; // Remove JIP when map is deleted

_player unlinkItem "ItemMap";
private _mapClass = [_player] call FUNC(removeMap);
_map setVariable [QGVAR(mapClass), _mapClass, true];
}, _player] call CBA_fnc_waitUntilAndExecute;
},
{
params ["", "_player"];
("ItemMap" in (assignedItems _player)) && {[_player, objNull] call ace_common_fnc_canInteractWith}
([_player] call FUNC(hasMap)) && {[_player, objNull] call ace_common_fnc_canInteractWith}
}
] call ace_interact_menu_fnc_createAction;

Expand Down
24 changes: 24 additions & 0 deletions addons/map/functions/fnc_hasMap.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "script_component.hpp"
/**
* Author: Timi007
*
* Description:
* Returns true if unit has a map; otherwise false.
*
* Parameter(s):
* 0: OBJECT - Unit to check.
*
* Returns:
* BOOLEAN - Unit has a map.
*
* Example:
* [player] call mts_map_fnc_hasMap
*
*/

params ["_player"];

private _map = (assignedItems _player) param [0, ""];
private _hasMap = getText (configFile >> "CfgWeapons" >> _map >> "simulation") == "ItemMap";

_hasMap
82 changes: 0 additions & 82 deletions addons/map/functions/fnc_mapActionMenu.sqf

This file was deleted.

35 changes: 35 additions & 0 deletions addons/map/functions/fnc_openMap.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "script_component.hpp"
/**
* Author: Timi007
*
* Description:
* Opens the map for a unit even if the unit has no map.
*
* Parameter(s):
* 0: OBJECT - Unit which should open a map.
* 1: OBJECT - The map object which the player interacted with.
* If this object is picked up, all units looking inside this map are forced out.
*
* Returns:
* BOOLEAN - Return true if the map of the unit is open.
*
* Example:
* [player, cursorObject] call mts_map_fnc_openMap
*
*/

params [["_player", objNull, [objNull]], ["_map", objNull, [objNull]]];

CHECK(isNull _player || isNull _map);

if ([_player] call FUNC(hasMap)) then {
GVAR(hasMap) = true;
} else {
GVAR(hasMap) = false;

private _mapClass = _map getVariable [QGVAR(mapClass), "ItemMap"];
_player linkItem _mapClass;
};

GVAR(map) = _map;
openMap true;
Loading

0 comments on commit 4903f9f

Please sign in to comment.