Adding in the ability to disable messages in the client
This commit is contained in:
parent
48669e96d1
commit
a6d78d9af7
15
FF1Client.py
15
FF1Client.py
|
@ -18,6 +18,8 @@ CONNECTION_TENTATIVE_STATUS = "Initial Connection Made"
|
||||||
CONNECTION_CONNECTED_STATUS = "Connected"
|
CONNECTION_CONNECTED_STATUS = "Connected"
|
||||||
CONNECTION_INITIAL_STATUS = "Connection has not been initiated"
|
CONNECTION_INITIAL_STATUS = "Connection has not been initiated"
|
||||||
|
|
||||||
|
DISPLAY_MSGS = True
|
||||||
|
|
||||||
|
|
||||||
class FF1CommandProcessor(ClientCommandProcessor):
|
class FF1CommandProcessor(ClientCommandProcessor):
|
||||||
def __init__(self, ctx: CommonContext):
|
def __init__(self, ctx: CommonContext):
|
||||||
|
@ -28,6 +30,12 @@ class FF1CommandProcessor(ClientCommandProcessor):
|
||||||
if isinstance(self.ctx, FF1Context):
|
if isinstance(self.ctx, FF1Context):
|
||||||
logger.info(f"NES Status: {self.ctx.nes_status}")
|
logger.info(f"NES Status: {self.ctx.nes_status}")
|
||||||
|
|
||||||
|
def _cmd_toggle_msgs(self):
|
||||||
|
"""Toggle displaying messages in bizhawk"""
|
||||||
|
global DISPLAY_MSGS
|
||||||
|
DISPLAY_MSGS = not DISPLAY_MSGS
|
||||||
|
logger.info(f"Messages are now {'enabled' if DISPLAY_MSGS else 'disabled'}")
|
||||||
|
|
||||||
|
|
||||||
class FF1Context(CommonContext):
|
class FF1Context(CommonContext):
|
||||||
command_processor = FF1CommandProcessor
|
command_processor = FF1CommandProcessor
|
||||||
|
@ -42,6 +50,7 @@ class FF1Context(CommonContext):
|
||||||
self.nes_status = CONNECTION_INITIAL_STATUS
|
self.nes_status = CONNECTION_INITIAL_STATUS
|
||||||
self.game = 'Final Fantasy'
|
self.game = 'Final Fantasy'
|
||||||
self.awaiting_rom = False
|
self.awaiting_rom = False
|
||||||
|
self.display_msgs = True
|
||||||
|
|
||||||
async def server_auth(self, password_requested: bool = False):
|
async def server_auth(self, password_requested: bool = False):
|
||||||
if password_requested and not self.password:
|
if password_requested and not self.password:
|
||||||
|
@ -54,7 +63,8 @@ class FF1Context(CommonContext):
|
||||||
await self.send_connect()
|
await self.send_connect()
|
||||||
|
|
||||||
def _set_message(self, msg: str, msg_id: int):
|
def _set_message(self, msg: str, msg_id: int):
|
||||||
self.messages[(time.time(), msg_id)] = msg
|
if DISPLAY_MSGS:
|
||||||
|
self.messages[(time.time(), msg_id)] = msg
|
||||||
|
|
||||||
def on_package(self, cmd: str, args: dict):
|
def on_package(self, cmd: str, args: dict):
|
||||||
if cmd == 'Connected':
|
if cmd == 'Connected':
|
||||||
|
@ -215,6 +225,9 @@ if __name__ == '__main__':
|
||||||
# Text Mode to use !hint and such with games that have no text entry
|
# Text Mode to use !hint and such with games that have no text entry
|
||||||
Utils.init_logging("FF1Client")
|
Utils.init_logging("FF1Client")
|
||||||
|
|
||||||
|
options = Utils.get_options()
|
||||||
|
DISPLAY_MSGS = options["ffr_options"]["display_msgs"]
|
||||||
|
|
||||||
async def main(args):
|
async def main(args):
|
||||||
ctx = FF1Context(args.connect, args.password)
|
ctx = FF1Context(args.connect, args.password)
|
||||||
ctx.server_task = asyncio.create_task(server_loop(ctx), name="ServerLoop")
|
ctx.server_task = asyncio.create_task(server_loop(ctx), name="ServerLoop")
|
||||||
|
|
|
@ -102,12 +102,14 @@ sm_options:
|
||||||
rom_start: true
|
rom_start: true
|
||||||
factorio_options:
|
factorio_options:
|
||||||
executable: "factorio\\bin\\x64\\factorio"
|
executable: "factorio\\bin\\x64\\factorio"
|
||||||
minecraft_options:
|
minecraft_options:
|
||||||
forge_directory: "Minecraft Forge server"
|
forge_directory: "Minecraft Forge server"
|
||||||
max_heap_size: "2G"
|
max_heap_size: "2G"
|
||||||
oot_options:
|
oot_options:
|
||||||
# File name of the OoT v1.0 ROM
|
# File name of the OoT v1.0 ROM
|
||||||
rom_file: "The Legend of Zelda - Ocarina of Time.z64"
|
rom_file: "The Legend of Zelda - Ocarina of Time.z64"
|
||||||
soe_options:
|
soe_options:
|
||||||
# File name of the SoE US ROM
|
# File name of the SoE US ROM
|
||||||
rom_file: "Secret of Evermore (USA).sfc"
|
rom_file: "Secret of Evermore (USA).sfc"
|
||||||
|
ffr_options:
|
||||||
|
display_msgs: true
|
||||||
|
|
Loading…
Reference in New Issue