Allow content to ignore prototype-types.

This commit is contained in:
Pieter-Jan Briers
2018-07-28 15:33:48 +02:00
parent 5d2d56bc64
commit 00b16c63ac
2 changed files with 12 additions and 2 deletions

View File

@@ -6,7 +6,7 @@ namespace SS14.Server.Prototypes
{
public ServerPrototypeManager() : base()
{
IgnoredPrototypeTypes.Add("shader");
RegisterIgnore("shader");
}
}
}

View File

@@ -66,6 +66,11 @@ namespace SS14.Shared.Prototypes
/// Syncs all inter-prototype data. Call this when operations adding new prototypes are done.
/// </summary>
void Resync();
/// <summary>
/// Registers a specific prototype name to be ignored.
/// </summary>
void RegisterIgnore(string name);
}
/// <summary>
@@ -96,7 +101,7 @@ namespace SS14.Shared.Prototypes
private readonly Dictionary<Type, List<IPrototype>> prototypes = new Dictionary<Type, List<IPrototype>>();
private readonly Dictionary<Type, Dictionary<string, IIndexedPrototype>> indexedPrototypes = new Dictionary<Type, Dictionary<string, IIndexedPrototype>>();
protected readonly HashSet<string> IgnoredPrototypeTypes = new HashSet<string>();
private readonly HashSet<string> IgnoredPrototypeTypes = new HashSet<string>();
public IEnumerable<T> EnumeratePrototypes<T>() where T : class, IPrototype
{
@@ -296,6 +301,11 @@ namespace SS14.Shared.Prototypes
prototype = (T)uncast;
return returned;
}
public void RegisterIgnore(string name)
{
IgnoredPrototypeTypes.Add(name);
}
}
[Serializable]