diff --git a/exp_scenario/module/commands/waterfill.lua b/exp_scenario/module/commands/waterfill.lua index ef4c57b7..0603e613 100644 --- a/exp_scenario/module/commands/waterfill.lua +++ b/exp_scenario/module/commands/waterfill.lua @@ -72,13 +72,14 @@ Selection.on_selection(SelectionName, function(event) surface.set_tiles(tiles_to_make, true, "abort_on_collision", true, false, player, 0) local remaining_tiles = surface.count_tiles_filtered{ area = area, name = "water-mud" } + local t_diff = tile_count - remaining_tiles if item_count_type_bool then - player.remove_item{ name = "cliff-explosives", count = tile_count - remaining_tiles } + player.remove_item{ name = "cliff-explosives", count = t_diff } else - player.remove_item{ name = "explosives", count = 10 * (tile_count - remaining_tiles) } - player.remove_item{ name = "barrel", count = tile_count - remaining_tiles } - player.remove_item{ name = "grenade", count = tile_count - remaining_tiles } + player.remove_item{ name = "explosives", count = 10 * t_diff } + player.remove_item{ name = "barrel", count = t_diff } + player.remove_item{ name = "grenade", count = t_diff } end if remaining_tiles > 0 then