How Can I Make A Custom Annotation Plugin?

Godot Version

Godot 4.7.2

Question

Hi okay, so I want to make a plugin that uses a custom annotation like the @abstract method type or the @rpc method type. More specifically like @rpc. With rpc functions, you can use a special function called (roughly) multiplayer.get_sender_id() where, outside of RPC functions, the value returned would be 0, but inside of them, it would get the multiplayer sender id.

The specific plugin I’m trying to make isn’t very relevant but I’ll include it in case. I need an annotation that’s something like @silent_reciever() that silently gives the following function the calling node as a hidden last parameter called something like sender_node. By default the type sender_node would take would be “Node” or “Object” but can be specified in the parenthesis. But it’s also different from the rpc example I mentioned earlier because it HAS to be a parameter as I want static functions to be able to silently recieve the sending node too.

(this is mostly to just deal with the laziness of inputing “self” everytime i want to use a relavent function)

It’s not possible to add custom annotations. There’s an open proposal for it:

The @rpc annotation is just a shorthand for Node.rpc_config() internally. multiplayter.get_sender_id() just returns the state at the point of calling the rpc method.

I don’t think what you want to do is possible.

ahh I see, it was very weird to see there not being anything about it but I mean that makes sense, thank you for the response.