]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - doc/mapformat.txt
Reworked formspecs and kahrl's hexcolor parser
[dragonfireclient.git] / doc / mapformat.txt
index db1619865073c79636388eb81d4bf014ea84fbe5..89863ea043b5118c351e514b33e57a095df997ce 100644 (file)
@@ -1,13 +1,16 @@
-===============================================
-Minetest World Format used as of 0.4.dev-120322
-===============================================
+=============================
+Minetest World Format 22...25
+=============================
 
-This applies to a world format carrying the block serialization version 22
-which is used at least in version 0.4.dev-120322.
+This applies to a world format carrying the block serialization version
+22...25, used at least in
+- 0.4.dev-20120322 ... 0.4.dev-20120606 (22...23)
+- 0.4.0 (23)
+- 24 was never released as stable and existed for ~2 days
 
-The map data serialization version used is 22. It does not fully specify every
-aspect of this format; if compliance with this format is to be checked, it
-needs to be done by detecting if the files and data indeed follows it.
+The block serialization version does not fully specify every aspect of this
+format; if compliance with this format is to be checked, it needs to be
+done by detecting if the files and data indeed follows it.
 
 Legacy stuff
 =============
@@ -20,8 +23,8 @@ Files
 Everything is contained in a directory, the name of which is freeform, but
 often serves as the name of the world.
 
-Currently the authentication and ban data is stored on a per-world basis. It
-can be copied over from an old world to a newly created world.
+Currently the authentication and ban data is stored on a per-world basis.
+It can be copied over from an old world to a newly created world.
 
 World
 |-- auth.txt ----- Authentication data
@@ -260,17 +263,26 @@ u8 flags
 
 u8 content_width
 - Number of bytes in the content (param0) fields of nodes
-- Always 1
+if map format version <= 23:
+    - Always 1
+if map format version >= 24:
+    - Always 2
 
 u8 params_width
 - Number of bytes used for parameters per node
 - Always 2
 
 zlib-compressed node data:
-- content:
-  u8[4096]: param0 fields
-  u8[4096]: param1 fields
-  u8[4096]: param2 fields
+if content_width == 1:
+    - content:
+      u8[4096]: param0 fields
+      u8[4096]: param1 fields
+      u8[4096]: param2 fields
+if content_width == 2:
+    - content:
+      u16[4096]: param0 fields
+      u8[4096]: param1 fields
+      u8[4096]: param2 fields
 - The location of a node in each of those arrays is (z*16*16 + y*16 + x).
 
 zlib-compressed node metadata list
@@ -283,9 +295,19 @@ zlib-compressed node metadata list
     u16 content_size
     u8[content_size] (content of metadata)
 
-u16 mapblockobject_count
-- Always 0
-- Should be removed in version 23 (TODO)
+- Node timers
+if map format version == 23:
+  u8 unused version (always 0)
+if map format version == 24: (NOTE: Not released as stable)
+  u8 nodetimer_version
+  if nodetimer_version == 0:
+    (nothing else)
+  if nodetimer_version == 1:
+    u16 num_of_timers
+    foreach num_of_timers:
+      u16 timer position (z*16*16 + y*16 + x)
+      s32 timeout*1000
+      s32 elapsed*1000
 
 u8 static object version:
 - Always 0
@@ -315,17 +337,29 @@ foreach num_name_id_mappings
   u16 name_len
   u8[name_len] name
 
+- Node timers
+if map format version == 25:
+  u8 length of the data of a single timer (always 2+4+4=10)
+  u16 num_of_timers
+  foreach num_of_timers:
+    u16 timer position (z*16*16 + y*16 + x)
+    s32 timeout*1000
+    s32 elapsed*1000
+
 EOF.
 
 Format of nodes
 ----------------
 A node is composed of the u8 fields param0, param1 and param2.
 
-The content id of a node is determined as so:
-- If param0 < 0x80,
-    content_id = param0
-- Otherwise
-    content_id = (param0<<4) + (param2>>4)
+if map format version <= 23:
+    The content id of a node is determined as so:
+    - If param0 < 0x80,
+        content_id = param0
+    - Otherwise
+        content_id = (param0<<4) + (param2>>4)
+if map format version >= 24:
+    The content id of a node is param0.
 
 The purpose of param1 and param2 depend on the definition of the node.
 
@@ -371,6 +405,50 @@ Node metadata format
   u8[len] owner
   serialized inventory
 
+Static objects
+---------------
+Static objects are persistent freely moving objects in the world.
+
+Object types:
+1: Test object
+2: Item
+3: Rat (deprecated)
+4: Oerkki (deprecated)
+5: Firefly (deprecated)
+6: MobV2 (deprecated)
+7: LuaEntity
+
+1: Item:
+  u8 version
+  version 0:
+    u16 len
+    u8[len] itemstring
+
+7: LuaEntity:
+  u8 version
+  version 1:
+    u16 len
+    u8[len] entity name
+    u32 len
+    u8[len] static data
+    s16 hp
+    s32 velocity.x * 10000
+    s32 velocity.y * 10000
+    s32 velocity.z * 10000
+    s32 yaw * 1000
+
+Itemstring format
+------------------
+eg. 'default:dirt 5'
+eg. 'default:pick_wood 21323'
+eg. '"default:apple" 2'
+eg. 'default:apple'
+- The wear value in tools is 0...65535
+- There are also a number of older formats that you might stumble upon:
+eg. 'node "default:dirt" 5'
+eg. 'NodeItem default:dirt 5'
+eg. 'ToolItem WPick 21323'
+
 Inventory serialization format
 -------------------------------
 - The inventory serialization format is line-based