Module Tile

Contains functions to query single tiles for information about objects on them.

Functions

abandonBuilding (x, y) Abandons the building at the given location.
extinguishBurningBuilding (x, y) Extinguishes the fire of a building at a given position.
getBuilding (x, y) Returns a bulding object that can be use to call building related functions more conveniently.
getBuildingAnimationFrame (x, y[, slot=1]) Returns the current frame of an animation that is attached to a building.
getBuildingDaysBuilt (x, y) Returns the number of days since this building was constructed.
getBuildingDraft (x, y) Returns the draft of a building at a given position.
getBuildingFrame (x, y) Returns the current frame of a building at a given position.
getBuildingName (x, y) Gets the name of a building
getBuildingPerformance (x, y) Returns the current performance of a building at a given position.
getBuildingStorage (x, y) Returns the storage table of the building at a given position.
getBuildingXY (x, y) Returns the pivot position of a building at a given position.
getGroundDraft (x, y[, level=0]) Returns the ground draft at a given position.
getGroundHeight (x, y) Returns the ground height at a given position.
getInfluence (influenceType, x, y) Returns the influence value of a influence type at a given position.
getPipeDraft (x, y) Returns the draft of the pipe at a given location.
getRoadCarCount (x, y, level) Returns the absolute car counter of the road at a given position and level.
getRoadChargeableCarCount (x, y, level) Returns the absolute chargeable car counter of the road at a given position and level.
getRoadDeco (x, y, level) Returns the draft of the road decoration on the road at a given position and level.
getRoadDraft (x, y, level) Returns the draft of the road at a given position and level.
getRoadFrame (x, y, level) Returns the frame of a road at a given position and level.
getRoadOccupation (x, y, level) Returns the draft of the road occupcation on the road at a given position and level.
getRoadStorage (x, y, level) Returns the storage table of the road at a given position and level.
getRoadTraffic (x, y, level) Returns the amount of traffic on a road tile.
getTerrainHeight (x, y) Returns the average terrain height at a given position.
getTreeDraft (x, y) Returns the draft of the tree at the given position.
getTreeFrame (x, y) Returns the frame of the tree at the given position.
getWireDraft (x, y, level) Returns the draft of the wire at a given location.
hasBuildingNeededRoad (x, y) Returns true iff there's a building at a given position that needs a road connection but also has a road connection.
hasBuildingRoad (x, y) Returns true iff there's a building at a given position that has a road connection.
hasBuildingUpgrade (upgradeId, x, y) Returns true iff the building at a given position has a specific upgrade applied to it.
hasRoad (x, y) Returns true if there's any raod at the given position regardless of the level.
hasRoadOccupation (x, y, level) Returns true iff there's a road occupation on the road at a given position and level.
hasWire (x, y) Determines whether there is any wire at the given location regardless of the level.
isBuilding (x, y) Returns true iff there's a building at a given position.
isBuildingAnimationPaused (x, y[, slot=1]) Resumes an animation that is attached to a building.
isBuildingBurning (x, y) Returns true iff there's a building at a given position the is burning right now.
isBuildingEmpty (x, y) Returns true iff there's a building at a given position that is empty right now.
isBuildingFullOfDeadPeople (x, y) Returns true iff there's a building at a given position that has transport issues with dead bodies right now.
isBuildingFullOfWaste (x, y) Returns true iff there's a building at a given position that is full of garbage right now.
isBuildingIll (x, y) Returns true iff there's a building at a given position that contains ill people right now.
isBuildingInConstruction (x, y) Returns true iff there's a building at a given position that is in construction right now.
isBuildingUntouchable (x, y) Determines whether a RCI building is untouchable.
isBuildingUpgradeInConstruction (x, y) Returns true iff there's a building at a given position that has a pending upgrade right now.
isBuildingWorking (x, y) Returns true iff there's a building at a given position that is working right now.
isFlat (x, y) Determines whether the ground is flat at a given position.
isLand (x, y) Returns true iff there's land (the opposite of water) at a given position.
isPipe (x, y) Determines whether there is pipe at the given location.
isRoad (x, y, level) Returns true if there's a road at a given position and level.
isRoadDeco (x, y, level) Returns true iff there's a road decoration on the road at a given position and level.
isTree (x, y) Returns true iff there's a tree at a given position.
isValid (x, y) Returns true iff a position is on the map.
isWater (x, y) Returns true iff there's water at a given position.
isWire (x, y, level) Determines whether there is a wire at the given location and level.
pauseBuildingAnimation (x, y[, slot=1]) Pauses an animation that is attached to a building.
resumeBuildingAnimation (x, y[, slot=1[, speed=1.0]]) Resumes an animation that is attached to a building.
setBuildingAnimationFrame (x, y, frame[, slot=1]) Sets the current frame of an animation regardless of whether the animation is playing right now.
setBuildingFrame (x, y, frame) Sets the frame of a building at a given position.
setBuildingName (x, y, name) Sets the name of a building
setBuildingPerformance (x, y, performance) Sets the performance of a building.
setBuildingUntouchable (x, y[, state=true]) Marks a RCI building as untouchable/touchable.
setRoadOccupation (draft, x, y, level) Sets the road occupation on the road at a given position and level.

Fields

INFLUENCE_BODY_DISPOSAL Body disposal influence type.
INFLUENCE_COMMERCIAL Commercial influence type.
INFLUENCE_CULTURE Culture influence type.
INFLUENCE_DENSITY Density influence type.
INFLUENCE_EDUCATION_HIGH High education influence type.
INFLUENCE_EDUCATION_LOW Low education influence type.
INFLUENCE_FIREDEPARTMENT Fire department influence type.
INFLUENCE_HEALTH Health influence type.
INFLUENCE_INDUSTRIAL Industrial influence type.
INFLUENCE_LEVEL_HIGH High level influence type.
INFLUENCE_LEVEL_LOW Low level influence type.
INFLUENCE_LEVEL_MIDDLE Medium level influence type.
INFLUENCE_MANAGEMENT Management influence type.
INFLUENCE_NATURE Nature influence type.
INFLUENCE_NOISE Noise influence type.
INFLUENCE_PARK Park influence type.
INFLUENCE_PASSENGER_BUS Bus passenger influence type.
INFLUENCE_PASSENGER_TRAIN Train passenger influence type.
INFLUENCE_POLICE Police influence type.
INFLUENCE_POLLUTION Pollution influence type.
INFLUENCE_RADIOACTIVITY Radioactivity influence type.
INFLUENCE_RELIGION Religion influence type.
INFLUENCE_RESIDENTIAL Residential influence type.
INFLUENCE_SPORT Sport influence type.
INFLUENCE_TRAFFIC Traffic influence type.
INFLUENCE_WASTE_DISPOSAL Waste disposal influence type.


Functions

abandonBuilding (x, y)
Abandons the building at the given location.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.
extinguishBurningBuilding (x, y)
Extinguishes the fire of a building at a given position.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.
getBuilding (x, y)
Returns a bulding object that can be use to call building related functions more conveniently.

Parameters:

  • x
  • y

Returns:

    Building A building object with convenient functions.
getBuildingAnimationFrame (x, y[, slot=1])
Returns the current frame of an animation that is attached to a building.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.
  • slot int The index of the animation to pause. 1 is the first attached animation. (default 1)

Returns:

    int or nil The current frame of the animation or nil if something went wrong.
getBuildingDaysBuilt (x, y)
Returns the number of days since this building was constructed. Negative values indicate non finished buildings.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.

Returns:

    int
getBuildingDraft (x, y)
Returns the draft of a building at a given position.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.

Returns:

    draft
getBuildingFrame (x, y)
Returns the current frame of a building at a given position.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.

Returns:

    int
