sm.projectile
Information about projectiles are located in `/Data/Projectiles/projectiles.json`.
Functions:
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:
Type | Name | Description |
---|---|---|
table | userdata | The custom user data |
string | name | The projectile's name. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position in world space. |
Vec3 | velocity | The direction and velocity. |
Player | source | The player that is the source of the projectile. |
Vec3 | fakePosThird=nil | The visual start position in third-person. (Defaults to position) |
Vec3 | fakePosFirst=nil | The visual start position in first-person. (Defaults to position) |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
table | userdata | The custom user data |
string | name | The projectile's name. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position in world space. |
Vec3 | velocity | The direction and velocity. |
Unit | source | The Unit that is the source of the projectile. |
Vec3 | fakePosThird=nil | The visual start position in third-person. (Defaults to position) |
Vec3 | fakePosFirst=nil | The visual start position in first-person. (Defaults to position) |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
table | userdata | The custom user data |
Uuid | uuid | The projectile's uuid. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position in world space. |
Vec3 | velocity | The direction and velocity. |
Player | source | The player that is the source of the projectile. |
Vec3 | fakePosThird=nil | The visual start position in third-person. (Defaults to position) |
Vec3 | fakePosFirst=nil | The visual start position in first-person. (Defaults to position) |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
table | userdata | The custom user data |
Uuid | uuid | The projectile's uuid. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position in world space. |
Vec3 | velocity | The direction and velocity. |
Unit | source | The Unit that is the source of the projectile. |
Vec3 | fakePosThird=nil | The visual start position in third-person. (Defaults to position) |
Vec3 | fakePosFirst=nil | The visual start position in first-person. (Defaults to position) |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
string | name | The projectile's name. |
Returns:
Type | Description |
---|---|
number | The mass. |
sm.projectile.getProjectileMass(uuid)
Returns the mass of a projectile.
Parameters:
Type | Name | Description |
---|---|---|
Uuid | uuid | The projectile's uuid. |
Returns:
Type | Description |
---|---|
number | The 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:
Type | Name | Description |
---|---|---|
table | userdata | The custom user data |
string | name | The projectile's name. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position in world space. |
Vec3 | velocity | The direction and velocity. |
Harvestable | source | The harvestable that is the source of the projectile. |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
table | userdata | The custom user data |
Uuid | uuid | The projectile's uuid. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position in world space. |
Vec3 | velocity | The direction and velocity. |
Harvestable | source | The harvestable that is the source of the projectile. |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
string | name | The projectile's name. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position in world space. |
Vec3 | velocity | The direction and velocity. |
Harvestable | source | The Harvestable that is the source of the projectile. |
integer | delay=0 | The number of ticks before firing. (Defaults to 0) |
sm.projectile.harvestableProjectileAttack(uuid, damage, position, velocity, source, delay=0)
Perform a projectile attack
Parameters:
Type | Name | Description |
---|---|---|
Uuid | uuid | The projectile's uuid. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position in world space. |
Vec3 | velocity | The direction and velocity. |
Harvestable | source | The Harvestable that is the source of the projectile. |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
string | name | The projectile's name. |
Vec3 | position | The start position. |
Vec3 | velocity | The direction and velocity. |
Vec3 | fakePosThird=nil | The visual start position in third-person. (Defaults to position) |
Vec3 | fakePosFirst=nil | The visual start position in first-person. (Defaults to position) |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
Uuid | uuid | The projectile's uuid. |
Vec3 | position | The start position. |
Vec3 | velocity | The direction and velocity. |
Vec3 | fakePosThird=nil | The visual start position in third-person. (Defaults to position) |
Vec3 | fakePosFirst=nil | The visual start position in first-person. (Defaults to position) |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
string | name | The projectile's name. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position. |
Vec3 | velocity | The direction and velocity. |
Player | source | The player that is the source of the projectile. |
Vec3 | fakePosThird=nil | The visual start position in third-person. (Defaults to position) |
Vec3 | fakePosFirst=nil | The visual start position in first-person. (Defaults to position) |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
string | name | The projectile's name. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position. |
Vec3 | velocity | The direction and velocity. |
Unit | source | The Unit that is the source of the projectile. |
Vec3 | fakePosThird=nil | The visual start position in third-person. (Defaults to position) |
Vec3 | fakePosFirst=nil | The visual start position in first-person. (Defaults to position) |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
Uuid | uuid | The projectile's uuid. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position. |
Vec3 | velocity | The direction and velocity. |
Player | source | The player that is the source of the projectile. |
Vec3 | fakePosThird=nil | The visual start position in third-person. (Defaults to position) |
Vec3 | fakePosFirst=nil | The visual start position in first-person. (Defaults to position) |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
Uuid | uuid | The projectile's uuid. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position. |
Vec3 | velocity | The direction and velocity. |
Unit | source | The Unit that is the source of the projectile. |
Vec3 | fakePosThird=nil | The visual start position in third-person. (Defaults to position) |
Vec3 | fakePosFirst=nil | The visual start position in first-person. (Defaults to position) |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
table | userdata | The custom user data |
string | name | The projectile's name. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position in the shape's local space. |
Vec3 | velocity | The direction and velocity. |
Shape | source | The shape that is the source of the projectile. |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
table | userdata | The custom user data |
Uuid | uuid | The projectile's uuid. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position in the shape's local space. |
Vec3 | velocity | The direction and velocity. |
Shape | source | The shape that is the source of the projectile. |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
Shape | shape | The shape. |
string | name | The projectile's name. |
Vec3 | position | The start position. |
Vec3 | velocity | The direction and velocity. |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
Shape | shape | The shape. |
Uuid | uuid | The projectile's uuid. |
Vec3 | position | The start position. |
Vec3 | velocity | The direction and velocity. |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
string | name | The projectile's name. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position in the shape's local space. |
Vec3 | velocity | The direction and velocity. |
Shape | source | The shape that is the source of the projectile. |
integer | delay=0 | The number of ticks before firing. (Defaults to 0) |
sm.projectile.shapeProjectileAttack(uuid, damage, position, velocity, source, delay=0)
Perform a projectile attack
Parameters:
Type | Name | Description |
---|---|---|
Uuid | uuid | The projectile's uuid. |
integer | damage | The damage the projectile will inflict. |
Vec3 | position | The start position in the shape's local space. |
Vec3 | velocity | The direction and velocity. |
Shape | source | The shape that is the source of the projectile. |
integer | delay=0 | The 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:
Type | Name | Description |
---|---|---|
Vec3 | firePos | The position the projectile is fired from. |
Vec3 | targetPos | The position the projectile should hit. |
number | velocity | The fire velocity of the projectile. |
number | gravity | The gravity ( positive down ). |
Returns:
Type | Description |
---|---|
Vec3, Vec3 | The low angle solution; The high angle solution. |