adding way to allow bang-commands that only a gm would have access to for everyone

This commit is contained in:
Fate-JH 2024-03-29 00:29:15 -04:00
parent 197c37315e
commit 941228974c
3 changed files with 9 additions and 5 deletions

View file

@ -542,9 +542,12 @@ network {
}
development {
# List of GM commands available to everyone
# List of GM commands made available to everyone
# Values are `ChatMessageType` members, for example: [CMT_ADDBATTLEEXPERIENCE, CMT_CAPTUREBASE]
unprivileged-gm-commands = []
# List of GM bang commands made available to everyone
# Since the commands come in as plain chat preceded by a bang (!) character, values are the names of the commands
unprivileged-gm-bang-commands = []
net-sim {
# Enable artificial packet unreliability. Used for development testing.

View file

@ -723,7 +723,7 @@ class ChatActor(
(message.messageType, message.recipient.trim, message.contents.trim) match {
/** Messages starting with ! are custom chat commands */
case (_, _, contents) if contents.startsWith("!") &&
customCommandMessages(message, session, chatService, cluster, gmCommandAllowed) => ()
customCommandMessages(message, session, chatService, cluster) => ()
case (CMT_FLY, recipient, contents) if gmCommandAllowed =>
val (token, flying) = contents match {
@ -1492,8 +1492,7 @@ class ChatActor(
message: ChatMsg,
session: Session,
chatService: ActorRef[ChatService.Command],
cluster: ActorRef[InterstellarClusterService.Command],
gmCommandAllowed: Boolean
cluster: ActorRef[InterstellarClusterService.Command]
): Boolean = {
val contents = message.contents
if (contents.startsWith("!")) {
@ -1501,8 +1500,9 @@ class ChatActor(
case a :: b => (a, b)
case _ => ("", Seq(""))
}
val gmBangCommandAllowed = session.account.gm || Config.app.development.unprivilegedGmBangCommands.contains(command)
//try gm commands
val tryGmCommandResult = if (gmCommandAllowed) {
val tryGmCommandResult = if (gmBangCommandAllowed) {
command match {
case "whitetext" => Some(customCommandWhitetext(session, params, chatService))
case "list" => Some(customCommandList(session, params, message, sessionActor))

View file

@ -182,6 +182,7 @@ case class HartConfig(
case class DevelopmentConfig(
unprivilegedGmCommands: Seq[ChatMessageType],
unprivilegedGmBangCommands: Seq[String],
netSim: NetSimConfig
)