popstarfreas / Dimensions

The load-balancing and routing service for Terraria Servers
MIT License
42 stars 16 forks source link

How to disable currentTerrariaVersion in config?It cause some problem when some plugins check player version. #95

Closed ACaiCat closed 2 years ago

ACaiCat commented 2 years ago
 ```

The currentTerrariaVersion in config makes some plugins check player version wrongly. Plugins check the player version normally when player join the fisrst Server.But when play use command to enter anther server,all plugins's player version check result is currentTerrariaVersion(230).It cause PC player's client version is changed into 1.4.0.5(230),but the server version is 1.4.3.2.It causes many bugs. Last week,I turn to a lot of people who understand TShock programming in China.Almost everyone thinks that it is currentTerrariaVersion in config.js problem, not @Moneylover3246‘s Crossplay.But they have not time to further research Dimensions.So I ask help for you. Chinese players just use 1.4.0.5 and 1.4.3.2.So we must use CrossPlay to allows for cross-platform play. Dimensions is the most stable multi world I've ever seen, so I'm not like giving up using it.Could you share a solution or help me modify the code?

ACaiCat commented 2 years ago

The "加入了多人运动" means "have joined" . "正在连接" means “Connecting” IMG_20220407_185426 IMG_20220407_185045 IMG_20220407_184405

popstarfreas commented 2 years ago

The currentTerrariaVersion is used when switching for all players. Are you saying you want to use the client version instead?

ACaiCat commented 2 years ago

Yes

popstarfreas commented 2 years ago

Option 1 (Extension): You could create an extension to read and force the client's own version in the connect request packets (similar to MCL in a way), e.g. https://github.com/popstarfreas/dimensions-mcl/blob/6fdfeaa01a665c7c04d93f14bdf34e53317dc481/app/priorclienthandler.ts#L44-L62 is where MCL for 1412 and above rewrites to 1.4.1.1, which could be changed to store the version of the client and then force it for every new connect request sent by the same client.

Option 2 (Dimensions): Where currentTerrariaVersion is used: https://github.com/popstarfreas/Dimensions/blob/dev/app/node_modules/dimensions/client.ts#L445-L449

You can replace it with the client version, but you also need to obtain that information which dimensions does not currently, but you could add it: https://github.com/popstarfreas/Dimensions/blob/dev/app/node_modules/dimensions/clientpackethandler.ts#L49-L66 in there is where client packets are parsed, you can just add one for connect request and store the version in the client object.

If you go for option 2, it might be worth making a PR for it so that the config option is not necessary anymore. Of course if you are not a programmer than possibly I can do option 2 myself at some point.

ACaiCat commented 2 years ago

OK,I will have a try.Thank you for you answer.

ACaiCat commented 2 years ago

I seem to have failed.I don't know how to add one for connect request.

ACaiCat commented 2 years ago

I think that I must fix it as soon as possible because players on my server is a little angry.Could you help me do option 2?

popstarfreas commented 2 years ago

I'll see what I can do.