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);

View File

@@ -0,0 +1,64 @@
- type: entity
id: CP14SmokingPipe
parent: BaseSmokingPipe
name: pipe
description: A comfortable and practical smoking pipe, the latest fashion in the Empire.
categories: [ ForkFiltered ]
components:
- type: Sprite
sprite: _CP14/Objects/Consumable/Smokeables/Pipes/pipe.rsi
state: unlit-icon
- type: Clothing
sprite: _CP14/Objects/Consumable/Smokeables/Pipes/pipe.rsi
slots: [ mask ]
equippedPrefix: unlit
- type: Item
size: Tiny
sprite: _CP14/Objects/Consumable/Smokeables/Pipes/pipe.rsi
- type: Appearance
- type: BurnStateVisuals
unlitIcon: unlit-icon
- type: entity
id: CP14SmokingPipeFilledTobacco
parent: CP14SmokingPipe
suffix: Tobacco
categories: [ ForkFiltered ]
components:
- type: ContainerContainer
containers:
bowl_slot: !type:ContainerSlot
- type: ItemSlots
- type: SmokingPipe
bowl_slot:
name: smoking-pipe-slot-component-slot-name-bowl
startingItem: CP14GroundTobacco
whitelist:
tags:
- Smokable
insertSound:
path: /Audio/Weapons/Guns/Empty/empty.ogg
ejectSound:
path: /Audio/Weapons/Guns/Empty/empty.ogg
- type: entity
id: CP14SmokingPipeFilledSage
parent: CP14SmokingPipe
suffix: Sage
categories: [ ForkFiltered ]
components:
- type: ContainerContainer
containers:
bowl_slot: !type:ContainerSlot
- type: ItemSlots
- type: SmokingPipe
bowl_slot:
name: smoking-pipe-slot-component-slot-name-bowl
startingItem: CP14GroundSage
whitelist:
tags:
- Smokable
insertSound:
path: /Audio/Weapons/Guns/Empty/empty.ogg
ejectSound:
path: /Audio/Weapons/Guns/Empty/empty.ogg

View File

@@ -0,0 +1,45 @@
- type: entity
name: ground tobacco
parent: BaseItem
id: CP14GroundTobacco
description: Grinded and dried tabac leaves, some like it is a cur.
categories: [ ForkFiltered ]
components:
- type: Item
size: Tiny
- type: SolutionContainerManager
solutions:
food:
reagents:
- ReagentId: Nicotine
Quantity: 10
- type: Sprite
sprite: _CP14/Objects/Misc/reagent_fillings.rsi
state: tobacco_small
- type: Tag
tags:
- Smokable
- type: entity
name: ground sage
parent: BaseItem
id: CP14GroundSage
description: Ground and dried sage root as it turns out is an excellent substitute for tobacco.
categories: [ ForkFiltered ]
components:
- type: Item
size: Tiny
- type: SolutionContainerManager
solutions:
food:
reagents:
- ReagentId: THC
Quantity: 8
- ReagentId: Happiness
Quantity: 2
- type: Sprite
sprite: _CP14/Objects/Misc/reagent_fillings.rsi
state: sage_powder
- type: Tag
tags:
- Smokable

View File

@@ -94,5 +94,6 @@
- type: entity
parent: CP14Torch
id: CP14TorchIgnited
suffix: Ignited
components:
- type: CP14AutoIgnite
- type: CP14AutoIgnite

View File

@@ -497,6 +497,12 @@
back:
- CP14Torch
- type: loadout
id: CP14Pipe
storage:
back:
- CP14SmokingPipeFilledTobacco
- type: loadout
id: CP14LyraInstrument
storage:

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

View File

@@ -0,0 +1,68 @@
{
"version": 1,
"license": "All right reserved",
"copyright": "Created by Max Gab",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "unlit-equipped-MASK",
"directions": 4
},
{
"name": "lit-equipped-MASK",
"directions": 4,
"delays": [
[
0.1,
0.1,
0.1,
0.1
],
[
0.1,
0.1,
0.1,
0.1
],
[
0.1,
0.1,
0.1,
0.1
],
[
0.1,
0.1,
0.1,
0.1
]
]
},
{
"name": "burnt-icon"
},
{
"name": "unlit-icon"
},
{
"name": "lit-icon",
"delays": [
[
0.1,
0.1
]
]
},
{
"name": "inhand-left",
"directions": 4
},
{
"name": "inhand-right",
"directions": 4
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

View File

@@ -0,0 +1,17 @@
{
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "All right reserved",
"copyright": "Created by Prazat",
"states": [
{
"name": "tobacco_small"
},
{
"name": "sage_powder"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B