ECS and bandaid research (#9251)

This commit is contained in:
metalgearsloth
2022-06-28 22:54:08 +10:00
committed by GitHub
parent 9b08457e52
commit 5dbb3220dd
21 changed files with 496 additions and 531 deletions

View File

@@ -11,18 +11,13 @@ namespace Content.Shared.Research.Components
{
[DataField("technologies")] private List<string> _technologyIds = new();
protected List<TechnologyPrototype> _technologies = new();
/// <summary>
/// A read-only list of unlocked technologies.
/// </summary>
public IReadOnlyList<TechnologyPrototype> Technologies => _technologies;
public List<TechnologyPrototype> Technologies = new();
void ISerializationHooks.BeforeSerialization()
{
var techIds = new List<string>();
foreach (var tech in _technologies)
foreach (var tech in Technologies)
{
techIds.Add(tech.ID);
}
@@ -38,7 +33,7 @@ namespace Content.Shared.Research.Components
{
if (prototypeManager.TryIndex(id, out TechnologyPrototype? tech))
{
_technologies.Add(tech);
Technologies.Add(tech);
}
}
}
@@ -61,7 +56,7 @@ namespace Content.Shared.Research.Components
{
List<string> techIds = new List<string>();
foreach (var tech in _technologies)
foreach (var tech in Technologies)
{
techIds.Add(tech.ID);
}
@@ -76,7 +71,7 @@ namespace Content.Shared.Research.Components
/// <returns>Whether it is unlocked or not</returns>
public bool IsTechnologyUnlocked(TechnologyPrototype technology)
{
return _technologies.Contains(technology);
return Technologies.Contains(technology);
}
/// <summary>