2021-10-29 13:40:15 +01:00
|
|
|
using Content.Server.Chemistry.Components.SolutionManager;
|
2021-12-16 23:42:02 +13:00
|
|
|
using Content.Shared.Chemistry.Components;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Chemistry.Reagent;
|
2020-04-08 15:53:15 +05:00
|
|
|
using Robust.Server.GameObjects;
|
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-12-03 11:15:12 +01:00
|
|
|
using Robust.Shared.IoC;
|
2020-04-08 15:53:15 +05:00
|
|
|
using Robust.Shared.Utility;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Chemistry.Components
|
2020-04-08 15:53:15 +05:00
|
|
|
{
|
|
|
|
|
[RegisterComponent]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class TransformableContainerComponent : Component
|
2020-04-08 15:53:15 +05:00
|
|
|
{
|
2021-12-08 17:04:21 +01:00
|
|
|
[Dependency] private readonly IEntityManager _entMan = default!;
|
|
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
public SpriteSpecifier? InitialSprite;
|
|
|
|
|
public string InitialName = default!;
|
|
|
|
|
public string InitialDescription = default!;
|
|
|
|
|
public ReagentPrototype? CurrentReagent;
|
2020-04-09 16:43:56 +05:00
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
public bool Transformed { get; internal set; }
|
2020-04-08 15:53:15 +05:00
|
|
|
|
2021-06-19 19:41:26 -07:00
|
|
|
protected override void Initialize()
|
2020-04-08 15:53:15 +05:00
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
2021-12-08 17:04:21 +01:00
|
|
|
if (_entMan.TryGetComponent(Owner, out SpriteComponent? sprite) &&
|
2020-08-22 22:29:20 +02:00
|
|
|
sprite.BaseRSIPath != null)
|
|
|
|
|
{
|
2021-09-06 15:49:44 +02:00
|
|
|
InitialSprite = new SpriteSpecifier.Rsi(new ResourcePath(sprite.BaseRSIPath), "icon");
|
2020-08-22 22:29:20 +02:00
|
|
|
}
|
|
|
|
|
|
2021-12-08 17:04:21 +01:00
|
|
|
InitialName = _entMan.GetComponent<MetaDataComponent>(Owner).EntityName;
|
|
|
|
|
InitialDescription = _entMan.GetComponent<MetaDataComponent>(Owner).EntityDescription;
|
2020-04-08 15:53:15 +05:00
|
|
|
}
|
|
|
|
|
|
2020-04-08 17:12:00 +05:00
|
|
|
protected override void Startup()
|
|
|
|
|
{
|
|
|
|
|
base.Startup();
|
2020-08-24 13:39:00 +02:00
|
|
|
|
2021-09-06 15:49:44 +02:00
|
|
|
Owner.EnsureComponentWarn<SolutionContainerManagerComponent>();
|
|
|
|
|
Owner.EnsureComponentWarn<FitsInDispenserComponent>();
|
2020-04-08 15:53:15 +05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|