sm.projectile
Information about projectiles are located in /Data/Projectiles/ProjectileSets/projectiles.json.
Server + Client
getProjectileMass - name
sm.projectile.getProjectileMass( name )
Deprecated: Name is deprecated, use uuid instead
Returns the mass of a projectile.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The projectile's name. |
Returns:
| Type | Description |
|---|---|
| number | The mass. |
getProjectileMass - Uuid
sm.projectile.getProjectileMass( uuid )
Returns the mass of a projectile.
Parameters:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The projectile's uuid. |
Returns:
| Type | Description |
|---|---|
| number | The mass. |
getProjectileRadius
sm.projectile.getProjectileRadius( uuid )
Returns the radius of a projectile.
Parameters:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The projectile's uuid. |
Returns:
| Type | Description |
|---|---|
| number | The radius. |
harvestableProjectileAttack - name
sm.projectile.harvestableProjectileAttack(
name,
damage,
position,
velocity,
source,
delay
)
Deprecated: Name is deprecated, use uuid instead
Perform a projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The projectile's name. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in world space. |
velocity |
Vec3 | The direction and velocity. |
source |
Harvestable | The Harvestable that is the source of the projectile. |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
harvestableProjectileAttack - Uuid
sm.projectile.harvestableProjectileAttack(
uuid,
damage,
position,
velocity,
source,
delay,
acceleration,
lifetime
)
Perform a projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The projectile's uuid. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in world space. |
velocity |
Vec3 | The direction and velocity. |
source |
Harvestable | The Harvestable that is the source of the projectile. |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
acceleration (optional) |
number | The acceleration of the projectile. (Defaults to 0) |
lifetime (optional) |
integer | The max lifetime of the projectile in ticks. (Defaults to 400) |
projectileAttack - name + Player
sm.projectile.projectileAttack(
name,
damage,
position,
velocity,
source,
fakePosThird,
fakePosFirst,
delay
)
Deprecated: Name is deprecated, use uuid instead
Perform a projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The projectile's name. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position. |
velocity |
Vec3 | The direction and velocity. |
source |
Player | The player that is the source of the projectile. |
fakePosThird (optional) |
Vec3 | The visual start position in third-person. (Defaults to position) |
fakePosFirst (optional) |
Vec3 | The visual start position in first-person. (Defaults to position) |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
projectileAttack - name + Unit
sm.projectile.projectileAttack(
name,
damage,
position,
velocity,
source,
fakePosThird,
fakePosFirst,
delay
)
Deprecated: Name is deprecated, use uuid instead
Perform a projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The projectile's name. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position. |
velocity |
Vec3 | The direction and velocity. |
source |
Unit | The Unit that is the source of the projectile. |
fakePosThird (optional) |
Vec3 | The visual start position in third-person. (Defaults to position) |
fakePosFirst (optional) |
Vec3 | The visual start position in first-person. (Defaults to position) |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
projectileAttack - Uuid + Player
sm.projectile.projectileAttack(
uuid,
damage,
position,
velocity,
source,
fakePosThird,
fakePosFirst,
delay,
acceleration,
lifetime
)
Perform a projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The projectile's uuid. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position. |
velocity |
Vec3 | The direction and velocity. |
source |
Player | The player that is the source of the projectile. |
fakePosThird (optional) |
Vec3 | The visual start position in third-person. (Defaults to position) |
fakePosFirst (optional) |
Vec3 | The visual start position in first-person. (Defaults to position) |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
acceleration (optional) |
number | The acceleration of the projectile. (Defaults to 0) |
lifetime (optional) |
integer | The max lifetime of the projectile in ticks. (Defaults to 400) |
projectileAttack - Uuid + Unit
sm.projectile.projectileAttack(
uuid,
damage,
position,
velocity,
source,
fakePosThird,
fakePosFirst,
delay,
acceleration,
lifetime
)
Perform a projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The projectile's uuid. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position. |
velocity |
Vec3 | The direction and velocity. |
source |
Unit | The Unit that is the source of the projectile. |
fakePosThird (optional) |
Vec3 | The visual start position in third-person. (Defaults to position) |
fakePosFirst (optional) |
Vec3 | The visual start position in first-person. (Defaults to position) |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
acceleration (optional) |
number | The acceleration of the projectile. (Defaults to 0) |
lifetime (optional) |
integer | The max lifetime of the projectile in ticks. (Defaults to 400) |
shapeProjectileAttack - name
sm.projectile.shapeProjectileAttack(
name,
damage,
position,
velocity,
source,
delay
)
Deprecated: Name is deprecated, use uuid instead
Perform a projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The projectile's name. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in the shape's local space. |
velocity |
Vec3 | The direction and velocity. |
source |
Shape | The shape that is the source of the projectile. |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
shapeProjectileAttack - Uuid
sm.projectile.shapeProjectileAttack(
uuid,
damage,
position,
velocity,
source,
delay,
acceleration,
lifetime
)
Perform a projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The projectile's uuid. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in the shape's local space. |
velocity |
Vec3 | The direction and velocity. |
source |
Shape | The shape that is the source of the projectile. |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
acceleration (optional) |
number | The acceleration of the projectile. (Defaults to 0) |
lifetime (optional) |
integer | The max lifetime of the projectile in ticks. (Defaults to 400) |
solveBallisticArc
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:
| Name | Type | Description |
|---|---|---|
firePos |
Vec3 | The position the projectile is fired from. |
targetPos |
Vec3 | The position the projectile should hit. |
velocity |
number | The fire velocity of the projectile. |
gravity |
number | The gravity ( positive down ). |
Returns:
Server-only
customProjectileAttack - name + Player
sm.projectile.customProjectileAttack(
userdata,
name,
damage,
position,
velocity,
source,
fakePosThird,
fakePosFirst,
delay
)
Deprecated: Name is deprecated, use uuid instead
Perform a customized projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
userdata |
table | The custom user data |
name |
string | The projectile's name. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in world space. |
velocity |
Vec3 | The direction and velocity. |
source |
Player | The player that is the source of the projectile. |
fakePosThird (optional) |
Vec3 | The visual start position in third-person. (Defaults to position) |
fakePosFirst (optional) |
Vec3 | The visual start position in first-person. (Defaults to position) |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
customProjectileAttack - name + Unit
sm.projectile.customProjectileAttack(
userdata,
name,
damage,
position,
velocity,
source,
fakePosThird,
fakePosFirst,
delay
)
Deprecated: Name is deprecated, use uuid instead
Perform a customized projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
userdata |
table | The custom user data |
name |
string | The projectile's name. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in world space. |
velocity |
Vec3 | The direction and velocity. |
source |
Unit | The Unit that is the source of the projectile. |
fakePosThird (optional) |
Vec3 | The visual start position in third-person. (Defaults to position) |
fakePosFirst (optional) |
Vec3 | The visual start position in first-person. (Defaults to position) |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
customProjectileAttack - Uuid + World
sm.projectile.customProjectileAttack(
userdata,
uuid,
damage,
position,
velocity,
source,
fakePosThird,
fakePosFirst,
delay,
acceleration,
lifetime
)
Perform a customized projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
userdata |
table | The custom user data |
uuid |
Uuid | The projectile's uuid. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in world space. |
velocity |
Vec3 | The direction and velocity. |
source |
World | The world that is the source of the projectile. |
fakePosThird (optional) |
Vec3 | The visual start position in third-person. (Defaults to position) |
fakePosFirst (optional) |
Vec3 | The visual start position in first-person. (Defaults to position) |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
acceleration (optional) |
number | The acceleration of the projectile. (Defaults to 0) |
lifetime (optional) |
integer | The max lifetime of the projectile in ticks. (Defaults to 400) |
customProjectileAttack - Uuid + Player
sm.projectile.customProjectileAttack(
userdata,
uuid,
damage,
position,
velocity,
source,
fakePosThird,
fakePosFirst,
delay,
acceleration,
lifetime
)
Perform a customized projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
userdata |
table | The custom user data |
uuid |
Uuid | The projectile's uuid. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in world space. |
velocity |
Vec3 | The direction and velocity. |
source |
Player | The player that is the source of the projectile. |
fakePosThird (optional) |
Vec3 | The visual start position in third-person. (Defaults to position) |
fakePosFirst (optional) |
Vec3 | The visual start position in first-person. (Defaults to position) |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
acceleration (optional) |
number | The acceleration of the projectile. (Defaults to 0) |
lifetime (optional) |
integer | The max lifetime of the projectile in ticks. (Defaults to 400) |
customProjectileAttack - Uuid + Unit
sm.projectile.customProjectileAttack(
userdata,
uuid,
damage,
position,
velocity,
source,
fakePosThird,
fakePosFirst,
delay,
acceleration,
lifetime
)
Perform a customized projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
userdata |
table | The custom user data |
uuid |
Uuid | The projectile's uuid. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in world space. |
velocity |
Vec3 | The direction and velocity. |
source |
Unit | The Unit that is the source of the projectile. |
fakePosThird (optional) |
Vec3 | The visual start position in third-person. (Defaults to position) |
fakePosFirst (optional) |
Vec3 | The visual start position in first-person. (Defaults to position) |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
acceleration (optional) |
number | The acceleration of the projectile. (Defaults to 0) |
lifetime (optional) |
integer | The max lifetime of the projectile in ticks. (Defaults to 400) |
harvestableCustomProjectileAttack - name
sm.projectile.harvestableCustomProjectileAttack(
userdata,
name,
damage,
position,
velocity,
source,
delay
)
Deprecated: Name is deprecated, use uuid instead
Perform a customized projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
userdata |
table | The custom user data |
name |
string | The projectile's name. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in world space. |
velocity |
Vec3 | The direction and velocity. |
source |
Harvestable | The harvestable that is the source of the projectile. |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
harvestableCustomProjectileAttack - Uuid
sm.projectile.harvestableCustomProjectileAttack(
userdata,
uuid,
damage,
position,
velocity,
source,
delay,
acceleration,
lifetime
)
Perform a customized projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
userdata |
table | The custom user data |
uuid |
Uuid | The projectile's uuid. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in world space. |
velocity |
Vec3 | The direction and velocity. |
source |
Harvestable | The harvestable that is the source of the projectile. |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
acceleration (optional) |
number | The acceleration of the projectile. (Defaults to 0) |
lifetime (optional) |
integer | The max lifetime of the projectile in ticks. (Defaults to 400) |
shapeCustomProjectileAttack - name
sm.projectile.shapeCustomProjectileAttack(
userdata,
name,
damage,
position,
velocity,
source,
delay
)
Deprecated: Name is deprecated, use uuid instead
Perform a customized projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
userdata |
table | The custom user data |
name |
string | The projectile's name. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in the shape's local space. |
velocity |
Vec3 | The direction and velocity. |
source |
Shape | The shape that is the source of the projectile. |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
shapeCustomProjectileAttack - Uuid
sm.projectile.shapeCustomProjectileAttack(
userdata,
uuid,
damage,
position,
velocity,
source,
delay,
acceleration,
lifetime
)
Perform a customized projectile attack
Parameters:
| Name | Type | Description |
|---|---|---|
userdata |
table | The custom user data |
uuid |
Uuid | The projectile's uuid. |
damage |
integer | The damage the projectile will inflict. |
position |
Vec3 | The start position in the shape's local space. |
velocity |
Vec3 | The direction and velocity. |
source |
Shape | The shape that is the source of the projectile. |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
acceleration (optional) |
number | The acceleration of the projectile. (Defaults to 0) |
lifetime (optional) |
integer | The max lifetime of the projectile in ticks. (Defaults to 400) |
shapeFire - name
sm.projectile.shapeFire( shape, name, position, velocity, delay )
Deprecated: Name is deprecated, use uuid instead
Creates and fires a projectile from a Shape.
Parameters:
| Name | Type | Description |
|---|---|---|
shape |
Shape | The shape. |
name |
string | The projectile's name. |
position |
Vec3 | The start position. |
velocity |
Vec3 | The direction and velocity. |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
shapeFire - Uuid
sm.projectile.shapeFire(
shape,
uuid,
position,
velocity,
delay,
projectileAmount
)
Creates and fires a projectile from a Shape.
Parameters:
| Name | Type | Description |
|---|---|---|
shape |
Shape | The shape. |
uuid |
Uuid | The projectile's uuid. |
position |
Vec3 | The start position. |
velocity |
Vec3 | The direction and velocity. |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
projectileAmount (optional) |
integer | The amount of shots that will be fired. Uses projectile amount from json if not set (Optional, range of 0-255) |
Client-only
playerFire - name
sm.projectile.playerFire(
name,
position,
velocity,
fakePosThird,
fakePosFirst,
delay
)
Deprecated: Name is deprecated, use uuid instead
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:
| Name | Type | Description |
|---|---|---|
name |
string | The projectile's name. |
position |
Vec3 | The start position. |
velocity |
Vec3 | The direction and velocity. |
fakePosThird (optional) |
Vec3 | The visual start position in third-person. (Defaults to position) |
fakePosFirst (optional) |
Vec3 | The visual start position in first-person. (Defaults to position) |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
playerFire - Uuid
sm.projectile.playerFire(
uuid,
position,
velocity,
fakePosThird,
fakePosFirst,
delay
)
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:
| Name | Type | Description |
|---|---|---|
uuid |
Uuid | The projectile's uuid. |
position |
Vec3 | The start position. |
velocity |
Vec3 | The direction and velocity. |
fakePosThird (optional) |
Vec3 | The visual start position in third-person. (Defaults to position) |
fakePosFirst (optional) |
Vec3 | The visual start position in first-person. (Defaults to position) |
delay (optional) |
integer | The number of ticks before firing. (Defaults to 0) |
removeProjectilesWithSource - World
sm.projectile.removeProjectilesWithSource( source, delay )
Removes projectiles created by a given source. The source world must exist.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
World | The world that is the source of the projectile. |
delay (optional) |
integer | The number of ticks before destroying the projectile. (Defaults to 0) |
removeProjectilesWithSource - Player
sm.projectile.removeProjectilesWithSource( source, delay )
Removes projectiles created by a given source. The source player must exist.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
Player | The player that is the source of the projectile. |
delay (optional) |
integer | The number of ticks before destroying the projectile. (Defaults to 0) |
removeProjectilesWithSource - Character
sm.projectile.removeProjectilesWithSource( source, delay, world )
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: