Jump to content

Recommended Posts

@wbykos,

ModManager:GetEnabledModNames()

 

I've tried this in AddComponentPostInit("playerspawner", function ... player.ModManager:GetEnabledModNames()

 

but got error "attempt to index field 'ModManager' (a nil value)"

 

If check GLOBAL.ModManager:GetEnabledModNames() its return server modnames...need clients

Edited by wbykos

@wbykos

"ModManager" is a global value. I assume you're putting it inside your modmain.lua. If so, use

GLOBAL.ModManger:GetEnabledModNames()

But either way, it's useless in such a mod, as it only returns mods installed on your side, the server-side in this case. I'll write here if I find a way to solve your problem.

@wbykos

I think I know a good solution. You need to create a simple "toggle" mod that is installed on all of the clients (all_clients_require_mod = true) that checks whether the client has the language pack installed. I'd suggest to do it this way:

 

In your original mod's modmain, you put this:

GLOBAL.TUNING.IS_x_LANGUAGE_INSTALLED = true

Then, in the toggle mod's modmain:

AddModRPCHandler("x_languagepack", "clientcheck", function(player)    --this happens when the player has the language pack installedend)AddSimPostInit(function()    if GLOBAL.TUNING.IS_x_LANGUAGE_INSTALLED then        SendModRPCToServer(MOD_RPC.x_languagepack.clientcheck)    endend)

In this case need to do this without all_clients_require_mod = true

why? the game automatically installs the mod on all clients if someone tries to join the server.

@przemolsz,

what u did there is exactly what i said, make the clients tell u what mods are installed. but your solution only works, if @wbykos is the owner of all the languagepacks he want to include.

instead u could just use ModManager:GetEnabledModNames() to pass all the enabled languagepacks to the server.

@Seiai,

I think what he wants to do is give choice to the players, if they want to play with a language pack, then send them translated massages, otherwise use normal ones, not forcing them to download the mod.

 

And how do you want to pass all of the mod names to the server? Is there a function that lets you send strings?

 

EDIT: Okay, nevermind. I get it now. Although mod names  may sometimes differentiate, someone might have a Steam Workshop version named "workshop-491135223", somebody else a Klei forum's version of the mod - "x_languagepack". It's not a perfect solution, but we'll see what @wbykos says.

Edited by przemolsz
What i say? I say that i made mine first mod :] not without big help from this subforum


 

Conclusion that the server cant get any non default data from connected clients. And yes, przemolsz talking right, i want put default and alternate translation to server messages without intervening to client-side. At the moment its impossible but when it happens i will add English translation to mine mod :]

intervening to client-side

i wouldn't call it "intervening", u really only have the clients tell u their languagepacks via an RPC.

if u really dont like that they "have" to autoinstall the mod via "all_clients_require_mod = true", then just dont.

anyone who happens to have your mod installed, will send his info to your server, so your server can adapt.

and if they want the server to adapt, they just have the option to install your mod.

Edited by Seiai

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...