Skip to content

Commit a93bd3e

Browse files
committed
Update interactOptions.mdx
1 parent 586fe4a commit a93bd3e

1 file changed

Lines changed: 24 additions & 18 deletions

File tree

pages/interactv2/client/interactOptions.mdx

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,30 @@ All interact actions are formated as an array containing objects with the follow
77
### Option Type Definition
88

99
```lua
10-
---@class Option
11-
{
12-
label: string, -- Display label
13-
icon?: string, -- Icon name
14-
distance?: number, -- Max interaction distance
15-
canInteract?: function, -- Function returning boolean
16-
name?: string, -- Unique identifier
17-
resource?: string, -- Owning resource
18-
offset?: vector3, -- Relative offset
19-
offsetAbsolute?: vector3, -- Absolute offset
20-
bones?: string | string[], -- Bone ID(s)
21-
onSelect?: function, -- Selection callback
22-
cooldown?: number, -- Cooldown in milliseconds
23-
export?: string, -- Export function name
24-
event?: string, -- Client-side event
25-
serverEvent?: string, -- Server-side event
26-
command?: string -- Command to execute
27-
}
10+
--- Represents an interaction option with various properties.
11+
---@class InteractOption
12+
---@field label string The display label for the option.
13+
---@field icon? string The icon associated with the option.
14+
---@field iconColor? string The css color for the icon
15+
---@field distance? number The maximum distance at which the option is available.
16+
---@field holdTime? number Makes the option a press and hold and sets how long it should be held for. (miliseconds)
17+
---@field canInteract? fun(entity: number, distance: number, coords: vector3, name: string): boolean? A function to determine if the option can be interacted with.
18+
---@field name? string A unique identifier for the option.
19+
---@field resource? string The resource that registered the option.
20+
---@field offset? vector3 A relative offset from the entity's position.
21+
---@field offsetAbsolute? vector3 An absolute offset in world coordinates.
22+
---@field color? number[] 4 numbers in an array that will be used for rgba and will overwrite the theme color for that option.
23+
---@field bones? string | string[] An array of bone IDs associated with the option.
24+
---@field allowInVehicle? boolean marks the option as being able to be used inside a vehicle.
25+
---@field onSelect? fun(data: InteractResponse) A function to execute when the option is selected.
26+
---@field cooldown? number number of miliseconds the interact system should cooldown for after this option is selected. prevents spam.
27+
---@field export? string Optional export function name
28+
---@field event? string Client-side event to trigger
29+
---@field serverEvent? string Server-side event to trigger
30+
---@field command? string Command to execute
31+
---@field onActive? fun(data: InteractResponse) A function to execute when the option is active.
32+
---@field onInactive? fun(data: InteractResponse) A function to execute when the option was active and is now inactive.
33+
---@field whileActive? fun(data: InteractResponse) A function to execute while the option is active on a loop.
2834
```
2935

3036
## Callback

0 commit comments

Comments
 (0)