Fix change clothes and login over sea level

This also aims for the fix that the player still gets damaged while in debug. It looks like that allowDamage gets lifted when it should not. fn_exitSwim set too early the damage true which can be a problem. Ive decided to remove the handled damage from fn_exitSwim and set allowDamage always false before we enter this function.
This needs intensive testing to be sure it works without any new problems.

Thx to ndavalos and iben.
This commit is contained in:
A Man
2022-04-16 17:20:28 +02:00
parent 8a7d937999
commit 876e264e33
5 changed files with 28 additions and 23 deletions

View File

@@ -236,10 +236,11 @@ if (typename _this == typename []) then {
_unit = _this select 0;
if (!local _unit) exitwith {};
_unit allowDamage false; //Prevent glitch death when opening chute
//--- Free fall
if (count _this == 2) exitwith { //Fresh spawn calling from player_monitor.fsm
_alt = _this select 1;
_unit call fn_exitSwim;
if (surfaceIsWater respawn_west_original) then {_unit call fn_exitSwim;};
_unit setvariable ["bis_fnc_halo_now",true];
_unit spawn bis_fnc_halo;
};
@@ -247,7 +248,6 @@ if (typename _this == typename []) then {
_para = objnull;
_vel = [];
_unit allowDamage false; //Prevent glitch death when opening chute
_paraPosition1 = [_unit] call FNC_GetPos;
_para = createVehicle ["ParachuteWest", _paraPosition1, [], 0, "CAN_COLLIDE"];
//_para = "BIS_Steerable_Parachute" createVehicle position _unit;

View File

@@ -1,12 +1,15 @@
//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;
local _unit = _this;
local _paraPosition = [_unit] call FNC_GetPos;
local _para = "ParachuteWest" createVehicleLocal [0,0,0];
_para setPos [(_paraPosition select 0),(_paraPosition select 1),(_paraPosition select 2) + 0.1];
_unit moveInDriver _para;
deleteVehicle _para;
_unit setPosATL _paraPosition;
_unit allowDamage true;
if (surfaceiswater _paraPosition) then {
_unit setPosASL _paraPosition;
} else {
_unit setPosATL _paraPosition;
};

View File

@@ -10,7 +10,7 @@ _old removeAllEventHandlers "HandleDamage";
_old removeAllEventHandlers "Killed";
_old removeAllEventHandlers "Fired";
_old allowDamage false;
_old AddEventHandler ["HandleDamage", {False}];
_old addEventHandler ["handleDamage", {0}];
//Logout
local _humanity = player getVariable ["humanity",0];
@@ -109,7 +109,7 @@ if (Z_SingleCurrency) then {
call dayz_resetSelfActions; //New unit has no self actions yet. Reset variables so actions can be added back.
dayz_actionInProgress = false; //Allow self actions to run now.
player removeAllEventHandlers "HandleDamage";
player removeAllEventHandlers "handleDamage";
eh_player_killed = player addeventhandler ["FiredNear",{_this call player_weaponFiredNear;}];
[player] call fnc_usec_damageHandle;
player allowDamage true;

View File

@@ -5,10 +5,7 @@ _class = if (_isArray) then {_this select 0} else {_this};
if (gear_done) then {disableUserInput true;disableUserInput true;};
disableSerialization;
//Old location system causes issues with players getting damaged during movement.
//_position = getPosATL player;
//New system testing needed.
_position = player modeltoWorld [0,0,0];
_position = [player] call FNC_GetPos;
_dir = getDir player;
_currentAnim = animationState player;
_currentCamera = cameraView;
@@ -70,9 +67,10 @@ _leader = (player == leader _oldGroup);
//[player] joinSilent grpNull;
_group = createGroup west;
_newUnit = _group createUnit [_class,respawn_west_original,[],0,"NONE"];
_newUnit allowDamage false;
if (_isArray) then {
_newUnit allowDamage false;
mydamage_eh1 = _newUnit AddEventHandler ["HandleDamage", {False}];
mydamage_eh1 = _newUnit addEventHandler ["handleDamage", {0}];
_newUnit setVariable ["characterID",(_this select 1),true];
_newUnit setVariable ["humanity",(_this select 2),true];
_newUnit setVariable ["zombieKills",(_this select 3),true];
@@ -112,7 +110,6 @@ if (_secweapon != (secondaryWeapon _newUnit) && _secweapon != "") then {
_switchUnit = {
//Make New Unit Playable (1 of these 3 commands causes crashes with gear dialog open)
//_oldUnit setPosATL [_position select 0 + cos(_dir) * 2, _position select 1 + sin(_dir) * 2, _position select 2];
addSwitchableUnit _newUnit;
setPlayable _newUnit;
selectPlayer _newUnit;
@@ -120,7 +117,13 @@ _switchUnit = {
_rndx = floor(random 100);
_rndy = floor(random 100);
_oldUnit setPosATL [(respawn_west_original select 0) + _rndx, (respawn_west_original select 1) + _rndy, 0];
if (surfaceIsWater _position) then {
_newUnit setPosASL _position;
} else {
_newUnit setPosATL _position;
};
if (surfaceIsWater respawn_west_original) then {_newUnit call fn_exitSwim;};
removeAllWeapons _oldUnit;
{_oldUnit removeMagazine _x;} count magazines _oldUnit;

View File

@@ -627,7 +627,6 @@ class FSM
"" \n
"_model call player_switchModel;" \n
"" \n
"player allowDamage false;" \n
"_lastAte = _survival select 1;" \n
"_lastDrank = _survival select 2;" \n
"" \n