Crate airmash_protocol

Crate airmash_protocol 

Source
Expand description

Protocol definitions for AIRMASH. This crate provides a strongly typed interface for communicating with an airmash server. It also provides an implementation of the airmash v5 protocol along with serde definitions for all interface structs. This is enough to communicate with any existing airmash server over a websocket connection.

§Library Usage

The library is designed to be straightforward to use. First construct the appropriate packet from either server packets or client packets. From there you can serialize it to bytes via v5::serialize.

let packet = ClientPacket::from(Key {
  seq: 0,
  key: KeyCode::Fire,
  state: true
});

let bytes = airmash_protocol::v5::serialize(&packet)?;
// ... send bytes to server

Note that while the individual packet types are serializable individually the only types expected to be passed between clients and servers are ServerPacket and ClientPacket.

For deserialization you can use v5::deserialize on any byte slice.

let bytes: Vec<u8> = get_some_bytes();
let packet: ClientPacket = airmash_protocol::v5::deserialize(&bytes)?;
// ... do stuff with packet

Modules§

client
Packets that the client sends to the server.
server
Packets that the server sends to the client.
v5
Serialization and deserialization for the airmash v5 protocol.

Structs§

EnumValueOutOfRangeError
Attempted to convert an enum from a value but the value didn’t map to any possible enum value.
ServerKeyState
All possible “keys” that a player can have activated.
Upgrades
Upgrade info that a client needs to know about to calculate movement. This also includes the shielded state of the player.

Enums§

ClientPacket
All possible client packets.
CommandReplyType
Specifies whether the debug reply to a command should open a popup or be displayed in the chat window.
DespawnType
Details on how the mob despawned.
ErrorType
All error codes that can be sent to the client.
FirewallStatus
This is used to control whether the firewall exists in BTR.
FlagCode
All player flags currently available within the game.
FlagUpdateType
Flag update type
GameType
Game Type.
KeyCode
The key that’s had it’s state changed.
LeaveHorizonType
Indicates the type of entity that just left the player’s horizon.
MobType
Types of all mobs present in the game.
PlaneType
Used to indicate the type of plane that the packet refers to.
PlayerLevelType
Indicate whether a player levelled up, or has just logged in and their level is being communicated to the client.
PlayerStatus
Flag for indicating whether a player is alive or dead.
PowerupType
The type of powerup effect that a player has.
ServerCustomType
Specific identifiers for server custom messages.
ServerMessageType
Type specifier for server banner messages.
ServerPacket
All possible server packets.
UpgradeType
All upgrade types.

Type Aliases§

Accel
A 2D vector of AccelScalars.
AccelScalar
Unit of acceleration: Distance / Time^2.
Distance
On-map distances.
Energy
Energy unit.
EnergyRegen
Unit of Energy / Time.
Flag
Health
Health unit.
HealthRegen
Unit of Health / Time.
Level
Mob
Player
Position
A 2D vector of Distances.
Rotation
Unit for rotations (in radians).
RotationRate
Unit of angular velocity: Rotation / Time.
Score
Speed
Unit of velocity: Distance / Time.
Team
Time
Time unit. (1 unit of time ~= 16.667ms)
Velocity
A 2D vector of Speeds.