QuakeServer.Builtins.Write (quake_server v0.1.0)

Copy Markdown View Source

The message-writing builtins (WriteByte to WriteEntity, numbers 52 to 59, and FTE's WriteFloat, WriteInt and WriteUnterminatedString), which append bytes to a message in FTE's encodings.

The first argument names the destination: 4 (MSG_MULTICAST) builds the message the next multicast sends, 5 (MSG_ENTITY) the entity update SendEntity is writing; every other destination reaches the one player through the server's message stream, which QuakeServer.Messages reads back.

Coordinates are eighths of a unit in 16 bits and angles 256ths of a turn in a byte, or, on a server started with coords: :float, 32-bit floats and 65536ths of a turn in 16 bits; eighths and turns are rounded half away from zero, as FTE's MSG_ToCoord and MSG_WriteAngle round them.

Summary

Functions

Append bytes to destination destination.

A coordinate as WriteCoord writes it on server.

Three coordinates as three WriteCoords write them on server.

Append value written by builtin number to the destination the call names.

Functions

append(server, arg2, bytes)

Append bytes to destination destination.

coord(server, value)

@spec coord(QuakeServer.Server.t(), number()) :: binary()

A coordinate as WriteCoord writes it on server.

coords(server, arg)

@spec coords(QuakeServer.Server.t(), {number(), number(), number()}) :: binary()

Three coordinates as three WriteCoords write them on server.

write(server, number, value)

@spec write(QuakeServer.Server.t(), 52..59 | integer() | String.t(), QuakeC.value()) ::
  QuakeServer.Server.t()

Append value written by builtin number to the destination the call names.