Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is typing #3510

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Is typing #3510

wants to merge 2 commits into from

Conversation

michaelfaith84
Copy link
Contributor

Brief overview of PR changes/additions

New JS plugin listens for keydown events and messages the server if they're found. The plugin has several cleanup functions for potential stale data from disconnects. It also only updates when a say command is being used and only counts typing as words, letters, and punctuation (no F-keys, alt, etc).

Server side code isn't quite what @Griatch had in mind. I'll be refactoring it. Currently, it just targets others in the room. Also, the server doesn't keep track of anything, just relays messages. Also, the speaker isn't currently excluded because it made testing easier.

Motivation for adding to Evennia

@Griatch asked for it some time ago.

Other info (issues closed, discussion etc)

#1529

@michaelfaith84
Copy link
Contributor Author

@Griatch In terms of getting this done in a more efficient manner, it seems like a new script typeclass would be the best idea. I'm thinking of a couple of nattributes as lists. The first list would just contain the sessions that are subscribed. it would be populated when the client requests "Say" aliases. The second would be a list of dicts, maybe something like { "speaker": session, expiry: timestamp }. Am I on the right track?

Copy link
Member

@Griatch Griatch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool functionality! This is just a draft so far, so I'll just comment.
To be honest, I think a room scope for this is not a bad start (ideally one should be able to configure that scope though, so configurability (and ability to deactivate!) would be useful).

While I laid out some ideas for how to do it in the issue, I'm quite fine with a simpler implementation too.

You mention that the server only relays and don't save ... and looking at it, I think that's just fine. The less database querying going on here the better. I don't think we need to use a Script (or ServerConfig) to store anything here. What one may want to do is to collate the information and only echo it now and then - and for that one could use an in-memory cache.

# audience = ObjectDB.objects.filter(db_typeclass_path="typeclasses.characters.Character",
# db_location=session.puppet.location).exclude(db_key=session.puppet.key)

audience = ObjectDB.objects.filter(db_typeclass_path="typeclasses.characters.Character",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only filtering on Characters is a very limited thing since devs may well change the typeclass they use for characters. Maybe you are rather looking for DefaultCharacter.filter_family(...) here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants