game.read_file ?
Posted: Mon Jan 02, 2017 11:18 pm
there is a game.write_file(filename, data, append, for_player) method.
Is there a way to read it back in ?
Is there a way to read it back in ?
Rseding91 wrote:The standard game is not getting un-sandboxed.
I was thinking about it and had the idea that we might provide a flag that mods could use or perhaps a startup flag that would be required that enabled all of the unsafe and non-deterministic methods that aren't normally available. It would at the same time disable multiplayer and replays but this is all just ideas - I'm not sure if it would be worth the time at this point.
daniel34 wrote:If you are very experienced it is possible to patch factorio.exe, this unlocks the io lua library which you then can use in your mod to read from or write to any file: viewtopic.php?f=120&t=23655
Related: viewtopic.php?f=28&t=23519#p152528Rseding91 wrote:The standard game is not getting un-sandboxed.
I was thinking about it and had the idea that we might provide a flag that mods could use or perhaps a startup flag that would be required that enabled all of the unsafe and non-deterministic methods that aren't normally available. It would at the same time disable multiplayer and replays but this is all just ideas - I'm not sure if it would be worth the time at this point.
1) People don't know how to write incorrect code. People don't follow instructions like "Don't use this method, it will break determinism and it will desync". This has been proven time and time again.Plorntus wrote:I think the whole determinism argument is a bit of a crappy reason in my opinion. Just simply telling the user not to use it to make something happen in the game (other than loading blueprints or whatever) is enough.
Its like saying disallow mods because a user can accidentally write incorrect code (ie not using the right syntax), of course they can but as long as they know not to then it shouldnt be an issue.
Things like two way sockets or reading a file can enable some very cool things such as live online maps or telementary for the game (eg Kerbal Space Programs telamechus mod).
I guess, I dunno I just would have thought more people (especially those creating the mods) would follow what the documentation or information regarding what a method says, perhaps hiding the method behind some massive warning banner would work in the documentation, I know its a little more work for you guys but that'd seem like a nice compromise especially since there are a lot of questions asking for this. I dont see how the reporting the issue to you rather than the mod creators would be different when an unexpected issue occurs in the game because of a mod normally but I'll trust what you say is right in any case (as you'd of course know from experience).HanziQ wrote:1) People don't know how to write incorrect code. People don't follow instructions like "Don't use this method, it will break determinism and it will desync". This has been proven time and time again.Plorntus wrote:I think the whole determinism argument is a bit of a crappy reason in my opinion. Just simply telling the user not to use it to make something happen in the game (other than loading blueprints or whatever) is enough.
Its like saying disallow mods because a user can accidentally write incorrect code (ie not using the right syntax), of course they can but as long as they know not to then it shouldnt be an issue.
Things like two way sockets or reading a file can enable some very cool things such as live online maps or telementary for the game (eg Kerbal Space Programs telamechus mod).
2) When something like this happens, and someone downloads such broken mod and it breaks the game, where do they report it? To the mod author? No. To us, we have to go in, figure out whether the problem lies with our code or someone elses and send them their way. That takes a lot of our time and it's just wasteful. But it does have a simple solution - not including things like game.read_file.
Fixed that one for youHanziQ wrote:1) People don't know how to write correct code. People don't follow instructions like "Don't use this method, it will break determinism and it will desync". This has been proven time and time again.Plorntus wrote:I think the whole determinism argument is a bit of a crappy reason in my opinion. Just simply telling the user not to use it to make something happen in the game (other than loading blueprints or whatever) is enough.
Its like saying disallow mods because a user can accidentally write incorrect code (ie not using the right syntax), of course they can but as long as they know not to then it shouldnt be an issue.
Things like two way sockets or reading a file can enable some very cool things such as live online maps or telementary for the game (eg Kerbal Space Programs telamechus mod).
2) When something like this happens, and someone downloads such broken mod and it breaks the game, where do they report it? To the mod author? No. To us, we have to go in, figure out whether the problem lies with our code or someone elses and send them their way. That takes a lot of our time and it's just wasteful. But it does have a simple solution - not including things like game.read_file.
Yeah, my badorzelek wrote:Fixed that one for youHanziQ wrote:1) People don't know how to write correct code. People don't follow instructions like "Don't use this method, it will break determinism and it will desync". This has been proven time and time again.Plorntus wrote:I think the whole determinism argument is a bit of a crappy reason in my opinion. Just simply telling the user not to use it to make something happen in the game (other than loading blueprints or whatever) is enough.
Its like saying disallow mods because a user can accidentally write incorrect code (ie not using the right syntax), of course they can but as long as they know not to then it shouldnt be an issue.
Things like two way sockets or reading a file can enable some very cool things such as live online maps or telementary for the game (eg Kerbal Space Programs telamechus mod).
2) When something like this happens, and someone downloads such broken mod and it breaks the game, where do they report it? To the mod author? No. To us, we have to go in, figure out whether the problem lies with our code or someone elses and send them their way. That takes a lot of our time and it's just wasteful. But it does have a simple solution - not including things like game.read_file.
For one, the documentation is just getting up to a point where it's detailed to a point where it's useful. Just have a look at some mod-related stuff (mostly the guides) here in the forums from six months ago.Plorntus wrote:I guess, I dunno I just would have thought more people (especially those creating the mods) would follow what the documentation or information regarding what a method says, perhaps hiding the method behind some massive warning banner would work in the documentation, I know its a little more work for you guys but that'd seem like a nice compromise especially since there are a lot of questions asking for this. I dont see how the reporting the issue to you rather than the mod creators would be different when an unexpected issue occurs in the game because of a mod normally but I'll trust what you say is right in any case (as you'd of course know from experience).
You'd also hope that someone would be using the mod and realise its an issue with the mod rather than the base game providing the game worked before enabling it.
I just hope at some point perhaps later on you'd reconsider as it really would enable some cool additions to the game that you perhaps do not want to implement yourselves.