4 Commits

Author SHA1 Message Date
LeMagnesium
c64b27d1de Code cleanup
- Removal of useless prints
 - writeU* code cleanup
2016-02-09 08:12:09 +00:00
LeMagnesium
20d51a325c Unstable implementation of set_node
- 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
2016-02-07 15:51:56 +01:00
LeMagnesium
bf22f10fe6 Implement get_node
- 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
2016-01-25 20:16:30 +01:00
LeMagnesium
4f103d19fd Initial commit 2016-01-25 20:01:29 +01:00