Page 1 of 1

item_index doesn't seem to fully work for surface.create_entity

Posted: Wed Jul 30, 2025 4:56 pm
by Funtime60
I'm the author of Auto Lamp and I'm trying to get Factorio to place lamps into the same undo action across multiple ticks. Specifically, my mod creates 0~1 lamps every tick in a selected area and I want to be able to undo an entire selection at once. The issue is that while setting "item_index = 1" works for undo actions within a single tick, it doesn't seem to work at all for undo actions from previous ticks. I've made a demo branch on my repo to show this. Just use the tool to select multiple power poles and each power pole will gain 2 lamps which will undo together, but each pole's will undo in sequence. (Poles must not have existing lamp coverage.) I mostly want an answer about whether this is actually a bug, I imagine this code isn't used often so it could slip through, or that I'm just using it wrong. Thanks

Re: item_index doesn't seem to fully work for surface.create_entity

Posted: Wed Jul 30, 2025 5:15 pm
by Rseding91
It looks like the lua docs were done incorrectly. It's actually "undo_index". I've fixed them for the next release.

Re: item_index doesn't seem to fully work for surface.create_entity

Posted: Wed Jul 30, 2025 5:20 pm
by Funtime60
Thanks so much!

Re: item_index doesn't seem to fully work for surface.create_entity

Posted: Wed Jul 30, 2025 5:25 pm
by Funtime60
Just adding that I didn't notice because it IS item_index with entity.order_deconstruction

Re: item_index doesn't seem to fully work for surface.create_entity

Posted: Wed Jul 30, 2025 7:33 pm
by Rseding91
That's also wrong lua-doc wise, and is also undo_index. I've also fixed that one for the next release.

Re: item_index doesn't seem to fully work for surface.create_entity

Posted: Wed Jul 30, 2025 7:35 pm
by Funtime60
Weird, that one did work.