Page 1 of 1
Factorio API Ideas
Posted: Thu Mar 02, 2017 8:28 am
by Karutoh
If you as the reader have a few more ideas or one of these ideas already exist within the game, feel free to make a reply. I'll think of more later.
New Ideas
- "Disable" widgets so that users cannot interface with them, but is still visible, just faded.
- New events such as, on_player_open_inventory, and on_player_open_main_menu.
- Able to create drop down menu widgets. (Already Implemented as of 0.15)
- Before force merge, and after force merge events. (ssilk's idea)
- Able to create slider widgets.
- Label widget can word wrap.
- Force colors?
Re: Factorio API Ideas
Posted: Thu Mar 02, 2017 9:44 am
by Rseding91
•A more advanced graphical user interface for advanced users in the api. For example being able to manipulate the size and position of gui.
Size and position are not part of the game state and as such can't be read/changed through the Lua API.
I added support for the drop-down widget type in 0.15. As for the "message box" - it can already be done through any mod so no.
Re: Factorio API Ideas
Posted: Thu Mar 02, 2017 9:57 am
by ssilk
Karutoh wrote:
[*]Change game.merge_forces(string source, string destination) to game.merge_forces(string source, string destination, bool mergeResearch). This will allow you to merge research as well.[/*]
Mergeing can be done in several ways and makes no sense to introduce just one. Such a merge needs to be programmed out. Which is no problem, just a programmers work.
what makes more sense is to have an event (...before_merge, ...after_merge) that is called when two forces are merged. Isn't that already the case?
[*]New events such as, on_player_open_inventory, and on_player_open_main_menu.[/*]
Sorry, I don't see the use case for that. Maybe you can explain that...
Re: Factorio API Ideas
Posted: Thu Mar 02, 2017 10:16 am
by Karutoh
ssilk wrote:Karutoh wrote:
[*]Change game.merge_forces(string source, string destination) to game.merge_forces(string source, string destination, bool mergeResearch). This will allow you to merge research as well.[/*]
Mergeing can be done in several ways and makes no sense to introduce just one. Such a merge needs to be programmed out. Which is no problem, just a programmers work.
what makes more sense is to have an event (...before_merge, ...after_merge) that is called when two forces are merged. Isn't that already the case?
[*]New events such as, on_player_open_inventory, and on_player_open_main_menu.[/*]
Sorry, I don't see the use case for that. Maybe you can explain that...
I do like that idea better, however there still needs to be a way to get, and modify the research of a force, I'll move it up to the top. As an example for
on_player_open_inventory and
on_player_open_main_menu, I have a mod that's mainly a gui, the idea would be to close this gui if the player were to open the main menu, or open their inventory.
Re: Factorio API Ideas
Posted: Thu Mar 02, 2017 11:53 am
by Klonan
Karutoh wrote:ssilk wrote:Karutoh wrote:
[*]Change game.merge_forces(string source, string destination) to game.merge_forces(string source, string destination, bool mergeResearch). This will allow you to merge research as well.[/*]
Mergeing can be done in several ways and makes no sense to introduce just one. Such a merge needs to be programmed out. Which is no problem, just a programmers work.
what makes more sense is to have an event (...before_merge, ...after_merge) that is called when two forces are merged. Isn't that already the case?
[*]New events such as, on_player_open_inventory, and on_player_open_main_menu.[/*]
Sorry, I don't see the use case for that. Maybe you can explain that...
I do like that idea better, however there still needs to be a way to get, and modify the research of a force, I'll move it up to the top. As an example for
on_player_open_inventory and
on_player_open_main_menu, I have a mod that's mainly a gui, the idea would be to close this gui if the player were to open the main menu, or open their inventory.
You can easily modify the technologies of a force:
http://lua-api.factorio.com/latest/LuaF ... chnologies
Re: Factorio API Ideas
Posted: Thu Mar 02, 2017 10:17 pm
by Karutoh
Then that solves that problem, thank you.
Re: Factorio API Ideas
Posted: Thu Mar 09, 2017 8:09 am
by Karutoh
This doesn't work, all the values in that array are
nil. What am I missing?
Re: Factorio API Ideas
Posted: Thu Mar 09, 2017 8:49 am
by Rseding91
Karutoh wrote:
This doesn't work, all the values in that array are
nil. What am I missing?
Are you trying to iterate it with ipairs? Because that doesn't work per what the API docs page says about the "LuaCustomTable" type.
Re: Factorio API Ideas
Posted: Thu Mar 09, 2017 11:17 am
by darkfrei
Rseding91 wrote:Are you trying to iterate it with ipairs? Because that doesn't work per what the API docs page says about the "LuaCustomTable" type.
What is different between pairs and ipairs?
Re: Factorio API Ideas
Posted: Thu Mar 09, 2017 2:42 pm
by Klonan
darkfrei wrote:Rseding91 wrote:Are you trying to iterate it with ipairs? Because that doesn't work per what the API docs page says about the "LuaCustomTable" type.
What is different between pairs and ipairs?
Re: Factorio API Ideas
Posted: Thu Mar 09, 2017 11:19 pm
by Karutoh
Rseding91 wrote:Are you trying to iterate it with ipairs? Because that doesn't work per what the API docs page says about the "LuaCustomTable" type.
No I was using...
Code: Select all
for i = 0, #ply.force.technologies, 1 do
game.print(ply.force.technologies[i]);
end
I recently just did...
Code: Select all
for i, t in pairs(ply.force.technologies) do
game.print(t.name);
end
And it worked fine, I was able to modify all the technologies of a force. Why does it not "like" the index?
Re: Factorio API Ideas
Posted: Thu Mar 09, 2017 11:42 pm
by Rseding91
The technologies table keys are strings - there aren't any prototypes with integer names so when you try to index it with 1, 2, 3 and so on it doesn't find any result and returns nil.
Re: Factorio API Ideas
Posted: Fri Mar 10, 2017 12:18 am
by Karutoh
Rseding91 wrote:The technologies table keys are strings - there aren't any prototypes with integer names so when you try to index it with 1, 2, 3 and so on it doesn't find any result and returns nil.
Thank you that actually helped me understand the factorio api doc a little more.
Re: Factorio API Ideas
Posted: Fri Mar 10, 2017 4:56 pm
by darkfrei
Rseding91 wrote:The technologies table keys are strings - there aren't any prototypes with integer names so when you try to index it with 1, 2, 3 and so on it doesn't find any result and returns nil.
It was s the same like ipairs?
Re: Factorio API Ideas
Posted: Sat Mar 11, 2017 6:45 pm
by Mjo20031
sslik did'nt you say one suggestion per per thread?
Re: Factorio API Ideas
Posted: Sun Mar 12, 2017 8:27 am
by ssilk
Mjo20031 wrote:sslik did'nt you say one suggestion per per thread?
1. Call me ssilk, SSilk or ßilk. ßilk is the word to express a state that cannot exists due to the rules (in that case of German language a word that begins with sharp s), but exists, cause it is possible. And don't ask me about the "ilk".
2. Who am I to take my sword and cut a useful discussion?
3. I "remind" sometimes to the rules, but what I have in mind is to let the users think about useful behavior.
4. Yes, but I said also, there is rule number zero, which allows to change rules, if it makes sense.
Re: Factorio API Ideas
Posted: Sun Mar 12, 2017 1:44 pm
by Mjo20031
1. Call me ssilk, SSilk or ßilk. ßilk is the word to express a state that cannot exists due to the rules (in that case of German language a word that begins with sharp s), but exists, cause it is possible. And don't ask me about the "ilk".
2. Who am I to take my sword and cut a useful discussion?
3. I "remind" sometimes to the rules, but what I have in mind is to let the users think about useful behavior.
4. Yes, but I said also, there is rule number zero, which allows to change rules, if it makes sense.
kk sorry m8