Rework player_death for respawnDelay=0; #1825

See #1825
This commit is contained in:
ebaydayz
2017-01-24 15:55:15 -05:00
parent 1133efc2e0
commit 6c62b3f8e4
31 changed files with 157 additions and 116 deletions

View File

@@ -5,20 +5,29 @@
References to the player object after that point will return objNull, so this function
and server_playerSync must be fast or the player will not save.
*/
private ["_playerObj","_playerUID","_playerPos","_playerName","_characterID","_inCombat","_Sepsis","_myGroup"];
private ["_playerObj","_playerUID","_playerPos","_playerName","_characterID","_inCombat","_Sepsis"];
_playerUID = _this select 0;
_playerName = _this select 1;
_playerObj = nil;
//Lets search all players looking for the object that matches our UID
//If the player just died then the new unit they respawned into will be found (respawnDelay=0 in description.ext)
{
if ((getPlayerUID _x) == _playerUID) exitWith { _playerObj = _x; _playerPos = getPosATL _playerObj;};
} count playableUnits;
//If playerObj is not in playableUnits then lets exit the disconnect system.
if (isNil "_playerObj") exitWith {
diag_log format["%1: Player object is not in playableUnits. This is normal if the player just died. _this:%2", __FILE__, _this];
diag_log format["%1: Exiting. Player is not in playableUnits. _this:%2", __FILE__, _this];
};
//Player object is alive in debug zone. The player most likely just respawned.
if (_playerPos distance respawn_west_original < 1500) exitWith {
diag_log format["%1: Exiting. Player is near respawn_west. This is normal if the player just died. _this:%2", __FILE__, _this];
if (!isNull _playerObj) then {
_playerObj call sched_co_deleteVehicle;
};
};
//diag_log format["get: %1 (%2), sent: %3 (%4)",typeName (getPlayerUID _playerObj), getPlayerUID _playerObj, typeName _playerUID, _playerUID];
@@ -36,9 +45,7 @@ if (_playerUID in dayz_ghostPlayers) exitWith {
//Lets remove the object.
if (!isNull _playerObj) then {
_myGroup = group _playerObj;
deleteVehicle _playerObj;
deleteGroup _myGroup;
_playerObj call sched_co_deleteVehicle;
};
};
@@ -85,7 +92,5 @@ if (_characterID != "?") then {
};
if (alive _playerObj) then {
_myGroup = group _playerObj;
deleteVehicle _playerObj;
deleteGroup _myGroup;
_playerObj call sched_co_deleteVehicle;
};

View File

@@ -36,15 +36,15 @@ if (_characterID != "0") then {
#ifdef PLAYER_DEBUG
diag_log format ["Player UID#%3 CID#%4 %1 as %5 died at %2",
_newObject call fa_plr2str, _pos call fa_coor2str,
getPlayerUID _newObject,_characterID,
_playerID, _characterID,
typeOf _newObject
];
#endif
// DEATH MESSAGES
_suicide = _sourceName == _playerName;
_suicide = ((_sourceName == _playerName) or (_method == "suicide"));
if (_method in ["explosion","melee","shot","shothead","shotheavy"] && !(_method == "explosion" && (_suicide or _sourceName == "unknown"))) then {
if (_method in ["explosion","melee","shot","shothead","shotheavy","suicide"] && !(_method == "explosion" && (_suicide or _sourceName == "unknown"))) then {
if (_suicide) then {
_message = ["suicide",_playerName];
} else {

View File

@@ -26,7 +26,7 @@ if (isNil "_characterID") exitWith {
if (_characterID == "0" or _inDebug) exitWith {
if (_inDebug) then {
diag_log format["INFO: server_playerSync: Cannot Sync Player %1 [%2]. Position in debug! %3 (May be relogging or changing clothes)",_name,_characterID,_charPos];
diag_log format["INFO: server_playerSync: Cannot Sync Player %1 [%2]. Position in debug! %3. This is normal when respawning, relogging and changing clothes.",_name,_characterID,_charPos];
} else {
diag_log ("ERROR: Cannot Sync Character " + _name + " as no characterID");
};