QtCraft API C++ classes QML types Handbook

QcHeadlessOptions Namespace

The command line of qtcraft-headless and the steps every mode shares: the world options and loading the content. More...

Header: #include <headless/QcHeadlessOptions.h>

Classes

struct Options
struct RunConfig

Variables

const int defaultTimeLimitSeconds

Functions

QString dataDirectory(const QCommandLineParser &parser, const QcHeadlessOptions::Options &options)
QString generatorRefusal(const QString &type, int version)
std::optional<QcModLoader::Result> loadContent(const QCommandLineParser &parser, const QcHeadlessOptions::Options &options)
void printError(const QString &message)
void printLines(const QStringList &lines)
std::optional<QcHeadlessOptions::RunConfig> readConfig(const QCommandLineParser &parser, const QcHeadlessOptions::Options &options)
std::optional<QcServerSettings> serverSettings(const QCommandLineParser &parser, const QcHeadlessOptions::Options &options)
QcResult<QJsonObject> worldOptionsOf(const QString &text, const QString &type, const QcContentRegistry &content)

Detailed Description

Classes

class Options

The command line options of qtcraft-headless. More...

class RunConfig

What a local or joining run starts with: the server's configuration and the time limit in seconds. More...

Variable Documentation

const int QcHeadlessOptions::defaultTimeLimitSeconds

Default of –time-limit, in seconds.

Function Documentation

QString QcHeadlessOptions::dataDirectory(const QCommandLineParser &parser, const QcHeadlessOptions::Options &options)

Returns the data directory: –data-dir of options as parser read it, else QcDataRoot.

QString QcHeadlessOptions::generatorRefusal(const QString &type, int version)

Returns why no generator could be made for a world of type and generator version version.

std::optional<QcModLoader::Result> QcHeadlessOptions::loadContent(const QCommandLineParser &parser, const QcHeadlessOptions::Options &options)

Returns the base game with the mods of –mods-dir (as parser read options), else of the data directory's mods folder (none with –no-mods); std::nullopt (after printing the reason) when it cannot be loaded.

void QcHeadlessOptions::printError(const QString &message)

Writes message as a line to standard error.

void QcHeadlessOptions::printLines(const QStringList &lines)

Writes each of lines as a line to standard output.

std::optional<QcHeadlessOptions::RunConfig> QcHeadlessOptions::readConfig(const QCommandLineParser &parser, const QcHeadlessOptions::Options &options)

Returns seed, world name, generator and its options, view distance, spawn column, game mode, generator version and the time limit as parser read them for options; std::nullopt on a bad value.

std::optional<QcServerSettings> QcHeadlessOptions::serverSettings(const QCommandLineParser &parser, const QcHeadlessOptions::Options &options)

Returns the settings of –server: the file (made with the defaults when the default file is missing), then QTCRAFT_SERVER_PASSWORD, then the options parser read; std::nullopt (after printing why) when invalid.

QcResult<QJsonObject> QcHeadlessOptions::worldOptionsOf(const QString &text, const QString &type, const QcContentRegistry &content)

Returns the world generation options of –world-options (its value text) for a world of type (decision E-917): every option, the named ones as given; without the option none (the content's values). content knows the options; an error when an option is invalid.