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

This subforum contains all the issues which we already resolved.
Funtime60
Burner Inserter
Burner Inserter
Posts: 10
Joined: Wed Apr 09, 2025 2:59 am
Contact:

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

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

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

Post by Rseding91 »

It looks like the lua docs were done incorrectly. It's actually "undo_index". I've fixed them for the next release.
If you want to get ahold of me I'm almost always on Discord.
Funtime60
Burner Inserter
Burner Inserter
Posts: 10
Joined: Wed Apr 09, 2025 2:59 am
Contact:

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

Post by Funtime60 »

Thanks so much!
Funtime60
Burner Inserter
Burner Inserter
Posts: 10
Joined: Wed Apr 09, 2025 2:59 am
Contact:

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

Post by Funtime60 »

Just adding that I didn't notice because it IS item_index with entity.order_deconstruction
Rseding91
Factorio Staff
Factorio Staff
Posts: 16138
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post by Rseding91 »

That's also wrong lua-doc wise, and is also undo_index. I've also fixed that one for the next release.
If you want to get ahold of me I'm almost always on Discord.
Funtime60
Burner Inserter
Burner Inserter
Posts: 10
Joined: Wed Apr 09, 2025 2:59 am
Contact:

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

Post by Funtime60 »

Weird, that one did work.
Post Reply

Return to “Resolved Problems and Bugs”