[2.0.76] Cannot put item-with-entity-data into an ingredient slot if there is exactly one item already

User avatar
Osmo
Filter Inserter
Filter Inserter
Posts: 291
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

[2.0.76] Cannot put item-with-entity-data into an ingredient slot if there is exactly one item already

Post by Osmo »

- Define a recipe like this

Code: Select all

data.extend{
    {
        type = "recipe",
        name = "spidertrons",
        ingredients = {
            {type = "item", name = "spidertron", amount = 4},
        },
        results = {
            {type = "item", name = "iron-plate", amount = 4},
        },
    }
}
- Place an assembler with that recipe
- Put one spidertron into the ingredient slot
- Put a spidertron item in cursor
- Left click on the ingredient slot. The second spidertron is not put into the slot, but the item move sound plays. Right clicking works though.
- Put spidertron into player inventory
- Shift-click it into the ingredient slot. It does get moved.
Moving an item from cursor to ingredeint slot works if there is 2 or more items in the slot already.

This seems to happen for any item-with-entity-data with a stack size of 1
Attachments
factorio-current.log
(10.19 KiB) Downloaded 24 times
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4544
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.76] Cannot put item-with-entity-data into an ingredient slot if there is exactly one item already

Post by boskid »

Sound playing when you click is correct given that in this case it triggers cursor swap so the items are exchanged. This looks like an obscure corner case since spidertron has stack size of 1 but is not marked as non-stackable, and check for cursor swap checks for stack size being 1, not for item being non stackable. If spidertron would be marked as non stackable then you would not be able to use it as a recipe ingredient with amount larger than 1. In general stacking of item-with-entity-data is a super tricky corner case since they should only stack when they are equal, and this involves not having equipment grid configured on either of the items - if you have that item with a grid set (it is created by inserting equipment and it keeps existing regardless of equipment being taken out), then it no longer stacks even if prototype allows it.

Personally i am more in favor of marking spidertron item as non-stackable which would disallow you from having it as an ingredient with count larger than 1, but for now (2.1) i did a tiny change to this logic so it does not trigger cursor swap when item has stack size of 1 while being stackable.
Post Reply

Return to “Fixed for 2.1”