Universal weldable component (#7955)

* Weldable component for door

* Content update

* Examine message

* Universal visualizer

* Small fix

* Entity storage

* Content

* Fixed test

* Update Content.Shared/Storage/SharedStorageComponent.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* Fixed loc string

* Add public API to change welding time

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
Alex Evgrashin
2022-05-09 08:51:52 +03:00
committed by GitHub
parent 02de328d9c
commit df49c2fd57
29 changed files with 367 additions and 215 deletions

View File

@@ -0,0 +1,61 @@
using Content.Server.Tools.Systems;
using Content.Shared.Tools;
using Content.Shared.Tools.Components;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Tools.Components;
/// <summary>
/// Allows users to weld/unweld doors, crates and lockers.
/// </summary>
[RegisterComponent]
[Friend(typeof(WeldableSystem))]
public sealed class WeldableComponent : SharedWeldableComponent
{
/// <summary>
/// Tool quality for welding.
/// </summary>
[DataField("weldingQuality", customTypeSerializer: typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
[ViewVariables(VVAccess.ReadWrite)]
public string WeldingQuality = "Welding";
/// <summary>
/// Whether this entity can ever be welded shut.
/// </summary>
[DataField("weldable")]
[ViewVariables(VVAccess.ReadWrite)]
public bool Weldable = true;
/// <summary>
/// How much fuel does it take to weld/unweld entity.
/// </summary>
[DataField("fuel")]
[ViewVariables(VVAccess.ReadWrite)]
public float FuelConsumption = 1f;
/// <summary>
/// How much time does it take to weld/unweld entity.
/// </summary>
[DataField("time")]
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan WeldingTime = TimeSpan.FromSeconds(1f);
/// <summary>
/// Shown when welded entity is examined.
/// </summary>
[DataField("weldedExamineMessage")]
[ViewVariables(VVAccess.ReadWrite)]
public string? WeldedExamineMessage = "weldable-component-examine-is-welded";
/// <summary>
/// Whether something is currently using a welder on this so DoAfter isn't spammed.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public bool BeingWelded;
/// <summary>
/// Is this entity currently welded shut?
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public bool IsWelded;
}