Module CorsixTH.CorsixTH.Lua.map
Lua extensions to the C++ THMap class
Functions
| Map:draw (canvas, sx, sy, sw, sh, dx, dy) | Draws the rectangle of the map given by (sx, sy, sw, sh) at position (dx, dy) on the canvas |
| Map:getCellFlag (x, y, flag) | Get the value of the given flag from the tile at x, y in the map. |
| Map:getDifficulty () | Get the difficulty of the level. |
| Map:getParcelPrice (parcel) | Get the price of a parcel |
| Map:getParcelTileCount (parcel) | Get the number of tiles in a parcel. |
| Map:getRoomId (x, y) | Get the ID of the room of the tile at x, y in the map. |
| Map:registerTemperatureDisplayMethod () | Copy the temperature display method from the Lua data, if available, else use the default. |
| Map:setBlocks (blocks) | Set the sprites to be used by the map. |
| Map:setCameraTile (x, y, player) | Set the camera tile for the given player on the map |
| Map:setHeliportTile (x, y, player) | Set the heliport tile for the given player on the map |
| Map:setTemperatureDisplayMethod (method) | Set how to display the room temperature in the hospital map. |
Functions
- Map:draw (canvas, sx, sy, sw, sh, dx, dy)
-
Draws the rectangle of the map given by (sx, sy, sw, sh) at position (dx, dy) on the canvas
Parameters:
- canvas
- sx Horizontal start position at the screen.
- sy Vertical start position at the screen.
- sw (int) Width of the screen.
- sh (int) Height of the screen.
- dx (jnt) Horizontal destination at the canvas.
- dy (int) Vertical destination at the canvas. ]]
- Map:getCellFlag (x, y, flag)
-
Get the value of the given flag from the tile at x, y in the map.
Parameters:
- x (int) Horizontal position of the tile to query in the map.
- y (int) Vertical position of the tile to query in the map.
- flag (string) Name of the queried flag.
Returns:
-
(?) value of the queried flag.
- Map:getDifficulty ()
-
Get the difficulty of the level. Custom levels and campaign always have medium difficulty.
Returns:
-
(int) difficulty of the level, 1=easy, 2=medium, 3=hard.
- Map:getParcelPrice (parcel)
-
Get the price of a parcel
Parameters:
- parcel (int) Parcel number being queried.
Returns:
-
Price of the queried parcel.
- Map:getParcelTileCount (parcel)
-
Get the number of tiles in a parcel.
Parameters:
- parcel (int) Parcel number being queried.
Returns:
-
Number of tiles in the queried parcel.
- Map:getRoomId (x, y)
-
Get the ID of the room of the tile at x, y in the map.
Parameters:
- x (int) Horizontal position of the tile to query in the map.
- y (int) Vertical position of the tile to query in the map.
Returns:
-
ID of the room at the queried tile.
- Map:registerTemperatureDisplayMethod ()
- Copy the temperature display method from the Lua data, if available, else use the default.
- Map:setBlocks (blocks)
-
Set the sprites to be used by the map.
Parameters:
- blocks (object) Sprite sheet for the map.
- Map:setCameraTile (x, y, player)
-
Set the camera tile for the given player on the map
Parameters:
- x (int) Horizontal position of tile to set camera on
- y (int) Vertical position of the tile to set the camera on
- player (int) Player number (1-4)
- Map:setHeliportTile (x, y, player)
-
Set the heliport tile for the given player on the map
Parameters:
- x (int) Horizontal position of tile to set heliport on
- y (int) Vertical position of the tile to set the heliport on
- player (int) Player number (1-4)
- Map:setTemperatureDisplayMethod (method)
-
Set how to display the room temperature in the hospital map.
Parameters:
- method (int) Way of displaying the temperature. See also THMapTemperatureDisplay enum. 1=red gradients, 2=blue/green/red colour shifts, 3=yellow/orange/red colour shifts