mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* SpookyExtinguish, oooooo * comments, intensity * Use allowedIntensity in GhostSystem * commento-stuffed * GhostComponent: return to BooCount for sanity * unindento * fix ghost component, dependency order (holy shit) * More cleanup than feature at this point * Add partial to PoweredLightSystem * event field order, ghost system comments * Separate spooky, consistency w.r.t. DoGhostEvent * BooActionEvent handler to GhostSystem.Boo, fix ext * featuring kenny blankenship and vic romano * fix maximum value * Fix BooIntensity comment * remove whitespace * comments, RevenantSystem: set handled * "for a typical ghost" * Address PR suggestions * Use Handled, SpookyLight: BooIntensity->Intensity * Use Handled in BooActionEvent handler, update name * remove query * address beck-thompson's requested changes + Handled * ResponseIntensity setter, private Handled setter * Check Handled, not !Handled * there is a third * the hell was this using placement * Obsolete Extinguish, Try with Entity<T> * why wasn't this using TimeOffsetSerializer --------- Co-authored-by: iaada <iaada@users.noreply.github.com>
60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
using Content.Server.Atmos.EntitySystems;
|
|
using Content.Shared.Atmos.Components;
|
|
using Content.Shared.Trigger;
|
|
using Content.Shared.Trigger.Components.Effects;
|
|
|
|
namespace Content.Server.Trigger.Systems;
|
|
|
|
/// <summary>
|
|
/// Trigger system for adding or removing fire stacks from an entity with <see cref="FlammableComponent"/>.
|
|
/// </summary>
|
|
/// <seealso cref="IgniteOnTriggerSystem"/>
|
|
public sealed partial class FireStackOnTriggerSystem : EntitySystem
|
|
{
|
|
[Dependency] private FlammableSystem _flame = default!;
|
|
|
|
/// <inheritdoc/>
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<FireStackOnTriggerComponent, TriggerEvent>(OnTriggerFlame);
|
|
SubscribeLocalEvent<ExtinguishOnTriggerComponent, TriggerEvent>(OnTriggerExtinguish);
|
|
}
|
|
|
|
private void OnTriggerFlame(Entity<FireStackOnTriggerComponent> ent, ref TriggerEvent args)
|
|
{
|
|
if (args.Key != null && !ent.Comp.KeysIn.Contains(args.Key))
|
|
return;
|
|
|
|
var target = ent.Comp.TargetUser ? args.User : ent.Owner;
|
|
|
|
if (target == null)
|
|
return;
|
|
|
|
if (!TryComp<FlammableComponent>(target.Value, out var flammable))
|
|
return;
|
|
|
|
_flame.AdjustFireStacks(target.Value, ent.Comp.FireStacks, ignite: ent.Comp.DoIgnite, flammable: flammable);
|
|
|
|
args.Handled = true;
|
|
}
|
|
|
|
private void OnTriggerExtinguish(Entity<ExtinguishOnTriggerComponent> ent, ref TriggerEvent args)
|
|
{
|
|
if (args.Key != null && !ent.Comp.KeysIn.Contains(args.Key))
|
|
return;
|
|
|
|
var target = ent.Comp.TargetUser ? args.User : ent.Owner;
|
|
|
|
if (target == null)
|
|
return;
|
|
|
|
if (!TryComp<FlammableComponent>(target.Value, out var flammable))
|
|
return;
|
|
|
|
_flame.TryExtinguish((target.Value, flammable));
|
|
|
|
args.Handled = true;
|
|
}
|
|
}
|