Module CorsixTH.CorsixTH.Lua.dialogs.resizables.map_editor

Decide the highest possible placement for 'width' columns.

Functions

UIMapEditor:areaOnWorld (xpos, ypos, xsize, ysize) Stay on world with the entire area, by moving the base position (if needed).
UIMapEditor:buildSpriteButtons (buttons) Do layout of the sprite buttons of the page.
UIMapEditor:checkObjectSpace (obj_type, xpos, ypos, direction, remove) Collect other objects that use the space needed for the specified new object.
UIMapEditor:copyArea () Copy area from the game.
UIMapEditor:deleteWallsAtArea (coords) Delete the walls at the given coordinates.
UIMapEditor:draw (canvas) Draw the display (map editor window, and main world display)
UIMapEditor:drawCursorSpriteAtArea (coords) Draw the selected sprite at the given coordinates.
UIMapEditor:drawObject (obj_type, xpos, ypos, direction) Add an object to the map.
UIMapEditor:fillCursorArea (canvas, xpos, ypos, xsize, ysize) Fill an area of tiles with red cursor rectangles.
UIMapEditor:findObjects (minx, miny, thobdir_positions) Recognize objects in the collection of thob+tallWest entries
UIMapEditor:getCursorDragCapabilities () Retrieve what drag capabilities are allowed by the currently selected world cursor sprite.
UIMapEditor:getDrawPoints () Compute the positions to draw the selected sprite in the world.
UIMapEditor:mouseToWorld (mx, my) Convert mouse coordinates to tile coordinates in the world.
UIMapEditor:onMouseDown (button, xpos, ypos) Mouse button got pressed.
UIMapEditor:onMouseMove (x, y, dx, dy) The user moved the mouse!
UIMapEditor:onMouseUp (button, x, y) Mouse button was released.
UIMapEditor:pageClicked (name) Callback function of the page select buttons.
UIMapEditor:pasteArea () Paste copied area into the destination area (one or more times).
UIMapEditor:removeDoor (door) Remove an entrance door from the world.
UIMapEditor:setParcelAtArea (coords, parcel_num) Set parcel number at the given coordinates.


Functions

UIMapEditor:areaOnWorld (xpos, ypos, xsize, ysize)
Stay on world with the entire area, by moving the base position (if needed).

Parameters:

  • xpos (int) Horizontal base position.
  • ypos (int) Vertical base position.
  • xsize (int) Horizontal size.
  • ysize (int) Vertical size.

Returns:

    (int, int) Allowed base position
UIMapEditor:buildSpriteButtons (buttons)
Do layout of the sprite buttons of the page.

Parameters:

  • buttons
UIMapEditor:checkObjectSpace (obj_type, xpos, ypos, direction, remove)
Collect other objects that use the space needed for the specified new object. If they exist, return them or delete them.

Parameters:

  • obj_type (str) Type of object ("entrance_door")
  • xpos (int) Desired x position of the new object.
  • ypos (int) Desired y position of the new object.
  • direction (str) Direction of the new object ("north" or "west").
  • remove (bool) If set, remove the found objects.

Returns:

    (list) The objects that use the space, if they are not removed.
UIMapEditor:copyArea ()
Copy area from the game.

Returns:

    (bool) Whether copying succeeded.
UIMapEditor:deleteWallsAtArea (coords)
Delete the walls at the given coordinates.

Parameters:

  • coords (array or {xpos, ypos} tables) Coordinates to remove the walls.
UIMapEditor:draw (canvas)
Draw the display (map editor window, and main world display)

Parameters:

  • canvas (draw object) Canvas to draw on.
UIMapEditor:drawCursorSpriteAtArea (coords)
Draw the selected sprite at the given coordinates.

Parameters:

  • coords (array or {xpos, ypos} tables) Coordinates to draw the selected sprite.
UIMapEditor:drawObject (obj_type, xpos, ypos, direction)
Add an object to the map. Currently, only "entrance_door" is supported.

Parameters:

  • obj_type (str) Type of object ("entrance_door")
  • xpos (int) Desired x position of the new object.
  • ypos (int) Desired y position of the new object.
  • direction (str) Direction of the new object ("north" or "west").
UIMapEditor:fillCursorArea (canvas, xpos, ypos, xsize, ysize)
Fill an area of tiles with red cursor rectangles. Caller must make sure that the area is completely inside the world boundaries.

Parameters:

  • canvas Canvas to draw at.
  • xpos (int) Horizontal base tile position (of the top corner).
  • ypos (int) Vertical base tile position (of the top corner).
  • xsize (int) Horizontal size in tiles.
  • ysize (int) Vertical size in tiles.
UIMapEditor:findObjects (minx, miny, thobdir_positions)
Recognize objects in the collection of thob+tallWest entries

Parameters:

  • minx (int) Base horizontal position (objects should be put relative to it).
  • miny (int) Base vertical position (objects should be put relative to it).
  • thobdir_positions (table xy to {thob, tallWest}) Found thobs.

Returns:

    (array of {type, xpos, ypos, direction}) Found objects.
UIMapEditor:getCursorDragCapabilities ()
Retrieve what drag capabilities are allowed by the currently selected world cursor sprite.

Returns:

    (string) "none"=not draggable, "east-west"=dragging only in east-west direction, "north-south"=dragging only in north-south direction, "area"=dragging in both directions.
UIMapEditor:getDrawPoints ()
Compute the positions to draw the selected sprite in the world.

Returns:

    (array of {xpos, ypos} tables) Coordinates to draw the selected sprite.
UIMapEditor:mouseToWorld (mx, my)
Convert mouse coordinates to tile coordinates in the world.

Parameters:

  • mx (int) Mouse X screen coordinate.
  • my (int) Mouse y screen coordinate.

Returns:

    (int, int) Tile x,y coordinates, limited to the map.
UIMapEditor:onMouseDown (button, xpos, ypos)
Mouse button got pressed.

Parameters:

  • button (string) Mouse button being pressed.
  • xpos (int) Horizontal position of the mouse at the time of the mouse button press.
  • ypos (int) Vertical position of the mouse at the time of the mouse button press.

Returns:

    (bool) Whether to repaint the display.
UIMapEditor:onMouseMove (x, y, dx, dy)
The user moved the mouse!

Parameters:

  • x (int) New horizontal position of the mouse at the screen.
  • y (int) New vertical position of the mouse at the screen.
  • dx (int) Horizontal shift in position of the mouse at the screen.
  • dy (int) Vertical shift in position of the mouse at the screen.
UIMapEditor:onMouseUp (button, x, y)
Mouse button was released.

Parameters:

  • button (string) Mouse button being released.
  • x (int) Horizontal position of the mouse at the time of the mouse button release.
  • y (int) Vertical position of the mouse at the time of the mouse button release.

Returns:

    (bool) Whether to repaint the display.
UIMapEditor:pageClicked (name)
Callback function of the page select buttons.

Parameters:

  • name (string) Name of the clicked page.
UIMapEditor:pasteArea ()
Paste copied area into the destination area (one or more times).
UIMapEditor:removeDoor (door)
Remove an entrance door from the world.

Parameters:

  • door Entrance door to remove.
UIMapEditor:setParcelAtArea (coords, parcel_num)
Set parcel number at the given coordinates.

Parameters:

  • coords (array or {xpos, ypos} tables) Coordinates to set parcel.
  • parcel_num (int) Parcel number to set.
generated by LDoc TESTING Last updated 2015-01-01 12:00:00