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

Lack of any kind of API for receiving packets, or appending mod-scale scripts with plugins #251

Closed
BasedUser opened this issue Aug 20, 2020 · 4 comments

Comments

@BasedUser
Copy link
Contributor

To this day, people still have to replace ClientBeginStep to, say, detect when more than one emote is sent per tick. I can think of many more uses for such an API, to detect say, leaving players or player deaths, point captures, etc. (such an api could probably prevent replacing whole swaths of scripts, making many possible plugins compatible with each other again)

@BasedUser BasedUser changed the title Lack of any kind of API for receiving packets Lack of any kind of API for receiving packets, or appending mod-scale scripts with plugins Aug 20, 2020
@Medo42
Copy link
Contributor

Medo42 commented Aug 20, 2020

Here's my suggestion:

  • have a script "registerClientMessageInterceptor" which takes a string-script (or another type of callback) as argument as well as a list of message types it wants to intercept, and an argument that says if the interceptor should run before or after the message processing or if it replaces the normal message processing. It returns an opaque value which can be passed into "unregisterClientMessageObserver" to undo the effect. Multiple Before and After interceptors are allowed on a message type, but having more than one Replacement interceptor is an error.
  • The interceptor is called at the appropriate time, and it takes the message type (and for replacement interceptors, the socket) as arguments.
  • Before interceptors are called in reverse order of registration. After interceptors are called in forward order of registration.

Unsure right now what makes a good callback in the absence of being able to register new scripts - could use a simple string that is run with execute_string, or an instance which will get User Event 1 invoked on it. Right now I feel like the string is probably the better option (simpler).

Does this sound like it allows what you want?

@BasedUser
Copy link
Contributor Author

BasedUser commented Aug 20, 2020

Absolutely! Although, an instance would allow however many plugins to add onto it, since you can add to userevents with object_event_add

For the public record, the reason I needed to hook to CHAT_BUBBLE packets is to make a certain emote chat plugin that bypasses any the lack of serversent plugins, using emotes as a binary payload. You may find better uses.

@Medo42
Copy link
Contributor

Medo42 commented Oct 19, 2020

Can you explain a bit more about that emote chat plugin? I started implementing this but I'm now questioning how useful my approach actually is, so it would be good to understand your plan a bit better.

@Medo42
Copy link
Contributor

Medo42 commented Apr 24, 2021

As far as I remember, we discussed this and the main motivation behind this API was to create a very convoluted data channel for chat. Since the plan is to integrate a chat into vanilla anyway, this won't really be needed.

@Medo42 Medo42 closed this as completed Apr 24, 2021
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

No branches or pull requests

2 participants