Controls, Commands & Actions - photonle/Photon-v2 GitHub Wiki
Photon 2 uses a very modular user input (key-binding) system. While offering a basic and familiar user experience for most players, advanced users are able to make multiple custom input configurations, assign different input profiles to different vehicles, use one or more modifier keys, and create custom commands to precisely adjust controller channels and modes as desired.
Default Controls
F
: Toggle warning lights (MODE2)R
: Toggle siren, activate warning lights (MODE3)L ALT
: Cycle through warning lights modes (MODE1, MODE2, MODE3)M
: Toggle marker/cruise lights.N
: Short press toggles Auxiliary MODE1. Long press toggles Auxiliary MODE2.1
-8
: Toggle siren tones T1-T8H
: Quick press toggles headlights. Long press toggles parking lights.RAlt
+H
: Activates automatic headlights and daytime running lights. (On by default.)
Arrow LEFT
: Toggle left turn signal.Arrow RIGHT
: Toggle right turn signal.Arrow UP
: Toggle hazard lights.Arrow DOWN
: All turn signals off.
RCtrl
+Arrow LEFT
: Toggle traffic advisor left.RCtrl
+Arrow RIGHT
: Toggle traffic advisor right.RCtrl
+Arrow UP
: Toggle traffic advisor center-out.RCtrl
+Arrow DOWN
: Turn directional/traffic advisor off.
RShift
+Arrow LEFT
: Toggle left scene lighting.RShift
+Arrow RIGHT
: Toggle right scene lighting.RShift
+Arrow UP
: Toggle forward scene lighting.RShift
+Arrow DOWN
: Turn all scene lighting off.
MOUSE1
: Airhorn (momentary).MOUSE2
: Manual siren (momentary).
Input Configurations
Due to the volume of functions available in Photon 2 -- along with user preference and risk of conflict with other addons -- Photon 2 supports different input configuration profiles. Each profile can use completely unique key binds, and may be mapped to specific vehicles or used as a user's global default. Configuration profiles can be adjusted or swapped around at any time.
Photon 2 comes with different input configuration profiles as is, but new ones can also be created by a user, supplied by a server, or packaged with any addon.
Input configurations not created by the user are technically "locked" (as they are configured in Lua code). However, a user is able to copy or inherit from that profile and modify any aspect.
User-modified configurations are only stored locally.
Available Default Profiles
Default (User)
The "Default (User)" profile is used by default when Photon 2 is initially installed. It is a copy of the "Default" input configuration that the user is able to modify.
Alternate
The "Alternate" profile is specifically designed to not conflict with VCMod's default controls.
Always Use MODE3
This is a special profile made per user request. It is identical to Default, but jumps MODE3 when the lights are activated.
Classic (Photon LE)
The Classic profile mimics the default controls from Photon LE.
Customizing Key Binds
Basic
Key binding can be adjusted in-game using the Input Configuration window. (In Sandbox-based gamemodes, hold C, open menu titled Photon 2 at very top of screen, then select Open Input Settings.) The window should be sufficient for most users to customize
Modifier Keys
Modifier keys are additional buttons that must be pressed in combination with a primary button in order to execute a command. For example, in the common Ctrl+C
keyboard shortcut, C
is the primary key while Ctrl
is the modifier key. In most desktop applications, modifier keys are normally Control, Alt, and Shift.
(Note that the actual order/sequence of modifier keys is irrelevant. A command will be triggered whenever all corresponding keys are pressed simultaneously.)
Photon 2 supports this approach, and is even able to distinguish between the left and right modifier keys (e.g. ALT
vs R ALT
). There is also no limitation on what a modifier key can be. A J+K
combination, for example, is supported. You may also require multiple modifier keys, allowing for combinations like Shift+Ctrl+A
or Shift+Control+Alt+A
(see the advanced section below for more on this).
Advanced
As noted previously, Photon 2 has a comprehensive and fully-modular input system (which is somewhat intentionally obscured to avoid confusing casual users). Unlike most input-binding schemes, Photon 2 allows for a "many-to-many" relationship between buttons and commands. That means one button can execute multiple commands, and one command can be executed by multiple buttons.
To fully utilize the advanced binding functionality open the "Buttons" tab on Input & Controls options window.
Commands
Commands in Photon 2 are used to update the current behavior of a vehicle (i.e. a Photon Controller). They can turn lights on or off, activate a siren, change siren tones, and more. While you may be familiar to console commands as they're used in Garry's Mod or other Source games, the Photon 2 command system is separate and functions differently.
While commands in a traditional context can often be typed and executed via a console, Commands in Photon 2 are only designed for key or button-based activation, as they are intended to simulate how real-world switches and control panels operate.
Library
Commands are part of Photon 2's library system and are located at lua/photon-v2/library/commands
. This allows them to be shared, exported, or packaged with a standalone addon.
Example of the primary command to toggle emergency lights (default key: F).
Photon2.RegisterCommand({
Author = "Photon",
Name = "toggle_warning_lights",
Title = "Warning Lights",
Alt = "Emergency Lights",
Category = "Emergency",
Description = "When warning lights are off, turns them on to MODE2. When warning lights are on (any mode), turns them off.",
OnPress = {
-- Plays controller sound.
{ Action = "SOUND", Sound = "Controller" },
-- If Emergency.Warning is OFF, it sets it to the second-to-last mode.
-- If Emergency.Warning is anything besides OFF (MODE1, MODE2, MODE3, etc.), it sets it to OFF.
{ Action = "OFF_TOGGLE", Channel = "Emergency.Warning", Value = 1, Query = "LAST_MINUS" },
-- Sets Emergency.Siren to "OFF" if Emergency.Warning is also "OFF"
{ Action = "OFF_WITH", Channel = "Emergency.Siren", Value = "Emergency.Warning" }
},
OnRelease = {
-- Plays controller sound.
{ Action = "SOUND", Sound = "Controller" }
}
})
Queries
Queries interface with a Photon profile/vehicle's input schema. They are utilized to make actions dynamic and automatically adjust their behavior based on the detected capabilities of the current profile/vehicle. For example, they can accommodate when a profile/vehicle uses only one light stage as opposed to the standard of three. Conversely, they can adapt if the a profile/vehicle uses four.
Key Activities
Key activities are button events, which allows for different actions to be executed depending on the event.
OnPress
Immediately triggered as soon as a button in pressed.
OnHold
Triggered after the button was pressed and held for approximately one second.
OnRelease
Triggered when the button is released or lifted.
Actions
Actions are one or more functions that execute sequentially after a specific key activity is triggered (see above). In most cases, an action is used to adjust the current Mode of a single Channel.
"OFF_TOGGLE"
"ON_TOGGLE"
"SET"
"TOGGLE"
"CYCLE"
"SOUND"
Triggers an interaction sound based on the specified sound class (usually Controller
or Click
) and the activating key activity (press, hold, or release). The sound may be suppressed if the user's Interaction Sound Profile is configured to ignore it. (See the Interaction Sounds page for an explanation of this).