sm.projectile

Information about projectiles are located in `/Data/Projectiles/projectiles.json`.

Functions:

  • customProjectileAttack
  • customProjectileAttack
  • customProjectileAttack
  • customProjectileAttack
  • getProjectileMass
  • getProjectileMass
  • harvestableCustomProjectileAttack
  • harvestableCustomProjectileAttack
  • harvestableProjectileAttack
  • harvestableProjectileAttack
  • playerFire
  • playerFire
  • projectileAttack
  • projectileAttack
  • projectileAttack
  • projectileAttack
  • shapeCustomProjectileAttack
  • shapeCustomProjectileAttack
  • shapeFire
  • shapeFire
  • shapeProjectileAttack
  • shapeProjectileAttack
  • solveBallisticArc

  • sm.projectile.customProjectileAttack(userdata, name, damage, position, velocity, source, fakePosThird=nil, fakePosFirst=nil, delay=0)

    Deprecated:

    Name is deprecated, use uuid instead

    Server only

    Perform a customized projectile attack

    Parameters:

    TypeNameDescription
    tableuserdataThe custom user data
    stringnameThe projectile's name.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position in world space.
    Vec3velocityThe direction and velocity.
    PlayersourceThe player that is the source of the projectile.
    Vec3fakePosThird=nilThe visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst=nilThe visual start position in first-person. (Defaults to position)
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.customProjectileAttack(userdata, name, damage, position, velocity, source, fakePosThird=nil, fakePosFirst=nil, delay=0)

    Deprecated:

    Name is deprecated, use uuid instead

    Server only

    Perform a customized projectile attack

    Parameters:

    TypeNameDescription
    tableuserdataThe custom user data
    stringnameThe projectile's name.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position in world space.
    Vec3velocityThe direction and velocity.
    UnitsourceThe Unit that is the source of the projectile.
    Vec3fakePosThird=nilThe visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst=nilThe visual start position in first-person. (Defaults to position)
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.customProjectileAttack(userdata, uuid, damage, position, velocity, source, fakePosThird=nil, fakePosFirst=nil, delay=0)

    Server only

    Perform a customized projectile attack

    Parameters:

    TypeNameDescription
    tableuserdataThe custom user data
    UuiduuidThe projectile's uuid.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position in world space.
    Vec3velocityThe direction and velocity.
    PlayersourceThe player that is the source of the projectile.
    Vec3fakePosThird=nilThe visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst=nilThe visual start position in first-person. (Defaults to position)
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.customProjectileAttack(userdata, uuid, damage, position, velocity, source, fakePosThird=nil, fakePosFirst=nil, delay=0)

    Server only

    Perform a customized projectile attack

    Parameters:

    TypeNameDescription
    tableuserdataThe custom user data
    UuiduuidThe projectile's uuid.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position in world space.
    Vec3velocityThe direction and velocity.
    UnitsourceThe Unit that is the source of the projectile.
    Vec3fakePosThird=nilThe visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst=nilThe visual start position in first-person. (Defaults to position)
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.getProjectileMass(name)

    Deprecated:

    Name is deprecated, use uuid instead

    Returns the mass of a projectile.

    Parameters:

    TypeNameDescription
    stringnameThe projectile's name.

    Returns:

    TypeDescription
    numberThe mass.

    sm.projectile.getProjectileMass(uuid)

    Returns the mass of a projectile.

    Parameters:

    TypeNameDescription
    UuiduuidThe projectile's uuid.

    Returns:

    TypeDescription
    numberThe mass.

    sm.projectile.harvestableCustomProjectileAttack(userdata, name, damage, position, velocity, source, delay=0)

    Deprecated:

    Name is deprecated, use uuid instead

    Server only

    Perform a customized projectile attack

    Parameters:

    TypeNameDescription
    tableuserdataThe custom user data
    stringnameThe projectile's name.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position in world space.
    Vec3velocityThe direction and velocity.
    HarvestablesourceThe harvestable that is the source of the projectile.
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.harvestableCustomProjectileAttack(userdata, uuid, damage, position, velocity, source, delay=0)

    Server only

    Perform a customized projectile attack

    Parameters:

    TypeNameDescription
    tableuserdataThe custom user data
    UuiduuidThe projectile's uuid.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position in world space.
    Vec3velocityThe direction and velocity.
    HarvestablesourceThe harvestable that is the source of the projectile.
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.harvestableProjectileAttack(name, damage, position, velocity, source, delay=0)

    Deprecated:

    Name is deprecated, use uuid instead

    Perform a projectile attack

    Parameters:

    TypeNameDescription
    stringnameThe projectile's name.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position in world space.
    Vec3velocityThe direction and velocity.
    HarvestablesourceThe Harvestable that is the source of the projectile.
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.harvestableProjectileAttack(uuid, damage, position, velocity, source, delay=0)

    Perform a projectile attack

    Parameters:

    TypeNameDescription
    UuiduuidThe projectile's uuid.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position in world space.
    Vec3velocityThe direction and velocity.
    HarvestablesourceThe Harvestable that is the source of the projectile.
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.playerFire(name, position, velocity, fakePosThird=nil, fakePosFirst=nil, delay=0)

    Deprecated:

    Name is deprecated, use uuid instead

    Client only

    Creates and fires a projectile from a player.

    The projectile is normally fired from the player's position, but due to the weapon being held off-center it may require a fake position for where the projectile appears to be fired from.

    Parameters:

    TypeNameDescription
    stringnameThe projectile's name.
    Vec3positionThe start position.
    Vec3velocityThe direction and velocity.
    Vec3fakePosThird=nilThe visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst=nilThe visual start position in first-person. (Defaults to position)
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.playerFire(uuid, position, velocity, fakePosThird=nil, fakePosFirst=nil, delay=0)

    Client only

    Creates and fires a projectile from a player.

    The projectile is normally fired from the player's position, but due to the weapon being held off-center it may require a fake position for where the projectile appears to be fired from.

    Parameters:

    TypeNameDescription
    UuiduuidThe projectile's uuid.
    Vec3positionThe start position.
    Vec3velocityThe direction and velocity.
    Vec3fakePosThird=nilThe visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst=nilThe visual start position in first-person. (Defaults to position)
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.projectileAttack(name, damage, position, velocity, source, fakePosThird=nil, fakePosFirst=nil, delay=0)

    Deprecated:

    Name is deprecated, use uuid instead

    Perform a projectile attack

    Parameters:

    TypeNameDescription
    stringnameThe projectile's name.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position.
    Vec3velocityThe direction and velocity.
    PlayersourceThe player that is the source of the projectile.
    Vec3fakePosThird=nilThe visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst=nilThe visual start position in first-person. (Defaults to position)
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.projectileAttack(name, damage, position, velocity, source, fakePosThird=nil, fakePosFirst=nil, delay=0)

    Deprecated:

    Name is deprecated, use uuid instead

    Perform a projectile attack

    Parameters:

    TypeNameDescription
    stringnameThe projectile's name.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position.
    Vec3velocityThe direction and velocity.
    UnitsourceThe Unit that is the source of the projectile.
    Vec3fakePosThird=nilThe visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst=nilThe visual start position in first-person. (Defaults to position)
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.projectileAttack(uuid, damage, position, velocity, source, fakePosThird=nil, fakePosFirst=nil, delay=0)

    Perform a projectile attack

    Parameters:

    TypeNameDescription
    UuiduuidThe projectile's uuid.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position.
    Vec3velocityThe direction and velocity.
    PlayersourceThe player that is the source of the projectile.
    Vec3fakePosThird=nilThe visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst=nilThe visual start position in first-person. (Defaults to position)
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.projectileAttack(uuid, damage, position, velocity, source, fakePosThird=nil, fakePosFirst=nil, delay=0)

    Perform a projectile attack

    Parameters:

    TypeNameDescription
    UuiduuidThe projectile's uuid.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position.
    Vec3velocityThe direction and velocity.
    UnitsourceThe Unit that is the source of the projectile.
    Vec3fakePosThird=nilThe visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst=nilThe visual start position in first-person. (Defaults to position)
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.shapeCustomProjectileAttack(userdata, name, damage, position, velocity, source, delay=0)

    Deprecated:

    Name is deprecated, use uuid instead

    Server only

    Perform a customized projectile attack

    Parameters:

    TypeNameDescription
    tableuserdataThe custom user data
    stringnameThe projectile's name.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position in the shape's local space.
    Vec3velocityThe direction and velocity.
    ShapesourceThe shape that is the source of the projectile.
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.shapeCustomProjectileAttack(userdata, uuid, damage, position, velocity, source, delay=0)

    Server only

    Perform a customized projectile attack

    Parameters:

    TypeNameDescription
    tableuserdataThe custom user data
    UuiduuidThe projectile's uuid.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position in the shape's local space.
    Vec3velocityThe direction and velocity.
    ShapesourceThe shape that is the source of the projectile.
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.shapeFire(shape, name, position, velocity, delay=0)

    Deprecated:

    Name is deprecated, use uuid instead

    Server only

    Creates and fires a projectile from a Shape.

    Parameters:

    TypeNameDescription
    ShapeshapeThe shape.
    stringnameThe projectile's name.
    Vec3positionThe start position.
    Vec3velocityThe direction and velocity.
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.shapeFire(shape, uuid, position, velocity, delay=0)

    Server only

    Creates and fires a projectile from a Shape.

    Parameters:

    TypeNameDescription
    ShapeshapeThe shape.
    UuiduuidThe projectile's uuid.
    Vec3positionThe start position.
    Vec3velocityThe direction and velocity.
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.shapeProjectileAttack(name, damage, position, velocity, source, delay=0)

    Deprecated:

    Name is deprecated, use uuid instead

    Perform a projectile attack

    Parameters:

    TypeNameDescription
    stringnameThe projectile's name.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position in the shape's local space.
    Vec3velocityThe direction and velocity.
    ShapesourceThe shape that is the source of the projectile.
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.shapeProjectileAttack(uuid, damage, position, velocity, source, delay=0)

    Perform a projectile attack

    Parameters:

    TypeNameDescription
    UuiduuidThe projectile's uuid.
    integerdamageThe damage the projectile will inflict.
    Vec3positionThe start position in the shape's local space.
    Vec3velocityThe direction and velocity.
    ShapesourceThe shape that is the source of the projectile.
    integerdelay=0The number of ticks before firing. (Defaults to 0)

    sm.projectile.solveBallisticArc(firePos, targetPos, velocity, gravity)

    Calculate the ballistic arc of a projectile. There are two potential solutions to the problem.

    One with a low fire angle and one with a high fire angle. Solutions can be nil if no solution is found.

    Parameters:

    TypeNameDescription
    Vec3firePosThe position the projectile is fired from.
    Vec3targetPosThe position the projectile should hit.
    numbervelocityThe fire velocity of the projectile.
    numbergravityThe gravity ( positive down ).

    Returns:

    TypeDescription
    Vec3, Vec3The low angle solution; The high angle solution.