From 6edc98adb9835d64006a9fd54b5488424e397253 Mon Sep 17 00:00:00 2001 From: ebayShopper Date: Tue, 5 Dec 2017 14:19:55 -0500 Subject: [PATCH] Fix death cam height and rare duplicate weapon error Vanilla commit: https://github.com/DayZMod/DayZ/commit/1e01536fa70e4d73717a180c7364d350cdb5b488 --- CHANGE LOG 1.0.6.2.txt | 2 ++ SQF/dayz_code/compile/fn_dropItem.sqf | 23 ++++++++++++----------- SQF/dayz_code/compile/player_death.sqf | 15 ++++++++++----- Server Files/Battleye/scripts.txt | 2 +- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/CHANGE LOG 1.0.6.2.txt b/CHANGE LOG 1.0.6.2.txt index 4ec7017ee..418488d22 100644 --- a/CHANGE LOG 1.0.6.2.txt +++ b/CHANGE LOG 1.0.6.2.txt @@ -86,6 +86,8 @@ [FIXED] Updates to humanity and player stats after a skin change not always saving in hive (server_getDiff) [FIXED] Bad vehicle type crew error for RHIB2Turret on A2OA main menu intro scene [FIXED] Fresh spawns running on login if they died while running +[FIXED] Death camera height incorrect when player dies above terrain level +[FIXED] Duplicate weapon error when player dies with the same weapon in hands and on back [NOTE] Fixes below were included in hotfix 1.0.6.1A (March 10th 2017) and are now in the default files. [FIXED] Fixed food and drink going down 10x faster from melee and other "working" actions. diff --git a/SQF/dayz_code/compile/fn_dropItem.sqf b/SQF/dayz_code/compile/fn_dropItem.sqf index 82f2a53ce..758f84537 100644 --- a/SQF/dayz_code/compile/fn_dropItem.sqf +++ b/SQF/dayz_code/compile/fn_dropItem.sqf @@ -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"]; + }; }; }; diff --git a/SQF/dayz_code/compile/player_death.sqf b/SQF/dayz_code/compile/player_death.sqf index f4764c8c1..4ed242bf2 100644 --- a/SQF/dayz_code/compile/player_death.sqf +++ b/SQF/dayz_code/compile/player_death.sqf @@ -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; diff --git a/Server Files/Battleye/scripts.txt b/Server Files/Battleye/scripts.txt index 00e258dd8..4724cbe7f 100644 --- a/Server Files/Battleye/scripts.txt +++ b/Server Files/Battleye/scripts.txt @@ -29,7 +29,7 @@ 5 playableUnits !"for [{_y=0},{_y < count(playableUnits)},{_y=_y+1}] do {" !"typeName player == \"OBJECT\" && {(player in playableUnits" !"AND {((alive _x) AND {((vehicle _x) distance _obj < 150)})}} count playableUnits)}) then {" !="_local = { _unit distance _x < _dis; } count playableUnits <= 1;" !"if (!_isOk) exitWith {false};\nuiSleep 0.001;\n} forEach playableUnits;" !"ManagementMustBeClose) then { player nearEntities [\"CAManBase\", 10] } else { playableUnits };" 5 selectPlayer !"addSwitchableUnit dayz_originalPlayer;\nsetPlayable dayz_originalPlayer;\nselectPlayer dayz_originalPlayer;" !"addSwitchableUnit _newUnit;\nsetPlayable _newUnit;\nselectPlayer _newUnit;" 5 serverCommand !="_character = if (serverCommandAvailable \"#kick\") then { call sched_tg_follow } else { player };" !"serverCommand (\"#vote kick \" + _selectedName);" -5 setDamage !"if (_entity isKindOf \"Animal\") then {\n_entity setDamage 1;" !"player setDamage 1;\n};\n\nif (dayz_onBack != \"\") then {\n_body addWeapon dayz_onBack;" !"if (_ent isKindOf \"Animal\" || _ent isKindOf \"zZombie_base\") then {\n_ent setDamage 1;" +5 setDamage !"if (_entity isKindOf \"Animal\") then {\n_entity setDamage 1;" !"player setDamage 1;\n};\n\nif (dayz_onBack != \"\") then {\nif (dayz_onBack in w" !"if (_ent isKindOf \"Animal\" || _ent isKindOf \"zZombie_base\") then {\n_ent setDamage 1;" 5 setDammage 5 SetEventHandler !"\n_menu ctrlSetEventHandler [\"ButtonClick\",_compile];\n};" !"inGameUISetEventHandler [\"Action\",\"false\"];" 5 setMarkerAlpha