Module Builder

Functions to create and destroy buildings, roads, trees and more.

For convenience you can provide the id of a draft as a string instead of the draft itself whenever a draft is needed. There are different types of drafts. Ensure that you use the correct functions to build them. For example you cannot build $park00 by using Builder.buildRoad. Since it's a build you would have to use Builder.buildBuilding instead. For each type of object that can be built there's typically a function to check in advance whether the actual building process will be successful. It's good style to use these checks, even though the builder functions check validity on their own.

Usage:

    if Builder.isBuildingBuildable('$tree00', 2, 4) then
      Builder.buildBuilding('$tree00', 2, 4)
    end
    

Functions

isBuildingBuildable (draft, x, y) Checks whether the specified building draft can be built at the given position x, y.
getBuildingPrice (draft, x, y) Returns the price of the building.
buildBuilding (draft, x, y[, frame]) Tries to build the given building draft at the specified position and sets it's frame if a frame was specified.
isRoadBuildable (draft, x0, y0, x1, y1[, level0[, level1[, bridge]]]) Checks whether the specified road draft can be build along the given line x0,y0 - x1,y1.
getRoadPrice (draft, x0, y0, x1, y1[, level0[, level1[, bridge]]]) Returns the price of the road.
buildRoad (draft, x0, y0, x1, y1[, level0[, level1[, bridge]]]) Tries to build the given road draft along the given line.
isTreeBuildable (draft, x, y) Checks whether the specified tree draft can be built at the specified position.
getTreePrice (draft, x, y) Returns the price of the tree.
buildTree (draft, x, y[, frame]) Tries to build the given tree draft at the specified position x, y and return true iff this was successful.
isRoadDecoBuildable (draft, x, y, level) Returns true iff the given road decoration can be applied to the road at the specified location.
getRoadDecoPrice (draft, x, y, level) Returns the price of the road deco.
buildRoadDeco (draft, x, y, level) Tries to build the given road decoration draft on the road on the specified location.
isGroundBuildable (draft, x, y) Returns true iff the ground draft can be built at the given location.
getGroundPrice (draft, x, y) Returns the price of the ground.
buildGround (draft, x, y) Builds the specified ground draft and returns true iff building was successful.
remove (x, y) Removes anything from the specified location.


Functions

isBuildingBuildable (draft, x, y)
Checks whether the specified building draft can be built at the given position x, y. Returns true iff the building can be built.

Parameters:

  • draft draft
  • x number
  • y number

Returns:

    bool
getBuildingPrice (draft, x, y)
Returns the price of the building. May change with time.

Parameters:

  • draft draft
  • x number
  • y number

Returns:

    number
buildBuilding (draft, x, y[, frame])
Tries to build the given building draft at the specified position and sets it's frame if a frame was specified. Returns true iff the build was was successful.

Parameters:

  • draft draft
  • x number
  • y number
  • frame number The frame to use for the building. If no frame was specified a random frame will be used (in case the building has multiple frames). (optional)

Returns:

    bool True iff the building has been built successfully.
isRoadBuildable (draft, x0, y0, x1, y1[, level0[, level1[, bridge]]])
Checks whether the specified road draft can be build along the given line x0,y0 - x1,y1. To build a bridge manually you have to set level0 = level1 and bridge = true Only a single lane will be built so a valid line has to fulfill the property x0 == x1 or y0 == y1

Parameters:

  • draft draft Draft of the road to build.
  • x0 number X component of the starting position.
  • y0 number Y component of the starting position.
  • x1 number X component of the end position.
  • y1 number Y component of the end position.
  • level0 number Level at the start position. Default value is 0. (optional)
  • level1 number Level at the end position. Default value is 0. (optional)
  • bridge bool Specifies whether a bridge should be built. For this option to work _level0_ and _level1_ must be equal. Default is **false**. (optional)

Returns:

    bool True iff the road can be built.
getRoadPrice (draft, x0, y0, x1, y1[, level0[, level1[, bridge]]])
Returns the price of the road. May change with time.