getBuildingName (x, y)
Gets the name of a building

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.

Returns:

    string name of the building or nil if no name is set.
getBuildingPerformance (x, y)
Returns the current performance of a building at a given position. 1.0 represents 100%.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.

Returns:

    number
getBuildingStorage (x, y)
Returns the storage table of the building at a given position. Storage tables can be used to save information into cities/buildings/roads permanently.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.

Returns:

    table
getBuildingXY (x, y)
Returns the pivot position of a building at a given position. That point can differ from the queried position for buildings that have a size bigger than 1.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.

Returns:

    int,int X and Y component of the pivot position of the building.
getGroundDraft (x, y[, level=0])
Returns the ground draft at a given position.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.
  • level int Level to query, must be 0 or 1. (default 0)

Returns:

    draft
getGroundHeight (x, y)
Returns the ground height at a given position. Will return the minimum height in case of a slope.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    int An integer that represents height. 0 means ocean level.
getInfluence (influenceType, x, y)
Returns the influence value of a influence type at a given position.

Parameters:

  • influenceType int A influence type constant like Tile.INFLUENCE_PARK.
  • x int X component of a position.
  • y int Y component of a position.

Returns:

    number A number in 0..1. 1 Means the influence is maxed out.
getPipeDraft (x, y)
Returns the draft of the pipe at a given location.

Parameters:

  • x int X component of a location.
  • y int Y component of a location.

Returns:

    draft or nil The draft of the pipe if there is any.
getRoadCarCount (x, y, level)
Returns the absolute car counter of the road at a given position and level. The car counter is incremented for each car that has entered that road. You can use it to track the number of passed by cars in a certain time frame.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.
  • level int A road level with 0 being ground.

Returns:

    int Amount of cars.
getRoadChargeableCarCount (x, y, level)
Returns the absolute chargeable car counter of the road at a given position and level. The car counter is incremented for each chargeable car that has entered that road. You can use it to track the number of passed by chargeable cars in a certain time frame.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.
  • level int A road level with 0 being ground.

Returns:

    int
getRoadDeco (x, y, level)
Returns the draft of the road decoration on the road at a given position and level.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.
  • level int A road level with 0 being ground.

Returns:

    draft
getRoadDraft (x, y, level)
Returns the draft of the road at a given position and level.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.
  • level int A road level with 0 being ground.

Returns:

    draft Road draft object of the road.
getRoadFrame (x, y, level)
Returns the frame of a road at a given position and level.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.
  • level int A road level with 0 being ground.

Returns:

    int The frame of the road. Typically ranges from 0 to 15 dependent on the alignment (regardless city rotation).
getRoadOccupation (x, y, level)
Returns the draft of the road occupcation on the road at a given position and level.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.
  • level int A road level with 0 being ground.

Returns:

    animationdraft
getRoadStorage (x, y, level)
Returns the storage table of the road at a given position and level.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.
  • level int A road level with 0 being ground.

Returns:

    table The table can be used to save information permanently in a road.
getRoadTraffic (x, y, level)
Returns the amount of traffic on a road tile.

Parameters:

  • x int X component of a road position.
  • y int Y component of a road position.
  • level int A road level with 0 being ground.

Returns:

    number 0..1 with 1 being high traffic
getTerrainHeight (x, y)
Returns the average terrain height at a given position. Works similar to ground height but interpolates between the height of all four edges in case of a slope.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    number A float value that indicates the height of the terrain.
getTreeDraft (x, y)
Returns the draft of the tree at the given position.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    draft
getTreeFrame (x, y)
Returns the frame of the tree at the given position.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    draft
getWireDraft (x, y, level)
Returns the draft of the wire at a given location.

Parameters:

  • x int X component of a location.
  • y int Y component of a location.
  • level int Level of the wire to look for. The level of normal wires is 0 (-1 for underground and 1 for long distance wires).

Returns:

    draft or nil The draft of the wire if there is any.
