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§
- Enum
Value OutOf Range Error - Attempted to convert an enum from a value but the value didn’t map to any possible enum value.
- Server
KeyState - 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§
- Client
Packet - All possible client packets.
- Command
Reply Type - Specifies whether the debug reply to a command should open a popup or be displayed in the chat window.
- Despawn
Type - Details on how the mob despawned.
- Error
Type - All error codes that can be sent to the client.
- Firewall
Status - This is used to control whether the firewall exists in BTR.
- Flag
Code - All player flags currently available within the game.
- Flag
Update Type - Flag update type
- Game
Type - Game Type.
- KeyCode
- The key that’s had it’s state changed.
- Leave
Horizon Type - Indicates the type of entity that just left the player’s horizon.
- MobType
- Types of all mobs present in the game.
- Plane
Type - Used to indicate the type of plane that the packet refers to.
- Player
Level Type - Indicate whether a player levelled up, or has just logged in and their level is being communicated to the client.
- Player
Status - Flag for indicating whether a player is alive or dead.
- Powerup
Type - The type of powerup effect that a player has.
- Server
Custom Type - Specific identifiers for server custom messages.
- Server
Message Type - Type specifier for server banner messages.
- Server
Packet - All possible server packets.
- Upgrade
Type - All upgrade types.
Type Aliases§
- Accel
- A 2D vector of
AccelScalar
s. - Accel
Scalar - Unit of acceleration:
Distance / Time^2
. - Distance
- On-map distances.
- Energy
- Energy unit.
- Energy
Regen - Unit of
Energy / Time
. - Flag
- Health
- Health unit.
- Health
Regen - Unit of
Health / Time
. - Level
- Mob
- Player
- Position
- A 2D vector of
Distance
s. - Rotation
- Unit for rotations (in radians).
- Rotation
Rate - 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
Speed
s.