en-radialmenu is a hold-to-open action wheel. Hold F1, point the mouse at an entry and release to pick it. You can keep moving while the wheel is open. Entries can open submenus.
EndCore ships four groups of entries, and each hides itself when it isn't relevant:
- Survivor: Inventory, Skills, Craft, Party, Group, HUD settings.
- Vehicle: Engine, Lock/unlock, Trunk, Change seat, Windows, and a Doors submenu for each door, the hood and the trunk lid.
- Base: Build (needs a
building_planand en-properties). - Party: Members, Leave party (only while in a party).
Other resources add their own entries.
At a glance
| Depends on | en-core, en-ui |
| Side | Client only |
| Start after | en-core, en-ui. Order does not matter when registering through encore.radial.* |
| Database tables | None |
| Config files | config/shared.lua |
| Key binds | en_radialmenu, default F1 |
How it works
- Built-in entries call into other EndCore resources: en-inventory, en-skills (
OpenMenu), en-crafting (+en_crafting_hand), en-party (OpenMenu,GetParty), en-hud (hudcommand), en-vehiclekeys (HasAccess,ToggleLock,+en_vehiclekeys_engine) and en-properties (en-properties:client:openBuild). Each entry only shows when its resource is started. canShowis checked every time a ring is shown, so entries appear and disappear with the situation.- A submenu with no visible children is hidden.
- Items are removed automatically when the resource that registered them stops.
- Registrations made through
encore.radial.*are remembered and re-applied whenever en-radialmenu starts. - The wheel won't open while the player is dead, not logged in, paused, or focused on another NUI. It closes on
encore:client:playerDiedandencore:client:playerUnloaded. - While open, look, attack, aim, melee and pause controls are disabled.
Configuration
config/shared.lua:
| Key | Default | What it does |
|---|---|---|
Config.key | 'F1' | Default key (players can rebind it) |
Config.releaseToSelect | true | Releasing picks the entry under the pointer; false keeps the wheel open until a click or key press |
Config.defaults | { survivor = true, vehicle = true, base = true, party = true } | Turn built-in groups off |
Removing the base group on a server without building:
-- config/shared.lua
Config.key = 'F1'
Config.releaseToSelect = true
Config.defaults = { survivor = true, vehicle = true, base = false, party = true }Item shape
{
id = 'my-resource:radio', -- required, unique
label = 'Radio',
icon = 'radio', -- en-ui icon name
parent = 'survivor', -- submenu id; nil = top ring
order = 50, -- lower first (default 100); ties sorted by label
submenu = false, -- true = opens a ring of its children
canShow = function() return true end, -- checked when a ring is shown
onSelect = function() end,
keepOpen = false, -- true = the wheel stays open after selecting
}Built-in submenu ids you can add children to: survivor, vehicle, vehicle:doors, base, party.
Exports
Client exports on exports['en-radialmenu']:
| Export | Arguments | Returns |
|---|---|---|
AddItem | item | |
RemoveItem | id | |
IsOpen | boolean | |
Close |
encore.radial (preferred)
| Function | Notes |
|---|---|
encore.radial.addItem(item) | Runs onSelect in its own thread in your resource, so it may wait |
encore.radial.removeItem(id) | |
encore.radial.isAvailable() | Whether en-radialmenu is running |
State bags
The Windows entry keeps its state in local, non-replicated LocalPlayer.state.windowsDown.
en-radialmenu has no commands or events of its own.
Examples
A Radio submenu with an entry that only shows when the player carries a radio:
-- client
encore.radial.addItem({ id = 'my-radio:menu', label = 'Radio', icon = 'radio', submenu = true, order = 60 })
encore.radial.addItem({
id = 'my-radio:toggle',
parent = 'my-radio:menu',
label = 'Toggle radio',
icon = 'radio',
canShow = function() return encore.inventory.getItemCount('radio') > 0 end,
onSelect = function()
ExecuteCommand('radio')
end,
})Add an entry to the built-in Survivor ring:
-- client
encore.radial.addItem({
id = 'my-notes:journal',
parent = 'survivor',
label = 'Journal',
icon = 'book',
order = 90,
onSelect = function()
TriggerEvent('my-notes:client:open')
end,
})