mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* Everything except the YAML slop... * She solution on my manager till I sajfslkahfsjakfhaskjfshajksafhfsakhfasjfas * another 1000 lines * fix chem dispenser size * go my shnelf * Implicit ass * rider is being mean for some reason * dasdas * borger * better formatting go! * clothes/bloodstream * Cartons * cups and bottles * mmm soder * bar drinks * Spray bottles and some size tweaks with hindsight * 99 bottles of beer on the wall I hate YAML * push that shit * mmm burger * Sneed * sheets * condiments * mmm yummy * fridge yummyfood * meat... * sub 300 * burger... * bready * let them eat cake * does she know how to make a grilled cheese? * pizza pie! * misc shit * soup or salad * Food and drinks, vanquished * the cubes!!! * Almost free from YAML... * fix test fails and some yaml issues * fix prediction, almost done * fix all test fails * remove master merge artifacts and undo autonetworking * review and compatibility * graaah * unfuck master merge I hate github * merg conflicts * sfsa * ehoop * sadas * afsafsaasf * merge conflicts * fucked up the merge conflicts * merge conflict is fucked I might need to completely redo this branch * test fail * no calcium???? --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
59 lines
2.1 KiB
C#
59 lines
2.1 KiB
C#
using Content.Shared.Chemistry.Components;
|
|
using Content.Shared.Chemistry.Reaction;
|
|
using Robust.Shared.Containers;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Shared.Chemistry.EntitySystems;
|
|
|
|
public sealed class ReactiveContainerSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
|
[Dependency] private readonly ReactiveSystem _reactiveSystem = default!;
|
|
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
|
|
[Dependency] private readonly IGameTiming _timing = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<ReactiveContainerComponent, EntInsertedIntoContainerMessage>(OnInserted);
|
|
SubscribeLocalEvent<ReactiveContainerComponent, SolutionChangedEvent>(OnSolutionChange);
|
|
}
|
|
|
|
private void OnInserted(EntityUid uid, ReactiveContainerComponent comp, EntInsertedIntoContainerMessage args)
|
|
{
|
|
// Only reactive entities can react with the solution
|
|
if (!HasComp<ReactiveComponent>(args.Entity))
|
|
return;
|
|
|
|
if (!_solutionContainerSystem.TryGetSolution(uid, comp.Solution, out _, out var solution))
|
|
return;
|
|
if (solution.Volume == 0)
|
|
return;
|
|
|
|
_reactiveSystem.DoEntityReaction(args.Entity, solution, ReactionMethod.Touch);
|
|
}
|
|
|
|
private void OnSolutionChange(EntityUid uid, ReactiveContainerComponent comp, SolutionChangedEvent args)
|
|
{
|
|
// The changes are already networked as part of the same game state.
|
|
if (_timing.ApplyingState)
|
|
return;
|
|
|
|
if (!_solutionContainerSystem.TryGetSolution(uid, comp.Solution, out _, out var solution))
|
|
return;
|
|
|
|
if (solution.Volume == 0)
|
|
return;
|
|
|
|
if (!_containerSystem.TryGetContainer(uid, comp.Container, out var container))
|
|
return;
|
|
|
|
foreach (var entity in container.ContainedEntities)
|
|
{
|
|
if (!HasComp<ReactiveComponent>(entity))
|
|
continue;
|
|
_reactiveSystem.DoEntityReaction(entity, solution, ReactionMethod.Touch);
|
|
}
|
|
}
|
|
}
|