Compare commits

...

3 Commits

Author SHA1 Message Date
Marlow Alfonso 5202255b42 fix: added help entry for the 'me' command 2023-12-07 00:16:55 +00:00
Marlow Alfonso 6094480fea fix: tweaked around the 'look' command when used on players 2023-12-07 00:13:30 +00:00
Marlow Alfonso a196290e36 feat: added emoting support with the 'me' command 2023-12-06 23:37:35 +00:00
2 changed files with 24 additions and 2 deletions

View File

@ -7,11 +7,14 @@ def help(mud, id):
mud.send_message(id, '''This are the currently available commands:
* say <message>: Says something to everyone in the room.
* go <exit>: Enters an exit.
* look: Gives a description of the room.
* look: Gives a description of the room. Use it in a players to see info
about them. Use 'me' to see info about you.
* open <exit> <room>: (Only available for the builders of the room) creates
an exit to another room.
* build <room> <return> <description>: Creates a room. The return param is
the name of an exit to come back to the current room.
* me <action>: Emotes action. Example, 'me chuckles'. Visible to everyone
in the room.
''')
@ -59,9 +62,13 @@ def look(mud, id, players, rooms, params):
for pid, pl in players.items():
if params_list[0] == "me":
mud.send_message(id, players[id]["description"])
mud.send_message(id, "species: {}"
.format(players[id]["species"]))
break
elif params_list[0] == pl["name"]:
mud.send_message(id, pl["description"])
mud.send_message(id, "species: {}"
.format(players[pid]["species"]))
return
room = rooms[players[id]["room"]]
mud.send_message(id, room["description"])
@ -107,3 +114,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))

7
run.py
View File

@ -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,