Remove ILand (#4582)

* Remove ILand

* Make land not handleable

* Rename ILand
This commit is contained in:
metalgearsloth
2021-09-12 16:22:58 +10:00
committed by GitHub
parent 0137884e16
commit f301e45163
13 changed files with 99 additions and 103 deletions

View File

@@ -1,15 +1,21 @@
using Content.Server.Nutrition.Components;
using Content.Server.Fluids.Components;
using Content.Server.Nutrition.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Throwing;
using JetBrains.Annotations;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Player;
using Robust.Shared.Random;
namespace Content.Server.Nutrition.EntitySystems
{
[UsedImplicitly]
public class DrinkSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
public override void Initialize()
@@ -18,6 +24,25 @@ namespace Content.Server.Nutrition.EntitySystems
SubscribeLocalEvent<DrinkComponent, SolutionChangedEvent>(OnSolutionChange);
SubscribeLocalEvent<DrinkComponent, ComponentInit>(OnDrinkInit);
SubscribeLocalEvent<DrinkComponent, LandEvent>(HandleLand);
}
private void HandleLand(EntityUid uid, DrinkComponent component, LandEvent args)
{
if (component.Pressurized &&
!component.Opened &&
_random.Prob(0.25f) &&
_solutionContainerSystem.TryGetDrainableSolution(uid, out var interactions))
{
component.Opened = true;
var entity = EntityManager.GetEntity(uid);
var solution = _solutionContainerSystem.Drain(uid, interactions, interactions.DrainAvailable);
solution.SpillAt(entity, "PuddleSmear");
SoundSystem.Play(Filter.Pvs(entity), component.BurstSound.GetSound(), entity, AudioParams.Default.WithVolume(-4));
}
}
private void OnDrinkInit(EntityUid uid, DrinkComponent component, ComponentInit args)