Skip to content

Method rpc annotation can define a Target Client parameter - #102

Open
TheDavSmasher wants to merge 16 commits into
NuclearPowered:masterfrom
TheDavSmasher:method-rpc-target-client
Open

TheDavSmasher wants to merge 16 commits into
NuclearPowered:masterfrom
TheDavSmasher:method-rpc-target-client

Conversation

@TheDavSmasher

@TheDavSmasher TheDavSmasher commented Jun 10, 2026 •

Copy link
Copy Markdown

Expands the existing MethodRpc annotation so a parameter of the method it is annotating can be assigned to mark the "TargetClientId" that SendRpcImmediately uses to not broadcast rpc to all.

Also added an option so the RPC is only sent to the Host of the room automatically.

@miniduikboot miniduikboot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you add a piece of example code to Reactor.Example that uses a targeted RPC?

Comment thread Reactor/Networking/Attributes/MethodRpcAttribute.cs
Comment thread Reactor/Networking/Rpc/MethodRpc.cs Outdated
il.Emit(OpCodes.Stelem_Ref);
}

if (targetClientIndex >= 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

TODO: review this IL code, as I'm not familiar with it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Poke on this

@TheDavSmasher

Copy link
Copy Markdown
Author

Done

Comment thread Reactor/Networking/Rpc/MethodRpc.cs Outdated
Comment thread Reactor/Networking/Rpc/MethodRpc.cs Outdated
Comment thread Reactor/Networking/Rpc/MethodRpc.cs Outdated

@AlchlcDvl AlchlcDvl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lgtm

@TheDavSmasher

Copy link
Copy Markdown
Author

If I can improve this (ie when I'm back home), I think a second constructor that targets the Host only would be useful (since Host-only RPCs aren't uncommon).

@XtraCube XtraCube left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@TheDavSmasher

Copy link
Copy Markdown
Author

Added a second option for the rpc to instead be sent to specifically the host since host-only targeted rpcs are common enough to warrant having it

Comment thread Reactor/Networking/Rpc/MethodRpc.cs Outdated
@TheDavSmasher

Copy link
Copy Markdown
Author

I believe unless further changes are requested, I cannot think of more for this PR

Comment thread Reactor/Networking/Rpc/MethodRpc.cs Outdated
@TheDavSmasher

Copy link
Copy Markdown
Author

waaa

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.

4 participants