add ability to force immediate text processing

This commit is contained in:
in1tiate 2021-04-14 16:32:24 -05:00
parent 853e6e3ff4
commit 6ed4909088
6 changed files with 37 additions and 8 deletions

View File

@ -4,10 +4,12 @@ protected_area=true
iniswap_allowed=false
evidence_mod=cm
blankposting_allowed=true
force_immediate=true
[1:Courtroom 1]
background=gs4
protected_area=false
iniswap_allowed=true
evidence_mod=ffa
blankposting_allowed=true
blankposting_allowed=true
force_immediate=false

View File

@ -1142,7 +1142,7 @@ class AOClient : public QObject {
*
* @iscommand
*/
void cmdAllow_Blankposting(int argc, QStringList argv);
void cmdAllowBlankposting(int argc, QStringList argv);
///@}
@ -1528,6 +1528,15 @@ class AOClient : public QObject {
*/
void cmdBanInfo(int argc, QStringList argv);
/**
* @brief Toggles immediate text processing in the current area.
*
* @details No arguments.
*
* @iscommand
*/
void cmdForceImmediate(int argc, QStringList argv);
///@}
/**
@ -1751,7 +1760,8 @@ class AOClient : public QObject {
{"8ball", {ACLFlags.value("NONE"), 1, &AOClient::cmd8Ball}},
{"lm", {ACLFlags.value("MODCHAT"), 1, &AOClient::cmdLM}},
{"judgelog", {ACLFlags.value("CM"), 0, &AOClient::cmdJudgeLog}},
{"allow_blankposting", {ACLFlags.value("MODCHAT"), 0, &AOClient::cmdAllow_Blankposting}},
{"allowblankposting", {ACLFlags.value("MODCHAT"), 0, &AOClient::cmdAllowBlankposting}},
{"allow_blankposting", {ACLFlags.value("MODCHAT"), 0, &AOClient::cmdAllowBlankposting}},
{"gimp", {ACLFlags.value("MUTE"), 1, &AOClient::cmdGimp}},
{"ungimp", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnGimp}},
{"baninfo", {ACLFlags.value("BAN"), 1, &AOClient::cmdBanInfo}},
@ -1765,6 +1775,7 @@ class AOClient : public QObject {
{"undisemvowel", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnDisemvowel}},
{"shake", {ACLFlags.value("MUTE"), 1, &AOClient::cmdShake}},
{"unshake", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnShake}},
{"forceimmediate", {ACLFlags.value("CM"), 1, &AOClient::cmdForceImmediate}},
};
/**

View File

@ -344,6 +344,11 @@ class AreaData : public QObject {
* @brief The value of logger in config.ini.
*/
QString log_type;
/**
* @brief Whether or not to force immediate text processing in this area
*/
bool force_immediate;
};
#endif // AREA_DATA_H

View File

@ -39,6 +39,7 @@ AreaData::AreaData(QString p_name, int p_index) :
bg_locked = areas_ini.value("bg_locked", "false").toBool();
QString configured_evi_mod = areas_ini.value("evidence_mod", "FFA").toString().toLower();
blankposting_allowed = areas_ini.value("blankposting_allowed","true").toBool();
force_immediate = areas_ini.value("force_immediate", "false").toBool();
areas_ini.endGroup();
QSettings config_ini("config/config.ini", QSettings::IniFormat);
config_ini.beginGroup("Options");

View File

@ -1276,7 +1276,7 @@ void AOClient::cmdJudgeLog(int argc, QStringList argv)
}
}
void AOClient::cmdAllow_Blankposting(int argc, QStringList argv)
void AOClient::cmdAllowBlankposting(int argc, QStringList argv)
{
QString sender_name = ooc_name;
AreaData* area = server->areas[current_area];
@ -1521,6 +1521,14 @@ void AOClient::cmdUnShake(int argc, QStringList argv)
target->is_shaken = false;
}
void AOClient::cmdForceImmediate(int argc, QStringList argv)
{
AreaData* area = server->areas[current_area];
area->force_immediate = !area->force_immediate;
QString state = area->force_immediate ? "on." : "off.";
sendServerMessage("Forced immediate text processing in this area is now " + state);
}
QStringList AOClient::buildAreaList(int area_idx)
{
QStringList entries;

View File

@ -594,11 +594,13 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
}
args.append(other_flip);
// noninterrupting preanim
int ni_pa = incoming_args[18].toInt();
if (ni_pa != 1 && ni_pa != 0)
// immediate text processing
int immediate = incoming_args[18].toInt();
if (area->force_immediate)
immediate = 1;
if (immediate != 1 && immediate != 0)
return invalid;
args.append(QString::number(ni_pa));
args.append(QString::number(immediate));
}
// 2.8 packet extensions