Added some debug logging, Character.Revive removes the existing AITarget from the character before creating a new one

This commit is contained in:
Joonas Rikkonen
2018-02-26 18:05:03 +02:00
parent 1c68d5a4d7
commit 77940fa992
4 changed files with 16 additions and 0 deletions
@@ -17,8 +17,13 @@ namespace Barotrauma
var entity = FindEntityByID(entityId); var entity = FindEntityByID(entityId);
if (entity != null) if (entity != null)
{ {
DebugConsole.Log("Received entity removal message for \"" + entity.ToString() + "\".");
entity.Remove(); entity.Remove();
} }
else
{
DebugConsole.Log("Received entity removal message for ID " + entityId + ". Entity with a matching ID not found.");
}
} }
else else
{ {
@@ -1957,6 +1957,10 @@ namespace Barotrauma
{ {
isDead = false; isDead = false;
if (aiTarget != null)
{
aiTarget.Remove();
}
aiTarget = new AITarget(this); aiTarget = new AITarget(this);
Health = Math.Max(maxHealth * 0.1f, health); Health = Math.Max(maxHealth * 0.1f, health);
@@ -384,6 +384,11 @@ namespace Barotrauma.Items.Components
public void ServerWrite(NetBuffer msg, Client c, object[] extraData = null) public void ServerWrite(NetBuffer msg, Client c, object[] extraData = null)
{ {
if (!attachable)
{
DebugConsole.ThrowError("Sent an attachment event for an item that's not attachable.");
}
msg.Write(Attached); msg.Write(Attached);
} }
@@ -1555,6 +1555,8 @@ namespace Barotrauma
ushort inventoryId = msg.ReadUInt16(); ushort inventoryId = msg.ReadUInt16();
DebugConsole.Log("Received entity spawn message for item " + itemName + ".");
Vector2 pos = Vector2.Zero; Vector2 pos = Vector2.Zero;
Submarine sub = null; Submarine sub = null;
int inventorySlotIndex = -1; int inventorySlotIndex = -1;