Beam
public static class BeamNamespace 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 blinkvar ov = Beam.BeginOverride("MyMod"); // scoped, per-field overrideov.SetIntensity(1f).SetSpotAngle(28f); // dim + narrow while in a zoneov.Dispose(); // release -> beam returns to the player's own settingsProperties
Section titled “Properties”Available
Section titled “Available”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.
AbiVersion
Section titled “AbiVersion”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; }Intensity
Section titled “Intensity”public static float Intensity { get; }public static float Range { get; }SpotAngle
Section titled “SpotAngle”public static float SpotAngle { get; }IsMultiplayer
Section titled “IsMultiplayer”public static bool IsMultiplayer { get; }True while in a session with at least one other player.
LocalSteamId
Section titled “LocalSteamId”public static ulong LocalSteamId { get; }The local player’s SteamID64, or 0 when it is not known yet.
RemoteIds
Section titled “RemoteIds”public static ulong[] RemoteIds { get; }Every other player whose beam is being tracked. Never null; empty when alone or absent.
Events
Section titled “Events”OnToggled
Section titled “OnToggled”public static event Action<bool> OnToggledFires whenever the flashlight actually transitions on/off (player key or any mod’s SetOn/Toggle).
OnRemoteToggled
Section titled “OnRemoteToggled”public static event Action<ulong, bool> OnRemoteToggledFires when ANOTHER player’s beam goes on or off: (steamId, isOn).
Methods
Section titled “Methods”GetColor
Section titled “GetColor”public static void GetColor( out float r, out float g, out float b, out float a)TurnOn
Section titled “TurnOn”public static void TurnOn()TurnOff
Section titled “TurnOff”public static void TurnOff()Toggle
Section titled “Toggle”public static void Toggle()public static void SetOn(bool on)SetIntensity
Section titled “SetIntensity”public static void SetIntensity(float value)SetRange
Section titled “SetRange”public static void SetRange(float meters)SetSpotAngle
Section titled “SetSpotAngle”public static void SetSpotAngle(float degrees)SetColor
Section titled “SetColor”public static void SetColor(float r, float g, float b, float a = 1f)SetColorHex
Section titled “SetColorHex”public static void SetColorHex(string hex)public static void Blink(int times, float intervalSeconds = 0.12f)Flicker
Section titled “Flicker”public static void Flicker( float strength01, float durationSeconds, float frequencyHz = 14f)StopFlicker
Section titled “StopFlicker”public static void StopFlicker()public static void Pulse( float amplitude01, float periodSeconds, float durationSeconds)StopPulse
Section titled “StopPulse”public static void StopPulse()SetTemporaryIntensity
Section titled “SetTemporaryIntensity”public static void SetTemporaryIntensity( float value, float seconds, float fadeSeconds = 0.25f)SetTemporaryColor
Section titled “SetTemporaryColor”public static void SetTemporaryColor( float r, float g, float b, float seconds, float a = 1f, float fadeSeconds = 0.25f)RemoteHasTightBeam
Section titled “RemoteHasTightBeam”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.
IsRemoteRendered
Section titled “IsRemoteRendered”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.
TryGetRemote
Section titled “TryGetRemote”public static bool TryGetRemote(ulong steamId, out RemoteBeamState state)One player’s beam as it is being drawn. False when that player is unknown.
TryGetRemotePose
Section titled “TryGetRemotePose”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.
BeginOverride
Section titled “BeginOverride”public static OverrideHandle BeginOverride(string ownerId)Begin a scoped, per-field override for one owner. Dispose() (or scope exit) releases it.