Skip to content

Beam

public static class Beam

Namespace TightBeam.Api

TightBeam’s cross-mod control API for the player’s flashlight. Reference TightBeam.Api.dll OR drop this single file into your mod. Drive the beam from any mod: on/off, brightness, range, colour, plus Blink/Flicker/Pulse and scoped per-field overrides (e.g. dim it in a dark room, flicker it near power).

Every call is a zero-overhead no-op when TightBeam is not installed and lights up automatically when it is, so you can ship this unconditionally with no hard dependency. All calls MUST be on the Unity main thread.

using TightBeam.Api;
Beam.Blink(3); // event blink
var ov = Beam.BeginOverride("MyMod"); // scoped, per-field override
ov.SetIntensity(1f).SetSpotAngle(28f); // dim + narrow while in a zone
ov.Dispose(); // release -> beam returns to the player's own settings
public static bool Available { get; }

True only when the TightBeam host is installed AND bound. You rarely need this - the API is a safe no-op when absent.

public static int AbiVersion { get; }

ABI version of the host that is installed: 0 when absent, 1 for local-only builds, 2 and up once the other players’ beams can be read.

public static bool IsOn { get; }
public static float Intensity { get; }
public static float Range { get; }
public static float SpotAngle { get; }
public static bool IsMultiplayer { get; }

True while in a session with at least one other player.

public static ulong LocalSteamId { get; }

The local player’s SteamID64, or 0 when it is not known yet.

public static ulong[] RemoteIds { get; }

Every other player whose beam is being tracked. Never null; empty when alone or absent.

public static event Action<bool> OnToggled

Fires whenever the flashlight actually transitions on/off (player key or any mod’s SetOn/Toggle).

public static event Action<ulong, bool> OnRemoteToggled

Fires when ANOTHER player’s beam goes on or off: (steamId, isOn).

public static void GetColor(
out float r,
out float g,
out float b,
out float a)
public static void TurnOn()
public static void TurnOff()
public static void Toggle()
public static void SetOn(bool on)
public static void SetIntensity(float value)
public static void SetRange(float meters)
public static void SetSpotAngle(float degrees)
public static void SetColor(float r, float g, float b, float a = 1f)
public static void SetColorHex(string hex)
public static void Blink(int times, float intervalSeconds = 0.12f)
public static void Flicker(
float strength01,
float durationSeconds,
float frequencyHz = 14f)
public static void StopFlicker()
public static void Pulse(
float amplitude01,
float periodSeconds,
float durationSeconds)
public static void StopPulse()
public static void SetTemporaryIntensity(
float value,
float seconds,
float fadeSeconds = 0.25f)
public static void SetTemporaryColor(
float r,
float g,
float b,
float seconds,
float a = 1f,
float fadeSeconds = 0.25f)
public static bool RemoteHasTightBeam(ulong steamId)

Whether this player is running TightBeam and sharing their beam. False means TryGetRemote still answers, but with local defaults rather than their real settings.

public static bool IsRemoteRendered(ulong steamId)

Whether that player’s beam is actually being drawn, as opposed to lit but culled by distance or the beam cap.

public static bool TryGetRemote(ulong steamId, out RemoteBeamState state)

One player’s beam as it is being drawn. False when that player is unknown.

public static bool TryGetRemotePose(
ulong steamId,
out float px,
out float py,
out float pz,
out float fx,
out float fy,
out float fz)

Where one player’s beam starts and which way it points, for questions like “is that beam on me”. False when the beam is not currently drawn.

public static OverrideHandle BeginOverride(string ownerId)

Begin a scoped, per-field override for one owner. Dispose() (or scope exit) releases it.