ExPilot.Gear (ExPilot v0.1.1)

Copy Markdown View Source

What a ship's items do when their keys are pressed or held, and while their effects last.

use/4 reads the ship's held actions against what it held last tick — a toggle turns on the press, a one-shot spends an item on the press, a beam works while held — and returns the ship and game changed. wear/3 runs the timed effects down.

Keys: :fire_missile and :next_missile, :drop_mine, :fire_laser, :cloak, :ecm, :transporter, :tractor and :pressor, :deflector, :phasing, :hyperjump, :emergency_shield, :emergency_thrust, :autopilot, :connector.

Summary

Functions

The actions items add to a ship's.

Whether an ECM has the ship confused this tick.

Whether two ships are on different sides.

Whether shooter can hurt victim under settings: anyone but a teammate on a map with teamimmunity.

Whether the ship's phasing lets it through walls and shots this tick.

Whether the ship is shielded this tick: by its own shield, or an emergency one.

How much harder the ship thrusts: afterburners and emergency thrust multiply it.

Apply every item key ship pressed or holds this tick.

Run the timed effects down for dt and take their running costs from the tank.

Functions

actions()

@spec actions() :: [atom()]

The actions items add to a ship's.

confused?(ship, now)

@spec confused?(ExPilot.Ship.t(), float()) :: boolean()

Whether an ECM has the ship confused this tick.

enemy?(arg1, arg2)

@spec enemy?(ExPilot.Ship.t(), ExPilot.Ship.t()) :: boolean()

Whether two ships are on different sides.

hittable?(settings, shooter, victim)

@spec hittable?(map(), ExPilot.Ship.t(), ExPilot.Ship.t()) :: boolean()

Whether shooter can hurt victim under settings: anyone but a teammate on a map with teamimmunity.

phasing?(ship, now)

@spec phasing?(ExPilot.Ship.t(), float()) :: boolean()

Whether the ship's phasing lets it through walls and shots this tick.

shielded?(ship, now)

@spec shielded?(ExPilot.Ship.t(), float()) :: boolean()

Whether the ship is shielded this tick: by its own shield, or an emergency one.

thrust_factor(ship, now)

@spec thrust_factor(ExPilot.Ship.t(), float()) :: float()

How much harder the ship thrusts: afterburners and emergency thrust multiply it.

use(arg, dt, before)

@spec use({ExPilot.Ship.t(), map()}, float(), map()) :: {ExPilot.Ship.t(), map()}

Apply every item key ship pressed or holds this tick.

wear(ship, dt, now)

@spec wear(ExPilot.Ship.t(), float(), float()) :: ExPilot.Ship.t()

Run the timed effects down for dt and take their running costs from the tank.