2020-08-13 14:40:27 +02:00
|
|
|
|
using Content.Shared.Construction;
|
2020-08-01 17:37:12 +02:00
|
|
|
|
using Content.Shared.GameObjects.EntitySystems;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2020-08-01 17:37:12 +02:00
|
|
|
|
using Robust.Shared.GameObjects.Systems;
|
2020-07-02 14:50:57 -07:00
|
|
|
|
using Robust.Shared.Serialization;
|
2020-08-01 17:37:12 +02:00
|
|
|
|
using Robust.Shared.Utility;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Shared.ViewVariables;
|
2018-08-02 08:29:55 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.GameObjects.Components.Construction
|
|
|
|
|
|
{
|
2020-07-02 14:50:57 -07:00
|
|
|
|
/// <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]
|
2020-08-01 17:37:12 +02:00
|
|
|
|
public class ConstructionComponent : Component, IExamine
|
2018-08-02 08:29:55 +02:00
|
|
|
|
{
|
2020-07-02 14:50:57 -07:00
|
|
|
|
/// <inheritdoc />
|
2018-08-02 08:29:55 +02:00
|
|
|
|
public override string Name => "Construction";
|
|
|
|
|
|
|
2020-07-02 14:50:57 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The current construction recipe being used to build this entity.
|
|
|
|
|
|
/// </summary>
|
2018-09-09 15:34:43 +02:00
|
|
|
|
[ViewVariables]
|
2020-07-02 14:50:57 -07:00
|
|
|
|
public ConstructionPrototype Prototype { get; set; }
|
2018-08-02 08:29:55 +02:00
|
|
|
|
|
2020-07-02 14:50:57 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The current stage of construction.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
|
public int Stage { get; set; }
|
2018-08-02 08:29:55 +02:00
|
|
|
|
|
2020-07-02 14:50:57 -07:00
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
public override void ExposeData(ObjectSerializer serializer)
|
2018-08-02 08:29:55 +02:00
|
|
|
|
{
|
2020-07-02 14:50:57 -07:00
|
|
|
|
base.ExposeData(serializer);
|
2020-05-19 13:55:52 +02:00
|
|
|
|
|
2020-07-02 14:50:57 -07:00
|
|
|
|
serializer.DataReadWriteFunction("prototype", null,
|
|
|
|
|
|
value => Prototype = value, () => Prototype);
|
2020-05-19 13:55:52 +02:00
|
|
|
|
|
2020-07-02 14:50:57 -07:00
|
|
|
|
serializer.DataReadWriteFunction("stage", 0,
|
|
|
|
|
|
value => Stage = value, () => Stage);
|
2018-08-02 08:29:55 +02:00
|
|
|
|
}
|
2020-08-01 17:37:12 +02:00
|
|
|
|
|
|
|
|
|
|
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
|
|
|
|
|
{
|
|
|
|
|
|
EntitySystem.Get<SharedConstructionSystem>().DoExamine(message, Prototype, Stage, inDetailsRange);
|
|
|
|
|
|
}
|
2018-08-02 08:29:55 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|