EndCore Framework

en-radialmenu

A hold-to-open radial wheel with built-in survivor, vehicle, base and party entries that other resources can extend.

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_plan and en-properties).
  • Party: Members, Leave party (only while in a party).

Other resources add their own entries.

At a glance

Depends onen-core, en-ui
SideClient only
Start afteren-core, en-ui. Order does not matter when registering through encore.radial.*
Database tablesNone
Config filesconfig/shared.lua
Key bindsen_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 (hud command), en-vehiclekeys (HasAccess, ToggleLock, +en_vehiclekeys_engine) and en-properties (en-properties:client:openBuild). Each entry only shows when its resource is started.
  • canShow is 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:playerDied and encore:client:playerUnloaded.
  • While open, look, attack, aim, melee and pause controls are disabled.

Configuration

config/shared.lua:

KeyDefaultWhat it does
Config.key'F1'Default key (players can rebind it)
Config.releaseToSelecttrueReleasing 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:

lua
-- config/shared.lua
Config.key = 'F1'
Config.releaseToSelect = true
Config.defaults = { survivor = true, vehicle = true, base = false, party = true }

Item shape

lua
{
    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']:

ExportArgumentsReturns
AddItemitem
RemoveItemid
IsOpenboolean
Close

encore.radial (preferred)

FunctionNotes
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:

lua
-- 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:

lua
-- client
encore.radial.addItem({
    id = 'my-notes:journal',
    parent = 'survivor',
    label = 'Journal',
    icon = 'book',
    order = 90,
    onSelect = function()
        TriggerEvent('my-notes:client:open')
    end,
})