mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-02-28 19:13:40 +00:00
can not activate or deactive spectator of gm when dead; zoning while spectator removes spectator and defaults to sanctuary
This commit is contained in:
parent
734baacbb5
commit
7e5c923fec
3 changed files with 18 additions and 24 deletions
|
|
@ -24,7 +24,7 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
|
||||
def handleChatMsg(message: ChatMsg): Unit = {
|
||||
import net.psforever.types.ChatMessageType._
|
||||
val isAlive = if (player != null) player.isAlive else false
|
||||
lazy val isAlive = avatar != null && player != null && player.isAlive
|
||||
(message.messageType, message.recipient.trim, message.contents.trim) match {
|
||||
/** Messages starting with ! are custom chat commands */
|
||||
case (_, _, contents) if contents.startsWith("!") &&
|
||||
|
|
@ -32,7 +32,7 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
|
||||
case (CMT_ANONYMOUS, _, _) => ()
|
||||
|
||||
case (CMT_TOGGLE_GM, _, contents) =>
|
||||
case (CMT_TOGGLE_GM, _, contents) if isAlive =>
|
||||
customCommandModerator(contents)
|
||||
|
||||
case (CMT_CULLWATERMARK, _, contents) =>
|
||||
|
|
@ -155,16 +155,10 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
}
|
||||
|
||||
def commandToggleSpectatorMode(contents: String): Unit = {
|
||||
val currentSpectatorActivation = {
|
||||
if (player != null) {
|
||||
val avtr = player.avatar
|
||||
player.isAlive && (avtr.permissions.canSpectate || avtr.permissions.canGM)
|
||||
} else if (avatar != null) {
|
||||
avatar.permissions.canSpectate || avatar.permissions.canGM
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} || Config.app.world.serverType == ServerType.Development
|
||||
val currentSpectatorActivation =
|
||||
avatar.permissions.canSpectate ||
|
||||
avatar.permissions.canGM ||
|
||||
Config.app.world.serverType == ServerType.Development
|
||||
contents.toLowerCase() match {
|
||||
case "on" | "o" | "" if currentSpectatorActivation && !player.spectator =>
|
||||
context.self ! SessionActor.SetMode(ops.CurrentSpectatorMode)
|
||||
|
|
@ -175,21 +169,19 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
def customCommandModerator(contents: String): Boolean = {
|
||||
if (sessionLogic.zoning.maintainInitialGmState) {
|
||||
sessionLogic.zoning.maintainInitialGmState = false
|
||||
true
|
||||
} else {
|
||||
val currentCsrActivation = (if (player != null) {
|
||||
player.isAlive && player.avatar.permissions.canGM
|
||||
} else if (avatar != null) {
|
||||
avatar.permissions.canGM
|
||||
} else {
|
||||
false
|
||||
}) || Config.app.world.serverType == ServerType.Development
|
||||
val currentCsrActivation =
|
||||
avatar.permissions.canGM ||
|
||||
Config.app.world.serverType == ServerType.Development
|
||||
contents.toLowerCase() match {
|
||||
case "on" | "o" | "" if currentCsrActivation =>
|
||||
import net.psforever.actors.session.csr.CustomerServiceRepresentativeMode
|
||||
context.self ! SessionActor.SetMode(CustomerServiceRepresentativeMode)
|
||||
case _ => ()
|
||||
true
|
||||
case _ =>
|
||||
false
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import net.psforever.objects.Session
|
|||
import net.psforever.packet.game.{ChatMsg, SetChatFilterMessage}
|
||||
import net.psforever.services.chat.SpectatorChannel
|
||||
import net.psforever.types.ChatMessageType
|
||||
import net.psforever.zones.Zones
|
||||
|
||||
import scala.collection.Seq
|
||||
|
||||
|
|
@ -78,8 +79,9 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
case (CMT_WHO | CMT_WHO_CSR | CMT_WHO_CR | CMT_WHO_PLATOONLEADERS | CMT_WHO_SQUADLEADERS | CMT_WHO_TEAMS, _, _) =>
|
||||
ops.commandWho(session)
|
||||
|
||||
case (CMT_ZONE, _, contents) =>
|
||||
ops.commandZone(message, contents)
|
||||
case (CMT_ZONE, _, _) =>
|
||||
commandToggleSpectatorMode(contents = "off")
|
||||
ops.commandZone(message, Zones.sanctuaryZoneId(player.Faction))
|
||||
|
||||
case (CMT_WARP, _, contents) =>
|
||||
ops.commandWarp(session, message, contents)
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ class SpectatorModeLogic(data: SessionData) extends ModeLogic {
|
|||
sendResponse(ChatMsg(ChatMessageType.CMT_TOGGLESPECTATORMODE, "off"))
|
||||
sendResponse(ChatMsg(ChatMessageType.UNK_227, "@SpectatorDisabled"))
|
||||
zoning.zoneReload = true
|
||||
zoning.spawn.randomRespawn(0.seconds) //to sanctuary
|
||||
zoning.spawn.randomRespawn(10.milliseconds) //to sanctuary
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue