AlexMog / Longship

Valheim Dedicated server Fixes, Optimizations and High-Level API
MIT License
29 stars 3 forks source link

[Bug] Commands only listen to messages if it's been shouted #12

Open Hi-ImKyle opened 3 years ago

Hi-ImKyle commented 3 years ago

The title explains the majority. Whether this is just a byproduct of my BepInEx port or just down to the wrong chat method being hooked. I'll only know if I ask, though I'd prefer discussions being enabled on this repo so I don't clog the Issues with issues that aren't issues.

In-Game: image

Server Console:

[Info   :  Longship] [Chat] Kyle: I have arrived!
[Info   :  Longship] [Chat] Kyle: /server
[Info   :  Longship] Player Kyle, executed command: /server

Notice that there is no "test" chat message just before the "/server" one.

I did try and chat the chat patch to use Talker.RPC_Say() but to no avail, that seems to get nothing at all.

AlexMog commented 3 years ago

Hello and thanks for your bug report ! It is not a bug but a feature that is not currently available. Both /s and normal chat messages are not executed in the same way, Valheim uses routing mechanisms that are verry special and a little complicated to use. I'll explain: So first of all, that is the part where the client manages messages to send (it's important to note that it is the client that decides WHO will receive the message, and not the server, the server will transfer the message to the client that is targeted by the sending client, which makes it very tricky) image

So, what happens here it that the Server is also targetted when messaged are sent with the ZRoutedRpc.Everybody route is used to send the message, that's why my strategy was to listen on the RPC_ChatMessage method, but this method is not called on the server part if the server is not the target. And the only way to make this work would be to override the routing system of their network library, which I am planning to do but it will take me some time to do, that's why I've decided to start by providing more feature before starting to work on this specific part, until then, commands will need to pass by the /s command unfortunately !

I am also retro-engineering the way they use to execute commands, so this may evolve in the next days !

EDIT: RPC_Say will not work cause the server is still not targetted by the view, because the view will only consider players that are near the view !

Hi-ImKyle commented 3 years ago

Ok noted.

Just a FYI, if you need it, I forked and created a BepInEx branch on my repo. If you're unsure on how BepInEx works anyway, you may do a way better job but might help :) :+1:

AlexMog commented 3 years ago

Thanks, I'll take a look at it :)