Fix death cam height and rare duplicate weapon error

Vanilla commit:

1e01536fa7
This commit is contained in:
ebayShopper
2017-12-05 14:19:55 -05:00
parent 5e9a7271e9
commit 6edc98adb9
4 changed files with 25 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
private ["_amount","_item","_pos","_nearByPile","_holder","_type"];
private ["_amount","_item","_pos","_manualPos","_nearByPile","_holder","_type"];
//Radius to search for holder
#define PILE_SEARCH_RADIUS 2
@@ -8,11 +8,10 @@ private ["_amount","_item","_pos","_nearByPile","_holder","_type"];
_item = _this select 0;
_type = _this select 1;
_amount = _this select 2;
_manualPos = count _this > 3;
_pos = if (_manualPos) then {_this select 3} else {player modeltoWorld PILE_OFFSET};
_holder = objNull;
//Lets get the location of the player in the world
_pos = player modeltoWorld PILE_OFFSET;
//Check if a holder is close by the player.
_nearByPile= nearestObjects [_pos, ["WeaponHolder","WeaponHolderBase"],PILE_SEARCH_RADIUS];
@@ -23,13 +22,15 @@ if (count _nearByPile == 0) then {
//Found a near by weapon holder lets select it.
_holder = _nearByPile select 0;
//check to make sure the player can see the selected weapon holder.
_objects = lineIntersectsWith [(_holder modeltoWorld PILE_OFFSET), _pos, player, _holder, true];
//Can you see the current selected weapon holder
if ((count _objects) > 0) then {
//Unable to see the current selected weapon holder within the radius lets create a new one.
_holder = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"];
if (!_manualPos) then {
//check to make sure the player can see the selected weapon holder.
_objects = lineIntersectsWith [(_holder modeltoWorld PILE_OFFSET), _pos, player, _holder, true];
//Can you see the current selected weapon holder
if (count _objects > 0) then {
//Unable to see the current selected weapon holder within the radius lets create a new one.
_holder = createVehicle ["WeaponHolder", _pos, [], 0, "CAN_COLLIDE"];
};
};
};