(6d989732) Unstable v0.9.708.0

This commit is contained in:
Juan Pablo Arce
2020-02-12 16:05:02 -03:00
parent 2783125162
commit 27e10f7c2e
37 changed files with 420 additions and 345 deletions
@@ -262,37 +262,8 @@ namespace Barotrauma
#if CLIENT
private Sprite jobIcon;
private Vector2 jobIconPos
{
get { return new Vector2(HUDLayoutSettings.HealthBarAreaLeft.Right, HUDLayoutSettings.HealthBarAreaLeft.Y - HUDLayoutSettings.Padding); }
}
#endif
private Sprite portraitBackground;
public Sprite PortraitBackground
{
get
{
if (portraitBackground == null)
{
var portraitBackgroundElement = CharacterConfigElement.Element("portraitbackground");
if (portraitBackgroundElement != null)
{
portraitBackground = new Sprite(portraitBackgroundElement.Element("sprite"));
}
}
return portraitBackground;
}
private set
{
if (portraitBackground != null)
{
portraitBackground.Remove();
}
portraitBackground = value;
}
}
private List<WearableSprite> attachmentSprites;
public List<WearableSprite> AttachmentSprites
{
@@ -956,8 +927,20 @@ namespace Barotrauma
DebugConsole.ThrowError("Invalid inventory data in character \"" + Name + "\" - no slot indices found");
continue;
}
//make sure there's no other item in the slot
//this should not happen normally, but can occur if the character is accidentally given new job items while also loading previous items in the campaign
for (int i = 0; i < inventory.Capacity; i++)
{
if (slotIndices.Contains(i) && inventory.Items[i] != null && inventory.Items[i] != newItem)
{
DebugConsole.ThrowError($"Error while loading character inventory data. The slot {i} was already occupied by the item \"{inventory.Items[i].Name} ({inventory.Items[i].ID})\" when loading the item \"{newItem.Name} ({newItem.ID})\"");
inventory.Items[i].Drop(null, createNetworkEvent: false);
}
}
inventory.TryPutItem(newItem, slotIndices[0], false, false, null);
newItem.ParentInventory = inventory;
//force the item to the correct slots
// e.g. putting the item in a hand slot will also put it in the first available Any-slot,
@@ -1016,7 +999,6 @@ namespace Barotrauma
Character = null;
HeadSprite = null;
Portrait = null;
PortraitBackground = null;
AttachmentSprites = null;
}
}