Smoking pipe new (#823)

* pipe

* fix delayed smoke ignition

* sage

---------

Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
Co-authored-by: Ed <edwardxperia2000@gmail.com>
This commit is contained in:
Nim
2025-02-05 16:44:34 +02:00
committed by GitHub
parent 5e80f98242
commit bf46e6b5e8
17 changed files with 226 additions and 4 deletions

View File

@@ -74,7 +74,7 @@ namespace Content.Server.Nutrition.EntitySystems
}
// Convert smokable item into reagents to be smoked
private bool TryTransferReagents(Entity<SmokingPipeComponent> entity, Entity<SmokableComponent> smokable)
public bool TryTransferReagents(Entity<SmokingPipeComponent> entity, Entity<SmokableComponent> smokable) //CP14 make it public
{
if (entity.Comp.BowlSlot.Item == null)
return false;

View File

@@ -2,10 +2,12 @@ using System.Linq;
using System.Numerics;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.DoAfter;
using Content.Server.Nutrition.Components;
using Content.Server.Nutrition.EntitySystems;
using Content.Shared._CP14.Temperature;
using Content.Shared.Interaction;
using Content.Shared.Maps;
using Content.Shared.Nutrition.Components;
using Content.Shared.Smoking;
using Content.Shared.Weapons.Melee.Events;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
@@ -25,6 +27,7 @@ public sealed partial class CP14FireSpreadSystem : CP14SharedFireSpreadSystem
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
[Dependency] private readonly TileSystem _tile = default!;
[Dependency] private readonly ITileDefinitionManager _tileDef = default!;
[Dependency] private readonly SmokingSystem _smoking = default!;
private readonly EntProtoId _fireProto = "CP14Fire";
@@ -35,6 +38,8 @@ public sealed partial class CP14FireSpreadSystem : CP14SharedFireSpreadSystem
base.Initialize();
SubscribeLocalEvent<FlammableComponent, CP14IgnitionDoAfter>(OnFlammableIgnited);
SubscribeLocalEvent<SmokableComponent, CP14IgnitionDoAfter>(OnDelayedIgnite);
SubscribeLocalEvent<SmokingPipeComponent, CP14IgnitionDoAfter>(OnDelayedPipeIgnite);
SubscribeLocalEvent<CP14FlammableBonusDamageComponent, MeleeHitEvent>(OnFlammableMeleeHit);
}
@@ -59,6 +64,22 @@ public sealed partial class CP14FireSpreadSystem : CP14SharedFireSpreadSystem
args.Handled = true;
}
//For smokable cigars
private void OnDelayedIgnite(Entity<SmokableComponent> ent, ref CP14IgnitionDoAfter args)
{
_smoking.SetSmokableState(ent, SmokableState.Lit, ent.Comp);
}
//For smokable pipes
private void OnDelayedPipeIgnite(Entity<SmokingPipeComponent> pipe, ref CP14IgnitionDoAfter args)
{
if (!TryComp<SmokableComponent>(pipe, out var smokable))
return;
if (_smoking.TryTransferReagents(pipe, (pipe.Owner, smokable)))
_smoking.SetSmokableState(pipe, SmokableState.Lit, smokable);
}
public override void Update(float frameTime)
{
base.Update(frameTime);