Map Class
Lua extensions to the C++ THMap class
Method Index
- ScreenToWorld(x, y)
- WorldToScreen(x, y)
- afterLoad(old, new)
- afterSave()
- clearDebugText()
- draw(canvas, sx, sy, sw, sh, dx, dy)
- getCellFlag(x, y, flag)
- getParcelPrice(parcel)
- getParcelTileCount(parcel)
- getRawData(level_file)
- getRoomId(x, y)
- load(level, difficulty, level_name, level_file, level_intro)
- loadDebugText(base_offset, xy_offset, first, last, bits_)
- loadMapConfig(filename, config, custom)
- onTick()
- prepareForSave()
- registerTemperatureDisplayMethod()
- setBlocks(blocks)
- setCellFlags(...)
- setDebugFont(font)
- setDebugText(x, y, msg, ...)
- setTemperatureDisplayMethod(method)
- updateDebugOverlayFlags()
- updateDebugOverlayHeat()
Member Index
- app
- blocks
- cell_outline
- debug_flags
- debug_font
- debug_text
- debug_tick_timer
- difficulty
- height
- level_config
- level_file
- level_intro
- level_name
- level_number
- parcelTileCounts
- temperature_display_method
- th
- thData
- updateDebugOverlay
- width
function Map:ScreenToWorld(x, y)
Parameters:
Name | Type | Description |
---|---|---|
x | ? | ? |
y | ? | ? |
Declared on: line 82 of Lua/map.lua.
function Map:WorldToScreen(x, y)
Convert between world co-ordinates and screen co-ordinates
World co-ordinates are (at least for standard maps) in the range [1, 128)
for both x and y, with the floor of the values giving the cell index.
Screen co-ordinates are pixels relative to the map origin - NOT relative to
the top-left corner of the screen (use UI:WorldToScreen and UI:ScreenToWorld
for this).
Parameters:
Name | Type | Description |
---|---|---|
x | ? | ? |
y | ? | ? |
Declared on: line 65 of Lua/map.lua.
function Map:afterLoad(old, new)
Parameters:
Name | Type | Description |
---|---|---|
old | ? | ? |
new | ? | ? |
Declared on: line 532 of Lua/map.lua.
function Map:afterSave()
Restore the temporarily stored debug information after saving
Declared on: line 290 of Lua/map.lua.
function Map:clearDebugText()
Declared on: line 302 of Lua/map.lua.
function Map:draw(canvas, sx, sy, sw, sh, dx, dy)
@arguments canvas, screen_x, screen_y, screen_width, screen_height, destination_x, destination_y
Draws the rectangle of the map given by (sx, sy, sw, sh) at position (dx, dy) on the canvas
--
Parameters:
Name | Type | Description |
---|---|---|
canvas | ? | ? |
sx | ? | ? |
sy | ? | ? |
sw | ? | ? |
sh | ? | ? |
dx | ? | ? |
dy | ? | ? |
Declared on: line 427 of Lua/map.lua.
function Map:getCellFlag(x, y, flag)
Parameters:
Name | Type | Description |
---|---|---|
x | ? | ? |
y | ? | ? |
flag | ? | ? |
Declared on: line 41 of Lua/map.lua.
function Map:getParcelPrice(parcel)
Parameters:
Name | Type | Description |
---|---|---|
parcel | ? | ? |
Declared on: line 521 of Lua/map.lua.
function Map:getParcelTileCount(parcel)
Parameters:
Name | Type | Description |
---|---|---|
parcel | ? | ? |
Declared on: line 528 of Lua/map.lua.
function Map:getRawData(level_file)
Parameters:
Name | Type | Description |
---|---|---|
level_file | ? | ? |
Declared on: line 308 of Lua/map.lua.
function Map:getRoomId(x, y)
Parameters:
Name | Type | Description |
---|---|---|
x | ? | ? |
y | ? | ? |
Declared on: line 45 of Lua/map.lua.
function Map:load(level, difficulty, level_name, level_file, level_intro)
Loads the specified level. If a string is passed it looks for the file with the same name
in the "Levels" folder of CorsixTH, if it is a number it tries to load that level from
the original game.
Parameters:
Name | Type | Description |
---|---|---|
level | ? | The name (or number) of the level to load. If this is a number the game assumes the original game levels are considered. |
difficulty | ? | ? |
level_name | ? | The name of the actual map/area/hospital as written in the config file. |
level_file | ? | The path to the map file as supplied by the config file. |
level_intro | ? | ? |
Declared on: line 109 of Lua/map.lua.
function Map:loadDebugText(base_offset, xy_offset, first, last, bits_)
Parameters:
Name | Type | Description |
---|---|---|
base_offset | ? | ? |
xy_offset | ? | ? |
first | ? | ? |
last | ? | ? |
bits_ | ? | ? |
Declared on: line 343 of Lua/map.lua.
function Map:loadMapConfig(filename, config, custom)
Loads map configurations from files. Returns nil as first result
if no configuration could be loaded and config as second result no matter what.
Parameters:
Name | Type | Description |
---|---|---|
filename | ? | |
config | ? | If a base config already exists and only some values should be overridden this is the base config |
custom | ? | If true The configuration file is searched for where filename points, otherwise it is assumed that we're looking in the theme_hospital_install path. |
Declared on: line 216 of Lua/map.lua.
function Map:onTick()
Declared on: line 385 of Lua/map.lua.
function Map:prepareForSave()
Keep debug information in temporary local vars, do not save them
Declared on: line 278 of Lua/map.lua.
function Map:setBlocks(blocks)
Parameters:
Name | Type | Description |
---|---|---|
blocks | ? | ? |
Declared on: line 396 of Lua/map.lua.
function Map:setCellFlags(...)
Parameters:
Name | Type | Description |
---|---|---|
... | ? | ? |
Declared on: line 401 of Lua/map.lua.
function Map:setDebugFont(font)
Parameters:
Name | Type | Description |
---|---|---|
font | ? | ? |
Declared on: line 405 of Lua/map.lua.
function Map:setDebugText(x, y, msg, ...)
Parameters:
Name | Type | Description |
---|---|---|
x | ? | ? |
y | ? | ? |
msg | ? | ? |
... | ? | ? |
Declared on: line 410 of Lua/map.lua.
function Map:setTemperatureDisplayMethod(method)
Parameters:
Name | Type | Description |
---|---|---|
method | ? | ? |
Declared on: line 49 of Lua/map.lua.
function Map:updateDebugOverlayHeat()
Declared on: line 334 of Lua/map.lua.