Jump to content

Recommended Posts

@Jjmarco, more details on what you are wanting to do is needed. Please be specific because of the following.

 

If you want to adjust items such as components or health values, etc. that only needs to be modified on the server side. If you are wanting to modify the client's UI, then I understand.

  • Developer

Hello, I have a question about mod configs:

 

If both the client and the host run the same mod, is it possible for the client to get the host's mod config?

I want to be able to override the client's mod config with the host's.

 

Thanks in advance  :wilson_vforvictory:

I think PeterA worked on this :-) I'll send him this topic !

Edited by Diabu

@Kzisor, I want to modify the client's UI depending on the host's config of the mod.

When the host disables a part of the mod through the config, it disables a server-side part of it, which results in a part of the UI being redondant.

This is why I want to be able to get the host's config, to synchronize the change to the client, which may have a different mod config.

 

Sorry if I was unclear.

 

@Diabu, great, thanks!

@Kzisor, I want to modify the client's UI depending on the host's config of the mod.

When the host disables a part of the mod through the config, it disables a server-side part of it, which results in a part of the UI being redondant.

This is why I want to be able to get the host's config, to synchronize the change to the client, which may have a different mod config.

 

Sorry if I was unclear.

 

@Diabu, great, thanks!

 

I think I have the code to accomplish that without needing the host's config settings.

--Example:inst.screenshakeevent = net_event(inst.GUID, "screenshake")inst:ListenForEvent("screenshake", OnScreenShake) --Servers can push this and it will trigger on clientsinst.screenshakeevent:push()

The theory is that on your server you want to push the event only when the section of code is enabled. Otherwise it won't be activated on the clients side.

  • Developer

@Jjmarco,as Diabu mentioned, I've implemented a solution to this into the game (yet to be released). When you join a server, you'll download the mod configuration of any mod that is specified as "all_clients_require_mod = true" in the modinfo.

 

An update with this will be coming out soon (hopefully this coming week) that also includes support for dedicated servers to specify mod configs, and a better user experience when server mods are out of date.

@Kzisor, while trying to implement your solution and looking for more information about net_event, I noticed that there was a net_bool netvar.

Wouldn't it be simpler to just use that? Considering it will never change during the play session, client would just have to read the net_bool set by the host and act accordingly.

 

Something along these lines:

self.isThisTrue = net_bool(self.inst.GUID, "is_this_true")if TheWorld.ismastersim then    self.isThisTrue:set(GetModConfigData("Option1"))endif self.isThisTrue:value() then -- Do stuffend

Would that work?

..When you join a server, you'll download the mod configuration of any mod that is specified as "all_clients_require_mod = true" in the modinfo...

 

@PeterA,

Does that mean client side configs get overwritten by server side, or can you still access the client side configs as well? because some mods might require a server side component but you still want each client to configure it for themselves.

 

So you should be able to access both config versions.

  • Developer

@Sarcen, that's a good question! Currently it's implemented such that if you have temp config data from the server, the mod will read that data before it reads the local data. I should be able to add a flag so that you can request the local vs the host's config. Then your mod can use whatever logic it wants for determining which configuration to use.

 

As rezecib also mentioned, I can't really think of a good use case for this, but it's a fairly simple change and I can imagine it might be helpful in some scenarios. I'll add that in! :) Thanks for the feedback! 

I was actually wondering about that, that's great now that it will be added!

 

An example of a use would be a mod in which we want the server-side code to be configured by the server, but the client-side code, such as some UI components, to be configured by clients. This would give a much more customizable mod. :-)

 

@Kzisor, Ah, I see. I'll check the sticked post, thanks!

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...