Factorio API Ideas

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
Karutoh
Burner Inserter
Burner Inserter
Posts: 9
Joined: Thu Mar 02, 2017 7:58 am
Contact:

Factorio API Ideas

Post 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?
Last edited by Karutoh on Thu Mar 02, 2017 10:18 pm, edited 19 times in total.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14824
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Factorio API Ideas

Post 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.
If you want to get ahold of me I'm almost always on Discord.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Factorio API Ideas

Post 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... :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
Karutoh
Burner Inserter
Burner Inserter
Posts: 9
Joined: Thu Mar 02, 2017 7:58 am
Contact:

Re: Factorio API Ideas

Post 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.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5316
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Factorio API Ideas

Post 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
User avatar
Karutoh
Burner Inserter
Burner Inserter
Posts: 9
Joined: Thu Mar 02, 2017 7:58 am
Contact:

Re: Factorio API Ideas

Post by Karutoh »

Then that solves that problem, thank you.
User avatar
Karutoh
Burner Inserter
Burner Inserter
Posts: 9
Joined: Thu Mar 02, 2017 7:58 am
Contact:

Re: Factorio API Ideas

Post by Karutoh »

Klonan wrote: You can easily modify the technologies of a force:
http://lua-api.factorio.com/latest/LuaF ... chnologies
This doesn't work, all the values in that array are nil. What am I missing?
Rseding91
Factorio Staff
Factorio Staff
Posts: 14824
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Factorio API Ideas

Post by Rseding91 »

Karutoh wrote:
Klonan wrote: You can easily modify the technologies of a force:
http://lua-api.factorio.com/latest/LuaF ... chnologies
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.
If you want to get ahold of me I'm almost always on Discord.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Factorio API Ideas

Post 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?
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5316
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Factorio API Ideas

Post 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?
Image
User avatar
Karutoh
Burner Inserter
Burner Inserter
Posts: 9
Joined: Thu Mar 02, 2017 7:58 am
Contact:

Re: Factorio API Ideas

Post 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?
Rseding91
Factorio Staff
Factorio Staff
Posts: 14824
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Factorio API Ideas

Post 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.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Karutoh
Burner Inserter
Burner Inserter
Posts: 9
Joined: Thu Mar 02, 2017 7:58 am
Contact:

Re: Factorio API Ideas

Post 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.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Factorio API Ideas

Post 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?
Mjo20031
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sat Mar 11, 2017 5:51 pm
Contact:

Re: Factorio API Ideas

Post by Mjo20031 »

sslik did'nt you say one suggestion per per thread?
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Factorio API Ideas

Post 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. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Mjo20031
Burner Inserter
Burner Inserter
Posts: 8
Joined: Sat Mar 11, 2017 5:51 pm
Contact:

Re: Factorio API Ideas

Post 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
Post Reply

Return to “Modding interface requests”