Skip to main content

Flareover

Based on game build 714014 | Last updated: 2026-03-08

Overview

FlareOver is a UI widget that displays a full-screen visual flare effect (e.g., for sudden bright lighting or screen flash events) using a tinted image. It supports alpha-based fading and is typically attached to an owner entity (e.g., a player) that receives the "startflareoverlay" event to trigger the effect.

Usage example

-- Add the widget to an entity (e.g., in the entity's prefab init)
inst:AddComponent("flareover")
-- Trigger the flare with custom tint (e.g., white flash)
inst:PushEvent("startflareoverlay", { r=1.0, g=1.0, b=1.0 })

Dependencies & tags

Components used: None identified
Tags: None identified

Properties

PropertyTypeDefault ValueDescription
ownerentitynilThe entity that owns this widget and to which it listens for events.
_alphanumber0.0Current alpha value of the overlay (0.0 = invisible, 1.0 = opaque).
_alpha_targetnumber0.0Target alpha (unused in current implementation; always driven by fade logic).
_alpha_speednumber0.5Rate at which alpha decreases per second during the fade.
bgImagenilThe underlying image component displaying the flare texture.

Main functions

StartFlare(data)

  • Description: Initiates the flare effect by showing the overlay and resetting the alpha to full, then begins updating.
  • Parameters: data (table or nil) - Optional table containing keys r, g, and b (numbers from 0.0 to 1.0) to set the tint color. If nil, no tint is applied.
  • Returns: Nothing.

OnUpdate(dt)

  • Description: Called every frame while the overlay is visible. Gradually reduces _alpha, updates the background image's fade alpha, and hides the widget when the effect completes.
  • Parameters: dt (number) - Delta time in seconds since the last frame.
  • Returns: Nothing.
  • Error states: Ends fading early and hides the widget when _alpha <= 0.01; stops updating automatically.

Events & listeners

  • Listens to: startflareoverlay — triggered on the owner entity; invokes StartFlare(data) with event payload data.
  • Pushes: None identified