Files
crystall-punk-14/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs

50 lines
1.6 KiB
C#
Raw Normal View History

using Content.Shared.Construction;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Construction
{
/// <summary>
/// Holds data about an entity that is in the process of being constructed or destructed.
/// </summary>
2019-07-31 15:02:36 +02:00
[RegisterComponent]
public class ConstructionComponent : Component, IExamine
{
/// <inheritdoc />
public override string Name => "Construction";
/// <summary>
/// The current construction recipe being used to build this entity.
/// </summary>
2018-09-09 15:34:43 +02:00
[ViewVariables]
public ConstructionPrototype Prototype { get; set; }
/// <summary>
/// The current stage of construction.
/// </summary>
[ViewVariables]
public int Stage { get; set; }
/// <inheritdoc />
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
2020-05-19 13:55:52 +02:00
serializer.DataReadWriteFunction("prototype", null,
value => Prototype = value, () => Prototype);
2020-05-19 13:55:52 +02:00
serializer.DataReadWriteFunction("stage", 0,
value => Stage = value, () => Stage);
}
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{
EntitySystem.Get<SharedConstructionSystem>().DoExamine(message, Prototype, Stage, inDetailsRange);
}
}
}