I noticed in your code that items are only removed if the created entity is valid.
if upgraded_entity then
player.play_sound({
path = "entity-build/" .. upgraded_entity.name,
position = upgraded_entity.position,
})
if is_inventory then
item_source.remove(use_item)
else
item_source.count = item_source.count - use_item.count
end
return true
end
However py instantly destroys any built wind turbines and replaces them for another entity. This causes a duplication glitch.
Description
Cross posted from the py repo: https://github.com/pyanodon/pybugreports/issues/511
I noticed in your code that items are only removed if the created entity is valid.
However py instantly destroys any built wind turbines and replaces them for another entity. This causes a duplication glitch.
Reproduction
The wind turbine is created for free. factorio-current.log