Skip to content

Commit

Permalink
Replace instances of SolutionContainerSystem with SharedSolutionConta…
Browse files Browse the repository at this point in the history
…inerSystem (#30084)

* Replace instances of SolutionContainerSystem with SharedSolutionContainerSystem

* guap

* More fixes

* Wait you can do that?

---------

Co-authored-by: Pieter-Jan Briers <[email protected]>
  • Loading branch information
Cojoke-dot and PJB3005 authored Sep 2, 2024
1 parent 63ad627 commit ef1fadf
Show file tree
Hide file tree
Showing 67 changed files with 165 additions and 163 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Linq;
using Content.Client.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Atmos.Prototypes;
using Content.Shared.Body.Part;
using Content.Shared.Chemistry;
Expand All @@ -16,7 +16,7 @@ namespace Content.Client.Chemistry.EntitySystems;
/// <inheritdoc/>
public sealed class ChemistryGuideDataSystem : SharedChemistryGuideDataSystem
{
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;

[ValidatePrototypeId<MixingCategoryPrototype>]
private const string DefaultMixingCategory = "DummyMix";
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Administration/Commands/AddReagent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Administration;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.Reagent;
Expand Down Expand Up @@ -42,7 +42,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
return;
}

var solutionContainerSystem = _entManager.System<SolutionContainerSystem>();
var solutionContainerSystem = _entManager.System<SharedSolutionContainerSystem>();
if (!solutionContainerSystem.TryGetSolution((uid.Value, man), args[1], out var solution))
{
var validSolutions = string.Join(", ", solutionContainerSystem.EnumerateSolutions((uid.Value, man)).Select(s => s.Name));
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Administration/Commands/SetSolutionCapacity.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Administration;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.FixedPoint;
Expand Down Expand Up @@ -36,7 +36,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
return;
}

var solutionContainerSystem = _entManager.System<SolutionContainerSystem>();
var solutionContainerSystem = _entManager.System<SharedSolutionContainerSystem>();
if (!solutionContainerSystem.TryGetSolution((uid.Value, man), args[1], out var solution))
{
var validSolutions = string.Join(", ", solutionContainerSystem.EnumerateSolutions((uid.Value, man)).Select(s => s.Name));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Administration;
using Content.Shared.Chemistry.Components.SolutionManager;
using Robust.Shared.Console;
Expand Down Expand Up @@ -35,7 +35,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
return;
}

var solutionContainerSystem = _entManager.System<SolutionContainerSystem>();
var solutionContainerSystem = _entManager.System<SharedSolutionContainerSystem>();
if (!solutionContainerSystem.TryGetSolution((uid.Value, man), args[1], out var solution))
{
var validSolutions = string.Join(", ", solutionContainerSystem.EnumerateSolutions((uid.Value, man)).Select(s => s.Name));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Administration;
using Content.Shared.Chemistry.Components.SolutionManager;
using Robust.Shared.Console;
Expand Down Expand Up @@ -35,7 +35,7 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
return;
}

var solutionContainerSystem = _entManager.System<SolutionContainerSystem>();
var solutionContainerSystem = _entManager.System<SharedSolutionContainerSystem>();
if (!solutionContainerSystem.TryGetSolution((uid.Value, man), args[1], out var solutionEnt, out var solution))
{
var validSolutions = string.Join(", ", solutionContainerSystem.EnumerateSolutions((uid.Value, man)).Select(s => s.Name));
Expand Down
7 changes: 4 additions & 3 deletions Content.Server/Administration/Toolshed/SolutionCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Content.Shared.Chemistry.EntitySystems;
using Robust.Shared.Toolshed;
using Robust.Shared.Toolshed.Syntax;
using Robust.Shared.Toolshed.TypeParsers;
Expand All @@ -13,7 +14,7 @@ namespace Content.Server.Administration.Toolshed;
[ToolshedCommand, AdminCommand(AdminFlags.Debug)]
public sealed class SolutionCommand : ToolshedCommand
{
private SolutionContainerSystem? _solutionContainer;
private SharedSolutionContainerSystem? _solutionContainer;

[CommandImplementation("get")]
public SolutionRef? Get(
Expand All @@ -22,7 +23,7 @@ public sealed class SolutionCommand : ToolshedCommand
[CommandArgument] ValueRef<string> name
)
{
_solutionContainer ??= GetSys<SolutionContainerSystem>();
_solutionContainer ??= GetSys<SharedSolutionContainerSystem>();

if (_solutionContainer.TryGetSolution(input, name.Evaluate(ctx)!, out var solution))
return new SolutionRef(solution.Value);
Expand All @@ -48,7 +49,7 @@ public SolutionRef AdjReagent(
[CommandArgument] ValueRef<FixedPoint2> amountRef
)
{
_solutionContainer ??= GetSys<SolutionContainerSystem>();
_solutionContainer ??= GetSys<SharedSolutionContainerSystem>();

var amount = amountRef.Evaluate(ctx);
if (amount > 0)
Expand Down
5 changes: 3 additions & 2 deletions Content.Server/Administration/UI/EditSolutionsEui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Content.Shared.Administration;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Eui;
using Content.Shared.Chemistry.EntitySystems;
using JetBrains.Annotations;
using Robust.Shared.Timing;

Expand All @@ -17,13 +18,13 @@ public sealed class EditSolutionsEui : BaseEui
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
private readonly SolutionContainerSystem _solutionContainerSystem = default!;
private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
public readonly EntityUid Target;

public EditSolutionsEui(EntityUid entity)
{
IoCManager.InjectDependencies(this);
_solutionContainerSystem = _entityManager.System<SolutionContainerSystem>();
_solutionContainerSystem = _entityManager.System<SharedSolutionContainerSystem>();
Target = entity;
}

Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Animals/Systems/UdderSystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Content.Server.Animals.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Popups;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Components;
using Content.Shared.DoAfter;
using Content.Shared.IdentityManagement;
Expand All @@ -25,7 +25,7 @@ internal sealed class UdderSystem : EntitySystem
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;

public override void Initialize()
{
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/Animals/Systems/WoolySystem.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Content.Server.Animals.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Nutrition;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Mobs.Systems;
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
Expand All @@ -9,15 +9,15 @@
namespace Content.Server.Animals.Systems;

/// <summary>
/// Gives ability to produce fiber reagents, produces endless if the
/// Gives ability to produce fiber reagents, produces endless if the
/// owner has no HungerComponent
/// </summary>
public sealed class WoolySystem : EntitySystem
{
[Dependency] private readonly HungerSystem _hunger = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;

public override void Initialize()
{
Expand Down
6 changes: 3 additions & 3 deletions Content.Server/Anomaly/Effects/InjectionAnomalySystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Content.Server.Anomaly.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Anomaly.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
using System.Linq;
Expand All @@ -16,15 +16,15 @@ namespace Content.Server.Anomaly.Effects;
public sealed class InjectionAnomalySystem : EntitySystem
{
[Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly TransformSystem _transform = default!;

private EntityQuery<InjectableSolutionComponent> _injectableQuery;

public override void Initialize()
{
SubscribeLocalEvent<InjectionAnomalyComponent, AnomalyPulseEvent>(OnPulse);
SubscribeLocalEvent<InjectionAnomalyComponent, AnomalySupercriticalEvent>(OnSupercritical, before: new[] { typeof(SolutionContainerSystem) });
SubscribeLocalEvent<InjectionAnomalyComponent, AnomalySupercriticalEvent>(OnSupercritical, before: new[] { typeof(SharedSolutionContainerSystem) });

_injectableQuery = GetEntityQuery<InjectableSolutionComponent>();
}
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Anomaly/Effects/PuddleCreateAnomalySystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Content.Server.Anomaly.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Server.Fluids.EntitySystems;
using Content.Shared.Anomaly.Components;

Expand All @@ -11,7 +11,7 @@ namespace Content.Server.Anomaly.Effects;
public sealed class PuddleCreateAnomalySystem : EntitySystem
{
[Dependency] private readonly PuddleSystem _puddle = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;

public override void Initialize()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Content.Server.Anomaly.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Anomaly.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.Sprite;
Expand Down Expand Up @@ -28,7 +28,7 @@ public sealed class ReagentProducerAnomalySystem : EntitySystem
//Useful:
//Those reagents that the players are hunting for. Very low percentage of loss.

[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly PointLightSystem _light = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
Expand Down
16 changes: 11 additions & 5 deletions Content.Server/Body/Systems/BloodstreamSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Content.Server.Body.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.EntityEffects.Effects;
using Content.Server.Fluids.EntitySystems;
using Content.Server.Forensics;
Expand Down Expand Up @@ -37,7 +36,7 @@ public sealed class BloodstreamSystem : EntitySystem
[Dependency] private readonly PuddleSystem _puddleSystem = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly SharedDrunkSystem _drunkSystem = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly SharedStutteringSystem _stutteringSystem = default!;
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
[Dependency] private readonly ForensicsSystem _forensicsSystem = default!;
Expand Down Expand Up @@ -178,9 +177,16 @@ public override void Update(float frameTime)

private void OnComponentInit(Entity<BloodstreamComponent> entity, ref ComponentInit args)
{
var chemicalSolution = _solutionContainerSystem.EnsureSolution(entity.Owner, entity.Comp.ChemicalSolutionName);
var bloodSolution = _solutionContainerSystem.EnsureSolution(entity.Owner, entity.Comp.BloodSolutionName);
var tempSolution = _solutionContainerSystem.EnsureSolution(entity.Owner, entity.Comp.BloodTemporarySolutionName);
if (!_solutionContainerSystem.EnsureSolution(entity.Owner,
entity.Comp.ChemicalSolutionName,
out var chemicalSolution) ||
!_solutionContainerSystem.EnsureSolution(entity.Owner,
entity.Comp.BloodSolutionName,
out var bloodSolution) ||
!_solutionContainerSystem.EnsureSolution(entity.Owner,
entity.Comp.BloodTemporarySolutionName,
out var tempSolution))
return;

chemicalSolution.MaxVolume = entity.Comp.ChemicalMaxVolume;
bloodSolution.MaxVolume = entity.Comp.BloodMaxVolume;
Expand Down
12 changes: 7 additions & 5 deletions Content.Server/Body/Systems/LungSystem.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Atmos;
using Content.Shared.Chemistry.Components;
using Content.Shared.Clothing;
Expand All @@ -13,7 +13,7 @@ public sealed class LungSystem : EntitySystem
{
[Dependency] private readonly AtmosphereSystem _atmos = default!;
[Dependency] private readonly InternalsSystem _internals = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;

public static string LungSolutionName = "Lung";
Expand Down Expand Up @@ -50,9 +50,11 @@ private void OnGotEquipped(Entity<BreathToolComponent> ent, ref GotEquippedEvent

private void OnComponentInit(Entity<LungComponent> entity, ref ComponentInit args)
{
var solution = _solutionContainerSystem.EnsureSolution(entity.Owner, entity.Comp.SolutionName);
solution.MaxVolume = 100.0f;
solution.CanReact = false; // No dexalin lungs
if (_solutionContainerSystem.EnsureSolution(entity.Owner, entity.Comp.SolutionName, out var solution))
{
solution.MaxVolume = 100.0f;
solution.CanReact = false; // No dexalin lungs
}
}

private void OnMaskToggled(Entity<BreathToolComponent> ent, ref ItemMaskToggledEvent args)
Expand Down
8 changes: 4 additions & 4 deletions Content.Server/Body/Systems/MetabolizerSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Content.Server.Body.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Administration.Logs;
using Content.Shared.Body.Organ;
using Content.Shared.Chemistry.Components;
Expand All @@ -24,7 +24,7 @@ public sealed class MetabolizerSystem : EntitySystem
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;

private EntityQuery<OrganComponent> _organQuery;
private EntityQuery<SolutionContainerManagerComponent> _solutionQuery;
Expand Down Expand Up @@ -56,11 +56,11 @@ private void OnMetabolizerInit(Entity<MetabolizerComponent> entity, ref Componen
{
if (!entity.Comp.SolutionOnBody)
{
_solutionContainerSystem.EnsureSolution(entity.Owner, entity.Comp.SolutionName);
_solutionContainerSystem.EnsureSolution(entity.Owner, entity.Comp.SolutionName, out _);
}
else if (_organQuery.CompOrNull(entity)?.Body is { } body)
{
_solutionContainerSystem.EnsureSolution(body, entity.Comp.SolutionName);
_solutionContainerSystem.EnsureSolution(body, entity.Comp.SolutionName, out _);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Body/Systems/RespiratorSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Components;
using Content.Server.Chat.Systems;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.EntityEffects.EffectConditions;
using Content.Server.EntityEffects.Effects;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Alert;
using Content.Shared.Atmos;
using Content.Shared.Body.Components;
Expand Down Expand Up @@ -33,7 +33,7 @@ public sealed class RespiratorSystem : EntitySystem
[Dependency] private readonly LungSystem _lungSystem = default!;
[Dependency] private readonly MobStateSystem _mobState = default!;
[Dependency] private readonly IPrototypeManager _protoMan = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly ChatSystem _chat = default!;

private static readonly ProtoId<MetabolismGroupPrototype> GasId = new("Gas");
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Body/Systems/StomachSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Content.Server.Body.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Body.Organ;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
Expand All @@ -11,7 +11,7 @@ namespace Content.Server.Body.Systems
public sealed class StomachSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;

public const string DefaultSolutionName = "stomach";

Expand Down
6 changes: 5 additions & 1 deletion Content.Server/Botany/Systems/BotanySystem.Produce.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ public void ProduceGrown(EntityUid uid, ProduceComponent produce)
if (!TryGetSeed(produce, out var seed))
return;

var solutionContainer = _solutionContainerSystem.EnsureSolution(uid, produce.SolutionName, FixedPoint2.Zero, out _);
if (!_solutionContainerSystem.EnsureSolution(uid,
produce.SolutionName,
out var solutionContainer,
FixedPoint2.Zero))
return;

solutionContainer.RemoveAllSolution();
foreach (var (chem, quantity) in seed.Chemicals)
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Botany/Systems/BotanySystem.Seed.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Content.Server.Botany.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.Kitchen.Components;
using Content.Server.Popups;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Botany;
using Content.Shared.Examine;
using Content.Shared.Hands.EntitySystems;
Expand Down Expand Up @@ -31,7 +31,7 @@ public sealed partial class BotanySystem : EntitySystem
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly SharedPointLightSystem _light = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly FixtureSystem _fixtureSystem = default!;
[Dependency] private readonly CollisionWakeSystem _colWakeSystem = default!;
Expand Down
Loading

0 comments on commit ef1fadf

Please sign in to comment.