[boskid][1.1.74] Furnace progress in quantum state after json migration

This subforum contains all the issues which we already resolved.
User avatar
Stringweasel
Filter Inserter
Filter Inserter
Posts: 419
Joined: Thu Apr 27, 2017 8:22 pm
Contact:

[boskid][1.1.74] Furnace progress in quantum state after json migration

Post by Stringweasel »

What
I'm changing the internal name of a furnace entity, and after the migration the previous crafting_progress is reset to zero and the machine idles.
- If I then add another burnable item of the same type then the progress starts at where it should have been (and not at zero)
- Or if I instead add a different burnable item then the progress starts at zero.

I would expect the furnace to continue burning the entity that was burning previously as if nothing changed, even though the internal name changed.

Note: I could not recreate the same behaviour with the vanilla furnace, the progress was always correct after the migration. But I could never get my modded furnace-type-machine to have the same effect. See first comment, I reproduced it by placing a single iron-ore in the furnace, letting it burn, and then migrating.
Reproduction
Attached is a `pre.zip` before migration, made with 0.3.0. As well as a `post.zip` which applied a migration contained in 0.3.1.

1. Open `post.zip` with 0.3.1. The game should be paused.
2. Notice both machines has a progress of zero. The items in the boxes is the same type that was burning in `pre.zip`.
3.a. Unpause, and after the inserter inserted the items notice the left machine start at around 80-ish% in the next tick, and right machine at 20-ish%.
4.b. Or rotate (delete) the inserters, and watch the machines stay idle after no input. (not expected)
4.c. Or insert some other allowed burnable item (different than what was being burned, as shown in the box) and notice the progress start at 0.
Attachments
factorio-current.log
(6.26 KiB) Downloaded 86 times
biter-power_0.3.0.zip
(7.51 MiB) Downloaded 113 times
post.zip
(814.83 KiB) Downloaded 81 times
pre.zip
(814.98 KiB) Downloaded 82 times
biter-power_0.3.1.zip
(7.51 MiB) Downloaded 92 times
Last edited by Stringweasel on Mon Jan 16, 2023 9:17 pm, edited 1 time in total.
Alt-F4 Author | Factorio Modder
My Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock | Weasel's Demolition Derby
Official Contributor to Space Exploration
User avatar
Stringweasel
Filter Inserter
Filter Inserter
Posts: 419
Joined: Thu Apr 27, 2017 8:22 pm
Contact:

Re: [1.1.74] Furnace progress in quantum state after json migration

Post by Stringweasel »

Just reproduced it with the vanilla furnace. To get it into the quantum state I only added a single iron-ore which then started burning, meaning there was nothing in t

1. New map with a single electric-furnace (+ supporting structures)
2. Add a single iron-ore and pause the game before the iron is completely melted.
3. There should now be nothing in the input or output slots, but the progress bar should be in-progress.
4. Exit the game. Write a tiny mod that migrates the furnace (see below)
5. Enter game with migration, and witness furnace now in a quantum state.

Pretty sure for the migration to work correctly there needs to be items in the input-inventory. When I tested it initially I added an entire stack of ore and that worked as expected. Meaning migration doesn't work if the furnace is burning without an item in the input-inventory.

Quick code you can add to create and migrate to a new furnace.

Code: Select all

--new.json
{
        "entity":
        [
            ["electric-furnace", "n"]
        ]        
}

-- data.lua
require "util"
n = table.deepcopy(data.raw["furnace"]["electric-furnace"])
n.name = "n"
data:extend{ n }
Alt-F4 Author | Factorio Modder
My Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock | Weasel's Demolition Derby
Official Contributor to Space Exploration
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3274
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.1.74] Furnace progress in quantum state after json migration

Post by boskid »

I just verified and its not even because of the json migration. The issue also happens when loading such save file in a prototypes changed mode.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3274
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [boskid][1.1.74] Furnace progress in quantum state after json migration

Post by boskid »

Ok i found and fixed the issue. It was related to technology effects reset in which case a furnace would stop crafting and would check what recipe it should be crafting based on the items in the ingredients slot. In this case because ingredients inventory was empty it would stay without a recipe but was not clearing the bonus progress as well as normal crafting progress. Issue is now fixed for 1.1.78: during the technology effects reset if the furnace is already crafting and the recipe is still valid, the furnace will continue crafting that recipe.
Post Reply

Return to “Resolved Problems and Bugs”