2021-12-06 22:10:03 +00:00
|
|
|
using Content.Server.Storage.Components;
|
|
|
|
|
using Content.Shared.Construction;
|
|
|
|
|
using Content.Shared.Examine;
|
2023-09-05 00:07:01 +10:00
|
|
|
using Content.Shared.Tools.Systems;
|
2021-12-06 22:10:03 +00:00
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Construction.Conditions
|
|
|
|
|
{
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
|
[DataDefinition]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class StorageWelded : IGraphCondition
|
2021-12-06 22:10:03 +00:00
|
|
|
{
|
|
|
|
|
[DataField("welded")]
|
|
|
|
|
public bool Welded { get; private set; } = true;
|
|
|
|
|
|
|
|
|
|
public bool Condition(EntityUid uid, IEntityManager entityManager)
|
|
|
|
|
{
|
2023-09-06 19:18:11 +01:00
|
|
|
return entityManager.System<WeldableSystem>().IsWelded(uid) == Welded;
|
2021-12-06 22:10:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool DoExamine(ExaminedEvent args)
|
|
|
|
|
{
|
2021-12-07 17:48:49 +01:00
|
|
|
var entMan = IoCManager.Resolve<IEntityManager>();
|
2021-12-06 22:10:03 +00:00
|
|
|
var entity = args.Examined;
|
|
|
|
|
|
2023-09-05 00:07:01 +10:00
|
|
|
if (!entMan.HasComponent<EntityStorageComponent>(entity))
|
|
|
|
|
return false;
|
2021-12-07 17:48:49 +01:00
|
|
|
|
|
|
|
|
var metaData = entMan.GetComponent<MetaDataComponent>(entity);
|
2021-12-06 22:10:03 +00:00
|
|
|
|
2023-09-05 00:07:01 +10:00
|
|
|
if (entMan.System<WeldableSystem>().IsWelded(entity) != Welded)
|
2021-12-06 22:10:03 +00:00
|
|
|
{
|
2022-10-30 02:48:53 -04:00
|
|
|
if (Welded)
|
2021-12-07 17:48:49 +01:00
|
|
|
args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", metaData.EntityName)) + "\n");
|
2021-12-06 22:10:03 +00:00
|
|
|
else
|
2021-12-07 17:48:49 +01:00
|
|
|
args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", metaData.EntityName)) + "\n");
|
2021-12-06 22:10:03 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
|
|
|
|
|
{
|
|
|
|
|
yield return new ConstructionGuideEntry()
|
|
|
|
|
{
|
|
|
|
|
Localization = Welded
|
|
|
|
|
? "construction-guide-condition-door-weld"
|
|
|
|
|
: "construction-guide-condition-door-unweld",
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|