QtCraft API C++ classes QML types Handbook

QcServerVehicles Class

The vehicles of the server, minecarts (decision E-382) and boats (decision E-920), and what the server asks of both at once: a hit or a use of an entity, the input of a rider, getting out, the tick, which vehicle a player is in. More...

Header: #include <server/core/QcServerVehicles.h>

Public Functions

std::optional<QcBoatState> boatOf(const QcServerClient &client) const
QcServerBoats &boats()
const QcServerBoats &boats() const
bool hit(QcServerClient &client, quint32 id)
void leave(QcServerClient &client)
QcServerMinecarts &minecarts()
const QcServerMinecarts &minecarts() const
bool steer(QcServerClient &client, const QcPlayerInput &input)
void tick()
bool use(QcServerClient &client, quint32 id)
quint32 vehicleOf(const QcServerClient &client) const

Detailed Description

Member Function Documentation

std::optional<QcBoatState> QcServerVehicles::boatOf(const QcServerClient &client) const

Returns the state of the boat the player client drives, none for a cart or no vehicle.

QcServerBoats &QcServerVehicles::boats()

Returns the boats.

const QcServerBoats &QcServerVehicles::boats() const

Returns the boats.

bool QcServerVehicles::hit(QcServerClient &client, quint32 id)

client hits the entity id. Returns false when id is neither a cart nor a boat.

void QcServerVehicles::leave(QcServerClient &client)

Gets the player client out of whatever he is in.

QcServerMinecarts &QcServerVehicles::minecarts()

Returns the minecarts.

const QcServerMinecarts &QcServerVehicles::minecarts() const

Returns the minecarts.

bool QcServerVehicles::steer(QcServerClient &client, const QcPlayerInput &input)

Takes input of client as a rider or driver. Returns false when the player is in no vehicle (the input moves him).

void QcServerVehicles::tick()

Moves the carts, then the boats.

bool QcServerVehicles::use(QcServerClient &client, quint32 id)

client uses the entity id. Returns false when id is neither a cart nor a boat; a player in a vehicle uses no cart or boat.

quint32 QcServerVehicles::vehicleOf(const QcServerClient &client) const

Returns the entity id of the cart or boat the player client is in, 0 for none.