2021-11-11 16:10:57 -07:00
|
|
|
|
using Content.Server.Body.Components;
|
2021-12-30 22:56:10 +01:00
|
|
|
|
using Content.Server.Body.Systems;
|
2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Shared.Inventory;
|
2021-12-30 22:56:10 +01:00
|
|
|
|
using Robust.Shared.Analyzers;
|
2020-10-27 20:53:44 +01:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-12-03 14:17:01 +01:00
|
|
|
|
using Robust.Shared.IoC;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-10-27 20:53:44 +01:00
|
|
|
|
|
2021-06-19 13:25:05 +02:00
|
|
|
|
namespace Content.Server.Atmos.Components
|
2020-10-27 20:53:44 +01:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Used in internals as breath tool.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[RegisterComponent]
|
2022-02-01 19:35:40 -08:00
|
|
|
|
[ComponentProtoName("BreathMask")]
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class BreathToolComponent : Component
|
2020-10-27 20:53:44 +01:00
|
|
|
|
{
|
2021-12-05 18:09:01 +01:00
|
|
|
|
[Dependency] private readonly IEntityManager _entities = default!;
|
|
|
|
|
|
|
2020-10-27 20:53:44 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Tool is functional only in allowed slots
|
|
|
|
|
|
/// </summary>
|
2021-03-05 01:08:38 +01:00
|
|
|
|
[DataField("allowedSlots")]
|
2021-12-30 22:56:10 +01:00
|
|
|
|
public SlotFlags AllowedSlots = SlotFlags.MASK;
|
|
|
|
|
|
public bool IsFunctional;
|
|
|
|
|
|
public EntityUid ConnectedInternalsEntity;
|
2020-10-27 20:53:44 +01:00
|
|
|
|
|
|
|
|
|
|
protected override void Shutdown()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Shutdown();
|
|
|
|
|
|
DisconnectInternals();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void DisconnectInternals()
|
|
|
|
|
|
{
|
|
|
|
|
|
var old = ConnectedInternalsEntity;
|
2021-12-05 18:09:01 +01:00
|
|
|
|
ConnectedInternalsEntity = default;
|
2020-10-27 20:53:44 +01:00
|
|
|
|
|
2021-12-05 18:09:01 +01:00
|
|
|
|
if (old != default && _entities.TryGetComponent<InternalsComponent?>(old, out var internalsComponent))
|
2020-10-27 20:53:44 +01:00
|
|
|
|
{
|
|
|
|
|
|
internalsComponent.DisconnectBreathTool();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IsFunctional = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|