Hi there!
Wanted to add that it seems like there's a more general issue with "control_up" in simulations. I have another example where the simulation calls
game.simulation.control_down { control = "mine", notify = false }
-- ... some time later ...
game.simulation.control_up { control = "mine ...
Search found 24 matches
- Sun May 25, 2025 3:08 pm
- Forum: Assigned
- Topic: [Pard] [2.0.47] Impossible to complete selection-tool usage in a simulation
- Replies: 2
- Views: 344
- Sun May 25, 2025 1:16 pm
- Forum: Documentation Improvement Requests
- Topic: Document LuaSimulation.get_widget_position
- Replies: 0
- Views: 142
Document LuaSimulation.get_widget_position
The docs for get_widget_position don't really give you much. The arguments are called data and data2, and there's no explanation on what they mean (for each type). Only source of information I can find are files like tips-and-tricks-simulations.lua but only certain kinds of examples are in there ...
- Sat May 10, 2025 2:26 pm
- Forum: Modding interface requests
- Topic: Allow loadfile() when require() would be allowed
- Replies: 4
- Views: 275
Re: Allow loadfile() when require() would be allowed
Yeah, there are several elaborate workarounds like that that I can do, but I asked because they're kind of unreasonably complicated, and it's just kind of weird to allow load() (which also can override the environment) and not loadfile(). To be honest if load() hadn't been allowed I wouldn't have ...
- Fri May 09, 2025 1:39 pm
- Forum: Modding interface requests
- Topic: Allow loadfile() when require() would be allowed
- Replies: 4
- Views: 275
Re: Allow loadfile() when require() would be allowed
require doesn't take an environment, it always loads the module with the current environment/globals. In my tests I need to control the environment, so that I can replace things like "game" and "script". loadfile (and load) have an optional third parameter that is the environment to load the module ...
- Fri May 09, 2025 1:12 pm
- Forum: Modding interface requests
- Topic: Allow loadfile() when require() would be allowed
- Replies: 4
- Views: 275
Allow loadfile() when require() would be allowed
I'd like the Lua function loadfile to work, with the same restrictions as require and load (starting at mod root, not in event handlers, etc., only in text mode, only with .lua extension, etc.). I would be OK with an extra restriction that prevents loadfile from loading files in other mods, if you ...
- Thu May 01, 2025 12:24 pm
- Forum: Assigned
- Topic: [Pard] [2.0.47] Impossible to complete selection-tool usage in a simulation
- Replies: 2
- Views: 344
[Pard] [2.0.47] Impossible to complete selection-tool usage in a simulation
Summary: When trying to "use" a custom selection tool in a simulation, it's possible to start and drag the tool, but "releasing" it does not work.
Repro
Option 1:
1a. install the attached mod in bugrepro.zip
Option 2:
1b. create a mod with the following data.lua
data:extend {
{
type ...
Repro
Option 1:
1a. install the attached mod in bugrepro.zip
Option 2:
1b. create a mod with the following data.lua
data:extend {
{
type ...
- Mon Apr 21, 2025 4:40 pm
- Forum: Resolved Requests
- Topic: A list of events which don't get raised in simulations
- Replies: 3
- Views: 285
Re: A list of events which don't get raised in simulations
Thank you, that's one less hack I have to maintain
I'll let you know after .46 is out if I still see missing events.

- Sun Apr 20, 2025 8:36 am
- Forum: Resolved Requests
- Topic: A list of events which don't get raised in simulations
- Replies: 3
- Views: 285
A list of events which don't get raised in simulations
I just noticed on_player_cursor_stack_changed isn't raised in simulations. I could imagine this being intentional (to keep simulations fast/easy to implement) but my mod's behavior depends on it. I can usually fake it, so it's not a blocker, but it would be nice to have a list of events that don't ...
- Sat Apr 19, 2025 5:14 pm
- Forum: Resolved Requests
- Topic: Is LuaSimulation.get_slot_position supposed to be 0-based?
- Replies: 1
- Views: 168
Is LuaSimulation.get_slot_position supposed to be 0-based?
LuaSimulation.get_slot_position takes a slot_index. The game interprets this as 0-based (i.e. the first slot in the inventory is slot_index 0). It means it's inconsistent with functions like LuaInventory.find_item_stack which returns a 1-based stack index.
Intentional? If yes, please document as ...
Intentional? If yes, please document as ...
- Fri Apr 18, 2025 2:44 pm
- Forum: Modding interface requests
- Topic: Does LuaGuiElement.location not work in simulations?
- Replies: 1
- Views: 188
Does LuaGuiElement.location not work in simulations?
In my experiments it seems that LuaGuiElements under screen do not respect the location property in simulations. They are always displayed at the top-left, as if location was { 0, 0 }.
Is this intentional or am I mistaken? If intentional, could you please document it ("this has no effect in ...
Is this intentional or am I mistaken? If intentional, could you please document it ("this has no effect in ...
- Fri Apr 18, 2025 2:22 pm
- Forum: Modding interface requests
- Topic: A way to tell you're in a simulation during initial control.lua
- Replies: 0
- Views: 89
A way to tell you're in a simulation during initial control.lua
The official way to tell if you're in a simulation is game.simulation . Unfortunately, game is not defined yet while control.lua is first run, so it's seemingly impossible to tell at that point if we're in a simulation or the real game.
Could you add some way to tell we're in a simulation earlier ...
Could you add some way to tell we're in a simulation earlier ...
- Mon Feb 03, 2025 9:09 pm
- Forum: Resolved Requests
- Topic: consumed_items: how does it work?
- Replies: 4
- Views: 429
Re: consumed_items: how does it work?
But the description says this modifiable. If it says "I consumed a Foo" and I modify it to "no, actually you consumed nothing", then it should have some effect, no? Perhaps I was overly optimistic about it returning the item, but there is no documentation on what this modifiable inventory does when ...
- Mon Feb 03, 2025 2:23 pm
- Forum: Resolved Requests
- Topic: consumed_items: how does it work?
- Replies: 4
- Views: 429
consumed_items: how does it work?
The 2.0 changelog says:
Changed on_built_entity event. Instead of stack/item, it passes consumed_items - modifiable stack of items used for the building.
Sounds great but I can't figure out how I'm supposed to use that. I am trying to "refund" the item used when placing the entity. Ideally the ...
Changed on_built_entity event. Instead of stack/item, it passes consumed_items - modifiable stack of items used for the building.
Sounds great but I can't figure out how I'm supposed to use that. I am trying to "refund" the item used when placing the entity. Ideally the ...
- Fri Jan 17, 2025 9:58 pm
- Forum: Resolved Requests
- Topic: Document event order
- Replies: 5
- Views: 584
Re: Document event order
Ah, I have a simpler idea that perhaps is easier to commit to.
Could you document/commit that when there is an event "X changed", then you cannot see the new value of X from Lua before the event has fired ? Put differently, which events are instant, no matter what causes them (Lua or the engine ...
Could you document/commit that when there is an event "X changed", then you cannot see the new value of X from Lua before the event has fired ? Put differently, which events are instant, no matter what causes them (Lua or the engine ...
- Fri Jan 17, 2025 7:58 pm
- Forum: Resolved Requests
- Topic: Document event order
- Replies: 5
- Views: 584
Re: Document event order
Thanks, Bilka!
For events where there are ordering expectations they are documented on the lua actions that raise those events. E.g. https://lua-api.factorio.com/latest/classes/LuaControl.html#begin_crafting instantly raises on_pre_player_crafted_item and at some point in the current tick on ...
For events where there are ordering expectations they are documented on the lua actions that raise those events. E.g. https://lua-api.factorio.com/latest/classes/LuaControl.html#begin_crafting instantly raises on_pre_player_crafted_item and at some point in the current tick on ...
- Fri Jan 17, 2025 11:48 am
- Forum: Resolved Requests
- Topic: Document event order
- Replies: 5
- Views: 584
Document event order
A single player action can create multiple events, for example on_player_cursor_stack_changed and on_player_main_inventory_changed. Could you document what to expect in mods about this order?
a. "No guarantees whatsoever": the events can be raised in a different order every time, even for the same ...
a. "No guarantees whatsoever": the events can be raised in a different order every time, even for the same ...
- Wed Jan 08, 2025 11:53 pm
- Forum: Modding interface requests
- Topic: Permissive license for util.lua
- Replies: 2
- Views: 430
Re: Permissive license for util.lua
So I guess if it counts as "personal use" or "distributed as part of your mod" and not "commercial use", it's ok.
I'm not sure about github, but uploading your modified version of util.lua to the mod portal is ok according to that.
Personal "use" definitely doesn't cover distribution, but yes ...
- Wed Jan 08, 2025 11:38 am
- Forum: Modding interface requests
- Topic: Permissive license for util.lua
- Replies: 2
- Views: 430
Permissive license for util.lua
Sorry, this isn't exactly a modding interface request.
I would like to propose that you license util.lua under a permissive license like MIT. This will enable mods to copy and modify (parts of it) freely, regardless of their license.
My use case:
I am working on a mod where most of the tests can ...
I would like to propose that you license util.lua under a permissive license like MIT. This will enable mods to copy and modify (parts of it) freely, regardless of their license.
My use case:
I am working on a mod where most of the tests can ...
- Sat Jan 04, 2025 4:32 pm
- Forum: Modding interface requests
- Topic: AutoplaceControl.hidden = true to hide the control from the map generation screen
- Replies: 2
- Views: 337
Re: AutoplaceControl.hidden = true to hide the control from the map generation screen
But if you don't want it to be auto placed, why do you need an AutoplaceControl? You can define the prototype and just place it with create_entity.
- Mon Dec 30, 2024 5:43 pm
- Forum: Modding interface requests
- Topic: [2.0] AutoplaceControl.size
- Replies: 2
- Views: 254
[2.0] AutoplaceControl.size
Proposal: add an optional size parameter to AutoplaceControl defaulting to true. When set to false, the "Size" slider in the map settings UI is removed (similar to how richness is optional).
Rationale: resources that are supposed to always spawn as a single node -- in that case would reduce user ...
Rationale: resources that are supposed to always spawn as a single node -- in that case would reduce user ...