Naev

Module proximity

Provides a composable proximity callback: you can use "proximity" as a hook, with the function to call if the player's in range as an argument.

Functions

proximity (trigger) Poll for player proximity to a point in space.
proximityScan (trigger) This variant assumes a proximity hook between two ships, and trigger when the anchor ship scans the focus ship (fuzzy detection doesn't trigger).


Functions

proximity (trigger)
Poll for player proximity to a point in space.

Parameters:

  • trigger table

    Contains: "location" (destination point) or "anchor" (destination pilot), "radius" (maximum distance),

                         "focus" (source pilot, defaulting to the player), and "funcname" (what to call if within the radius).
    

Usage:

  • hook.timer(0.5, "proximity", {location = vec2.new(0, 0), radius = 500, funcname = "function"})
    
  • hook.timer(0.5, "proximity", {anchor = mypilot, radius = 500, funcname = "function"})
    
  • hook.timer(0.5, "proximity", {anchor = mypilot, radius = 500, funcname = "function", focus = theirpilot})
    
proximityScan (trigger)
This variant assumes a proximity hook between two ships, and trigger when the anchor ship scans the focus ship (fuzzy detection doesn't trigger).

Parameters:

  • trigger table

    Contains: "anchor" (destination pilot, defaulting to the player), "focus" (the pilot that's polled for),

                         "funcname" (what to call if "anchor" detects "focus").
             --
    

Usage:

  • hook.timer(0.5, "proximityScan", {focus = theirpilot, funcname = "function"}) -- Triggers when theirpilot is detected by the player
    
  • hook.timer(0.5, "proximityScan", {anchor = theirpilot, focus = mypilot, funcname = "function"}) -- Triggers when mypilot is detected by theirpilot
    
generated by LDoc 1.5.0 Last updated 2024-12-21 14:15:57