--- /dev/null
+namespace Content.Client.Light.Components;
+
+/// <summary>
+/// Fades out the <see cref="SharedPointLightComponent"/> attached to this entity.
+/// </summary>
+[RegisterComponent]
+public sealed class LightFadeComponent : Component
+{
+ [ViewVariables(VVAccess.ReadWrite), DataField("duration")]
+ public float Duration = 0.5f;
+}
--- /dev/null
+using Content.Client.Light.Components;
+using Robust.Client.Animations;
+using Robust.Client.GameObjects;
+using Robust.Shared.Animations;
+
+namespace Content.Client.Light.EntitySystems;
+
+public sealed class LightFadeSystem : EntitySystem
+{
+ [Dependency] private readonly AnimationPlayerSystem _player = default!;
+
+ private const string FadeTrack = "light-fade";
+
+ public override void Initialize()
+ {
+ base.Initialize();
+ SubscribeLocalEvent<LightFadeComponent, ComponentStartup>(OnFadeStartup);
+ }
+
+ private void OnFadeStartup(EntityUid uid, LightFadeComponent component, ComponentStartup args)
+ {
+ if (!TryComp<PointLightComponent>(uid, out var light))
+ return;
+
+ var animation = new Animation()
+ {
+ Length = TimeSpan.FromSeconds(component.Duration),
+ AnimationTracks =
+ {
+ new AnimationTrackComponentProperty()
+ {
+ Property = nameof(PointLightComponent.Energy),
+ ComponentType = typeof(PointLightComponent),
+ InterpolationMode = AnimationInterpolationMode.Cubic,
+ KeyFrames =
+ {
+ new AnimationTrackProperty.KeyFrame(light.Energy, 0f),
+ new AnimationTrackProperty.KeyFrame(0f, component.Duration)
+ }
+ }
+ }
+ };
+
+ _player.Play(uid, animation, FadeTrack);
+ }
+}
"UIFragment",
"PDABorderColor",
"InventorySlots",
+ "LightFade",
};
}
}
--- /dev/null
+using Content.Server.Explosion.EntitySystems;
+using Robust.Shared.Prototypes;
+using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
+
+namespace Content.Server.Explosion.Components;
+
+[RegisterComponent, Access(typeof(TriggerSystem))]
+public sealed class SpawnOnTriggerComponent : Component
+{
+ [ViewVariables(VVAccess.ReadWrite), DataField("proto", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
+ public string Proto = string.Empty;
+}
SubscribeLocalEvent<TriggerOnStepTriggerComponent, StepTriggeredEvent>(OnStepTriggered);
SubscribeLocalEvent<TriggerOnSlipComponent, SlipEvent>(OnSlipTriggered);
+ SubscribeLocalEvent<SpawnOnTriggerComponent, TriggerEvent>(OnSpawnTrigger);
SubscribeLocalEvent<DeleteOnTriggerComponent, TriggerEvent>(HandleDeleteTrigger);
SubscribeLocalEvent<ExplodeOnTriggerComponent, TriggerEvent>(HandleExplodeTrigger);
SubscribeLocalEvent<FlashOnTriggerComponent, TriggerEvent>(HandleFlashTrigger);
SubscribeLocalEvent<GibOnTriggerComponent, TriggerEvent>(HandleGibTrigger);
}
+ private void OnSpawnTrigger(EntityUid uid, SpawnOnTriggerComponent component, TriggerEvent args)
+ {
+ var xform = Transform(uid);
+
+ var coords = xform.Coordinates;
+
+ if (!coords.IsValid(EntityManager))
+ return;
+
+ Spawn(component.Proto, coords);
+ }
+
private void HandleExplodeTrigger(EntityUid uid, ExplodeOnTriggerComponent component, TriggerEvent args)
{
_explosions.TriggerExplosive(uid, user: args.User);
sound:
path: "/Audio/Effects/flash_bang.ogg"
- type: DeleteOnTrigger
+ - type: SpawnOnTrigger
+ proto: GrenadeFlashEffect
- type: Appearance
visuals:
- type: TimerTriggerVisualizer
countdown_sound:
path: /Audio/Effects/countdown.ogg
+- type: entity
+ id: GrenadeFlashEffect
+ noSpawn: true
+ components:
+ - type: PointLight
+ enabled: true
+ netsync: false
+ radius: 5
+ energy: 8
+ - type: LightFade
+ duration: 0.5
+ - type: TimedDespawn
+ lifetime: 0.5
+
- type: entity
name: Syndicate minibomb
description: A precision sabotage explosive for quickly destroying a machine, dead body, or whatever else needs to go.