fish-station/Content.Server/_Sunrise/SplashOnTrigger/SplashOnTriggerSystem.cs
Vigers Ray 6304ac7e6f
Культ плоти (#871)
* Культ плоти

* Мейби это скорет ноги для паучих ног

* фикс ног и иконок (#986)

Co-authored-by: Vigers Ray <vigersray@gmail.com>

---------

Co-authored-by: Babaev <129369024+babaevlsdd@users.noreply.github.com>
2025-01-01 08:02:29 +03:00

44 lines
1.4 KiB
C#

using Content.Server.Explosion.EntitySystems;
using Content.Server.Fluids.EntitySystems;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using JetBrains.Annotations;
namespace Content.Server._Sunrise.SplashOnTrigger;
[UsedImplicitly]
public sealed partial class SplashOnTriggerSystem : EntitySystem
{
[Dependency] private readonly SharedSolutionContainerSystem _solutionSystem = default!;
[Dependency] private readonly PuddleSystem _puddleSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SplashOnTriggerComponent, TriggerEvent>(OnSplashTrigger);
}
private void OnSplashTrigger(EntityUid uid, SplashOnTriggerComponent component, TriggerEvent args)
{
var xform = Transform(uid);
var coords = xform.Coordinates;
if (!coords.IsValid(EntityManager))
return;
var transferSolution = new Solution();
foreach (var solution in component.SplashReagents)
{
transferSolution.AddReagent(solution.Reagent, solution.Quantity);
}
if (_solutionSystem.TryGetInjectableSolution(uid, out var injectableSolution, out _))
{
_solutionSystem.TryAddSolution(injectableSolution.Value, transferSolution);
}
_puddleSystem.TrySplashSpillAt(uid, coords, transferSolution, out var puddleUid);
}
}