[1.1.89] Handcrafting some recipes takes 1 additional tick
Posted: Thu Aug 24, 2023 11:11 am
Brief
Crafting recipes, with the character, such as iron-gear-wheel or transport-belt takes 31 ticks instead of 30 ticks. While recipes such firearm-magazine or underground-transport-belt take the expected 60 ticks.Where?
This issue seem to be reserved to crafting with the character (handcrafting).So not crafting using assemblers, chemical plants, etc.
Which recipes are affected?
This seems to affect any recipe costing 0.5, 2, 5 or 8 seconds.However not recipes costing 1, 10 or 15 seconds.
This discrepancy is also why I consider it a bug.
Testing
I found this issue while developing a visual crafting timer. I timed the crafting using the code below inserting the result into a GUI element and then i used the mod Game Speed Controls to play exactly X ticks.Code: Select all
local count = -1
local time = 0
for key, value in pairs(player.crafting_queue) do
local recipe = game.recipe_prototypes[value.recipe]
time = time + (recipe.energy * value.count)
count = count + value.count
end
local energy = game.recipe_prototypes[player.crafting_queue[1].recipe].energy
time = time - player.crafting_queue_progress * energy + count / 60