From 6a711deccc51ed8e98a92257c1238683223cf6e9 Mon Sep 17 00:00:00 2001 From: ebayShopper Date: Thu, 23 Mar 2017 15:58:14 -0400 Subject: [PATCH] Add reliable workaround for swimming in ground and air issue Fixes #1913 --- CHANGE LOG 1.0.6.2.txt | 2 +- SQF/dayz_code/compile/BIS_fnc/fn_halo.sqf | 8 +------- SQF/dayz_code/compile/fn_exitSwim.sqf | 11 +++++++++++ SQF/dayz_code/compile/player_switchModel.sqf | 1 + SQF/dayz_code/init/compiles.sqf | 1 + SQF/dayz_code/system/player_monitor.fsm | 1 + SQF/dayz_server/init/server_functions.sqf | 14 +------------- 7 files changed, 17 insertions(+), 21 deletions(-) create mode 100644 SQF/dayz_code/compile/fn_exitSwim.sqf diff --git a/CHANGE LOG 1.0.6.2.txt b/CHANGE LOG 1.0.6.2.txt index e34b28307..5babc6e4c 100644 --- a/CHANGE LOG 1.0.6.2.txt +++ b/CHANGE LOG 1.0.6.2.txt @@ -12,7 +12,7 @@ [FIXED] Player_forceSave is now called correctly when the abort menu is opened. It was previously using the wrong variable and time. [FIXED] The unconscious wake up animation can no longer be skipped by using a bandage or other right click actions. [FIXED] Sharpening a knife will no longer delete one if the player already had a fully sharpened knife on their toolbelt (duplicate weapon). -[FIXED] Swimming in ground when relogging on some maps again. #1913 @Cherdenko +[FIXED] Swimming in air or ground after relog, clothes change and respawn on certain maps. #1913 @Cherdenko [FIXED] Arma cheats enterable on map display and create marker text box. #1915 @BigEgg17 [NOTE] Fixes below are included in the mission file and server pbo as part of server package 1.0.6.1A (March 10th 2017) diff --git a/SQF/dayz_code/compile/BIS_fnc/fn_halo.sqf b/SQF/dayz_code/compile/BIS_fnc/fn_halo.sqf index 5a8cd102a..76ea6d6db 100644 --- a/SQF/dayz_code/compile/BIS_fnc/fn_halo.sqf +++ b/SQF/dayz_code/compile/BIS_fnc/fn_halo.sqf @@ -239,14 +239,8 @@ if (typename _this == typename []) then { //--- Free fall if (count _this == 2) exitwith { //Fresh spawn calling from player_monitor.fsm _alt = _this select 1; - _unit allowDamage false; - _paraPosition = [_unit] call FNC_GetPos; - //_paraPosition set [2,_alt]; - _para = createVehicle ["ParachuteWest", _paraPosition, [], 0, "CAN_COLLIDE"]; - _para setpos _paraPosition; - _unit moveindriver _para; //Workaround for stuck swimming in air on maps with respawn_west in water. Can't setPos to ground first because antiTP blocks it. + _unit call fn_exitSwim; _unit setvariable ["bis_fnc_halo_now",true]; - _unit allowDamage true; _unit spawn bis_fnc_halo; }; //------------- diff --git a/SQF/dayz_code/compile/fn_exitSwim.sqf b/SQF/dayz_code/compile/fn_exitSwim.sqf new file mode 100644 index 000000000..0780352b7 --- /dev/null +++ b/SQF/dayz_code/compile/fn_exitSwim.sqf @@ -0,0 +1,11 @@ +//This workaround reliably exits swimming after a setPos directly from water to land or air. +//"Getting out while IsMoveOutInProgress" prints to client RPT, but it's needed to complete quickly and should be harmless. + +_unit = _this; +_unit allowDamage false; +_paraPosition = [_unit] call FNC_GetPos; +_para = "ParachuteWest" createVehicleLocal [0,0,0]; +_para setPos _paraPosition; +_unit moveInDriver _para; +deleteVehicle _para; +_unit allowDamage true; \ No newline at end of file diff --git a/SQF/dayz_code/compile/player_switchModel.sqf b/SQF/dayz_code/compile/player_switchModel.sqf index 958be2e49..fa9364ff0 100644 --- a/SQF/dayz_code/compile/player_switchModel.sqf +++ b/SQF/dayz_code/compile/player_switchModel.sqf @@ -113,6 +113,7 @@ _switchUnit = { _rndy = floor(random 100); _oldUnit setPosATL [(respawn_west_original select 0) + _rndx, (respawn_west_original select 1) + _rndy, 0]; _newUnit setPosATL _position; + if (surfaceIsWater respawn_west_original) then {_newUnit call fn_exitSwim;}; removeAllWeapons _oldUnit; {_oldUnit removeMagazine _x;} count magazines _oldUnit; if !(isNull _oldUnit) then {deleteVehicle _oldUnit;}; diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index cac335325..48645e3b3 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -18,6 +18,7 @@ if (!isDedicated) then { fn_dropItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_dropItem.sqf"; fn_dynamicTool = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_dynamicTool.sqf"; + fn_exitSwim = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_exitSwim.sqf"; fn_nearWaterHole = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_nearWaterHole.sqf"; player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf"; //Run on a players computer, checks if the player is near a zombie player_zombieAttack = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieAttack.sqf"; //Run on a players computer, causes a nearby zombie to attack them diff --git a/SQF/dayz_code/system/player_monitor.fsm b/SQF/dayz_code/system/player_monitor.fsm index 5be6d9069..355264b13 100644 --- a/SQF/dayz_code/system/player_monitor.fsm +++ b/SQF/dayz_code/system/player_monitor.fsm @@ -995,6 +995,7 @@ class FSM " player setPosATL [_setPos select 0,_setPos select 1,DZE_HaloSpawnHeight];" \n "} else {" \n " player setPosATL _setPos;" \n + " if (surfaceIsWater respawn_west_original) then {player call fn_exitSwim;};" \n "};" \n "" \n "player setVelocity [0,0,0.5];" \n diff --git a/SQF/dayz_server/init/server_functions.sqf b/SQF/dayz_server/init/server_functions.sqf index 3b05b1274..a6fe9a1d9 100644 --- a/SQF/dayz_server/init/server_functions.sqf +++ b/SQF/dayz_server/init/server_functions.sqf @@ -268,16 +268,4 @@ array_reduceSize = { // Precise base building 1.0.5 call compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\kk_functions.sqf"; -#include "mission_check.sqf" - -/* - Create platform if respawn_west position is in water - Makes sure player is standing instead of swimming when teleported to land or air -*/ -private "_platform"; -if (surfaceIsWater respawn_west_original) then { - _platform = createVehicle ["Land_Dirthump01",[0,0,0],[],0,"CAN_COLLIDE"]; - _platform setPosASL [respawn_west_original select 0, respawn_west_original select 1, -0.1]; - _platform setVehicleInit "this enableSimulation false;this allowDamage false;"; - processInitCommands; -}; \ No newline at end of file +#include "mission_check.sqf" \ No newline at end of file