diff --git a/Content.Server/_CP14/Chemistry/SmokeBomb/CP14SmokeBombComponent.cs b/Content.Server/_CP14/Chemistry/SmokeBomb/CP14SmokeBombComponent.cs new file mode 100644 index 0000000000..07922d38a1 --- /dev/null +++ b/Content.Server/_CP14/Chemistry/SmokeBomb/CP14SmokeBombComponent.cs @@ -0,0 +1,24 @@ +using Content.Shared._CP14.MagicSpell; +using Robust.Shared.Audio; +using Robust.Shared.Prototypes; + +namespace Content.Server._CP14.Chemistry.SmokeBomb; + +/// +/// A smoke bomb that creates a cloud of smoke when it lands +/// +[RegisterComponent, Access(typeof(CP14SharedMagicSystem))] +public sealed partial class CP14SmokeBombComponent : Component +{ + [DataField] + public string Solution = "bomb"; + + [DataField] + public EntProtoId SmokeProto = "CP14Mist"; + + [DataField] + public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Effects/smoke.ogg"); + + [DataField] + public float Duration = 10; +} diff --git a/Content.Server/_CP14/Chemistry/SmokeBomb/CP14SmokeBombSystem.cs b/Content.Server/_CP14/Chemistry/SmokeBomb/CP14SmokeBombSystem.cs new file mode 100644 index 0000000000..cbab9055b0 --- /dev/null +++ b/Content.Server/_CP14/Chemistry/SmokeBomb/CP14SmokeBombSystem.cs @@ -0,0 +1,41 @@ +using Content.Server.Destructible; +using Content.Server.Fluids.EntitySystems; +using Content.Shared.Chemistry.Components.SolutionManager; +using Content.Shared.Chemistry.EntitySystems; +using Content.Shared.Throwing; +using Robust.Shared.Audio.Systems; + +namespace Content.Server._CP14.Chemistry.SmokeBomb; + +public partial class CP14SmokeBombSystem : EntitySystem +{ + [Dependency] private readonly SmokeSystem _smoke = default!; + [Dependency] private readonly SharedSolutionContainerSystem _solution = default!; + [Dependency] private readonly SharedAudioSystem _audio = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnLand, before: [typeof(DestructibleSystem)]); + } + + private void OnLand(Entity ent, ref LandEvent args) + { + if (!TryComp(ent, out var solutionManager)) + return; + + if (!_solution.TryGetSolution((ent, solutionManager), ent.Comp.Solution, out var solution)) + return; + + var position = Transform(ent).Coordinates; + var spreadAmount = (int) solution.Value.Comp.Solution.Volume; + + if (spreadAmount <= 0) + return; + + var smokeEnt = SpawnAtPosition(ent.Comp.SmokeProto, Transform(ent).Coordinates); + _smoke.StartSmoke(smokeEnt, solution.Value.Comp.Solution, ent.Comp.Duration, spreadAmount); + _audio.PlayPvs(ent.Comp.Sound, position); + } +} diff --git a/Content.Shared/_CP14/MagicEssence/CP14MagicEssenceSystem.cs b/Content.Shared/_CP14/MagicEssence/CP14MagicEssenceSystem.cs index d41594302e..256c3814f3 100644 --- a/Content.Shared/_CP14/MagicEssence/CP14MagicEssenceSystem.cs +++ b/Content.Shared/_CP14/MagicEssence/CP14MagicEssenceSystem.cs @@ -54,7 +54,7 @@ public partial class CP14MagicEssenceSystem : EntitySystem private void OnCollectorCollide(Entity ent, ref StartCollideEvent args) { - if (!Transform(ent).Anchored) + if (TryComp(ent, out var energySlot) && !energySlot.Powered) return; if (!TryComp(args.OtherEntity, out var essenceComp)) diff --git a/Resources/Prototypes/_CP14/Entities/Objects/Specific/Alchemy/vial_bomb.yml b/Resources/Prototypes/_CP14/Entities/Objects/Specific/Alchemy/vial_bomb.yml new file mode 100644 index 0000000000..4816593da4 --- /dev/null +++ b/Resources/Prototypes/_CP14/Entities/Objects/Specific/Alchemy/vial_bomb.yml @@ -0,0 +1,20 @@ +- type: entity + id: CP14BaseAlchemyBomb + parent: CP14VialSmall + categories: [ ForkFiltered ] + name: alchemical bomb + description: A vial of liquid that explodes with an alchemical reagent cloud when thrown. + components: + - type: CP14SmokeBomb + solution: vial + - type: Sprite + noRot: false + layers: + - state: vial + - state: liq-1 + map: ["enum.SolutionContainerLayers.Fill"] + visible: false + - state: bomb + - state: label + visible: false + map: ["enum.PaperLabelVisuals.Layer"] \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/Entities/Structures/Specific/Thaumaturgy/essence_collector.yml b/Resources/Prototypes/_CP14/Entities/Structures/Specific/Thaumaturgy/essence_collector.yml index b4367d6635..bc514c8bc9 100644 --- a/Resources/Prototypes/_CP14/Entities/Structures/Specific/Thaumaturgy/essence_collector.yml +++ b/Resources/Prototypes/_CP14/Entities/Structures/Specific/Thaumaturgy/essence_collector.yml @@ -7,10 +7,6 @@ description: Being powered by the energy crystal, it will start sucking in all the essence floating in the air and converting it into useful liquid. categories: [ ForkFiltered ] components: - - type: Physics - bodyType: Static - - type: Transform - anchored: true - type: InteractionOutline - type: Sprite drawdepth: Mobs @@ -43,14 +39,11 @@ - type: Fixtures fixtures: fix1: - hard: false shape: !type:PhysShapeAabb bounds: "-0.25,-0.25,0.25,0.25" density: 525 mask: - - TabletopMachineMask - layer: - WallLayer - type: SolutionContainerManager solutions: @@ -81,6 +74,6 @@ maxFillLevels: 7 fillBaseName: liq- - type: CP14MagicEnergyDraw - energy: -0.2 + energy: -0.15 delay: 1 - type: CP14MagicEssenceCollector \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/Recipes/Workbench/furnace.yml b/Resources/Prototypes/_CP14/Recipes/Workbench/furnace.yml index c15871bcf0..844de2db2e 100644 --- a/Resources/Prototypes/_CP14/Recipes/Workbench/furnace.yml +++ b/Resources/Prototypes/_CP14/Recipes/Workbench/furnace.yml @@ -149,4 +149,21 @@ - !type:KnowledgeRequired knowledge: Glasswork result: CP14VialMediumReinforced + +- type: CP14Recipe + id: CP14BaseAlchemyBomb + tag: CP14RecipeMeltingFurnace + craftTime: 4 + requirements: + - !type:StackResource + stack: CP14GlassSheet + count: 3 + - !type:StackResource + stack: CP14GoldBar + count: 1 + - !type:KnowledgeRequired + knowledge: Glasswork + - !type:KnowledgeRequired + knowledge: MetallMelting + result: CP14BaseAlchemyBomb \ No newline at end of file diff --git a/Resources/Textures/_CP14/Objects/Specific/Alchemy/vial_small.rsi/bomb.png b/Resources/Textures/_CP14/Objects/Specific/Alchemy/vial_small.rsi/bomb.png new file mode 100644 index 0000000000..2f124c3bc1 Binary files /dev/null and b/Resources/Textures/_CP14/Objects/Specific/Alchemy/vial_small.rsi/bomb.png differ diff --git a/Resources/Textures/_CP14/Objects/Specific/Alchemy/vial_small.rsi/meta.json b/Resources/Textures/_CP14/Objects/Specific/Alchemy/vial_small.rsi/meta.json index 974cbd3c0f..2cf19aab61 100644 --- a/Resources/Textures/_CP14/Objects/Specific/Alchemy/vial_small.rsi/meta.json +++ b/Resources/Textures/_CP14/Objects/Specific/Alchemy/vial_small.rsi/meta.json @@ -10,6 +10,9 @@ { "name": "vial" }, + { + "name": "bomb" + }, { "name": "label" },