v0.14.6.0
This commit is contained in:
@@ -51,6 +51,9 @@ namespace Barotrauma
|
||||
public bool InheritTextureScale { get; private set; }
|
||||
public bool InheritOrigin { get; private set; }
|
||||
public bool InheritSourceRect { get; private set; }
|
||||
|
||||
public float Scale { get; private set; }
|
||||
|
||||
public LimbType DepthLimb { get; private set; }
|
||||
private Wearable _wearableComponent;
|
||||
public Wearable WearableComponent
|
||||
@@ -161,10 +164,7 @@ namespace Barotrauma
|
||||
if (IsInitialized) { return; }
|
||||
_gender = UnassignedSpritePath.Contains("[GENDER]") ? gender : Gender.None;
|
||||
ParsePath(false);
|
||||
if (Sprite != null)
|
||||
{
|
||||
Sprite.Remove();
|
||||
}
|
||||
Sprite?.Remove();
|
||||
Sprite = new Sprite(SourceElement, file: SpritePath);
|
||||
Limb = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("limb", "Head"), true);
|
||||
HideLimb = SourceElement.GetAttributeBool("hidelimb", false);
|
||||
@@ -175,6 +175,7 @@ namespace Barotrauma
|
||||
InheritSourceRect = SourceElement.GetAttributeBool("inheritsourcerect", false);
|
||||
DepthLimb = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("depthlimb", "None"), true);
|
||||
Sound = SourceElement.GetAttributeString("sound", "");
|
||||
Scale = SourceElement.GetAttributeFloat("scale", 1.0f);
|
||||
var index = SourceElement.GetAttributePoint("sheetindex", new Point(-1, -1));
|
||||
if (index.X > -1 && index.Y > -1)
|
||||
{
|
||||
@@ -201,7 +202,7 @@ namespace Barotrauma
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
class Wearable : Pickable, IServerSerializable
|
||||
partial class Wearable : Pickable, IServerSerializable
|
||||
{
|
||||
private readonly XElement[] wearableElements;
|
||||
private readonly WearableSprite[] wearableSprites;
|
||||
@@ -209,6 +210,7 @@ namespace Barotrauma.Items.Components
|
||||
private readonly Limb[] limb;
|
||||
|
||||
private readonly List<DamageModifier> damageModifiers;
|
||||
public readonly Dictionary<string, float> SkillModifiers;
|
||||
|
||||
public IEnumerable<DamageModifier> DamageModifiers
|
||||
{
|
||||
@@ -264,7 +266,8 @@ namespace Barotrauma.Items.Components
|
||||
this.item = item;
|
||||
|
||||
damageModifiers = new List<DamageModifier>();
|
||||
|
||||
SkillModifiers = new Dictionary<string, float>();
|
||||
|
||||
int spriteCount = element.Elements().Count(x => x.Name.ToString() == "sprite");
|
||||
Variants = element.GetAttributeInt("variants", 0);
|
||||
variant = Rand.Range(1, Variants + 1, Rand.RandSync.Server);
|
||||
@@ -307,18 +310,35 @@ namespace Barotrauma.Items.Components
|
||||
case "damagemodifier":
|
||||
damageModifiers.Add(new DamageModifier(subElement, item.Name + ", Wearable"));
|
||||
break;
|
||||
case "skillmodifier":
|
||||
string skillIdentifier = subElement.GetAttributeString("skillidentifier", string.Empty);
|
||||
float skillValue = subElement.GetAttributeFloat("skillvalue", 0f);
|
||||
if (SkillModifiers.ContainsKey(skillIdentifier))
|
||||
{
|
||||
SkillModifiers[skillIdentifier] += skillValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
SkillModifiers.TryAdd(skillIdentifier, skillValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Equip(Character character)
|
||||
{
|
||||
foreach (var allowedSlot in allowedSlots)
|
||||
{
|
||||
if (allowedSlot != InvSlotType.Any && !character.Inventory.IsInLimbSlot(item, allowedSlot)) { return; }
|
||||
}
|
||||
|
||||
picker = character;
|
||||
for (int i = 0; i < wearableSprites.Length; i++ )
|
||||
{
|
||||
var wearableSprite = wearableSprites[i];
|
||||
if (!wearableSprite.IsInitialized) { wearableSprite.Init(picker.Info?.Gender ?? Gender.None); }
|
||||
if (picker.Info?.Gender != Gender.None && (wearableSprite.Gender != Gender.None))
|
||||
if (picker.Info != null && picker.Info?.Gender != Gender.None && (wearableSprite.Gender != Gender.None))
|
||||
{
|
||||
// If the item is gender specific (it has a different textures for male and female), we have to change the gender here so that the texture is updated.
|
||||
wearableSprite.Gender = picker.Info.Gender;
|
||||
@@ -380,6 +400,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (character == null || character.Removed) { return; }
|
||||
if (picker == null) { return; }
|
||||
|
||||
for (int i = 0; i < wearableSprites.Length; i++)
|
||||
{
|
||||
Limb equipLimb = character.AnimController.GetLimb(limbType[i]);
|
||||
|
||||
Reference in New Issue
Block a user