Unstable 1.1.14.0

This commit is contained in:
Markus Isberg
2023-10-02 16:43:54 +03:00
parent 94f5a93a0c
commit cf8f0de659
606 changed files with 21906 additions and 11456 deletions
@@ -7,6 +7,7 @@ using System.Xml.Linq;
using Barotrauma.Items.Components;
using Barotrauma.Networking;
using Barotrauma.Abilities;
using System.Collections.Immutable;
namespace Barotrauma
{
@@ -55,6 +56,11 @@ namespace Barotrauma
public bool HideOtherWearables => ObscureOtherWearables == ObscuringMode.Hide;
public bool AlphaClipOtherWearables => ObscureOtherWearables == ObscuringMode.AlphaClip;
public bool CanBeHiddenByOtherWearables { get; private set; }
/// <summary>
/// Tags or identifiers of items that can hide this one.
/// </summary>
public ImmutableHashSet<Identifier> CanBeHiddenByItem { get; private set; }
public List<WearableType> HideWearablesOfType { get; private set; }
public bool InheritLimbDepth { get; private set; }
/// <summary>
@@ -139,11 +145,6 @@ namespace Barotrauma
case WearableType.Husk:
case WearableType.Herpes:
Limb = LimbType.Head;
ObscureOtherWearables = ObscuringMode.None;
InheritLimbDepth = true;
InheritScale = true;
InheritOrigin = true;
InheritSourceRect = true;
break;
}
}
@@ -177,6 +178,10 @@ namespace Barotrauma
public void ParsePath(bool parseSpritePath)
{
#if SERVER
// Server doesn't care about texture paths at all
return;
#endif
SpritePath = UnassignedSpritePath.Value;
if (_picker?.Info != null)
{
@@ -196,7 +201,7 @@ namespace Barotrauma
}
if (parseSpritePath)
{
Sprite.ParseTexturePath(file: SpritePath);
Sprite?.ParseTexturePath(file: SpritePath);
}
}
@@ -222,22 +227,23 @@ namespace Barotrauma
}
CanBeHiddenByOtherWearables = SourceElement.GetAttributeBool("canbehiddenbyotherwearables", true);
CanBeHiddenByItem = SourceElement.GetAttributeIdentifierArray(nameof(CanBeHiddenByItem), Array.Empty<Identifier>()).ToImmutableHashSet();
InheritLimbDepth = SourceElement.GetAttributeBool("inheritlimbdepth", true);
var scale = SourceElement.GetAttribute("inheritscale");
if (scale != null)
{
InheritScale = scale.GetAttributeBool(false);
InheritScale = scale.GetAttributeBool(Type != WearableType.Item);
}
else
{
InheritScale = SourceElement.GetAttributeBool("inherittexturescale", false);
InheritScale = SourceElement.GetAttributeBool("inherittexturescale", Type != WearableType.Item);
}
IgnoreLimbScale = SourceElement.GetAttributeBool("ignorelimbscale", false);
IgnoreTextureScale = SourceElement.GetAttributeBool("ignoretexturescale", false);
IgnoreRagdollScale = SourceElement.GetAttributeBool("ignoreragdollscale", false);
SourceElement.GetAttributeBool("inherittexturescale", false);
InheritOrigin = SourceElement.GetAttributeBool("inheritorigin", false);
InheritSourceRect = SourceElement.GetAttributeBool("inheritsourcerect", false);
InheritOrigin = SourceElement.GetAttributeBool("inheritorigin", Type != WearableType.Item);
InheritSourceRect = SourceElement.GetAttributeBool("inheritsourcerect", Type != WearableType.Item);
DepthLimb = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("depthlimb", "None"), true);
Sound = SourceElement.GetAttributeString("sound", "");
Scale = SourceElement.GetAttributeFloat("scale", 1.0f);
@@ -457,22 +463,20 @@ namespace Barotrauma.Items.Components
if (!equipLimb.WearingItems.Contains(wearableSprite))
{
equipLimb.WearingItems.Add(wearableSprite);
equipLimb.WearingItems.Sort((i1, i2) => { return i2.Sprite.Depth.CompareTo(i1.Sprite.Depth); });
equipLimb.WearingItems.Sort((i1, i2) =>
equipLimb.WearingItems.Sort((wearable, nextWearable) =>
{
if (i1?.WearableComponent == null && i2?.WearableComponent == null)
{
return 0;
}
else if (i1?.WearableComponent == null)
{
return -1;
}
else if (i2?.WearableComponent == null)
{
return 1;
}
return i1.WearableComponent.AllowedSlots.Contains(InvSlotType.OuterClothes).CompareTo(i2.WearableComponent.AllowedSlots.Contains(InvSlotType.OuterClothes));
float depth = wearable?.Sprite?.Depth ?? 0;
float nextDepth = nextWearable?.Sprite?.Depth ?? 0;
return nextDepth.CompareTo(depth);
});
equipLimb.WearingItems.Sort((wearable, nextWearable) =>
{
var wearableComponent = wearable?.WearableComponent;
var nextWearableComponent = nextWearable?.WearableComponent;
if (wearableComponent == null && nextWearableComponent == null) { return 0; }
if (wearableComponent == null) { return -1; }
if (nextWearableComponent == null) { return 1; }
return wearableComponent.AllowedSlots.Contains(InvSlotType.OuterClothes).CompareTo(nextWearableComponent.AllowedSlots.Contains(InvSlotType.OuterClothes));
});
}
#if CLIENT
@@ -553,10 +557,7 @@ namespace Barotrauma.Items.Components
foreach (WearableSprite wearableSprite in wearableSprites)
{
if (wearableSprite != null && wearableSprite.Sprite != null)
{
wearableSprite.Sprite.Remove();
}
wearableSprite?.Sprite?.Remove();
}
}