Fire extinguishers can now extinguish items, including when held/worn (#36267)
* 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>
This commit is contained in:
committed by
GitHub
parent
d0b4f4744c
commit
843d79be5f
@@ -23,6 +23,7 @@ using Content.Shared.Timing;
|
||||
using Content.Shared.Toggleable;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Hands;
|
||||
using Robust.Server.Audio;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Events;
|
||||
@@ -73,6 +74,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
SubscribeLocalEvent<FlammableComponent, TileFireEvent>(OnTileFire);
|
||||
SubscribeLocalEvent<FlammableComponent, RejuvenateEvent>(OnRejuvenate);
|
||||
SubscribeLocalEvent<FlammableComponent, ResistFireAlertEvent>(OnResistFireAlert);
|
||||
Subs.SubscribeWithRelay<FlammableComponent, ExtinguishEvent>(OnExtinguishEvent);
|
||||
|
||||
SubscribeLocalEvent<IgniteOnCollideComponent, StartCollideEvent>(IgniteOnCollide);
|
||||
SubscribeLocalEvent<IgniteOnCollideComponent, LandEvent>(OnIgniteLand);
|
||||
@@ -84,6 +86,14 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
SubscribeLocalEvent<IgniteOnHeatDamageComponent, DamageChangedEvent>(OnDamageChanged);
|
||||
}
|
||||
|
||||
private void OnExtinguishEvent(Entity<FlammableComponent> ent, ref ExtinguishEvent args)
|
||||
{
|
||||
// You know I'm really not sure if having AdjustFireStacks *after* Extinguish,
|
||||
// but I'm just moving this code, not questioning it.
|
||||
Extinguish(ent, ent.Comp);
|
||||
AdjustFireStacks(ent, args.FireStacksAdjustment, ent.Comp);
|
||||
}
|
||||
|
||||
private void OnMeleeHit(EntityUid uid, IgniteOnMeleeHitComponent component, MeleeHitEvent args)
|
||||
{
|
||||
foreach (var entity in args.HitEntities)
|
||||
@@ -315,6 +325,9 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
_ignitionSourceSystem.SetIgnited(uid, false);
|
||||
|
||||
var extinguished = new ExtinguishedEvent();
|
||||
RaiseLocalEvent(uid, ref extinguished);
|
||||
|
||||
UpdateAppearance(uid, flammable);
|
||||
}
|
||||
|
||||
@@ -336,6 +349,9 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
else
|
||||
_adminLogger.Add(LogType.Flammable, $"{ToPrettyString(uid):target} set on fire by {ToPrettyString(ignitionSource):actor}");
|
||||
flammable.OnFire = true;
|
||||
|
||||
var extinguished = new IgnitedEvent();
|
||||
RaiseLocalEvent(uid, ref extinguished);
|
||||
}
|
||||
|
||||
UpdateAppearance(uid, flammable);
|
||||
|
||||
Reference in New Issue
Block a user