hasBuildingNeededRoad (x, y)
Returns true iff there's a building at a given position that needs a road connection but also has a road connection.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
hasBuildingRoad (x, y)
Returns true iff there's a building at a given position that has a road connection.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
hasBuildingUpgrade (upgradeId, x, y)
Returns true iff the building at a given position has a specific upgrade applied to it.

Parameters:

  • upgradeId string Id of an upgrade.
  • x int X component of a building position.
  • y int Y component of a building position.

Returns:

    bool
hasRoad (x, y)
Returns true if there's any raod at the given position regardless of the level.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool True if there is road.
hasRoadOccupation (x, y, level)
Returns true iff there's a road occupation on the road at a given position and level.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.
  • level int A road level with 0 being ground.

Returns:

    bool
hasWire (x, y)
Determines whether there is any wire at the given location regardless of the level.

Parameters:

  • x int X component of a location.
  • y int Y component of a location.

Returns:

    bool True iff there is any wire.
isBuilding (x, y)
Returns true iff there's a building at a given position.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
isBuildingAnimationPaused (x, y[, slot=1])
Resumes an animation that is attached to a building.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.
  • slot int The index of the animation to pause. 1 is the first attached animation. (default 1)

Returns:

    bool or nil Is true iff the specified animation is paused right now, nil if an error occurred.
isBuildingBurning (x, y)
Returns true iff there's a building at a given position the is burning right now.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
isBuildingEmpty (x, y)
Returns true iff there's a building at a given position that is empty right now. That means that people left it. Only happens for RCI buildings.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
isBuildingFullOfDeadPeople (x, y)
Returns true iff there's a building at a given position that has transport issues with dead bodies right now.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
isBuildingFullOfWaste (x, y)
Returns true iff there's a building at a given position that is full of garbage right now.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
isBuildingIll (x, y)
Returns true iff there's a building at a given position that contains ill people right now.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
isBuildingInConstruction (x, y)
Returns true iff there's a building at a given position that is in construction right now.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
isBuildingUntouchable (x, y)
Determines whether a RCI building is untouchable. An untouchable building is protected in terms of it won't be replaced by automatically spawned buildings.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.
isBuildingUpgradeInConstruction (x, y)
Returns true iff there's a building at a given position that has a pending upgrade right now.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
isBuildingWorking (x, y)
Returns true iff there's a building at a given position that is working right now. A working building has road connection if needed, is not in construction and is not empty. It also has power and water if needed.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
isFlat (x, y)
Determines whether the ground is flat at a given position. Ground is flat if there is not slope in it.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool True iff the ground is flat.
isLand (x, y)
Returns true iff there's land (the opposite of water) at a given position.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
isPipe (x, y)
Determines whether there is pipe at the given location.

Parameters:

  • x int X component of a location.
  • y int Y component of a location.

Returns:

    bool True iff there is a pipe.
isRoad (x, y, level)
Returns true if there's a road at a given position and level.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.
  • level int A road level with 0 being ground.

Returns:

    bool True iff there is road.
isRoadDeco (x, y, level)
Returns true iff there's a road decoration on the road at a given position and level.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.
  • level int A road level with 0 being ground.

Returns:

    bool
isTree (x, y)
Returns true iff there's a tree at a given position.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
isValid (x, y)
Returns true iff a position is on the map.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool

Usage:

    print(Tile.isValid(-1,0))  --Prints false
    print(Tile.isValid(0,0))  --Prints true
    print(Tile.isValid(City.getWidth() - 1, City.getHeight() - 1))  --Prints true
    print(Tile.isValid(City.getWidth(), City.getHeight()))  --Prints false
    
isWater (x, y)
Returns true iff there's water at a given position.

Parameters:

  • x int X component of a position.
  • y int Y component of a position.

Returns:

    bool
isWire (x, y, level)
Determines whether there is a wire at the given location and level.

