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. |
countRoadBridgeType (x, y, level) | Returns the bridges number of the road at a given position and level. |
countRoadDecos (x, y, level) | Returns the number of decorations on the road at a given position and level. |
extinguishBurningBuilding (x, y) | Extinguishes the fire of a building at a given position. |
getBuilding (x, y) | Returns a building object that can be use to call building related functions more conveniently. |
getBuildingAnimationColor (x, y[, slot=1]) | Gets the color of an animation of a building. |
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. |
getBuildingDrawXY (x, y) | Returns the draw pivot position of the building at a given position. |
getBuildingFrame (x, y) | Returns the current frame of a building at a given position. |
getBuildingIcon (x, y) | Gets the currently set custom building icon for the specified building. |
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. |
getBusStop (x, y, level) | Returns the draft of the bus stop on the road at a given position and level. |
getCornerTerrainHeight (x, y) | Returns the terrain height of the tile corner at a given position. |
getFenceDraft (x, y, edge) | Returns the fence draft of the fence at the given location at the given edge. |
getGroundDraft (x, y[, level=0]) | Returns the ground draft at a given position. |
getGroundHeight (x, y) | Returns the legacy 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. |
getPipeFrame (x, y) | Returns the active frame of the pipe at a given location. |
getRoadAbsoluteLevel (x, y, level) | Returns the absolute level of a road at a given position and level. |
getRoadAlign (x, y, level) | Returns the alignment of a road at a given position and level. |
getRoadBridgeType (x, y, level) | Returns the bridge type of a road at a given position and level. |
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[, index=1]) | Returns the draft of the road decoration on the road at a given position and level. |
getRoadDirection (x, y, level) | Returns the direction of a 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=0]) | Returns the draft of the road occupcation on the road at a given position and level. |
getRoadSlopeDirection (x, y, level) | Returns the bridge entrance or exit direction of a 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=0]) | Returns the draft of the wire at a given location. |
getWireFrame (x, y[, level=0]) | Returns the frame of the wire at a given location. |
getZoneDraft (x, y) | Returns the draft of the zone 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. |
hasBuildingPendingUpgrade (upgradeId, x, y) | Returns true iff the building at a given position has a specific pending upgrade on it. |
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. |
hasFence (x, y[, edge]) | Returns true iff there is any fence at the given location. |
hasFenceWithin (x, y, width, height) | Returns true iff there is any fence within a specifiedc rectangle. |
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 is a building at the given position that 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. |
isBusStop (x, y, level) | Returns true iff there's a bus stop on the road at a given position and level. |
isCoast (x, y) | Returns true iff there's land at a given position and water on at least one of the four neighboring tiles. |
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. |
isRoadPile (x, y, level) | Returns the bridge pile of a road at a given position and level. |
isRoadSlope (x, y, level) | Returns true iff there's a bridge entrance or exit on the road at a given position and level. |
isSlope (x, y) | Determines whether there is a slope in the terrain at a given position. |
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=0]) | Determines whether there is a wire at the given location and level. |
isWirePole (x, y[, level=0]) | Returns true iff there's a pole on the wire at a given position 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. |
setBuildingAnimationColor (x, y, red, green, blue[, alpha=255[, slot=1]]) | Sets the color of an animation of 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. |
setBuildingIcon (x, y, icon) | Sets a building icon for the specified building. |
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. |
setGroundHeight (x, y, height) | Sets the legacy ground height of a tile. |
setRoadAlignment (x, y, level, alignment) | Sets the alignment of a road at a given position and level. |
setRoadBridgeType (x, y, level[, index=0]) | Sets the bridge type on the road at a given position and level. |
setRoadOccupation (draft, x, y[, level=0]) | Sets the road occupation on the road at a given position and level. |
setRoadOneWayAlignment (x, y, level, alignment) | Sets the direction and alignment of a road at a given position and level. |
setRoadPile (x, y, level, state) | Sets the bridge pile on the road at a given position and level. |
setWirePole (x, y[, level=0], state) | Sets the wire pole on the wire at a given position and level. |
spawnBuildingPedestrian (x, y[, amount=1]) | Will register one or multiple pedestrians for spawning from this building. |
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.
- countRoadBridgeType (x, y, level)
-
Returns the bridges number of the road at a given position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
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 bridges number of the road or zero if there's no road and or bridge frames.
- countRoadDecos (x, y, level)
-
Returns the number of decorations on the road at a given position and level.
New feature:
-
This is a new feature that was added in version 1.9.96
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 number of decorations on the road or zero if there's no road and or decorations.
- 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 building object that can be use to call building related functions
more conveniently.
Parameters:
- x int X component of a building position.
- y int Y component of a building position.
Returns:
-
Building
A building object with convenient functions.
- getBuildingAnimationColor (x, y[, slot=1])
-
Gets the color of an animation of a building. The default color is white
which is expressed as 255,255,255,255.
New feature:
-
This is a new feature that was added in version 1.10.49
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,int,int,int or nil
If the operation was successful the color is returned as four integer numbers.
- 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
- getBuildingDrawXY (x, y)
-
Returns the draw pivot position of the building at a given position.
You can use the result for use in Drawing.setTile() to get rotation
independent drawing based on the building's left most point.
New feature:
-
This is a new feature that was added in version 1.11.09
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 drawing tile position of
the building.
- 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
The zero based building frame if there is a building.
- getBuildingIcon (x, y)
-
Gets the currently set custom building icon for the specified building.
New feature:
-
This is a new feature that was added in version 1.11.61
Parameters:
- x int X component of a building position.
- y int Y component of a building position.
Returns:
-
draft
The currently used animation draft or nil.
- 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 or nil
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:
-
float
- 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:
- 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.
- getBusStop (x, y, level)
-
Returns the draft of the bus stop on the road at a given
position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
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
- getCornerTerrainHeight (x, y)
-
Returns the terrain height of the tile corner at a given position.
Valid locations range from 0,0 to widht,height (inclusive) so the corners
at the right edges of the city can be addressed.
In contrast to "ground height" terrain height refers to the hill functionality
that was added with the TheoTown66 release.
A height step is 12 pixels in size visually.
Ocean level has height 0. Smaller values are not possible.
New feature:
-
This is a new feature that was added in version 1.10.87
Parameters:
- x int X component of a corner position.
- y int Y component of a corner position.
Returns:
-
int
An int value that indicates the height of the terrain at the corner.
- getFenceDraft (x, y, edge)
-
Returns the fence draft of the fence at the given location at the given
edge.
As fences are technically placed in-between tiles two neighboring tiles always
share an edge in between them.
Because of that the following formulas should hold true:
For edge 0 (south-east):
Tile.getFenceDraft(x, y, 0) == Tile.getFenceDraft(x + 1, y, 2)
For edge 1 (north-east):
Tile.getFenceDraft(x, y, 1) == Tile.getFenceDraft(x, y + 1, 3)
For edge 2 (north-west):
Tile.getFenceDraft(x, y, 2) == Tile.getFenceDraft(x - 1, y, 0)
For edge 3 (south-west):
Tile.getFenceDraft(x, y, 3) == Tile.getFenceDraft(x, y - 1, 1)
Queries to tiles that are not inside the city should behave accordingly.
New feature:
-
This is a new feature that was added in version 1.9.99
Parameters:
- x int X component of a location.
- y int Y component of a location.
- edge int Fences can be located at all four edges of a tile. The edges are indexed as follows (for non rotated city): 0 is south-east, 1 is north-east, 2 is north-west, 3 is south-west
Returns:
-
draft or nil
The fence draft or nil if there is no fence.
- 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 -1 (water), 0 (main) or 1 (deco). Level -1 queries the water draft that is used to draw water for this tile. The water draft is determined by the level 0 draft of this and neighboring tiles. The default water draft will be returned if there are no water tiles nearby. (default 0)
Returns:
-
draft
- getGroundHeight (x, y)
-
Returns the legacy ground height at a given position.
Ground height is a legacy system used for terrain shading and water
depth coloring. It was added to the game before there were actual hills.
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.
Negative values are possible.
- 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:
-
float
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.
- getPipeFrame (x, y)
-
Returns the active frame of the pipe at a given location.
This frame is independent of city rotation.
New feature:
-
This is a new feature that was added in version 1.10.09
Parameters:
- x int X component of a location.
- y int Y component of a location.
Returns:
-
int or nil
The zero based frame index of the pipe if there is a pipe.
- getRoadAbsoluteLevel (x, y, level)
-
Returns the absolute level of a road at a given position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
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 or nil
The absolute level of the road.
The absolute level is the road level reduced by the terrain height.
- getRoadAlign (x, y, level)
-
Returns the alignment of a road at a given position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
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 or nil
The absolute alignment of the road
with a range from 0 to 15.
- getRoadBridgeType (x, y, level)
-
Returns the bridge type of a road at a given position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
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 or nil
The bridge type of the road
depends of the road bridge frames.
- 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[, index=1])
-
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.
- index int Index of the decoration. Starts with 1. (default 1)
Returns:
-
draft
- getRoadDirection (x, y, level)
-
Returns the direction of a road at a given position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
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 or nil
The direction of the road.
The directions are indexed as follows (for non rotated city):
1 is east direction,
2 is north direction,
4 is west direction,
8 is south direction.
- 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=0])
-
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. (default 0)
Returns:
-
animationdraft
The draft used for the occupation or nil if no
occupation is set.
- getRoadSlopeDirection (x, y, level)
-
Returns the bridge entrance or exit direction of a road at a given
position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
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 bridge entrance or exit direction of the road.
The directions are indexed as follows (for non rotated city):
0 flat road direction.
1 east entrance direction | west exit direction.
2 north entrance direction | south exit direction.
4 west entrance direction | east exit direction.
8 sout exit direction | north exit direction.
- 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:
-
float
0..1 with 1 being high traffic
- getTerrainHeight (x, y)
-
Returns the average terrain height at a given position.
Interpolates between the height of all four edges in case of a slope.
In contrast to "ground height" terrain height refers to the hill functionality
that was added with the TheoTown66 release.
A height step is 12 pixels in size visually.
Ocean level has height 0. Smaller values are not possible.
Parameters:
- x int X component of a position.
- y int Y component of a position.
Returns:
-
float
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:
-
int
The zero based frame index of the tree
- getWireDraft (x, y[, level=0])
-
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). (default 0)
Returns:
-
draft or nil
The draft of the wire if there is any.
- getWireFrame (x, y[, level=0])
-
Returns the frame of the wire at a given location.
Frame indices are zero based and city rotation independent.
New feature:
-
This is a new feature that was added in version 1.10.09
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). (default 0)
Returns:
-
int or nil
The zero based frame of the wire if there is any.
- getZoneDraft (x, y)
-
Returns the draft of the zone 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 zone or nil if there is no zone.
- 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
- hasBuildingPendingUpgrade (upgradeId, x, y)
-
Returns true iff the building at a given position has a specific pending
upgrade on it.
Pending upgrades are being built right now and will be applied in the future.
New feature:
-
This is a new feature that was added in version 1.11.12
Parameters:
- upgradeId string or draft Id or draft of a building upgrade.
- x int X component of a building position.
- y int Y component of a building position.
Returns:
-
bool or nil
True iff the building has the pending building upgrade.
- 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 or draft Id or draft of a building upgrade.
- x int X component of a building position.
- y int Y component of a building position.
Returns:
-
bool or nil
True iff the building has the building upgrade.
- hasFence (x, y[, edge])
-
Returns true iff there is any fence at the given location.
New feature:
-
This is a new feature that was added in version 1.9.99
Parameters:
- x int X component of a location.
- y int Y component of a location.
- edge int The edge to check for. If not specified the whole tile will be checked for any fences. (optional)
Returns:
-
bool
True iff there is at least once fence.
- hasFenceWithin (x, y, width, height)
-
Returns true iff there is any fence within a specifiedc rectangle.
New feature:
-
This is a new feature that was added in version 1.9.99
Parameters:
- x int X component of a location.
- y int Y component of a location.
- width int Width of the target area.
- height int Height of the target area.
Returns:
-
bool
True iff there is at least once fence within the rectangle.
- 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 is a building at the given position that 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
- isBusStop (x, y, level)
-
Returns true iff there's a bus stop on the road at a given
position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
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
- isCoast (x, y)
-
Returns true iff there's land at a given position and water on at least
one of the four neighboring tiles.
New feature:
-
This is a new feature that was added in version 1.9.80
Parameters:
- x int X component of a position.
- y int Y component of a position.
Returns:
-
bool
Whether this is a land tile that is near water.
- 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
- isRoadPile (x, y, level)
-
Returns the bridge pile of a road at a given position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
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 a brige pile.
- isRoadSlope (x, y, level)
-
Returns true iff there's a bridge entrance or exit on the road at a given
position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
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 or nil
- isSlope (x, y)
-
Determines whether there is a slope in the terrain at a given position.
The height step of a slope is 12 pixels in size visually.
Parameters:
- x int X component of a position.
- y int Y component of a position.
Returns:
-
bool
True iff there is a slope at the given position, false otherwise.
- 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=0])
-
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). (default 0)
Returns:
-
bool
True iff there is a wire.
- isWirePole (x, y[, level=0])
-
Returns true iff there's a pole on the wire at a given
position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
Parameters:
- x int X component of a position.
- y int Y component of a position.
- level int Level of the wire to look for. The level must be equal or greater than 0 (underground wires don't have poles). (default 0)
Returns:
-
bool
True iff there is a wire pole.
- 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.
- setBuildingAnimationColor (x, y, red, green, blue[, alpha=255[, slot=1]])
-
Sets the color of an animation of a building. The default color is white
which is expressed as 255,255,255 or 255,255,255,255.
New feature:
-
This is a new feature that was added in version 1.10.49
Parameters:
- x int X component of a building position.
- y int Y component of a building position.
- red int The red color component.
- green int The green color component.
- blue int The blue color component.
- alpha int The alpha color component that is considered as transparency. (default 255)
- 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.
- 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 zero based frame index to set.
- setBuildingIcon (x, y, icon)
-
Sets a building icon for the specified building.
Note that game building icons have higher precedence than custom ones.
For reference the game's internal icons have the following ids:
$buildingicon_illness00, $buildingicon_noroad00, $buildingicon_noenergy00, $buildingicon_nowater00, $buildingicon_overloaded00, $buildingicon_unhappy00, $buildingicon_waste00, $buildingicon_wasteoverloaded00, $buildingicon_deadbodies00, $buildingicon_deadbodiesoverloaded00, $buildingicon_crimegraffiti00, $buildingicon_crimeburglary00, $buildingicon_crimemurder00, $buildingicon_crimeriot00
New feature:
-
This is a new feature that was added in version 1.11.61
Parameters:
- x int X component of a building position.
- y int Y component of a building position.
- icon string or draft An animation draft to use as icon. Use nil to reset.
- 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 or nil 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 float 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 bool The untouchable state to set for the building. (default true)
- setGroundHeight (x, y, height)
-
Sets the legacy ground height of a tile.
Ground height is a legacy system used for terrain shading and water
depth coloring. It was added to the game before there were actual hills.
Parameters:
- x int X component of a position.
- y int Y component of a position.
- height int An integer that represents height. 0 means ocean level. Negative values are possible.
- setRoadAlignment (x, y, level, alignment)
-
Sets the alignment of a road at a given position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
Parameters:
- x int X component of a position.
- y int Y component of a position.
- level int A road level with 0 being ground.
- alignment int The zero based alignment index to set with a range from 0 to 15.
- setRoadBridgeType (x, y, level[, index=0])
-
Sets the bridge type on the road at a given position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
Parameters:
- x int X component of a position.
- y int Y component of a position.
- level int A road level with 0 being ground.
- index int The bridge type index of the road depends of the road bridge frames. (default 0)
- setRoadOccupation (draft, x, y[, level=0])
-
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. (default 0)
- setRoadOneWayAlignment (x, y, level, alignment)
-
Sets the direction and alignment of a road at a given position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
Parameters:
- x int X component of a position.
- y int Y component of a position.
- level int A road level with 0 being ground.
- alignment int The zero based alignment index to set with a range from 0 to 63.
- setRoadPile (x, y, level, state)
-
Sets the bridge pile on the road at a given position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
Parameters:
- x int X component of a position.
- y int Y component of a position.
- level int A road level with 0 being ground.
- state bool The brige pile state to set for the road.
- setWirePole (x, y[, level=0], state)
-
Sets the wire pole on the wire at a given position and level.
New feature:
-
This is a new feature that was added in version 1.11.40
Parameters:
- x int X component of a position.
- y int Y component of a position.
- level int Level of the wire to look for. The level must be equal or greater than 0 (underground wires don't have poles). (default 0)
- state bool The pole state to set for the wire.
- spawnBuildingPedestrian (x, y[, amount=1])
-
Will register one or multiple pedestrians for spawning from this building.
The pedestrians will be spawned over time on neighboring roads.
The pedestrian type to be spawned will be picked based on the spawning
building if it has the "pedestrian" attribute defined.
Otherwise the normal picking mechanism will be used that considers present
influence values.
New feature:
-
This is a new feature that was added in version 1.10.95
Parameters:
- x int X component of a building position.
- y int Y component of a building position.
- amount int Amount of pedestrians to spawn. (default 1)
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.