feat: Add faction-specific bot spawn commands

- Add !botnc, !bottr, !botvs commands to spawn bots of specific factions
- Modify customCommandBot to accept faction parameter
- !bot now spawns bot of player's own faction (maintains backwards compat)
- Display faction name in spawn confirmation message

Fixes: bots were spawning as player's faction instead of specified faction
This commit is contained in:
Claude 2025-11-23 05:49:50 +00:00
parent 0452f44545
commit 88d547a88a
No known key found for this signature in database
2 changed files with 16 additions and 6 deletions

View file

@ -8,7 +8,7 @@ import net.psforever.actors.session.support.{ChatFunctions, ChatOperations, Sess
import net.psforever.objects.Session
import net.psforever.packet.game.{ChatMsg, ServerType, SetChatFilterMessage}
import net.psforever.services.chat.{DefaultChannel, OutfitChannel, SquadChannel}
import net.psforever.types.ChatMessageType
import net.psforever.types.{ChatMessageType, PlanetSideEmpire}
import net.psforever.types.ChatMessageType.{CMT_TOGGLESPECTATORMODE, CMT_TOGGLE_GM}
import net.psforever.util.Config
@ -142,7 +142,10 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
case "macro" => ops.customCommandMacro(session, params)
case "progress" => ops.customCommandProgress(session, params)
case "squad" => ops.customCommandSquad(params)
case "bot" => ops.customCommandBot(session)
case "bot" => ops.customCommandBot(session, session.player.Faction)
case "botnc" => ops.customCommandBot(session, PlanetSideEmpire.NC)
case "bottr" => ops.customCommandBot(session, PlanetSideEmpire.TR)
case "botvs" => ops.customCommandBot(session, PlanetSideEmpire.VS)
case _ =>
// command was not handled
sendResponse(

View file

@ -1412,17 +1412,24 @@ class ChatOperations(
}
def customCommandBot(
session: Session
session: Session,
faction: PlanetSideEmpire.Value
): Boolean = {
val zone = session.zone
val player = session.player
val spawnPos = player.Position + Vector3(2, 2, 0) // Spawn slightly offset from player
// Use the zone's persistent BotManager
zone.BotManager ! BotManager.SpawnBot(player.Faction, spawnPos)
// Use the zone's persistent BotManager with specified faction
zone.BotManager ! BotManager.SpawnBot(faction, spawnPos)
val factionName = faction match {
case PlanetSideEmpire.TR => "TR"
case PlanetSideEmpire.NC => "NC"
case PlanetSideEmpire.VS => "VS"
case _ => "Unknown"
}
sendResponse(
ChatMsg(CMT_GMOPEN, wideContents = false, "Server", s"Spawning bot at $spawnPos", None)
ChatMsg(CMT_GMOPEN, wideContents = false, "Server", s"Spawning $factionName bot at $spawnPos", None)
)
true
}