modifying another mod's control.lua values to a variable

Place to get help with not working mods / modding interface.
inick
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Thu Jun 16, 2016 7:36 pm
Contact:

modifying another mod's control.lua values to a variable

Post by inick »

I'm not going to be vague trying to hide what I am after. I'm also not going to hide this is my first actual mod file (NOT yet posted). I have been using the memory-storage mods (one for items, one for fluids) and have made my own personal edits in fluid-memory-storage that work just fine. I make three edits in the mod to suit my playstyle, and think since I'm going to invite others to multiplay with me, maybe I should make an addon to fluid-memory-storage.

fluid-memory-storage_1.4.6/control.lua:149 defines

Code: Select all

comfortable = 0.5 * entity.fluidbox.get_capacity(1)
I want to change only

Code: Select all

0.5
to

Code: Select all

0.85
in my addon, but since it's in control.lua (runtime), how can I get my data-updates.lua to modify this value?
I've got the other two (of three) to successfully modify with my addon, but I can't google my way to update the control.lua value of someone else's mod.

Can someone give me a clue?
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 531
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: modifying another mod's control.lua values to a variable

Post by Silari »

You can't. Every mod has it's own LUA sandbox, and they can't interact with each other that way. Really the only way a mod can interact with another one is by requiring files from a mod to copy some of its stuff, or by using an interface that a mod defined which is then called.
inick
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Thu Jun 16, 2016 7:36 pm
Contact:

Re: modifying another mod's control.lua values to a variable

Post by inick »

Ohh - the familiar "getters" and "setters" functions in a source file are familiar.

the concept of the sandbox per mod was vague because you can alter data.raw during the data phase on game init. Thought I could alter anything, just a matter of a dot in the right place or brackets and quotes!

I'll consider my options, and keep an eye on this thread too.


Thanks for the reply
FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2768
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: modifying another mod's control.lua values to a variable

Post by FuryoftheStars »

Yeah, control.lua is pretty isolated. The best way would be to see if they can move that constant to a setting. Then you could modify it without the need of a mod. :)

For reference, too, this is not (so much of) an issue with data and setting files. :twisted:
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
inick
Long Handed Inserter
Long Handed Inserter
Posts: 57
Joined: Thu Jun 16, 2016 7:36 pm
Contact:

Re: modifying another mod's control.lua values to a variable

Post by inick »

Well, I had a big brain moment tonight. I feel accomplished.

I just used Factorio's own fluid dynamics + the default value in their control.lua to influence my own wishes on it. I got it working. Now, I only need two edits to make the mod fit my playstyle. Actually was a better turnout than what I was using previously.

I don't need to edit their control.lua anymore, I don't need to pack around the files, now I just need to download my own mod to everywhere.


(for visitors.. fluid_box["base_level"] = 0.35 plus the original value 0.5 = my desired 0.85 (85%) pipe fill when using the mods)
Post Reply

Return to “Modding help”