Skip to content

Commit 85997c8

Browse files
committed
Fixed - Sling Mask: Mask rotated the wrong way when slung
What ================= Fixed: The mask being rotated the wrong way when being displayed on the player's waist. Renamed: a few variables that were still referencing helmets from GRAD_slingHelmet. Issue ID: #14
1 parent 33fbb84 commit 85997c8

9 files changed

+91
-12
lines changed

addons/sling_mask/CfgFunctions.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ class CfgFunctions {
88
class actionSwap {};
99
class addMaskToWhitelist {};
1010
class whitelist {};
11+
class addSlungMask {};
12+
class EHGetOut {};
1113
};
1214
};
1315

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* ----------------------------------------------------------------------------
2+
Function: bnb_e_sling_mask_fnc_EHGetOut
3+
4+
Description:
5+
Eventhandler - Get Out. Does the actual mounting of the weapon holder
6+
onto the unit's waist both when mask is slung as well as when unit exits
7+
the vehicle they may be in.
8+
9+
Parameters:
10+
0: _unit <OBJECT>
11+
1: _position <STRING>
12+
2: _veh <OBJECT>
13+
14+
Returns:
15+
Nothing
16+
17+
Examples:
18+
[player, "", objNull] call bnb_e_sling_mask_fnc_EHGetOut;
19+
20+
Author:
21+
DerZade, Arend
22+
---------------------------------------------------------------------------- */
23+
params ["_unit","_position","_veh"];
24+
25+
if (isNil "_unit" or isNil "_veh") exitWith {["No proper argument(s) given."] call BIS_fnc_error};
26+
27+
private _wh = [_unit] call GRAD_slingHelmet_fnc_weaponHolder;
28+
29+
//attach and unhide the weaponholder (slung helmet)
30+
[_wh, [_unit,[0.15,-0.09,-0.75],"pelvis"]] remoteExec ["attachTo", 0];
31+
[_wh, [[-1,-0.8,30],[1,-0.8,1]]] remoteExec ["setVectorDirAndUp", 0];
32+
[_wh, false] remoteExec ["hideObjectGlobal", 0];

addons/sling_mask/functions/fn_actionSling.sqf

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ Examples:
1616
Author:
1717
DerZade, Arend
1818
---------------------------------------------------------------------------- */
19-
2019
params ["_unit"];
2120

22-
private _helmetClass = goggles _unit;
21+
private _maskClass = goggles _unit;
2322

2423
//can't sling a non existent helmet
25-
if (_helmetClass isEqualTo "") exitWith {};
24+
if (_maskClass isEqualTo "") exitWith {};
2625

27-
[_unit, _helmetClass] call GRAD_slingHelmet_fnc_addSlungHelmet;
26+
[_unit, _maskClass] call bnb_e_sling_mask_fnc_addSlungMask;
2827
_unit setVariable ["bnb_e_sling_mask_slung", 1];
2928
removegoggles _unit;