Parameters:

  • draft draft
  • x0 number X component of the starting position.
  • y0 number Y component of the starting position.
  • x1 number X component of the end position.
  • y1 number Y component of the end position.
  • level0 number Level at the start position. Default value is 0. (optional)
  • level1 number Level at the end position. Default value is 0. (optional)
  • bridge bool Specifies whether a bridge should be built. For this option to work _level0_ and _level1_ must be equal. Default is **false**. (optional)

Returns:

    number
buildRoad (draft, x0, y0, x1, y1[, level0[, level1[, bridge]]])
Tries to build the given road draft along the given line. Returns true if building was successful.

Parameters:

  • draft draft Draft of the road to build.
  • x0 number X component of the starting position.
  • y0 number Y component of the starting position.
  • x1 number X component of the end position.
  • y1 number Y component of the end position.
  • level0 number Level at the start position. Default value is 0. (optional)
  • level1 number Level at the end position. Default value is 0. (optional)
  • bridge bool Specifies whether a bridge should be built. For this option to work _level0_ and _level1_ must be equal. Default is **false**. (optional)

Returns:

    bool True iff the road has been built successfully.
isTreeBuildable (draft, x, y)
Checks whether the specified tree draft can be built at the specified position.

Parameters:

  • draft draft The tree draft that should be used.
  • x number X component of the target position.
  • y number Y component of the target position.

Returns:

    bool True iff the tree can be built.
getTreePrice (draft, x, y)
Returns the price of the tree. May change with time.

Parameters:

  • draft draft The tree draft that should be used.
  • x number X component of the target position.
  • y number Y component of the target position.

Returns:

    number
buildTree (draft, x, y[, frame])
Tries to build the given tree draft at the specified position x, y and return true iff this was successful. If frame is specified it also tries to set the frame of the tree accordingly.

Parameters:

  • draft draft The tree draft that should be used.
  • x number X component of the target position.
  • y number Y component of the target position.
  • frame number The frame to use for the tree. A random frame will be picked if it isn't specified. (optional)

Returns:

    bool True iff the tree can be built.
isRoadDecoBuildable (draft, x, y, level)
Returns true iff the given road decoration can be applied to the road at the specified location.

Parameters:

  • draft draft A road decoration draft.
  • x number X component of the target position.
  • y number Y component of the target position.
  • level number Road level of the target position with 0 being ground level.

Returns:

    bool True iff the road decoration can be built.
getRoadDecoPrice (draft, x, y, level)
Returns the price of the road deco. May change with time.

Parameters:

  • draft draft A road decoration draft.
  • x number X component of the target position.
  • y number Y component of the target position.
  • level number Road level of the target position with 0 being ground level.

Returns:

    number
buildRoadDeco (draft, x, y, level)
Tries to build the given road decoration draft on the road on the specified location. Returns true iff this was successful.

Parameters:

  • draft draft A road decoration draft.
  • x number X component of the target position.
  • y number Y component of the target position.
  • level number Road level of the target position with 0 being ground level.

Returns:

    bool True iff the road decoration has been built.
isGroundBuildable (draft, x, y)
Returns true iff the ground draft can be built at the given location.

Parameters:

  • draft draft A ground draft. You can alternatively provide **true** for water or **false** for land. A generic ground draft will be used then.
  • x number X component of the target position.
  • y number Y component of the target position.

Returns:

    bool True iff the ground can be built.
getGroundPrice (draft, x, y)
Returns the price of the ground. May change with time.

Parameters:

  • draft draft A ground draft. You can alternatively provide **true** for water or **false** for land. A generic ground draft will be used then.
  • x number X component of the target position.
  • y number Y component of the target position.

Returns:

    number
buildGround (draft, x, y)
Builds the specified ground draft and returns true iff building was successful.

Parameters:

  • draft draft A ground draft. You can alternatively provide **true** for water or **false** for land. A generic ground draft will be used then.
  • x number X component of the target position.
  • y number Y component of the target position.

Returns:

    bool True iff the ground has been built.
remove (x, y)
Removes anything from the specified location.

Parameters:

  • x number X component of the target position.
  • y number Y component of the target position.
generated by LDoc 1.4.3 Last updated 2019-10-28 15:18:26