mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-01 16:20:59 +00:00
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:
parent
0452f44545
commit
88d547a88a
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue