Copy It!

If you liked this item, please rate it up on Steam Workshop page.

Author: okeating

Last revision: 3 Jul, 2023 at 22:32 UTC

File size: 517.12 KB

On Steam Workshop

Description:

By popular request here is a tool that allows you to copy / paste segments and constructions.

Features:
– Select multiple constructions and segments at the same time to create a template
– (Optionally) name the template and it is saved to clipboard
– Select a template and paste with a mouse click – easy
– Templates can be rotated using the slider in the UI window
– Integrated with my Undo! mod
– Choose whether to build with collision. If not, then the tool will highlight the collision entities.
– Optionally save the templates into your savegame, this comes with a caveat (see below)

Limitations:
– Limited to constructions that are directly buildable by the player (no town buildings, no asset plopping (unless a construction))
– I cannot find a way for the API to preview the build so it is limited to a white outline painted on the terrain
– Related to that, there is (deliberately) no height adjustment, it will build level with the terrain – use my Move It! mod if you want to make fine adjustments
– There is no keyboard listener in the API (probably just as well), so I cannot implement any keyboard shortcuts, which is why rotation is a bit clunky
– I made savegame saving optional because the way TPF2 does this is it constantly sends the data from the engine thread to the UI thread, and I am not sure exactly how this is implemented, but if it requires copying the data each time it could impact performance.
– The pasting has to be done in two stages, first to get the construction then the segments – this is because it needs to find the nodes to connect to. I have tried to make sure it validates the segment part first so it shouldn’t end up with half a job. Note though that for Undo! this will require two clicks of the Undo button.

As always please backup and save regularly. Let me know if you encounter any problems in the comments below.

Enjoy!