Solution rejig (#12428)

This commit is contained in:
Leon Friedrich
2023-01-12 16:41:40 +13:00
committed by GitHub
parent 38504f6412
commit 466384b081
61 changed files with 873 additions and 619 deletions

View File

@@ -1,4 +1,4 @@
using Content.Server.Body.Components;
using Content.Server.Body.Components;
using Content.Server.Body.Systems;
using Content.Server.Chemistry.EntitySystems;
using Content.Shared.Administration.Logs;
@@ -7,6 +7,7 @@ using Content.Shared.Chemistry.Reagent;
using Content.Shared.Database;
using Content.Shared.FixedPoint;
using Content.Shared.Smoking;
using Robust.Shared.Prototypes;
namespace Content.Server.Chemistry.Components
{
@@ -15,6 +16,7 @@ namespace Content.Server.Chemistry.Components
public sealed class SmokeSolutionAreaEffectComponent : SolutionAreaEffectComponent
{
[Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
public new const string SolutionName = "solutionArea";
@@ -24,7 +26,7 @@ namespace Content.Server.Chemistry.Components
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance) &&
EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution))
{
appearance.SetData(SmokeVisuals.Color, solution.Color);
appearance.SetData(SmokeVisuals.Color, solution.GetColor(_proto));
}
}
@@ -42,7 +44,7 @@ namespace Content.Server.Chemistry.Components
var chemistry = EntitySystem.Get<ReactiveSystem>();
var cloneSolution = solution.Clone();
var transferAmount = FixedPoint2.Min(cloneSolution.TotalVolume * solutionFraction, bloodstream.ChemicalSolution.AvailableVolume);
var transferAmount = FixedPoint2.Min(cloneSolution.Volume * solutionFraction, bloodstream.ChemicalSolution.AvailableVolume);
var transferSolution = cloneSolution.SplitSolution(transferAmount);
foreach (var reagentQuantity in transferSolution.Contents.ToArray())