user generated rooms are saved to json now

fruitual
Stephen Kerr 1 year ago
parent 67ef82eec6
commit c4951d1fff

@ -1,26 +1 @@
{
"Studio": {
"name": "Studio",
"description": "You're in a cosy studio. It smells a bit like soup.",
"exits": {"south": "Corridor"}
},
"Office": {
"name": "Office",
"description": "You're in an office with glass windows to the corridor.",
"exits": {"east": "Corridor", "south": "artificial research station"}
},
"Corridor": {
"name": "Corridor",
"description": "You're in a short corridor with doors on three sides.",
"exits": {"north": "Studio", "south": "Aquarium", "west": "Office"}
},
"Aquarium": {
"name": "Aquarium",
"description": "You're in an underwater cavern, somehow you can breathe!",
"exits": {"north": "Corridor"}
},
"artificial research station": {
"description": "You're in the artificial research station. What happens here?",
"exits": {"north": "Office"}
}
}
{"Studio": {"name": "Studio", "description": "You're in a cosy studio. It smells a bit like soup.", "exits": {"south": "Corridor"}}, "Office": {"name": "Office", "description": "You're in an office with glass windows to the corridor.", "exits": {"east": "Corridor", "south": "artificial research station"}}, "Corridor": {"name": "Corridor", "description": "You're in a short corridor with doors on three sides.", "exits": {"north": "Studio", "south": "Aquarium", "west": "Office", "east": "tunnel"}}, "Aquarium": {"name": "Aquarium", "description": "You're in an underwater cavern, somehow you can breathe!", "exits": {"north": "Corridor"}}, "artificial research station": {"description": "You're in the artificial research station. What happens here?", "exits": {"north": "Office"}}, "tunnel": {"description": "this is a secret tunnel", "exits": {"east": "Corridor"}}}

@ -224,7 +224,7 @@ Hi there! This is the multiplayer, text-based version of the Experimental Publis
mud.send_message(id, "You dropped it")
# make command
elif command == "made":
elif command == "make":
mud.send_message(id, "You made a ")
# 'create' command
@ -294,6 +294,9 @@ Hi there! This is the multiplayer, text-based version of the Experimental Publis
# invite the player to write a description for the room
mud.send_message(id, "The room is not described yet. When you are in the room, you can use 'describe' to add a description. For example: 'describe This is the XML! It smells a bit muffy here.'")
with open("rooms.json", "w") as jsonFile:
json.dump(rooms, jsonFile)
# warn the player when the "create" command is not used in the right way
else:
mud.send_message(id, f"Sorry you cannot create a new room in that way. Try: 'create direction roomname'")
@ -309,7 +312,10 @@ Hi there! This is the multiplayer, text-based version of the Experimental Publis
current_room_name = players[id]["room"]
print("[INSPECT] current room: ", current_room_name)
rooms[new_room]["description"] = description
rooms[new_room]["description"] = description
with open("rooms.json", "w") as jsonFile:
json.dump(rooms, jsonFile)
# some other, unrecognised command
else:

Loading…
Cancel
Save