Fixed SetClientCharacter & Revive

This commit is contained in:
Joonas Rikkonen
2017-07-26 17:19:35 +03:00
parent f062ca0e4d
commit 6faf658ae0
3 changed files with 5 additions and 3 deletions
@@ -530,6 +530,8 @@ namespace Barotrauma
}
else
{
this.isDead = false;
health = msg.ReadRangedSingle(minHealth, maxHealth, 8);
bool lowOxygen = msg.ReadBoolean();
@@ -499,6 +499,7 @@ namespace Barotrauma
foreach (Client c in GameMain.Server.ConnectedClients)
{
if (c.Character != revivedCharacter) continue;
//clients stop controlling the character when it dies, force control back
GameMain.Server.SetClientCharacter(c, revivedCharacter);
break;
@@ -620,7 +621,7 @@ namespace Barotrauma
}
string[] argsLeft = args.Take(separatorIndex).ToArray();
string[] argsRight = args.Skip(separatorIndex).ToArray();
string[] argsRight = args.Skip(separatorIndex + 1).ToArray();
string clientName = String.Join(" ", argsLeft);
@@ -1868,13 +1868,12 @@ namespace Barotrauma.Networking
{
if (client.Character != null) //removing control of the current character
{
newCharacter.IsRemotePlayer = false;
CreateEntityEvent(client.Character, new object[] { NetEntityEvent.Type.Control, null });
client.Character = null;
}
}
else if (client.Character != newCharacter) //taking control of a new character
else //taking control of a new character
{
newCharacter.ResetNetState();
newCharacter.LastNetworkUpdateID = client.Character.LastNetworkUpdateID;