Skip to content

Commit

Permalink
Fix single tile loaders upgrade with belts
Browse files Browse the repository at this point in the history
  • Loading branch information
jodokus31 committed May 30, 2023
1 parent d981002 commit 80d9298
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Version: 0.5.6
Date: 2023-05-30
Changes:
- Add setting to allow Autobuild to keep building, even when in combat
Bugfixes:
- Fix that belts can be upgraded with a single tile loaders or vice versa
---------------------------------------------------------------------------------------------------
Version: 0.5.5
Date: 2023-04-21
Expand Down
9 changes: 6 additions & 3 deletions control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -327,21 +327,24 @@ local function try_upgrade_with_stack(entity, target_name, player, stack_to_plac
return false
end

local entity = entity.surface.create_entity{
local new_entity = entity.surface.create_entity{
name = target_name,
position = entity.position,
direction = entity.direction,
force = entity.force,
fast_replace = true,
player = player,
type = entity.type:find("loader") and entity.loader_type or
entity.type == "underground-belt" and entity.belt_to_ground_type,
entity.type == "underground-belt" and entity.belt_to_ground_type or
nil,
raise_built = true,
}
if entity then

if new_entity then
player.remove_item(stack_to_place)
return true
end

return false
end

Expand Down

0 comments on commit 80d9298

Please sign in to comment.