What can be done with modding?
What can be done with modding?
So, I'm a little bit confused, and I figured I'd try to find out what, exactly, can and can't be done using Lua.
I've been poking around in the base 'mod' , but it all seems more like simple data definitions than any real logic.
Are there any rules of thumb, etc. in the absence of an actual reference? For example:
Can you draw your own GUIs? Direct shapes, text etc.?
Can you change the flow of items on belts and so on?
I've been poking around in the base 'mod' , but it all seems more like simple data definitions than any real logic.
Are there any rules of thumb, etc. in the absence of an actual reference? For example:
Can you draw your own GUIs? Direct shapes, text etc.?
Can you change the flow of items on belts and so on?
窮屈そうに身を屈めても今じゃ誰もがそうしてる 天井の無いECHO ROOMに誰かが僕を放り込む
君のSPEEDでもって 同じPHRASEを弾いて 冷たい時に寄り添って
君のSPEEDでもって 同じPHRASEを弾いて 冷たい時に寄り添って
Re: What can be done with modding?
Lots of things can be done with lua script, lots, and if a interface is needed for what you want to do, there may be a "workarround" for it.
A example is the turret car in my mod, turret cars cant really be done, but what I did is create a turret that doesnt collide and a car, and with the lua script every tick the turret is moved on top of the car.
Is a quite messy way, but it works.
I guess that if you have only seen base mod, you have only seen prototype definitions, because the base mod doesnt use lua script, devs can use c++
To learn more about what can be done with lua script (not only definitions) you should look other mods code, im not going to recommend my mod this time, because the code is longer, I recomend looking at FreEr's mods, because they are smaller mods that do more specific stuff, in my code you may get lost because I jump from a thing to a different one.
Now the specific questions:
Yes, you can draw custom guis, and im not sure what you mean by changing the flow of items on a belt, the speed can be changed in the definitions, they can also be made bigger in the definition and you can turn them with the lua script.
A example is the turret car in my mod, turret cars cant really be done, but what I did is create a turret that doesnt collide and a car, and with the lua script every tick the turret is moved on top of the car.
Is a quite messy way, but it works.
I guess that if you have only seen base mod, you have only seen prototype definitions, because the base mod doesnt use lua script, devs can use c++

