(3dc4135ce) v0.9.5.1

This commit is contained in:
Regalis
2019-11-21 18:22:25 +01:00
parent b39922a074
commit 5c95c53118
287 changed files with 12655 additions and 5048 deletions
@@ -36,9 +36,12 @@ namespace Barotrauma
get { return skills.Values.ToList(); }
}
public Job(JobPrefab jobPrefab)
public int Variant;
public Job(JobPrefab jobPrefab, int variant = 0)
{
prefab = jobPrefab;
Variant = variant;
skills = new Dictionary<string, Skill>();
foreach (SkillPrefab skillPrefab in prefab.Skills)
@@ -156,6 +159,25 @@ namespace Barotrauma
character.Inventory.TryPutItem(item, null, item.AllowedSlots);
}
Wearable wearable = ((List<ItemComponent>)item.Components)?.Find(c => c is Wearable) as Wearable;
if (wearable != null)
{
if (Variant > 0 && Variant <= wearable.Variants)
{
wearable.Variant = Variant;
}
else
{
wearable.Variant = wearable.Variant; //force server event
if (wearable.Variants > 0 && Variant == 0)
{
//set variant to the same as the wearable to get the rest of the character's gear
//to use the same variant (if possible)
Variant = wearable.Variant;
}
}
}
if (item.Prefab.Identifier == "idcard" && spawnPoint != null)
{
foreach (string s in spawnPoint.IdCardTags)