Naev

Module munition

Lua bindings to interact with munitions.

This will allow you to create and manipulate munitions in-game.

Functions

__eq (p, comp) Checks to see if munition and p are the same.
__tostring (p) Gets the munition's current (translated) name or notes it is inexistent.
exists (m) Checks to see if a munition still exists.
clear () Clears all the munitions in the system.
getAll (onlyhittable) Gets all the munitions in the system.
getInrange (pos, range[, Pilot=nil]) Get munitions in range.
pos (m) Gets the position of the munition.
vel (m) Gets the velocity of the munition.
faction (m) Gets the faction of the munition.
parent (m) Gets the parent of the munition.
target (m) Gets the target of the munition.
outfit (m) Gets the outfit corresponding to the munition.
strength (m) Gets the strength of a munition.
strengthSet (m, str) Sets the strength of a munition.


Functions

__eq (p, comp)
Checks to see if munition and p are the same.

Parameters:

  • p Munition Munition to compare.
  • comp Munition Munition to compare against.

Returns:

    boolean true if they are the same.

Usage:

    if p == p2 then -- Munition 'p' and 'p2' match.
    
__tostring (p)
Gets the munition's current (translated) name or notes it is inexistent.

Parameters:

  • p Munition Munition to convert to string.

Returns:

    string The current name of the munition or "(inexistent munition)" if not existent.

Usage:

    tostring(p)
    
exists (m)
Checks to see if a munition still exists.

Parameters:

  • m Munition Munition to see if still exists.

Returns:

    boolean true if the munition still exists.
clear ()
Clears all the munitions in the system.
getAll (onlyhittable)
Gets all the munitions in the system.

Parameters:

  • onlyhittable boolean Whether or not to only get hittable munitions, or all of them.

Returns:

    table A table containing all the munitions in the system.
getInrange (pos, range[, Pilot=nil])
Get munitions in range. Note that this can only get hittable munitions.

Parameters:

  • pos Vec2 Position from which to get munitions.
  • range number Range to get munitions from.
  • Pilot Pilot or nil to check hostility to. (default nil)

Returns:

    table A table containing all the munitions found in range.
pos (m)
Gets the position of the munition.

Parameters:

  • m Munition Munition to get property of.

Returns:

    Vec2 Position of the munition.
vel (m)
Gets the velocity of the munition.

Parameters:

  • m Munition Munition to get property of.

Returns:

    Vec2 Velocity of the munition.
faction (m)
Gets the faction of the munition.

Parameters:

  • m Munition Munition to get property of.

Returns:

    Faction Faction of the munition.
parent (m)
Gets the parent of the munition.

Parameters:

  • m Munition Munition to get property of.

Returns:

    Pilot Parent of the munition.
target (m)
Gets the target of the munition.

Parameters:

  • m Munition Munition to get property of.

Returns:

    Pilot Target of the munition.
outfit (m)
Gets the outfit corresponding to the munition.

Parameters:

  • m Munition Munition to get corresponding outfit of.

Returns:

    Outfit The outfit corresponding to the munition.
strength (m)
Gets the strength of a munition.

Defaults to 1. and only changed when past falloff range or modified by a Lua script.

Parameters:

  • m Munition Munition to get strength of.

Returns:

    number The corresponding strength value where 1 indicates normal strength.
strengthSet (m, str)
Sets the strength of a munition.

Parameters:

  • m Munition Munition to get strength of.
  • str number Strength to set to. A value of 1 indicates normal strength.
generated by LDoc 1.5.0 Last updated 2024-04-26 14:59:58