Is there a way to read personalized settings during the Prototype stage?
Is there a way to read personalized settings during the Prototype stage?
Hello,
I'm currently working on a anti-phobia mod and it needs to replace sprites with ones less triggering in order to work. However, people who don't have that phobia don't necessarily need the swapped out sprites and so I wanted to have a setting to try to keep them vanilla if possible. Is there any way of actually doing this? I currently cannot think of any way of handling this at the moment as personal settings are only accessible during the control stage of the game.
Any help is appreciated!
I'm currently working on a anti-phobia mod and it needs to replace sprites with ones less triggering in order to work. However, people who don't have that phobia don't necessarily need the swapped out sprites and so I wanted to have a setting to try to keep them vanilla if possible. Is there any way of actually doing this? I currently cannot think of any way of handling this at the moment as personal settings are only accessible during the control stage of the game.
Any help is appreciated!
Re: Is there a way to read personalized settings during the Prototype stage?
Only startup settings can be used in the data stage. Allowing per-player settings would definitely lead to desyncs.
Far as I'm aware none of the actual graphics are game state, so the game won't care if they don't match between clients (though the files need to be similar enough that they work with the exact same prototype settings) but that's not anything you can do within the modding system. You could do it by abusing the system outside of the game and have people swap in/out graphics files physically, but that would be a real pain in the butt for the end users.
Far as I'm aware none of the actual graphics are game state, so the game won't care if they don't match between clients (though the files need to be similar enough that they work with the exact same prototype settings) but that's not anything you can do within the modding system. You could do it by abusing the system outside of the game and have people swap in/out graphics files physically, but that would be a real pain in the butt for the end users.
Re: Is there a way to read personalized settings during the Prototype stage?
Yeah. I was afraid that was going to be the case. I was really hoping to avoid the file swap. I know some older mods used to have their own settings files, but I don't think that's supported any more either.
Re: Is there a way to read personalized settings during the Prototype stage?
You can still build your own settings file, but it won't be in the settings GUI then.
Re: Is there a way to read personalized settings during the Prototype stage?
What's the proper way to do that then? Or is there some sort of guide for how to do that you can link me to? As far as I can tell, the Lua io library is not included here, so using that seems out of the question. But, yeah, if you could point me toward how to properly do that, I'd appreciate it.
Re: Is there a way to read personalized settings during the Prototype stage?
just include a config.lua, which looks like that:
setting_name1 = settings_value1
setting_name2 = setting_value2
these variables are global. The file is still a norma lua code file
setting_name1 = settings_value1
setting_name2 = setting_value2
these variables are global. The file is still a norma lua code file
Re: Is there a way to read personalized settings during the Prototype stage?
This is useful information. However, I was hoping for some sort of external persistence. ie, still be able to save something from the game into an external settings/config file and read it on game start or something.
- IsaacOscar
- Filter Inserter
- Posts: 840
- Joined: Sat Nov 09, 2024 2:36 pm
- Contact:
Re: Is there a way to read personalized settings during the Prototype stage?
I'm pretty sure you can only load files from the mod directory, and there's no way to write to files there (you can write to the factorio log file, but that won't help you).
If you're happy to require your uses do a bit of work to install your mod, you could cheat by using this function https://lua-api.factorio.com/latest/cla ... write_file and make symlink from your mods folder to a lua file in script_output (making symlinks on Windows however requires admin rights for some reason)
Re: Is there a way to read personalized settings during the Prototype stage?
I take it there's no good way to read something from the script-output folder without a simlink then? Because the goal is to minimize the digging/editing of files that the user has to do.
Because, I'm thinking of doing something along the lines of:
1. Create a user setting
2. Check this event: 'on_runtime_mod_setting_changed' for my setting
3. Write out setting to some 'config.lua' file
4. On game start, read the setting in the 'config.lua' file.
At this point, step 4 seems to be the tricky part. Can the game not require or read files somehow from the script-output folder without using a simlink?
Because, I'm thinking of doing something along the lines of:
1. Create a user setting
2. Check this event: 'on_runtime_mod_setting_changed' for my setting
3. Write out setting to some 'config.lua' file
4. On game start, read the setting in the 'config.lua' file.
At this point, step 4 seems to be the tricky part. Can the game not require or read files somehow from the script-output folder without using a simlink?
Re: Is there a way to read personalized settings during the Prototype stage?
Answering the original question: it is not possible to have player specific settings affect data stage. We do our best to disallow that and if you find a way then it is going to be removed because it would be a bug. Architecture of multiplayer heavily relies on all clients and server to agree on the content of all the prototypes because they affect outcome of simulation update. If there would be a difference in prototypes, client would desync from the server. Shared settings are allowed because on join, client must have them equal to server settings.
There are some pieces of data not affecting game state (locale, sprites, sounds, hr settings) but the data produced by data stage lua must be equal.
There are some pieces of data not affecting game state (locale, sprites, sounds, hr settings) but the data produced by data stage lua must be equal.
Re: Is there a way to read personalized settings during the Prototype stage?
Well, as disappointing as that is, I thank you all for the responses. This has at the very least, been a learning experience.
- IsaacOscar
- Filter Inserter
- Posts: 840
- Joined: Sat Nov 09, 2024 2:36 pm
- Contact:
Re: Is there a way to read personalized settings during the Prototype stage?
Perhaps it's worth submitting a modding interface request for another stage between data and runtime, that is allowed to read per user settings but only write non-gameplay prototype data?
Although that would probably be a lot of work for Wube and lead to many desync bugs.
Although that would probably be a lot of work for Wube and lead to many desync bugs.