--- /dev/null
+namespace Content.Server.IgnitionSource;
+
+/// <summary>
+/// Raised in order to toggle the ignitionSourceComponent on an entity on or off
+/// </summary>
+[ByRefEvent]
+public readonly record struct IgnitionEvent(bool Ignite = false);
SubscribeLocalEvent<IgnitionSourceComponent, IsHotEvent>(OnIsHot);
SubscribeLocalEvent<ItemToggleHotComponent, ItemToggledEvent>(OnItemToggle);
+ SubscribeLocalEvent<IgnitionSourceComponent, IgnitionEvent>(OnIgnitionEvent);
}
private void OnIsHot(Entity<IgnitionSourceComponent> ent, ref IsHotEvent args)
{
- SetIgnited((ent.Owner, ent.Comp), args.IsHot);
+ args.IsHot = ent.Comp.Ignited;
}
+
private void OnItemToggle(Entity<ItemToggleHotComponent> ent, ref ItemToggledEvent args)
{
if (TryComp<IgnitionSourceComponent>(ent, out var comp))
SetIgnited((ent.Owner, comp), args.Activated);
}
+ private void OnIgnitionEvent(Entity<IgnitionSourceComponent> ent, ref IgnitionEvent args)
+ {
+ SetIgnited((ent.Owner, ent.Comp), args.Ignite);
+ }
+
/// <summary>
/// Simply sets the ignited field to the ignited param.
/// </summary>
+using Content.Server.IgnitionSource;
using Content.Server.Light.Components;
using Content.Shared.Clothing.Components;
using Content.Shared.Clothing.EntitySystems;
_item.SetHeldPrefix(ent, "lit", component: item);
}
- var isHotEvent = new IsHotEvent() {IsHot = true};
- RaiseLocalEvent(ent, isHotEvent);
+ var ignite = new IgnitionEvent(true);
+ RaiseLocalEvent(ent, ref ignite);
component.CurrentState = ExpendableLightState.Lit;
component.StateExpiryTime = component.GlowDuration;
case ExpendableLightState.Dead:
_appearance.SetData(ent, ExpendableLightVisuals.Behavior, string.Empty, appearance);
- var isHotEvent = new IsHotEvent() {IsHot = true};
- RaiseLocalEvent(ent, isHotEvent);
+ var ignite = new IgnitionEvent(false);
+ RaiseLocalEvent(ent, ref ignite);
break;
}
}
loop: true
volume: -10
maxDistance: 5
-
- type: Sprite
sprite: Objects/Misc/flare.rsi
layers: