Add spacing between IF session exit messages
This commit is contained in:
parent
54cd0f6656
commit
f8e9ae0acc
1 changed files with 7 additions and 5 deletions
|
|
@ -340,20 +340,22 @@ async def shell(
|
||||||
elif player.mode == "if" and player.if_session:
|
elif player.mode == "if" and player.if_session:
|
||||||
response = await player.if_session.handle_input(command)
|
response = await player.if_session.handle_input(command)
|
||||||
if response.output:
|
if response.output:
|
||||||
await player.send(response.output)
|
# Ensure output ends with newline
|
||||||
|
output = response.output
|
||||||
|
if not output.endswith("\r\n"):
|
||||||
|
output += "\r\n"
|
||||||
|
await player.send(output)
|
||||||
# Broadcast to spectators unless it's an escape command
|
# Broadcast to spectators unless it's an escape command
|
||||||
if not command.startswith("::"):
|
if not command.startswith("::"):
|
||||||
spectator_msg = (
|
spectator_msg = (
|
||||||
f"[{player.name}'s terminal]\r\n"
|
f"[{player.name}'s terminal]\r\n> {command}\r\n{output}"
|
||||||
f"> {command}\r\n"
|
|
||||||
f"{response.output}"
|
|
||||||
)
|
)
|
||||||
await broadcast_to_spectators(player, spectator_msg)
|
await broadcast_to_spectators(player, spectator_msg)
|
||||||
if response.done:
|
if response.done:
|
||||||
await player.if_session.stop()
|
await player.if_session.stop()
|
||||||
player.if_session = None
|
player.if_session = None
|
||||||
player.mode_stack.pop()
|
player.mode_stack.pop()
|
||||||
await player.send("you leave the terminal.\r\n")
|
await player.send("\r\nyou leave the terminal.\r\n")
|
||||||
# Notify spectators
|
# Notify spectators
|
||||||
leave_msg = f"{player.name} steps away from the terminal.\r\n"
|
leave_msg = f"{player.name} steps away from the terminal.\r\n"
|
||||||
await broadcast_to_spectators(player, leave_msg)
|
await broadcast_to_spectators(player, leave_msg)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue