Option to set aliases for StructurePrefabs
This commit is contained in:
@@ -60,14 +60,6 @@ namespace Barotrauma
|
||||
|
||||
private bool canSpriteFlipX;
|
||||
|
||||
//if a matching itemprefab is not found when loading a sub, the game will attempt to find a prefab with a matching alias
|
||||
//(allows changing item names while keeping backwards compatibility with older sub files)
|
||||
public string[] Aliases
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public List<DeconstructItem> DeconstructItems
|
||||
{
|
||||
get;
|
||||
@@ -266,7 +258,6 @@ namespace Barotrauma
|
||||
|
||||
CanUseOnSelf = element.GetAttributeBool("canuseonself", false);
|
||||
|
||||
|
||||
Health = element.GetAttributeFloat("health", 100.0f);
|
||||
Indestructible = element.GetAttributeBool("indestructible", false);
|
||||
FireProof = element.GetAttributeBool("fireproof", false);
|
||||
|
||||
@@ -87,6 +87,14 @@ namespace Barotrauma
|
||||
get { return price; }
|
||||
}
|
||||
|
||||
//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
|
||||
{
|
||||
get;
|
||||
protected set;
|
||||
}
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
MapEntityPrefab ep = new MapEntityPrefab();
|
||||
@@ -114,12 +122,6 @@ namespace Barotrauma
|
||||
ep.name = "Spawnpoint";
|
||||
ep.constructor = typeof(WayPoint).GetConstructor(new Type[] { typeof(MapEntityPrefab), typeof(Rectangle) });
|
||||
list.Add(ep);
|
||||
|
||||
//ep = new MapEntityPrefab();
|
||||
//ep.name = "Linked Submarine";
|
||||
//ep.Category = 0;
|
||||
//list.Add(ep);
|
||||
|
||||
}
|
||||
|
||||
public MapEntityPrefab()
|
||||
|
||||
@@ -839,7 +839,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (MapEntityPrefab ep in MapEntityPrefab.list)
|
||||
{
|
||||
if (ep.Name == name)
|
||||
if (ep.Name == name || (ep.Aliases != null && ep.Aliases.Contains(name)))
|
||||
{
|
||||
s = new Structure(rect, (StructurePrefab)ep, submarine);
|
||||
s.Submarine = submarine;
|
||||
|
||||
@@ -8,8 +8,6 @@ namespace Barotrauma
|
||||
{
|
||||
partial class StructurePrefab : MapEntityPrefab
|
||||
{
|
||||
//public static List<StructurePrefab> list = new List<StructurePrefab>();
|
||||
|
||||
//does the structure have a physics body
|
||||
private bool hasBody;
|
||||
|
||||
@@ -126,6 +124,12 @@ namespace Barotrauma
|
||||
sp.Category = category;
|
||||
|
||||
sp.Description = element.GetAttributeString("description", "");
|
||||
|
||||
string aliases = element.GetAttributeString("aliases", "");
|
||||
if (!string.IsNullOrWhiteSpace(aliases))
|
||||
{
|
||||
sp.Aliases = aliases.Split(',');
|
||||
}
|
||||
|
||||
sp.size = Vector2.Zero;
|
||||
sp.size.X = element.GetAttributeFloat("width", 0.0f);
|
||||
|
||||
Reference in New Issue
Block a user