Closed j-f1 closed 4 years ago
Should I contribute this instead to the Evennia contrib? It seems like it isn’t specific to Ainneve.
I agree - it's really quite useful for most any game. If you try it on Ainneve and it works well, perhaps a contrib for Evennia?
Can I get some 👀 on this @chainsol?
Let me try it on my little test server, just to make sure it runs on 0.7.
Actually, I already have some concerns - I don't like the idea of modifying the webclient like this, and it already breaks the webclient.
Edit: To be clear to anyone reading this later - it's because Evennia 0.7 loads jQuery from the CDN, not the static folder.
How does this break the webclient?
It's because Evennia core, at least in 0.7, doesn't store jQuery, it's loaded from the CDN. Changing that line of course fixes it.
I’m wondering if it’s possible to install the map logic by overwriting the onText
function in a separate script. I’ll try to move the other (notification-related) change to a PR on evennia/evennia this weekend.
Nice. I'm going to wait for @Griatch or @feend78 to chime in before I approve just because I want some feedback from others about the webclient thing. I'm just wary of it...
Edit: Thinking about this, it would actually be good to be able to add "plugins" like this to the webclient anyway. Perhaps the core Evennia could support something like that...
@j-f1 I just noticed - line 70 in typeclasses/maps.py, you check the character.player, but we'll have renamed that to character.account.
@j-f1 I'd like to merge this into Develop, is it possible to fix any references to the player to match Develop, as well as to update the dictionary we talked about, of alternate characters for non-unicode clients?
I’m hoping to get to it this weekend, although I might have a chance sooner than that.
Of course, no rush! I just wanted you to know I hadn't forgotten!
@j-f1 Would you say you're ready with this? The change to a separate file for the webclient changes eases my qualms with this, and I can't see anything wrong!
@chainsol I’m good to go if you’re ready. Should I worry about support for non-Unicode clients?
Yes, if you're able to, I think that would be important - sounds like Griatch suggested character.sessions.get()[0].protocol_flags['ENCODING']
as a way to check for UTF-8/Unicode support.
@j-f1 Would it be doable to just change the map tiles to a tuple, with the unicode character and a fallback character, and then check if the session supports Unicode in the Map object itself?
That’s a good idea! I’ll take a look at that this afternoon. (~5-6 hours from now)
No rush! When you get to it, great, and we'll merge this in to the develop branch.
I’ve looked at this a few times, but I’m not sure how I should thread the result down to the map_tile
methods.
Hmm, I've been going crazy moving, but I see your troubles there. Could the map_tile functions be passed the player trying to look at them?
Edit: Oh goodness, did you mean the @map_tile
command? Or the map_tile method on the rooms?
Oh goodness, did you mean the
@map_tile
command? Or the map_tile method on the rooms?
I meant the map_tile
method on rooms.
So would that work? Pass down from the commands the session of the player looking at the map, and default to showing UTF-8/Unicode characters, fall-back to ASCII if the session doesn't support UTF-8?
ââââ MAP ââââââ
â . ~â~ . â
â . .â. . â
â * . . â
â ââââ¬ââââââ´ â
â \ â
â \^_ â
ââââââââââââââââ
Without having fallback characters, that's what the map looks like. I think we need to figure this out before merging it in. With a utf-8
encoding, it looks great, though!
I took a look at it and if we changed the character dicts to be storing tuples of the "nice" character and a fallback, that might be best? That way we can check if a character is holding the map and if so, use the fallback character if the session doesn't support utf-8
.
The map will automatically fill in as you explore Ainneve. Each time you enter a room, the map will look through all of the exits representing a compass direction and store information about the rooms on the other side. The
map
command (orlook map
) will show you your map. By default, the map is also printed every time you move to a new room. The webclient has the option to show the map in a popup window, kind of like thehelp
command. In addition, I’ve:@map_tile
command to customize the tile shown on the map for a specific roomRoad
andBridge
typeclasses that render connected lines on the map. Example:consists of:
@charcreate
The
map
command also includes amap/reset
command, which erases all of the data on the map, which is useful when testing the map.Here’s the current world map: