Draggable Props
๐ Installation
- Download the resource and place the
tlb-draggable-propsfolder into your server'sresourcesdirectory. - Ensure the resource in your
server.cfg:
ensure tlb-draggable-props
- (Optional) Configure the default settings in
shared/config.lua.
๐ ๏ธ Developer API (Exports)
TLB Draggable Props is designed to be used as a library from other resources.
exports['tlb-draggable-props']:Register(config)
Registers a new interaction session.
Parameters:
config(table): The session configuration.props(list): Entities to spawn.interactions(list): Drag & Drop logic (which prop goes where).steps(list): UI task list.stepsTitle(string): Title of the UI panel.dragMode(string):'raycast'or'flat'.
exports['tlb-draggable-props']:Start(options)
Starts the interaction session.
exports['tlb-draggable-props']:Stop()
Force-stops the current session and cleans up entities.
exports['tlb-draggable-props']:DetachFromCursor()
Stops the "following" logic for the currently held prop. Useful for starting an animation when a drop is validated.
๐งช Usage Example
local cfg = {
dragMode = 'flat',
dragDepth = 2.2, -- Distance from player
props = {
{
model = 'prop_cs_pills',
coords = vector3(100.0, 200.0, 30.0),
name = 'Reagent Bottle'
},
{
model = 'xm3_prop_xm3_lsd_beaker_02a',
coords = vector3(101.0, 200.0, 30.0),
name = 'Mixing Beaker'
}
},
interactions = {
{
drag = 'prop_cs_pills',
drop = 'xm3_prop_xm3_lsd_beaker_02a',
callback = function(draggingProp, dropTarget)
-- Interaction logic (animations, FX, etc.)
print("Interaction successful!")
end
}
}
}
exports['tlb-draggable-props']:Register(cfg)
exports['tlb-draggable-props']:Start({ enableCamera = true })
โ๏ธ Configuration
The shared/config.lua file allows you to customize the global behavior:
- Highlighting: Change the outline color and thickness.
- Controls: Rebind interaction keys (Grab, Rotate, Quit).
- Camera: Adjust default FOV, offsets, and transition speeds.
- UI: Customize the Labels (font, size, background colors).