diff --git a/CHANGELOG.md b/CHANGELOG.md index 48006ea7..51d3dc35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d ### Added - Add Copy/Paste for metatiles in the Tileset Editor. -- Add ability to set the opacity of the scripting overlay. -- Add ability to get/set map header properties and read tile pixel data via the API. +- Add new features to the scripting API, including the ability to set overlay opacity, get/set map header properties, read tile pixel data, and set blocks using a raw value. - Add button to copy the full metatile label to the clipboard in the Tileset Editor. - Add option to not open the most recent project on launch. - Add color picker to palette editor for taking colors from the screen. @@ -33,6 +32,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d - Fix cursor tile and player view outlines exiting map bounds while painting. - Fix cursor tile and player view outlines not updating immediately when toggled in Collision view. - Fix selected space not updating while painting in Collision view. +- Fix collision values of 2 or 3 not rendering properly. - Fix the map music dropdown being empty when importing a map from Advance Map. - Fixed a bug where saving the tileset editor would reselect the main editor's first selected metatile. diff --git a/docsrc/manual/scripting-capabilities.rst b/docsrc/manual/scripting-capabilities.rst index d86208cc..21f53591 100644 --- a/docsrc/manual/scripting-capabilities.rst +++ b/docsrc/manual/scripting-capabilities.rst @@ -190,11 +190,21 @@ The following functions are related to editing the map's blocks or retrieving in :param number x: x coordinate of the block :param number y: y coordinate of the block :param number metatileId: the metatile id of the block - :param number collision: the collision of the block (``0`` = passable, ``1`` = impassable) + :param number collision: the collision of the block (``0`` = passable, ``1-3`` = impassable) :param number elevation: the elevation of the block :param boolean forceRedraw: Force the map view to refresh. Defaults to ``true``. Redrawing the map view is expensive, so set to ``false`` when making many consecutive map edits, and then redraw the map once using ``map.redraw()``. :param boolean commitChanges: Commit the changes to the map's edit/undo history. Defaults to ``true``. When making many related map edits, it can be useful to set this to ``false``, and then commit all of them together with ``map.commit()``. +.. js:function:: map.setBlock(x, y, rawValue, forceRedraw = true, commitChanges = true) + + Sets a block in the currently-opened map. This is an overloaded function that takes the raw value of a block instead of each of the block's properties individually. + + :param number x: x coordinate of the block + :param number y: y coordinate of the block + :param number rawValue: the 16 bit value of the block. Bits ``0-9`` will be the metatile id, bits ``10-11`` will be the collision, and bits ``12-15`` will be the elevation. + :param boolean forceRedraw: Force the map view to refresh. Defaults to ``true``. Redrawing the map view is expensive, so set to ``false`` when making many consecutive map edits, and then redraw the map once using ``map.redraw()``. + :param boolean commitChanges: Commit the changes to the map's edit/undo history. Defaults to ``true``. When making many related map edits, it can be useful to set this to ``false``, and then commit all of them together with ``map.commit()``. + .. js:function:: map.getMetatileId(x, y) Gets the metatile id of a block in the currently-opened map. @@ -215,7 +225,7 @@ The following functions are related to editing the map's blocks or retrieving in .. js:function:: map.getCollision(x, y) - Gets the collision of a block in the currently-opened map. (``0`` = passable, ``1`` = impassable) + Gets the collision of a block in the currently-opened map. (``0`` = passable, ``1-3`` = impassable) :param number x: x coordinate of the block :param number y: y coordinate of the block @@ -223,7 +233,7 @@ The following functions are related to editing the map's blocks or retrieving in .. js:function:: map.setCollision(x, y, collision, forceRedraw = true, commitChanges = true) - Sets the collision of a block in the currently-opened map. (``0`` = passable, ``1`` = impassable) + Sets the collision of a block in the currently-opened map. (``0`` = passable, ``1-3`` = impassable) :param number x: x coordinate of the block :param number y: y coordinate of the block