What a ship can throw besides its cannon shot: torpedoes, smart and heat missiles, mines, and the laser.
A missile is a shot with a :kind — :torpedo flies straight, :smart turns toward
the nearest enemy, :heat toward the nearest ship that is thrusting — and a mine is a
shot that never moves and explodes on any ship but its owner's, once armed. steer/4 turns a
missile each tick; laser/3 finds the first ship along a ship's heading.
ExPilot.Weapons.missile(ship, :smart, next_id, settings)
ExPilot.Weapons.mine(ship, next_id)
ExPilot.Weapons.laser(ship, ships, grid)
Summary
Functions
Whether shot is a mine that has had its second to arm.
The beam ship fires along its heading: {from, to, hit} where hit is the first
living ship on the line within range, or nil, and to is where the beam stops — at
that ship, at a wall, or at full range.
A mine dropped where ship is, armed after fuse seconds (a second by default).
A missile of kind leaving ship along its heading.
Turn a homing missile toward its target for dt seconds; other shots are unchanged.
Types
Functions
Whether shot is a mine that has had its second to arm.
@spec laser(ExPilot.Ship.t(), [ExPilot.Ship.t()], Cauldron2D.Collision.grid()) :: {Cauldron2D.Body.point(), Cauldron2D.Body.point(), ExPilot.Ship.t() | nil}
The beam ship fires along its heading: {from, to, hit} where hit is the first
living ship on the line within range, or nil, and to is where the beam stops — at
that ship, at a wall, or at full range.
@spec mine(ExPilot.Ship.t(), pos_integer(), float()) :: map()
A mine dropped where ship is, armed after fuse seconds (a second by default).
@spec missile(ExPilot.Ship.t(), :torpedo | :smart | :heat, pos_integer(), map()) :: map()
A missile of kind leaving ship along its heading.
@spec steer(map(), [ExPilot.Ship.t()], float(), float()) :: map()
Turn a homing missile toward its target for dt seconds; other shots are unchanged.