sm.projectile

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

Functions:

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

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

    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?The visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst?The visual start position in first-person. (Defaults to position)
    integerdelay?The number of ticks before firing. (Defaults to 0)

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

    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?The visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst?The visual start position in first-person. (Defaults to position)
    integerdelay?The number of ticks before firing. (Defaults to 0)

    sm.projectile.customProjectileAttack(userdata, uuid, damage, position, velocity, source, fakePosThird?, fakePosFirst?, delay?, acceleration?, lifetime?)

    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.
    WorldsourceThe world that is the source of the projectile.
    Vec3fakePosThird?The visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst?The visual start position in first-person. (Defaults to position)
    integerdelay?The number of ticks before firing. (Defaults to 0)
    numberacceleration?The acceleration of the projectile. (Defaults to 0)
    integerlifetime?The max lifetime of the projectile in ticks. (Defaults to 400)

    sm.projectile.customProjectileAttack(userdata, uuid, damage, position, velocity, source, fakePosThird?, fakePosFirst?, delay?, acceleration?, lifetime?)

    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?The visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst?The visual start position in first-person. (Defaults to position)
    integerdelay?The number of ticks before firing. (Defaults to 0)
    numberacceleration?The acceleration of the projectile. (Defaults to 0)
    integerlifetime?The max lifetime of the projectile in ticks. (Defaults to 400)

    sm.projectile.customProjectileAttack(userdata, uuid, damage, position, velocity, source, fakePosThird?, fakePosFirst?, delay?, acceleration?, lifetime?)

    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?The visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst?The visual start position in first-person. (Defaults to position)
    integerdelay?The number of ticks before firing. (Defaults to 0)
    numberacceleration?The acceleration of the projectile. (Defaults to 0)
    integerlifetime?The max lifetime of the projectile in ticks. (Defaults to 400)

    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.getProjectileRadius(uuid)

    Returns the radius of a projectile.

    Parameters:

    TypeNameDescription
    UuiduuidThe projectile's uuid.

    Returns:

    TypeDescription
    numberThe radius.

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

    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?The number of ticks before firing. (Defaults to 0)

    sm.projectile.harvestableCustomProjectileAttack(userdata, uuid, damage, position, velocity, source, delay?, acceleration?, lifetime?)

    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?The number of ticks before firing. (Defaults to 0)
    numberacceleration?The acceleration of the projectile. (Defaults to 0)
    integerlifetime?The max lifetime of the projectile in ticks. (Defaults to 400)

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

    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?The number of ticks before firing. (Defaults to 0)

    sm.projectile.harvestableProjectileAttack(uuid, damage, position, velocity, source, delay?, acceleration?, lifetime?)

    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?The number of ticks before firing. (Defaults to 0)
    numberacceleration?The acceleration of the projectile. (Defaults to 0)
    integerlifetime?The max lifetime of the projectile in ticks. (Defaults to 400)

    sm.projectile.playerFire(name, position, velocity, fakePosThird?, fakePosFirst?, delay?)

    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?The visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst?The visual start position in first-person. (Defaults to position)
    integerdelay?The number of ticks before firing. (Defaults to 0)

    sm.projectile.playerFire(uuid, position, velocity, fakePosThird?, fakePosFirst?, delay?)

    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?The visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst?The visual start position in first-person. (Defaults to position)
    integerdelay?The number of ticks before firing. (Defaults to 0)

    sm.projectile.projectileAttack(name, damage, position, velocity, source, fakePosThird?, fakePosFirst?, delay?)

    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?The visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst?The visual start position in first-person. (Defaults to position)
    integerdelay?The number of ticks before firing. (Defaults to 0)

    sm.projectile.projectileAttack(name, damage, position, velocity, source, fakePosThird?, fakePosFirst?, delay?)

    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?The visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst?The visual start position in first-person. (Defaults to position)
    integerdelay?The number of ticks before firing. (Defaults to 0)

    sm.projectile.projectileAttack(uuid, damage, position, velocity, source, fakePosThird?, fakePosFirst?, delay?, acceleration?, lifetime?)

    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?The visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst?The visual start position in first-person. (Defaults to position)
    integerdelay?The number of ticks before firing. (Defaults to 0)
    numberacceleration?The acceleration of the projectile. (Defaults to 0)
    integerlifetime?The max lifetime of the projectile in ticks. (Defaults to 400)

    sm.projectile.projectileAttack(uuid, damage, position, velocity, source, fakePosThird?, fakePosFirst?, delay?, acceleration?, lifetime?)

    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?The visual start position in third-person. (Defaults to position)
    Vec3fakePosFirst?The visual start position in first-person. (Defaults to position)
    integerdelay?The number of ticks before firing. (Defaults to 0)
    numberacceleration?The acceleration of the projectile. (Defaults to 0)
    integerlifetime?The max lifetime of the projectile in ticks. (Defaults to 400)

    sm.projectile.removeProjectilesWithSource(source, delay?)

    Client only

    Removes projectiles created by a given source. The source world must exist.

    Parameters:

    TypeNameDescription
    WorldsourceThe world that is the source of the projectile.
    integerdelay?The number of ticks before destroying the projectile. (Defaults to 0)

    sm.projectile.removeProjectilesWithSource(source, delay?)

    Client only

    Removes projectiles created by a given source. The source player must exist.

    Parameters:

    TypeNameDescription
    PlayersourceThe player that is the source of the projectile.
    integerdelay?The number of ticks before destroying the projectile. (Defaults to 0)

    sm.projectile.removeProjectilesWithSource(source, delay?, world?)

    Client only

    Removes projectiles created by a given character source. Can remove projectiles from a source that doesn't exist, in this case a world to remove from is required.

    Parameters:

    TypeNameDescription
    CharactersourceThe Character that is the source of the projectile.
    integerdelay?The number of ticks before destroying the projectile. (Defaults to 0)
    Worldworld?The world the projectiles should be removed from. (Defaults to same world as source.)

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

    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?The number of ticks before firing. (Defaults to 0)

    sm.projectile.shapeCustomProjectileAttack(userdata, uuid, damage, position, velocity, source, delay?, acceleration?, lifetime?)

    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?The number of ticks before firing. (Defaults to 0)
    numberacceleration?The acceleration of the projectile. (Defaults to 0)
    integerlifetime?The max lifetime of the projectile in ticks. (Defaults to 400)

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

    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?The number of ticks before firing. (Defaults to 0)

    sm.projectile.shapeFire(shape, uuid, position, velocity, delay?, projectileAmount?)

    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?The number of ticks before firing. (Defaults to 0)
    integerprojectileAmount?The amount of shots that will be fired. Uses projectile amount from json if not set (Optional, range of 0-255)

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

    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?The number of ticks before firing. (Defaults to 0)

    sm.projectile.shapeProjectileAttack(uuid, damage, position, velocity, source, delay?, acceleration?, lifetime?)

    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?The number of ticks before firing. (Defaults to 0)
    numberacceleration?The acceleration of the projectile. (Defaults to 0)
    integerlifetime?The max lifetime of the projectile in ticks. (Defaults to 400)

    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.