From c2bbc01ff20c651d6000465cb204b721d1267a05 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> Date: Tue, 18 Jan 2022 07:35:17 +0100 Subject: [PATCH] Smokables can now expose temperature to the atmosphere, causing fires. (#6142) Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> --- .../Nutrition/Components/SmokableComponent.cs | 6 ++++++ .../Nutrition/EntitySystems/SmokingSystem.cs | 12 ++++++++++-- .../Consumable/Smokeables/base_smokeables.yml | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Content.Server/Nutrition/Components/SmokableComponent.cs b/Content.Server/Nutrition/Components/SmokableComponent.cs index 34233c6d5f..bd54e7f7cc 100644 --- a/Content.Server/Nutrition/Components/SmokableComponent.cs +++ b/Content.Server/Nutrition/Components/SmokableComponent.cs @@ -25,6 +25,12 @@ namespace Content.Server.Nutrition.Components [DataField("state")] public SmokableState State { get; set; } = SmokableState.Unlit; + [DataField("exposeTemperature")] + public float ExposeTemperature { get; set; } = 0; + + [DataField("exposeVolume")] + public float ExposeVolume { get; set; } = 1f; + // clothing prefixes [DataField("burntPrefix")] public string BurntPrefix = "unlit"; diff --git a/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs b/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs index 6dc811e0bc..c9ba7d6724 100644 --- a/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using Content.Server.Atmos.EntitySystems; using Content.Server.Body.Components; using Content.Server.Body.Systems; using Content.Server.Chemistry.EntitySystems; @@ -21,6 +22,7 @@ namespace Content.Server.Nutrition.EntitySystems [Dependency] private readonly ReactiveSystem _reactiveSystem = default!; [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!; + [Dependency] private readonly AtmosphereSystem _atmos = default!; private const float UpdateTimer = 3f; @@ -80,7 +82,7 @@ namespace Content.Server.Nutrition.EntitySystems foreach (var uid in _active.ToArray()) { - if (!EntityManager.TryGetComponent(uid, out SmokableComponent? smokable)) + if (!TryComp(uid, out SmokableComponent? smokable)) { _active.Remove(uid); continue; @@ -92,6 +94,12 @@ namespace Content.Server.Nutrition.EntitySystems continue; } + if (smokable.ExposeTemperature > 0 && smokable.ExposeVolume > 0) + { + var transform = Transform(uid); + _atmos.HotspotExpose(transform.Coordinates, smokable.ExposeTemperature, smokable.ExposeVolume, true); + } + var inhaledSolution = _solutionContainerSystem.SplitSolution(uid, solution, smokable.InhaleAmount * _timer); if (solution.TotalVolume == FixedPoint2.Zero) @@ -105,7 +113,7 @@ namespace Content.Server.Nutrition.EntitySystems // 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) || - !EntityManager.TryGetComponent(containerManager.Owner, out BloodstreamComponent? bloodstream)) + !TryComp(containerManager.Owner, out BloodstreamComponent? bloodstream)) continue; _reactiveSystem.ReactionEntity(containerManager.Owner, ReactionMethod.Ingestion, inhaledSolution); diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/base_smokeables.yml b/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/base_smokeables.yml index afdd6a7b7a..80c7d027de 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/base_smokeables.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/base_smokeables.yml @@ -20,6 +20,8 @@ id: BaseCigar abstract: true components: + - type: Smokable + exposeTemperature: 1173.15 - type: Cigar - type: InjectableSolution solution: smokable