using System.Collections.Generic;
using Content.Shared.Materials;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
using Robust.Shared.Reflection;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Shared.GameObjects.Components.Materials
{
///
/// Component to store data such as "this object is made out of steel".
/// This is not a storage system for say smelteries.
///
[RegisterComponent]
public class MaterialComponent : Component, ISerializationHooks
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public const string SerializationCache = "mat";
public override string Name => "Material";
[DataField("materials")] private List _materials = new();
public IEnumerable> MaterialTypes
{
get
{
foreach (var entry in _materials)
{
var prototype = _prototypeManager.Index(entry.Value);
yield return new KeyValuePair