| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using Content.Server.Storage.Components;
- using Content.Shared.Construction;
- using Content.Shared.Examine;
- using Content.Shared.Tools.Systems;
- using JetBrains.Annotations;
- namespace Content.Server.Construction.Conditions
- {
- [UsedImplicitly]
- [DataDefinition]
- public sealed partial class StorageWelded : IGraphCondition
- {
- [DataField("welded")]
- public bool Welded { get; private set; } = true;
- public bool Condition(EntityUid uid, IEntityManager entityManager)
- {
- return entityManager.System<WeldableSystem>().IsWelded(uid) == Welded;
- }
- public bool DoExamine(ExaminedEvent args)
- {
- var entMan = IoCManager.Resolve<IEntityManager>();
- var entity = args.Examined;
- if (!entMan.HasComponent<EntityStorageComponent>(entity))
- return false;
- var metaData = entMan.GetComponent<MetaDataComponent>(entity);
- if (entMan.System<WeldableSystem>().IsWelded(entity) != Welded)
- {
- if (Welded)
- args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", metaData.EntityName)) + "\n");
- else
- args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", metaData.EntityName)) + "\n");
- return true;
- }
- return false;
- }
- public IEnumerable<ConstructionGuideEntry> GenerateGuideEntry()
- {
- yield return new ConstructionGuideEntry()
- {
- Localization = Welded
- ? "construction-guide-condition-door-weld"
- : "construction-guide-condition-door-unweld",
- };
- }
- }
- }
|