1- private [" _amount" ," _item" ," _pos" ," _nearByPile" ," _holder" ," _type" ];
1+ private [" _amount" ," _item" ," _pos" ," _manualPos " , " _nearByPile" ," _holder" ," _type" ];
22
33// Radius to search for holder
44#define PILE_SEARCH_RADIUS 2
@@ -8,11 +8,10 @@ private ["_amount","_item","_pos","_nearByPile","_holder","_type"];
88_item = _this select 0 ;
99_type = _this select 1 ;
1010_amount = _this select 2 ;
11+ _manualPos = count _this > 3 ;
12+ _pos = if (_manualPos ) then {_this select 3 } else {player modeltoWorld PILE_OFFSET};
1113_holder = objNull ;
1214
13- // Lets get the location of the player in the world
14- _pos = player modeltoWorld PILE_OFFSET;
15-
1615// Check if a holder is close by the player.
1716_nearByPile = nearestObjects [_pos , [" WeaponHolder" ," WeaponHolderBase" ],PILE_SEARCH_RADIUS];
1817
@@ -23,13 +22,15 @@ if (count _nearByPile == 0) then {
2322 // Found a near by weapon holder lets select it.
2423 _holder = _nearByPile select 0 ;
2524
26- // check to make sure the player can see the selected weapon holder.
27- _objects = lineIntersectsWith [(_holder modeltoWorld PILE_OFFSET), _pos , player , _holder , true ];
28-
29- // Can you see the current selected weapon holder
30- if ((count _objects ) > 0 ) then {
31- // Unable to see the current selected weapon holder within the radius lets create a new one.
32- _holder = createVehicle [" WeaponHolder" , _pos , [], 0 , " CAN_COLLIDE" ];
25+ if (! _manualPos ) then {
26+ // check to make sure the player can see the selected weapon holder.
27+ _objects = lineIntersectsWith [(_holder modeltoWorld PILE_OFFSET), _pos , player , _holder , true ];
28+
29+ // Can you see the current selected weapon holder
30+ if (count _objects > 0 ) then {
31+ // Unable to see the current selected weapon holder within the radius lets create a new one.
32+ _holder = createVehicle [" WeaponHolder" , _pos , [], 0 , " CAN_COLLIDE" ];
33+ };
3334 };
3435};
3536
0 commit comments