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

@@ -75,24 +75,6 @@ public sealed class DoorComponent : Component, ISerializationHooks
public bool Partial;
#endregion
#region Welding
// TODO WELDING. Consider creating a WeldableComponent for use with doors, crates and lockers? Currently they all
// have their own welding logic.
[DataField("weldingQuality", customTypeSerializer: typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
public string WeldingQuality = "Welding";
/// <summary>
/// Whether the door can ever be welded shut.
/// </summary>
[DataField("weldable")]
public bool Weldable = true;
/// <summary>
/// Whether something is currently using a welder on this so DoAfter isn't spammed.
/// </summary>
public bool BeingWelded;
#endregion
public bool BeingPried;
#region Sounds

View File

@@ -47,7 +47,6 @@ public abstract class SharedDoorSystem : EntitySystem
SubscribeLocalEvent<DoorComponent, ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<DoorComponent, ActivateInWorldEvent>(OnActivate);
SubscribeLocalEvent<DoorComponent, ExaminedEvent>(OnExamine);
SubscribeLocalEvent<DoorComponent, StartCollideEvent>(HandleCollide);
SubscribeLocalEvent<DoorComponent, PreventCollideEvent>(PreventCollision);
@@ -173,12 +172,6 @@ public abstract class SharedDoorSystem : EntitySystem
args.Handled = true;
}
private void OnExamine(EntityUid uid, DoorComponent door, ExaminedEvent args)
{
if (door.State == DoorState.Welded)
args.PushText(Loc.GetString("door-component-examine-is-welded"));
}
/// <summary>
/// Update the door state/visuals and play an access denied sound when a user without access interacts with the
/// door.

View File

@@ -78,11 +78,9 @@ namespace Content.Shared.Storage
[NetSerializable]
[Serializable]
public enum StorageVisuals
public enum StorageVisuals : byte
{
Open,
CanWeld,
Welded,
CanLock,
Locked
}

View File

@@ -0,0 +1,20 @@
using Robust.Shared.Serialization;
namespace Content.Shared.Tools.Components;
public abstract class SharedWeldableComponent : Component
{
}
[Serializable, NetSerializable]
public enum WeldableVisuals : byte
{
IsWelded
}
[Serializable, NetSerializable]
public enum WeldableLayers : byte
{
BaseWelded
}