OpenFactorioServerManager / factorio-server-manager

A tool to help manage Factorio multiplayer servers including mods and save games.
MIT License
541 stars 130 forks source link

The file I modified in the base of factorio was restored to its original state #317

Open Quu77 opened 2 years ago

Quu77 commented 2 years ago

I modified two Lua files (entities.lua, mining drill. Lua) in the base / protocols / entity / directory of factorio, but the server was shut down abnormally after running for more than ten hours. The server can be started normally after restarting docker, but the two files I modified were restored to the original state. What caused this problem, How can I prevent this problem from happening again

Mattie112 commented 2 years ago

Can you explain how you changed those files? And what cmd do you use to start (or really what volumes are mounted)?

knoxfighter commented 2 years ago

When you start the container factori is redownloaded and installed again. This is done to allow autoupdating and changing the version with just a simple restart/rebuild. Therefore changes in those files are removed. You can try to put the files into a volume, but i don't think that will make it work.

Quu77 commented 2 years ago

您能解释一下您是如何更改这些文件的吗?您使用什么 cmd 来启动(或者实际上安装了哪些卷)?

I just modified the parameters in the configuration game of these two files. I use Linux for operation and use docker stop container ID docker start container ID

Quu77 commented 2 years ago

当您启动容器时,factori 会重新下载并再次安装。这样做是为了允许通过简单的重新启动/重建来自动更新和更改版本。因此,这些文件中的更改将被删除。您可以尝试将文件放入一个卷中,但我认为这不会使其工作。

Do you mean that I put this file in another directory to modify its loading

Quu77 commented 2 years ago

当您启动容器时,factori 会重新下载并再次安装。这样做是为了允许通过简单的重新启动/重建来自动更新和更改版本。因此,这些文件中的更改将被删除。您可以尝试将文件放入一个卷中,但我认为这不会使其工作。

Or is there any way I can prevent docker from downloading and installing these files again when I start it

Mattie112 commented 2 years ago

Ah I see that it is indeed always downloaded. In this case indeed binding it as a volume won't work. @Quu77 can you not pack your changes in a mod then it would work?

If you are willing to code you can fork this project and remove this method docker/entrypoint.sh:21

Perhaps a solution that at least partially resolves it would be to first check the current version if it already matches then no need to redownload. But yeah with an update your changes will then be gone again.

Quu77 commented 2 years ago

啊,我看到它确实总是被下载。在这种情况下,确实将其绑定为一个卷是行不通的。@Quu77你能不把你的改变打包到一个模组里然后它会起作用吗?

如果你愿意编码,你可以分叉这个项目并删除这个方法docker/entrypoint.sh:21

也许至少部分解决它的解决方案是首先检查当前版本,如果它已经匹配,则无需重新下载。但是,是的,随着更新,您的更改将再次消失。

OK, thank you very much. I'll try to recompile the code

Quu77 commented 2 years ago

Ah I see that it is indeed always downloaded. In this case indeed binding it as a volume won't work. @Quu77 can you not pack your changes in a mod then it would work?

If you are willing to code you can fork this project and remove this method docker/entrypoint.sh:21

Perhaps a solution that at least partially resolves it would be to first check the current version if it already matches then no need to redownload. But yeah with an update your changes will then be gone again.

Thank you very much. I have solved this problem @Mattie112

mroote commented 2 years ago

Glad you got it working @Quu77 thanks for helping @Mattie112!

I think we could add a environment variable that would prevent the redownloading of the Factorio binary. Then we would also have to save the downloaded Factorio artifacts in a volume so the changes to the Factorio files could persist through restarts of the container.

knoxfighter commented 2 years ago

The filesystem is kept inbetween restarts, it is only removed when rebuilding the container. So that the saving is not an issue.

mroote commented 2 years ago

Nice in that case we can just add an environment variable to disable the auto downloading.

knoxfighter commented 2 years ago

We could also change the update script, so that it checks the factorio version on startup and then only downloads something, when it is not found or a different version. Would also save some downloading time.

Quu77 commented 2 years ago

我们还可以更改更新脚本,使其在启动时检查 factorio 版本,然后仅在未找到或其他版本时下载某些内容。还可以节省一些下载时间。

Great idea. Thank you for your proposal @knoxfighter

Quu77 commented 2 years ago

很高兴你得到它的工作@Quu77感谢@Mattie112 的帮助!

我认为我们可以添加一个环境变量来防止重新下载 Factorio 二进制文件。然后我们还必须将下载的 Factorio 工件保存在一个卷中,以便对 Factorio 文件的更改可以在容器重新启动时持续存在。

Thank you for developing such a great project @mroote

Mattie112 commented 2 years ago

My personal opinion:

I think it would be strange to have a flag that disables downloading as it is really an edge-case that you want to manually edit server files. I think it would be a bit confusing to have that available. But: checking for the version and not download if you have it already would be a great idea. Buy hey that's just my 2 cents XD

And just out of interest @Quu77 wouldn't it be possible to pack your changes into a mod?

Quu77 commented 2 years ago

My personal opinion:

I think it would be strange to have a flag that disables downloading as it is really an edge-case that you want to manually edit server files. I think it would be a bit confusing to have that available. But: checking for the version and not download if you have it already would be a great idea. Buy hey that's just my 2 cents XD

And just out of interest @Quu77 wouldn't it be possible to pack your changes into a mod?

Thank you. I have solved this problem now