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 Feb 18, 2022
2 parents 4903f9f + 674a472 commit d41dc35
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 27 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.3-blue.svg?style=flat-square" alt="Metis Marker Version">
<img src="https://img.shields.io/badge/Version-1.3.4-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/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 3
#define BUILD 220119
#define PATCHLVL 4
#define BUILD 220218
1 change: 1 addition & 0 deletions addons/map/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PREP(addOpenMapAction);
PREP(addPickupMapAction);
PREP(addPlaceMapAction);
PREP(getPlaceMapOnVehicleParams);
PREP(hasMap);
PREP(openMap);
PREP(pickupMap);
Expand Down
13 changes: 4 additions & 9 deletions addons/map/functions/fnc_addPickupMapAction.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*
* 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.
Expand All @@ -18,7 +17,7 @@
*
*/

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

CHECK(!hasinterface || isNull _map);

Expand All @@ -27,16 +26,12 @@ private _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, _map] 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;
31 changes: 31 additions & 0 deletions addons/map/functions/fnc_getPlaceMapOnVehicleParams.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "script_component.hpp"
/**
* Author: Timi007
*
* Description:
* Returns the parameters needed for mts_map_fnc_placeMapOnVehicle.
* How to use: Place vehicle and map how you want the map to be placed when the action is performed.
* Call this function and pass the vehicle and map objects. The returned array are the parameters.
*
* Parameter(s):
* 0: OBJECT - Vehicle the map is placed on.
* 1: OBJECT - The placeholder map object.
*
* Returns:
* ARRAY - Parameters for mts_map_fnc_placeMapOnVehicle.
*
* Example:
* [this, map1] call mts_map_fnc_getPlaceMapOnVehicleParams
*
*/

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

CHECK(isNull _vehicle || isNull _mapObj);

private _class = typeOf _vehicle;
private _offset = _vehicle worldToModelVisual (ASLtoAGL (getPosASLVisual _mapObj));
private _vectorDir = vectorDir _mapObj;
private _vectorUp = vectorUp _mapObj;

[_class, _offset, [_vectorDir, _vectorUp]]
7 changes: 4 additions & 3 deletions addons/map/functions/fnc_pickupMap.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Parameter(s):
* 0: OBJECT - Player which takes the map from the ground.
* 1: OBJECT - The map object to pickup.
* 2: OBJECT - The vehicle the map object is attached to. (Optional, ignore if map object is not attached to anything)
*
* Returns:
* Nothing.
Expand All @@ -18,18 +17,20 @@
*
*/

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

CHECK(isNull _player || isNull _map);

[_player, "pickup"] call FUNC(playMapSound);
_player playAction "PutDown";

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

[QGVAR(removeMap), _map] call CBA_fnc_remoteEvent;

private _vehicle = attachedTo _map;

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

deleteVehicle _map;
Expand Down
26 changes: 18 additions & 8 deletions addons/map/functions/fnc_placeMapOnVehicle.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
* Parameter(s):
* 0: STRING - Classname of (typeOf) the vehicle.
* 1: ARRAY - Offset of map to the vehicle.
* 2. ARRAY - Dir and up vectors of the map.
* 2: ARRAY - Dir and up vectors of the map.
* 3: CODE - Addtional condition when to show action
* Passed arguments:
* 0: OBJECT - Vehicle.
* 1: OBJECT - Player.
* 2: ARRAY - Custom args (see param 4)).
* 4: ARRAY - Custom arguments for the condition.
*
* Returns:
* Nothing.
Expand All @@ -23,11 +29,12 @@
params [
["_vehClass", "", [""]],
["_offset", [0,0,0], [[]]],
["_vectorDirAndUp", [[0,1,0],[0,0,1]], [[]]]
["_vectorDirAndUp", [[0,1,0],[0,0,1]], [[]]],
["_condition", {true}, [{}]],
["_conditionArgs", [], [[]]]
];

CHECK(!hasinterface);
CHECK(_vehClass isEqualTo "");
CHECK(!hasinterface || _vehClass isEqualTo "");

private _placeMapOnVehAction = [
QGVAR(placeMapOnVehAction),
Expand All @@ -49,21 +56,24 @@ private _placeMapOnVehAction = [

_vehicle setVariable [QGVAR(isMapOnVehicle), true, true];

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

private _mapClass = [_player] call FUNC(removeMap);
_map setVariable [QGVAR(mapClass), _mapClass, true];
}, [_vehicle, _player, _offset, _vectorDirAndUp]] call CBA_fnc_waitUntilAndExecute;
},
{
params ["_vehicle", "_player"];
params ["_vehicle", "_player", "_args"];
_args params ["", "", "_condition", "_conditionArgs"];

([_player] call FUNC(hasMap)) &&
{[_player, _vehicle, ["isNotInside"]] call ace_common_fnc_canInteractWith} &&
{!(_vehicle getVariable [QGVAR(isMapOnVehicle), false])}
{!(_vehicle getVariable [QGVAR(isMapOnVehicle), false])} &&
{[_vehicle, _player, _conditionArgs] call _condition}
},
{},
[_offset, _vectorDirAndUp],
[_offset, _vectorDirAndUp, _condition, _conditionArgs],
_offset,
2
] call ace_interact_menu_fnc_createAction;
Expand Down
15 changes: 11 additions & 4 deletions addons/zeus/functions/fnc_initDrawIconEH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,21 @@ CHECK(!isNil {(_curatorModule getVariable QGVAR(unconsciousPlayers))});
private _unconsciousPlayers = _curatorModule getVariable [QGVAR(unconsciousPlayers), []];

{
private _pos = getPos _x;
private _pos = ASLToAGL (getPosASLVisual _x);
private _camPos = ASLToAGL (getPosASLVisual curatorCamera);
private _d = _pos distance _camPos;
private _scale = linearConversion [300, 730, _d, 1.5, 0, true]; // 300m => 1.5, 730m => 0

if (_scale < 0.01) then {
continue;
};

drawIcon3D [
"z\ace\addons\zeus\ui\Icon_Module_Zeus_Unconscious_ca.paa",
[0.9, 0, 0, 1],
[_pos select 0, _pos select 1, 2],
1.5, // Width
1.5, // Height
[_pos select 0, _pos select 1, (_pos select 2) + 2],
_scale, // Width
_scale, // Height
0, // Angle
"", // Text
1 // Shadow
Expand Down

0 comments on commit d41dc35

Please sign in to comment.