(Fun Suggestion) Cloning

Plug-in related stuff can be discussed here.

Moderator: Plugin Moderators

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1876
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone model: Moto Z Force Droid

Platform

(Fun Suggestion) Cloning

#1

Post by KINGTUT10101 » Wed Apr 03, 2019 14:19

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.

User avatar
Lobby
Developer
Reactions:
Posts: 3324
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

Re: (Fun Suggestion) Cloning

#2

Post by Lobby » Wed Apr 03, 2019 16:18

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)
:lua:
...Have a nice stay

Post Reply Previous topicNext topic

Return to “Plug-In Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests