Gas tank internals alerts (#9567)

This commit is contained in:
metalgearsloth
2022-07-25 14:42:25 +10:00
committed by GitHub
parent dad26db137
commit 40a7584c2f
25 changed files with 570 additions and 354 deletions

View File

@@ -1,6 +1,7 @@
using System.Linq;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Camera;
using Content.Server.Nutrition.Components;
using Content.Server.Storage.EntitySystems;
using Content.Server.Storage.Components;
@@ -27,12 +28,13 @@ namespace Content.Server.PneumaticCannon
public sealed class PneumaticCannonSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly StunSystem _stun = default!;
[Dependency] private readonly AtmosphereSystem _atmos = default!;
[Dependency] private readonly SharedCameraRecoilSystem _sharedCameraRecoil = default!;
[Dependency] private readonly CameraRecoilSystem _cameraRecoil = default!;
[Dependency] private readonly GasTankSystem _gasTank = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
[Dependency] private readonly StorageSystem _storageSystem = default!;
[Dependency] private readonly StunSystem _stun = default!;
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
private HashSet<PneumaticCannonComponent> _currentlyFiring = new();
@@ -211,7 +213,7 @@ namespace Content.Server.PneumaticCannon
{
data.User.PopupMessage(Loc.GetString("pneumatic-cannon-component-fire-no-gas",
("cannon", comp.Owner)));
SoundSystem.Play("/Audio/Items/hiss.ogg", Filter.Pvs(((IComponent) comp).Owner), ((IComponent) comp).Owner, AudioParams.Default);
SoundSystem.Play("/Audio/Items/hiss.ogg", Filter.Pvs(comp.Owner), comp.Owner, AudioParams.Default);
return;
}
@@ -227,11 +229,11 @@ namespace Content.Server.PneumaticCannon
var ent = _random.Pick(storage.StoredEntities);
_storageSystem.RemoveAndDrop(comp.Owner, ent, storage);
SoundSystem.Play(comp.FireSound.GetSound(), Filter.Pvs(data.User), ((IComponent) comp).Owner, AudioParams.Default);
SoundSystem.Play(comp.FireSound.GetSound(), Filter.Pvs(data.User), comp.Owner, AudioParams.Default);
if (EntityManager.HasComponent<CameraRecoilComponent>(data.User))
{
var kick = Vector2.One * data.Strength;
_sharedCameraRecoil.KickCamera(data.User, kick);
_cameraRecoil.KickCamera(data.User, kick);
}
_throwingSystem.TryThrow(ent, data.Direction, data.Strength, data.User, GetPushbackRatioFromPower(comp.Power));
@@ -250,7 +252,7 @@ namespace Content.Server.PneumaticCannon
// we checked for this earlier in HasGas so a GetComp is okay
var gas = EntityManager.GetComponent<GasTankComponent>(contained);
var environment = _atmos.GetContainingMixture(comp.Owner, false, true);
var removed = gas.RemoveAir(GetMoleUsageFromPower(comp.Power));
var removed = _gasTank.RemoveAir(gas, GetMoleUsageFromPower(comp.Power));
if (environment != null && removed != null)
{
_atmos.Merge(environment, removed);