Introduction:

As 0.17 brought us the possibility for landfill in blueprints, I set out to solve the remaining issue - how to get that landfill into your existing blueprints?

I made a small mod that parses a blueprint and put landfill tiles under entities and tiles in your blueprint, but ONLY where needed to build your blueprint.

Usage:

The mod adds a small button in your top right corner. This has a few different modes depending on your modifier:

With a blueprint in hand, click the button to place landfill under all entities and tiles in the blueprint. This also (a limitation in the game) remove existing tiles in the print. If you shift-click the button it will only place landfill under your entities, not where you have only tiles like concrete, brick and so on. This also removes existing tiles. If you hold control while clicking, I attempt to add existing tiles again. This has limited usefulness as the resulting blueprint often is impossible to place on water, but it might be what you want if you only want to cover small water spots. It's a game limitation that makes it impossible to have both concrete and landfill at the same spot in a blueprint.

Now that you have landfill in the blueprint, just force-click the blueprint on water (by holding shift when placing it) and sit back and watch your robots fill up the lake for you!

There is support for the mod Platforms, which adds special tiles that can be removed by the player. If you want those you have to have the mod installed AND choose it in the Player settings.

This can be used for every blueprint you want near or in a lake, but it's extra useful when putting down nuclear reactors that often require precise placement of landfill. I've tested this with a gigantic 2.4 GW blueprint without a problem.

The new copy function in 0.17 is a temporary blueprint, so the mod works on those too.

I haven't tested on modded entities but as long as they have a proper selection box that match the footprint of the entity they should work fine. Let me know otherwise.

The Fine Print:

This permanently alters the blueprint in your hand. Your library is unaffected, but if you modify a blueprint in your inventory it will stay modified.

This also removes any existing tiles in your blueprint - concrete, bricks and so on. This should not be a problem since if you take the blueprint from your library the original will still have concrete - you can put down the landfill and then take the original from your library again and stamp down the blueprint with concrete.

This is my first program in lua and it's my first factorio mod - I will gladly accept suggestions for improvements, both functionality and in the code.

Known issues:

None.

Acknowledgements:

This mod builds upon the shoulders of giants: The support for curved rail is straight up nicked from Blueprint Footprint by MostlyNumbers, an older mod that did almost the same thing but slightly different and hasn't been updated. My algorithm for regular entities is my own, though. I also got tips on how to handle blueprints from Foreman by Choumiko.