To learn more about what can be done with lua script (not only definitions) you should look other mods code, im not going to recommend my mod this time, because the code is longer, I recomend looking at FreEr's mods, because they are smaller mods that do more specific stuff, in my code you may get lost because I jump from a thing to a different one.
Now the specific questions:
Yes, you can draw custom guis, and im not sure what you mean by changing the flow of items on a belt, the speed can be changed in the definitions, they can also be made bigger in the definition and you can turn them with the lua script.
Re: What can be done with modding?
By "flow", I mean switching lanes and so on.
I don't suppose there's any documentation?
I don't suppose there's any documentation?
窮屈そうに身を屈めても今じゃ誰もがそうしてる 天井の無いECHO ROOMに誰かが僕を放り込む
君のSPEEDでもって 同じPHRASEを弾いて 冷たい時に寄り添って
君のSPEEDでもって 同じPHRASEを弾いて 冷たい時に寄り添って
-
- Fast Inserter
- Posts: 226
- Joined: Wed Apr 30, 2014 11:17 pm
- Contact:
Re: What can be done with modding?
I'm still relatively new, but this is my answer to what I think you're asking. Someone else please chime in (especially if I'm dead wrong about anything :p ).
There are basically two areas for modding. The first is essentially object (item, entity, tech, etc) definition and occurs when Factorio loads. This is relatively static, and most mods I've seen have pretty passive lua for this section (declarations of new data). It involves modifying existing game elements or adding new ones in relatively simple, number-tweaking sorts of ways. It's where one would add new stuff: new resources, new recipes, new techs, new machines. The second area is control.lua (and any dependencies) which is run during actual gameplay, and typically contains any "real" code (branching, etc) to define the behavior of objects or game events (such as if a machine does something in a fundamentally different way than existing machines. Wind power, underground mining, etc.). In either case, both can be kind of restricted in terms of what certain types of items are hardcoded to handle, but if you look at people's mods you will see some interesting workarounds; regarding that, it's sort of trial and error at this point. (But since the game is still alpha and lots of things are still subject to change, this is kind of to be expected.)
As far as documentation, the modding wiki article and those linked in it are good places to start (and, unfortunately, end, at least as far as I know).
https://forums.factorio.com/wiki/inde ... g_Tutorial
There are basically two areas for modding. The first is essentially object (item, entity, tech, etc) definition and occurs when Factorio loads. This is relatively static, and most mods I've seen have pretty passive lua for this section (declarations of new data). It involves modifying existing game elements or adding new ones in relatively simple, number-tweaking sorts of ways. It's where one would add new stuff: new resources, new recipes, new techs, new machines. The second area is control.lua (and any dependencies) which is run during actual gameplay, and typically contains any "real" code (branching, etc) to define the behavior of objects or game events (such as if a machine does something in a fundamentally different way than existing machines. Wind power, underground mining, etc.). In either case, both can be kind of restricted in terms of what certain types of items are hardcoded to handle, but if you look at people's mods you will see some interesting workarounds; regarding that, it's sort of trial and error at this point. (But since the game is still alpha and lots of things are still subject to change, this is kind of to be expected.)
As far as documentation, the modding wiki article and those linked in it are good places to start (and, unfortunately, end, at least as far as I know).
https://forums.factorio.com/wiki/inde ... g_Tutorial
Like my mods? Check out another! Or see older, pre-0.12.0 mods.
Re: What can be done with modding?
Both answers before me are pretty great, and not just because they mentioned my stuff
The base files mostly contain the 'declarations' of items that will be available to the players (but not the actual implementations, since that's done in C++). If the devs needed an entity to do something they've done it in C++ (thus there is very very little lua code done by the base mod).
The 'real' modding is done with control.lua and to find out what is directly possible you'll need to have a look at the wiki (as already suggested), specifically at the Lua/Events which define (essentially) when you can take action and Lua/Objects which (essentially) define what actions you can take. For anything complex you are pretty much going to be employing workarounds because the C++ code is quite specific and the lua is pretty much bound to it right now (of course we all hope that it becomes more flexible over time but it is an alpha and the devs are working more on the game than the modding right now).
As previously suggested look at what other modders have done, and how they've managed it, to get more ideas of what is actually possible and the workarounds used to make it possible.
For any specific questions feel free to ask of course

The base files mostly contain the 'declarations' of items that will be available to the players (but not the actual implementations, since that's done in C++). If the devs needed an entity to do something they've done it in C++ (thus there is very very little lua code done by the base mod).
The 'real' modding is done with control.lua and to find out what is directly possible you'll need to have a look at the wiki (as already suggested), specifically at the Lua/Events which define (essentially) when you can take action and Lua/Objects which (essentially) define what actions you can take. For anything complex you are pretty much going to be employing workarounds because the C++ code is quite specific and the lua is pretty much bound to it right now (of course we all hope that it becomes more flexible over time but it is an alpha and the devs are working more on the game than the modding right now).
As previously suggested look at what other modders have done, and how they've managed it, to get more ideas of what is actually possible and the workarounds used to make it possible.
For any specific questions feel free to ask of course

First, if you haven't noticed already... the wiki IS the doc (for good or bad...), as for switching lanes, as of right now you could attempt to use lua to find the item entities on the belts (game.findentitiesfiltered{type="item-entity", area=...}) and then teleport them to where they 'should' be...but lua is significantly slower than C++ and it probably wouldn't work efficiently for such cases...robhol wrote:By "flow", I mean switching lanes and so on.
I don't suppose there's any documentation?
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me
Or drop into #factorio on irc.esper.net
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me

Or drop into #factorio on irc.esper.net
Re: What can be done with modding?
I'd like to abuse this thread to ask one simple question:
Is it possible to make a secondary power network via modding and why not?
Is it possible to make a secondary power network via modding and why not?
Re: What can be done with modding?
Please explain what you mean by secondary power network?Drury wrote:I'd like to abuse this thread to ask one simple question:
Is it possible to make a secondary power network via modding and why not?
Re: What can be done with modding?
Sure.
A bit similar to circuit network. It occupies electricity poles but it's not a part of the primary network. It's separate, it has it's own generators and it's own consumers.
A bit similar to circuit network. It occupies electricity poles but it's not a part of the primary network. It's separate, it has it's own generators and it's own consumers.
Re: What can be done with modding?
I've managed to block parts of belts by changing collision boxes in prototype definitions (https://forums.factorio.com/forum/vie ... =14&t=3657) but I've not found a way to change lane within a single entity.robhol wrote:Can you change the flow of items on belts and so on?
-
- Inserter
- Posts: 24
- Joined: Sat Apr 12, 2014 6:35 pm
- Contact:
Re: What can be done with modding?
@ Drury
By this are you wanting a second (Isolated) power network or a network-within-a-network?
For the first power grids must NOT be connected (2 grids that have no wires between them are 2 different networks).
For the 2nd DyTech has implemented this (primary, secondary, & tertiary) Power produced in order all primary supplemented by secondary supplemented by tertiary. currently only the tertiary accumulators work, hopefully fixed soon.
If you were wanting dual overlapping power grids (example: Solar A feeds only rader A while Steam plant B feeds only turret B using same power poles) ...Not available, doubt it can be done using same poles (but poles can be placed side by side, remove wires from one line, then manually connect 2nd line poles so they don't "touch" 1st line - or space poles far enough apart) this is useful for programing smart networks but could be applied to power creating parallel grids.
IRL a "Power Grid" is either on or off. Power is there or not. Sections can be shut down during low power (IRL=Rolling brown/blackouts, Factorio=Accumulator bridging 2 grids).
OH yeah I was typing a reply...got lost reading about accumulators etc.
Hope this helped... Still not quite sure what you are/were asking about
But hopefully you do!
By this are you wanting a second (Isolated) power network or a network-within-a-network?
For the first power grids must NOT be connected (2 grids that have no wires between them are 2 different networks).
For the 2nd DyTech has implemented this (primary, secondary, & tertiary) Power produced in order all primary supplemented by secondary supplemented by tertiary. currently only the tertiary accumulators work, hopefully fixed soon.
If you were wanting dual overlapping power grids (example: Solar A feeds only rader A while Steam plant B feeds only turret B using same power poles) ...Not available, doubt it can be done using same poles (but poles can be placed side by side, remove wires from one line, then manually connect 2nd line poles so they don't "touch" 1st line - or space poles far enough apart) this is useful for programing smart networks but could be applied to power creating parallel grids.
IRL a "Power Grid" is either on or off. Power is there or not. Sections can be shut down during low power (IRL=Rolling brown/blackouts, Factorio=Accumulator bridging 2 grids).


Hope this helped... Still not quite sure what you are/were asking about

Have FUN!
WARNING Factorio
Re: What can be done with modding?
Hi, i would liket to ask also if something can be done or not.
Can you define objects/items "on the fly" via mods? (a bit like blueprints, where you the object is a composition of objects, and that is also viewed on the picture?
Can you define objects/items "on the fly" via mods? (a bit like blueprints, where you the object is a composition of objects, and that is also viewed on the picture?