diff --git a/Content.Server/Chemistry/ReagentEntityReactions/AddToSolutionReaction.cs b/Content.Server/Chemistry/ReagentEntityReactions/AddToSolutionReaction.cs index 6ae5f56dc3..ad48f5a26c 100644 --- a/Content.Server/Chemistry/ReagentEntityReactions/AddToSolutionReaction.cs +++ b/Content.Server/Chemistry/ReagentEntityReactions/AddToSolutionReaction.cs @@ -20,15 +20,15 @@ namespace Content.Server.Chemistry.ReagentEntityReactions // ReSharper disable once CollectionNeverUpdated.Local private readonly HashSet _reagents = new(); - protected override void React(IEntity entity, ReagentPrototype reagent, FixedPoint2 volume, Solution? source) + protected override void React(EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Solution? source, IEntityManager entityManager) { // TODO see if this is correct if (!EntitySystem.Get() - .TryGetSolution(entity.Uid, _solution, out var solutionContainer) + .TryGetSolution(uid, _solution, out var solutionContainer) || (_reagents.Count > 0 && !_reagents.Contains(reagent.ID))) return; if (EntitySystem.Get() - .TryAddReagent(entity.Uid, solutionContainer, reagent.ID, volume, out var accepted)) + .TryAddReagent(uid, solutionContainer, reagent.ID, volume, out var accepted)) source?.RemoveReagent(reagent.ID, accepted); } } diff --git a/Content.Server/Chemistry/ReagentEntityReactions/ExtinguishReaction.cs b/Content.Server/Chemistry/ReagentEntityReactions/ExtinguishReaction.cs index b252f9abd8..00c5fa455c 100644 --- a/Content.Server/Chemistry/ReagentEntityReactions/ExtinguishReaction.cs +++ b/Content.Server/Chemistry/ReagentEntityReactions/ExtinguishReaction.cs @@ -18,13 +18,13 @@ namespace Content.Server.Chemistry.ReagentEntityReactions // ReSharper disable once CollectionNeverUpdated.Local private readonly HashSet _reagents = new (); - protected override void React(IEntity entity, ReagentPrototype reagent, FixedPoint2 volume, Solution? source) + protected override void React(EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Solution? source, IEntityManager entityManager) { - if (!entity.TryGetComponent(out FlammableComponent? flammable) || !_reagents.Contains(reagent.ID)) return; + if (!entityManager.TryGetComponent(uid, out FlammableComponent? flammable) || !_reagents.Contains(reagent.ID)) return; var flammableSystem = EntitySystem.Get(); - flammableSystem.Extinguish(entity.Uid, flammable); - flammableSystem.AdjustFireStacks(entity.Uid, -1.5f, flammable); + flammableSystem.Extinguish(uid, flammable); + flammableSystem.AdjustFireStacks(uid, -1.5f, flammable); } } } diff --git a/Content.Server/Chemistry/ReagentEntityReactions/FlammableReaction.cs b/Content.Server/Chemistry/ReagentEntityReactions/FlammableReaction.cs index 0585f60cb8..2ec8aea1e1 100644 --- a/Content.Server/Chemistry/ReagentEntityReactions/FlammableReaction.cs +++ b/Content.Server/Chemistry/ReagentEntityReactions/FlammableReaction.cs @@ -18,11 +18,11 @@ namespace Content.Server.Chemistry.ReagentEntityReactions // ReSharper disable once CollectionNeverUpdated.Local private readonly HashSet _reagents = new (); - protected override void React(IEntity entity, ReagentPrototype reagent, FixedPoint2 volume, Solution? source) + protected override void React(EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Solution? source, IEntityManager entityManager) { - if (!entity.TryGetComponent(out FlammableComponent? flammable) || !_reagents.Contains(reagent.ID)) return; + if (!entityManager.TryGetComponent(uid, out FlammableComponent? flammable) || !_reagents.Contains(reagent.ID)) return; - EntitySystem.Get().AdjustFireStacks(entity.Uid, volume.Float() / 10f, flammable); + EntitySystem.Get().AdjustFireStacks(uid, volume.Float() / 10f, flammable); source?.RemoveReagent(reagent.ID, volume); } } diff --git a/Content.Server/Chemistry/ReagentEntityReactions/WashCreamPieReaction.cs b/Content.Server/Chemistry/ReagentEntityReactions/WashCreamPieReaction.cs index 36e62a1105..1c6420e492 100644 --- a/Content.Server/Chemistry/ReagentEntityReactions/WashCreamPieReaction.cs +++ b/Content.Server/Chemistry/ReagentEntityReactions/WashCreamPieReaction.cs @@ -18,11 +18,11 @@ namespace Content.Server.Chemistry.ReagentEntityReactions // ReSharper disable once CollectionNeverUpdated.Local private readonly HashSet _reagents = new (); - protected override void React(IEntity entity, ReagentPrototype reagent, FixedPoint2 volume, Solution? source) + protected override void React(EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Solution? source, IEntityManager entityManager) { - if (!entity.TryGetComponent(out CreamPiedComponent? creamPied) || !_reagents.Contains(reagent.ID)) return; + if (!entityManager.TryGetComponent(uid, out CreamPiedComponent? creamPied) || !_reagents.Contains(reagent.ID)) return; - EntitySystem.Get().SetCreamPied(entity.Uid, creamPied, false); + EntitySystem.Get().SetCreamPied(uid, creamPied, false); } } } diff --git a/Content.Shared/Chemistry/ChemistrySystem.cs b/Content.Shared/Chemistry/ChemistrySystem.cs index 65c6dd8093..12373135e2 100644 --- a/Content.Shared/Chemistry/ChemistrySystem.cs +++ b/Content.Shared/Chemistry/ChemistrySystem.cs @@ -37,7 +37,7 @@ namespace Content.Shared.Chemistry foreach (var reaction in reactive.Reactions) { // If we have a source solution, use the reagent quantity we have left. Otherwise, use the reaction volume specified. - reaction.React(method, entity, reagent, source?.GetReagentQuantity(reagent.ID) ?? reactVolume, source); + reaction.React(method, entity.Uid, reagent, source?.GetReagentQuantity(reagent.ID) ?? reactVolume, source, EntityManager); // Make sure we still have enough reagent to go... if (source != null && !source.ContainsReagent(reagent.ID)) diff --git a/Content.Shared/Chemistry/Reagent/ReagentEntityReaction.cs b/Content.Shared/Chemistry/Reagent/ReagentEntityReaction.cs index ac7686abf6..6f2587ce99 100644 --- a/Content.Shared/Chemistry/Reagent/ReagentEntityReaction.cs +++ b/Content.Shared/Chemistry/Reagent/ReagentEntityReaction.cs @@ -28,7 +28,7 @@ namespace Content.Shared.Chemistry.Reagent [DataField("ingestion")] public bool Ingestion { get; } = false; - public void React(ReactionMethod method, IEntity entity, ReagentPrototype reagent, FixedPoint2 volume, Components.Solution? source) + public void React(ReactionMethod method, EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Components.Solution? source, IEntityManager entityManager) { switch (method) { @@ -48,9 +48,9 @@ namespace Content.Shared.Chemistry.Reagent throw new ArgumentOutOfRangeException(nameof(method), method, null); } - React(entity, reagent, volume, source); + React(uid, reagent, volume, source, entityManager); } - protected abstract void React(IEntity entity, ReagentPrototype reagent, FixedPoint2 volume, Components.Solution? source); + protected abstract void React(EntityUid uid, ReagentPrototype reagent, FixedPoint2 volume, Components.Solution? source, IEntityManager entityManager); } }