add firstperson variable and command toggle

This commit is contained in:
in1tiate 2021-04-30 22:58:04 -05:00
parent e44f687030
commit 69f77548a8
3 changed files with 28 additions and 4 deletions

View File

@ -161,6 +161,13 @@ class AOClient : public QObject {
*/
bool global_enabled = true;
/**
* @brief If true, the client's messages will be sent in first-person mode.
*
* @see AOClient::cmdFirstPerson
*/
bool first_person = false;
/**
* @brief If true, the client may not use in-character chat.
*/
@ -1528,6 +1535,15 @@ class AOClient : public QObject {
*/
void cmdS(int argc, QStringList argv);
/**
* @brief Toggle whether the client's messages will be sent in first person mode.
*
* @details No arguments.
*
* @iscommand
*/
void cmdFirstPerson(int argc, QStringList argv);
///@}
/**
@ -1983,7 +1999,8 @@ class AOClient : public QObject {
{"charselect", {ACLFlags.value("NONE"), 0, &AOClient::cmdCharSelect}},
{"togglemusic", {ACLFlags.value("CM"), 0, &AOClient::cmdToggleMusic}},
{"a", {ACLFlags.value("NONE"), 2, &AOClient::cmdA}},
{"s", {ACLFlags.value("NONE"), 0, &AOClient::cmdS}}
{"s", {ACLFlags.value("NONE"), 0, &AOClient::cmdS}},
{"firstperson", {ACLFlags.value("NONE"), 0, &AOClient::cmdFirstPerson}},
};
/**

View File

@ -260,14 +260,14 @@ void AOClient::cmdBgLock(int argc, QStringList argv)
{
AreaData* area = server->areas[current_area];
area->bg_locked = true;
server->broadcast(AOPacket("CT", {"Server", current_char + " locked the background.", "1"}), current_area);
server->broadcast(AOPacket("CT", {server->server_name, current_char + " locked the background.", "1"}), current_area);
}
void AOClient::cmdBgUnlock(int argc, QStringList argv)
{
AreaData* area = server->areas[current_area];
area->bg_locked = false;
server->broadcast(AOPacket("CT", {"Server", current_char + " unlocked the background.", "1"}), current_area);
server->broadcast(AOPacket("CT", {server->server_name, current_char + " unlocked the background.", "1"}), current_area);
}
void AOClient::cmdStatus(int argc, QStringList argv)
@ -291,7 +291,7 @@ void AOClient::cmdStatus(int argc, QStringList argv)
return;
}
arup(ARUPType::STATUS, true);
sendServerMessageArea(ooc_name + " changed status to " + arg);
server->broadcast(AOPacket("CT", {server->server_name, current_char + " changed status to " + arg.toUpper(), "1"}), current_area);
}
void AOClient::cmdJudgeLog(int argc, QStringList argv)

View File

@ -445,3 +445,10 @@ void AOClient::cmdS(int argc, QStringList argv)
server->broadcast(AOPacket("CT", {"[CM]" + sender_name, ooc_message}), i);
}
}
void AOClient::cmdFirstPerson(int argc, QStringList argv)
{
first_person = !first_person;
QString str_en = first_person ? "enabled" : "disabled";
sendServerMessage("First person mode " + str_en + ".");
}