using Content.Shared.Item.ItemToggle.Components; using Content.Shared.Temperature; namespace Content.Shared.IgnitionSource; /// /// Ignites flammable gases when the ignition source is toggled on. /// Also makes the entity hot so that it can be used to ignite matchsticks, cigarettes ect. /// public abstract partial class SharedIgnitionSourceSystem : EntitySystem { public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnIsHot); SubscribeLocalEvent(OnItemToggle); SubscribeLocalEvent(OnIgnitionEvent); } private void OnIsHot(Entity ent, ref IsHotEvent args) { args.IsHot |= ent.Comp.Ignited; } private void OnItemToggle(Entity ent, ref ItemToggledEvent args) { SetIgnited(ent.Owner, args.Activated); } private void OnIgnitionEvent(Entity ent, ref IgnitionEvent args) { SetIgnited((ent.Owner, ent.Comp), args.Ignite); } /// /// Simply sets the ignited field to the ignited param. /// public void SetIgnited(Entity ent, bool ignited = true) { if (!Resolve(ent, ref ent.Comp, false)) return; ent.Comp.Ignited = ignited; Dirty(ent, ent.Comp); } }