Skip to content

atl/sm/projectile

import "atl/sm/projectile"

Firing projectiles (sm.projectile). Damage is dealt by the game when a projectile hits.

func Attack(projectile sm.Uuid, damage int, position, velocity sm.Vec3, source atl.Wrapper, o Options)

Fires a projectile from source (a player, unit or other object).

func CustomAttack(customData atl.Value, projectile sm.Uuid, damage int, position, velocity sm.Vec3,
source atl.Wrapper, o Options)

[server] Fires a projectile carrying customData to whatever it hits.

func ShapeAttack(projectile sm.Uuid, damage int, position, velocity sm.Vec3, source sm.Shape, o Options)

Fires a projectile from a shape.

func ShapeCustomAttack(customData atl.Value, projectile sm.Uuid, damage int, position, velocity sm.Vec3,
source sm.Shape, o Options)

[server] Fires a projectile carrying customData from a shape.

func HarvestableAttack(projectile sm.Uuid, damage int, position, velocity sm.Vec3, source sm.Harvestable,
o Options)

Fires a projectile from a harvestable.

func HarvestableCustomAttack(customData atl.Value, projectile sm.Uuid, damage int, position, velocity sm.Vec3,
source sm.Harvestable, o Options)

[server] Fires a projectile carrying customData from a harvestable.

func PlayerFire(projectile sm.Uuid, position, velocity sm.Vec3, o Options)

[client] Fires a projectile from the local player.

func ShapeFire(shape sm.Shape, projectile sm.Uuid, position, velocity sm.Vec3, delay, amount *int)

[server] Fires a projectile from a shape, optionally amount at once.

func RemoveWithSource(source atl.Wrapper, delay *int)

Removes projectiles fired by source, optionally after a delay.

func RemoveWithSourceIn(source sm.Character, delay *int, world sm.World)

Removes projectiles fired by a character in a given world.

func Mass(projectile sm.Uuid) float64
func Radius(projectile sm.Uuid) float64

A projectile type's mass and radius.

type Options struct {
FakePosThird *sm.Vec3
FakePosFirst *sm.Vec3
Delay *int
Acceleration *float64
Lifetime *int
}

Optional projectile settings. FakePos* set where the projectile appears to start in third / first person; Delay and Lifetime are in ticks.

type Arc struct {
Low, High sm.Vec3
}

The two launch velocities that hit a target: a low and a high arc.

func SolveBallisticArc(from, target sm.Vec3, velocity, gravity float64) (Arc, bool)

Solves the launch velocities that hit target from from at a given speed; false if out of reach.