addons/sling_mask/functions/fn_actionSwap.sqf

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ removeGoggles _unit;
2929
// Check if _goggles is a slingable item
3030
if (_goggles in ([] call bnb_e_sling_mask_fnc_whitelist)) then {
3131

32-
[_unit, _goggles] call GRAD_slingHelmet_fnc_addSlungHelmet;
32+
[_unit, _goggles] call bnb_e_sling_mask_fnc_addSlungMask;
3333
_unit setVariable ["bnb_e_sling_mask_slung", 1];
3434

3535
} else {

addons/sling_mask/functions/fn_actionUnSling.sqf

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ Examples:
1616
Author:
1717
DerZade, Arend
1818
---------------------------------------------------------------------------- */
19-
2019
params ["_unit"];
2120

22-
private _helmetClass = [_unit] call GRAD_slingHelmet_fnc_getSlungHelmet;
21+
private _maskClass = [_unit] call GRAD_slingHelmet_fnc_getSlungHelmet;
2322

2423

2524
//can't unsling a non existent helmet
26-
if (_helmetClass isEqualTo "") exitWith {};
25+
if (_maskClass isEqualTo "") exitWith {};
2726

2827
[_unit] call GRAD_slingHelmet_fnc_removeSlungHelmet;
2928
_unit setVariable ["bnb_e_sling_mask_slung", 0];
30-
_unit addgoggles _helmetClass;
29+
_unit addgoggles _maskClass;

addons/sling_mask/functions/fn_addMaskToWhitelist.sqf

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ Examples:
2121
Author:
2222
DerZade, Arend
2323
---------------------------------------------------------------------------- */
24-
2524
if (isNil "_this") exitWith {};
2625
if (_this isEqualTo []) exitWith {};
2726

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/* ----------------------------------------------------------------------------
2+
Function: bnb_e_sling_mask_fnc_addSlungMask
3+
4+
Description:
5+
Adds a slung mask to the given unit.
6+
7+
Parameters:
8+
0: _unit <OBJECT>
9+
1: _maskClass <OBJECT>
10+
11+
Returns:
12+
Nothing
13+
14+
Examples:
15+
[player, "H_HelmetB_desert"] call bnb_e_sling_mask_fnc_addSlungMask;
16+
17+
Author:
18+
DerZade, Arend
19+
---------------------------------------------------------------------------- */
20+
params ["_unit", "_maskClass"];
21+
22+
//remove old helmet if unit has already a slung helmet
23+
if !(([_unit] call GRAD_slingHelmet_fnc_getSlungHelmet) isEqualTo "") then {
24+
[_unit] call GRAD_slingHelmet_fnc_removeSlungHelmet;
25+
};
26+
27+
//create weaponholder
28+
private _weaponHolder = createVehicle ["GRAD_slingHelmet_WeaponHolder", getPos _unit, [], 0, "CAN_COLLIDE"];
29+
_weaponHolder addItemCargoGlobal [_maskClass, 1];
30+
31+
//add EHs to unit
32+
private _getInID = _unit addEventHandler ["GetInMan",GRAD_slingHelmet_fnc_EHGetIn];
33+
private _getOutID = _unit addEventHandler ["GetOutMan",bnb_e_sling_mask_fnc_EHGetOut];
34+
private _killedID = _unit addEventHandler ["Killed",GRAD_slingHelmet_fnc_EHKilled];
35+
36+
_unit setVariable ["GRAD_slingHelmet_variable",[_maskClass, _weaponHolder, [_getInID,_getOutID,_killedID]], true];
37+
38+
//add HandleDisconnect-EH on server if not done yet
39+
if !(missionNamespace getVariable ["GRAD_slingHelmet_HDCEHadded",false]) then {
40+
["HandleDisconnect", GRAD_slingHelmet_fnc_EHHandleDisconnect] remoteExec ["addMissionEventHandler", 2];
41+
GRAD_slingHelmet_HDCEHadded = true;
42+
publicVariable "GRAD_slingHelmet_HDCEHadded";
43+
};
44+
45+
//execute vehicle shit
46+
if !(vehicle _unit isEqualTo _unit) then {
47+
[_unit, "", vehicle _unit] call GRAD_slingHelmet_fnc_EHGetIn;
48+
} else {
49+
[_unit, "", objNull] call bnb_e_sling_mask_fnc_EHGetOut;
50+
};

addons/sling_mask/functions/fn_canSlingMask.sqf

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Examples:
1616
Author:
1717
DerZade, Arend
1818
---------------------------------------------------------------------------- */
19-
2019
params ["_unit"];
2120

2221
//unit has to have goggles

addons/sling_mask/functions/fn_whitelist.sqf

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Examples:
1616
Author:
1717
DerZade, Arend
1818
---------------------------------------------------------------------------- */
19-
2019
#include "..\allowedMasks.hpp"
2120

2221
if (isNil "bnb_e_sling_mask_whitelist") then {

0 commit comments

Comments
 (0)