(a6aea4ada) Fixed clients failing to spawn items when using a different language than the server

This commit is contained in:
Joonas Rikkonen
2019-05-16 06:39:31 +03:00
parent 82a3e21510
commit 5a4f50cfd2
16 changed files with 486 additions and 106 deletions
@@ -702,6 +702,25 @@ namespace Barotrauma
}
}
public string DisplayName
{
get;
private set;
}
private string roomName;
[Editable, Serialize("", true, translationTextTag: "RoomName.")]
public string RoomName
{
get { return roomName; }
set
{
if (roomName == value) { return; }
roomName = value;
DisplayName = TextManager.Get(roomName, returnNull: true) ?? roomName;
}
}
public override Rectangle Rect
{
get
@@ -96,7 +96,7 @@ namespace Barotrauma
//If a matching prefab is not found when loading a sub, the game will attempt to find a prefab with a matching alias.
//(allows changing names while keeping backwards compatibility with older sub files)
public string[] Aliases
public HashSet<string> Aliases
{
get;
protected set;
@@ -115,6 +115,7 @@ namespace Barotrauma
Linkable = true
};
ep.AllowedLinks.Add("hull");
ep.Aliases = new HashSet<string> { "hull" };
List.Add(ep);
ep = new MapEntityPrefab
@@ -127,6 +128,7 @@ namespace Barotrauma
ResizeVertical = true
};
List.Add(ep);
ep.Aliases = new HashSet<string> { "gap" };
ep = new MapEntityPrefab
{
@@ -136,6 +138,7 @@ namespace Barotrauma
constructor = typeof(WayPoint).GetConstructor(new Type[] { typeof(MapEntityPrefab), typeof(Rectangle) })
};
List.Add(ep);
ep.Aliases = new HashSet<string> { "waypoint" };
ep = new MapEntityPrefab
{
@@ -145,6 +148,7 @@ namespace Barotrauma
constructor = typeof(WayPoint).GetConstructor(new Type[] { typeof(MapEntityPrefab), typeof(Rectangle) })
};
List.Add(ep);
ep.Aliases = new HashSet<string> { "spawnpoint" };
}
public MapEntityPrefab()
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using Barotrauma.Extensions;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
@@ -217,11 +218,12 @@ namespace Barotrauma
}
sp.Category = category;
string aliases = element.GetAttributeString("aliases", "");
if (!string.IsNullOrWhiteSpace(aliases))
{
sp.Aliases = aliases.Split(',');
}
sp.Aliases =
(element.GetAttributeStringArray("aliases", null) ??
element.GetAttributeStringArray("Aliases", new string[0])).ToHashSet();
string nonTranslatedName = element.GetAttributeString("name", null) ?? element.Name.ToString();
sp.Aliases.Add(nonTranslatedName.ToLowerInvariant());
SerializableProperty.DeserializeProperties(sp, element);
if (sp.Body)