mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-03 04:00:20 +00:00
feat: Add !locrec command and fix weapon firing flow for tracers
- Add !locrec [note] command to log player coordinates to server log Format: LOCREC: PlayerName @ zone | x=X y=Y z=Z | optional note This enables coordinate capture for arena/tower mapping via /log - Remove test firing-at-spawn code, keep proper combat flow: 1. Target acquired -> wait recognition time 2. Start firing (sets ChangeFireStateMessage_Start for tracers) 3. Fire until burst ends or target lost 4. Stop firing (sets ChangeFireStateMessage_Stop) Tracers now work because firing flag is properly set before shooting!
This commit is contained in:
parent
dc81207366
commit
19568f9d38
3 changed files with 26 additions and 8 deletions
|
|
@ -201,14 +201,7 @@ class BotManager(zone: Zone) extends Actor {
|
|||
)
|
||||
|
||||
// Weapon is already drawn (DrawnSlot set before LoadPlayer packet)
|
||||
// TEST: Start firing immediately to see if tracers appear
|
||||
player.Holsters()(2).Equipment.collect { case t: Tool => t }.foreach { weapon =>
|
||||
zone.LocalEvents ! LocalServiceMessage(
|
||||
zone.id,
|
||||
LocalAction.SendResponse(ChangeFireStateMessage_Start(weapon.GUID))
|
||||
)
|
||||
log.info(s"Bot '$name' weapon firing flag set for tracer test")
|
||||
}
|
||||
// Firing flag will be set when bot acquires a target and starts combat
|
||||
|
||||
// Initialize movement state
|
||||
val moveAngle = random.nextFloat() * 360f
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ class ChatLogic(val ops: ChatOperations, implicit val context: ActorContext) ext
|
|||
case "botvs" => ops.customCommandBot(session, PlanetSideEmpire.VS)
|
||||
case "boton" => ops.customCommandBotAI(session, enabled = true)
|
||||
case "botoff" => ops.customCommandBotAI(session, enabled = false)
|
||||
case "locrec" => ops.customCommandLocRec(session, params)
|
||||
case _ =>
|
||||
// command was not handled
|
||||
sendResponse(
|
||||
|
|
|
|||
|
|
@ -1449,6 +1449,30 @@ class ChatOperations(
|
|||
true
|
||||
}
|
||||
|
||||
/**
|
||||
* Log player coordinates to server log for arena/map data capture.
|
||||
* Usage: !locrec [optional note]
|
||||
* Output goes to server log (captured by /log) not to chat.
|
||||
*/
|
||||
def customCommandLocRec(
|
||||
session: Session,
|
||||
params: Seq[String]
|
||||
): Boolean = {
|
||||
val player = session.player
|
||||
val pos = player.Position
|
||||
val note = if (params.nonEmpty && params.head.nonEmpty) params.mkString(" ") else ""
|
||||
val noteStr = if (note.nonEmpty) s" | $note" else ""
|
||||
|
||||
// Log to server log (this gets captured by /log command)
|
||||
log.info(s"LOCREC: ${player.Name} @ ${session.zone.id} | x=${pos.x} y=${pos.y} z=${pos.z}$noteStr")
|
||||
|
||||
// Also send confirmation to player
|
||||
sendResponse(
|
||||
ChatMsg(CMT_GMOPEN, wideContents = false, "Server", s"Logged: (${pos.x}, ${pos.y}, ${pos.z})$noteStr", None)
|
||||
)
|
||||
true
|
||||
}
|
||||
|
||||
override protected[session] def stop(): Unit = {
|
||||
silenceTimer.cancel()
|
||||
chatService ! ChatService.LeaveAllChannels(chatServiceAdapter)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue