Files
tbd-station-14/Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs
Acruid 3ee480a3b1 Deconstruction Features (#1242)
* ConstructionSystem now detects when a tool is used on an arbitrary entity.

* Refactored building logic from ConstructionComponent to ConstructionSystem.

* Add OnDeconstruct events so that deconstruction can be blocked if prerequisites are not met.

* Multi-step deconstruction works.
Windows can be deconstructed using a screwdriver.

* In-hand construction and deconstruction works.

* Intermediate entities now have a better name assigned to them when created.

* Removed a question mark to appease Jenkins.

* Instead of running ExposeData on the existing ItemComponent of an intermediateFrame, the system will now replace the existing ItemComponent with a new one, and run ExposeData on the new one.
2020-07-02 14:50:57 -07:00

42 lines
1.2 KiB
C#

using Content.Shared.Construction;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization;
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>
[RegisterComponent]
public class ConstructionComponent : Component
{
/// <inheritdoc />
public override string Name => "Construction";
/// <summary>
/// The current construction recipe being used to build this entity.
/// </summary>
[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);
serializer.DataReadWriteFunction("prototype", null,
value => Prototype = value, () => Prototype);
serializer.DataReadWriteFunction("stage", 0,
value => Stage = value, () => Stage);
}
}
}