Add headbutting open airlocks when you have no hands (#1433)

This commit is contained in:
DrSmugleaf
2020-07-20 16:03:05 +02:00
committed by GitHub
parent 20ca4ccd4a
commit 8e1ecb5476
3 changed files with 15 additions and 2 deletions

View File

@@ -2,12 +2,16 @@
using System.Linq; using System.Linq;
using Content.Server.GameObjects.Components.Access; using Content.Server.GameObjects.Components.Access;
using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Mobs;
using Content.Server.Interfaces.GameObjects;
using Content.Shared.GameObjects.Components.Doors; using Content.Shared.GameObjects.Components.Doors;
using Content.Shared.GameObjects.Components.Movement; using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.Interfaces.GameObjects.Components; using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components; using Robust.Shared.GameObjects.Components;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Maths; using Robust.Shared.Maths;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
@@ -35,7 +39,7 @@ namespace Content.Server.GameObjects
protected bool AutoClose = true; protected bool AutoClose = true;
protected const float AutoCloseDelay = 5; protected const float AutoCloseDelay = 5;
protected float CloseSpeed = AutoCloseDelay; protected float CloseSpeed = AutoCloseDelay;
private ICollidableComponent _collidableComponent; private ICollidableComponent _collidableComponent;
private AppearanceComponent _appearance; private AppearanceComponent _appearance;
private CancellationTokenSource _cancellationTokenSource; private CancellationTokenSource _cancellationTokenSource;
@@ -145,7 +149,14 @@ namespace Content.Server.GameObjects
Deny(); Deny();
return; return;
} }
Open(); Open();
if (user.TryGetComponent(out HandsComponent hands) && hands.Count == 0)
{
EntitySystem.Get<AudioSystem>().PlayFromEntity("/Audio/Effects/bang.ogg", Owner,
AudioParams.Default.WithVolume(-2));
}
} }
public void Open() public void Open()
@@ -296,7 +307,7 @@ namespace Content.Server.GameObjects
{ {
OpenTimeCounter += frameTime; OpenTimeCounter += frameTime;
} }
if (OpenTimeCounter > CloseSpeed) if (OpenTimeCounter > CloseSpeed)
{ {
if (!CanClose() || !Close()) if (!CanClose() || !Close())

View File

@@ -55,6 +55,8 @@ namespace Content.Server.GameObjects
// Mostly arbitrary. // Mostly arbitrary.
public const float PickupRange = 2; public const float PickupRange = 2;
[ViewVariables] public int Count => _orderedHands.Count;
public override void ExposeData(ObjectSerializer serializer) public override void ExposeData(ObjectSerializer serializer)
{ {
base.ExposeData(serializer); base.ExposeData(serializer);

Binary file not shown.