> ## Documentation Index
> Fetch the complete documentation index at: https://lationscripts.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Interact - Utilities

> Remove anchors, suppress the interaction layer, and debug placements

Everything on this page is a client export on `lation_interact`: removal of anchors and rules, tag-based suppression of the whole layer, and the per-anchor `debug` flag.

## Removing Anchors

<Info>
  Cleanup is largely automatic: every anchor and rule a resource registered is dropped when that resource stops, and entity anchors remove themselves when their entity stops existing. Manual removal is for anchors that should disappear mid-session.
</Info>

<AccordionGroup>
  <Accordion title="remove" icon="trash">
    Remove any anchor or rule by id, whatever its kind - points, sphere/box zones, entity anchors, model rules, and global rules all share one id space. Calling it with an id that no longer exists is a safe no-op.

    ```lua theme={null}
    exports.lation_interact:remove(id)
    ```

    **Parameters:**

    * `id` (number) - The id returned by any `add*` export

    **Example:**

    ```lua theme={null}
    local id = exports.lation_interact:addPoint({
        coords = vec3(195.17, -933.4, 30.69),
        label = 'Notice Board',
        options = {
            { label = 'Read', icon = 'newspaper', key = 'E', onSelect = function() end }
        }
    })

    -- later, when the board should stop being interactive
    exports.lation_interact:remove(id)
    ```
  </Accordion>

  <Accordion title="removePoint" icon="location-dot">
    An alias of `remove` - identical behavior, kept so code written against point-specific naming reads naturally. It accepts any anchor or rule id, not just points.

    ```lua theme={null}
    exports.lation_interact:removePoint(id)
    ```

    **Parameters:**

    * `id` (number) - The id returned by any `add*` export
  </Accordion>

  <Accordion title="removeEntity" icon="car">
    Removes an entity anchor by the id `addEntity` returned.

    ```lua theme={null}
    exports.lation_interact:removeEntity(id)
    ```

    **Parameters:**

    * `id` (number) - The id returned by `addEntity`

    **Example:**

    ```lua theme={null}
    local id = exports.lation_interact:addEntity(vehicle, {
        label = 'Delivery Van',
        options = {
            { label = 'Unload', icon = 'box-open', key = 'E', onSelect = function() end }
        }
    })

    exports.lation_interact:removeEntity(id)
    ```

    <Note>
      This export name is shared with the ox\_target compatibility layer, and it handles both call shapes. A known lation\_interact anchor id passed alone removes that anchor. Anything else - a netId or array of netIds, optionally followed by option names - is treated as ox\_target's `removeEntity(netIds, optionNames)` and removes options registered through the ox bridge. The two can never collide: anchor ids are allocated starting above 1,000,000, far past FiveM's 16-bit network id space.
    </Note>
  </Accordion>
</AccordionGroup>

## Suppression

When the layer is suppressed, everything sleeps - no grains, no focus, no pill, no input - and it wakes the moment the state clears. Suppression happens automatically for the states enabled in `Config.Suppress` (dead, cuffed, the pause menu, another resource holding NUI focus), and any script can hold the layer down manually with its own tag. Tags are independent: two scripts never fight over one boolean, and a tag is held until its owner releases it.

<AccordionGroup>
  <Accordion title="suppress" icon="moon">
    Hold the interaction layer down under a tag. The layer stays asleep until the same tag is released - use a tag unique to your script so you never collide with another script's hold.

    ```lua theme={null}
    exports.lation_interact:suppress(tag)
    ```

    **Parameters:**

    * `tag` (string) - A non-empty identifier for your hold, e.g. your resource name

    **Example:**

    ```lua theme={null}
    -- hide all interactions during a cutscene
    exports.lation_interact:suppress('myscript:cutscene')
    PlayCutscene()
    exports.lation_interact:release('myscript:cutscene')
    ```
  </Accordion>

  <Accordion title="release" icon="sun">
    Release a tag you previously held with `suppress`. The layer wakes once no manual tags are held and no automatic suppression state is active. Releasing a tag that was never held is a safe no-op.

    ```lua theme={null}
    exports.lation_interact:release(tag)
    ```

    **Parameters:**

    * `tag` (string) - The same tag passed to `suppress`
  </Accordion>

  <Accordion title="isSuppressed" icon="circle-question">
    Returns whether the layer is currently suppressed for any reason - a manual tag or an automatic state (dead, cuffed, pause menu, NUI focus). Suppression is evaluated on a slow interval, never per frame, so the answer reflects the most recent pass.

    ```lua theme={null}
    local suppressed = exports.lation_interact:isSuppressed()
    ```

    **Returns:**

    * `suppressed` (boolean) - `true` while the layer is asleep

    **Example:**

    ```lua theme={null}
    if not exports.lation_interact:isSuppressed() then
        -- the interaction layer is live
    end
    ```
  </Accordion>
</AccordionGroup>

## Debugging

<AccordionGroup>
  <Accordion title="The debug flag" icon="bug">
    Every `add*` spec accepts `debug = true`, which draws the anchor's physical interaction shape in-world: zones draw their volume (the sphere or rotated box), while points and entity anchors draw the reach sphere at the anchor. Point and zone shapes draw at any distance while the flag is set, so you can line placements up from across the map; entity shapes draw whenever their entity is around.

    ```lua theme={null}
    exports.lation_interact:addSphere({
        coords = vec3(195.17, -933.4, 30.69),
        radius = 3.0,
        label = 'Legion Square',
        debug = true, -- draws the sphere in-world
        options = {
            { label = 'Inspect', icon = 'magnifying-glass', key = 'E', onSelect = function() end }
        }
    })
    ```

    <Warning>
      Leave `debug` off in production - it exists for placing and sizing anchors during development.
    </Warning>

    Zones registered through the compatibility layers honor their original `debug` / `debugPoly` fields the same way, so bridged debug zones draw their volume too.
  </Accordion>
</AccordionGroup>
