Compare commits

...

2 Commits

Author SHA1 Message Date
Marlow Alfonso 5df58feb31 feat: added human-readable runtime logs 2023-11-17 18:39:32 +00:00
Marlow Alfonso 23268488f9 feat: added error message when attempting a wrong login 2023-11-17 18:10:32 +00:00
1 changed files with 8 additions and 0 deletions

8
run.py
View File

@ -86,6 +86,7 @@ def add_player(id, name, species, description, room = "Lobby"):
"description": description,
"room": room
}
print("{} connected as '{}'".format(id, name))
def update():
# Update the server
@ -99,11 +100,13 @@ def update():
Welcome to the UNIX.dog MUCK!!
Type help for a list of commands
''')
print("{} joined the waitlist".format(id))
# Remove disconected players from the list
for id in mud.get_disconnected_players():
if id not in players:
continue
print("{}('{}') disconnected".format(id, players[id]["name"]))
for pid, pl in players.items():
mud.send_message(pid, "{} quit the game".format(players[id]["name"]))
@ -144,6 +147,11 @@ You can log in to your character typing:
add_player(id, name, pl["species"], pl["description"], pl["room"])
waitlist.pop(id)
break
else:
found = False
for name, pl in characters.items():
if params_list[0] == name: found = True
if not found: mud.send_message(id, "Character '{}' not found".format(params_list[0]))
else:
mud.send_message(id, "Unknown command " + command)