mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
Fix wrong vehicle update if the player disconnects
This commit is contained in:
@@ -18,12 +18,12 @@ _humanity = 0;
|
|||||||
_name = if (alive _character) then {name _character} else {"Dead Player"};
|
_name = if (alive _character) then {name _character} else {"Dead Player"};
|
||||||
_inDebug = (respawn_west_original distance _charPos) < 1500;
|
_inDebug = (respawn_west_original distance _charPos) < 1500;
|
||||||
|
|
||||||
_exitReason = switch true do {
|
_exitReason = call {
|
||||||
case (isNil "_characterID"): {("ERROR: Cannot Sync Character " + _name + " has nil characterID")}; //Unit is null
|
if (isNil "_characterID") exitwith {("ERROR: Cannot Sync Character " + _name + " has nil characterID")}; //Unit is null
|
||||||
case (_inDebug): {format["INFO: Cannot Sync Character %1 near respawn_west %2. This is normal when relogging or changing clothes.",_name,_charPos]};
|
if (_inDebug) exitwith {format["INFO: Cannot Sync Character %1 near respawn_west %2. This is normal when relogging or changing clothes.",_name,_charPos]};
|
||||||
case (_characterID == "0"): {("ERROR: Cannot Sync Character " + _name + " has no characterID")};
|
if (_characterID == "0") exitwith {("ERROR: Cannot Sync Character " + _name + " has no characterID")};
|
||||||
case (_character isKindOf "Animal"): {("ERROR: Cannot Sync Character " + _name + " is an Animal class")};
|
if (_character isKindOf "Animal") exitwith {("ERROR: Cannot Sync Character " + _name + " is an Animal class")};
|
||||||
default {"none"};
|
"none";
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_exitReason != "none") exitWith {
|
if (_exitReason != "none") exitWith {
|
||||||
@@ -123,11 +123,11 @@ if (_lastTime == -1) then {
|
|||||||
/*
|
/*
|
||||||
Get character state details
|
Get character state details
|
||||||
*/
|
*/
|
||||||
_currentWpn = currentMuzzle _character;
|
_currentWpn = currentMuzzle _character;
|
||||||
_currentAnim = animationState _character;
|
_currentAnim = animationState _character;
|
||||||
_config = configFile >> "CfgMovesMaleSdr" >> "States" >> _currentAnim;
|
_config = configFile >> "CfgMovesMaleSdr" >> "States" >> _currentAnim;
|
||||||
_onLadder = (getNumber (_config >> "onLadder")) == 1;
|
_onLadder = (getNumber (_config >> "onLadder")) == 1;
|
||||||
_isTerminal = (getNumber (_config >> "terminal")) == 1;
|
_isTerminal = (getNumber (_config >> "terminal")) == 1;
|
||||||
//_wpnDisabled = (getNumber (_config >> "disableWeapons")) == 1;
|
//_wpnDisabled = (getNumber (_config >> "disableWeapons")) == 1;
|
||||||
_currentModel = typeOf _character;
|
_currentModel = typeOf _character;
|
||||||
if (_currentModel == _modelChk) then {
|
if (_currentModel == _modelChk) then {
|
||||||
@@ -136,6 +136,12 @@ if (_currentModel == _modelChk) then {
|
|||||||
_currentModel = str _currentModel;
|
_currentModel = str _currentModel;
|
||||||
_character setVariable ["model_CHK",typeOf _character];
|
_character setVariable ["model_CHK",typeOf _character];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// If player is in a vehicle, keep its position updated
|
||||||
|
if (vehicle _character != _character) then {
|
||||||
|
[vehicle _character, "position"] call server_updateObject;
|
||||||
|
};
|
||||||
|
|
||||||
if (count _this > 4) then { //calling from player_onDisconnect
|
if (count _this > 4) then { //calling from player_onDisconnect
|
||||||
if (_this select 4) then { //combat logged
|
if (_this select 4) then { //combat logged
|
||||||
_medical set [1, true]; //set unconcious to true
|
_medical set [1, true]; //set unconcious to true
|
||||||
@@ -188,11 +194,6 @@ if (_isInVehicle) then {
|
|||||||
};
|
};
|
||||||
_currentState = [[_currentWpn,_currentAnim,_temp],[]];
|
_currentState = [[_currentWpn,_currentAnim,_temp],[]];
|
||||||
|
|
||||||
// If player is in a vehicle, keep its position updated
|
|
||||||
if (vehicle _character != _character) then {
|
|
||||||
[vehicle _character, "position"] call server_updateObject;
|
|
||||||
};
|
|
||||||
|
|
||||||
//Reset timer
|
//Reset timer
|
||||||
if (_timeSince > 0) then {
|
if (_timeSince > 0) then {
|
||||||
_character setVariable ["lastTime",(diag_ticktime - _timeLeft)];
|
_character setVariable ["lastTime",(diag_ticktime - _timeLeft)];
|
||||||
|
|||||||
Reference in New Issue
Block a user