Airlock construction (#3609)

* Add construction and deconstsruction of airlocks

* Change name to door electronics

* Rearrange things

* Fix errors

* Fix physics error from bumping

* Prevent editing the map for now

* Address reviews

* Change switch to if

* Fix newlines
This commit is contained in:
ShadowCommander
2021-03-17 05:07:49 -07:00
committed by GitHub
parent 0c0c66ff6f
commit 51178b9ae7
10 changed files with 301 additions and 12 deletions

View File

@@ -0,0 +1,43 @@
#nullable enable
using Content.Server.GameObjects.Components.Doors;
using Content.Shared.Construction;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using System.Threading.Tasks;
namespace Content.Server.Construction.Conditions
{
[UsedImplicitly]
[DataDefinition]
public class AirlockBolted : IEdgeCondition
{
[DataField("value")]
public bool Value { get; private set; } = true;
public async Task<bool> Condition(IEntity entity)
{
if (!entity.TryGetComponent(out AirlockComponent? airlock)) return true;
return airlock.BoltsDown == Value;
}
public bool DoExamine(IEntity entity, FormattedMessage message, bool inDetailsRange)
{
if (!entity.TryGetComponent(out AirlockComponent? airlock)) return false;
if (airlock.BoltsDown != Value)
{
if (Value == true)
message.AddMarkup(Loc.GetString("construction-condition-airlock-bolt", ("entityName", entity.Name)) + "\n");
else
message.AddMarkup(Loc.GetString("construction-condition-airlock-unbolt", ("entityName", entity.Name)) + "\n");
return true;
}
return false;
}
}
}