Files
tbd-station-14/Content.Server/GameObjects/Components/Atmos/FirelockComponent.cs
Git-Nivrak 6d2882c7cf (Smaller) Construction PR - (IC Construction) (#2575)
* Disable Pulling When Buckling an entity

* Projectile Improvements

If you shoot at a person that is critted now it will only hit if you aim at that person otherwise go "above" him and hit other targets.
- Dead people are still unhitable

* Update Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs

Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>

* Firelock In Progress

* Revert "Projectile Improvements"

This reverts commit 5821afc798e49e530d4086d7a9ddbe097805fdc4.

* Firelock Graph

* Revert "Merge branch 'master' into test2"

This reverts commit c69661cc7d9dcdc6d8c0dd45770f9eb94b231463, reversing
changes made to 5f1de8b8d24cd52190addb3df5617cb1012fd52c.

* Bunch of stuff

- Metal Rods
- Reinforced Glass
- SetStackCount Condition
- Tables
- Lattice

* Output2 to FloorTileItemComponent

* Plating, Underplating and Tiles (+FloorTile Improvements)

* Turf Fixes

+ APC Electronics

* Reinforced Glass In-hand textures

* All the fixes

* Final Changes

* (Hopefully) Last commit

* Update Resources/Prototypes/Entities/Constructible/Doors/firelock_frame.yml

Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>

* Update Content.Server/GameObjects/Components/Atmos/FirelockComponent.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* A Few more things

* Edit FirelockComponent.cs

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2020-11-20 15:58:06 +01:00

108 lines
3.4 KiB
C#

using System;
using System.Threading.Tasks;
using Content.Server.GameObjects.Components.Doors;
using Content.Server.GameObjects.Components.Interactable;
using Content.Shared.GameObjects.Components.Doors;
using Content.Shared.GameObjects.Components.Interactable;
using Content.Shared.Interfaces;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Server.GameObjects.Components.Atmos
{
[RegisterComponent]
[ComponentReference(typeof(ServerDoorComponent))]
public class FirelockComponent : ServerDoorComponent, IInteractUsing, ICollideBehavior
{
public override string Name => "Firelock";
protected override TimeSpan CloseTimeOne => TimeSpan.FromSeconds(0.1f);
protected override TimeSpan CloseTimeTwo => TimeSpan.FromSeconds(0.6f);
protected override TimeSpan OpenTimeOne => TimeSpan.FromSeconds(0.1f);
protected override TimeSpan OpenTimeTwo => TimeSpan.FromSeconds(0.6f);
public void CollideWith(IEntity collidedWith)
{
// We do nothing.
}
protected override void Startup()
{
base.Startup();
if (Owner.TryGetComponent(out AirtightComponent airtightComponent))
{
airtightComponent.AirBlocked = false;
}
if (Owner.TryGetComponent(out IPhysicsComponent physics))
{
physics.CanCollide = false;
}
AutoClose = false;
Safety = false;
State = DoorState.Open;
SetAppearance(DoorVisualState.Open);
}
public bool EmergencyPressureStop()
{
var closed = State == DoorState.Open && Close();
if(closed)
Owner.GetComponent<AirtightComponent>().AirBlocked = true;
return closed;
}
public override bool CanOpen()
{
return !IsHoldingFire() && !IsHoldingPressure() && base.CanOpen();
}
public override bool CanClose(IEntity user) => true;
public override bool CanOpen(IEntity user) => CanOpen();
public override async Task<bool> InteractUsing(InteractUsingEventArgs eventArgs)
{
if (await base.InteractUsing(eventArgs))
return false;
if (!eventArgs.Using.TryGetComponent<ToolComponent>(out var tool))
return false;
if (tool.HasQuality(ToolQuality.Prying) && !IsWeldedShut)
{
var holdingPressure = IsHoldingPressure();
var holdingFire = IsHoldingFire();
if (State == DoorState.Closed)
{
if (holdingPressure)
Owner.PopupMessage(eventArgs.User, "A gush of air blows in your face... Maybe you should reconsider.");
}
if (IsWeldedShut || !await tool.UseTool(eventArgs.User, Owner, holdingPressure || holdingFire ? 1.5f : 0.25f, ToolQuality.Prying)) return false;
if (State == DoorState.Closed)
{
Open();
}
else if (State == DoorState.Open)
{
Close();
}
return true;
}
return false;
}
}
}