From a196290e36cc74a6b00a94f59391691251f339e8 Mon Sep 17 00:00:00 2001 From: Marlow Alfonso Date: Wed, 6 Dec 2023 23:37:35 +0000 Subject: [PATCH] feat: added emoting support with the 'me' command --- commands.py | 10 ++++++++++ run.py | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/commands.py b/commands.py index 01367ac..a6762ac 100644 --- a/commands.py +++ b/commands.py @@ -107,3 +107,13 @@ def build(mud, id, players, rooms, params): "owner": players[id]["name"], "builders": [players[id]["name"]] } + + +def me(mud, id, players, rooms, params): + if not params: + mud.send_message(id, "Invalid params.") + return + for pid, pl in players.items(): + if pl["room"] == players[id]["room"]: + mud.send_message(pid, "{} {}" + .format(players[id]["name"], params)) diff --git a/run.py b/run.py index b781f61..4d829a4 100755 --- a/run.py +++ b/run.py @@ -80,6 +80,10 @@ def cmd_build(id, params): cmd.build(mud, id, players, rooms, params) +def cmd_me(id, params): + cmd.me(mud, id, players, rooms, params) + + def cmd_unknown(id, command): cmd.unknown(mud, command, id) @@ -90,7 +94,8 @@ commands = { "go": cmd_go, "say": cmd_say, "open": cmd_open, - "build": cmd_build + "build": cmd_build, + "me": cmd_me } waitlist_commands = { "help": cmd_whelp,