Sirens - photonle/Photon-v2 GitHub Wiki

Sirens are integrated with Photon 2's library platform.

Registering

Siren .lua files should be placed in lua/photon-v2/library/sirens/. Due to their simplicity, it is recommended to use a single file when registering multiple sirens.

They are registered using the following syntax:

Photon2.RegisterSiren(
    {
        Name = "fedsig_smartsiren",
        Make = "Federal Signal",
        Model = "SmartSiren",
        Author = "Schmal",
        Sounds = {
            ["WAIL"]     = { Sound = "photon/sirens/fedsig_ss/wail.wav", Default = "T1" },
            ["YELP"]     = { Sound = "photon/sirens/fedsig_ss/yelp.wav", Default = "T2" },
            ["PRIORITY"] = { Sound = "photon/sirens/fedsig_ss/priority.wav", Icon = "bolt", Default = "T3", Label = "PRTY" },
            ["HILO"]     = { Sound = "photon/sirens/fedsig_ss/hilo.wav", Default = "T4" },
            ["AIRHORN"]  = { Sound = "photon/sirens/fedsig_ss/airhorn.wav", Default = "AIR", Label = "AIR" },
            ["MANUAL"]   = { Sound = "photon/sirens/fedsig_ss/manual.wav", Default = "MAN", Label = "MAN" },
        }
    }
)

Components

Siren components, which are derived from normal lighting components, are specially designed to connect to the siren library and primarily exist as a convenience feature.

Tones

Siren Tones are a loosely-standardized interface that bridges actual sounds to their intended use. Because every real siren amplifier has a different number of tones that may go by different proprietary names, Photon 2 uses Tones to enforce consistency for an easier player experience.

Tones are functionally similar to, and work in conjunction with, the VEHICLE.Schema system.

The actual mapping and behavior of tones occurs within a siren speaker component. Should you ever need a custom implementation of the default tone structure, you can do so by creating and adjusting a new siren component.

[!TIP] To see an example of customized tone handling, see the SoundOff Signal (photon_sos_siren) component. This component accepts secondary tones (e.g. T1 and TS1, T2 and TS2, etc.) to simulate SoundOff's special dual-siren functionality.

Default

By default, Photon supports eight general tones, a manual tone, and an airhorn. The following table is guide of tone codes and what they are typically used for.

Tone Common Sound Default Controls
T1 Wail 1
T2 Yelp 2
T3 Piercer/Priority/Hyper 3
T4 Hi-Lo 4
T5 P-Call 5
T6 Extra 6
T7 Extra 7
T8 Extra 8
AIR Airhorn Left Mouse Button
MAN Manual Right Mouse Button