Add /togglemusic
- Adds /togglemusic to toggle whether music can be played in an area. CM's can still play music. - Add toggle_music option to area.ini to set the default value in an area. Default value is set to true. - Also fixes a missing period in the documentation for force_immediate. Because I noticed it.
This commit is contained in:
parent
a32cc0e27f
commit
cf1e1cfc95
@ -1665,6 +1665,13 @@ class AOClient : public QObject {
|
|||||||
*/
|
*/
|
||||||
void cmdCurrentMusic(int argc, QStringList argv);
|
void cmdCurrentMusic(int argc, QStringList argv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Toggles music playing in the current area.
|
||||||
|
*
|
||||||
|
* @details No arguments.
|
||||||
|
*/
|
||||||
|
void cmdToggleMusic(int argc, QStringList argv);
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1936,7 +1943,8 @@ class AOClient : public QObject {
|
|||||||
{"block_dj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdBlockDj}},
|
{"block_dj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdBlockDj}},
|
||||||
{"unblockdj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}},
|
{"unblockdj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}},
|
||||||
{"unblock_dj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}},
|
{"unblock_dj", {ACLFlags.value("MUTE"), 1, &AOClient::cmdUnBlockDj}},
|
||||||
{"charselect", {ACLFlags.value("NONE"), 0, &AOClient::cmdCharSelect}}
|
{"charselect", {ACLFlags.value("NONE"), 0, &AOClient::cmdCharSelect}},
|
||||||
|
{"togglemusic", {ACLFlags.value("CM"), 0, &AOClient::cmdToggleMusic}},
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -346,9 +346,14 @@ class AreaData : public QObject {
|
|||||||
QString log_type;
|
QString log_type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Whether or not to force immediate text processing in this area
|
* @brief Whether or not to force immediate text processing in this area.
|
||||||
*/
|
*/
|
||||||
bool force_immediate;
|
bool force_immediate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Whether or not music is allowed in this area. If false, only CMs can change the music.
|
||||||
|
*/
|
||||||
|
bool toggle_music;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AREA_DATA_H
|
#endif // AREA_DATA_H
|
||||||
|
@ -40,6 +40,7 @@ AreaData::AreaData(QString p_name, int p_index) :
|
|||||||
QString configured_evi_mod = areas_ini.value("evidence_mod", "FFA").toString().toLower();
|
QString configured_evi_mod = areas_ini.value("evidence_mod", "FFA").toString().toLower();
|
||||||
blankposting_allowed = areas_ini.value("blankposting_allowed","true").toBool();
|
blankposting_allowed = areas_ini.value("blankposting_allowed","true").toBool();
|
||||||
force_immediate = areas_ini.value("force_immediate", "false").toBool();
|
force_immediate = areas_ini.value("force_immediate", "false").toBool();
|
||||||
|
toggle_music = areas_ini.value("toggle_music", "true").toBool();
|
||||||
areas_ini.endGroup();
|
areas_ini.endGroup();
|
||||||
QSettings config_ini("config/config.ini", QSettings::IniFormat);
|
QSettings config_ini("config/config.ini", QSettings::IniFormat);
|
||||||
config_ini.beginGroup("Options");
|
config_ini.beginGroup("Options");
|
||||||
|
@ -82,3 +82,11 @@ void AOClient::cmdUnBlockDj(int argc, QStringList argv)
|
|||||||
}
|
}
|
||||||
target->is_dj_blocked = false;
|
target->is_dj_blocked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOClient::cmdToggleMusic(int argc, QStringList argv)
|
||||||
|
{
|
||||||
|
AreaData* area = server->areas[current_area];
|
||||||
|
area->toggle_music = !area->toggle_music;
|
||||||
|
QString state = area->toggle_music ? "allowed." : "disallowed.";
|
||||||
|
sendServerMessage("Music in this area is now " + state);
|
||||||
|
}
|
||||||
|
@ -225,6 +225,10 @@ void AOClient::pktChangeMusic(AreaData* area, int argc, QStringList argv, AOPack
|
|||||||
sendServerMessage("You are blocked from changing the music.");
|
sendServerMessage("You are blocked from changing the music.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!area->toggle_music && !checkAuth(ACLFlags.value("CM"))) {
|
||||||
|
sendServerMessage("Music is disabled in this area.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
QString effects;
|
QString effects;
|
||||||
if (argc >= 4)
|
if (argc >= 4)
|
||||||
effects = argv[3];
|
effects = argv[3];
|
||||||
|
Loading…
Reference in New Issue
Block a user