## (Fun Suggestion) Cloning

Plug-in related stuff can be discussed here.

Moderator: Plugin Moderators

KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 2112
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Contact:

### (Fun Suggestion) Cloning

Could we have a feature with fun that would allow us to clone a building, which would retain all information about it? Right now, if I wanted to have a building that can move or something that also has multiple frames, the frame it is on is not saved when I move the building using the "destroy/build" method. When I do use that method, the game just picks a random frame when it builds that building, not the same frame as the building that built it.

This means that if I want to have a building with three frames that can move in all four directions, I'll probably need to have 12 fun objects (4 directions * 3 frames) alone just to make sure it doesn't lose it's frame while moving.

Lobby
Developer
Reactions:
Posts: 3643
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta

### Re: (Fun Suggestion) Cloning

This is another special case that shows how limited the fun syntax actually is. It's not a programming language and you'll notice that whenever you try to do something that wasn't thought of when designing it

In Lua you would do something like:

Code: Select all

function script:daily(x, y)
...                                            -- The code that decides where to build something
local frame = Tile.getBuildingFrame(x, y)      -- Fetching own frame
Builder.buildBuilding(script:getDraft(), targetX, targetY, frame)   -- Building the new building with the same frame
end

And just append it to your building (could even be reused for multiple buildings)
=^._.^= ∫