mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-20 02:16:29 +03:00
Fix death cam height and rare duplicate weapon error
Vanilla commit:
1e01536fa7
This commit is contained in:
@@ -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"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ if (typeName (_this select 0) == "ARRAY") then {
|
||||
_killed = false;
|
||||
};
|
||||
|
||||
_deathPos = getPos _body;
|
||||
_deathPos = getPosATL _body;
|
||||
_playerID = getPlayerUID player;
|
||||
|
||||
//Switch view to camera so player does not see debug plains at respawn_west
|
||||
@@ -25,7 +25,7 @@ _camera camSetDir 0;
|
||||
_camera camSetFOV 1;
|
||||
_camera cameraEffect ["Internal","TOP"];
|
||||
_camera camSetTarget _deathPos;
|
||||
_camera camSetPos [_deathPos select 0, (_deathPos select 1) + 2, 5];
|
||||
_camera camSetPos [_deathPos select 0, (_deathPos select 1) + 2, (_deathPos select 2) + 5];
|
||||
_camera camCommit 0;
|
||||
|
||||
if (!_killed) then {
|
||||
@@ -34,7 +34,12 @@ if (!_killed) then {
|
||||
};
|
||||
|
||||
if (dayz_onBack != "") then {
|
||||
_body addWeapon dayz_onBack;
|
||||
if (dayz_onBack in weapons _body) then {
|
||||
//Prevent duplicate weapon error
|
||||
[dayz_onBack,2,1,[_deathPos select 0,_deathPos select 1,0]] call fn_dropItem;
|
||||
} else {
|
||||
_body addWeapon dayz_onBack;
|
||||
};
|
||||
};
|
||||
|
||||
//Get killer information immediately. Weapon, distance or vehicle can change in seconds.
|
||||
@@ -53,7 +58,7 @@ _ammo = if (count _this > 2) then {_this select 2} else {""};
|
||||
|
||||
if (!isNull _source) then {
|
||||
if (!isNull _body) then {
|
||||
_distance = round (_body distance _source);
|
||||
_distance = round (_deathPos distance _source);
|
||||
};
|
||||
|
||||
_sourceVehicleType = typeOf (vehicle _source);
|
||||
@@ -178,7 +183,7 @@ if ((_body == (vehicle _body)) && {_animState != "deadstate" && {_animCheck != "
|
||||
_deathPos = _this select 2;
|
||||
|
||||
waitUntil {camCommitted _camera};
|
||||
_camera camSetPos [_deathPos select 0, (_deathPos select 1) + 2, 15];
|
||||
_camera camSetPos [_deathPos select 0, (_deathPos select 1) + 2, (_deathPos select 2) + 15];
|
||||
_camera camCommit 4;
|
||||
uiSleep 5;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user