* Fire extinguishers now put out candles This did not actually require any changes to flammable or extinguishers directly, the only necessary changes were to make the collision actually work. Vapor entities (also used for fire extinguishers) now have a collision layer, so they can hit items. Added a new FlammableSetCollisionWake component to actually enable collision on candles while they are lit, because otherwise CollisionWake on entities gets in the way too. * Extinguishing items is now relayed to held/worn items This means held candles get extinguished too. Involved moving the core logic of ExtinguishReaction into an event so that it can be relayed via the existing hand/inventory relay logic. * Add helper functions for subscribing to relayed events. Use these in FlammableSystem * Make extinguishers work on cigarettes too A bunch of renaming to make the rest of my code work with SmokableComponent --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using Content.Shared.Atmos;
|
|
using Content.Shared.EntityEffects;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Server.EntityEffects.Effects
|
|
{
|
|
[UsedImplicitly]
|
|
public sealed partial class ExtinguishReaction : EntityEffect
|
|
{
|
|
/// <summary>
|
|
/// Amount of firestacks reduced.
|
|
/// </summary>
|
|
[DataField]
|
|
public float FireStacksAdjustment = -1.5f;
|
|
|
|
protected override string? ReagentEffectGuidebookText(IPrototypeManager prototype, IEntitySystemManager entSys)
|
|
=> Loc.GetString("reagent-effect-guidebook-extinguish-reaction", ("chance", Probability));
|
|
|
|
public override void Effect(EntityEffectBaseArgs args)
|
|
{
|
|
var ev = new ExtinguishEvent
|
|
{
|
|
FireStacksAdjustment = FireStacksAdjustment,
|
|
};
|
|
|
|
if (args is EntityEffectReagentArgs reagentArgs)
|
|
{
|
|
ev.FireStacksAdjustment *= (float)reagentArgs.Quantity;
|
|
}
|
|
|
|
args.EntityManager.EventBus.RaiseLocalEvent(args.TargetEntity, ref ev);
|
|
}
|
|
}
|
|
}
|