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

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.
buildGround (draft, x, y) Builds the specified ground draft and returns true iff building was successful.
buildRoad (draft, x0, y0, x1, y1[, level0[, level1[, bridge]]]) Tries to build the given road draft along the given line.
buildRoadDeco (draft, x, y, level) Tries to build the given road decoration draft on the road on the specified location.
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.
buildZone (draft, x, y) Builds the specified zone draft or removes it if draft is nil.
getBuildingPrice (draft, x, y) Returns the price of the building.
getGroundPrice (draft, x, y) Returns the price of the ground.
getRoadDecoPrice (draft, x, y, level) Returns the price of the road deco.
getRoadPrice (draft, x0, y0, x1, y1[, level0[, level1[, bridge]]]) Returns the price of the road.
getTreePrice (draft, x, y) Returns the price of the tree.
isBuildingBuildable (draft, x, y) Checks whether the specified building draft can be built at the given position x, y.
isGroundBuildable (draft, x, y) Returns true iff the ground draft can be built at the given location.
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.
isRoadDecoBuildable (draft, x, y, level) Returns true iff the given road decoration can be applied to the road at the specified location.
isTreeBuildable (draft, x, y) Checks whether the specified tree draft can be built at the specified position.
remove (x, y) Removes anything from the specified location.


Functions

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.
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.
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.
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.
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.
buildZone (draft, x, y)
Builds the specified zone draft or removes it if draft is nil.

Parameters:

  • draft draft A zone draft or nil.
  • x number X component of the target position.
  • y number Y component of the target position.
getBuildingPrice (draft, x, y)
Returns the price of the building. May change with time.

Parameters:

  • draft draft
  • x number
  • y number

Returns:

    number
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
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
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
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
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
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.
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.
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.
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.
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 2020-09-27 16:37:25