Skip to content

Commit

Permalink
Check smokable is in mouth (#9281)
Browse files Browse the repository at this point in the history
  • Loading branch information
TekuNut authored Jun 29, 2022
1 parent 7a08f5b commit 7508227
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Content.Server/Nutrition/EntitySystems/SmokingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Content.Shared.Inventory;
using Content.Shared.Smoking;
using Content.Shared.Temperature;
using Robust.Shared.Containers;
Expand All @@ -20,6 +21,7 @@ public sealed partial class SmokingSystem : EntitySystem
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!;
[Dependency] private readonly AtmosphereSystem _atmos = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!;

private const float UpdateTimer = 3f;

Expand Down Expand Up @@ -110,8 +112,11 @@ public override void Update(float frameTime)
// This is awful. I hate this so much.
// TODO: Please, someone refactor containers and free me from this bullshit.
if (!smokable.Owner.TryGetContainerMan(out var containerManager) ||
!(_inventorySystem.TryGetSlotEntity(containerManager.Owner, "mask", out var inMaskSlotUid) && inMaskSlotUid == smokable.Owner) ||
!TryComp(containerManager.Owner, out BloodstreamComponent? bloodstream))
{
continue;
}

_reactiveSystem.ReactionEntity(containerManager.Owner, ReactionMethod.Ingestion, inhaledSolution);
_bloodstreamSystem.TryAddToChemicals(containerManager.Owner, inhaledSolution, bloodstream);
Expand Down

0 comments on commit 7508227

Please sign in to comment.