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:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user