- Map: Create `PROTOCOL_VERSION` set to 27 (current maximum in MineTest)
- Map: Modify the default version of `MapBlock.version`
- Map: Add `MapBlock.lighting_complete` set to 0 (introduced in version 27)
- Map: Define `MapBlock.{set,get}_lighting_complete` which take/return tables representing a MapBlock's 'Lighting Complete' flags
- Map: Update implode and explode methods to take in account modifications introduced in version 27
- Map: Change 'equal to' to 'greater than or equal' when checking for version 25 time data length compatibility
- Nodes: Add `param0` as a field of `Node`
- Nodes: Add getters and setters for `Node`
- Tests: Add a section to check 'Lighting Complete' flags setting/getting
- For #8
- Remove all modulo operations in Pos.getAsInt()
- Change MapInterface.get_node and MapInterface.set_node to apply the modulo themselves
- Be a little bit more explicit about invalid coordinates whenever a MapBlock receives one
- Map: Rewrite MapVessels and MapInterface. MapVessels do not manage any cache any more, the MapInterface manages StackCaches (new class)
for cache_history and mod_cache. Those caches replace the old db.interface.cache. The field 'interface' for MapInterfaces is now called 'container'.
MapInterface.mod_flag is now called MapInterface.flag_mod, and it comes with MapInterface.unflag_mod (in case you need it). MapInterface cannot discard
changes on mapblocks when unloading them, it will always save them.
- Utils: Remove intFromPos since you can use Pos.getAsInt(max_val=16). Pos objects are initialized using three integers, not a dict any more
- Demos: All demos are updated to use new code
- Maps: Add a method to `MapVessel` to empty its cache and remove all blocks from the database
- Demo: Fix the exit signal for schematic manipulation demo
- Sources moved to the right directory
- Setup.py written
- Demos moved to bin/
- Global test script moved to tests/
- Moved src/ to libminetest/
- Solves #1
- Configuration : Use a parallel list of lines to recreate comments and blank lines
- Test : Improve the test for configuration objects (checking removal, addition, modification). All tests are activated again, and they will use the environment variable 'HOME' to determine the home directory of the user
- Map: Do not create and store name/id mappings for each one of the 4096 air nodes set when initiating an empty mapblock
- Logger: Use `module` rather than `name` for the format
- Logger : Add basic logging with debug level
- Map:
- Make empty mapblocks able to implode into correct mapblock data and activate them with air everywhere
- Do not update name_id_mappings every time a node is set
- Fix crash when a mapblock was removed from the cache history
- Use logging
- Add a method called `init_mapblock` to create and store an empty mapblock
- Compute strings and values only one time during schematic importation. Also, create missing mapblocks (ungenerated) and add option to save every 10% (in case of very large schematic)
- Demo: Schematic Manipulation: Use a small cache size to force saving into the interface as soon as possible
- Minetest: Declare version
- Tests: Move main code in a `main` function
- Unified indentation in the source code
- MapInterfaces (`minetest.map.MapInterface`) can now import schematics as well
- Some prints in MapVessel's (`minetest.map.MapVessel`) code were labeled "WARNING", the others commented
- Utils :
- A class called Vector (`minetest.utils.Vector`) is added to deal with vectors and Pos (`minetest.utils.Pos`) manipulation
- Tests :
- Tests are made more fancy with check lists (rather than big data dumps) and time tests. All tests were remade and organized to include assertations and prettier printing
- Demo :
- A new demo is available, it is called demo_schematics_manipulation and serves the purpose of exporting/importing schematics from/into a map database
- Schematics :
- The export method now writes position integers on the correct amount of bytes
- Minetest :
- All python source code files are imported into the single file minetest.py, later imported by any other source code file
- Demo : create a file called demo_clean_unknown with all the code to clean maps from unknown nodes extracted from tests.py
- Tests : all tests are reactivated and the unknown nodes cleaning code is moved to a demo file
- Maps : MapVessels can now retrieve a list of all available mapblock positions, and the isEmpty method is now called is_empty to be consistent with naming convention in the class
- The .py files are moved in a folder called 'src'
- Schematics: Adds schematics. They are compatible with minetest's mts format. A Schematic object can import a mts file, read binary data, export its data into a BytesIO stream, and write its binary data to a file readable by minetest
- Map: MapInterfaces can now be requested to copy a part of a map delimited by two positions in space into a Schematic object, later usable and savable. Mapblocks' nodes now show their correct position in the world. Mapblocks also store their mapblock position and the integer representing that position in the mapblock grid. MapVessels' methods' naming convention is also unified
- Test: The picture building function is removed. Messages are added to the test functions, and a new one is implemented, removing all unknown items once provided with a map.sqlite file and another file containing all known nodes' itemstrings (dumped from the minetest server)
- Tools: A mod was developed to be used in minetest in order to dump the known nodes list. Copy the mod and use /dumpnodes for this
* Inventory: Two functions added : is_empty(listname) and get_size(listname), both working in a similar fashion as their minetest API counterpart
* Map:
- Implosion fixed. The num_name_id_mappings variable is correctly set, all data are written to the correct byte streams. A function is added to check whether a position given to a function (list get/set_node) is correct and the mapblock is loaded.
- Data storage type for static object data fixed
- MapBlocks now have a get_meta(abspos) method. Abspos is the integer representing the position of the querried metadata inside the mapblock
- MapVessels default to forcefully save a flagged mapblock before unloading it
- A new method in MapInterface can flag a mapblock as modified. It is used in member methods to deal with the modification cache flags more easily
- MapInterface has got another new function to check whether a mapblock is loaded or not and try to load it, all depending on a given position
- MapInterface's save method is fixed
- MapInterfaces can return a node's metadata using the get_meta(pos) method. It determines what mapblock contains the quierried node, and use the said mapblock's get_meta method to return a NodeMetaRef object
* Metadata : Strings are stored as and decoded from arrays of integers, easier to convert from bytes without knowing what is float, what is int, and what is string
* Nodes : The position argument in a Node object is now a key argument. The only mandatory parameter is the itemstring
* Test : testSetNode now completly working. It doesn't change the node in (0,0,0) anymore. This node is a chest in the test map and is used to test metadata and inventory manipulation in the new invManip function called upon execution of test.py
- Errors: Add a new error called `IgnoreContentReplacementError` similar to what Minetest would consider as an attempt to replace CONTENT_IGNORE
- Inventory: The serializing algorithm was fixed to put items in the right order. `InvRef` objects can now directly export data into a serialized string with `to_string`
- Map:
* New functions and methods are imported to be used.
* Add `create_id_mappings` and `implode` along with `set_node`. They respectively update the name/id mapping table, export data into a binary blob to be written in the database, and set_node inside the node table
* When writing a mapblock, the changes are commited. This will later be removed and a function which is still WIP called `save` will allow `MapInterface` objects to save all unstaged changes
* Alternatively, setting a `MapVessel`'s `force_save_on_unload` field to `True` will save all unsaved mapblocks that are to be unloaded (for caching reasons)
* `MapVessel`s also have a new method called `store` to write binary blobs in cache before writing
* The cache mechanism might be removed later due to the principle of unstaged/uncommited changes inherent to sqlite's python module
* When `MapInterface`s unload a mapblock, they print a warning message, it being about either saving or discarding the changes made depending on the value of the object's `force_save_on_unload` field
* A counterpart to `MapInterface.loadMapBlock`, `MapInterface.saveMapBlock`, is created to act as a wrapper around the copy of a mapblock's binary blob data into the `MapVessel`'s cache
- Metadata: A `NodeMetaRef` object can be initialized without any parameter, giving it default values (`.meta` is `dict`, `.pos` is `Pos` and `.inv` is `InvRef`)
- Minetest: Every class in nodes.py is imported into the exposed namespace
- Test: Two new functions were added, to test massive use of `get_node` and simple use of `set_node`. Note: None of them are stable as of now
- Reorganize the MapVessel
- Introduce MapInterfaces with cache size control
- New error : EmptyMapblockError
- MapVessel now reads a mapblock if it is not cached but asked for loading
- MapBlock now organizes all nodes in a single dict
- Fix param0 reading and AssertionError in MapBlock.explode
- Add get_node to MapBlock, used by MapInterface to read a node on the relevant MapBlock after loading it from its vessel