Page 1 of 1

[Solved] Need help with data.lua

Posted: Wed Jul 22, 2015 2:37 pm
by ClayC
Hello everyone, I just started using lua scripting as I am a fan of DyTech mod and I did spend some days looking at their code etc and since the 0.12.0 was released the mod is not able to run on it so I was wondering to keep atleast 1 thing from the mod until they update the mod, which may take them a while since the mod is huge.

now I have to say that in the dytech mod I found this line
data.raw["player"]["player"].inventory_size = 100

and I intend to use this just to have something going on quickly and it should do what I want exactly. So I created a new folder named it "inventory-mod_0.1.1" and I created a file "info.json" with these contents

{
"name": "inventory-mod",
"version": "0.1.1",
"title": "Inventory Mod",
"author": "ClayC",
"contact": "http://www.factorio.com",
"homepage": "http://www.factorio.com",
"description": "Get a bigger inventory"
}

I created a control.lua and a data.lua and a prototypes folder which is empty as I saw this as a requirement on a tutorial I followed.
inside the control.lua I pasted the above mentioned line for the inventory size and I left the data.lua empty as I am not sure what to include.

I tried opening the game to see if the mod was recognized and it doesn't show up in the list, I also wasn't able to find any errors what-so-ever

What am I missing?
Any help and information is welcome,

Thanks,
ClayC

Re: Need help with data.lua

Posted: Wed Jul 22, 2015 3:03 pm
by SirRichie
Any data.raw related changes (new recipies, items, changes to inventory size) need to go to data.lua (or it's variants).

control.lua is for reacting to game events (like... a chunk has been generated) and cannot modify data.raw values, as the game has already read them upon startup (so technically speaking, it can modify them, but without any effect).

Re: Need help with data.lua

Posted: Wed Jul 22, 2015 6:03 pm
by orzelek
There is an inventory mod already that does just this.

It's here: https://forums.factorio.com/forum/vie ... =91&t=5891

Re: Need help with data.lua

Posted: Wed Jul 22, 2015 9:58 pm
by ClayC
SirRichie wrote:Any data.raw related changes (new recipies, items, changes to inventory size) need to go to data.lua (or it's variants).

control.lua is for reacting to game events (like... a chunk has been generated) and cannot modify data.raw values, as the game has already read them upon startup (so technically speaking, it can modify them, but without any effect).
Then how is it achievable like what DyTech did? I am asking for learning purposes maybe I come up with some new ideas to add to the game who knows :D
orzelek wrote:There is an inventory mod already that does just this.

It's here: https://forums.factorio.com/forum/vie ... =91&t=5891
Thanks, I'll look at the way this was handled and learn from it as the inventory seems to be the easiest mode to do on this game :)

Re: Need help with data.lua

Posted: Wed Jul 22, 2015 10:19 pm
by ClayC
I found the issue after uninstalling and re-installing the game and adding the mod files back in it worked like magic hehe, there was something wrong with my game, thanks to those that tried to help :)