Alchemical bomb (#965)
* smoke bomb system * collector fixes * bomb integration * fix * tweak
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using Content.Shared._CP14.MagicSpell;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server._CP14.Chemistry.SmokeBomb;
|
||||
|
||||
/// <summary>
|
||||
/// A smoke bomb that creates a cloud of smoke when it lands
|
||||
/// </summary>
|
||||
[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;
|
||||
}
|
||||
@@ -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<CP14SmokeBombComponent, LandEvent>(OnLand, before: [typeof(DestructibleSystem)]);
|
||||
}
|
||||
|
||||
private void OnLand(Entity<CP14SmokeBombComponent> ent, ref LandEvent args)
|
||||
{
|
||||
if (!TryComp<SolutionContainerManagerComponent>(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);
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public partial class CP14MagicEssenceSystem : EntitySystem
|
||||
|
||||
private void OnCollectorCollide(Entity<CP14MagicEssenceCollectorComponent> ent, ref StartCollideEvent args)
|
||||
{
|
||||
if (!Transform(ent).Anchored)
|
||||
if (TryComp<CP14MagicEnergyCrystalSlotComponent>(ent, out var energySlot) && !energySlot.Powered)
|
||||
return;
|
||||
|
||||
if (!TryComp<CP14MagicEssenceComponent>(args.OtherEntity, out var essenceComp))
|
||||
|
||||
@@ -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"]
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 310 B |
@@ -10,6 +10,9 @@
|
||||
{
|
||||
"name": "vial"
|
||||
},
|
||||
{
|
||||
"name": "bomb"
|
||||
},
|
||||
{
|
||||
"name": "label"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user