sm.projectile
Information about projectiles are located in `/Data/Projectiles/ProjectileSets/projectiles.json`.
Functions:
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:
| 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? | The visual start position in third-person. (Defaults to position) |
| Vec3 | fakePosFirst? | The visual start position in first-person. (Defaults to position) |
| integer | delay? | 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:
| 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? | The visual start position in third-person. (Defaults to position) |
| Vec3 | fakePosFirst? | The visual start position in first-person. (Defaults to position) |
| integer | delay? | 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:
| 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. |
| World | source | The world that is the source of the projectile. |
| Vec3 | fakePosThird? | The visual start position in third-person. (Defaults to position) |
| Vec3 | fakePosFirst? | The visual start position in first-person. (Defaults to position) |
| integer | delay? | The number of ticks before firing. (Defaults to 0) |
| number | acceleration? | The acceleration of the projectile. (Defaults to 0) |
| integer | lifetime? | 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:
| 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? | The visual start position in third-person. (Defaults to position) |
| Vec3 | fakePosFirst? | The visual start position in first-person. (Defaults to position) |
| integer | delay? | The number of ticks before firing. (Defaults to 0) |
| number | acceleration? | The acceleration of the projectile. (Defaults to 0) |
| integer | lifetime? | 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:
| 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? | The visual start position in third-person. (Defaults to position) |
| Vec3 | fakePosFirst? | The visual start position in first-person. (Defaults to position) |
| integer | delay? | The number of ticks before firing. (Defaults to 0) |
| number | acceleration? | The acceleration of the projectile. (Defaults to 0) |
| integer | lifetime? | 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:
| 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.getProjectileRadius(uuid)
Returns the radius of a projectile.
Parameters:
| Type | Name | Description |
|---|---|---|
| Uuid | uuid | The projectile's uuid. |
Returns:
| Type | Description |
|---|---|
| number | The 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:
| 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? | 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:
| 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? | The number of ticks before firing. (Defaults to 0) |
| number | acceleration? | The acceleration of the projectile. (Defaults to 0) |
| integer | lifetime? | 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:
| 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? | 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:
| 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? | The number of ticks before firing. (Defaults to 0) |
| number | acceleration? | The acceleration of the projectile. (Defaults to 0) |
| integer | lifetime? | 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:
| Type | Name | Description |
|---|---|---|
| string | name | The projectile's name. |
| Vec3 | position | The start position. |
| Vec3 | velocity | The direction and velocity. |
| Vec3 | fakePosThird? | The visual start position in third-person. (Defaults to position) |
| Vec3 | fakePosFirst? | The visual start position in first-person. (Defaults to position) |
| integer | delay? | 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:
| Type | Name | Description |
|---|---|---|
| Uuid | uuid | The projectile's uuid. |
| Vec3 | position | The start position. |
| Vec3 | velocity | The direction and velocity. |
| Vec3 | fakePosThird? | The visual start position in third-person. (Defaults to position) |
| Vec3 | fakePosFirst? | The visual start position in first-person. (Defaults to position) |
| integer | delay? | 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:
| 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? | The visual start position in third-person. (Defaults to position) |
| Vec3 | fakePosFirst? | The visual start position in first-person. (Defaults to position) |
| integer | delay? | 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:
| 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? | The visual start position in third-person. (Defaults to position) |
| Vec3 | fakePosFirst? | The visual start position in first-person. (Defaults to position) |
| integer | delay? | 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:
| 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? | The visual start position in third-person. (Defaults to position) |
| Vec3 | fakePosFirst? | The visual start position in first-person. (Defaults to position) |
| integer | delay? | The number of ticks before firing. (Defaults to 0) |
| number | acceleration? | The acceleration of the projectile. (Defaults to 0) |
| integer | lifetime? | 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:
| 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? | The visual start position in third-person. (Defaults to position) |
| Vec3 | fakePosFirst? | The visual start position in first-person. (Defaults to position) |
| integer | delay? | The number of ticks before firing. (Defaults to 0) |
| number | acceleration? | The acceleration of the projectile. (Defaults to 0) |
| integer | lifetime? | 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:
| Type | Name | Description |
|---|---|---|
| World | source | The world that is the source of the projectile. |
| integer | delay? | 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:
| Type | Name | Description |
|---|---|---|
| Player | source | The player that is the source of the projectile. |
| integer | delay? | 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:
| Type | Name | Description |
|---|---|---|
| Character | source | The Character that is the source of the projectile. |
| integer | delay? | The number of ticks before destroying the projectile. (Defaults to 0) |
| World | world? | 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:
| 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? | 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:
| 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? | The number of ticks before firing. (Defaults to 0) |
| number | acceleration? | The acceleration of the projectile. (Defaults to 0) |
| integer | lifetime? | 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:
| 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? | 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:
| 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? | The number of ticks before firing. (Defaults to 0) |
| integer | projectileAmount? | 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:
| 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? | 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:
| 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? | The number of ticks before firing. (Defaults to 0) |
| number | acceleration? | The acceleration of the projectile. (Defaults to 0) |
| integer | lifetime? | 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:
| 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. |