Parameters:

  • x int X component of a location.
  • y int Y component of a location.
  • level int Level of the wire to look for. The level of normal wires is 0 (-1 for underground and 1 for long distance wires).

Returns:

    bool True iff there is a wire.
pauseBuildingAnimation (x, y[, slot=1])
Pauses an animation that is attached to a building.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.
  • slot int The index of the animation to pause. 1 is the first attached animation. (default 1)

Returns:

    int or nil The current frame of the animation or nil if something went wrong.
resumeBuildingAnimation (x, y[, slot=1[, speed=1.0]])
Resumes an animation that is attached to a building.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.
  • slot int The index of the animation to pause. 1 is the first attached animation. (default 1)
  • speed number A speed multiplier for the animation. (default 1.0)

Returns:

    int or nil The current frame of the animation or nil if something went wrong.
setBuildingAnimationFrame (x, y, frame[, slot=1])
Sets the current frame of an animation regardless of whether the animation is playing right now.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.
  • frame int The frame to set.
  • slot int The index of the animation to pause. 1 is the first attached animation. (default 1)

Returns:

    bool or nil Only true if the operation was successful.
setBuildingFrame (x, y, frame)
Sets the frame of a building at a given position.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.
  • frame int The frame index to set.
setBuildingName (x, y, name)
Sets the name of a building

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.
  • name string The name that should be used for the building. Use nil to reset it.
setBuildingPerformance (x, y, performance)
Sets the performance of a building. The performance value will be clipped by the min and max value defined in the building's draft.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.
  • performance number The performance to set. 1 represents 100%.
setBuildingUntouchable (x, y[, state=true])
Marks a RCI building as untouchable/touchable. An untouchable building is protected in terms of it won't be replaced by automatically spawned buildings.

Parameters:

  • x int X component of a building position.
  • y int Y component of a building position.
  • state boolean The untouchable state to set for the building. (default true)
setRoadOccupation (draft, x, y, level)
Sets the road occupation on the road at a given position and level.

Parameters:

  • draft draft The animation draft to set on the road.
  • x int X component of a position.
  • y int Y component of a position.
  • level int A road level with 0 being ground.

Fields

INFLUENCE_BODY_DISPOSAL
Body disposal influence type.
INFLUENCE_COMMERCIAL
Commercial influence type.
INFLUENCE_CULTURE
Culture influence type.
INFLUENCE_DENSITY
Density influence type.
INFLUENCE_EDUCATION_HIGH
High education influence type.
INFLUENCE_EDUCATION_LOW
Low education influence type.
INFLUENCE_FIREDEPARTMENT
Fire department influence type.
INFLUENCE_HEALTH
Health influence type.
INFLUENCE_INDUSTRIAL
Industrial influence type.
INFLUENCE_LEVEL_HIGH
High level influence type.
INFLUENCE_LEVEL_LOW
Low level influence type.
INFLUENCE_LEVEL_MIDDLE
Medium level influence type.
INFLUENCE_MANAGEMENT
Management influence type.
INFLUENCE_NATURE
Nature influence type.
INFLUENCE_NOISE
Noise influence type.
INFLUENCE_PARK
Park influence type.
INFLUENCE_PASSENGER_BUS
Bus passenger influence type.
INFLUENCE_PASSENGER_TRAIN
Train passenger influence type.
INFLUENCE_POLICE
Police influence type.
INFLUENCE_POLLUTION
Pollution influence type.
INFLUENCE_RADIOACTIVITY
Radioactivity influence type.
INFLUENCE_RELIGION
Religion influence type.
INFLUENCE_RESIDENTIAL
Residential influence type.
INFLUENCE_SPORT
Sport influence type.
INFLUENCE_TRAFFIC
Traffic influence type.
INFLUENCE_WASTE_DISPOSAL
Waste disposal influence type.
generated by LDoc 1.4.3 Last updated 2021-03-02 09:54:23